@maplab/hyperdoc 0.2.0 → 0.3.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.
@@ -1,549 +0,0 @@
1
- var AT=Object.defineProperty;var OT=(e,t,n)=>t in e?AT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ee=(e,t,n)=>OT(e,typeof t!="symbol"?t+"":t,n);function PT(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function Tk(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Nk={exports:{}},Cd={},Ak={exports:{}},ye={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var ga=Symbol.for("react.element"),IT=Symbol.for("react.portal"),DT=Symbol.for("react.fragment"),LT=Symbol.for("react.strict_mode"),_T=Symbol.for("react.profiler"),$T=Symbol.for("react.provider"),zT=Symbol.for("react.context"),jT=Symbol.for("react.forward_ref"),FT=Symbol.for("react.suspense"),BT=Symbol.for("react.memo"),VT=Symbol.for("react.lazy"),$v=Symbol.iterator;function HT(e){return e===null||typeof e!="object"?null:(e=$v&&e[$v]||e["@@iterator"],typeof e=="function"?e:null)}var Ok={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Pk=Object.assign,Ik={};function Ts(e,t,n){this.props=e,this.context=t,this.refs=Ik,this.updater=n||Ok}Ts.prototype.isReactComponent={};Ts.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ts.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Dk(){}Dk.prototype=Ts.prototype;function Km(e,t,n){this.props=e,this.context=t,this.refs=Ik,this.updater=n||Ok}var Jm=Km.prototype=new Dk;Jm.constructor=Km;Pk(Jm,Ts.prototype);Jm.isPureReactComponent=!0;var zv=Array.isArray,Lk=Object.prototype.hasOwnProperty,Qm={current:null},_k={key:!0,ref:!0,__self:!0,__source:!0};function $k(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)Lk.call(t,r)&&!_k.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(l===1)o.children=n;else if(1<l){for(var a=Array(l),u=0;u<l;u++)a[u]=arguments[u+2];o.children=a}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)o[r]===void 0&&(o[r]=l[r]);return{$$typeof:ga,type:e,key:i,ref:s,props:o,_owner:Qm.current}}function UT(e,t){return{$$typeof:ga,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Xm(e){return typeof e=="object"&&e!==null&&e.$$typeof===ga}function WT(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var jv=/\/+/g;function Pf(e,t){return typeof e=="object"&&e!==null&&e.key!=null?WT(""+e.key):t.toString(36)}function Ou(e,t,n,r,o){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case ga:case IT:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+Pf(s,0):r,zv(o)?(n="",e!=null&&(n=e.replace(jv,"$&/")+"/"),Ou(o,t,n,"",function(u){return u})):o!=null&&(Xm(o)&&(o=UT(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(jv,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",zv(e))for(var l=0;l<e.length;l++){i=e[l];var a=r+Pf(i,l);s+=Ou(i,t,n,a,o)}else if(a=HT(e),typeof a=="function")for(e=a.call(e),l=0;!(i=e.next()).done;)i=i.value,a=r+Pf(i,l++),s+=Ou(i,t,n,a,o);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function ja(e,t,n){if(e==null)return e;var r=[],o=0;return Ou(e,r,"","",function(i){return t.call(n,i,o++)}),r}function GT(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Nt={current:null},Pu={transition:null},qT={ReactCurrentDispatcher:Nt,ReactCurrentBatchConfig:Pu,ReactCurrentOwner:Qm};function zk(){throw Error("act(...) is not supported in production builds of React.")}ye.Children={map:ja,forEach:function(e,t,n){ja(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ja(e,function(){t++}),t},toArray:function(e){return ja(e,function(t){return t})||[]},only:function(e){if(!Xm(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ye.Component=Ts;ye.Fragment=DT;ye.Profiler=_T;ye.PureComponent=Km;ye.StrictMode=LT;ye.Suspense=FT;ye.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qT;ye.act=zk;ye.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Pk({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=Qm.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(a in t)Lk.call(t,a)&&!_k.hasOwnProperty(a)&&(r[a]=t[a]===void 0&&l!==void 0?l[a]:t[a])}var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){l=Array(a);for(var u=0;u<a;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:ga,type:e.type,key:o,ref:i,props:r,_owner:s}};ye.createContext=function(e){return e={$$typeof:zT,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:$T,_context:e},e.Consumer=e};ye.createElement=$k;ye.createFactory=function(e){var t=$k.bind(null,e);return t.type=e,t};ye.createRef=function(){return{current:null}};ye.forwardRef=function(e){return{$$typeof:jT,render:e}};ye.isValidElement=Xm;ye.lazy=function(e){return{$$typeof:VT,_payload:{_status:-1,_result:e},_init:GT}};ye.memo=function(e,t){return{$$typeof:BT,type:e,compare:t===void 0?null:t}};ye.startTransition=function(e){var t=Pu.transition;Pu.transition={};try{e()}finally{Pu.transition=t}};ye.unstable_act=zk;ye.useCallback=function(e,t){return Nt.current.useCallback(e,t)};ye.useContext=function(e){return Nt.current.useContext(e)};ye.useDebugValue=function(){};ye.useDeferredValue=function(e){return Nt.current.useDeferredValue(e)};ye.useEffect=function(e,t){return Nt.current.useEffect(e,t)};ye.useId=function(){return Nt.current.useId()};ye.useImperativeHandle=function(e,t,n){return Nt.current.useImperativeHandle(e,t,n)};ye.useInsertionEffect=function(e,t){return Nt.current.useInsertionEffect(e,t)};ye.useLayoutEffect=function(e,t){return Nt.current.useLayoutEffect(e,t)};ye.useMemo=function(e,t){return Nt.current.useMemo(e,t)};ye.useReducer=function(e,t,n){return Nt.current.useReducer(e,t,n)};ye.useRef=function(e){return Nt.current.useRef(e)};ye.useState=function(e){return Nt.current.useState(e)};ye.useSyncExternalStore=function(e,t,n){return Nt.current.useSyncExternalStore(e,t,n)};ye.useTransition=function(){return Nt.current.useTransition()};ye.version="18.3.1";Ak.exports=ye;var x=Ak.exports;const fn=Tk(x),Ed=PT({__proto__:null,default:fn},[x]);/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var KT=x,JT=Symbol.for("react.element"),QT=Symbol.for("react.fragment"),XT=Object.prototype.hasOwnProperty,YT=KT.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ZT={key:!0,ref:!0,__self:!0,__source:!0};function jk(e,t,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(s=t.ref);for(r in t)XT.call(t,r)&&!ZT.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:JT,type:e,key:i,ref:s,props:o,_owner:YT.current}}Cd.Fragment=QT;Cd.jsx=jk;Cd.jsxs=jk;Nk.exports=Cd;var w=Nk.exports,Fk={exports:{}},Xt={},Bk={exports:{}},Vk={};/**
18
- * @license React
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */(function(e){function t(N,j){var te=N.length;N.push(j);e:for(;0<te;){var he=te-1>>>1,A=N[he];if(0<o(A,j))N[he]=j,N[te]=A,te=he;else break e}}function n(N){return N.length===0?null:N[0]}function r(N){if(N.length===0)return null;var j=N[0],te=N.pop();if(te!==j){N[0]=te;e:for(var he=0,A=N.length,V=A>>>1;he<V;){var Y=2*(he+1)-1,G=N[Y],pe=Y+1,O=N[pe];if(0>o(G,te))pe<A&&0>o(O,G)?(N[he]=O,N[pe]=te,he=pe):(N[he]=G,N[Y]=te,he=Y);else if(pe<A&&0>o(O,te))N[he]=O,N[pe]=te,he=pe;else break e}}return j}function o(N,j){var te=N.sortIndex-j.sortIndex;return te!==0?te:N.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}var a=[],u=[],c=1,d=null,f=3,p=!1,h=!1,m=!1,y=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(N){for(var j=n(u);j!==null;){if(j.callback===null)r(u);else if(j.startTime<=N)r(u),j.sortIndex=j.expirationTime,t(a,j);else break;j=n(u)}}function S(N){if(m=!1,k(N),!h)if(n(a)!==null)h=!0,ue(b);else{var j=n(u);j!==null&&fe(S,j.startTime-N)}}function b(N,j){h=!1,m&&(m=!1,g(R),R=-1),p=!0;var te=f;try{for(k(j),d=n(a);d!==null&&(!(d.expirationTime>j)||N&&!J());){var he=d.callback;if(typeof he=="function"){d.callback=null,f=d.priorityLevel;var A=he(d.expirationTime<=j);j=e.unstable_now(),typeof A=="function"?d.callback=A:d===n(a)&&r(a),k(j)}else r(a);d=n(a)}if(d!==null)var V=!0;else{var Y=n(u);Y!==null&&fe(S,Y.startTime-j),V=!1}return V}finally{d=null,f=te,p=!1}}var E=!1,M=null,R=-1,D=5,I=-1;function J(){return!(e.unstable_now()-I<D)}function ne(){if(M!==null){var N=e.unstable_now();I=N;var j=!0;try{j=M(!0,N)}finally{j?re():(E=!1,M=null)}}else E=!1}var re;if(typeof v=="function")re=function(){v(ne)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,ie=U.port2;U.port1.onmessage=ne,re=function(){ie.postMessage(null)}}else re=function(){y(ne,0)};function ue(N){M=N,E||(E=!0,re())}function fe(N,j){R=y(function(){N(e.unstable_now())},j)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(N){N.callback=null},e.unstable_continueExecution=function(){h||p||(h=!0,ue(b))},e.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<N?Math.floor(1e3/N):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(a)},e.unstable_next=function(N){switch(f){case 1:case 2:case 3:var j=3;break;default:j=f}var te=f;f=j;try{return N()}finally{f=te}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(N,j){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var te=f;f=N;try{return j()}finally{f=te}},e.unstable_scheduleCallback=function(N,j,te){var he=e.unstable_now();switch(typeof te=="object"&&te!==null?(te=te.delay,te=typeof te=="number"&&0<te?he+te:he):te=he,N){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=te+A,N={id:c++,callback:j,priorityLevel:N,startTime:te,expirationTime:A,sortIndex:-1},te>he?(N.sortIndex=te,t(u,N),n(a)===null&&N===n(u)&&(m?(g(R),R=-1):m=!0,fe(S,te-he))):(N.sortIndex=A,t(a,N),h||p||(h=!0,ue(b))),N},e.unstable_shouldYield=J,e.unstable_wrapCallback=function(N){var j=f;return function(){var te=f;f=j;try{return N.apply(this,arguments)}finally{f=te}}}})(Vk);Bk.exports=Vk;var eN=Bk.exports;/**
26
- * @license React
27
- * react-dom.production.min.js
28
- *
29
- * Copyright (c) Facebook, Inc. and its affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var tN=x,Jt=eN;function z(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Hk=new Set,$l={};function ui(e,t){ds(e,t),ds(e+"Capture",t)}function ds(e,t){for($l[e]=t,e=0;e<t.length;e++)Hk.add(t[e])}var Sr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),th=Object.prototype.hasOwnProperty,nN=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Fv={},Bv={};function rN(e){return th.call(Bv,e)?!0:th.call(Fv,e)?!1:nN.test(e)?Bv[e]=!0:(Fv[e]=!0,!1)}function oN(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function iN(e,t,n,r){if(t===null||typeof t>"u"||oN(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function At(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var pt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){pt[e]=new At(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];pt[t]=new At(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){pt[e]=new At(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){pt[e]=new At(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){pt[e]=new At(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){pt[e]=new At(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){pt[e]=new At(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){pt[e]=new At(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){pt[e]=new At(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ym=/[\-:]([a-z])/g;function Zm(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Ym,Zm);pt[t]=new At(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Ym,Zm);pt[t]=new At(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Ym,Zm);pt[t]=new At(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){pt[e]=new At(e,1,!1,e.toLowerCase(),null,!1,!1)});pt.xlinkHref=new At("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){pt[e]=new At(e,1,!1,e.toLowerCase(),null,!0,!0)});function eg(e,t,n,r){var o=pt.hasOwnProperty(t)?pt[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(iN(t,n,o,r)&&(n=null),r||o===null?rN(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Mr=tN.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Fa=Symbol.for("react.element"),Bi=Symbol.for("react.portal"),Vi=Symbol.for("react.fragment"),tg=Symbol.for("react.strict_mode"),nh=Symbol.for("react.profiler"),Uk=Symbol.for("react.provider"),Wk=Symbol.for("react.context"),ng=Symbol.for("react.forward_ref"),rh=Symbol.for("react.suspense"),oh=Symbol.for("react.suspense_list"),rg=Symbol.for("react.memo"),Fr=Symbol.for("react.lazy"),Gk=Symbol.for("react.offscreen"),Vv=Symbol.iterator;function Hs(e){return e===null||typeof e!="object"?null:(e=Vv&&e[Vv]||e["@@iterator"],typeof e=="function"?e:null)}var Be=Object.assign,If;function il(e){if(If===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);If=t&&t[1]||""}return`
34
- `+If+e}var Df=!1;function Lf(e,t){if(!e||Df)return"";Df=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var o=u.stack.split(`
35
- `),i=r.stack.split(`
36
- `),s=o.length-1,l=i.length-1;1<=s&&0<=l&&o[s]!==i[l];)l--;for(;1<=s&&0<=l;s--,l--)if(o[s]!==i[l]){if(s!==1||l!==1)do if(s--,l--,0>l||o[s]!==i[l]){var a=`
37
- `+o[s].replace(" at new "," at ");return e.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",e.displayName)),a}while(1<=s&&0<=l);break}}}finally{Df=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?il(e):""}function sN(e){switch(e.tag){case 5:return il(e.type);case 16:return il("Lazy");case 13:return il("Suspense");case 19:return il("SuspenseList");case 0:case 2:case 15:return e=Lf(e.type,!1),e;case 11:return e=Lf(e.type.render,!1),e;case 1:return e=Lf(e.type,!0),e;default:return""}}function ih(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Vi:return"Fragment";case Bi:return"Portal";case nh:return"Profiler";case tg:return"StrictMode";case rh:return"Suspense";case oh:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Wk:return(e.displayName||"Context")+".Consumer";case Uk:return(e._context.displayName||"Context")+".Provider";case ng:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case rg:return t=e.displayName||null,t!==null?t:ih(e.type)||"Memo";case Fr:t=e._payload,e=e._init;try{return ih(e(t))}catch{}}return null}function lN(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ih(t);case 8:return t===tg?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function yo(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qk(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function aN(e){var t=qk(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ba(e){e._valueTracker||(e._valueTracker=aN(e))}function Kk(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=qk(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ec(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function sh(e,t){var n=t.checked;return Be({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Hv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=yo(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Jk(e,t){t=t.checked,t!=null&&eg(e,"checked",t,!1)}function lh(e,t){Jk(e,t);var n=yo(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ah(e,t.type,n):t.hasOwnProperty("defaultValue")&&ah(e,t.type,yo(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Uv(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ah(e,t,n){(t!=="number"||ec(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var sl=Array.isArray;function es(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+yo(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function uh(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(z(91));return Be({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Wv(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(z(92));if(sl(n)){if(1<n.length)throw Error(z(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:yo(n)}}function Qk(e,t){var n=yo(t.value),r=yo(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Gv(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Xk(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ch(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Xk(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Va,Yk=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Va=Va||document.createElement("div"),Va.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Va.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function zl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var gl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},uN=["Webkit","ms","Moz","O"];Object.keys(gl).forEach(function(e){uN.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),gl[t]=gl[e]})});function Zk(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||gl.hasOwnProperty(e)&&gl[e]?(""+t).trim():t+"px"}function e1(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=Zk(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var cN=Be({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function dh(e,t){if(t){if(cN[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(z(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(z(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(z(61))}if(t.style!=null&&typeof t.style!="object")throw Error(z(62))}}function fh(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ph=null;function og(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var hh=null,ts=null,ns=null;function qv(e){if(e=xa(e)){if(typeof hh!="function")throw Error(z(280));var t=e.stateNode;t&&(t=Ad(t),hh(e.stateNode,e.type,t))}}function t1(e){ts?ns?ns.push(e):ns=[e]:ts=e}function n1(){if(ts){var e=ts,t=ns;if(ns=ts=null,qv(e),t)for(e=0;e<t.length;e++)qv(t[e])}}function r1(e,t){return e(t)}function o1(){}var _f=!1;function i1(e,t,n){if(_f)return e(t,n);_f=!0;try{return r1(e,t,n)}finally{_f=!1,(ts!==null||ns!==null)&&(o1(),n1())}}function jl(e,t){var n=e.stateNode;if(n===null)return null;var r=Ad(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(z(231,t,typeof n));return n}var mh=!1;if(Sr)try{var Us={};Object.defineProperty(Us,"passive",{get:function(){mh=!0}}),window.addEventListener("test",Us,Us),window.removeEventListener("test",Us,Us)}catch{mh=!1}function dN(e,t,n,r,o,i,s,l,a){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(c){this.onError(c)}}var yl=!1,tc=null,nc=!1,gh=null,fN={onError:function(e){yl=!0,tc=e}};function pN(e,t,n,r,o,i,s,l,a){yl=!1,tc=null,dN.apply(fN,arguments)}function hN(e,t,n,r,o,i,s,l,a){if(pN.apply(this,arguments),yl){if(yl){var u=tc;yl=!1,tc=null}else throw Error(z(198));nc||(nc=!0,gh=u)}}function ci(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s1(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Kv(e){if(ci(e)!==e)throw Error(z(188))}function mN(e){var t=e.alternate;if(!t){if(t=ci(e),t===null)throw Error(z(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return Kv(o),e;if(i===r)return Kv(o),t;i=i.sibling}throw Error(z(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,l=o.child;l;){if(l===n){s=!0,n=o,r=i;break}if(l===r){s=!0,r=o,n=i;break}l=l.sibling}if(!s){for(l=i.child;l;){if(l===n){s=!0,n=i,r=o;break}if(l===r){s=!0,r=i,n=o;break}l=l.sibling}if(!s)throw Error(z(189))}}if(n.alternate!==r)throw Error(z(190))}if(n.tag!==3)throw Error(z(188));return n.stateNode.current===n?e:t}function l1(e){return e=mN(e),e!==null?a1(e):null}function a1(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=a1(e);if(t!==null)return t;e=e.sibling}return null}var u1=Jt.unstable_scheduleCallback,Jv=Jt.unstable_cancelCallback,gN=Jt.unstable_shouldYield,yN=Jt.unstable_requestPaint,We=Jt.unstable_now,vN=Jt.unstable_getCurrentPriorityLevel,ig=Jt.unstable_ImmediatePriority,c1=Jt.unstable_UserBlockingPriority,rc=Jt.unstable_NormalPriority,xN=Jt.unstable_LowPriority,d1=Jt.unstable_IdlePriority,Md=null,Wn=null;function wN(e){if(Wn&&typeof Wn.onCommitFiberRoot=="function")try{Wn.onCommitFiberRoot(Md,e,void 0,(e.current.flags&128)===128)}catch{}}var Tn=Math.clz32?Math.clz32:bN,kN=Math.log,SN=Math.LN2;function bN(e){return e>>>=0,e===0?32:31-(kN(e)/SN|0)|0}var Ha=64,Ua=4194304;function ll(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function oc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var l=s&~o;l!==0?r=ll(l):(i&=s,i!==0&&(r=ll(i)))}else s=n&~o,s!==0?r=ll(s):i!==0&&(r=ll(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Tn(t),o=1<<n,r|=e[n],t&=~o;return r}function CN(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function EN(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-Tn(i),l=1<<s,a=o[s];a===-1?(!(l&n)||l&r)&&(o[s]=CN(l,t)):a<=t&&(e.expiredLanes|=l),i&=~l}}function yh(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function f1(){var e=Ha;return Ha<<=1,!(Ha&4194240)&&(Ha=64),e}function $f(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ya(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Tn(t),e[t]=n}function MN(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-Tn(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function sg(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Tn(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var Ce=0;function p1(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var h1,lg,m1,g1,y1,vh=!1,Wa=[],no=null,ro=null,oo=null,Fl=new Map,Bl=new Map,Wr=[],RN="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Qv(e,t){switch(e){case"focusin":case"focusout":no=null;break;case"dragenter":case"dragleave":ro=null;break;case"mouseover":case"mouseout":oo=null;break;case"pointerover":case"pointerout":Fl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Bl.delete(t.pointerId)}}function Ws(e,t,n,r,o,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},t!==null&&(t=xa(t),t!==null&&lg(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function TN(e,t,n,r,o){switch(t){case"focusin":return no=Ws(no,e,t,n,r,o),!0;case"dragenter":return ro=Ws(ro,e,t,n,r,o),!0;case"mouseover":return oo=Ws(oo,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return Fl.set(i,Ws(Fl.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Bl.set(i,Ws(Bl.get(i)||null,e,t,n,r,o)),!0}return!1}function v1(e){var t=$o(e.target);if(t!==null){var n=ci(t);if(n!==null){if(t=n.tag,t===13){if(t=s1(n),t!==null){e.blockedOn=t,y1(e.priority,function(){m1(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Iu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=xh(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);ph=r,n.target.dispatchEvent(r),ph=null}else return t=xa(n),t!==null&&lg(t),e.blockedOn=n,!1;t.shift()}return!0}function Xv(e,t,n){Iu(e)&&n.delete(t)}function NN(){vh=!1,no!==null&&Iu(no)&&(no=null),ro!==null&&Iu(ro)&&(ro=null),oo!==null&&Iu(oo)&&(oo=null),Fl.forEach(Xv),Bl.forEach(Xv)}function Gs(e,t){e.blockedOn===t&&(e.blockedOn=null,vh||(vh=!0,Jt.unstable_scheduleCallback(Jt.unstable_NormalPriority,NN)))}function Vl(e){function t(o){return Gs(o,e)}if(0<Wa.length){Gs(Wa[0],e);for(var n=1;n<Wa.length;n++){var r=Wa[n];r.blockedOn===e&&(r.blockedOn=null)}}for(no!==null&&Gs(no,e),ro!==null&&Gs(ro,e),oo!==null&&Gs(oo,e),Fl.forEach(t),Bl.forEach(t),n=0;n<Wr.length;n++)r=Wr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Wr.length&&(n=Wr[0],n.blockedOn===null);)v1(n),n.blockedOn===null&&Wr.shift()}var rs=Mr.ReactCurrentBatchConfig,ic=!0;function AN(e,t,n,r){var o=Ce,i=rs.transition;rs.transition=null;try{Ce=1,ag(e,t,n,r)}finally{Ce=o,rs.transition=i}}function ON(e,t,n,r){var o=Ce,i=rs.transition;rs.transition=null;try{Ce=4,ag(e,t,n,r)}finally{Ce=o,rs.transition=i}}function ag(e,t,n,r){if(ic){var o=xh(e,t,n,r);if(o===null)qf(e,t,r,sc,n),Qv(e,r);else if(TN(o,e,t,n,r))r.stopPropagation();else if(Qv(e,r),t&4&&-1<RN.indexOf(e)){for(;o!==null;){var i=xa(o);if(i!==null&&h1(i),i=xh(e,t,n,r),i===null&&qf(e,t,r,sc,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else qf(e,t,r,null,n)}}var sc=null;function xh(e,t,n,r){if(sc=null,e=og(r),e=$o(e),e!==null)if(t=ci(e),t===null)e=null;else if(n=t.tag,n===13){if(e=s1(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return sc=e,null}function x1(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(vN()){case ig:return 1;case c1:return 4;case rc:case xN:return 16;case d1:return 536870912;default:return 16}default:return 16}}var Jr=null,ug=null,Du=null;function w1(){if(Du)return Du;var e,t=ug,n=t.length,r,o="value"in Jr?Jr.value:Jr.textContent,i=o.length;for(e=0;e<n&&t[e]===o[e];e++);var s=n-e;for(r=1;r<=s&&t[n-r]===o[i-r];r++);return Du=o.slice(e,1<r?1-r:void 0)}function Lu(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Ga(){return!0}function Yv(){return!1}function Yt(e){function t(n,r,o,i,s){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Ga:Yv,this.isPropagationStopped=Yv,this}return Be(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Ga)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ga)},persist:function(){},isPersistent:Ga}),t}var Ns={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},cg=Yt(Ns),va=Be({},Ns,{view:0,detail:0}),PN=Yt(va),zf,jf,qs,Rd=Be({},va,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dg,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==qs&&(qs&&e.type==="mousemove"?(zf=e.screenX-qs.screenX,jf=e.screenY-qs.screenY):jf=zf=0,qs=e),zf)},movementY:function(e){return"movementY"in e?e.movementY:jf}}),Zv=Yt(Rd),IN=Be({},Rd,{dataTransfer:0}),DN=Yt(IN),LN=Be({},va,{relatedTarget:0}),Ff=Yt(LN),_N=Be({},Ns,{animationName:0,elapsedTime:0,pseudoElement:0}),$N=Yt(_N),zN=Be({},Ns,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),jN=Yt(zN),FN=Be({},Ns,{data:0}),e0=Yt(FN),BN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},VN={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},HN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function UN(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=HN[e])?!!t[e]:!1}function dg(){return UN}var WN=Be({},va,{key:function(e){if(e.key){var t=BN[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Lu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?VN[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dg,charCode:function(e){return e.type==="keypress"?Lu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Lu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),GN=Yt(WN),qN=Be({},Rd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),t0=Yt(qN),KN=Be({},va,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dg}),JN=Yt(KN),QN=Be({},Ns,{propertyName:0,elapsedTime:0,pseudoElement:0}),XN=Yt(QN),YN=Be({},Rd,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),ZN=Yt(YN),eA=[9,13,27,32],fg=Sr&&"CompositionEvent"in window,vl=null;Sr&&"documentMode"in document&&(vl=document.documentMode);var tA=Sr&&"TextEvent"in window&&!vl,k1=Sr&&(!fg||vl&&8<vl&&11>=vl),n0=" ",r0=!1;function S1(e,t){switch(e){case"keyup":return eA.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function b1(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Hi=!1;function nA(e,t){switch(e){case"compositionend":return b1(t);case"keypress":return t.which!==32?null:(r0=!0,n0);case"textInput":return e=t.data,e===n0&&r0?null:e;default:return null}}function rA(e,t){if(Hi)return e==="compositionend"||!fg&&S1(e,t)?(e=w1(),Du=ug=Jr=null,Hi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return k1&&t.locale!=="ko"?null:t.data;default:return null}}var oA={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function o0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!oA[e.type]:t==="textarea"}function C1(e,t,n,r){t1(r),t=lc(t,"onChange"),0<t.length&&(n=new cg("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var xl=null,Hl=null;function iA(e){L1(e,0)}function Td(e){var t=Gi(e);if(Kk(t))return e}function sA(e,t){if(e==="change")return t}var E1=!1;if(Sr){var Bf;if(Sr){var Vf="oninput"in document;if(!Vf){var i0=document.createElement("div");i0.setAttribute("oninput","return;"),Vf=typeof i0.oninput=="function"}Bf=Vf}else Bf=!1;E1=Bf&&(!document.documentMode||9<document.documentMode)}function s0(){xl&&(xl.detachEvent("onpropertychange",M1),Hl=xl=null)}function M1(e){if(e.propertyName==="value"&&Td(Hl)){var t=[];C1(t,Hl,e,og(e)),i1(iA,t)}}function lA(e,t,n){e==="focusin"?(s0(),xl=t,Hl=n,xl.attachEvent("onpropertychange",M1)):e==="focusout"&&s0()}function aA(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Td(Hl)}function uA(e,t){if(e==="click")return Td(t)}function cA(e,t){if(e==="input"||e==="change")return Td(t)}function dA(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Pn=typeof Object.is=="function"?Object.is:dA;function Ul(e,t){if(Pn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!th.call(t,o)||!Pn(e[o],t[o]))return!1}return!0}function l0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function a0(e,t){var n=l0(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=l0(n)}}function R1(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?R1(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function T1(){for(var e=window,t=ec();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ec(e.document)}return t}function pg(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function fA(e){var t=T1(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&R1(n.ownerDocument.documentElement,n)){if(r!==null&&pg(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=a0(n,i);var s=a0(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var pA=Sr&&"documentMode"in document&&11>=document.documentMode,Ui=null,wh=null,wl=null,kh=!1;function u0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;kh||Ui==null||Ui!==ec(r)||(r=Ui,"selectionStart"in r&&pg(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),wl&&Ul(wl,r)||(wl=r,r=lc(wh,"onSelect"),0<r.length&&(t=new cg("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Ui)))}function qa(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Wi={animationend:qa("Animation","AnimationEnd"),animationiteration:qa("Animation","AnimationIteration"),animationstart:qa("Animation","AnimationStart"),transitionend:qa("Transition","TransitionEnd")},Hf={},N1={};Sr&&(N1=document.createElement("div").style,"AnimationEvent"in window||(delete Wi.animationend.animation,delete Wi.animationiteration.animation,delete Wi.animationstart.animation),"TransitionEvent"in window||delete Wi.transitionend.transition);function Nd(e){if(Hf[e])return Hf[e];if(!Wi[e])return e;var t=Wi[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in N1)return Hf[e]=t[n];return e}var A1=Nd("animationend"),O1=Nd("animationiteration"),P1=Nd("animationstart"),I1=Nd("transitionend"),D1=new Map,c0="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Eo(e,t){D1.set(e,t),ui(t,[e])}for(var Uf=0;Uf<c0.length;Uf++){var Wf=c0[Uf],hA=Wf.toLowerCase(),mA=Wf[0].toUpperCase()+Wf.slice(1);Eo(hA,"on"+mA)}Eo(A1,"onAnimationEnd");Eo(O1,"onAnimationIteration");Eo(P1,"onAnimationStart");Eo("dblclick","onDoubleClick");Eo("focusin","onFocus");Eo("focusout","onBlur");Eo(I1,"onTransitionEnd");ds("onMouseEnter",["mouseout","mouseover"]);ds("onMouseLeave",["mouseout","mouseover"]);ds("onPointerEnter",["pointerout","pointerover"]);ds("onPointerLeave",["pointerout","pointerover"]);ui("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ui("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ui("onBeforeInput",["compositionend","keypress","textInput","paste"]);ui("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ui("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ui("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var al="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),gA=new Set("cancel close invalid load scroll toggle".split(" ").concat(al));function d0(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,hN(r,t,void 0,e),e.currentTarget=null}function L1(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var s=r.length-1;0<=s;s--){var l=r[s],a=l.instance,u=l.currentTarget;if(l=l.listener,a!==i&&o.isPropagationStopped())break e;d0(o,l,u),i=a}else for(s=0;s<r.length;s++){if(l=r[s],a=l.instance,u=l.currentTarget,l=l.listener,a!==i&&o.isPropagationStopped())break e;d0(o,l,u),i=a}}}if(nc)throw e=gh,nc=!1,gh=null,e}function Ae(e,t){var n=t[Mh];n===void 0&&(n=t[Mh]=new Set);var r=e+"__bubble";n.has(r)||(_1(t,e,2,!1),n.add(r))}function Gf(e,t,n){var r=0;t&&(r|=4),_1(n,e,r,t)}var Ka="_reactListening"+Math.random().toString(36).slice(2);function Wl(e){if(!e[Ka]){e[Ka]=!0,Hk.forEach(function(n){n!=="selectionchange"&&(gA.has(n)||Gf(n,!1,e),Gf(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ka]||(t[Ka]=!0,Gf("selectionchange",!1,t))}}function _1(e,t,n,r){switch(x1(t)){case 1:var o=AN;break;case 4:o=ON;break;default:o=ag}n=o.bind(null,t,n,e),o=void 0,!mh||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function qf(e,t,n,r,o){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var l=r.stateNode.containerInfo;if(l===o||l.nodeType===8&&l.parentNode===o)break;if(s===4)for(s=r.return;s!==null;){var a=s.tag;if((a===3||a===4)&&(a=s.stateNode.containerInfo,a===o||a.nodeType===8&&a.parentNode===o))return;s=s.return}for(;l!==null;){if(s=$o(l),s===null)return;if(a=s.tag,a===5||a===6){r=i=s;continue e}l=l.parentNode}}r=r.return}i1(function(){var u=i,c=og(n),d=[];e:{var f=D1.get(e);if(f!==void 0){var p=cg,h=e;switch(e){case"keypress":if(Lu(n)===0)break e;case"keydown":case"keyup":p=GN;break;case"focusin":h="focus",p=Ff;break;case"focusout":h="blur",p=Ff;break;case"beforeblur":case"afterblur":p=Ff;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Zv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=DN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=JN;break;case A1:case O1:case P1:p=$N;break;case I1:p=XN;break;case"scroll":p=PN;break;case"wheel":p=ZN;break;case"copy":case"cut":case"paste":p=jN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=t0}var m=(t&4)!==0,y=!m&&e==="scroll",g=m?f!==null?f+"Capture":null:f;m=[];for(var v=u,k;v!==null;){k=v;var S=k.stateNode;if(k.tag===5&&S!==null&&(k=S,g!==null&&(S=jl(v,g),S!=null&&m.push(Gl(v,S,k)))),y)break;v=v.return}0<m.length&&(f=new p(f,h,null,n,c),d.push({event:f,listeners:m}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&n!==ph&&(h=n.relatedTarget||n.fromElement)&&($o(h)||h[br]))break e;if((p||f)&&(f=c.window===c?c:(f=c.ownerDocument)?f.defaultView||f.parentWindow:window,p?(h=n.relatedTarget||n.toElement,p=u,h=h?$o(h):null,h!==null&&(y=ci(h),h!==y||h.tag!==5&&h.tag!==6)&&(h=null)):(p=null,h=u),p!==h)){if(m=Zv,S="onMouseLeave",g="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(m=t0,S="onPointerLeave",g="onPointerEnter",v="pointer"),y=p==null?f:Gi(p),k=h==null?f:Gi(h),f=new m(S,v+"leave",p,n,c),f.target=y,f.relatedTarget=k,S=null,$o(c)===u&&(m=new m(g,v+"enter",h,n,c),m.target=k,m.relatedTarget=y,S=m),y=S,p&&h)t:{for(m=p,g=h,v=0,k=m;k;k=Ti(k))v++;for(k=0,S=g;S;S=Ti(S))k++;for(;0<v-k;)m=Ti(m),v--;for(;0<k-v;)g=Ti(g),k--;for(;v--;){if(m===g||g!==null&&m===g.alternate)break t;m=Ti(m),g=Ti(g)}m=null}else m=null;p!==null&&f0(d,f,p,m,!1),h!==null&&y!==null&&f0(d,y,h,m,!0)}}e:{if(f=u?Gi(u):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var b=sA;else if(o0(f))if(E1)b=cA;else{b=aA;var E=lA}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(b=uA);if(b&&(b=b(e,u))){C1(d,b,n,c);break e}E&&E(e,f,u),e==="focusout"&&(E=f._wrapperState)&&E.controlled&&f.type==="number"&&ah(f,"number",f.value)}switch(E=u?Gi(u):window,e){case"focusin":(o0(E)||E.contentEditable==="true")&&(Ui=E,wh=u,wl=null);break;case"focusout":wl=wh=Ui=null;break;case"mousedown":kh=!0;break;case"contextmenu":case"mouseup":case"dragend":kh=!1,u0(d,n,c);break;case"selectionchange":if(pA)break;case"keydown":case"keyup":u0(d,n,c)}var M;if(fg)e:{switch(e){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else Hi?S1(e,n)&&(R="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&(k1&&n.locale!=="ko"&&(Hi||R!=="onCompositionStart"?R==="onCompositionEnd"&&Hi&&(M=w1()):(Jr=c,ug="value"in Jr?Jr.value:Jr.textContent,Hi=!0)),E=lc(u,R),0<E.length&&(R=new e0(R,e,null,n,c),d.push({event:R,listeners:E}),M?R.data=M:(M=b1(n),M!==null&&(R.data=M)))),(M=tA?nA(e,n):rA(e,n))&&(u=lc(u,"onBeforeInput"),0<u.length&&(c=new e0("onBeforeInput","beforeinput",null,n,c),d.push({event:c,listeners:u}),c.data=M))}L1(d,t)})}function Gl(e,t,n){return{instance:e,listener:t,currentTarget:n}}function lc(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=jl(e,n),i!=null&&r.unshift(Gl(e,i,o)),i=jl(e,t),i!=null&&r.push(Gl(e,i,o))),e=e.return}return r}function Ti(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function f0(e,t,n,r,o){for(var i=t._reactName,s=[];n!==null&&n!==r;){var l=n,a=l.alternate,u=l.stateNode;if(a!==null&&a===r)break;l.tag===5&&u!==null&&(l=u,o?(a=jl(n,i),a!=null&&s.unshift(Gl(n,a,l))):o||(a=jl(n,i),a!=null&&s.push(Gl(n,a,l)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var yA=/\r\n?/g,vA=/\u0000|\uFFFD/g;function p0(e){return(typeof e=="string"?e:""+e).replace(yA,`
38
- `).replace(vA,"")}function Ja(e,t,n){if(t=p0(t),p0(e)!==t&&n)throw Error(z(425))}function ac(){}var Sh=null,bh=null;function Ch(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Eh=typeof setTimeout=="function"?setTimeout:void 0,xA=typeof clearTimeout=="function"?clearTimeout:void 0,h0=typeof Promise=="function"?Promise:void 0,wA=typeof queueMicrotask=="function"?queueMicrotask:typeof h0<"u"?function(e){return h0.resolve(null).then(e).catch(kA)}:Eh;function kA(e){setTimeout(function(){throw e})}function Kf(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),Vl(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Vl(t)}function io(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function m0(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var As=Math.random().toString(36).slice(2),Vn="__reactFiber$"+As,ql="__reactProps$"+As,br="__reactContainer$"+As,Mh="__reactEvents$"+As,SA="__reactListeners$"+As,bA="__reactHandles$"+As;function $o(e){var t=e[Vn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[br]||n[Vn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=m0(e);e!==null;){if(n=e[Vn])return n;e=m0(e)}return t}e=n,n=e.parentNode}return null}function xa(e){return e=e[Vn]||e[br],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Gi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(z(33))}function Ad(e){return e[ql]||null}var Rh=[],qi=-1;function Mo(e){return{current:e}}function Pe(e){0>qi||(e.current=Rh[qi],Rh[qi]=null,qi--)}function Ne(e,t){qi++,Rh[qi]=e.current,e.current=t}var vo={},wt=Mo(vo),_t=Mo(!1),Qo=vo;function fs(e,t){var n=e.type.contextTypes;if(!n)return vo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function $t(e){return e=e.childContextTypes,e!=null}function uc(){Pe(_t),Pe(wt)}function g0(e,t,n){if(wt.current!==vo)throw Error(z(168));Ne(wt,t),Ne(_t,n)}function $1(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(z(108,lN(e)||"Unknown",o));return Be({},n,r)}function cc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||vo,Qo=wt.current,Ne(wt,e),Ne(_t,_t.current),!0}function y0(e,t,n){var r=e.stateNode;if(!r)throw Error(z(169));n?(e=$1(e,t,Qo),r.__reactInternalMemoizedMergedChildContext=e,Pe(_t),Pe(wt),Ne(wt,e)):Pe(_t),Ne(_t,n)}var dr=null,Od=!1,Jf=!1;function z1(e){dr===null?dr=[e]:dr.push(e)}function CA(e){Od=!0,z1(e)}function Ro(){if(!Jf&&dr!==null){Jf=!0;var e=0,t=Ce;try{var n=dr;for(Ce=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}dr=null,Od=!1}catch(o){throw dr!==null&&(dr=dr.slice(e+1)),u1(ig,Ro),o}finally{Ce=t,Jf=!1}}return null}var Ki=[],Ji=0,dc=null,fc=0,on=[],sn=0,Xo=null,pr=1,hr="";function Do(e,t){Ki[Ji++]=fc,Ki[Ji++]=dc,dc=e,fc=t}function j1(e,t,n){on[sn++]=pr,on[sn++]=hr,on[sn++]=Xo,Xo=e;var r=pr;e=hr;var o=32-Tn(r)-1;r&=~(1<<o),n+=1;var i=32-Tn(t)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,pr=1<<32-Tn(t)+o|n<<o|r,hr=i+e}else pr=1<<i|n<<o|r,hr=e}function hg(e){e.return!==null&&(Do(e,1),j1(e,1,0))}function mg(e){for(;e===dc;)dc=Ki[--Ji],Ki[Ji]=null,fc=Ki[--Ji],Ki[Ji]=null;for(;e===Xo;)Xo=on[--sn],on[sn]=null,hr=on[--sn],on[sn]=null,pr=on[--sn],on[sn]=null}var Gt=null,Wt=null,Le=!1,bn=null;function F1(e,t){var n=an(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function v0(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Gt=e,Wt=io(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Gt=e,Wt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Xo!==null?{id:pr,overflow:hr}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=an(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Gt=e,Wt=null,!0):!1;default:return!1}}function Th(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Nh(e){if(Le){var t=Wt;if(t){var n=t;if(!v0(e,t)){if(Th(e))throw Error(z(418));t=io(n.nextSibling);var r=Gt;t&&v0(e,t)?F1(r,n):(e.flags=e.flags&-4097|2,Le=!1,Gt=e)}}else{if(Th(e))throw Error(z(418));e.flags=e.flags&-4097|2,Le=!1,Gt=e}}}function x0(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Gt=e}function Qa(e){if(e!==Gt)return!1;if(!Le)return x0(e),Le=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Ch(e.type,e.memoizedProps)),t&&(t=Wt)){if(Th(e))throw B1(),Error(z(418));for(;t;)F1(e,t),t=io(t.nextSibling)}if(x0(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(z(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Wt=io(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Wt=null}}else Wt=Gt?io(e.stateNode.nextSibling):null;return!0}function B1(){for(var e=Wt;e;)e=io(e.nextSibling)}function ps(){Wt=Gt=null,Le=!1}function gg(e){bn===null?bn=[e]:bn.push(e)}var EA=Mr.ReactCurrentBatchConfig;function Ks(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(z(309));var r=n.stateNode}if(!r)throw Error(z(147,e));var o=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(s){var l=o.refs;s===null?delete l[i]:l[i]=s},t._stringRef=i,t)}if(typeof e!="string")throw Error(z(284));if(!n._owner)throw Error(z(290,e))}return e}function Xa(e,t){throw e=Object.prototype.toString.call(t),Error(z(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function w0(e){var t=e._init;return t(e._payload)}function V1(e){function t(g,v){if(e){var k=g.deletions;k===null?(g.deletions=[v],g.flags|=16):k.push(v)}}function n(g,v){if(!e)return null;for(;v!==null;)t(g,v),v=v.sibling;return null}function r(g,v){for(g=new Map;v!==null;)v.key!==null?g.set(v.key,v):g.set(v.index,v),v=v.sibling;return g}function o(g,v){return g=uo(g,v),g.index=0,g.sibling=null,g}function i(g,v,k){return g.index=k,e?(k=g.alternate,k!==null?(k=k.index,k<v?(g.flags|=2,v):k):(g.flags|=2,v)):(g.flags|=1048576,v)}function s(g){return e&&g.alternate===null&&(g.flags|=2),g}function l(g,v,k,S){return v===null||v.tag!==6?(v=np(k,g.mode,S),v.return=g,v):(v=o(v,k),v.return=g,v)}function a(g,v,k,S){var b=k.type;return b===Vi?c(g,v,k.props.children,S,k.key):v!==null&&(v.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Fr&&w0(b)===v.type)?(S=o(v,k.props),S.ref=Ks(g,v,k),S.return=g,S):(S=Vu(k.type,k.key,k.props,null,g.mode,S),S.ref=Ks(g,v,k),S.return=g,S)}function u(g,v,k,S){return v===null||v.tag!==4||v.stateNode.containerInfo!==k.containerInfo||v.stateNode.implementation!==k.implementation?(v=rp(k,g.mode,S),v.return=g,v):(v=o(v,k.children||[]),v.return=g,v)}function c(g,v,k,S,b){return v===null||v.tag!==7?(v=Uo(k,g.mode,S,b),v.return=g,v):(v=o(v,k),v.return=g,v)}function d(g,v,k){if(typeof v=="string"&&v!==""||typeof v=="number")return v=np(""+v,g.mode,k),v.return=g,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Fa:return k=Vu(v.type,v.key,v.props,null,g.mode,k),k.ref=Ks(g,null,v),k.return=g,k;case Bi:return v=rp(v,g.mode,k),v.return=g,v;case Fr:var S=v._init;return d(g,S(v._payload),k)}if(sl(v)||Hs(v))return v=Uo(v,g.mode,k,null),v.return=g,v;Xa(g,v)}return null}function f(g,v,k,S){var b=v!==null?v.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return b!==null?null:l(g,v,""+k,S);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Fa:return k.key===b?a(g,v,k,S):null;case Bi:return k.key===b?u(g,v,k,S):null;case Fr:return b=k._init,f(g,v,b(k._payload),S)}if(sl(k)||Hs(k))return b!==null?null:c(g,v,k,S,null);Xa(g,k)}return null}function p(g,v,k,S,b){if(typeof S=="string"&&S!==""||typeof S=="number")return g=g.get(k)||null,l(v,g,""+S,b);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Fa:return g=g.get(S.key===null?k:S.key)||null,a(v,g,S,b);case Bi:return g=g.get(S.key===null?k:S.key)||null,u(v,g,S,b);case Fr:var E=S._init;return p(g,v,k,E(S._payload),b)}if(sl(S)||Hs(S))return g=g.get(k)||null,c(v,g,S,b,null);Xa(v,S)}return null}function h(g,v,k,S){for(var b=null,E=null,M=v,R=v=0,D=null;M!==null&&R<k.length;R++){M.index>R?(D=M,M=null):D=M.sibling;var I=f(g,M,k[R],S);if(I===null){M===null&&(M=D);break}e&&M&&I.alternate===null&&t(g,M),v=i(I,v,R),E===null?b=I:E.sibling=I,E=I,M=D}if(R===k.length)return n(g,M),Le&&Do(g,R),b;if(M===null){for(;R<k.length;R++)M=d(g,k[R],S),M!==null&&(v=i(M,v,R),E===null?b=M:E.sibling=M,E=M);return Le&&Do(g,R),b}for(M=r(g,M);R<k.length;R++)D=p(M,g,R,k[R],S),D!==null&&(e&&D.alternate!==null&&M.delete(D.key===null?R:D.key),v=i(D,v,R),E===null?b=D:E.sibling=D,E=D);return e&&M.forEach(function(J){return t(g,J)}),Le&&Do(g,R),b}function m(g,v,k,S){var b=Hs(k);if(typeof b!="function")throw Error(z(150));if(k=b.call(k),k==null)throw Error(z(151));for(var E=b=null,M=v,R=v=0,D=null,I=k.next();M!==null&&!I.done;R++,I=k.next()){M.index>R?(D=M,M=null):D=M.sibling;var J=f(g,M,I.value,S);if(J===null){M===null&&(M=D);break}e&&M&&J.alternate===null&&t(g,M),v=i(J,v,R),E===null?b=J:E.sibling=J,E=J,M=D}if(I.done)return n(g,M),Le&&Do(g,R),b;if(M===null){for(;!I.done;R++,I=k.next())I=d(g,I.value,S),I!==null&&(v=i(I,v,R),E===null?b=I:E.sibling=I,E=I);return Le&&Do(g,R),b}for(M=r(g,M);!I.done;R++,I=k.next())I=p(M,g,R,I.value,S),I!==null&&(e&&I.alternate!==null&&M.delete(I.key===null?R:I.key),v=i(I,v,R),E===null?b=I:E.sibling=I,E=I);return e&&M.forEach(function(ne){return t(g,ne)}),Le&&Do(g,R),b}function y(g,v,k,S){if(typeof k=="object"&&k!==null&&k.type===Vi&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Fa:e:{for(var b=k.key,E=v;E!==null;){if(E.key===b){if(b=k.type,b===Vi){if(E.tag===7){n(g,E.sibling),v=o(E,k.props.children),v.return=g,g=v;break e}}else if(E.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Fr&&w0(b)===E.type){n(g,E.sibling),v=o(E,k.props),v.ref=Ks(g,E,k),v.return=g,g=v;break e}n(g,E);break}else t(g,E);E=E.sibling}k.type===Vi?(v=Uo(k.props.children,g.mode,S,k.key),v.return=g,g=v):(S=Vu(k.type,k.key,k.props,null,g.mode,S),S.ref=Ks(g,v,k),S.return=g,g=S)}return s(g);case Bi:e:{for(E=k.key;v!==null;){if(v.key===E)if(v.tag===4&&v.stateNode.containerInfo===k.containerInfo&&v.stateNode.implementation===k.implementation){n(g,v.sibling),v=o(v,k.children||[]),v.return=g,g=v;break e}else{n(g,v);break}else t(g,v);v=v.sibling}v=rp(k,g.mode,S),v.return=g,g=v}return s(g);case Fr:return E=k._init,y(g,v,E(k._payload),S)}if(sl(k))return h(g,v,k,S);if(Hs(k))return m(g,v,k,S);Xa(g,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,v!==null&&v.tag===6?(n(g,v.sibling),v=o(v,k),v.return=g,g=v):(n(g,v),v=np(k,g.mode,S),v.return=g,g=v),s(g)):n(g,v)}return y}var hs=V1(!0),H1=V1(!1),pc=Mo(null),hc=null,Qi=null,yg=null;function vg(){yg=Qi=hc=null}function xg(e){var t=pc.current;Pe(pc),e._currentValue=t}function Ah(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function is(e,t){hc=e,yg=Qi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Lt=!0),e.firstContext=null)}function pn(e){var t=e._currentValue;if(yg!==e)if(e={context:e,memoizedValue:t,next:null},Qi===null){if(hc===null)throw Error(z(308));Qi=e,hc.dependencies={lanes:0,firstContext:e}}else Qi=Qi.next=e;return t}var zo=null;function wg(e){zo===null?zo=[e]:zo.push(e)}function U1(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,wg(t)):(n.next=o.next,o.next=n),t.interleaved=n,Cr(e,r)}function Cr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Br=!1;function kg(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function W1(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function yr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function so(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ve&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Cr(e,n)}return o=r.interleaved,o===null?(t.next=t,wg(r)):(t.next=o.next,o.next=t),r.interleaved=t,Cr(e,n)}function _u(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,sg(e,n)}}function k0(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function mc(e,t,n,r){var o=e.updateQueue;Br=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,l=o.shared.pending;if(l!==null){o.shared.pending=null;var a=l,u=a.next;a.next=null,s===null?i=u:s.next=u,s=a;var c=e.alternate;c!==null&&(c=c.updateQueue,l=c.lastBaseUpdate,l!==s&&(l===null?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=a))}if(i!==null){var d=o.baseState;s=0,c=u=a=null,l=i;do{var f=l.lane,p=l.eventTime;if((r&f)===f){c!==null&&(c=c.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var h=e,m=l;switch(f=t,p=n,m.tag){case 1:if(h=m.payload,typeof h=="function"){d=h.call(p,d,f);break e}d=h;break e;case 3:h.flags=h.flags&-65537|128;case 0:if(h=m.payload,f=typeof h=="function"?h.call(p,d,f):h,f==null)break e;d=Be({},d,f);break e;case 2:Br=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=o.effects,f===null?o.effects=[l]:f.push(l))}else p={eventTime:p,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(u=c=p,a=d):c=c.next=p,s|=f;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;f=l,l=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(!0);if(c===null&&(a=d),o.baseState=a,o.firstBaseUpdate=u,o.lastBaseUpdate=c,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);Zo|=s,e.lanes=s,e.memoizedState=d}}function S0(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(z(191,o));o.call(r)}}}var wa={},Gn=Mo(wa),Kl=Mo(wa),Jl=Mo(wa);function jo(e){if(e===wa)throw Error(z(174));return e}function Sg(e,t){switch(Ne(Jl,t),Ne(Kl,e),Ne(Gn,wa),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ch(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ch(t,e)}Pe(Gn),Ne(Gn,t)}function ms(){Pe(Gn),Pe(Kl),Pe(Jl)}function G1(e){jo(Jl.current);var t=jo(Gn.current),n=ch(t,e.type);t!==n&&(Ne(Kl,e),Ne(Gn,n))}function bg(e){Kl.current===e&&(Pe(Gn),Pe(Kl))}var ze=Mo(0);function gc(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Qf=[];function Cg(){for(var e=0;e<Qf.length;e++)Qf[e]._workInProgressVersionPrimary=null;Qf.length=0}var $u=Mr.ReactCurrentDispatcher,Xf=Mr.ReactCurrentBatchConfig,Yo=0,Fe=null,et=null,nt=null,yc=!1,kl=!1,Ql=0,MA=0;function mt(){throw Error(z(321))}function Eg(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Pn(e[n],t[n]))return!1;return!0}function Mg(e,t,n,r,o,i){if(Yo=i,Fe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$u.current=e===null||e.memoizedState===null?AA:OA,e=n(r,o),kl){i=0;do{if(kl=!1,Ql=0,25<=i)throw Error(z(301));i+=1,nt=et=null,t.updateQueue=null,$u.current=PA,e=n(r,o)}while(kl)}if($u.current=vc,t=et!==null&&et.next!==null,Yo=0,nt=et=Fe=null,yc=!1,t)throw Error(z(300));return e}function Rg(){var e=Ql!==0;return Ql=0,e}function zn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nt===null?Fe.memoizedState=nt=e:nt=nt.next=e,nt}function hn(){if(et===null){var e=Fe.alternate;e=e!==null?e.memoizedState:null}else e=et.next;var t=nt===null?Fe.memoizedState:nt.next;if(t!==null)nt=t,et=e;else{if(e===null)throw Error(z(310));et=e,e={memoizedState:et.memoizedState,baseState:et.baseState,baseQueue:et.baseQueue,queue:et.queue,next:null},nt===null?Fe.memoizedState=nt=e:nt=nt.next=e}return nt}function Xl(e,t){return typeof t=="function"?t(e):t}function Yf(e){var t=hn(),n=t.queue;if(n===null)throw Error(z(311));n.lastRenderedReducer=e;var r=et,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var l=s=null,a=null,u=i;do{var c=u.lane;if((Yo&c)===c)a!==null&&(a=a.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var d={lane:c,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};a===null?(l=a=d,s=r):a=a.next=d,Fe.lanes|=c,Zo|=c}u=u.next}while(u!==null&&u!==i);a===null?s=r:a.next=l,Pn(r,t.memoizedState)||(Lt=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=a,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do i=o.lane,Fe.lanes|=i,Zo|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Zf(e){var t=hn(),n=t.queue;if(n===null)throw Error(z(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=e(i,s.action),s=s.next;while(s!==o);Pn(i,t.memoizedState)||(Lt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function q1(){}function K1(e,t){var n=Fe,r=hn(),o=t(),i=!Pn(r.memoizedState,o);if(i&&(r.memoizedState=o,Lt=!0),r=r.queue,Tg(X1.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||nt!==null&&nt.memoizedState.tag&1){if(n.flags|=2048,Yl(9,Q1.bind(null,n,r,o,t),void 0,null),it===null)throw Error(z(349));Yo&30||J1(n,t,o)}return o}function J1(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Fe.updateQueue,t===null?(t={lastEffect:null,stores:null},Fe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Q1(e,t,n,r){t.value=n,t.getSnapshot=r,Y1(t)&&Z1(e)}function X1(e,t,n){return n(function(){Y1(t)&&Z1(e)})}function Y1(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Pn(e,n)}catch{return!0}}function Z1(e){var t=Cr(e,1);t!==null&&Nn(t,e,1,-1)}function b0(e){var t=zn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Xl,lastRenderedState:e},t.queue=e,e=e.dispatch=NA.bind(null,Fe,e),[t.memoizedState,e]}function Yl(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Fe.updateQueue,t===null?(t={lastEffect:null,stores:null},Fe.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function eS(){return hn().memoizedState}function zu(e,t,n,r){var o=zn();Fe.flags|=e,o.memoizedState=Yl(1|t,n,void 0,r===void 0?null:r)}function Pd(e,t,n,r){var o=hn();r=r===void 0?null:r;var i=void 0;if(et!==null){var s=et.memoizedState;if(i=s.destroy,r!==null&&Eg(r,s.deps)){o.memoizedState=Yl(t,n,i,r);return}}Fe.flags|=e,o.memoizedState=Yl(1|t,n,i,r)}function C0(e,t){return zu(8390656,8,e,t)}function Tg(e,t){return Pd(2048,8,e,t)}function tS(e,t){return Pd(4,2,e,t)}function nS(e,t){return Pd(4,4,e,t)}function rS(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function oS(e,t,n){return n=n!=null?n.concat([e]):null,Pd(4,4,rS.bind(null,t,e),n)}function Ng(){}function iS(e,t){var n=hn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Eg(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function sS(e,t){var n=hn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Eg(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function lS(e,t,n){return Yo&21?(Pn(n,t)||(n=f1(),Fe.lanes|=n,Zo|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Lt=!0),e.memoizedState=n)}function RA(e,t){var n=Ce;Ce=n!==0&&4>n?n:4,e(!0);var r=Xf.transition;Xf.transition={};try{e(!1),t()}finally{Ce=n,Xf.transition=r}}function aS(){return hn().memoizedState}function TA(e,t,n){var r=ao(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},uS(e))cS(t,n);else if(n=U1(e,t,n,r),n!==null){var o=Mt();Nn(n,e,r,o),dS(n,t,r)}}function NA(e,t,n){var r=ao(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(uS(e))cS(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,l=i(s,n);if(o.hasEagerState=!0,o.eagerState=l,Pn(l,s)){var a=t.interleaved;a===null?(o.next=o,wg(t)):(o.next=a.next,a.next=o),t.interleaved=o;return}}catch{}finally{}n=U1(e,t,o,r),n!==null&&(o=Mt(),Nn(n,e,r,o),dS(n,t,r))}}function uS(e){var t=e.alternate;return e===Fe||t!==null&&t===Fe}function cS(e,t){kl=yc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function dS(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,sg(e,n)}}var vc={readContext:pn,useCallback:mt,useContext:mt,useEffect:mt,useImperativeHandle:mt,useInsertionEffect:mt,useLayoutEffect:mt,useMemo:mt,useReducer:mt,useRef:mt,useState:mt,useDebugValue:mt,useDeferredValue:mt,useTransition:mt,useMutableSource:mt,useSyncExternalStore:mt,useId:mt,unstable_isNewReconciler:!1},AA={readContext:pn,useCallback:function(e,t){return zn().memoizedState=[e,t===void 0?null:t],e},useContext:pn,useEffect:C0,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,zu(4194308,4,rS.bind(null,t,e),n)},useLayoutEffect:function(e,t){return zu(4194308,4,e,t)},useInsertionEffect:function(e,t){return zu(4,2,e,t)},useMemo:function(e,t){var n=zn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=zn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=TA.bind(null,Fe,e),[r.memoizedState,e]},useRef:function(e){var t=zn();return e={current:e},t.memoizedState=e},useState:b0,useDebugValue:Ng,useDeferredValue:function(e){return zn().memoizedState=e},useTransition:function(){var e=b0(!1),t=e[0];return e=RA.bind(null,e[1]),zn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Fe,o=zn();if(Le){if(n===void 0)throw Error(z(407));n=n()}else{if(n=t(),it===null)throw Error(z(349));Yo&30||J1(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,C0(X1.bind(null,r,i,e),[e]),r.flags|=2048,Yl(9,Q1.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=zn(),t=it.identifierPrefix;if(Le){var n=hr,r=pr;n=(r&~(1<<32-Tn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ql++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=MA++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},OA={readContext:pn,useCallback:iS,useContext:pn,useEffect:Tg,useImperativeHandle:oS,useInsertionEffect:tS,useLayoutEffect:nS,useMemo:sS,useReducer:Yf,useRef:eS,useState:function(){return Yf(Xl)},useDebugValue:Ng,useDeferredValue:function(e){var t=hn();return lS(t,et.memoizedState,e)},useTransition:function(){var e=Yf(Xl)[0],t=hn().memoizedState;return[e,t]},useMutableSource:q1,useSyncExternalStore:K1,useId:aS,unstable_isNewReconciler:!1},PA={readContext:pn,useCallback:iS,useContext:pn,useEffect:Tg,useImperativeHandle:oS,useInsertionEffect:tS,useLayoutEffect:nS,useMemo:sS,useReducer:Zf,useRef:eS,useState:function(){return Zf(Xl)},useDebugValue:Ng,useDeferredValue:function(e){var t=hn();return et===null?t.memoizedState=e:lS(t,et.memoizedState,e)},useTransition:function(){var e=Zf(Xl)[0],t=hn().memoizedState;return[e,t]},useMutableSource:q1,useSyncExternalStore:K1,useId:aS,unstable_isNewReconciler:!1};function kn(e,t){if(e&&e.defaultProps){t=Be({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Oh(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Be({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Id={isMounted:function(e){return(e=e._reactInternals)?ci(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Mt(),o=ao(e),i=yr(r,o);i.payload=t,n!=null&&(i.callback=n),t=so(e,i,o),t!==null&&(Nn(t,e,o,r),_u(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Mt(),o=ao(e),i=yr(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=so(e,i,o),t!==null&&(Nn(t,e,o,r),_u(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Mt(),r=ao(e),o=yr(n,r);o.tag=2,t!=null&&(o.callback=t),t=so(e,o,r),t!==null&&(Nn(t,e,r,n),_u(t,e,r))}};function E0(e,t,n,r,o,i,s){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,s):t.prototype&&t.prototype.isPureReactComponent?!Ul(n,r)||!Ul(o,i):!0}function fS(e,t,n){var r=!1,o=vo,i=t.contextType;return typeof i=="object"&&i!==null?i=pn(i):(o=$t(t)?Qo:wt.current,r=t.contextTypes,i=(r=r!=null)?fs(e,o):vo),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Id,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function M0(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Id.enqueueReplaceState(t,t.state,null)}function Ph(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},kg(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=pn(i):(i=$t(t)?Qo:wt.current,o.context=fs(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Oh(e,t,i,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&Id.enqueueReplaceState(o,o.state,null),mc(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function gs(e,t){try{var n="",r=t;do n+=sN(r),r=r.return;while(r);var o=n}catch(i){o=`
39
- Error generating stack: `+i.message+`
40
- `+i.stack}return{value:e,source:t,stack:o,digest:null}}function ep(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ih(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var IA=typeof WeakMap=="function"?WeakMap:Map;function pS(e,t,n){n=yr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){wc||(wc=!0,Hh=r),Ih(e,t)},n}function hS(e,t,n){n=yr(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Ih(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Ih(e,t),typeof r!="function"&&(lo===null?lo=new Set([this]):lo.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function R0(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new IA;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=qA.bind(null,e,t,n),t.then(e,e))}function T0(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function N0(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=yr(-1,1),t.tag=2,so(n,t,1))),n.lanes|=1),e)}var DA=Mr.ReactCurrentOwner,Lt=!1;function St(e,t,n,r){t.child=e===null?H1(t,null,n,r):hs(t,e.child,n,r)}function A0(e,t,n,r,o){n=n.render;var i=t.ref;return is(t,o),r=Mg(e,t,n,r,i,o),n=Rg(),e!==null&&!Lt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Er(e,t,o)):(Le&&n&&hg(t),t.flags|=1,St(e,t,r,o),t.child)}function O0(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!$g(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,mS(e,t,i,r,o)):(e=Vu(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:Ul,n(s,r)&&e.ref===t.ref)return Er(e,t,o)}return t.flags|=1,e=uo(i,r),e.ref=t.ref,e.return=t,t.child=e}function mS(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(Ul(i,r)&&e.ref===t.ref)if(Lt=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(Lt=!0);else return t.lanes=e.lanes,Er(e,t,o)}return Dh(e,t,n,r,o)}function gS(e,t,n){var r=t.pendingProps,o=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ne(Yi,Ht),Ht|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ne(Yi,Ht),Ht|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Ne(Yi,Ht),Ht|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Ne(Yi,Ht),Ht|=r;return St(e,t,o,n),t.child}function yS(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Dh(e,t,n,r,o){var i=$t(n)?Qo:wt.current;return i=fs(t,i),is(t,o),n=Mg(e,t,n,r,i,o),r=Rg(),e!==null&&!Lt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Er(e,t,o)):(Le&&r&&hg(t),t.flags|=1,St(e,t,n,o),t.child)}function P0(e,t,n,r,o){if($t(n)){var i=!0;cc(t)}else i=!1;if(is(t,o),t.stateNode===null)ju(e,t),fS(t,n,r),Ph(t,n,r,o),r=!0;else if(e===null){var s=t.stateNode,l=t.memoizedProps;s.props=l;var a=s.context,u=n.contextType;typeof u=="object"&&u!==null?u=pn(u):(u=$t(n)?Qo:wt.current,u=fs(t,u));var c=n.getDerivedStateFromProps,d=typeof c=="function"||typeof s.getSnapshotBeforeUpdate=="function";d||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==r||a!==u)&&M0(t,s,r,u),Br=!1;var f=t.memoizedState;s.state=f,mc(t,r,s,o),a=t.memoizedState,l!==r||f!==a||_t.current||Br?(typeof c=="function"&&(Oh(t,n,c,r),a=t.memoizedState),(l=Br||E0(t,n,l,r,f,a,u))?(d||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=a),s.props=r,s.state=a,s.context=u,r=l):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,W1(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:kn(t.type,l),s.props=u,d=t.pendingProps,f=s.context,a=n.contextType,typeof a=="object"&&a!==null?a=pn(a):(a=$t(n)?Qo:wt.current,a=fs(t,a));var p=n.getDerivedStateFromProps;(c=typeof p=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==d||f!==a)&&M0(t,s,r,a),Br=!1,f=t.memoizedState,s.state=f,mc(t,r,s,o);var h=t.memoizedState;l!==d||f!==h||_t.current||Br?(typeof p=="function"&&(Oh(t,n,p,r),h=t.memoizedState),(u=Br||E0(t,n,u,r,f,h,a)||!1)?(c||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,h,a),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,h,a)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=h),s.props=r,s.state=h,s.context=a,r=u):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Lh(e,t,n,r,i,o)}function Lh(e,t,n,r,o,i){yS(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&y0(t,n,!1),Er(e,t,i);r=t.stateNode,DA.current=t;var l=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=hs(t,e.child,null,i),t.child=hs(t,null,l,i)):St(e,t,l,i),t.memoizedState=r.state,o&&y0(t,n,!0),t.child}function vS(e){var t=e.stateNode;t.pendingContext?g0(e,t.pendingContext,t.pendingContext!==t.context):t.context&&g0(e,t.context,!1),Sg(e,t.containerInfo)}function I0(e,t,n,r,o){return ps(),gg(o),t.flags|=256,St(e,t,n,r),t.child}var _h={dehydrated:null,treeContext:null,retryLane:0};function $h(e){return{baseLanes:e,cachePool:null,transitions:null}}function xS(e,t,n){var r=t.pendingProps,o=ze.current,i=!1,s=(t.flags&128)!==0,l;if((l=s)||(l=e!==null&&e.memoizedState===null?!1:(o&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),Ne(ze,o&1),e===null)return Nh(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=_d(s,r,0,null),e=Uo(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=$h(n),t.memoizedState=_h,e):Ag(t,s));if(o=e.memoizedState,o!==null&&(l=o.dehydrated,l!==null))return LA(e,t,s,r,l,o,n);if(i){i=r.fallback,s=t.mode,o=e.child,l=o.sibling;var a={mode:"hidden",children:r.children};return!(s&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=a,t.deletions=null):(r=uo(o,a),r.subtreeFlags=o.subtreeFlags&14680064),l!==null?i=uo(l,i):(i=Uo(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?$h(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=_h,r}return i=e.child,e=i.sibling,r=uo(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Ag(e,t){return t=_d({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ya(e,t,n,r){return r!==null&&gg(r),hs(t,e.child,null,n),e=Ag(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function LA(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=ep(Error(z(422))),Ya(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=_d({mode:"visible",children:r.children},o,0,null),i=Uo(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&hs(t,e.child,null,s),t.child.memoizedState=$h(s),t.memoizedState=_h,i);if(!(t.mode&1))return Ya(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(z(419)),r=ep(i,r,void 0),Ya(e,t,s,r)}if(l=(s&e.childLanes)!==0,Lt||l){if(r=it,r!==null){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|s)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,Cr(e,o),Nn(r,e,o,-1))}return _g(),r=ep(Error(z(421))),Ya(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=KA.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,Wt=io(o.nextSibling),Gt=t,Le=!0,bn=null,e!==null&&(on[sn++]=pr,on[sn++]=hr,on[sn++]=Xo,pr=e.id,hr=e.overflow,Xo=t),t=Ag(t,r.children),t.flags|=4096,t)}function D0(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ah(e.return,t,n)}function tp(e,t,n,r,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function wS(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(St(e,t,r.children,n),r=ze.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&D0(e,n,t);else if(e.tag===19)D0(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ne(ze,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&gc(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),tp(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&gc(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}tp(t,!0,n,null,i);break;case"together":tp(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ju(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Er(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Zo|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(z(153));if(t.child!==null){for(e=t.child,n=uo(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=uo(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function _A(e,t,n){switch(t.tag){case 3:vS(t),ps();break;case 5:G1(t);break;case 1:$t(t.type)&&cc(t);break;case 4:Sg(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;Ne(pc,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ne(ze,ze.current&1),t.flags|=128,null):n&t.child.childLanes?xS(e,t,n):(Ne(ze,ze.current&1),e=Er(e,t,n),e!==null?e.sibling:null);Ne(ze,ze.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return wS(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Ne(ze,ze.current),r)break;return null;case 22:case 23:return t.lanes=0,gS(e,t,n)}return Er(e,t,n)}var kS,zh,SS,bS;kS=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};zh=function(){};SS=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,jo(Gn.current);var i=null;switch(n){case"input":o=sh(e,o),r=sh(e,r),i=[];break;case"select":o=Be({},o,{value:void 0}),r=Be({},r,{value:void 0}),i=[];break;case"textarea":o=uh(e,o),r=uh(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=ac)}dh(n,r);var s;n=null;for(u in o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&o[u]!=null)if(u==="style"){var l=o[u];for(s in l)l.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&($l.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var a=r[u];if(l=o!=null?o[u]:void 0,r.hasOwnProperty(u)&&a!==l&&(a!=null||l!=null))if(u==="style")if(l){for(s in l)!l.hasOwnProperty(s)||a&&a.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in a)a.hasOwnProperty(s)&&l[s]!==a[s]&&(n||(n={}),n[s]=a[s])}else n||(i||(i=[]),i.push(u,n)),n=a;else u==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(i=i||[]).push(u,a)):u==="children"?typeof a!="string"&&typeof a!="number"||(i=i||[]).push(u,""+a):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&($l.hasOwnProperty(u)?(a!=null&&u==="onScroll"&&Ae("scroll",e),i||l===a||(i=[])):(i=i||[]).push(u,a))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};bS=function(e,t,n,r){n!==r&&(t.flags|=4)};function Js(e,t){if(!Le)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function gt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function $A(e,t,n){var r=t.pendingProps;switch(mg(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gt(t),null;case 1:return $t(t.type)&&uc(),gt(t),null;case 3:return r=t.stateNode,ms(),Pe(_t),Pe(wt),Cg(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Qa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,bn!==null&&(Gh(bn),bn=null))),zh(e,t),gt(t),null;case 5:bg(t);var o=jo(Jl.current);if(n=t.type,e!==null&&t.stateNode!=null)SS(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(z(166));return gt(t),null}if(e=jo(Gn.current),Qa(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Vn]=t,r[ql]=i,e=(t.mode&1)!==0,n){case"dialog":Ae("cancel",r),Ae("close",r);break;case"iframe":case"object":case"embed":Ae("load",r);break;case"video":case"audio":for(o=0;o<al.length;o++)Ae(al[o],r);break;case"source":Ae("error",r);break;case"img":case"image":case"link":Ae("error",r),Ae("load",r);break;case"details":Ae("toggle",r);break;case"input":Hv(r,i),Ae("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Ae("invalid",r);break;case"textarea":Wv(r,i),Ae("invalid",r)}dh(n,i),o=null;for(var s in i)if(i.hasOwnProperty(s)){var l=i[s];s==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&Ja(r.textContent,l,e),o=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Ja(r.textContent,l,e),o=["children",""+l]):$l.hasOwnProperty(s)&&l!=null&&s==="onScroll"&&Ae("scroll",r)}switch(n){case"input":Ba(r),Uv(r,i,!0);break;case"textarea":Ba(r),Gv(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=ac)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Xk(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Vn]=t,e[ql]=r,kS(e,t,!1,!1),t.stateNode=e;e:{switch(s=fh(n,r),n){case"dialog":Ae("cancel",e),Ae("close",e),o=r;break;case"iframe":case"object":case"embed":Ae("load",e),o=r;break;case"video":case"audio":for(o=0;o<al.length;o++)Ae(al[o],e);o=r;break;case"source":Ae("error",e),o=r;break;case"img":case"image":case"link":Ae("error",e),Ae("load",e),o=r;break;case"details":Ae("toggle",e),o=r;break;case"input":Hv(e,r),o=sh(e,r),Ae("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=Be({},r,{value:void 0}),Ae("invalid",e);break;case"textarea":Wv(e,r),o=uh(e,r),Ae("invalid",e);break;default:o=r}dh(n,o),l=o;for(i in l)if(l.hasOwnProperty(i)){var a=l[i];i==="style"?e1(e,a):i==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&Yk(e,a)):i==="children"?typeof a=="string"?(n!=="textarea"||a!=="")&&zl(e,a):typeof a=="number"&&zl(e,""+a):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&($l.hasOwnProperty(i)?a!=null&&i==="onScroll"&&Ae("scroll",e):a!=null&&eg(e,i,a,s))}switch(n){case"input":Ba(e),Uv(e,r,!1);break;case"textarea":Ba(e),Gv(e);break;case"option":r.value!=null&&e.setAttribute("value",""+yo(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?es(e,!!r.multiple,i,!1):r.defaultValue!=null&&es(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=ac)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return gt(t),null;case 6:if(e&&t.stateNode!=null)bS(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(z(166));if(n=jo(Jl.current),jo(Gn.current),Qa(t)){if(r=t.stateNode,n=t.memoizedProps,r[Vn]=t,(i=r.nodeValue!==n)&&(e=Gt,e!==null))switch(e.tag){case 3:Ja(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ja(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Vn]=t,t.stateNode=r}return gt(t),null;case 13:if(Pe(ze),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Le&&Wt!==null&&t.mode&1&&!(t.flags&128))B1(),ps(),t.flags|=98560,i=!1;else if(i=Qa(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(z(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(z(317));i[Vn]=t}else ps(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;gt(t),i=!1}else bn!==null&&(Gh(bn),bn=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||ze.current&1?tt===0&&(tt=3):_g())),t.updateQueue!==null&&(t.flags|=4),gt(t),null);case 4:return ms(),zh(e,t),e===null&&Wl(t.stateNode.containerInfo),gt(t),null;case 10:return xg(t.type._context),gt(t),null;case 17:return $t(t.type)&&uc(),gt(t),null;case 19:if(Pe(ze),i=t.memoizedState,i===null)return gt(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)Js(i,!1);else{if(tt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=gc(e),s!==null){for(t.flags|=128,Js(i,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,s=i.alternate,s===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,e=s.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Ne(ze,ze.current&1|2),t.child}e=e.sibling}i.tail!==null&&We()>ys&&(t.flags|=128,r=!0,Js(i,!1),t.lanes=4194304)}else{if(!r)if(e=gc(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Js(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Le)return gt(t),null}else 2*We()-i.renderingStartTime>ys&&n!==1073741824&&(t.flags|=128,r=!0,Js(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=We(),t.sibling=null,n=ze.current,Ne(ze,r?n&1|2:n&1),t):(gt(t),null);case 22:case 23:return Lg(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ht&1073741824&&(gt(t),t.subtreeFlags&6&&(t.flags|=8192)):gt(t),null;case 24:return null;case 25:return null}throw Error(z(156,t.tag))}function zA(e,t){switch(mg(t),t.tag){case 1:return $t(t.type)&&uc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ms(),Pe(_t),Pe(wt),Cg(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return bg(t),null;case 13:if(Pe(ze),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(z(340));ps()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Pe(ze),null;case 4:return ms(),null;case 10:return xg(t.type._context),null;case 22:case 23:return Lg(),null;case 24:return null;default:return null}}var Za=!1,xt=!1,jA=typeof WeakSet=="function"?WeakSet:Set,W=null;function Xi(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){He(e,t,r)}else n.current=null}function jh(e,t,n){try{n()}catch(r){He(e,t,r)}}var L0=!1;function FA(e,t){if(Sh=ic,e=T1(),pg(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,l=-1,a=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var p;d!==n||o!==0&&d.nodeType!==3||(l=s+o),d!==i||r!==0&&d.nodeType!==3||(a=s+r),d.nodeType===3&&(s+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===e)break t;if(f===n&&++u===o&&(l=s),f===i&&++c===r&&(a=s),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(bh={focusedElem:e,selectionRange:n},ic=!1,W=t;W!==null;)if(t=W,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,W=e;else for(;W!==null;){t=W;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var m=h.memoizedProps,y=h.memoizedState,g=t.stateNode,v=g.getSnapshotBeforeUpdate(t.elementType===t.type?m:kn(t.type,m),y);g.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var k=t.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(z(163))}}catch(S){He(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,W=e;break}W=t.return}return h=L0,L0=!1,h}function Sl(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&jh(t,n,i)}o=o.next}while(o!==r)}}function Dd(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Fh(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function CS(e){var t=e.alternate;t!==null&&(e.alternate=null,CS(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Vn],delete t[ql],delete t[Mh],delete t[SA],delete t[bA])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function ES(e){return e.tag===5||e.tag===3||e.tag===4}function _0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ES(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Bh(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ac));else if(r!==4&&(e=e.child,e!==null))for(Bh(e,t,n),e=e.sibling;e!==null;)Bh(e,t,n),e=e.sibling}function Vh(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Vh(e,t,n),e=e.sibling;e!==null;)Vh(e,t,n),e=e.sibling}var at=null,Sn=!1;function Lr(e,t,n){for(n=n.child;n!==null;)MS(e,t,n),n=n.sibling}function MS(e,t,n){if(Wn&&typeof Wn.onCommitFiberUnmount=="function")try{Wn.onCommitFiberUnmount(Md,n)}catch{}switch(n.tag){case 5:xt||Xi(n,t);case 6:var r=at,o=Sn;at=null,Lr(e,t,n),at=r,Sn=o,at!==null&&(Sn?(e=at,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):at.removeChild(n.stateNode));break;case 18:at!==null&&(Sn?(e=at,n=n.stateNode,e.nodeType===8?Kf(e.parentNode,n):e.nodeType===1&&Kf(e,n),Vl(e)):Kf(at,n.stateNode));break;case 4:r=at,o=Sn,at=n.stateNode.containerInfo,Sn=!0,Lr(e,t,n),at=r,Sn=o;break;case 0:case 11:case 14:case 15:if(!xt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&jh(n,t,s),o=o.next}while(o!==r)}Lr(e,t,n);break;case 1:if(!xt&&(Xi(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){He(n,t,l)}Lr(e,t,n);break;case 21:Lr(e,t,n);break;case 22:n.mode&1?(xt=(r=xt)||n.memoizedState!==null,Lr(e,t,n),xt=r):Lr(e,t,n);break;default:Lr(e,t,n)}}function $0(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new jA),t.forEach(function(r){var o=JA.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function vn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var i=e,s=t,l=s;e:for(;l!==null;){switch(l.tag){case 5:at=l.stateNode,Sn=!1;break e;case 3:at=l.stateNode.containerInfo,Sn=!0;break e;case 4:at=l.stateNode.containerInfo,Sn=!0;break e}l=l.return}if(at===null)throw Error(z(160));MS(i,s,o),at=null,Sn=!1;var a=o.alternate;a!==null&&(a.return=null),o.return=null}catch(u){He(o,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)RS(t,e),t=t.sibling}function RS(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(vn(t,e),_n(e),r&4){try{Sl(3,e,e.return),Dd(3,e)}catch(m){He(e,e.return,m)}try{Sl(5,e,e.return)}catch(m){He(e,e.return,m)}}break;case 1:vn(t,e),_n(e),r&512&&n!==null&&Xi(n,n.return);break;case 5:if(vn(t,e),_n(e),r&512&&n!==null&&Xi(n,n.return),e.flags&32){var o=e.stateNode;try{zl(o,"")}catch(m){He(e,e.return,m)}}if(r&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,s=n!==null?n.memoizedProps:i,l=e.type,a=e.updateQueue;if(e.updateQueue=null,a!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&Jk(o,i),fh(l,s);var u=fh(l,i);for(s=0;s<a.length;s+=2){var c=a[s],d=a[s+1];c==="style"?e1(o,d):c==="dangerouslySetInnerHTML"?Yk(o,d):c==="children"?zl(o,d):eg(o,c,d,u)}switch(l){case"input":lh(o,i);break;case"textarea":Qk(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?es(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?es(o,!!i.multiple,i.defaultValue,!0):es(o,!!i.multiple,i.multiple?[]:"",!1))}o[ql]=i}catch(m){He(e,e.return,m)}}break;case 6:if(vn(t,e),_n(e),r&4){if(e.stateNode===null)throw Error(z(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(m){He(e,e.return,m)}}break;case 3:if(vn(t,e),_n(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Vl(t.containerInfo)}catch(m){He(e,e.return,m)}break;case 4:vn(t,e),_n(e);break;case 13:vn(t,e),_n(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(Ig=We())),r&4&&$0(e);break;case 22:if(c=n!==null&&n.memoizedState!==null,e.mode&1?(xt=(u=xt)||c,vn(t,e),xt=u):vn(t,e),_n(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!c&&e.mode&1)for(W=e,c=e.child;c!==null;){for(d=W=c;W!==null;){switch(f=W,p=f.child,f.tag){case 0:case 11:case 14:case 15:Sl(4,f,f.return);break;case 1:Xi(f,f.return);var h=f.stateNode;if(typeof h.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(m){He(r,n,m)}}break;case 5:Xi(f,f.return);break;case 22:if(f.memoizedState!==null){j0(d);continue}}p!==null?(p.return=f,W=p):j0(d)}c=c.sibling}e:for(c=null,d=e;;){if(d.tag===5){if(c===null){c=d;try{o=d.stateNode,u?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=d.stateNode,a=d.memoizedProps.style,s=a!=null&&a.hasOwnProperty("display")?a.display:null,l.style.display=Zk("display",s))}catch(m){He(e,e.return,m)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(m){He(e,e.return,m)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:vn(t,e),_n(e),r&4&&$0(e);break;case 21:break;default:vn(t,e),_n(e)}}function _n(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(ES(n)){var r=n;break e}n=n.return}throw Error(z(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(zl(o,""),r.flags&=-33);var i=_0(e);Vh(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,l=_0(e);Bh(e,l,s);break;default:throw Error(z(161))}}catch(a){He(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function BA(e,t,n){W=e,TS(e)}function TS(e,t,n){for(var r=(e.mode&1)!==0;W!==null;){var o=W,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||Za;if(!s){var l=o.alternate,a=l!==null&&l.memoizedState!==null||xt;l=Za;var u=xt;if(Za=s,(xt=a)&&!u)for(W=o;W!==null;)s=W,a=s.child,s.tag===22&&s.memoizedState!==null?F0(o):a!==null?(a.return=s,W=a):F0(o);for(;i!==null;)W=i,TS(i),i=i.sibling;W=o,Za=l,xt=u}z0(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,W=i):z0(e)}}function z0(e){for(;W!==null;){var t=W;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:xt||Dd(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!xt)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:kn(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&S0(t,i,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}S0(t,s,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var a=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break;case"img":a.src&&(n.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var c=u.memoizedState;if(c!==null){var d=c.dehydrated;d!==null&&Vl(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(z(163))}xt||t.flags&512&&Fh(t)}catch(f){He(t,t.return,f)}}if(t===e){W=null;break}if(n=t.sibling,n!==null){n.return=t.return,W=n;break}W=t.return}}function j0(e){for(;W!==null;){var t=W;if(t===e){W=null;break}var n=t.sibling;if(n!==null){n.return=t.return,W=n;break}W=t.return}}function F0(e){for(;W!==null;){var t=W;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Dd(4,t)}catch(a){He(t,n,a)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(a){He(t,o,a)}}var i=t.return;try{Fh(t)}catch(a){He(t,i,a)}break;case 5:var s=t.return;try{Fh(t)}catch(a){He(t,s,a)}}}catch(a){He(t,t.return,a)}if(t===e){W=null;break}var l=t.sibling;if(l!==null){l.return=t.return,W=l;break}W=t.return}}var VA=Math.ceil,xc=Mr.ReactCurrentDispatcher,Og=Mr.ReactCurrentOwner,un=Mr.ReactCurrentBatchConfig,ve=0,it=null,Ge=null,ft=0,Ht=0,Yi=Mo(0),tt=0,Zl=null,Zo=0,Ld=0,Pg=0,bl=null,It=null,Ig=0,ys=1/0,ar=null,wc=!1,Hh=null,lo=null,eu=!1,Qr=null,kc=0,Cl=0,Uh=null,Fu=-1,Bu=0;function Mt(){return ve&6?We():Fu!==-1?Fu:Fu=We()}function ao(e){return e.mode&1?ve&2&&ft!==0?ft&-ft:EA.transition!==null?(Bu===0&&(Bu=f1()),Bu):(e=Ce,e!==0||(e=window.event,e=e===void 0?16:x1(e.type)),e):1}function Nn(e,t,n,r){if(50<Cl)throw Cl=0,Uh=null,Error(z(185));ya(e,n,r),(!(ve&2)||e!==it)&&(e===it&&(!(ve&2)&&(Ld|=n),tt===4&&Gr(e,ft)),zt(e,r),n===1&&ve===0&&!(t.mode&1)&&(ys=We()+500,Od&&Ro()))}function zt(e,t){var n=e.callbackNode;EN(e,t);var r=oc(e,e===it?ft:0);if(r===0)n!==null&&Jv(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Jv(n),t===1)e.tag===0?CA(B0.bind(null,e)):z1(B0.bind(null,e)),wA(function(){!(ve&6)&&Ro()}),n=null;else{switch(p1(r)){case 1:n=ig;break;case 4:n=c1;break;case 16:n=rc;break;case 536870912:n=d1;break;default:n=rc}n=_S(n,NS.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function NS(e,t){if(Fu=-1,Bu=0,ve&6)throw Error(z(327));var n=e.callbackNode;if(ss()&&e.callbackNode!==n)return null;var r=oc(e,e===it?ft:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Sc(e,r);else{t=r;var o=ve;ve|=2;var i=OS();(it!==e||ft!==t)&&(ar=null,ys=We()+500,Ho(e,t));do try{WA();break}catch(l){AS(e,l)}while(!0);vg(),xc.current=i,ve=o,Ge!==null?t=0:(it=null,ft=0,t=tt)}if(t!==0){if(t===2&&(o=yh(e),o!==0&&(r=o,t=Wh(e,o))),t===1)throw n=Zl,Ho(e,0),Gr(e,r),zt(e,We()),n;if(t===6)Gr(e,r);else{if(o=e.current.alternate,!(r&30)&&!HA(o)&&(t=Sc(e,r),t===2&&(i=yh(e),i!==0&&(r=i,t=Wh(e,i))),t===1))throw n=Zl,Ho(e,0),Gr(e,r),zt(e,We()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(z(345));case 2:Lo(e,It,ar);break;case 3:if(Gr(e,r),(r&130023424)===r&&(t=Ig+500-We(),10<t)){if(oc(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Mt(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Eh(Lo.bind(null,e,It,ar),t);break}Lo(e,It,ar);break;case 4:if(Gr(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-Tn(r);i=1<<s,s=t[s],s>o&&(o=s),r&=~i}if(r=o,r=We()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*VA(r/1960))-r,10<r){e.timeoutHandle=Eh(Lo.bind(null,e,It,ar),r);break}Lo(e,It,ar);break;case 5:Lo(e,It,ar);break;default:throw Error(z(329))}}}return zt(e,We()),e.callbackNode===n?NS.bind(null,e):null}function Wh(e,t){var n=bl;return e.current.memoizedState.isDehydrated&&(Ho(e,t).flags|=256),e=Sc(e,t),e!==2&&(t=It,It=n,t!==null&&Gh(t)),e}function Gh(e){It===null?It=e:It.push.apply(It,e)}function HA(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!Pn(i(),o))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Gr(e,t){for(t&=~Pg,t&=~Ld,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Tn(t),r=1<<n;e[n]=-1,t&=~r}}function B0(e){if(ve&6)throw Error(z(327));ss();var t=oc(e,0);if(!(t&1))return zt(e,We()),null;var n=Sc(e,t);if(e.tag!==0&&n===2){var r=yh(e);r!==0&&(t=r,n=Wh(e,r))}if(n===1)throw n=Zl,Ho(e,0),Gr(e,t),zt(e,We()),n;if(n===6)throw Error(z(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Lo(e,It,ar),zt(e,We()),null}function Dg(e,t){var n=ve;ve|=1;try{return e(t)}finally{ve=n,ve===0&&(ys=We()+500,Od&&Ro())}}function ei(e){Qr!==null&&Qr.tag===0&&!(ve&6)&&ss();var t=ve;ve|=1;var n=un.transition,r=Ce;try{if(un.transition=null,Ce=1,e)return e()}finally{Ce=r,un.transition=n,ve=t,!(ve&6)&&Ro()}}function Lg(){Ht=Yi.current,Pe(Yi)}function Ho(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,xA(n)),Ge!==null)for(n=Ge.return;n!==null;){var r=n;switch(mg(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&uc();break;case 3:ms(),Pe(_t),Pe(wt),Cg();break;case 5:bg(r);break;case 4:ms();break;case 13:Pe(ze);break;case 19:Pe(ze);break;case 10:xg(r.type._context);break;case 22:case 23:Lg()}n=n.return}if(it=e,Ge=e=uo(e.current,null),ft=Ht=t,tt=0,Zl=null,Pg=Ld=Zo=0,It=bl=null,zo!==null){for(t=0;t<zo.length;t++)if(n=zo[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,i=n.pending;if(i!==null){var s=i.next;i.next=o,r.next=s}n.pending=r}zo=null}return e}function AS(e,t){do{var n=Ge;try{if(vg(),$u.current=vc,yc){for(var r=Fe.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}yc=!1}if(Yo=0,nt=et=Fe=null,kl=!1,Ql=0,Og.current=null,n===null||n.return===null){tt=1,Zl=t,Ge=null;break}e:{var i=e,s=n.return,l=n,a=t;if(t=ft,l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var u=a,c=l,d=c.tag;if(!(c.mode&1)&&(d===0||d===11||d===15)){var f=c.alternate;f?(c.updateQueue=f.updateQueue,c.memoizedState=f.memoizedState,c.lanes=f.lanes):(c.updateQueue=null,c.memoizedState=null)}var p=T0(s);if(p!==null){p.flags&=-257,N0(p,s,l,i,t),p.mode&1&&R0(i,u,t),t=p,a=u;var h=t.updateQueue;if(h===null){var m=new Set;m.add(a),t.updateQueue=m}else h.add(a);break e}else{if(!(t&1)){R0(i,u,t),_g();break e}a=Error(z(426))}}else if(Le&&l.mode&1){var y=T0(s);if(y!==null){!(y.flags&65536)&&(y.flags|=256),N0(y,s,l,i,t),gg(gs(a,l));break e}}i=a=gs(a,l),tt!==4&&(tt=2),bl===null?bl=[i]:bl.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var g=pS(i,a,t);k0(i,g);break e;case 1:l=a;var v=i.type,k=i.stateNode;if(!(i.flags&128)&&(typeof v.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(lo===null||!lo.has(k)))){i.flags|=65536,t&=-t,i.lanes|=t;var S=hS(i,l,t);k0(i,S);break e}}i=i.return}while(i!==null)}IS(n)}catch(b){t=b,Ge===n&&n!==null&&(Ge=n=n.return);continue}break}while(!0)}function OS(){var e=xc.current;return xc.current=vc,e===null?vc:e}function _g(){(tt===0||tt===3||tt===2)&&(tt=4),it===null||!(Zo&268435455)&&!(Ld&268435455)||Gr(it,ft)}function Sc(e,t){var n=ve;ve|=2;var r=OS();(it!==e||ft!==t)&&(ar=null,Ho(e,t));do try{UA();break}catch(o){AS(e,o)}while(!0);if(vg(),ve=n,xc.current=r,Ge!==null)throw Error(z(261));return it=null,ft=0,tt}function UA(){for(;Ge!==null;)PS(Ge)}function WA(){for(;Ge!==null&&!gN();)PS(Ge)}function PS(e){var t=LS(e.alternate,e,Ht);e.memoizedProps=e.pendingProps,t===null?IS(e):Ge=t,Og.current=null}function IS(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=zA(n,t),n!==null){n.flags&=32767,Ge=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{tt=6,Ge=null;return}}else if(n=$A(n,t,Ht),n!==null){Ge=n;return}if(t=t.sibling,t!==null){Ge=t;return}Ge=t=e}while(t!==null);tt===0&&(tt=5)}function Lo(e,t,n){var r=Ce,o=un.transition;try{un.transition=null,Ce=1,GA(e,t,n,r)}finally{un.transition=o,Ce=r}return null}function GA(e,t,n,r){do ss();while(Qr!==null);if(ve&6)throw Error(z(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(z(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(MN(e,i),e===it&&(Ge=it=null,ft=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||eu||(eu=!0,_S(rc,function(){return ss(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=un.transition,un.transition=null;var s=Ce;Ce=1;var l=ve;ve|=4,Og.current=null,FA(e,n),RS(n,e),fA(bh),ic=!!Sh,bh=Sh=null,e.current=n,BA(n),yN(),ve=l,Ce=s,un.transition=i}else e.current=n;if(eu&&(eu=!1,Qr=e,kc=o),i=e.pendingLanes,i===0&&(lo=null),wN(n.stateNode),zt(e,We()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(wc)throw wc=!1,e=Hh,Hh=null,e;return kc&1&&e.tag!==0&&ss(),i=e.pendingLanes,i&1?e===Uh?Cl++:(Cl=0,Uh=e):Cl=0,Ro(),null}function ss(){if(Qr!==null){var e=p1(kc),t=un.transition,n=Ce;try{if(un.transition=null,Ce=16>e?16:e,Qr===null)var r=!1;else{if(e=Qr,Qr=null,kc=0,ve&6)throw Error(z(331));var o=ve;for(ve|=4,W=e.current;W!==null;){var i=W,s=i.child;if(W.flags&16){var l=i.deletions;if(l!==null){for(var a=0;a<l.length;a++){var u=l[a];for(W=u;W!==null;){var c=W;switch(c.tag){case 0:case 11:case 15:Sl(8,c,i)}var d=c.child;if(d!==null)d.return=c,W=d;else for(;W!==null;){c=W;var f=c.sibling,p=c.return;if(CS(c),c===u){W=null;break}if(f!==null){f.return=p,W=f;break}W=p}}}var h=i.alternate;if(h!==null){var m=h.child;if(m!==null){h.child=null;do{var y=m.sibling;m.sibling=null,m=y}while(m!==null)}}W=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,W=s;else e:for(;W!==null;){if(i=W,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Sl(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,W=g;break e}W=i.return}}var v=e.current;for(W=v;W!==null;){s=W;var k=s.child;if(s.subtreeFlags&2064&&k!==null)k.return=s,W=k;else e:for(s=v;W!==null;){if(l=W,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Dd(9,l)}}catch(b){He(l,l.return,b)}if(l===s){W=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,W=S;break e}W=l.return}}if(ve=o,Ro(),Wn&&typeof Wn.onPostCommitFiberRoot=="function")try{Wn.onPostCommitFiberRoot(Md,e)}catch{}r=!0}return r}finally{Ce=n,un.transition=t}}return!1}function V0(e,t,n){t=gs(n,t),t=pS(e,t,1),e=so(e,t,1),t=Mt(),e!==null&&(ya(e,1,t),zt(e,t))}function He(e,t,n){if(e.tag===3)V0(e,e,n);else for(;t!==null;){if(t.tag===3){V0(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(lo===null||!lo.has(r))){e=gs(n,e),e=hS(t,e,1),t=so(t,e,1),e=Mt(),t!==null&&(ya(t,1,e),zt(t,e));break}}t=t.return}}function qA(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Mt(),e.pingedLanes|=e.suspendedLanes&n,it===e&&(ft&n)===n&&(tt===4||tt===3&&(ft&130023424)===ft&&500>We()-Ig?Ho(e,0):Pg|=n),zt(e,t)}function DS(e,t){t===0&&(e.mode&1?(t=Ua,Ua<<=1,!(Ua&130023424)&&(Ua=4194304)):t=1);var n=Mt();e=Cr(e,t),e!==null&&(ya(e,t,n),zt(e,n))}function KA(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),DS(e,n)}function JA(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(z(314))}r!==null&&r.delete(t),DS(e,n)}var LS;LS=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||_t.current)Lt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Lt=!1,_A(e,t,n);Lt=!!(e.flags&131072)}else Lt=!1,Le&&t.flags&1048576&&j1(t,fc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ju(e,t),e=t.pendingProps;var o=fs(t,wt.current);is(t,n),o=Mg(null,t,r,e,o,n);var i=Rg();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,$t(r)?(i=!0,cc(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,kg(t),o.updater=Id,t.stateNode=o,o._reactInternals=t,Ph(t,r,e,n),t=Lh(null,t,r,!0,i,n)):(t.tag=0,Le&&i&&hg(t),St(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ju(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=XA(r),e=kn(r,e),o){case 0:t=Dh(null,t,r,e,n);break e;case 1:t=P0(null,t,r,e,n);break e;case 11:t=A0(null,t,r,e,n);break e;case 14:t=O0(null,t,r,kn(r.type,e),n);break e}throw Error(z(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:kn(r,o),Dh(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:kn(r,o),P0(e,t,r,o,n);case 3:e:{if(vS(t),e===null)throw Error(z(387));r=t.pendingProps,i=t.memoizedState,o=i.element,W1(e,t),mc(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=gs(Error(z(423)),t),t=I0(e,t,r,n,o);break e}else if(r!==o){o=gs(Error(z(424)),t),t=I0(e,t,r,n,o);break e}else for(Wt=io(t.stateNode.containerInfo.firstChild),Gt=t,Le=!0,bn=null,n=H1(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ps(),r===o){t=Er(e,t,n);break e}St(e,t,r,n)}t=t.child}return t;case 5:return G1(t),e===null&&Nh(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,Ch(r,o)?s=null:i!==null&&Ch(r,i)&&(t.flags|=32),yS(e,t),St(e,t,s,n),t.child;case 6:return e===null&&Nh(t),null;case 13:return xS(e,t,n);case 4:return Sg(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=hs(t,null,r,n):St(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:kn(r,o),A0(e,t,r,o,n);case 7:return St(e,t,t.pendingProps,n),t.child;case 8:return St(e,t,t.pendingProps.children,n),t.child;case 12:return St(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,Ne(pc,r._currentValue),r._currentValue=s,i!==null)if(Pn(i.value,s)){if(i.children===o.children&&!_t.current){t=Er(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){s=i.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=yr(-1,n&-n),a.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Ah(i.return,n,t),l.lanes|=n;break}a=a.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(z(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Ah(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}St(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,is(t,n),o=pn(o),r=r(o),t.flags|=1,St(e,t,r,n),t.child;case 14:return r=t.type,o=kn(r,t.pendingProps),o=kn(r.type,o),O0(e,t,r,o,n);case 15:return mS(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:kn(r,o),ju(e,t),t.tag=1,$t(r)?(e=!0,cc(t)):e=!1,is(t,n),fS(t,r,o),Ph(t,r,o,n),Lh(null,t,r,!0,e,n);case 19:return wS(e,t,n);case 22:return gS(e,t,n)}throw Error(z(156,t.tag))};function _S(e,t){return u1(e,t)}function QA(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function an(e,t,n,r){return new QA(e,t,n,r)}function $g(e){return e=e.prototype,!(!e||!e.isReactComponent)}function XA(e){if(typeof e=="function")return $g(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ng)return 11;if(e===rg)return 14}return 2}function uo(e,t){var n=e.alternate;return n===null?(n=an(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Vu(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")$g(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Vi:return Uo(n.children,o,i,t);case tg:s=8,o|=8;break;case nh:return e=an(12,n,t,o|2),e.elementType=nh,e.lanes=i,e;case rh:return e=an(13,n,t,o),e.elementType=rh,e.lanes=i,e;case oh:return e=an(19,n,t,o),e.elementType=oh,e.lanes=i,e;case Gk:return _d(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Uk:s=10;break e;case Wk:s=9;break e;case ng:s=11;break e;case rg:s=14;break e;case Fr:s=16,r=null;break e}throw Error(z(130,e==null?e:typeof e,""))}return t=an(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function Uo(e,t,n,r){return e=an(7,e,r,t),e.lanes=n,e}function _d(e,t,n,r){return e=an(22,e,r,t),e.elementType=Gk,e.lanes=n,e.stateNode={isHidden:!1},e}function np(e,t,n){return e=an(6,e,null,t),e.lanes=n,e}function rp(e,t,n){return t=an(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function YA(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=$f(0),this.expirationTimes=$f(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$f(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function zg(e,t,n,r,o,i,s,l,a){return e=new YA(e,t,n,l,a),t===1?(t=1,i===!0&&(t|=8)):t=0,i=an(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},kg(i),e}function ZA(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Bi,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function $S(e){if(!e)return vo;e=e._reactInternals;e:{if(ci(e)!==e||e.tag!==1)throw Error(z(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if($t(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(z(171))}if(e.tag===1){var n=e.type;if($t(n))return $1(e,n,t)}return t}function zS(e,t,n,r,o,i,s,l,a){return e=zg(n,r,!0,e,o,i,s,l,a),e.context=$S(null),n=e.current,r=Mt(),o=ao(n),i=yr(r,o),i.callback=t??null,so(n,i,o),e.current.lanes=o,ya(e,o,r),zt(e,r),e}function $d(e,t,n,r){var o=t.current,i=Mt(),s=ao(o);return n=$S(n),t.context===null?t.context=n:t.pendingContext=n,t=yr(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=so(o,t,s),e!==null&&(Nn(e,o,s,i),_u(e,o,s)),s}function bc(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function H0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function jg(e,t){H0(e,t),(e=e.alternate)&&H0(e,t)}function eO(){return null}var jS=typeof reportError=="function"?reportError:function(e){console.error(e)};function Fg(e){this._internalRoot=e}zd.prototype.render=Fg.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(z(409));$d(e,t,null,null)};zd.prototype.unmount=Fg.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ei(function(){$d(null,e,null,null)}),t[br]=null}};function zd(e){this._internalRoot=e}zd.prototype.unstable_scheduleHydration=function(e){if(e){var t=g1();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Wr.length&&t!==0&&t<Wr[n].priority;n++);Wr.splice(n,0,e),n===0&&v1(e)}};function Bg(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function jd(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function U0(){}function tO(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var u=bc(s);i.call(u)}}var s=zS(t,r,e,0,null,!1,!1,"",U0);return e._reactRootContainer=s,e[br]=s.current,Wl(e.nodeType===8?e.parentNode:e),ei(),s}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var l=r;r=function(){var u=bc(a);l.call(u)}}var a=zg(e,0,!1,null,null,!1,!1,"",U0);return e._reactRootContainer=a,e[br]=a.current,Wl(e.nodeType===8?e.parentNode:e),ei(function(){$d(t,a,n,r)}),a}function Fd(e,t,n,r,o){var i=n._reactRootContainer;if(i){var s=i;if(typeof o=="function"){var l=o;o=function(){var a=bc(s);l.call(a)}}$d(t,s,e,o)}else s=tO(n,t,e,o,r);return bc(s)}h1=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ll(t.pendingLanes);n!==0&&(sg(t,n|1),zt(t,We()),!(ve&6)&&(ys=We()+500,Ro()))}break;case 13:ei(function(){var r=Cr(e,1);if(r!==null){var o=Mt();Nn(r,e,1,o)}}),jg(e,1)}};lg=function(e){if(e.tag===13){var t=Cr(e,134217728);if(t!==null){var n=Mt();Nn(t,e,134217728,n)}jg(e,134217728)}};m1=function(e){if(e.tag===13){var t=ao(e),n=Cr(e,t);if(n!==null){var r=Mt();Nn(n,e,t,r)}jg(e,t)}};g1=function(){return Ce};y1=function(e,t){var n=Ce;try{return Ce=e,t()}finally{Ce=n}};hh=function(e,t,n){switch(t){case"input":if(lh(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=Ad(r);if(!o)throw Error(z(90));Kk(r),lh(r,o)}}}break;case"textarea":Qk(e,n);break;case"select":t=n.value,t!=null&&es(e,!!n.multiple,t,!1)}};r1=Dg;o1=ei;var nO={usingClientEntryPoint:!1,Events:[xa,Gi,Ad,t1,n1,Dg]},Qs={findFiberByHostInstance:$o,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},rO={bundleType:Qs.bundleType,version:Qs.version,rendererPackageName:Qs.rendererPackageName,rendererConfig:Qs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Mr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=l1(e),e===null?null:e.stateNode},findFiberByHostInstance:Qs.findFiberByHostInstance||eO,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var tu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tu.isDisabled&&tu.supportsFiber)try{Md=tu.inject(rO),Wn=tu}catch{}}Xt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=nO;Xt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Bg(t))throw Error(z(200));return ZA(e,t,null,n)};Xt.createRoot=function(e,t){if(!Bg(e))throw Error(z(299));var n=!1,r="",o=jS;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=zg(e,1,!1,null,null,n,!1,r,o),e[br]=t.current,Wl(e.nodeType===8?e.parentNode:e),new Fg(t)};Xt.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(z(188)):(e=Object.keys(e).join(","),Error(z(268,e)));return e=l1(t),e=e===null?null:e.stateNode,e};Xt.flushSync=function(e){return ei(e)};Xt.hydrate=function(e,t,n){if(!jd(t))throw Error(z(200));return Fd(null,e,t,!0,n)};Xt.hydrateRoot=function(e,t,n){if(!Bg(e))throw Error(z(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=jS;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=zS(t,null,e,1,n??null,o,!1,i,s),e[br]=t.current,Wl(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new zd(t)};Xt.render=function(e,t,n){if(!jd(t))throw Error(z(200));return Fd(null,e,t,!1,n)};Xt.unmountComponentAtNode=function(e){if(!jd(e))throw Error(z(40));return e._reactRootContainer?(ei(function(){Fd(null,null,e,!1,function(){e._reactRootContainer=null,e[br]=null})}),!0):!1};Xt.unstable_batchedUpdates=Dg;Xt.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!jd(n))throw Error(z(200));if(e==null||e._reactInternals===void 0)throw Error(z(38));return Fd(e,t,n,!1,r)};Xt.version="18.3.1-next-f1338f8080-20240426";function FS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(FS)}catch(e){console.error(e)}}FS(),Fk.exports=Xt;var di=Fk.exports;const BS=Tk(di);var VS,W0=di;VS=W0.createRoot,W0.hydrateRoot;/**
41
- * @remix-run/router v1.23.2
42
- *
43
- * Copyright (c) Remix Software Inc.
44
- *
45
- * This source code is licensed under the MIT license found in the
46
- * LICENSE.md file in the root directory of this source tree.
47
- *
48
- * @license MIT
49
- */function ea(){return ea=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ea.apply(this,arguments)}var Xr;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Xr||(Xr={}));const G0="popstate";function oO(e){e===void 0&&(e={});function t(r,o){let{pathname:i,search:s,hash:l}=r.location;return qh("",{pathname:i,search:s,hash:l},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(r,o){return typeof o=="string"?o:Cc(o)}return sO(t,n,null,e)}function Ke(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Vg(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function iO(){return Math.random().toString(36).substr(2,8)}function q0(e,t){return{usr:e.state,key:e.key,idx:t}}function qh(e,t,n,r){return n===void 0&&(n=null),ea({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Os(t):t,{state:n,key:t&&t.key||r||iO()})}function Cc(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Os(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function sO(e,t,n,r){r===void 0&&(r={});let{window:o=document.defaultView,v5Compat:i=!1}=r,s=o.history,l=Xr.Pop,a=null,u=c();u==null&&(u=0,s.replaceState(ea({},s.state,{idx:u}),""));function c(){return(s.state||{idx:null}).idx}function d(){l=Xr.Pop;let y=c(),g=y==null?null:y-u;u=y,a&&a({action:l,location:m.location,delta:g})}function f(y,g){l=Xr.Push;let v=qh(m.location,y,g);u=c()+1;let k=q0(v,u),S=m.createHref(v);try{s.pushState(k,"",S)}catch(b){if(b instanceof DOMException&&b.name==="DataCloneError")throw b;o.location.assign(S)}i&&a&&a({action:l,location:m.location,delta:1})}function p(y,g){l=Xr.Replace;let v=qh(m.location,y,g);u=c();let k=q0(v,u),S=m.createHref(v);s.replaceState(k,"",S),i&&a&&a({action:l,location:m.location,delta:0})}function h(y){let g=o.location.origin!=="null"?o.location.origin:o.location.href,v=typeof y=="string"?y:Cc(y);return v=v.replace(/ $/,"%20"),Ke(g,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,g)}let m={get action(){return l},get location(){return e(o,s)},listen(y){if(a)throw new Error("A history only accepts one active listener");return o.addEventListener(G0,d),a=y,()=>{o.removeEventListener(G0,d),a=null}},createHref(y){return t(o,y)},createURL:h,encodeLocation(y){let g=h(y);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:f,replace:p,go(y){return s.go(y)}};return m}var K0;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(K0||(K0={}));function lO(e,t,n){return n===void 0&&(n="/"),aO(e,t,n)}function aO(e,t,n,r){let o=typeof t=="string"?Os(t):t,i=Hg(o.pathname||"/",n);if(i==null)return null;let s=HS(e);uO(s);let l=null;for(let a=0;l==null&&a<s.length;++a){let u=kO(i);l=vO(s[a],u)}return l}function HS(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let o=(i,s,l)=>{let a={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};a.relativePath.startsWith("/")&&(Ke(a.relativePath.startsWith(r),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(r.length));let u=co([r,a.relativePath]),c=n.concat(a);i.children&&i.children.length>0&&(Ke(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),HS(i.children,t,c,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:gO(u,i.index),routesMeta:c})};return e.forEach((i,s)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))o(i,s);else for(let a of US(i.path))o(i,s,a)}),t}function US(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return o?[i,""]:[i];let s=US(r.join("/")),l=[];return l.push(...s.map(a=>a===""?i:[i,a].join("/"))),o&&l.push(...s),l.map(a=>e.startsWith("/")&&a===""?"/":a)}function uO(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:yO(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const cO=/^:[\w-]+$/,dO=3,fO=2,pO=1,hO=10,mO=-2,J0=e=>e==="*";function gO(e,t){let n=e.split("/"),r=n.length;return n.some(J0)&&(r+=mO),t&&(r+=fO),n.filter(o=>!J0(o)).reduce((o,i)=>o+(cO.test(i)?dO:i===""?pO:hO),r)}function yO(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function vO(e,t,n){let{routesMeta:r}=e,o={},i="/",s=[];for(let l=0;l<r.length;++l){let a=r[l],u=l===r.length-1,c=i==="/"?t:t.slice(i.length)||"/",d=xO({path:a.relativePath,caseSensitive:a.caseSensitive,end:u},c),f=a.route;if(!d)return null;Object.assign(o,d.params),s.push({params:o,pathname:co([i,d.pathname]),pathnameBase:MO(co([i,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(i=co([i,d.pathnameBase]))}return s}function xO(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=wO(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let i=o[0],s=i.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:r.reduce((u,c,d)=>{let{paramName:f,isOptional:p}=c;if(f==="*"){let m=l[d]||"";s=i.slice(0,i.length-m.length).replace(/(.)\/+$/,"$1")}const h=l[d];return p&&!h?u[f]=void 0:u[f]=(h||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:s,pattern:e}}function wO(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Vg(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,a)=>(r.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function kO(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Vg(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Hg(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const SO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bO=e=>SO.test(e);function CO(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?Os(e):e,i;if(n)if(bO(n))i=n;else{if(n.includes("//")){let s=n;n=n.replace(/\/\/+/g,"/"),Vg(!1,"Pathnames cannot have embedded double slashes - normalizing "+(s+" -> "+n))}n.startsWith("/")?i=Q0(n.substring(1),"/"):i=Q0(n,t)}else i=t;return{pathname:i,search:RO(r),hash:TO(o)}}function Q0(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function op(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function EO(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function WS(e,t){let n=EO(e);return t?n.map((r,o)=>o===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function GS(e,t,n,r){r===void 0&&(r=!1);let o;typeof e=="string"?o=Os(e):(o=ea({},e),Ke(!o.pathname||!o.pathname.includes("?"),op("?","pathname","search",o)),Ke(!o.pathname||!o.pathname.includes("#"),op("#","pathname","hash",o)),Ke(!o.search||!o.search.includes("#"),op("#","search","hash",o)));let i=e===""||o.pathname==="",s=i?"/":o.pathname,l;if(s==null)l=n;else{let d=t.length-1;if(!r&&s.startsWith("..")){let f=s.split("/");for(;f[0]==="..";)f.shift(),d-=1;o.pathname=f.join("/")}l=d>=0?t[d]:"/"}let a=CO(o,l),u=s&&s!=="/"&&s.endsWith("/"),c=(i||s===".")&&n.endsWith("/");return!a.pathname.endsWith("/")&&(u||c)&&(a.pathname+="/"),a}const co=e=>e.join("/").replace(/\/\/+/g,"/"),MO=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),RO=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,TO=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function NO(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const qS=["post","put","patch","delete"];new Set(qS);const AO=["get",...qS];new Set(AO);/**
50
- * React Router v6.30.3
51
- *
52
- * Copyright (c) Remix Software Inc.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE.md file in the root directory of this source tree.
56
- *
57
- * @license MIT
58
- */function ta(){return ta=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ta.apply(this,arguments)}const Ug=x.createContext(null),OO=x.createContext(null),fi=x.createContext(null),Bd=x.createContext(null),pi=x.createContext({outlet:null,matches:[],isDataRoute:!1}),KS=x.createContext(null);function PO(e,t){let{relative:n}=t===void 0?{}:t;ka()||Ke(!1);let{basename:r,navigator:o}=x.useContext(fi),{hash:i,pathname:s,search:l}=XS(e,{relative:n}),a=s;return r!=="/"&&(a=s==="/"?r:co([r,s])),o.createHref({pathname:a,search:l,hash:i})}function ka(){return x.useContext(Bd)!=null}function Sa(){return ka()||Ke(!1),x.useContext(Bd).location}function JS(e){x.useContext(fi).static||x.useLayoutEffect(e)}function QS(){let{isDataRoute:e}=x.useContext(pi);return e?WO():IO()}function IO(){ka()||Ke(!1);let e=x.useContext(Ug),{basename:t,future:n,navigator:r}=x.useContext(fi),{matches:o}=x.useContext(pi),{pathname:i}=Sa(),s=JSON.stringify(WS(o,n.v7_relativeSplatPath)),l=x.useRef(!1);return JS(()=>{l.current=!0}),x.useCallback(function(u,c){if(c===void 0&&(c={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let d=GS(u,JSON.parse(s),i,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:co([t,d.pathname])),(c.replace?r.replace:r.push)(d,c.state,c)},[t,r,s,i,e])}function XS(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=x.useContext(fi),{matches:o}=x.useContext(pi),{pathname:i}=Sa(),s=JSON.stringify(WS(o,r.v7_relativeSplatPath));return x.useMemo(()=>GS(e,JSON.parse(s),i,n==="path"),[e,s,i,n])}function DO(e,t){return LO(e,t)}function LO(e,t,n,r){ka()||Ke(!1);let{navigator:o}=x.useContext(fi),{matches:i}=x.useContext(pi),s=i[i.length-1],l=s?s.params:{};s&&s.pathname;let a=s?s.pathnameBase:"/";s&&s.route;let u=Sa(),c;if(t){var d;let y=typeof t=="string"?Os(t):t;a==="/"||(d=y.pathname)!=null&&d.startsWith(a)||Ke(!1),c=y}else c=u;let f=c.pathname||"/",p=f;if(a!=="/"){let y=a.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(y.length).join("/")}let h=lO(e,{pathname:p}),m=FO(h&&h.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:co([a,o.encodeLocation?o.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?a:co([a,o.encodeLocation?o.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),i,n,r);return t&&m?x.createElement(Bd.Provider,{value:{location:ta({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:Xr.Pop}},m):m}function _O(){let e=UO(),t=NO(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),n?x.createElement("pre",{style:o},n):null,null)}const $O=x.createElement(_O,null);class zO extends x.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?x.createElement(pi.Provider,{value:this.props.routeContext},x.createElement(KS.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function jO(e){let{routeContext:t,match:n,children:r}=e,o=x.useContext(Ug);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),x.createElement(pi.Provider,{value:t},r)}function FO(e,t,n,r){var o;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let s=e,l=(o=n)==null?void 0:o.errors;if(l!=null){let c=s.findIndex(d=>d.route.id&&(l==null?void 0:l[d.route.id])!==void 0);c>=0||Ke(!1),s=s.slice(0,Math.min(s.length,c+1))}let a=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let c=0;c<s.length;c++){let d=s[c];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(u=c),d.route.id){let{loaderData:f,errors:p}=n,h=d.route.loader&&f[d.route.id]===void 0&&(!p||p[d.route.id]===void 0);if(d.route.lazy||h){a=!0,u>=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((c,d,f)=>{let p,h=!1,m=null,y=null;n&&(p=l&&d.route.id?l[d.route.id]:void 0,m=d.route.errorElement||$O,a&&(u<0&&f===0?(GO("route-fallback"),h=!0,y=null):u===f&&(h=!0,y=d.route.hydrateFallbackElement||null)));let g=t.concat(s.slice(0,f+1)),v=()=>{let k;return p?k=m:h?k=y:d.route.Component?k=x.createElement(d.route.Component,null):d.route.element?k=d.route.element:k=c,x.createElement(jO,{match:d,routeContext:{outlet:c,matches:g,isDataRoute:n!=null},children:k})};return n&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?x.createElement(zO,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:v(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):v()},null)}var YS=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(YS||{}),ZS=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(ZS||{});function BO(e){let t=x.useContext(Ug);return t||Ke(!1),t}function VO(e){let t=x.useContext(OO);return t||Ke(!1),t}function HO(e){let t=x.useContext(pi);return t||Ke(!1),t}function eb(e){let t=HO(),n=t.matches[t.matches.length-1];return n.route.id||Ke(!1),n.route.id}function UO(){var e;let t=x.useContext(KS),n=VO(),r=eb();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function WO(){let{router:e}=BO(YS.UseNavigateStable),t=eb(ZS.UseNavigateStable),n=x.useRef(!1);return JS(()=>{n.current=!0}),x.useCallback(function(o,i){i===void 0&&(i={}),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,ta({fromRouteId:t},i)))},[e,t])}const X0={};function GO(e,t,n){X0[e]||(X0[e]=!0)}function qO(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function tb(e){Ke(!1)}function KO(e){let{basename:t="/",children:n=null,location:r,navigationType:o=Xr.Pop,navigator:i,static:s=!1,future:l}=e;ka()&&Ke(!1);let a=t.replace(/^\/*/,"/"),u=x.useMemo(()=>({basename:a,navigator:i,static:s,future:ta({v7_relativeSplatPath:!1},l)}),[a,l,i,s]);typeof r=="string"&&(r=Os(r));let{pathname:c="/",search:d="",hash:f="",state:p=null,key:h="default"}=r,m=x.useMemo(()=>{let y=Hg(c,a);return y==null?null:{location:{pathname:y,search:d,hash:f,state:p,key:h},navigationType:o}},[a,c,d,f,p,h,o]);return m==null?null:x.createElement(fi.Provider,{value:u},x.createElement(Bd.Provider,{children:n,value:m}))}function JO(e){let{children:t,location:n}=e;return DO(Kh(t),n)}new Promise(()=>{});function Kh(e,t){t===void 0&&(t=[]);let n=[];return x.Children.forEach(e,(r,o)=>{if(!x.isValidElement(r))return;let i=[...t,o];if(r.type===x.Fragment){n.push.apply(n,Kh(r.props.children,i));return}r.type!==tb&&Ke(!1),!r.props.index||!r.props.children||Ke(!1);let s={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(s.children=Kh(r.props.children,i)),n.push(s)}),n}/**
59
- * React Router DOM v6.30.3
60
- *
61
- * Copyright (c) Remix Software Inc.
62
- *
63
- * This source code is licensed under the MIT license found in the
64
- * LICENSE.md file in the root directory of this source tree.
65
- *
66
- * @license MIT
67
- */function Jh(){return Jh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jh.apply(this,arguments)}function QO(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function XO(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function YO(e,t){return e.button===0&&(!t||t==="_self")&&!XO(e)}const ZO=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],eP="6";try{window.__reactRouterVersion=eP}catch{}const tP="startTransition",Y0=Ed[tP];function nP(e){let{basename:t,children:n,future:r,window:o}=e,i=x.useRef();i.current==null&&(i.current=oO({window:o,v5Compat:!0}));let s=i.current,[l,a]=x.useState({action:s.action,location:s.location}),{v7_startTransition:u}=r||{},c=x.useCallback(d=>{u&&Y0?Y0(()=>a(d)):a(d)},[a,u]);return x.useLayoutEffect(()=>s.listen(c),[s,c]),x.useEffect(()=>qO(r),[r]),x.createElement(KO,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:s,future:r})}const rP=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",oP=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,iP=x.forwardRef(function(t,n){let{onClick:r,relative:o,reloadDocument:i,replace:s,state:l,target:a,to:u,preventScrollReset:c,viewTransition:d}=t,f=QO(t,ZO),{basename:p}=x.useContext(fi),h,m=!1;if(typeof u=="string"&&oP.test(u)&&(h=u,rP))try{let k=new URL(window.location.href),S=u.startsWith("//")?new URL(k.protocol+u):new URL(u),b=Hg(S.pathname,p);S.origin===k.origin&&b!=null?u=b+S.search+S.hash:m=!0}catch{}let y=PO(u,{relative:o}),g=sP(u,{replace:s,state:l,target:a,preventScrollReset:c,relative:o,viewTransition:d});function v(k){r&&r(k),k.defaultPrevented||g(k)}return x.createElement("a",Jh({},f,{href:h||y,onClick:m||i?r:v,ref:n,target:a}))});var Z0;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Z0||(Z0={}));var ex;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ex||(ex={}));function sP(e,t){let{target:n,replace:r,state:o,preventScrollReset:i,relative:s,viewTransition:l}=t===void 0?{}:t,a=QS(),u=Sa(),c=XS(e,{relative:s});return x.useCallback(d=>{if(YO(d,n)){d.preventDefault();let f=r!==void 0?r:Cc(u)===Cc(c);a(e,{replace:f,state:o,preventScrollReset:i,relative:s,viewTransition:l})}},[u,a,c,r,o,n,e,i,s,l])}var nb={exports:{}},rb={};/**
68
- * @license React
69
- * use-sync-external-store-shim.production.js
70
- *
71
- * Copyright (c) Meta Platforms, Inc. and affiliates.
72
- *
73
- * This source code is licensed under the MIT license found in the
74
- * LICENSE file in the root directory of this source tree.
75
- */var vs=x;function lP(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var aP=typeof Object.is=="function"?Object.is:lP,uP=vs.useState,cP=vs.useEffect,dP=vs.useLayoutEffect,fP=vs.useDebugValue;function pP(e,t){var n=t(),r=uP({inst:{value:n,getSnapshot:t}}),o=r[0].inst,i=r[1];return dP(function(){o.value=n,o.getSnapshot=t,ip(o)&&i({inst:o})},[e,n,t]),cP(function(){return ip(o)&&i({inst:o}),e(function(){ip(o)&&i({inst:o})})},[e]),fP(n),n}function ip(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!aP(e,n)}catch{return!0}}function hP(e,t){return t()}var mP=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?hP:pP;rb.useSyncExternalStore=vs.useSyncExternalStore!==void 0?vs.useSyncExternalStore:mP;nb.exports=rb;var Wg=nb.exports;function ut(e){this.content=e}ut.prototype={constructor:ut,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,o=r.find(e),i=r.content.slice();return o==-1?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new ut(i)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new ut(n)},addToStart:function(e,t){return new ut([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new ut(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(i==-1?o.length:i,0,t,n),new ut(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=ut.from(e),e.size?new ut(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=ut.from(e),e.size?new ut(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=ut.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}};ut.from=function(e){if(e instanceof ut)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new ut(t)};function ob(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=ob(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function ib(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=e.child(--o),l=t.child(--i),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let u=0,c=Math.min(s.text.length,l.text.length);for(;u<c&&s.text[s.text.length-u-1]==l.text[l.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(s.content.size||l.content.size){let u=ib(s.content,l.content,n-1,r-1);if(u)return u}n-=a,r-=a}}class _{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,o=0,i){for(let s=0,l=0;l<n;s++){let a=this.content[s],u=l+a.nodeSize;if(u>t&&r(a,o+l,i||null,s)!==!1&&a.content.size){let c=l+1;a.nodesBetween(Math.max(0,t-c),Math.min(a.content.size,n-c),r,o+c)}l=u}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,o){let i="",s=!0;return this.nodesBetween(t,n,(l,a)=>{let u=l.isText?l.text.slice(Math.max(t,a)-a,n-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&r&&(s?s=!1:i+=r),i+=u},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<t.content.length;i++)o.push(t.content[i]);return new _(o,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],o=0;if(n>t)for(let i=0,s=0;s<n;i++){let l=this.content[i],a=s+l.nodeSize;a>t&&((s<t||a>n)&&(l.isText?l=l.cut(Math.max(0,t-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,t-s-1),Math.min(l.content.size,n-s-1))),r.push(l),o+=l.nodeSize),s=a}return new _(r,o)}cutByIndex(t,n){return t==n?_.empty:t==0&&n==this.content.length?this:new _(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[t]=n,new _(o,i)}addToStart(t){return new _([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new _(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];t(o,r,n),r+=o.nodeSize}}findDiffStart(t,n=0){return ob(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return ib(this,t,n,r)}findIndex(t){if(t==0)return nu(0,t);if(t==this.size)return nu(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=t)return i==t?nu(n+1,i):nu(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return _.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new _(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return _.empty;let n,r=0;for(let o=0;o<t.length;o++){let i=t[o];r+=i.nodeSize,o&&i.isText&&t[o-1].sameMarkup(i)?(n||(n=t.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new _(n||t,r)}static from(t){if(!t)return _.empty;if(t instanceof _)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new _([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}_.empty=new _([],0);const sp={index:0,offset:0};function nu(e,t){return sp.index=e,sp.offset=t,sp}function Ec(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!Ec(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!Ec(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}let Te=class Qh{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let o=0;o<t.length;o++){let i=t[o];if(this.eq(i))return t;if(this.type.excludes(i.type))n||(n=t.slice(0,o));else{if(i.type.excludes(this.type))return t;!r&&i.type.rank>this.type.rank&&(n||(n=t.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&Ec(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return Qh.none;if(t instanceof Qh)return[t];let n=t.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Te.none=[];class Mc extends Error{}class B{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=lb(this.content,t+this.openStart,n);return r&&new B(r,this.openStart,this.openEnd)}removeBetween(t,n){return new B(sb(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return B.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new B(_.fromJSON(t,n.content),r,o)}static maxOpen(t,n=!0){let r=0,o=0;for(let i=t.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=t.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new B(t,r,o)}}B.empty=new B(_.empty,0,0);function sb(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:l}=e.findIndex(n);if(o==t||i.isText){if(l!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(sb(i.content,t-o-1,n-o-1)))}function lb(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=lb(s.content,t-i-1,n,s);return l&&e.replaceChild(o,s.copy(l))}function gP(e,t,n){if(n.openStart>e.depth)throw new Mc("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Mc("Inconsistent open depths");return ab(e,t,n,0)}function ab(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=ab(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let s=e.parent,l=s.content;return Go(s,l.cut(0,e.parentOffset).append(n.content).append(l.cut(t.parentOffset)))}else{let{start:s,end:l}=yP(n,e);return Go(i,cb(e,s,l,t,r))}else return Go(i,Rc(e,t,r))}function ub(e,t){if(!t.type.compatibleContent(e.type))throw new Mc("Cannot join "+t.type.name+" onto "+e.type.name)}function Xh(e,t,n){let r=e.node(n);return ub(r,t.node(n)),r}function Wo(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function El(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(Wo(e.nodeAfter,r),i++));for(let l=i;l<s;l++)Wo(o.child(l),r);t&&t.depth==n&&t.textOffset&&Wo(t.nodeBefore,r)}function Go(e,t){return e.type.checkContent(t),e.copy(t)}function cb(e,t,n,r,o){let i=e.depth>o&&Xh(e,t,o+1),s=r.depth>o&&Xh(n,r,o+1),l=[];return El(null,e,o,l),i&&s&&t.index(o)==n.index(o)?(ub(i,s),Wo(Go(i,cb(e,t,n,r,o+1)),l)):(i&&Wo(Go(i,Rc(e,t,o+1)),l),El(t,n,o,l),s&&Wo(Go(s,Rc(n,r,o+1)),l)),El(r,null,o,l),new _(l)}function Rc(e,t,n){let r=[];if(El(null,e,n,r),e.depth>n){let o=Xh(e,t,n+1);Wo(Go(o,Rc(e,t,n+1)),r)}return El(t,null,n,r),new _(r)}function yP(e,t){let n=t.depth-e.openStart,o=t.node(n).copy(e.content);for(let i=n-1;i>=0;i--)o=t.node(i).copy(_.from(o));return{start:o.resolveNoCache(e.openStart+n),end:o.resolveNoCache(o.content.size-e.openEnd-n)}}class na{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=t.child(n);return r?t.child(n).cut(r):o}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<t;i++)o+=r.child(i).nodeSize;return o}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return Te.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),o=t.maybeChild(n);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=t.parent.maybeChild(t.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new Tc(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=t;;){let{index:l,offset:a}=s.content.findIndex(i),u=i-a;if(r.push(s,l,o+a),!u||(s=s.child(l),s.isText))break;i=u-1,o+=a+1}return new na(n,r,i)}static resolveCached(t,n){let r=tx.get(t);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else tx.set(t,r=new vP);let o=r.elts[r.i]=na.resolve(t,n);return r.i=(r.i+1)%xP,o}}class vP{constructor(){this.elts=[],this.i=0}}const xP=12,tx=new WeakMap;class Tc{constructor(t,n,r){this.$from=t,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const wP=Object.create(null);let fo=class Yh{constructor(t,n,r,o=Te.none){this.type=t,this.attrs=n,this.marks=o,this.content=r||_.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,o=0){this.content.nodesBetween(t,n,r,o,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,o){return this.content.textBetween(t,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&Ec(this.attrs,n||t.defaultAttrs||wP)&&Te.sameSet(this.marks,r||Te.none)}copy(t=null){return t==this.content?this:new Yh(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Yh(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return B.empty;let o=this.resolve(t),i=this.resolve(n),s=r?0:o.sharedDepth(n),l=o.start(s),u=o.node(s).content.cut(o.pos-l,i.pos-l);return new B(u,o.depth-s,i.depth-s)}replace(t,n,r){return gP(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(o==t||n.isText)return n;t-=o+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(t){return na.resolveCached(this,t)}resolveNoCache(t){return na.resolve(this,t)}rangeHasMark(t,n,r){let o=!1;return n>t&&this.nodesBetween(t,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),db(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=_.empty,o=0,i=r.childCount){let s=this.contentMatchAt(t).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(t,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(t).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=Te.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!Te.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let o=_.fromJSON(t,n.content),i=t.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};fo.prototype.text=void 0;class Nc extends fo{constructor(t,n,r,o){if(super(t,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):db(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Nc(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Nc(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function db(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class ti{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new kP(t,n);if(r.next==null)return ti.empty;let o=fb(r);r.next&&r.err("Unexpected trailing text");let i=TP(RP(o));return NP(i,r),i}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(t.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(t,r);if(a&&(!n||a.validEnd))return _.from(l.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!(c.isText||c.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,l.concat(c));if(f)return f}}return null}return i(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(t)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let o=0;o<r.next.length;o++)t.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),t.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+t.indexOf(r.next[s].next);return i}).join(`
76
- `)}}ti.empty=new ti(!0);class kP{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function fb(e){let t=[];do t.push(SP(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function SP(e){let t=[];do t.push(bP(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function bP(e){let t=MP(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=CP(e,t);else break;return t}function nx(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function CP(e,t){let n=nx(e),r=n;return e.eat(",")&&(e.next!="}"?r=nx(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function EP(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(t)&&o.push(s)}return o.length==0&&e.err("No node type or group '"+t+"' found"),o}function MP(e){if(e.eat("(")){let t=fb(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=EP(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function RP(e){let t=[[]];return o(i(e,0),n()),t;function n(){return t.push([])-1}function r(s,l,a){let u={term:a,to:l};return t[s].push(u),u}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,u)=>a.concat(i(u,l)),[]);if(s.type=="seq")for(let a=0;;a++){let u=i(s.exprs[a],l);if(a==s.exprs.length-1)return u;o(u,l=n())}else if(s.type=="star"){let a=n();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let u=0;u<s.min;u++){let c=n();o(i(s.expr,a),c),a=c}if(s.max==-1)o(i(s.expr,a),a);else for(let u=s.min;u<s.max;u++){let c=n();r(a,c),o(i(s.expr,a),c),a=c}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function pb(e,t){return t-e}function rx(e,t){let n=[];return r(t),n.sort(pb);function r(o){let i=e[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&n.indexOf(a)==-1&&r(a)}}}function TP(e){let t=Object.create(null);return n(rx(e,0));function n(r){let o=[];r.forEach(s=>{e[s].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let c=0;c<o.length;c++)o[c][0]==l&&(u=o[c][1]);rx(e,a).forEach(c=>{u||o.push([l,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let i=t[r.join(",")]=new ti(r.indexOf(e.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(pb);i.next.push({type:o[s][0],next:t[l.join(",")]||n(l)})}return i}}function NP(e,t){for(let n=0,r=[e];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:u}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(u)==-1&&r.push(u)}i&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function hb(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function mb(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(o===void 0){let i=e[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function gb(e,t,n,r){for(let o in t)if(!(o in e))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in e){let i=e[o];i.validate&&i.validate(t[o])}}function yb(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new OP(e,r,t[r]);return n}let ox=class vb{constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=yb(t,r.attrs),this.defaultAttrs=hb(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ti.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:mb(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new fo(this,this.computeAttrs(t),_.from(n),Te.setFrom(r))}createChecked(t=null,n,r){return n=_.from(n),this.checkContent(n),new fo(this,this.computeAttrs(t),n,Te.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=_.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(_.empty,!0);return i?new fo(this,t,n.append(i),Te.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){gb(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:Te.none:t}static compile(t,n){let r=Object.create(null);t.forEach((i,s)=>r[i]=new vb(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function AP(e,t,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}class OP{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?AP(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Vd{constructor(t,n,r,o){this.name=t,this.rank=n,this.schema=r,this.spec=o,this.attrs=yb(t,o.attrs),this.excluded=null;let i=hb(this.attrs);this.instance=i?new Te(this,i):null}create(t=null){return!t&&this.instance?this.instance:new Te(this,mb(this.attrs,t))}static compile(t,n){let r=Object.create(null),o=0;return t.forEach((i,s)=>r[i]=new Vd(i,o++,n,s)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}checkAttrs(t){gb(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class xb{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in t)n[o]=t[o];n.nodes=ut.from(t.nodes),n.marks=ut.from(t.marks||{}),this.nodes=ox.compile(this.spec.nodes,this),this.marks=Vd.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=ti.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?ix(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:ix(this,s.split(" "))}this.nodeFromJSON=o=>fo.fromJSON(this,o),this.markFromJSON=o=>Te.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,o){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof ox){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,o)}text(t,n){let r=this.nodes.text;return new Nc(r,r.defaultAttrs,t,Te.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function ix(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let l in e.marks){let a=e.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function PP(e){return e.tag!=null}function IP(e){return e.style!=null}class vr{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(PP(o))this.tags.push(o);else if(IP(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=t.nodes[o.node];return i.contentMatch.matchType(i)})}parse(t,n={}){let r=new lx(this,n,!1);return r.addAll(t,Te.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new lx(this,n,!0);return r.addAll(t,Te.none,n.from,n.to),B.maxOpen(r.finish())}matchTag(t,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(_P(t,i.tag)&&(i.namespace===void 0||t.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(t);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(t,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(t)!=0||s.context&&!r.matchesContext(s.context)||l.length>t.length&&(l.charCodeAt(t.length)!=61||l.slice(t.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(t){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,o)}for(let o in t.marks){let i=t.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=ax(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in t.nodes){let i=t.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=ax(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new vr(t,vr.schemaRules(t)))}}const wb={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},DP={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},kb={ol:!0,ul:!0},ra=1,Zh=2,Ml=4;function sx(e,t,n){return t!=null?(t?ra:0)|(t==="full"?Zh:0):e&&e.whitespace=="pre"?ra|Zh:n&~Ml}class ru{constructor(t,n,r,o,i,s){this.type=t,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=Te.none,this.match=i||(s&Ml?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(_.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(t.type))?(this.match=r,o):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&ra)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=_.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(_.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!wb.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class lx{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=sx(null,n.preserveWhitespace,0)|(r?Ml:0);o?i=new ru(o.type,o.attrs,Te.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new ru(null,null,Te.none,!0,null,s):i=new ru(t.schema.topNodeType,null,Te.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let r=t.nodeValue,o=this.top,i=o.options&Zh?"full":this.localPreserveWS||(o.options&ra)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
77
- `);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(s.text(l[a]),n,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=o.content[o.content.length-1],a=t.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(t)}else this.findInside(t)}addElement(t,n,r){let o=this.localPreserveWS,i=this.top;(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let s=t.nodeName.toLowerCase(),l;kb.hasOwnProperty(s)&&this.parser.normalizeLists&&LP(t);let a=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(l=this.parser.matchTag(t,this,r));e:if(a?a.ignore:DP.hasOwnProperty(s))this.findInside(t),this.ignoreFallback(t,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(t=a.skip);let u,c=this.needsBlock;if(wb.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,n);break e}let d=a&&a.skip?n:this.readStyles(t,n);d&&this.addAll(t,d),u&&this.sync(i),this.needsBlock=c}else{let u=this.readStyles(t,n);u&&this.addElementByRule(t,a,u,a.consuming===!1?l:void 0)}this.localPreserveWS=o}leafFallback(t,n){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
78
- `),n)}ignoreFallback(t,n){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(t,n){let r=t.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(u=>!a.clearMark(u)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(t,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,t.nodeName=="BR")||this.leafFallback(t,r);else{let a=this.enter(s,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(t);else if(o)this.addElement(t,r,o);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=t;typeof n.contentElement=="string"?a=t.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(t):n.contentElement&&(a=n.contentElement),this.findAround(t,a,!0),this.addAll(a,r),this.findAround(t,a,!1)}i&&this.sync(l)&&this.open--}addAll(t,n,r,o){let i=r||0;for(let s=r?t.childNodes[r]:t.firstChild,l=o==null?null:t.childNodes[o];s!=l;s=s.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(s,n);this.findAtPoint(t,i)}findPlace(t,n,r){let o,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],u=a.findWrapping(t);if(u&&(!o||o.length>u.length+l)&&(o=u,i=a,!u.length))break;if(a.solid){if(r)break;l+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(t,n,r){if(t.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(t,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(t.type));let s=Te.none;for(let l of o.concat(t.marks))(i.type?i.type.allowsMarkType(l.type):ux(l.type,t.type))&&(s=l.addToSet(s));return i.content.push(t.mark(s)),!0}return!1}enter(t,n,r,o){let i=this.findPlace(t.create(n),r,!1);return i&&(i=this.enterInner(t,n,r,!0,o)),i}enterInner(t,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let l=sx(t,i,s.options);s.options&Ml&&s.content.length==0&&(l|=Ml);let a=Te.none;return r=r.filter(u=>(s.type?s.type.allowsMarkType(u.type):ux(u.type,t))?(a=u.addToSet(a),!1):!0),this.nodes.push(new ru(t,n,a,o,null,l)),this.open++,r}closeExtra(t=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(t){for(let n=this.open;n>=0;n--){if(this.nodes[n]==t)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=ra)}return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)t+=r[o].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,r){if(t!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&t.nodeType==1&&t.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let u=n[l];if(u==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let c=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;a--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function LP(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&kb.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function _P(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function ax(e){let t={};for(let n in e)t[n]=e[n];return t}function ux(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:u,next:c}=l.edge(a);if(u==t||i.indexOf(c)<0&&s(c))return!0}};if(s(o.contentMatch))return!0}}class hi{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=lp(n).createDocumentFragment());let o=r,i=[];return t.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let u=s.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(i[l][0])||u.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<s.marks.length;){let u=s.marks[a++],c=this.serializeMark(u,s.isInline,n);c&&(i.push([u,o]),o.appendChild(c.dom),o=c.contentDOM||c.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(t,n){let{dom:r,contentDOM:o}=Hu(lp(n),this.nodes[t.type.name](t),null,t.attrs);if(o){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,o)}return r}serializeNode(t,n={}){let r=this.serializeNodeInner(t,n);for(let o=t.marks.length-1;o>=0;o--){let i=this.serializeMark(t.marks[o],t.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(t,n,r={}){let o=this.marks[t.type.name];return o&&Hu(lp(r),o(t,n),null,t.attrs)}static renderSpec(t,n,r=null,o){return Hu(t,n,r,o)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new hi(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=cx(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return cx(t.marks)}}function cx(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function lp(e){return e.document||window.document}const dx=new WeakMap;function $P(e){let t=dx.get(e);return t===void 0&&dx.set(e,t=zP(e)),t}function zP(e){let t=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")t||(t=[]),t.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(e),t}function Hu(e,t,n,r){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let o=t[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=$P(r))&&i.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let l,a=n?e.createElementNS(n,o):e.createElement(o),u=t[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),u[d]):d=="style"&&a.style?a.style.cssText=u[d]:a.setAttribute(d,u[d])}}for(let d=c;d<t.length;d++){let f=t[d];if(f===0){if(d<t.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:p,contentDOM:h}=Hu(e,f,n,r);if(a.appendChild(p),h){if(l)throw new RangeError("Multiple content holes");l=h}}}return{dom:a,contentDOM:l}}const Sb=65535,bb=Math.pow(2,16);function jP(e,t){return e+t*bb}function fx(e){return e&Sb}function FP(e){return(e-(e&Sb))/bb}const Cb=1,Eb=2,Uu=4,Mb=8;class em{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Mb)>0}get deletedBefore(){return(this.delInfo&(Cb|Uu))>0}get deletedAfter(){return(this.delInfo&(Eb|Uu))>0}get deletedAcross(){return(this.delInfo&Uu)>0}}class Ut{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Ut.empty)return Ut.empty}recover(t){let n=0,r=fx(t);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+FP(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>t)break;let u=this.ranges[l+i],c=this.ranges[l+s],d=a+u;if(t<=d){let f=u?t==a?-1:t==d?1:n:n,p=a+o+(f<0?0:c);if(r)return p;let h=t==(n<0?a:d)?null:jP(l/3,t-a),m=t==a?Eb:t==d?Cb:Uu;return(n<0?t!=a:t!=d)&&(m|=Mb),new em(p,m,h)}o+=c-u}return r?t+o:new em(t+o,0,null)}touches(t,n){let r=0,o=fx(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>t)break;let u=this.ranges[l+i],c=a+u;if(t<=c&&l==o*3)return!0;r+=this.ranges[l+s]-u}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),u=this.ranges[o+n],c=this.ranges[o+r];t(l,l+u,a,a+c),i+=c-u}}invert(){return new Ut(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Ut.empty:new Ut(t<0?[0,-t,0]:[0,0,t])}}Ut.empty=new Ut([]);class oa{constructor(t,n,r=0,o=t?t.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=t||[],this.ownData=!(t||n)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new oa(this._maps,this.mirror,t,n)}appendMap(t,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(t){for(let n=0,r=this._maps.length;n<t._maps.length;n++){let o=t.getMirror(n);this.appendMap(t._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this._maps.length+t._maps.length;n>=0;n--){let o=t.getMirror(n);this.appendMap(t._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let t=new oa;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this._maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(t,n);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,t=this._maps[a].recover(l.recover);continue}}o|=l.delInfo,t=l.pos}return r?t:new em(t,o,null)}}const ap=Object.create(null);class kt{getMap(){return Ut.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ap[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in ap)throw new RangeError("Duplicate use of step JSON ID "+t);return ap[t]=n,n.prototype.jsonID=t,n}}class qe{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new qe(t,null)}static fail(t){return new qe(null,t)}static fromReplace(t,n,r,o){try{return qe.ok(t.replace(n,r,o))}catch(i){if(i instanceof Mc)return qe.fail(i.message);throw i}}}function Gg(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(Gg(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return _.fromArray(r)}class Yr extends kt{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new B(Gg(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return qe.fromReplace(t,this.from,this.to,i)}invert(){return new Rn(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Yr(n.pos,r.pos,this.mark)}merge(t){return t instanceof Yr&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Yr(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Yr(n.from,n.to,t.markFromJSON(n.mark))}}kt.jsonID("addMark",Yr);class Rn extends kt{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new B(Gg(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),t),n.openStart,n.openEnd);return qe.fromReplace(t,this.from,this.to,r)}invert(){return new Yr(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Rn(n.pos,r.pos,this.mark)}merge(t){return t instanceof Rn&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Rn(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Rn(n.from,n.to,t.markFromJSON(n.mark))}}kt.jsonID("removeMark",Rn);class Zr extends kt{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return qe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return qe.fromReplace(t,this.pos,this.pos+1,new B(_.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new Zr(this.pos,n.marks[o]);return new Zr(this.pos,this.mark)}}return new ni(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Zr(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Zr(n.pos,t.markFromJSON(n.mark))}}kt.jsonID("addNodeMark",Zr);class ni extends kt{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return qe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return qe.fromReplace(t,this.pos,this.pos+1,new B(_.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Zr(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new ni(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ni(n.pos,t.markFromJSON(n.mark))}}kt.jsonID("removeNodeMark",ni);class rt extends kt{constructor(t,n,r,o=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=o}apply(t){return this.structure&&tm(t,this.from,this.to)?qe.fail("Structure replace would overwrite content"):qe.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Ut([this.from,this.to-this.from,this.slice.size])}invert(t){return new rt(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new rt(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(t){if(!(t instanceof rt)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?B.empty:new B(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new rt(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?B.empty:new B(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new rt(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new rt(n.from,n.to,B.fromJSON(t,n.slice),!!n.structure)}}kt.jsonID("replace",rt);class st extends kt{constructor(t,n,r,o,i,s,l=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(t){if(this.structure&&(tm(t,this.from,this.gapFrom)||tm(t,this.gapTo,this.to)))return qe.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return qe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?qe.fromReplace(t,this.from,this.to,r):qe.fail("Content does not fit in gap")}getMap(){return new Ut([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new st(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new st(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new st(n.from,n.to,n.gapFrom,n.gapTo,B.fromJSON(t,n.slice),n.insert,!!n.structure)}}kt.jsonID("replaceAround",st);function tm(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function BP(e,t,n,r){let o=[],i=[],s,l;e.doc.nodesBetween(t,n,(a,u,c)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let f=Math.max(u,t),p=Math.min(u+a.nodeSize,n),h=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(h)||(s&&s.to==f&&s.mark.eq(d[m])?s.to=p:o.push(s=new Rn(f,p,d[m])));l&&l.to==f?l.to=p:i.push(l=new Yr(f,p,r))}}),o.forEach(a=>e.step(a)),i.forEach(a=>e.step(a))}function VP(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(r instanceof Vd){let u=s.marks,c;for(;c=r.isInSet(u);)(a||(a=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let u=Math.min(l+s.nodeSize,n);for(let c=0;c<a.length;c++){let d=a[c],f;for(let p=0;p<o.length;p++){let h=o[p];h.step==i-1&&d.eq(o[p].style)&&(f=h)}f?(f.to=u,f.step=i):o.push({style:d,from:Math.max(l,t),to:u,step:i})}}}),o.forEach(s=>e.step(new Rn(s.from,s.to,s.style)))}function qg(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),s=[],l=t+1;for(let a=0;a<i.childCount;a++){let u=i.child(a),c=l+u.nodeSize,d=r.matchType(u.type);if(!d)s.push(new rt(l,c,B.empty));else{r=d;for(let f=0;f<u.marks.length;f++)n.allowsMarkType(u.marks[f].type)||e.step(new Rn(l,c,u.marks[f]));if(o&&u.isText&&n.whitespace!="pre"){let f,p=/\r?\n|\r/g,h;for(;f=p.exec(u.text);)h||(h=new B(_.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),s.push(new rt(l+f.index,l+f.index+f[0].length,h))}}l=c}if(!r.validEnd){let a=r.fillBefore(_.empty,!0);e.replace(l,l,new B(a,0,0))}for(let a=s.length-1;a>=0;a--)e.step(s[a])}function HP(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Ps(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth,o=0,i=0;;--r){let s=e.$from.node(r),l=e.$from.index(r)+o,a=e.$to.indexAfter(r)-i;if(r<e.depth&&s.canReplace(l,a,n))return r;if(r==0||s.type.spec.isolating||!HP(s,l,a))break;l&&(o=1),a<s.childCount&&(i=1)}return null}function UP(e,t,n){let{$from:r,$to:o,depth:i}=t,s=r.before(i+1),l=o.after(i+1),a=s,u=l,c=_.empty,d=0;for(let h=i,m=!1;h>n;h--)m||r.index(h)>0?(m=!0,c=_.from(r.node(h).copy(c)),d++):a--;let f=_.empty,p=0;for(let h=i,m=!1;h>n;h--)m||o.after(h+1)<o.end(h)?(m=!0,f=_.from(o.node(h).copy(f)),p++):u++;e.step(new st(a,u,s,l,new B(c.append(f),d,p),c.size-d,!0))}function Kg(e,t,n=null,r=e){let o=WP(e,t),i=o&&GP(r,t);return i?o.map(px).concat({type:t,attrs:n}).concat(i.map(px)):null}function px(e){return{type:e,attrs:null}}function WP(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}function GP(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let u=r;a&&u<o;u++)a=a.matchType(n.child(u).type);return!a||!a.validEnd?null:s}function qP(e,t,n){let r=_.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let l=n[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=_.from(n[s].type.create(n[s].attrs,r))}let o=t.start,i=t.end;e.step(new st(o,i,o,i,new B(r,0,0),n.length,!0))}function KP(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(s,l)=>{let a=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,a)&&JP(e.doc,e.mapping.slice(i).map(l),r)){let u=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!h?u=!1:!p&&h&&(u=!0)}u===!1&&Tb(e,s,l,i),qg(e,e.mapping.slice(i).map(l,1),r,void 0,u===null);let c=e.mapping.slice(i),d=c.map(l,1),f=c.map(l+s.nodeSize,1);return e.step(new st(d,f,d+1,f-1,new B(_.from(r.create(a,null,s.marks)),0,0),1,!0)),u===!0&&Rb(e,s,l,i),!1}})}function Rb(e,t,n,r){t.forEach((o,i)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(o.text);){let a=e.mapping.slice(r).map(n+1+i+s.index);e.replaceWith(a,a+1,t.type.schema.linebreakReplacement.create())}}})}function Tb(e,t,n,r){t.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=e.mapping.slice(r).map(n+1+i);e.replaceWith(s,s+1,t.type.schema.text(`
79
- `))}})}function JP(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function QP(e,t,n,r,o){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new st(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new B(_.from(s),0,0),1,!0))}function xr(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let u=o.depth-1,c=n-2;u>i;u--,c--){let d=o.node(u),f=o.index(u);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(f,d.childCount),h=r&&r[c+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[c]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(p))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function XP(e,t,n=1,r){let o=e.doc.resolve(t),i=_.empty,s=_.empty;for(let l=o.depth,a=o.depth-n,u=n-1;l>a;l--,u--){i=_.from(o.node(l).copy(i));let c=r&&r[u];s=_.from(c?c.type.create(c.attrs,s):o.node(l).copy(s))}e.step(new rt(t,t,new B(i.append(s),n,n),!0))}function To(e,t){let n=e.resolve(t),r=n.index();return Nb(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function YP(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let o=0;o<t.childCount;o++){let i=t.child(o),s=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!e.type.allowsMarks(i.marks))return!1}return n.validEnd}function Nb(e,t){return!!(e&&t&&!e.isLeaf&&YP(e,t))}function Hd(e,t,n=-1){let r=e.resolve(t);for(let o=r.depth;;o--){let i,s,l=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),l++,s=r.node(o).maybeChild(l)):(i=r.node(o).maybeChild(l-1),s=r.node(o+1)),i&&!i.isTextblock&&Nb(i,s)&&r.node(o).canReplace(l,l+1))return t;if(o==0)break;t=n<0?r.before(o):r.after(o)}}function ZP(e,t,n){let r=null,{linebreakReplacement:o}=e.doc.type.schema,i=e.doc.resolve(t-n),s=i.node().type;if(o&&s.inlineContent){let c=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);c&&!d?r=!1:!c&&d&&(r=!0)}let l=e.steps.length;if(r===!1){let c=e.doc.resolve(t+n);Tb(e,c.node(),c.before(),l)}s.inlineContent&&qg(e,t+n-1,s,i.node().contentMatchAt(i.index()),r==null);let a=e.mapping.slice(l),u=a.map(t-n);if(e.step(new rt(u,a.map(t+n,-1),B.empty,!0)),r===!0){let c=e.doc.resolve(u);Rb(e,c.node(),c.before(),e.steps.length)}return e}function eI(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function Ab(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),u=r.node(s),c=!1;if(i==1)c=u.canReplace(a,a,o);else{let d=u.contentMatchAt(a).findWrapping(o.firstChild.type);c=d&&u.canReplaceWith(a,a,d[0])}if(c)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Ud(e,t,n=t,r=B.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return Ob(o,i,r)?new rt(t,n,r):new tI(o,i,r).fit()}function Ob(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class tI{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=_.empty;for(let o=0;o<=t.depth;o++){let i=t.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(t.indexAfter(o))})}for(let o=t.depth;o>0;o--)this.placed=_.from(t.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(t<0?this.$to:r.doc.resolve(t));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new B(i,s,l);return t>-1?new st(r.pos,t,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new rt(r.pos,o.pos,a):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<t;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){t=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=up(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:u}=this.frontier[l],c,d=null;if(n==1&&(s?u.matchType(s.type)||(d=u.fillBefore(_.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(n==2&&s&&(c=u.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:c};if(i&&u.matchType(i.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,o=up(t,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new B(t,n+1,Math.max(r,o.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,o=up(t,n);if(o.childCount<=1&&n>0){let i=t.size-n<=n+o.size;this.unplaced=new B(ul(t,n-1,1),n-1,i?n-1:r)}else this.unplaced=new B(ul(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-t,u=0,c=[],{match:d,type:f}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)c.push(o.child(m));d=d.matchFragment(o)}let p=l.size+t-(s.content.size-s.openEnd);for(;u<l.childCount;){let m=l.child(u),y=d.matchType(m.type);if(!y)break;u++,(u>1||a==0||m.content.size)&&(d=y,c.push(Pb(m.mark(f.allowedMarks(m.marks)),u==1?a:0,u==l.childCount?p:-1)))}let h=u==l.childCount;h||(p=-1),this.placed=cl(this.placed,n,_.from(c)),this.frontier[n].match=d,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,y=l;m<p;m++){let g=y.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),y=g.content}this.unplaced=h?t==0?B.empty:new B(ul(s.content,t-1,1),t-1,p<0?s.openEnd:t-1):new B(ul(s.content,t,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!cp(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),s=cp(t,n,o,r,i);if(s){for(let l=n-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],c=cp(t,l,u,a,!0);if(!c||c.childCount)continue e}return{depth:n,fit:s,move:i?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=cl(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let o=t.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,t.index(r));this.openFrontierNode(o.type,o.attrs,i)}return t}openFrontierNode(t,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(t),this.placed=cl(this.placed,this.depth,_.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(_.empty,!0);n.childCount&&(this.placed=cl(this.placed,this.frontier.length,n))}}function ul(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(ul(e.firstChild.content,t-1,n)))}function cl(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(cl(e.lastChild.content,t-1,n)))}function up(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Pb(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Pb(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(_.empty,!0)))),e.copy(r)}function cp(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!nI(n,i.content,s)?l:null}function nI(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function rI(e){return e.spec.defining||e.spec.definingForContent}function oI(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(Ob(o,i,r))return e.step(new rt(t,n,r));let s=Db(o,i);s[s.length-1]==0&&s.pop();let l=-(o.depth+1);s.unshift(l);for(let f=o.depth,p=o.pos-1;f>0;f--,p--){let h=o.node(f).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(f)>-1?l=f:o.before(f)==p&&s.splice(1,0,-f)}let a=s.indexOf(l),u=[],c=r.openStart;for(let f=r.content,p=0;;p++){let h=f.firstChild;if(u.push(h),p==r.openStart)break;f=h.content}for(let f=c-1;f>=0;f--){let p=u[f],h=rI(p.type);if(h&&!p.sameMarkup(o.node(Math.abs(l)-1)))c=f;else if(h||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+c+1)%(r.openStart+1),h=u[p];if(h)for(let m=0;m<s.length;m++){let y=s[(m+a)%s.length],g=!0;y<0&&(g=!1,y=-y);let v=o.node(y-1),k=o.index(y-1);if(v.canReplaceWith(k,k,h.type,h.marks))return e.replace(o.before(y),g?i.after(y):n,new B(Ib(r.content,0,r.openStart,p),p,r.openEnd))}}let d=e.steps.length;for(let f=s.length-1;f>=0&&(e.replace(t,n,r),!(e.steps.length>d));f--){let p=s[f];p<0||(t=o.before(p),n=i.after(p))}}function Ib(e,t,n,r,o){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(Ib(i.content,t+1,n,r,i)))}if(t>r){let i=o.contentMatchAt(0),s=i.fillBefore(e).append(e);e=s.append(i.matchFragment(s).fillBefore(_.empty,!0))}return e}function iI(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=eI(e.doc,t,r.type);o!=null&&(t=n=o)}e.replaceRange(t,n,new B(_.from(r),0,0))}function sI(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=Db(r,o);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return e.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return e.delete(r.before(l),o.after(l))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(t-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return e.delete(r.before(s),n);e.delete(t,n)}function Db(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let o=r;o>=0;o--){let i=e.start(o);if(i<e.pos-(e.depth-o)||t.end(o)>t.pos+(t.depth-o)||e.node(o).type.spec.isolating||t.node(o).type.spec.isolating)break;(i==t.start(o)||o==e.depth&&o==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&o&&t.start(o-1)==i-1)&&n.push(o)}return n}class ls extends kt{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return qe.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return qe.fromReplace(t,this.pos,this.pos+1,new B(_.from(o),0,n.isLeaf?0:1))}getMap(){return Ut.empty}invert(t){return new ls(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new ls(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ls(n.pos,n.attr,n.value)}}kt.jsonID("attr",ls);class ia extends kt{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let o in t.attrs)n[o]=t.attrs[o];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return qe.ok(r)}getMap(){return Ut.empty}invert(t){return new ia(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new ia(n.attr,n.value)}}kt.jsonID("docAttr",ia);let xs=class extends Error{};xs=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};xs.prototype=Object.create(Error.prototype);xs.prototype.constructor=xs;xs.prototype.name="TransformError";class Lb{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new oa}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new xs(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let o=this.mapping.maps[r];r&&(t=o.map(t,1),n=o.map(n,-1)),o.forEach((i,s,l,a)=>{t=Math.min(t,l),n=Math.max(n,a)})}return t==1e9?null:{from:t,to:n}}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=B.empty){let o=Ud(this.doc,t,n,r);return o&&this.step(o),this}replaceWith(t,n,r){return this.replace(t,n,new B(_.from(r),0,0))}delete(t,n){return this.replace(t,n,B.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return oI(this,t,n,r),this}replaceRangeWith(t,n,r){return iI(this,t,n,r),this}deleteRange(t,n){return sI(this,t,n),this}lift(t,n){return UP(this,t,n),this}join(t,n=1){return ZP(this,t,n),this}wrap(t,n){return qP(this,t,n),this}setBlockType(t,n=t,r,o=null){return KP(this,t,n,r,o),this}setNodeMarkup(t,n,r=null,o){return QP(this,t,n,r,o),this}setNodeAttribute(t,n,r){return this.step(new ls(t,n,r)),this}setDocAttribute(t,n){return this.step(new ia(t,n)),this}addNodeMark(t,n){return this.step(new Zr(t,n)),this}removeNodeMark(t,n){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n instanceof Te)n.isInSet(r.marks)&&this.step(new ni(t,n));else{let o=r.marks,i,s=[];for(;i=n.isInSet(o);)s.push(new ni(t,i)),o=i.removeFromSet(o);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(t,n=1,r){return XP(this,t,n,r),this}addMark(t,n,r){return BP(this,t,n,r),this}removeMark(t,n,r){return VP(this,t,n,r),this}clearIncompatible(t,n,r){return qg(this,t,n,r),this}}const dp=Object.create(null);class ce{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new _b(t.min(n),t.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let n=0;n<t.length;n++)if(t[n].$from.pos!=t[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,n=B.empty){let r=n.content.lastChild,o=null;for(let l=0;l<n.openEnd;l++)o=r,r=r.lastChild;let i=t.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:u}=s[l],c=t.mapping.slice(i);t.replaceRange(c.map(a.pos),c.map(u.pos),l?B.empty:n),l==0&&gx(t,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(t,n){let r=t.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:l}=o[i],a=t.mapping.slice(r),u=a.map(s.pos),c=a.map(l.pos);i?t.deleteRange(u,c):(t.replaceRangeWith(u,c,n),gx(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let o=t.parent.inlineContent?new de(t):_i(t.node(0),t.parent,t.pos,t.index(),n,r);if(o)return o;for(let i=t.depth-1;i>=0;i--){let s=n<0?_i(t.node(0),t.node(i),t.before(i+1),t.index(i),n,r):_i(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,n,r);if(s)return s}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new qt(t.node(0))}static atStart(t){return _i(t,t,0,0,1)||new qt(t)}static atEnd(t){return _i(t,t,t.content.size,t.childCount,-1)||new qt(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=dp[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in dp)throw new RangeError("Duplicate use of selection JSON ID "+t);return dp[t]=n,n.prototype.jsonID=t,n}getBookmark(){return de.between(this.$anchor,this.$head).getBookmark()}}ce.prototype.visible=!0;class _b{constructor(t,n){this.$from=t,this.$to=n}}let hx=!1;function mx(e){!hx&&!e.parent.inlineContent&&(hx=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class de extends ce{constructor(t,n=t){mx(t),mx(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return ce.near(r);let o=t.resolve(n.map(this.anchor));return new de(o.parent.inlineContent?o:r,r)}replace(t,n=B.empty){if(super.replace(t,n),n==B.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof de&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Wd(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new de(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let o=t.resolve(n);return new this(o,r==n?o:t.resolve(r))}static between(t,n,r){let o=t.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=ce.findFrom(n,r,!0)||ce.findFrom(n,-r,!0);if(i)n=i.$head;else return ce.near(n,r)}return t.parent.inlineContent||(o==0?t=n:(t=(ce.findFrom(t,-r,!0)||ce.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=o<0&&(t=n))),new de(t,n)}}ce.jsonID("text",de);class Wd{constructor(t,n){this.anchor=t,this.head=n}map(t){return new Wd(t.map(this.anchor),t.map(this.head))}resolve(t){return de.between(t.resolve(this.anchor),t.resolve(this.head))}}class ee extends ce{constructor(t){let n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);super(t,r),this.node=n}map(t,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),i=t.resolve(o);return r?ce.near(i):new ee(i)}content(){return new B(_.from(this.node),0,0)}eq(t){return t instanceof ee&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Jg(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ee(t.resolve(n.anchor))}static create(t,n){return new ee(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}ee.prototype.visible=!1;ce.jsonID("node",ee);class Jg{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new Wd(r,r):new Jg(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&ee.isSelectable(r)?new ee(n):ce.near(n)}}class qt extends ce{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=B.empty){if(n==B.empty){t.delete(0,t.doc.content.size);let r=ce.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new qt(t)}map(t){return new qt(t)}eq(t){return t instanceof qt}getBookmark(){return lI}}ce.jsonID("all",qt);const lI={map(){return this},resolve(e){return new qt(e)}};function _i(e,t,n,r,o,i=!1){if(t.inlineContent)return de.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let l=t.child(s);if(l.isAtom){if(!i&&ee.isSelectable(l))return ee.create(e,n-(o<0?l.nodeSize:0))}else{let a=_i(e,l,n+o,o<0?l.childCount:0,o,i);if(a)return a}n+=l.nodeSize*o}return null}function gx(e,t,n){let r=e.steps.length-1;if(r<t)return;let o=e.steps[r];if(!(o instanceof rt||o instanceof st))return;let i=e.mapping.maps[r],s;i.forEach((l,a,u,c)=>{s==null&&(s=c)}),e.setSelection(ce.near(e.doc.resolve(s),n))}const yx=1,ou=2,vx=4;class aI extends Lb{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|yx)&~ou,this.storedMarks=null,this}get selectionSet(){return(this.updated&yx)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=ou,this}ensureMarks(t){return Te.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&ou)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~ou,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let r=this.selection;return n&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Te.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,r){let o=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(o.text(t),!0):this.deleteSelection();{if(r==null&&(r=n),!t)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(t,i)),!this.selection.empty&&this.selection.to==n+t.length&&this.setSelection(ce.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=vx,this}get scrolledIntoView(){return(this.updated&vx)>0}}function xx(e,t){return!t||!e?e:e.bind(t)}class dl{constructor(t,n,r){this.name=t,this.init=xx(n.init,r),this.apply=xx(n.apply,r)}}const uI=[new dl("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new dl("selection",{init(e,t){return e.selection||ce.atStart(t.doc)},apply(e){return e.selection}}),new dl("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new dl("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class fp{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=uI.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new dl(r.key,r.spec.state,r))})}}class Zi{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let n=[t],r=this.applyInner(t),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=o?o[s].n:0,u=o?o[s].state:this,c=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,u,r);if(c&&r.filterTransaction(c,s)){if(c.setMeta("appendedTransaction",t),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),i=!0}o&&(o[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Zi(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new aI(this)}static create(t){let n=new fp(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new Zi(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(t,r);return r}reconfigure(t){let n=new fp(this.schema,t.plugins),r=n.fields,o=new Zi(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(t,o)}return o}toJSON(t){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=t[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.key]))}return n}static fromJSON(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let o=new fp(t.schema,t.plugins),i=new Zi(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=fo.fromJSON(t.schema,n.doc);else if(s.name=="selection")i.selection=ce.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],u=a.spec.state;if(a.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[s.name]=u.fromJSON.call(a,t,n[l],i);return}}i[s.name]=s.init(t,i)}}),i}}function $b(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):r=="handleDOMEvents"&&(o=$b(o,t,{})),n[r]=o}return n}class Ie{constructor(t){this.spec=t,this.props={},t.props&&$b(t.props,this,this.props),this.key=t.key?t.key.key:zb("plugin")}getState(t){return t[this.key]}}const pp=Object.create(null);function zb(e){return e in pp?e+"$"+ ++pp[e]:(pp[e]=0,e+"$")}class _e{constructor(t="key"){this.key=zb(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const Qg=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function jb(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const Fb=(e,t,n)=>{let r=jb(e,n);if(!r)return!1;let o=Xg(r);if(!o){let s=r.blockRange(),l=s&&Ps(s);return l==null?!1:(t&&t(e.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(Jb(e,o,t,-1))return!0;if(r.parent.content.size==0&&(ws(i,"end")||ee.isSelectable(i)))for(let s=r.depth;;s--){let l=Ud(e.doc,r.before(s),r.after(s),B.empty);if(l&&l.slice.size<l.to-l.from){if(t){let a=e.tr.step(l);a.setSelection(ws(i,"end")?ce.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):ee.create(a.doc,o.pos-i.nodeSize)),t(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},cI=(e,t,n)=>{let r=jb(e,n);if(!r)return!1;let o=Xg(r);return o?Bb(e,o,t):!1},dI=(e,t,n)=>{let r=Hb(e,n);if(!r)return!1;let o=Yg(r);return o?Bb(e,o,t):!1};function Bb(e,t,n){let r=t.nodeBefore,o=r,i=t.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let c=o.lastChild;if(!c)return!1;o=c}let s=t.nodeAfter,l=s,a=t.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let c=l.firstChild;if(!c)return!1;l=c}let u=Ud(e.doc,i,a,B.empty);if(!u||u.from!=i||u instanceof rt&&u.slice.size>=a-i)return!1;if(n){let c=e.tr.step(u);c.setSelection(de.create(c.doc,i)),n(c.scrollIntoView())}return!0}function ws(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Vb=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=Xg(r)}let s=i&&i.nodeBefore;return!s||!ee.isSelectable(s)?!1:(t&&t(e.tr.setSelection(ee.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Xg(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Hb(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const Ub=(e,t,n)=>{let r=Hb(e,n);if(!r)return!1;let o=Yg(r);if(!o)return!1;let i=o.nodeAfter;if(Jb(e,o,t,1))return!0;if(r.parent.content.size==0&&(ws(i,"start")||ee.isSelectable(i))){let s=Ud(e.doc,r.before(),r.after(),B.empty);if(s&&s.slice.size<s.to-s.from){if(t){let l=e.tr.step(s);l.setSelection(ws(i,"start")?ce.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):ee.create(l.doc,l.mapping.map(o.pos))),t(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},Wb=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=Yg(r)}let s=i&&i.nodeAfter;return!s||!ee.isSelectable(s)?!1:(t&&t(e.tr.setSelection(ee.create(e.doc,i.pos)).scrollIntoView()),!0)};function Yg(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const fI=(e,t)=>{let n=e.selection,r=n instanceof ee,o;if(r){if(n.node.isTextblock||!To(e.doc,n.from))return!1;o=n.from}else if(o=Hd(e.doc,n.from,-1),o==null)return!1;if(t){let i=e.tr.join(o);r&&i.setSelection(ee.create(i.doc,o-e.doc.resolve(o).nodeBefore.nodeSize)),t(i.scrollIntoView())}return!0},pI=(e,t)=>{let n=e.selection,r;if(n instanceof ee){if(n.node.isTextblock||!To(e.doc,n.to))return!1;r=n.to}else if(r=Hd(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},hI=(e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&Ps(o);return i==null?!1:(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)},Gb=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
80
- `).scrollIntoView()),!0)};function Zg(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const mI=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Zg(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let l=n.after(),a=e.tr.replaceWith(l,l,s.createAndFill());a.setSelection(ce.near(a.doc.resolve(l),1)),t(a.scrollIntoView())}return!0},qb=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof qt||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Zg(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=e.tr.insert(s,i.createAndFill());l.setSelection(de.create(l.doc,s+1)),t(l.scrollIntoView())}return!0},Kb=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(xr(e.doc,i))return t&&t(e.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Ps(r);return o==null?!1:(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};function gI(e){return(t,n)=>{let{$from:r,$to:o}=t.selection;if(t.selection instanceof ee&&t.selection.node.isBlock)return!r.parentOffset||!xr(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,l,a=!1,u=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){a=r.end(p)==r.pos+(r.depth-p),u=r.start(p)==r.pos-(r.depth-p),l=Zg(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),i.unshift(a&&l?{type:l}:null),s=p;break}else{if(p==1)return!1;i.unshift(null)}let c=t.tr;(t.selection instanceof de||t.selection instanceof qt)&&c.deleteSelection();let d=c.mapping.map(r.pos),f=xr(c.doc,d,i.length,i);if(f||(i[0]=l?{type:l}:null,f=xr(c.doc,d,i.length,i)),!f)return!1;if(c.split(d,i.length,i),!a&&u&&r.node(s).type!=l){let p=c.mapping.map(r.before(s)),h=c.doc.resolve(p);l&&r.node(s-1).canReplaceWith(h.index(),h.index()+1,l)&&c.setNodeMarkup(c.mapping.map(r.before(s)),l)}return n&&n(c.scrollIntoView()),!0}}const yI=gI(),vI=(e,t)=>{let{$from:n,to:r}=e.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),t&&t(e.tr.setSelection(ee.create(e.doc,o))),!0)};function xI(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(i,i+1)||!(o.isTextblock||To(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function Jb(e,t,n,r){let o=t.nodeBefore,i=t.nodeAfter,s,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&xI(e,t,n))return!0;let u=!a&&t.parent.canReplace(t.index(),t.index()+1);if(u&&(s=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let p=t.pos+i.nodeSize,h=_.empty;for(let g=s.length-1;g>=0;g--)h=_.from(s[g].create(null,h));h=_.from(o.copy(h));let m=e.tr.step(new st(t.pos-1,p,t.pos,p,new B(h,1,0),s.length,!0)),y=m.doc.resolve(p+2*s.length);y.nodeAfter&&y.nodeAfter.type==o.type&&To(m.doc,y.pos)&&m.join(y.pos),n(m.scrollIntoView())}return!0}let c=i.type.spec.isolating||r>0&&a?null:ce.findFrom(t,1),d=c&&c.$from.blockRange(c.$to),f=d&&Ps(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(u&&ws(i,"start",!0)&&ws(o,"end")){let p=o,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let m=i,y=1;for(;!m.isTextblock;m=m.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(n){let g=_.empty;for(let k=h.length-1;k>=0;k--)g=_.from(h[k].copy(g));let v=e.tr.step(new st(t.pos-h.length,t.pos+i.nodeSize,t.pos+y,t.pos+i.nodeSize-y,new B(g,h.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function Qb(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(t.tr.setSelection(de.create(t.doc,e<0?o.start(i):o.end(i)))),!0):!1}}const wI=Qb(-1),kI=Qb(1);function SI(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),l=s&&Kg(s,e,t);return l?(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function wx(e,t=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(a,u)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(e,t)))if(a.type==e)o=!0;else{let c=n.doc.resolve(u),d=c.index();o=c.parent.canReplaceWith(d,d+1,e)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[s];i.setBlockType(l,a,e,t)}r(i.scrollIntoView())}return!0}}function ey(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}ey(Qg,Fb,Vb);ey(Qg,Ub,Wb);ey(Gb,qb,Kb,yI);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function bI(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let l=r?n.tr:null;return CI(l,s,e,t)?(r&&r(l.scrollIntoView()),!0):!1}}function CI(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let a=s.resolve(t.start-2);i=new Tc(a,a,t.depth),t.endIndex<t.parent.childCount&&(t=new Tc(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let l=Kg(i,n,r,t);return l?(e&&EI(e,t,l,o,n),!0):!1}function EI(e,t,n,r,o){let i=_.empty;for(let c=n.length-1;c>=0;c--)i=_.from(n[c].type.create(n[c].attrs,i));e.step(new st(t.start-(r?2:0),t.end,t.start,t.end,new B(i,0,0),n.length,!0));let s=0;for(let c=0;c<n.length;c++)n[c].type==o&&(s=c+1);let l=n.length-s,a=t.start+n.length-(r?2:0),u=t.parent;for(let c=t.startIndex,d=t.endIndex,f=!0;c<d;c++,f=!1)!f&&xr(e.doc,a,l)&&(e.split(a,l),a+=2*l),a+=u.child(c).nodeSize;return e}function MI(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==e);return i?n?r.node(i.depth-1).type==e?RI(t,n,e,i):TI(t,n,i):!0:!1}}function RI(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new st(i-1,s,i,s,new B(_.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Tc(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const l=Ps(r);if(l==null)return!1;o.lift(r,l);let a=o.doc.resolve(o.mapping.map(i,-1)-1);return To(o.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&o.join(a.pos),t(o.scrollIntoView()),!0}function TI(e,t,n){let r=e.tr,o=n.parent;for(let p=n.end,h=n.endIndex-1,m=n.startIndex;h>m;h--)p-=o.child(h).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==o.childCount,u=i.node(-1),c=i.index(-1);if(!u.canReplace(c+(l?0:1),c+1,s.content.append(a?_.empty:_.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new st(d-(l?1:0),f+(a?1:0),d+1,f-1,new B((l?_.empty:_.from(o.copy(_.empty))).append(a?_.empty:_.from(o.copy(_.empty))),l?0:1,a?0:1),l?0:1)),t(r.scrollIntoView()),!0}function NI(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,u=>u.childCount>0&&u.firstChild.type==e);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=e)return!1;if(n){let u=a.lastChild&&a.lastChild.type==l.type,c=_.from(u?e.create():null),d=new B(_.from(e.create(null,_.from(l.type.create(null,c)))),u?3:1,0),f=i.start,p=i.end;n(t.tr.step(new st(f-(u?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}const ct=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},ks=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let nm=null;const ur=function(e,t,n){let r=nm||(nm=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},AI=function(){nm=null},ri=function(e,t,n,r){return n&&(kx(e,t,n,r,-1)||kx(e,t,n,r,1))},OI=/^(img|br|input|textarea|hr)$/i;function kx(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:ln(e))){let s=e.parentNode;if(!s||s.nodeType!=1||ba(e)||OI.test(e.nodeName)||e.contentEditable=="false")return!1;t=ct(e)+(o<0?0:1),e=s}else if(e.nodeType==1){let s=e.childNodes[t+(o<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)t+=o;else return!1;else e=s,t=o<0?ln(e):0}else return!1}}function ln(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function PI(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=ln(e)}else if(e.parentNode&&!ba(e))t=ct(e),e=e.parentNode;else return null}}function II(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!ba(e))t=ct(e)+1,e=e.parentNode;else return null}}function DI(e,t,n){for(let r=t==0,o=t==ln(e);r||o;){if(e==n)return!0;let i=ct(e);if(e=e.parentNode,!e)return!1;r=r&&i==0,o=o&&i==ln(e)}}function ba(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const Gd=function(e){return e.focusNode&&ri(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function _o(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function LI(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function _I(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(ln(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(ln(r.startContainer),r.startOffset)}}}const Jn=typeof navigator<"u"?navigator:null,Sx=typeof document<"u"?document:null,No=Jn&&Jn.userAgent||"",rm=/Edge\/(\d+)/.exec(No),Xb=/MSIE \d/.exec(No),om=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(No),jt=!!(Xb||om||rm),po=Xb?document.documentMode:om?+om[1]:rm?+rm[1]:0,cn=!jt&&/gecko\/(\d+)/i.test(No);cn&&+(/Firefox\/(\d+)/.exec(No)||[0,0])[1];const im=!jt&&/Chrome\/(\d+)/.exec(No),ot=!!im,Yb=im?+im[1]:0,ht=!jt&&!!Jn&&/Apple Computer/.test(Jn.vendor),Ss=ht&&(/Mobile\/\w+/.test(No)||!!Jn&&Jn.maxTouchPoints>2),rn=Ss||(Jn?/Mac/.test(Jn.platform):!1),Zb=Jn?/Win/.test(Jn.platform):!1,mr=/Android \d/.test(No),Ca=!!Sx&&"webkitFontSmoothing"in Sx.documentElement.style,$I=Ca?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function zI(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function tr(e,t){return typeof e=="number"?e:e[t]}function jI(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function bx(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(s.nodeType!=1){s=ks(s);continue}let l=s,a=l==i.body,u=a?zI(i):jI(l),c=0,d=0;if(t.top<u.top+tr(r,"top")?d=-(u.top-t.top+tr(o,"top")):t.bottom>u.bottom-tr(r,"bottom")&&(d=t.bottom-t.top>u.bottom-u.top?t.top+tr(o,"top")-u.top:t.bottom-u.bottom+tr(o,"bottom")),t.left<u.left+tr(r,"left")?c=-(u.left-t.left+tr(o,"left")):t.right>u.right-tr(r,"right")&&(c=t.right-u.right+tr(o,"right")),c||d)if(a)i.defaultView.scrollBy(c,d);else{let p=l.scrollLeft,h=l.scrollTop;d&&(l.scrollTop+=d),c&&(l.scrollLeft+=c);let m=l.scrollLeft-p,y=l.scrollTop-h;t={left:t.left-m,top:t.top-y,right:t.right-m,bottom:t.bottom-y}}let f=a?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:ks(s)}}function FI(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,o;for(let i=(t.left+t.right)/2,s=n+1;s<Math.min(innerHeight,t.bottom);s+=5){let l=e.root.elementFromPoint(i,s);if(!l||l==e.dom||!e.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:eC(e.dom)}}function eC(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=ks(r));return t}function BI({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;tC(n,r==0?0:r-t)}function tC(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Ni=null;function VI(e){if(e.setActive)return e.setActive();if(Ni)return e.focus(Ni);let t=eC(e);e.focus(Ni==null?{get preventScroll(){return Ni={preventScroll:!0},!0}}:void 0),Ni||(Ni=!1,tC(t,0))}function nC(e,t){let n,r=2e8,o,i=0,s=t.top,l=t.top,a,u;for(let c=e.firstChild,d=0;c;c=c.nextSibling,d++){let f;if(c.nodeType==1)f=c.getClientRects();else if(c.nodeType==3)f=ur(c).getClientRects();else continue;for(let p=0;p<f.length;p++){let h=f[p];if(h.top<=s&&h.bottom>=l){s=Math.max(h.bottom,s),l=Math.min(h.top,l);let m=h.left>t.left?h.left-t.left:h.right<t.left?t.left-h.right:0;if(m<r){n=c,r=m,o=m&&n.nodeType==3?{left:h.right<t.left?h.right:h.left,top:t.top}:t,c.nodeType==1&&m&&(i=d+(t.left>=(h.left+h.right)/2?1:0));continue}}else h.top>t.top&&!a&&h.left<=t.left&&h.right>=t.left&&(a=c,u={left:Math.max(h.left,Math.min(h.right,t.left)),top:h.top});!n&&(t.left>=h.right&&t.top>=h.top||t.left>=h.left&&t.top>=h.bottom)&&(i=d+1)}}return!n&&a&&(n=a,o=u,r=0),n&&n.nodeType==3?HI(n,o):!n||r&&n.nodeType==1?{node:e,offset:i}:nC(n,o)}function HI(e,t){let n=e.nodeValue.length,r=document.createRange(),o;for(let i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);let s=zr(r,1);if(s.top!=s.bottom&&ty(t,s)){o={node:e,offset:i+(t.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),o||{node:e,offset:0}}function ty(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function UI(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function WI(e,t,n){let{node:r,offset:o}=nC(t,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}function GI(e,t,n,r){let o=-1;for(let i=t,s=!1;i!=e.dom;){let l=e.docView.nearestDesc(i,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>r.left||a.top>r.top?o=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(o=l.posAfter),s=!0),!l.contentDOM&&o<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}function rC(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=e.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let u=l[a];if(ty(t,u))return rC(s,t,u)}}if((i=(i+1)%r)==o)break}return e}function qI(e,t){let n=e.dom.ownerDocument,r,o=0,i=_I(n,t.left,t.top);i&&({node:r,offset:o}=i);let s=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),l;if(!s||!e.dom.contains(s.nodeType!=1?s.parentNode:s)){let u=e.dom.getBoundingClientRect();if(!ty(t,u)||(s=rC(e.dom,t,u),!s))return null}if(ht)for(let u=s;r&&u;u=ks(u))u.draggable&&(r=void 0);if(s=UI(s,t),r){if(cn&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let c=r.childNodes[o],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=t.left&&d.bottom>t.top&&o++}let u;Ca&&o&&r.nodeType==1&&(u=r.childNodes[o-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=t.top&&o--,r==e.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?l=e.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=GI(e,r,o,t))}l==null&&(l=WI(e,s,t));let a=e.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Cx(e){return e.top<e.bottom||e.left<e.right}function zr(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(Cx(r))return r}return Array.prototype.find.call(n,Cx)||e.getBoundingClientRect()}const KI=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function oC(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=Ca||cn;if(r.nodeType==3)if(s&&(KI.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let a=zr(ur(r,o,o),n);if(cn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let u=zr(ur(r,o-1,o-1),-1);if(u.top==a.top){let c=zr(ur(r,o,o+1),-1);if(c.top!=a.top)return Xs(c,c.left<u.left)}}return a}else{let a=o,u=o,c=n<0?1:-1;return n<0&&!o?(u++,c=-1):n>=0&&o==r.nodeValue.length?(a--,c=1):n<0?a--:u++,Xs(zr(ur(r,a,u),c),c<0)}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==ln(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return hp(a.getBoundingClientRect(),!1)}if(i==null&&o<ln(r)){let a=r.childNodes[o];if(a.nodeType==1)return hp(a.getBoundingClientRect(),!0)}return hp(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==ln(r))){let a=r.childNodes[o-1],u=a.nodeType==3?ur(a,ln(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return Xs(zr(u,1),!1)}if(i==null&&o<ln(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let u=a?a.nodeType==3?ur(a,0,s?0:1):a.nodeType==1?a:null:null;if(u)return Xs(zr(u,-1),!0)}return Xs(zr(r.nodeType==3?ur(r):r,-n),n>=0)}function Xs(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function hp(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function iC(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}function JI(e,t,n){let r=t.selection,o=n=="up"?r.$from:r.$to;return iC(e,t,()=>{let{node:i}=e.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let l=e.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=oC(e,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=ur(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<a.length;u++){let c=a[u];if(c.bottom>c.top+1&&(n=="up"?s.top-c.top>(c.bottom-s.top)*2:c.bottom-s.bottom>(s.bottom-c.top)*2))return!1}}return!0})}const QI=/[\u0590-\u08ac]/;function XI(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=e.domSelection();return l?!QI.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:iC(e,t,()=>{let{focusNode:a,focusOffset:u,anchorNode:c,anchorOffset:d}=e.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let p=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:h,focusOffset:m}=e.domSelectionRange(),y=h&&!p.contains(h.nodeType==1?h:h.parentNode)||a==h&&u==m;try{l.collapse(c,d),a&&(a!=c||u!=d)&&l.extend&&l.extend(a,u)}catch{}return f!=null&&(l.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}let Ex=null,Mx=null,Rx=!1;function YI(e,t,n){return Ex==t&&Mx==n?Rx:(Ex=t,Mx=n,Rx=n=="up"||n=="down"?JI(e,t,n):XI(e,t,n))}const dn=0,Tx=1,Fo=2,Qn=3;class Ea{constructor(t,n,r,o){this.parent=t,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=dn,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;n<this.children.length;n++)t+=this.children[n].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==t)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,n,r){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode))if(r<0){let i,s;if(t==this.contentDOM)i=t.childNodes[n-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(t==this.contentDOM)i=t.childNodes[n];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(t==this.dom&&this.contentDOM)o=n>ct(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=t;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==t.childNodes.length)for(let i=t;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,o=t;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(t.nodeType==1?t:t.parentNode):s==t))r=!1;else return i}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let o=t;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==t&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let l=o.children[s];if(l.size){o=l;break}}return o}if(t<i)return o.descAt(t-r-o.border);r=i}}domFromPos(t,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],l=i+s.size;if(l>t||s instanceof lC){o=t-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof sC&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?ct(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?ct(i.dom):this.contentDOM.childNodes.length}}}parseRange(t,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,l=0;;l++){let a=this.children[l],u=s+a.size;if(o==-1&&t<=u){let c=s+a.border;if(t>=c&&n<=u-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,n,c);t=s;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=ct(f.dom)+1;break}t-=f.size}o==-1&&(o=0)}if(o>-1&&(u>n||l==this.children.length-1)){n=u;for(let c=l+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=ct(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=u}return{node:this.contentDOM,from:t,to:n,fromOffset:o,toOffset:i}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[t<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(t)}domAfterPos(t){let{node:n,offset:r}=this.domFromPos(t,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]}setSelection(t,n,r,o=!1){let i=Math.min(t,n),s=Math.max(t,n);for(let p=0,h=0;p<this.children.length;p++){let m=this.children[p],y=h+m.size;if(i>h&&s<y)return m.setSelection(t-h-m.border,n-h-m.border,r,o);h=y}let l=this.domFromPos(t,t?-1:1),a=n==t?l:this.domFromPos(n,n?-1:1),u=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((cn||ht)&&t==n){let{node:p,offset:h}=l;if(p.nodeType==3){if(d=!!(h&&p.nodeValue[h-1]==`
81
- `),d&&h==p.nodeValue.length)for(let m=p,y;m;m=m.parentNode){if(y=m.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:ct(y)+1});break}let g=m.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let m=p.childNodes[h-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(cn&&c.focusNode&&c.focusNode!=a.node&&c.focusNode.nodeType==1){let p=c.focusNode.childNodes[c.focusOffset];p&&p.contentEditable=="false"&&(o=!0)}if(!(o||d&&ht)&&ri(l.node,l.offset,c.anchorNode,c.anchorOffset)&&ri(a.node,a.offset,c.focusNode,c.focusOffset))return;let f=!1;if((u.extend||t==n)&&!(d&&cn)){u.collapse(l.node,l.offset);try{t!=n&&u.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(t>n){let h=l;l=a,a=h}let p=document.createRange();p.setEnd(a.node,a.offset),p.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(p)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?t<=s&&n>=r:t<s&&n>r){let l=r+i.border,a=s-i.border;if(t>=l&&n<=a){this.dirty=t==r||n==s?Fo:Tx,t==l&&n==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Qn:i.markDirty(t-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Fo:Qn}r=s}this.dirty=Fo}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?Fo:Tx;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class sC extends Ea{constructor(t,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(t,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(t){return this.dirty==dn&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class ZI extends Ea{constructor(t,n,r,o){super(t,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class oi extends Ea{constructor(t,n,r,o,i){super(t,[],r,o),this.mark=n,this.spec=i}static create(t,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=hi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new oi(t,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Qn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=Qn&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=dn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=dn}}slice(t,n,r){let o=oi.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=lm(i,n,s,r)),t>0&&(i=lm(i,0,t,r));for(let l=0;l<i.length;l++)i[l].parent=o;return o.children=i,o}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ho extends Ea{constructor(t,n,r,o,i,s,l,a,u){super(t,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(t,n,r,o,i,s){let l=i.nodeViews[n.type.name],a,u=l&&l(n,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,o),c=u&&u.dom,d=u&&u.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=hi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let f=c;return c=cC(c,r,n),u?a=new e2(t,n,r,o,c,d||null,f,u,i,s+1):n.isText?new qd(t,n,r,o,c,f,i):new ho(t,n,r,o,c,d||null,f,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>_.empty)}return t}matchesNode(t,n,r){return this.dirty==dn&&t.eq(this.node)&&Ac(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let r=this.node.inlineContent,o=n,i=t.composing?this.localCompositionInfo(t,n):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new n2(this,s&&s.node,t);i2(this.node,this.innerDeco,(u,c,d)=>{u.spec.marks?a.syncToMarks(u.spec.marks,r,t,c):u.type.side>=0&&!d&&a.syncToMarks(c==this.node.childCount?Te.none:this.node.child(c).marks,r,t,c),a.placeWidget(u,t,o)},(u,c,d,f)=>{a.syncToMarks(u.marks,r,t,f);let p;a.findNodeMatch(u,c,d,f)||l&&t.state.selection.from>o&&t.state.selection.to<o+u.nodeSize&&(p=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(u,c,d,p,t)||a.updateNextNode(u,c,d,t,f,o)||a.addNode(u,c,d,t,o),o+=u.nodeSize}),a.syncToMarks([],r,t,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Fo)&&(s&&this.protectLocalComposition(t,s),aC(this.contentDOM,this.children,t),Ss&&s2(this.dom))}localCompositionInfo(t,n){let{from:r,to:o}=t.state.selection;if(!(t.state.selection instanceof de)||r<n||o>n+this.node.content.size)return null;let i=t.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=l2(this.node.content,s,r-n,o-n);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new ZI(this,i,n,o);t.input.compositionNodes.push(s),this.children=lm(this.children,r,r+o.length,t,s)}update(t,n,r,o){return this.dirty==Qn||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,r,o),!0)}updateInner(t,n,r,o){this.updateOuterDeco(n),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=dn}updateOuterDeco(t){if(Ac(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=uC(this.dom,this.nodeDOM,sm(this.outerDeco,this.node,n),sm(t,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Nx(e,t,n,r,o){cC(r,t,e);let i=new ho(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class qd extends ho{constructor(t,n,r,o,i,s,l){super(t,n,r,o,i,null,s,l,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,r,o){return this.dirty==Qn||this.dirty!=dn&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=dn||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=t,this.dirty=dn,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,r){let o=this.node.cut(t,n),i=document.createTextNode(o.text);return new qd(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Qn)}get domAtom(){return!1}isText(t){return this.node.text==t}}class lC extends Ea{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==dn&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class e2 extends ho{constructor(t,n,r,o,i,s,l,a,u,c){super(t,n,r,o,i,s,l,u,c),this.spec=a}update(t,n,r,o){if(this.dirty==Qn)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let i=this.spec.update(t,n,r);return i&&this.updateInner(t,n,r,o),i}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,r,o){this.spec.setSelection?this.spec.setSelection(t,n,r.root):super.setSelection(t,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function aC(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],l=s.dom;if(l.parentNode==e){for(;l!=r;)r=Ax(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(l,r);if(s instanceof oi){let a=r?r.previousSibling:e.lastChild;aC(s.contentDOM,s.children,n),r=a?a.nextSibling:e.firstChild}}for(;r;)r=Ax(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const Rl=function(e){e&&(this.nodeName=e)};Rl.prototype=Object.create(null);const Bo=[new Rl];function sm(e,t,n){if(e.length==0)return Bo;let r=n?Bo[0]:new Rl,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new Rl(s.nodeName));for(let l in s){let a=s[l];a!=null&&(n&&o.length==1&&o.push(r=new Rl(t.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return o}function uC(e,t,n,r){if(n==Bo&&r==Bo)return t;let o=t;for(let i=0;i<r.length;i++){let s=r[i],l=n[i];if(i){let a;l&&l.nodeName==s.nodeName&&o!=e&&(a=o.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=Bo[0]),o=a}t2(o,l||Bo[0],s)}return o}function t2(e,t,n){for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&e.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&e.classList.add(o[i]);e.classList.length==0&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(t.style);)e.style.removeProperty(o[1])}n.style&&(e.style.cssText+=n.style)}}function cC(e,t,n){return uC(e,e,Bo,sm(t,n,e.nodeType!=1))}function Ac(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function Ax(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class n2{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=r2(t.node.content,t)}destroyBetween(t,n){if(t!=n){for(let r=t;r<n;r++)this.top.children[r].destroy();this.top.children.splice(t,n-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,n,r,o){let i=0,s=this.stack.length>>1,l=Math.min(s,t.length);for(;i<l&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(t[i])&&t[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=dn,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<t.length;){this.stack.push(this.top,this.index+1);let a=-1,u=this.top.children.length;o<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let c=this.index;c<u;c++){let d=this.top.children[c];if(d.matchesMark(t[s])&&!this.isLocked(d.dom)){a=c;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let c=oi.create(this.top,t[s],n,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,s++}}findNodeMatch(t,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(t,n,r))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let u=this.top.children[l];if(u.matchesNode(t,n,r)&&!this.preMatch.matched.has(u)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(t,n,r,o,i){let s=this.top.children[o];return s.dirty==Qn&&s.dom==s.contentDOM&&(s.dirty=Fo),s.update(t,n,r,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(t){for(;;){let n=t.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}t=n}}updateNextNode(t,n,r,o,i,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof ho){let u=this.preMatch.matched.get(a);if(u!=null&&u!=i)return!1;let c=a.dom,d,f=this.isLocked(c)&&!(t.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==t.text&&a.dirty!=Qn&&Ac(n,a.outerDeco));if(!f&&a.update(t,n,r,o))return this.destroyBetween(this.index,l),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,t,n,r,o,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Fo,d.updateChildren(o,s+1),d.dirty=dn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,n,r,o,i,s){if(t.dirty||n.isAtom||!t.children.length||!t.node.content.eq(n.content)||!Ac(r,t.outerDeco)||!o.eq(t.innerDeco))return null;let l=ho.create(this.top,n,r,o,i,s);if(l.contentDOM){l.children=t.children,t.children=[];for(let a of l.children)a.parent=l}return t.destroy(),l}addNode(t,n,r,o,i){let s=ho.create(this.top,t,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(t,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(t)&&(t==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new sC(this.top,t,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],n=this.top;for(;t instanceof oi;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof qd)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((ht||ot)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(t,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new lC(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function r2(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let l;for(;;)if(r){let u=n.children[r-1];if(u instanceof oi)n=u,r=u.children.length;else{l=u,r--;break}}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=e.child(o-1))break;--o,i.set(l,o),s.push(l)}}return{index:o,matched:i,matches:s.reverse()}}function o2(e,t){return e.type.side-t.type.side}function i2(e,t,n,r){let o=t.locals(e),i=0;if(o.length==0){for(let u=0;u<e.childCount;u++){let c=e.child(u);r(c,o,t.forChild(i,c),u),i+=c.nodeSize}return}let s=0,l=[],a=null;for(let u=0;;){let c,d;for(;s<o.length&&o[s].to==i;){let y=o[s++];y.widget&&(c?(d||(d=[c])).push(y):c=y)}if(c)if(d){d.sort(o2);for(let y=0;y<d.length;y++)n(d[y],u,!!a)}else n(c,u,!!a);let f,p;if(a)p=-1,f=a,a=null;else if(u<e.childCount)p=u,f=e.child(u++);else break;for(let y=0;y<l.length;y++)l[y].to<=i&&l.splice(y--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)l.push(o[s++]);let h=i+f.nodeSize;if(f.isText){let y=h;s<o.length&&o[s].from<y&&(y=o[s].from);for(let g=0;g<l.length;g++)l[g].to<y&&(y=l[g].to);y<h&&(a=f.cut(y-i),f=f.cut(0,y-i),h=y,p=-1)}else for(;s<o.length&&o[s].to<h;)s++;let m=f.isInline&&!f.isLeaf?l.filter(y=>!y.inline):l.slice();r(f,m,t.forChild(i,f),p),i=h}}function s2(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function l2(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;o<e.childCount;){let u=e.child(o++);if(i+=u.nodeSize,!u.isText)break;a+=u.text}if(i>=n){if(i>=r&&a.slice(r-t.length-l,r-l)==t)return r-t.length;let u=l<r?a.lastIndexOf(t,r-l-1):-1;if(u>=0&&u+t.length+l>=n)return l+u;if(n==r&&a.length>=r+t.length-l&&a.slice(r-l,r-l+t.length)==t)return r}}return-1}function lm(e,t,n,r,o){let i=[];for(let s=0,l=0;s<e.length;s++){let a=e[s],u=l,c=l+=a.size;u>=n||c<=t?i.push(a):(u<t&&i.push(a.slice(0,t-u,r)),o&&(i.push(o),o=void 0),c>n&&i.push(a.slice(n-u,a.size,r)))}return i}function ny(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,u;if(Gd(n)){for(a=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&ee.isSelectable(d)&&o.parent&&!(d.isInline&&DI(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;u=new ee(s==f?l:r.resolve(f))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,f=s;for(let p=0;p<n.rangeCount;p++){let h=n.getRangeAt(p);d=Math.min(d,e.docView.posFromDOM(h.startContainer,h.startOffset,1)),f=Math.max(f,e.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(d<0)return null;[a,s]=f==e.state.selection.anchor?[f,d]:[d,f],l=r.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let c=r.resolve(a);if(!u){let d=t=="pointer"||e.state.selection.head<l.pos&&!i?1:-1;u=ry(e,c,l,d)}return u}function dC(e){return e.editable?e.hasFocus():pC(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function wr(e,t=!1){let n=e.state.selection;if(fC(e,n),!!dC(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&ot){let r=e.domSelectionRange(),o=e.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&ri(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)u2(e);else{let{anchor:r,head:o}=n,i,s;Ox&&!(n instanceof de)&&(n.$from.parent.inlineContent||(i=Px(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Px(e,n.to))),e.docView.setSelection(r,o,e,t),Ox&&(i&&Ix(i),s&&Ix(s)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&a2(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Ox=ht||ot&&Yb<63;function Px(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(ht&&o&&o.contentEditable=="false")return mp(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return mp(o);if(i)return mp(i)}}function mp(e){return e.contentEditable="true",ht&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Ix(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function a2(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!dC(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function u2(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName=="IMG";r?t.collapse(n.parentNode,ct(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&jt&&po<=11&&(n.disabled=!0,n.disabled=!1)}function fC(e,t){if(t instanceof ee){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Dx(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Dx(e)}function Dx(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function ry(e,t,n,r){return e.someProp("createSelectionBetween",o=>o(e,t,n))||de.between(t,n,r)}function Lx(e){return e.editable&&!e.hasFocus()?!1:pC(e)}function pC(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function c2(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return ri(t.node,t.offset,n.anchorNode,n.anchorOffset)}function am(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&ce.findFrom(i,t)}function Vr(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function _x(e,t,n){let r=e.state.selection;if(r instanceof de)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=e.state.doc.resolve(o.pos+i.nodeSize*(t<0?-1:1));return Vr(e,new de(r.$anchor,s))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let o=am(e.state,t);return o&&o instanceof ee?Vr(e,o):!1}else if(!(rn&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let l=t<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=e.docView.descAt(l))&&!s.contentDOM?ee.isSelectable(i)?Vr(e,new ee(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):Ca?Vr(e,new de(e.state.doc.resolve(t<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ee&&r.node.isInline)return Vr(e,new de(t>0?r.$to:r.$from));{let o=am(e.state,t);return o?Vr(e,o):!1}}}function Oc(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Tl(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function Ai(e,t){return t<0?d2(e):f2(e)}function d2(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;for(cn&&n.nodeType==1&&r<Oc(n)&&Tl(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(Tl(l,-1))o=n,i=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(hC(n))break;{let l=n.previousSibling;for(;l&&Tl(l,-1);)o=n.parentNode,i=ct(l),l=l.previousSibling;if(l)n=l,r=Oc(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?um(e,n,r):o&&um(e,o,i)}function f2(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o=Oc(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let l=n.childNodes[r];if(Tl(l,1))i=n,s=++r;else break}else{if(hC(n))break;{let l=n.nextSibling;for(;l&&Tl(l,1);)i=l.parentNode,s=ct(l)+1,l=l.nextSibling;if(l)n=l,r=0,o=Oc(n);else{if(n=n.parentNode,n==e.dom)break;r=o=0}}}i&&um(e,i,s)}function hC(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function p2(e,t){for(;e&&t==e.childNodes.length&&!ba(e);)t=ct(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=0}}function h2(e,t){for(;e&&!t&&!ba(e);)t=ct(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=e.childNodes.length}}function um(e,t,n){if(t.nodeType!=3){let i,s;(s=p2(t,n))?(t=s,n=0):(i=h2(t,n))&&(t=i,n=i.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Gd(r)){let i=document.createRange();i.setEnd(t,n),i.setStart(t,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout(()=>{e.state==o&&wr(e)},50)}function $x(e,t){let n=e.state.doc.resolve(t);if(!(ot||Zb)&&n.parent.inlineContent){let o=e.coordsAtPos(t);if(t>n.start()){let i=e.coordsAtPos(t-1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(t<n.end()){let i=e.coordsAtPos(t+1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function zx(e,t,n){let r=e.state.selection;if(r instanceof de&&!r.empty||n.indexOf("s")>-1||rn&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let s=am(e.state,t);if(s&&s instanceof ee)return Vr(e,s)}if(!o.parent.inlineContent){let s=t<0?o:i,l=r instanceof qt?ce.near(s,t):ce.findFrom(s,t);return l?Vr(e,l):!1}return!1}function jx(e,t){if(!(e.state.selection instanceof de))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=e.state.tr;return t<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),e.dispatch(s),!0}return!1}function Fx(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function m2(e){if(!ht||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;Fx(e,r,"true"),setTimeout(()=>Fx(e,r,"false"),20)}return!1}function g2(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function y2(e,t){let n=t.keyCode,r=g2(t);if(n==8||rn&&n==72&&r=="c")return jx(e,-1)||Ai(e,-1);if(n==46&&!t.shiftKey||rn&&n==68&&r=="c")return jx(e,1)||Ai(e,1);if(n==13||n==27)return!0;if(n==37||rn&&n==66&&r=="c"){let o=n==37?$x(e,e.state.selection.from)=="ltr"?-1:1:-1;return _x(e,o,r)||Ai(e,o)}else if(n==39||rn&&n==70&&r=="c"){let o=n==39?$x(e,e.state.selection.from)=="ltr"?1:-1:1;return _x(e,o,r)||Ai(e,o)}else{if(n==38||rn&&n==80&&r=="c")return zx(e,-1,r)||Ai(e,-1);if(n==40||rn&&n==78&&r=="c")return m2(e)||zx(e,1,r)||Ai(e,1);if(r==(rn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function oy(e,t){e.someProp("transformCopied",p=>{t=p(t,e)});let n=[],{content:r,openStart:o,openEnd:i}=t;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=e.someProp("clipboardSerializer")||hi.fromSchema(e.state.schema),l=wC(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let u=a.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=xC[u.nodeName.toLowerCase()]);){for(let p=c.length-1;p>=0;p--){let h=l.createElement(c[p]);for(;a.firstChild;)h.appendChild(a.firstChild);a.appendChild(h),d++}u=a.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=e.someProp("clipboardTextSerializer",p=>p(t,e))||t.content.textBetween(0,t.content.size,`
82
-
83
- `);return{dom:a,text:f,slice:t}}function mC(e,t,n,r,o){let i=o.parent.type.spec.code,s,l;if(!n&&!t)return null;let a=!!t&&(r||i||!n);if(a){if(e.someProp("transformPastedText",f=>{t=f(t,i||r,e)}),i)return l=new B(_.from(e.state.schema.text(t.replace(/\r\n?/g,`
84
- `))),0,0),e.someProp("transformPasted",f=>{l=f(l,e,!0)}),l;let d=e.someProp("clipboardTextParser",f=>f(t,o,r,e));if(d)l=d;else{let f=o.marks(),{schema:p}=e.state,h=hi.fromSchema(p);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(m=>{let y=s.appendChild(document.createElement("p"));m&&y.appendChild(h.serializeNode(p.text(m,f)))})}}else e.someProp("transformPastedHTML",d=>{n=d(n,e)}),s=k2(n),Ca&&S2(s);let u=s&&s.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(e.someProp("clipboardParser")||e.someProp("domParser")||vr.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||c),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!v2.test(f.parentNode.nodeName)?{ignore:!0}:null}})),c)l=b2(Bx(l,+c[1],+c[2]),c[4]);else if(l=B.maxOpen(x2(l.content,o),!0),l.openStart||l.openEnd){let d=0,f=0;for(let p=l.content.firstChild;d<l.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=l.content.lastChild;f<l.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);l=Bx(l,d,f)}return e.someProp("transformPasted",d=>{l=d(l,e,a)}),l}const v2=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function x2(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let o=t.node(n).contentMatchAt(t.index(n)),i,s=[];if(e.forEach(l=>{if(!s)return;let a=o.findWrapping(l.type),u;if(!a)return s=null;if(u=s.length&&i.length&&yC(a,i,l,s[s.length-1],0))s[s.length-1]=u;else{s.length&&(s[s.length-1]=vC(s[s.length-1],i.length));let c=gC(l,a);s.push(c),o=o.matchType(c.type),i=a}}),s)return _.from(s)}return e}function gC(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,_.from(e));return e}function yC(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=yC(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(_.from(gC(n,e,o+1))))}}function vC(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,vC(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(_.empty,!0);return e.copy(n.append(r))}function cm(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,l=s.content;return e.childCount>1&&(i=0),o<r-1&&(l=cm(l,t,n,r,o+1,i)),o>=n&&(l=t<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(_.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(l))}function Bx(e,t,n){return t<e.openStart&&(e=new B(cm(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new B(cm(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const xC={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Vx=null;function wC(){return Vx||(Vx=document.implementation.createHTMLDocument("title"))}let gp=null;function w2(e){let t=window.trustedTypes;return t?(gp||(gp=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),gp.createHTML(e)):e}function k2(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=wC().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),o;if((o=r&&xC[r[1].toLowerCase()])&&(e=o.map(i=>"<"+i+">").join("")+e+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=w2(e),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function S2(e){let t=e.querySelectorAll(ot?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function b2(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:o,openStart:i,openEnd:s}=e;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;o=_.from(a.create(r[l+1],o)),i++,s++}return new B(o,i,s)}const Rt={},Tt={},C2={touchstart:!0,touchmove:!0};class E2{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function M2(e){for(let t in Rt){let n=Rt[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{T2(e,r)&&!iy(e,r)&&(e.editable||!(r.type in Tt))&&n(e,r)},C2[t]?{passive:!0}:void 0)}ht&&e.dom.addEventListener("input",()=>null),dm(e)}function eo(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function R2(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function dm(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>iy(e,r))})}function iy(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function T2(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function N2(e,t){!iy(e,t)&&Rt[t.type]&&(e.editable||!(t.type in Tt))&&Rt[t.type](e,t)}Tt.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!SC(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(mr&&ot&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),Ss&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",o=>o(e,_o(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||y2(e,n)?n.preventDefault():eo(e,"key")};Tt.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};Tt.keypress=(e,t)=>{let n=t;if(SC(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||rn&&n.metaKey)return;if(e.someProp("handleKeyPress",o=>o(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof de)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!e.someProp("handleTextInput",s=>s(e,r.$from.pos,r.$to.pos,o,i))&&e.dispatch(i()),n.preventDefault()}};function Kd(e){return{left:e.clientX,top:e.clientY}}function A2(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function sy(e,t,n,r,o){if(r==-1)return!1;let i=e.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(e.someProp(t,l=>s>i.depth?l(e,n,i.nodeAfter,i.before(s),o,!0):l(e,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function as(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function O2(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&ee.isSelectable(r)?(as(e,new ee(n)),!0):!1}function P2(e,t){if(t==-1)return!1;let n=e.state.selection,r,o;n instanceof ee&&(r=n.node);let i=e.state.doc.resolve(t);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(ee.isSelectable(l)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(as(e,ee.create(e.state.doc,o)),!0):!1}function I2(e,t,n,r,o){return sy(e,"handleClickOn",t,n,r)||e.someProp("handleClick",i=>i(e,t,r))||(o?P2(e,n):O2(e,n))}function D2(e,t,n,r){return sy(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",o=>o(e,t,r))}function L2(e,t,n,r){return sy(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",o=>o(e,t,r))||_2(e,n,r)}function _2(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(as(e,de.create(r,0,r.content.size)),!0):!1;let o=r.resolve(t);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),l=o.before(i);if(s.inlineContent)as(e,de.create(r,l+1,l+1+s.content.size));else if(ee.isSelectable(s))as(e,ee.create(r,l));else continue;return!0}}function ly(e){return Pc(e)}const kC=rn?"metaKey":"ctrlKey";Rt.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=ly(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&A2(n,e.input.lastClick)&&!n[kC]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type=="singleClick"?i="doubleClick":e.input.lastClick.type=="doubleClick"&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=e.posAtCoords(Kd(n));s&&(i=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new $2(e,s,n,!!r)):(i=="doubleClick"?D2:L2)(e,s.pos,s.inside,n)?n.preventDefault():eo(e,"pointer"))};class $2{constructor(t,n,r,o){this.view=t,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[kC],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=t.state.doc.nodeAt(n.inside),s=n.inside;else{let c=t.state.doc.resolve(n.pos);i=c.parent,s=c.depth?c.before():0}const l=o?null:r.target,a=l?t.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:u}=t.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof ee&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&cn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),eo(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>wr(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Kd(t))),this.updateAllowDefault(t),this.allowDefault||!n?eo(this.view,"pointer"):I2(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||ht&&this.mightDrag&&!this.mightDrag.node.isAtom||ot&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(as(this.view,ce.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):eo(this.view,"pointer")}move(t){this.updateAllowDefault(t),eo(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}Rt.touchstart=e=>{e.input.lastTouch=Date.now(),ly(e),eo(e,"pointer")};Rt.touchmove=e=>{e.input.lastTouch=Date.now(),eo(e,"pointer")};Rt.contextmenu=e=>ly(e);function SC(e,t){return e.composing?!0:ht&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const z2=mr?5e3:-1;Tt.compositionstart=Tt.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof de&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ot&&Zb&&j2(e)))e.markCursor=e.state.storedMarks||n.marks(),Pc(e,!0),e.markCursor=null;else if(Pc(e,!t.selection.empty),cn&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=e.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}e.input.composing=!0}bC(e,z2)};function j2(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Tt.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,bC(e,20))};function bC(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Pc(e),t))}function CC(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=B2());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function F2(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=PI(t.focusNode,t.focusOffset),r=II(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function B2(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function Pc(e,t=!1){if(!(mr&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),CC(e),t||e.docView&&e.docView.dirty){let n=ny(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function V2(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const sa=jt&&po<15||Ss&&$I<604;Rt.copy=Tt.cut=(e,t)=>{let n=t,r=e.state.selection,o=n.type=="cut";if(r.empty)return;let i=sa?null:n.clipboardData,s=r.content(),{dom:l,text:a}=oy(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):V2(e,l),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function H2(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function U2(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?la(e,r.value,null,o,t):la(e,r.textContent,r.innerHTML,o,t)},50)}function la(e,t,n,r,o){let i=mC(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",a=>a(e,o,i||B.empty)))return!0;if(!i)return!1;let s=H2(i),l=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function EC(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Tt.paste=(e,t)=>{let n=t;if(e.composing&&!mr)return;let r=sa?null:n.clipboardData,o=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&la(e,EC(r),r.getData("text/html"),o,n)?n.preventDefault():U2(e,n)};class MC{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const W2=rn?"altKey":"ctrlKey";function RC(e,t){let n=e.someProp("dragCopies",r=>!r(t));return n??!t[W2]}Rt.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=e.state.selection,i=o.empty?null:e.posAtCoords(Kd(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof ee?o.to-1:o.to))){if(r&&r.mightDrag)s=ee.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=e.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=e.docView&&(s=ee.create(e.state.doc,d.posBefore))}}let l=(s||e.state.selection).content(),{dom:a,text:u,slice:c}=oy(e,l);(!n.dataTransfer.files.length||!ot||Yb>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(sa?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",sa||n.dataTransfer.setData("text/plain",u),e.dragging=new MC(c,RC(e,n),s)};Rt.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};Tt.dragover=Tt.dragenter=(e,t)=>t.preventDefault();Tt.drop=(e,t)=>{try{G2(e,t,e.dragging)}finally{e.dragging=null}};function G2(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Kd(t));if(!r)return;let o=e.state.doc.resolve(r.pos),i=n&&n.slice;i?e.someProp("transformPasted",p=>{i=p(i,e,!1)}):i=mC(e,EC(t.dataTransfer),sa?null:t.dataTransfer.getData("text/html"),!1,o);let s=!!(n&&RC(e,t));if(e.someProp("handleDrop",p=>p(e,t,i||B.empty,s))){t.preventDefault();return}if(!i)return;t.preventDefault();let l=i?Ab(e.state.doc,o.pos,i):o.pos;l==null&&(l=o.pos);let a=e.state.tr;if(s){let{node:p}=n;p?p.replace(a):a.deleteSelection()}let u=a.mapping.map(l),c=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=a.doc;if(c?a.replaceRangeWith(u,u,i.content.firstChild):a.replaceRange(u,u,i),a.doc.eq(d))return;let f=a.doc.resolve(u);if(c&&ee.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new ee(f));else{let p=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((h,m,y,g)=>p=g),a.setSelection(ry(e,f,a.doc.resolve(p)))}e.focus(),e.dispatch(a.setMeta("uiEvent","drop"))}Rt.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&wr(e)},20))};Rt.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};Rt.beforeinput=(e,t)=>{if(ot&&mr&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",i=>i(e,_o(8,"Backspace")))))return;let{$cursor:o}=e.state.selection;o&&o.pos>0&&e.dispatch(e.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let e in Tt)Rt[e]=Tt[e];function aa(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Ic{constructor(t,n){this.toDOM=t,this.spec=n||qo,this.side=this.spec.side||0}map(t,n,r,o){let{pos:i,deleted:s}=t.mapResult(n.from+o,this.side<0?-1:1);return s?null:new Ct(i-r,i-r,this)}valid(){return!0}eq(t){return this==t||t instanceof Ic&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&aa(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class mo{constructor(t,n){this.attrs=t,this.spec=n||qo}map(t,n,r,o){let i=t.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=t.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new Ct(i,s,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof mo&&aa(this.attrs,t.attrs)&&aa(this.spec,t.spec)}static is(t){return t.type instanceof mo}destroy(){}}class ay{constructor(t,n){this.attrs=t,this.spec=n||qo}map(t,n,r,o){let i=t.mapResult(n.from+o,1);if(i.deleted)return null;let s=t.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new Ct(i.pos-r,s.pos-r,this)}valid(t,n){let{index:r,offset:o}=t.content.findIndex(n.from),i;return o==n.from&&!(i=t.child(r)).isText&&o+i.nodeSize==n.to}eq(t){return this==t||t instanceof ay&&aa(this.attrs,t.attrs)&&aa(this.spec,t.spec)}destroy(){}}class Ct{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new Ct(t,n,this.type)}eq(t,n=0){return this.type.eq(t.type)&&this.from+n==t.from&&this.to+n==t.to}map(t,n,r){return this.type.map(t,this,n,r)}static widget(t,n,r){return new Ct(t,t,new Ic(n,r))}static inline(t,n,r,o){return new Ct(t,n,new mo(r,o))}static node(t,n,r,o){return new Ct(t,n,new ay(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof mo}get widget(){return this.type instanceof Ic}}const $i=[],qo={};class je{constructor(t,n){this.local=t.length?t:$i,this.children=n.length?n:$i}static create(t,n){return n.length?Dc(n,t,0,qo):vt}find(t,n,r){let o=[];return this.findInner(t??0,n??1e9,o,0,r),o}findInner(t,n,r,o,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=t&&(!i||i(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>t){let l=this.children[s]+1;this.children[s+2].findInner(t-l,n-l,r,o+l,i)}}map(t,n,r){return this==vt||t.maps.length==0?this:this.mapInner(t,n,0,0,r||qo)}mapInner(t,n,r,o,i){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(t,r,o);a&&a.type.valid(n,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?q2(this.children,s||[],t,n,r,o,i):s?new je(s.sort(Ko),$i):vt}add(t,n){return n.length?this==vt?je.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let o,i=0;t.forEach((l,a)=>{let u=a+r,c;if(c=NC(n,l,u)){for(o||(o=this.children.slice());i<o.length&&o[i]<a;)i+=3;o[i]==a?o[i+2]=o[i+2].addInner(l,c,u+1):o.splice(i,0,a,a+l.nodeSize,Dc(c,l,u+1,qo)),i+=3}});let s=TC(i?AC(n):n,-r);for(let l=0;l<s.length;l++)s[l].type.valid(t,s[l])||s.splice(l--,1);return new je(s.length?this.local.concat(s).sort(Ko):this.local,o||this.children)}remove(t){return t.length==0||this==vt?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,l=r[i]+n,a=r[i+1]+n;for(let c=0,d;c<t.length;c++)(d=t[c])&&d.from>l&&d.to<a&&(t[c]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let u=r[i+2].removeInner(s,l+1);u!=vt?r[i+2]=u:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<t.length;i++)if(s=t[i])for(let l=0;l<o.length;l++)o[l].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new je(o,r):vt}forChild(t,n){if(this==vt)return this;if(n.isLeaf)return je.empty;let r,o;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=t){this.children[l]==t&&(r=this.children[l+2]);break}let i=t+1,s=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof mo){let u=Math.max(i,a.from)-i,c=Math.min(s,a.to)-i;u<c&&(o||(o=[])).push(a.copy(u,c))}}if(o){let l=new je(o.sort(Ko),$i);return r?new qr([l,r]):l}return r||vt}eq(t){if(this==t)return!0;if(!(t instanceof je)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0}locals(t){return uy(this.localsInner(t))}localsInner(t){if(this==vt)return $i;if(t.inlineContent||!this.local.some(mo.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof mo||n.push(this.local[r]);return n}forEachSet(t){t(this)}}je.empty=new je([],[]);je.removeOverlap=uy;const vt=je.empty;class qr{constructor(t){this.members=t}map(t,n){const r=this.members.map(o=>o.map(t,n,qo));return qr.from(r)}forChild(t,n){if(n.isLeaf)return je.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(t,n);i!=vt&&(i instanceof qr?r=r.concat(i.members):r.push(i))}return qr.from(r)}eq(t){if(!(t instanceof qr)||t.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}locals(t){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(t);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?uy(r?n:n.sort(Ko)):$i}static from(t){switch(t.length){case 0:return vt;case 1:return t[0];default:return new qr(t.every(n=>n instanceof je)?t:t.reduce((n,r)=>n.concat(r instanceof je?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function q2(e,t,n,r,o,i,s){let l=e.slice();for(let u=0,c=i;u<n.maps.length;u++){let d=0;n.maps[u].forEach((f,p,h,m)=>{let y=m-h-(p-f);for(let g=0;g<l.length;g+=3){let v=l[g+1];if(v<0||f>v+c-d)continue;let k=l[g]+c-d;p>=k?l[g+1]=f<=k?-2:-1:f>=c&&y&&(l[g]+=y,l[g+1]+=y)}d+=y}),c=n.maps[u].map(c,-1)}let a=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){a=!0,l[u+1]=-1;continue}let c=n.map(e[u]+i),d=c-o;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(e[u+1]+i,-1),p=f-o,{index:h,offset:m}=r.content.findIndex(d),y=r.maybeChild(h);if(y&&m==d&&m+y.nodeSize==p){let g=l[u+2].mapInner(n,y,c+1,e[u]+i+1,s);g!=vt?(l[u]=d,l[u+1]=p,l[u+2]=g):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=K2(l,e,t,n,o,i,s),c=Dc(u,r,0,s);t=c.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<c.children.length;d+=3){let p=c.children[d];for(;f<l.length&&l[f]<p;)f+=3;l.splice(f,0,c.children[d],c.children[d+1],c.children[d+2])}}return new je(t.sort(Ko),l)}function TC(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new Ct(o.from+t,o.to+t,o.type))}return n}function K2(e,t,n,r,o,i,s){function l(a,u){for(let c=0;c<a.local.length;c++){let d=a.local[c].map(r,o,u);d?n.push(d):s.onRemove&&s.onRemove(a.local[c].spec)}for(let c=0;c<a.children.length;c+=3)l(a.children[c+2],a.children[c]+u+1)}for(let a=0;a<e.length;a+=3)e[a+1]==-1&&l(e[a+2],t[a]+i+1);return n}function NC(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let i=0,s;i<e.length;i++)(s=e[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),e[i]=null);return o}function AC(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function Dc(e,t,n,r){let o=[],i=!1;t.forEach((l,a)=>{let u=NC(e,l,a+n);if(u){i=!0;let c=Dc(u,l,n+a+1,r);c!=vt&&o.push(a,a+l.nodeSize,c)}});let s=TC(i?AC(e):e,-n).sort(Ko);for(let l=0;l<s.length;l++)s[l].type.valid(t,s[l])||(r.onRemove&&r.onRemove(s[l].spec),s.splice(l--,1));return s.length||o.length?new je(s,o):vt}function Ko(e,t){return e.from-t.from||e.to-t.to}function uy(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from==r.from){i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),Hx(t,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),Hx(t,o,r.copy(i.from,r.to)));break}}}return t}function Hx(e,t,n){for(;t<e.length&&Ko(n,e[t])>0;)t++;e.splice(t,0,n)}function yp(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=vt&&t.push(r)}),e.cursorWrapper&&t.push(je.create(e.state.doc,[e.cursorWrapper.deco])),qr.from(t)}const J2={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Q2=jt&&po<=11;class X2{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class Y2{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new X2,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);jt&&po<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():ht&&t.composing&&r.some(o=>o.type=="childList"&&o.target.nodeName=="TR")?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Q2&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,J2)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Lx(this.view)){if(this.suppressingSelectionUpdates)return wr(this.view);if(jt&&po<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&ri(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,r;for(let i=t.focusNode;i;i=ks(i))n.add(i);for(let i=t.anchorNode;i;i=ks(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Lx(t)&&!this.ignoreSelectionChange(r),i=-1,s=-1,l=!1,a=[];if(t.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],a);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(l=!0))}if(cn&&a.length){let c=a.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,f]=c;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of c){let p=f.parentNode;p&&p.nodeName=="LI"&&(!d||tD(t,d)!=p)&&f.remove()}}}else if((ot||ht)&&a.some(c=>c.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46)){for(let c of a)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&c.parentNode.removeChild(c)}}let u=null;i<0&&o&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&Gd(r)&&(u=ny(t))&&u.eq(ce.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,wr(t),this.currentSelection.set(r),t.scrollToSelection()):(i>-1||o)&&(i>-1&&(t.docView.markDirty(i,s),Z2(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,nD(t,a)),this.handleDOMChange(i,s,l,a),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||wr(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let c=0;c<t.addedNodes.length;c++){let d=t.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let o=t.previousSibling,i=t.nextSibling;if(jt&&po<=11&&t.addedNodes.length)for(let c=0;c<t.addedNodes.length;c++){let{previousSibling:d,nextSibling:f}=t.addedNodes[c];(!d||Array.prototype.indexOf.call(t.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(t.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==t.target?ct(o)+1:0,l=r.localPosFromDOM(t.target,s,-1),a=i&&i.parentNode==t.target?ct(i):t.target.childNodes.length,u=r.localPosFromDOM(t.target,a,1);return{from:l,to:u}}else return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=t.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let Ux=new WeakMap,Wx=!1;function Z2(e){if(!Ux.has(e)&&(Ux.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=cn,Wx)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Wx=!0}}function Gx(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return ri(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function eD(e,t){if(t.getComposedRanges){let o=t.getComposedRanges(e.root)[0];if(o)return Gx(e,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?Gx(e,n):null}function tD(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function nD(e,t){var n;let{focusNode:r,focusOffset:o}=e.domSelectionRange();for(let i of t)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(i,l.firstChild),r==i&&e.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}function rD(e,t,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:l}=e.docView.parseRange(t,n),a=e.domSelectionRange(),u,c=a.anchorNode;if(c&&e.dom.contains(c.nodeType==1?c:c.parentNode)&&(u=[{node:c,offset:a.anchorOffset}],Gd(a)||u.push({node:a.focusNode,offset:a.focusOffset})),ot&&e.input.lastKeyCode===8)for(let y=i;y>o;y--){let g=r.childNodes[y-1],v=g.pmViewDesc;if(g.nodeName=="BR"&&!v){i=y;break}if(!v||v.size)break}let d=e.state.doc,f=e.someProp("domParser")||vr.fromSchema(e.state.schema),p=d.resolve(s),h=null,m=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:oD,context:p});if(u&&u[0].pos!=null){let y=u[0].pos,g=u[1]&&u[1].pos;g==null&&(g=y),h={anchor:y+s,head:g+s}}return{doc:m,sel:h,from:s,to:l}}function oD(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(ht&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||ht&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const iD=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function sD(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let M=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,R=ny(e,M);if(R&&!e.state.selection.eq(R)){if(ot&&mr&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",I=>I(e,_o(13,"Enter"))))return;let D=e.state.tr.setSelection(R);M=="pointer"?D.setMeta("pointer",!0):M=="key"&&D.scrollIntoView(),i&&D.setMeta("composition",i),e.dispatch(D)}return}let s=e.state.doc.resolve(t),l=s.sharedDepth(n);t=s.before(l+1),n=e.state.doc.resolve(n).after(l+1);let a=e.state.selection,u=rD(e,t,n),c=e.state.doc,d=c.slice(u.from,u.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p="end"):(f=e.state.selection.from,p="start"),e.input.lastKeyCode=null;let h=uD(d.content,u.doc.content,u.from,f,p);if(h&&e.input.domChangeCount++,(Ss&&e.input.lastIOSEnter>Date.now()-225||mr)&&o.some(M=>M.nodeType==1&&!iD.test(M.nodeName))&&(!h||h.endA>=h.endB)&&e.someProp("handleKeyDown",M=>M(e,_o(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!h)if(r&&a instanceof de&&!a.empty&&a.$head.sameParent(a.$anchor)&&!e.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))h={start:a.from,endA:a.to,endB:a.to};else{if(u.sel){let M=qx(e,e.state.doc,u.sel);if(M&&!M.eq(e.state.selection)){let R=e.state.tr.setSelection(M);i&&R.setMeta("composition",i),e.dispatch(R)}}return}e.state.selection.from<e.state.selection.to&&h.start==h.endB&&e.state.selection instanceof de&&(h.start>e.state.selection.from&&h.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?h.start=e.state.selection.from:h.endA<e.state.selection.to&&h.endA>=e.state.selection.to-2&&e.state.selection.to<=u.to&&(h.endB+=e.state.selection.to-h.endA,h.endA=e.state.selection.to)),jt&&po<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>u.from&&u.doc.textBetween(h.start-u.from-1,h.start-u.from+1)=="  "&&(h.start--,h.endA--,h.endB--);let m=u.doc.resolveNoCache(h.start-u.from),y=u.doc.resolveNoCache(h.endB-u.from),g=c.resolve(h.start),v=m.sameParent(y)&&m.parent.inlineContent&&g.end()>=h.endA;if((Ss&&e.input.lastIOSEnter>Date.now()-225&&(!v||o.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!v&&m.pos<u.doc.content.size&&(!m.sameParent(y)||!m.parent.inlineContent)&&m.pos<y.pos&&!/\S/.test(u.doc.textBetween(m.pos,y.pos,"","")))&&e.someProp("handleKeyDown",M=>M(e,_o(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>h.start&&aD(c,h.start,h.endA,m,y)&&e.someProp("handleKeyDown",M=>M(e,_o(8,"Backspace")))){mr&&ot&&e.domObserver.suppressSelectionUpdates();return}ot&&h.endB==h.start&&(e.input.lastChromeDelete=Date.now()),mr&&!v&&m.start()!=y.start()&&y.parentOffset==0&&m.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==h.endA&&(h.endB-=2,y=u.doc.resolveNoCache(h.endB-u.from),setTimeout(()=>{e.someProp("handleKeyDown",function(M){return M(e,_o(13,"Enter"))})},20));let k=h.start,S=h.endA,b=M=>{let R=M||e.state.tr.replace(k,S,u.doc.slice(h.start-u.from,h.endB-u.from));if(u.sel){let D=qx(e,R.doc,u.sel);D&&!(ot&&e.composing&&D.empty&&(h.start!=h.endB||e.input.lastChromeDelete<Date.now()-100)&&(D.head==k||D.head==R.mapping.map(S)-1)||jt&&D.empty&&D.head==k)&&R.setSelection(D)}return i&&R.setMeta("composition",i),R.scrollIntoView()},E;if(v)if(m.pos==y.pos){jt&&po<=11&&m.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>wr(e),20));let M=b(e.state.tr.delete(k,S)),R=c.resolve(h.start).marksAcross(c.resolve(h.endA));R&&M.ensureMarks(R),e.dispatch(M)}else if(h.endA==h.endB&&(E=lD(m.parent.content.cut(m.parentOffset,y.parentOffset),g.parent.content.cut(g.parentOffset,h.endA-g.start())))){let M=b(e.state.tr);E.type=="add"?M.addMark(k,S,E.mark):M.removeMark(k,S,E.mark),e.dispatch(M)}else if(m.parent.child(m.index()).isText&&m.index()==y.index()-(y.textOffset?0:1)){let M=m.parent.textBetween(m.parentOffset,y.parentOffset),R=()=>b(e.state.tr.insertText(M,k,S));e.someProp("handleTextInput",D=>D(e,k,S,M,R))||e.dispatch(R())}else e.dispatch(b());else e.dispatch(b())}function qx(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:ry(e,t.resolve(n.anchor),t.resolve(n.head))}function lD(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,o=n,i=r,s,l,a;for(let c=0;c<r.length;c++)o=r[c].removeFromSet(o);for(let c=0;c<n.length;c++)i=n[c].removeFromSet(i);if(o.length==1&&i.length==0)l=o[0],s="add",a=c=>c.mark(l.addToSet(c.marks));else if(o.length==0&&i.length==1)l=i[0],s="remove",a=c=>c.mark(l.removeFromSet(c.marks));else return null;let u=[];for(let c=0;c<t.childCount;c++)u.push(a(t.child(c)));if(_.from(u).eq(e))return{mark:l,type:s}}function aD(e,t,n,r,o){if(n-t<=o.pos-r.pos||vp(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==t+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(vp(i,!0,!0));return!s.parent.isTextblock||s.pos>n||vp(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function vp(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let i=e.node(r).maybeChild(e.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function uD(e,t,n,r,o){let i=e.findDiffStart(t,n);if(i==null)return null;let{a:s,b:l}=e.findDiffEnd(t,n+e.size,n+t.size);if(o=="end"){let a=Math.max(0,i-Math.min(s,l));r-=s+a-i}if(s<i&&e.size<t.size){let a=r<=i&&r>=s?i-r:0;i-=a,i&&i<t.size&&Kx(t.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-s),s=i}else if(l<i){let a=r<=i&&r>=l?i-r:0;i-=a,i&&i<e.size&&Kx(e.textBetween(i-1,i+1))&&(i+=a?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function Kx(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class OC{constructor(t,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new E2,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Zx),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=Xx(this),Qx(this),this.nodeViews=Yx(this),this.docView=Nx(this.state.doc,Jx(this),yp(this),this.dom,this),this.domObserver=new Y2(this,(r,o,i,s)=>sD(this,r,o,i,s)),this.domObserver.start(),M2(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&dm(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(Zx),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var r;let o=this.state,i=!1,s=!1;t.storedMarks&&this.composing&&(CC(this),s=!0),this.state=t;let l=o.plugins!=t.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=Yx(this);dD(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&dm(this),this.editable=Xx(this),Qx(this);let a=yp(this),u=Jx(this),c=o.plugins!=t.plugins&&!o.doc.eq(t.doc)?"reset":t.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(t.doc,u,a);(d||!t.selection.eq(o.selection))&&(s=!0);let f=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&FI(this);if(s){this.domObserver.stop();let p=d&&(jt||ot)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&cD(o.selection,t.selection);if(d){let h=ot?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=F2(this)),(i||!this.docView.update(t.doc,u,a,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Nx(t.doc,u,a,this.dom,this)),h&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&c2(this))?wr(this,p):(fC(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,o),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():f&&BI(f)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof ee){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&bx(this,n.getBoundingClientRect(),t)}else bx(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,t)}}updateDraggedNode(t,n){let r=t.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new MC(t.slice,t.move,o<0?void 0:ee.create(this.state.doc,o))}someProp(t,n){let r=this._props&&this._props[t],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[t];if(l!=null&&(o=n?n(l):l))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[t];if(l!=null&&(o=n?n(l):l))return o}}hasFocus(){if(jt){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&VI(this.dom),wr(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return t||document}updateRoot(){this._root=null}posAtCoords(t){return qI(this,t)}coordsAtPos(t,n=1){return oC(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let o=this.docView.posFromDOM(t,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(t,n){return YI(this,n||this.state,t)}pasteHTML(t,n){return la(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return la(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return oy(this,t)}destroy(){this.docView&&(R2(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],yp(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,AI())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return N2(this,t)}domSelectionRange(){let t=this.domSelection();return t?ht&&this.root.nodeType===11&&LI(this.dom.ownerDocument)==this.dom&&eD(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}OC.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function Jx(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[Ct.node(0,e.state.doc.content.size,t)]}function Qx(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Ct.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Xx(e){return!e.someProp("editable",t=>t(e.state)===!1)}function cD(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function Yx(e){let t=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(t,o)||(t[o]=r[o])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function dD(e,t){let n=0,r=0;for(let o in e){if(e[o]!=t[o])return!0;n++}for(let o in t)r++;return n!=r}function Zx(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var xo={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Lc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},fD=typeof navigator<"u"&&/Mac/.test(navigator.platform),pD=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var dt=0;dt<10;dt++)xo[48+dt]=xo[96+dt]=String(dt);for(var dt=1;dt<=24;dt++)xo[dt+111]="F"+dt;for(var dt=65;dt<=90;dt++)xo[dt]=String.fromCharCode(dt+32),Lc[dt]=String.fromCharCode(dt);for(var xp in xo)Lc.hasOwnProperty(xp)||(Lc[xp]=xo[xp]);function hD(e){var t=fD&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||pD&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Lc:xo)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const mD=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),gD=typeof navigator<"u"&&/Win/.test(navigator.platform);function yD(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<t.length-1;l++){let a=t[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))mD?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function vD(e){let t=Object.create(null);for(let n in e)t[yD(n)]=e[n];return t}function wp(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function xD(e){return new Ie({props:{handleKeyDown:cy(e)}})}function cy(e){let t=vD(e);return function(n,r){let o=hD(r),i,s=t[wp(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=t[wp(o,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(gD&&r.ctrlKey&&r.altKey)&&(i=xo[r.keyCode])&&i!=o){let l=t[wp(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var wD=Object.defineProperty,dy=(e,t)=>{for(var n in t)wD(e,n,{get:t[n],enumerable:!0})};function Jd(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var Qd=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([s,l])=>[s,(...u)=>{const c=l(...u)(i);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],l=!!e,a=e||o.tr,u=()=>(!l&&t&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),s.every(d=>d===!0)),c={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...h)=>{const m=this.buildProps(a,t),y=f(...h)(m);return s.push(y),c}])),run:u};return c}createCan(e){const{rawCommands:t,state:n}=this,r=!1,o=e||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(t).map(([l,a])=>[l,(...u)=>a(...u)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:e,editor:r,view:i,state:Jd({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...u)=>a(...u)(s)]))}};return s}},wn={};dy(wn,{blur:()=>kD,clearContent:()=>SD,clearNodes:()=>bD,command:()=>CD,createParagraphNear:()=>ED,cut:()=>MD,deleteCurrentNode:()=>RD,deleteNode:()=>TD,deleteRange:()=>ND,deleteSelection:()=>AD,enter:()=>OD,exitCode:()=>PD,extendMarkRange:()=>ID,first:()=>DD,focus:()=>_D,forEach:()=>$D,insertContent:()=>zD,insertContentAt:()=>BD,joinBackward:()=>UD,joinDown:()=>HD,joinForward:()=>WD,joinItemBackward:()=>GD,joinItemForward:()=>qD,joinTextblockBackward:()=>KD,joinTextblockForward:()=>JD,joinUp:()=>VD,keyboardShortcut:()=>XD,lift:()=>YD,liftEmptyBlock:()=>ZD,liftListItem:()=>eL,newlineInCode:()=>tL,resetAttributes:()=>nL,scrollIntoView:()=>rL,selectAll:()=>oL,selectNodeBackward:()=>iL,selectNodeForward:()=>sL,selectParentNode:()=>lL,selectTextblockEnd:()=>aL,selectTextblockStart:()=>uL,setContent:()=>cL,setMark:()=>AL,setMeta:()=>OL,setNode:()=>PL,setNodeSelection:()=>IL,setTextDirection:()=>DL,setTextSelection:()=>LL,sinkListItem:()=>_L,splitBlock:()=>$L,splitListItem:()=>zL,toggleList:()=>jL,toggleMark:()=>FL,toggleNode:()=>BL,toggleWrap:()=>VL,undoInputRule:()=>HL,unsetAllMarks:()=>UL,unsetMark:()=>WL,unsetTextDirection:()=>GL,updateAttributes:()=>qL,wrapIn:()=>KL,wrapInList:()=>JL});var kD=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),SD=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),bD=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{e.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:u,mapping:c}=t,d=u.resolve(c.map(a)),f=u.resolve(c.map(a+l.nodeSize)),p=d.blockRange(f);if(!p)return;const h=Ps(p);if(l.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());t.setNodeMarkup(p.start,m)}(h||h===0)&&t.lift(p,h)})}),!0},CD=e=>t=>e(t),ED=()=>({state:e,dispatch:t})=>qb(e,t),MD=(e,t)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const s=r.mapping.map(t);return r.insert(s,i.content),r.setSelection(new de(r.doc.resolve(Math.max(s-1,0)))),!0},RD=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const o=e.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(t){const l=o.before(i),a=o.after(i);e.delete(l,a).scrollIntoView()}return!0}return!1};function Je(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var TD=e=>({tr:t,state:n,dispatch:r})=>{const o=Je(e,n.schema),i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){const a=i.before(s),u=i.after(s);t.delete(a,u).scrollIntoView()}return!0}return!1},ND=e=>({tr:t,dispatch:n})=>{const{from:r,to:o}=e;return n&&t.delete(r,o),!0},AD=()=>({state:e,dispatch:t})=>Qg(e,t),OD=()=>({commands:e})=>e.keyboardShortcut("Enter"),PD=()=>({state:e,dispatch:t})=>mI(e,t);function fy(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function _c(e,t,n={strict:!0}){const r=Object.keys(t);return r.length?r.every(o=>n.strict?t[o]===e[o]:fy(t[o])?t[o].test(e[o]):t[o]===e[o]):!0}function PC(e,t,n={}){return e.find(r=>r.type===t&&_c(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function ew(e,t,n={}){return!!PC(e,t,n)}function py(e,t,n){var r;if(!e||!t)return;let o=e.parent.childAfter(e.parentOffset);if((!o.node||!o.node.marks.some(c=>c.type===t))&&(o=e.parent.childBefore(e.parentOffset)),!o.node||!o.node.marks.some(c=>c.type===t)||(n=n||((r=o.node.marks[0])==null?void 0:r.attrs),!PC([...o.node.marks],t,n)))return;let s=o.index,l=e.start()+o.offset,a=s+1,u=l+o.node.nodeSize;for(;s>0&&ew([...e.parent.child(s-1).marks],t,n);)s-=1,l-=e.parent.child(s).nodeSize;for(;a<e.parent.childCount&&ew([...e.parent.child(a).marks],t,n);)u+=e.parent.child(a).nodeSize,a+=1;return{from:l,to:u}}function Rr(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var ID=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const i=Rr(e,r.schema),{doc:s,selection:l}=n,{$from:a,from:u,to:c}=l;if(o){const d=py(a,i,t);if(d&&d.from<=u&&d.to>=c){const f=de.create(s,d.from,d.to);n.setSelection(f)}}return!0},DD=e=>t=>{const n=typeof e=="function"?e(t):e;for(let r=0;r<n.length;r+=1)if(n[r](t))return!0;return!1};function hy(e){return e instanceof de}function gr(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function IC(e,t=null){if(!t)return null;const n=ce.atStart(e),r=ce.atEnd(e);if(t==="start"||t===!0)return n;if(t==="end")return r;const o=n.from,i=r.to;return t==="all"?de.create(e,gr(0,o,i),gr(e.content.size,o,i)):de.create(e,gr(t,o,i),gr(t,o,i))}function tw(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function $c(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function LD(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var _D=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{($c()||tw())&&r.dom.focus(),LD()&&!$c()&&!tw()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t!=null&&t.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(i&&e===null&&!hy(n.state.selection))return s(),!0;const l=IC(o.doc,e)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},$D=(e,t)=>n=>e.every((r,o)=>t(r,{...n,index:o})),zD=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),DC=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&DC(r)}return e};function fl(e){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,"text/html").body;return DC(n)}function ua(e,t,n){if(e instanceof fo||e instanceof _)return e;n={slice:!0,parseOptions:{},...n};const r=typeof e=="object"&&e!==null,o=typeof e=="string";if(r)try{if(Array.isArray(e)&&e.length>0)return _.fromArray(e.map(l=>t.nodeFromJSON(l)));const s=t.nodeFromJSON(e);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",i),ua("",t,n)}if(o){if(n.errorOnInvalidContent){let s=!1,l="";const a=new xb({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(s=!0,l=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?vr.fromSchema(a).parseSlice(fl(e),n.parseOptions):vr.fromSchema(a).parse(fl(e),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=vr.fromSchema(t);return n.slice?i.parseSlice(fl(e),n.parseOptions).content:i.parse(fl(e),n.parseOptions)}return ua("",t,n)}function jD(e,t,n){const r=e.steps.length-1;if(r<t)return;const o=e.steps[r];if(!(o instanceof rt||o instanceof st))return;const i=e.mapping.maps[r];let s=0;i.forEach((l,a,u,c)=>{s===0&&(s=c)}),e.setSelection(ce.near(e.doc.resolve(s),n))}var FD=e=>!("type"in e),BD=(e,t,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=y=>{i.emit("contentError",{editor:i,error:y,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{ua(t,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=ua(t,i.schema,{parseOptions:u,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(y){return a(y),!1}let{from:c,to:d}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},f=!0,p=!0;if((FD(l)?l:[l]).forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,p=p?y.isBlock:!1}),c===d&&p){const{parent:y}=r.doc.resolve(c);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(c-=1,d+=1)}let m;if(f){if(Array.isArray(t))m=t.map(y=>y.text||"").join("");else if(t instanceof _){let y="";t.forEach(g=>{g.text&&(y+=g.text)}),m=y}else typeof t=="object"&&t&&t.text?m=t.text:m=t;r.insertText(m,c,d)}else{m=l;const y=r.doc.resolve(c),g=y.node(),v=y.parentOffset===0,k=g.isText||g.isTextblock,S=g.content.size>0;v&&k&&S&&(c=Math.max(0,c-1)),r.replaceWith(c,d,m)}n.updateSelection&&jD(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:m})}return!0},VD=()=>({state:e,dispatch:t})=>fI(e,t),HD=()=>({state:e,dispatch:t})=>pI(e,t),UD=()=>({state:e,dispatch:t})=>Fb(e,t),WD=()=>({state:e,dispatch:t})=>Ub(e,t),GD=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Hd(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},qD=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Hd(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},KD=()=>({state:e,dispatch:t})=>cI(e,t),JD=()=>({state:e,dispatch:t})=>dI(e,t);function LC(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function QD(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<t.length-1;l+=1){const a=t[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))$c()||LC()?s=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var XD=e=>({editor:t,view:n,tr:r,dispatch:o})=>{const i=QD(e).split(/-(?!$)/),s=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=t.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,l))});return a==null||a.steps.forEach(u=>{const c=u.map(r.mapping);c&&o&&r.maybeStep(c)}),!0};function wo(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?Je(t,e.schema):null,l=[];e.doc.nodesBetween(r,o,(d,f)=>{if(d.isText)return;const p=Math.max(r,f),h=Math.min(o,f+d.nodeSize);l.push({node:d,from:p,to:h})});const a=o-r,u=l.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>_c(d.node.attrs,n,{strict:!1}));return i?!!u.length:u.reduce((d,f)=>d+f.to-f.from,0)>=a}var YD=(e,t={})=>({state:n,dispatch:r})=>{const o=Je(e,n.schema);return wo(n,o,t)?hI(n,r):!1},ZD=()=>({state:e,dispatch:t})=>Kb(e,t),eL=e=>({state:t,dispatch:n})=>{const r=Je(e,t.schema);return MI(r)(t,n)},tL=()=>({state:e,dispatch:t})=>Gb(e,t);function Xd(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function nw(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((r,o)=>(n.includes(o)||(r[o]=e[o]),r),{})}var nL=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=Xd(typeof e=="string"?e:e.name,r.schema);if(!l)return!1;l==="node"&&(i=Je(e,r.schema)),l==="mark"&&(s=Rr(e,r.schema));let a=!1;return n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(c,d)=>{i&&i===c.type&&(a=!0,o&&n.setNodeMarkup(d,void 0,nw(c.attrs,t))),s&&c.marks.length&&c.marks.forEach(f=>{s===f.type&&(a=!0,o&&n.addMark(d,d+c.nodeSize,s.create(nw(f.attrs,t))))})})}),a},rL=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),oL=()=>({tr:e,dispatch:t})=>{if(t){const n=new qt(e.doc);e.setSelection(n)}return!0},iL=()=>({state:e,dispatch:t})=>Vb(e,t),sL=()=>({state:e,dispatch:t})=>Wb(e,t),lL=()=>({state:e,dispatch:t})=>vI(e,t),aL=()=>({state:e,dispatch:t})=>kI(e,t),uL=()=>({state:e,dispatch:t})=>wI(e,t);function fm(e,t,n={},r={}){return ua(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var cL=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:l})=>{const{doc:a}=i;if(r.preserveWhitespace!=="full"){const u=fm(e,o.schema,r,{errorOnInvalidContent:t??o.options.enableContentCheck});return s&&i.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},e,{parseOptions:r,errorOnInvalidContent:t??o.options.enableContentCheck})};function _C(e,t){const n=Rr(t,e.schema),{from:r,to:o,empty:i}=e.selection,s=[];i?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,o,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function $C(e,t){const n=new Lb(e);return t.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function dL(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function fL(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(o,i)=>{n(o)&&r.push({node:o,pos:i})}),r}function pL(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function Yd(e){return t=>pL(t.$from,e)}function Q(e,t,n){return e.config[t]===void 0&&e.parent?Q(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?Q(e.parent,t,n):null}):e.config[t]}function Zd(e){return e.map(t=>{const n={name:t.name,options:t.options,storage:t.storage},r=Q(t,"addExtensions",n);return r?[t,...Zd(r())]:t}).flat(10)}function my(e,t){const n=hi.fromSchema(t).serializeFragment(e),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function zC(e){return typeof e=="function"}function Se(e,t=void 0,...n){return zC(e)?t?e.bind(t)(...n):e(...n):e}function hL(e={}){return Object.keys(e).length===0&&e.constructor===Object}function bs(e){const t=e.filter(o=>o.type==="extension"),n=e.filter(o=>o.type==="node"),r=e.filter(o=>o.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:r}}function jC(e){const t=[],{nodeExtensions:n,markExtensions:r}=bs(e),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:o},a=Q(s,"addGlobalAttributes",l);if(!a)return;a().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([f,p])=>{t.push({type:d,name:f,attribute:{...i,...p}})})})})}),o.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},a=Q(s,"addAttributes",l);if(!a)return;const u=a();Object.entries(u).forEach(([c,d])=>{const f={...i,...d};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,t.push({type:s.name,name:c,attribute:f})})}),t}function Qe(...e){return e.filter(t=>!!t).reduce((t,n)=>{const r={...t};return Object.entries(n).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){const l=i?String(i).split(" "):[],a=r[o]?r[o].split(" "):[],u=l.filter(c=>!a.includes(c));r[o]=[...a,...u].join(" ")}else if(o==="style"){const l=i?i.split(";").map(c=>c.trim()).filter(Boolean):[],a=r[o]?r[o].split(";").map(c=>c.trim()).filter(Boolean):[],u=new Map;a.forEach(c=>{const[d,f]=c.split(":").map(p=>p.trim());u.set(d,f)}),l.forEach(c=>{const[d,f]=c.split(":").map(p=>p.trim());u.set(d,f)}),r[o]=Array.from(u.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else r[o]=i}),r},{})}function ca(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,r)=>Qe(n,r),{})}function mL(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function rw(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;const o=t.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(n):mL(n.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...r,...o}}}}function ow(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&hL(n)?!1:n!=null))}function iw(e){var t,n;const r={};return!((t=e==null?void 0:e.attribute)!=null&&t.isRequired)&&"default"in((e==null?void 0:e.attribute)||{})&&(r.default=e.attribute.default),((n=e==null?void 0:e.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function FC(e,t){var n;const r=jC(e),{nodeExtensions:o,markExtensions:i}=bs(e),s=(n=o.find(u=>Q(u,"topNode")))==null?void 0:n.name,l=Object.fromEntries(o.map(u=>{const c=r.filter(g=>g.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:t},f=e.reduce((g,v)=>{const k=Q(v,"extendNodeSchema",d);return{...g,...k?k(u):{}}},{}),p=ow({...f,content:Se(Q(u,"content",d)),marks:Se(Q(u,"marks",d)),group:Se(Q(u,"group",d)),inline:Se(Q(u,"inline",d)),atom:Se(Q(u,"atom",d)),selectable:Se(Q(u,"selectable",d)),draggable:Se(Q(u,"draggable",d)),code:Se(Q(u,"code",d)),whitespace:Se(Q(u,"whitespace",d)),linebreakReplacement:Se(Q(u,"linebreakReplacement",d)),defining:Se(Q(u,"defining",d)),isolating:Se(Q(u,"isolating",d)),attrs:Object.fromEntries(c.map(iw))}),h=Se(Q(u,"parseHTML",d));h&&(p.parseDOM=h.map(g=>rw(g,c)));const m=Q(u,"renderHTML",d);m&&(p.toDOM=g=>m({node:g,HTMLAttributes:ca(g,c)}));const y=Q(u,"renderText",d);return y&&(p.toText=y),[u.name,p]})),a=Object.fromEntries(i.map(u=>{const c=r.filter(y=>y.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:t},f=e.reduce((y,g)=>{const v=Q(g,"extendMarkSchema",d);return{...y,...v?v(u):{}}},{}),p=ow({...f,inclusive:Se(Q(u,"inclusive",d)),excludes:Se(Q(u,"excludes",d)),group:Se(Q(u,"group",d)),spanning:Se(Q(u,"spanning",d)),code:Se(Q(u,"code",d)),attrs:Object.fromEntries(c.map(iw))}),h=Se(Q(u,"parseHTML",d));h&&(p.parseDOM=h.map(y=>rw(y,c)));const m=Q(u,"renderHTML",d);return m&&(p.toDOM=y=>m({mark:y,HTMLAttributes:ca(y,c)})),[u.name,p]}));return new xb({topNode:s,nodes:l,marks:a})}function gL(e){const t=e.filter((n,r)=>e.indexOf(n)!==r);return Array.from(new Set(t))}function zc(e){return e.sort((n,r)=>{const o=Q(n,"priority")||100,i=Q(r,"priority")||100;return o>i?-1:o<i?1:0})}function gy(e){const t=zc(Zd(e)),n=gL(t.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),t}function yL(e,t){const n=gy(e);return FC(n,t)}function vL(e,t){const n=yL(t),r=fl(e);return vr.fromSchema(n).parse(r).toJSON()}function BC(e,t,n){const{from:r,to:o}=t,{blockSeparator:i=`
85
-
86
- `,textSerializers:s={}}=n||{};let l="";return e.nodesBetween(r,o,(a,u,c,d)=>{var f;a.isBlock&&u>r&&(l+=i);const p=s==null?void 0:s[a.type.name];if(p)return c&&(l+=p({node:a,pos:u,parent:c,index:d,range:t})),!1;a.isText&&(l+=(f=a==null?void 0:a.text)==null?void 0:f.slice(Math.max(r,u)-u,o-u))}),l}function VC(e,t){const n={from:0,to:e.content.size};return BC(e,n,t)}function yy(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}function xL(e,t){const n=Je(t,e.schema),{from:r,to:o}=e.selection,i=[];e.doc.nodesBetween(r,o,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function HC(e,t){const n=Xd(typeof t=="string"?t:t.name,e.schema);return n==="node"?xL(e,t):n==="mark"?_C(e,t):{}}function wL(e,t=JSON.stringify){const n={};return e.filter(r=>{const o=t(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function kL(e){const t=wL(e);return t.length===1?t:t.filter((n,r)=>!t.filter((i,s)=>s!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function UC(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((o,i)=>{const s=[];if(o.ranges.length)o.forEach((l,a)=>{s.push({from:l,to:a})});else{const{from:l,to:a}=n[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{const u=t.slice(i).map(l,-1),c=t.slice(i).map(a),d=t.invert().map(u,-1),f=t.invert().map(c);r.push({oldRange:{from:d,to:f},newRange:{from:u,to:c}})})}),kL(r)}function vy(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(o=>{const i=n.resolve(e),s=py(i,o.type);s&&r.push({mark:o,...s})}):n.nodesBetween(e,t,(o,i)=>{!o||(o==null?void 0:o.nodeSize)===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}var SL=(e,t,n,r=20)=>{const o=e.doc.resolve(n);let i=r,s=null;for(;i>0&&s===null;){const l=o.node(i);(l==null?void 0:l.type.name)===t?s=l:i-=1}return[s,i]};function iu(e,t){return t.nodes[e]||t.marks[e]||null}function Wu(e,t,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=e.find(i=>i.type===t&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}var bL=(e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(o,i,s,l)=>{var a,u;const c=((u=(a=o.type.spec).toText)==null?void 0:u.call(a,{node:o,pos:i,parent:s,index:l}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?c:c.slice(0,Math.max(0,r-i))}),n};function pm(e,t,n={}){const{empty:r,ranges:o}=e.selection,i=t?Rr(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>_c(d.attrs,n,{strict:!1}));let s=0;const l=[];if(o.forEach(({$from:d,$to:f})=>{const p=d.pos,h=f.pos;e.doc.nodesBetween(p,h,(m,y)=>{if(!m.isText&&!m.marks.length)return;const g=Math.max(p,y),v=Math.min(h,y+m.nodeSize),k=v-g;s+=k,l.push(...m.marks.map(S=>({mark:S,from:g,to:v})))})}),s===0)return!1;const a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>_c(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),u=l.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+u:a)>=s}function CL(e,t,n={}){if(!t)return wo(e,null,n)||pm(e,null,n);const r=Xd(t,e.schema);return r==="node"?wo(e,t,n):r==="mark"?pm(e,t,n):!1}var EL=(e,t)=>{const{$from:n,$to:r,$anchor:o}=e.selection;if(t){const i=Yd(l=>l.type.name===t)(e.selection);if(!i)return!1;const s=e.doc.resolve(i.pos+1);return o.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},ML=e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function sw(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function lw(e,t){const{nodeExtensions:n}=bs(t),r=n.find(s=>s.name===e);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},i=Se(Q(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function ef(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(e.type.name==="hardBreak")return!0;if(e.isText)return/^\s*$/m.test((r=e.text)!=null?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let o=!0;return e.content.forEach(i=>{o!==!1&&(ef(i,{ignoreWhitespace:n,checkChildren:t})||(o=!1))}),o}return!1}function WC(e){return e instanceof ee}var GC=class qC{constructor(t){this.position=t}static fromJSON(t){return new qC(t.position)}toJSON(){return{position:this.position}}};function RL(e,t){const n=t.mapping.mapResult(e.position);return{position:new GC(n.pos),mapResult:n}}function TL(e){return new GC(e)}function KC(e,t,n){const o=e.state.doc.content.size,i=gr(t,0,o),s=gr(n,0,o),l=e.coordsAtPos(i),a=e.coordsAtPos(s,-1),u=Math.min(l.top,a.top),c=Math.max(l.bottom,a.bottom),d=Math.min(l.left,a.left),f=Math.max(l.right,a.right),p=f-d,h=c-u,g={top:u,bottom:c,left:d,right:f,width:p,height:h,x:d,y:u};return{...g,toJSON:()=>g}}function NL(e,t,n){var r;const{selection:o}=t;let i=null;if(hy(o)&&(i=o.$cursor),i){const l=(r=e.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(u=>u.type.excludes(n)))}const{ranges:s}=o;return s.some(({$from:l,$to:a})=>{let u=l.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(l.pos,a.pos,(c,d,f)=>{if(u)return!1;if(c.isInline){const p=!f||f.type.allowsMarkType(n),h=!!n.isInSet(c.marks)||!c.marks.some(m=>m.type.excludes(n));u=p&&h}return!u}),u})}var AL=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:l}=i,a=Rr(e,r.schema);if(o)if(s){const u=_C(r,a);n.addStoredMark(a.create({...u,...t}))}else l.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;r.doc.nodesBetween(c,d,(f,p)=>{const h=Math.max(p,c),m=Math.min(p+f.nodeSize,d);f.marks.find(g=>g.type===a)?f.marks.forEach(g=>{a===g.type&&n.addMark(h,m,a.create({...g.attrs,...t}))}):n.addMark(h,m,a.create(t))})});return NL(r,n,a)},OL=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),PL=(e,t={})=>({state:n,dispatch:r,chain:o})=>{const i=Je(e,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:l})=>wx(i,{...s,...t})(n)?!0:l.clearNodes()).command(({state:l})=>wx(i,{...s,...t})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},IL=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,o=gr(e,0,r.content.size),i=ee.create(r,o);t.setSelection(i)}return!0},DL=(e,t)=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=r;let s,l;return typeof t=="number"?(s=t,l=t):t&&"from"in t&&"to"in t?(s=t.from,l=t.to):(s=i.from,l=i.to),o&&n.doc.nodesBetween(s,l,(a,u)=>{a.isText||n.setNodeMarkup(u,void 0,{...a.attrs,dir:e})}),!0},LL=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,{from:o,to:i}=typeof e=="number"?{from:e,to:e}:e,s=de.atStart(r).from,l=de.atEnd(r).to,a=gr(o,s,l),u=gr(i,s,l),c=de.create(r,a,u);t.setSelection(c)}return!0},_L=e=>({state:t,dispatch:n})=>{const r=Je(e,t.schema);return NI(r)(t,n)};function aw(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(o=>t==null?void 0:t.includes(o.type.name));e.tr.ensureMarks(r)}}var $L=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:l,$to:a}=i,u=o.extensionManager.attributes,c=Wu(u,l.node().type.name,l.node().attrs);if(i instanceof ee&&i.node.isBlock)return!l.parentOffset||!xr(s,l.pos)?!1:(r&&(e&&aw(n,o.extensionManager.splittableMarks),t.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:dL(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=d&&f?[{type:f,attrs:c}]:void 0,h=xr(t.doc,t.mapping.map(l.pos),1,p);if(!p&&!h&&xr(t.doc,t.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(h=!0,p=f?[{type:f,attrs:c}]:void 0),r){if(h&&(i instanceof de&&t.deleteSelection(),t.split(t.mapping.map(l.pos),1,p),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const m=t.mapping.map(l.before()),y=t.doc.resolve(m);l.node(-1).canReplaceWith(y.index(),y.index()+1,f)&&t.setNodeMarkup(t.mapping.map(l.before()),f)}e&&aw(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return h},zL=(e,t={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const l=Je(e,r.schema),{$from:a,$to:u}=r.selection,c=r.selection.node;if(c&&c.isBlock||a.depth<2||!a.sameParent(u))return!1;const d=a.node(-1);if(d.type!==l)return!1;const f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(o){let g=_.empty;const v=a.index(-1)?1:a.index(-2)?2:3;for(let R=a.depth-v;R>=a.depth-3;R-=1)g=_.from(a.node(R).copy(g));const k=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,S={...Wu(f,a.node().type.name,a.node().attrs),...t},b=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(S))||void 0;g=g.append(_.from(l.createAndFill(null,b)||void 0));const E=a.before(a.depth-(v-1));n.replace(E,a.after(-k),new B(g,4-v,0));let M=-1;n.doc.nodesBetween(E,n.doc.content.size,(R,D)=>{if(M>-1)return!1;R.isTextblock&&R.content.size===0&&(M=D+1)}),M>-1&&n.setSelection(de.near(n.doc.resolve(M))),n.scrollIntoView()}return!0}const p=u.pos===a.end()?d.contentMatchAt(0).defaultType:null,h={...Wu(f,d.type.name,d.attrs),...t},m={...Wu(f,a.node().type.name,a.node().attrs),...t};n.delete(a.pos,u.pos);const y=p?[{type:l,attrs:h},{type:p,attrs:m}]:[{type:l,attrs:h}];if(!xr(n.doc,a.pos,2))return!1;if(o){const{selection:g,storedMarks:v}=r,{splittableMarks:k}=i.extensionManager,S=v||g.$to.parentOffset&&g.$from.marks();if(n.split(a.pos,2,y).scrollIntoView(),!S||!o)return!0;const b=S.filter(E=>k.includes(E.type.name));n.ensureMarks(b)}return!0},kp=(e,t)=>{const n=Yd(s=>s.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=e.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&To(e.doc,n.pos)&&e.join(n.pos),!0},Sp=(e,t)=>{const n=Yd(s=>s.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=e.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&To(e.doc,r)&&e.join(r),!0},jL=(e,t,n,r={})=>({editor:o,tr:i,state:s,dispatch:l,chain:a,commands:u,can:c})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,p=Je(e,s.schema),h=Je(t,s.schema),{selection:m,storedMarks:y}=s,{$from:g,$to:v}=m,k=g.blockRange(v),S=y||m.$to.parentOffset&&m.$from.marks();if(!k)return!1;const b=Yd(E=>lw(E.type.name,d))(m);if(k.depth>=1&&b&&k.depth-b.depth<=1){if(b.node.type===p)return u.liftListItem(h);if(lw(b.node.type.name,d)&&p.validContent(b.node.content)&&l)return a().command(()=>(i.setNodeMarkup(b.pos,p),!0)).command(()=>kp(i,p)).command(()=>Sp(i,p)).run()}return!n||!S||!l?a().command(()=>c().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>kp(i,p)).command(()=>Sp(i,p)).run():a().command(()=>{const E=c().wrapInList(p,r),M=S.filter(R=>f.includes(R.type.name));return i.ensureMarks(M),E?!0:u.clearNodes()}).wrapInList(p,r).command(()=>kp(i,p)).command(()=>Sp(i,p)).run()},FL=(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=Rr(e,r.schema);return pm(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)},BL=(e,t,n={})=>({state:r,commands:o})=>{const i=Je(e,r.schema),s=Je(t,r.schema),l=wo(r,i,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?o.setNode(s,a):o.setNode(i,{...a,...n})},VL=(e,t={})=>({state:n,commands:r})=>{const o=Je(e,n.schema);return wo(n,o,t)?r.lift(o):r.wrapIn(o,t)},HL=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){const s=e.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,e.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},UL=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:o}=n;return r||t&&o.forEach(i=>{e.removeMark(i.$from.pos,i.$to.pos)}),!0},WL=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:l}=n,a=Rr(e,r.schema),{$from:u,empty:c,ranges:d}=l;if(!o)return!0;if(c&&s){let{from:f,to:p}=l;const h=(i=u.marks().find(y=>y.type===a))==null?void 0:i.attrs,m=py(u,a,h);m&&(f=m.from,p=m.to),n.removeMark(f,p,a)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,a)});return n.removeStoredMark(a),!0},GL=e=>({tr:t,state:n,dispatch:r})=>{const{selection:o}=n;let i,s;return typeof e=="number"?(i=e,s=e):e&&"from"in e&&"to"in e?(i=e.from,s=e.to):(i=o.from,s=o.to),r&&t.doc.nodesBetween(i,s,(l,a)=>{if(l.isText)return;const u={...l.attrs};delete u.dir,t.setNodeMarkup(a,void 0,u)}),!0},qL=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=Xd(typeof e=="string"?e:e.name,r.schema);if(!l)return!1;l==="node"&&(i=Je(e,r.schema)),l==="mark"&&(s=Rr(e,r.schema));let a=!1;return n.selection.ranges.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;let f,p,h,m;n.selection.empty?r.doc.nodesBetween(c,d,(y,g)=>{i&&i===y.type&&(a=!0,h=Math.max(g,c),m=Math.min(g+y.nodeSize,d),f=g,p=y)}):r.doc.nodesBetween(c,d,(y,g)=>{g<c&&i&&i===y.type&&(a=!0,h=Math.max(g,c),m=Math.min(g+y.nodeSize,d),f=g,p=y),g>=c&&g<=d&&(i&&i===y.type&&(a=!0,o&&n.setNodeMarkup(g,void 0,{...y.attrs,...t})),s&&y.marks.length&&y.marks.forEach(v=>{if(s===v.type&&(a=!0,o)){const k=Math.max(g,c),S=Math.min(g+y.nodeSize,d);n.addMark(k,S,s.create({...v.attrs,...t}))}}))}),p&&(f!==void 0&&o&&n.setNodeMarkup(f,void 0,{...p.attrs,...t}),s&&p.marks.length&&p.marks.forEach(y=>{s===y.type&&o&&n.addMark(h,m,s.create({...y.attrs,...t}))}))}),a},KL=(e,t={})=>({state:n,dispatch:r})=>{const o=Je(e,n.schema);return SI(o,t)(n,r)},JL=(e,t={})=>({state:n,dispatch:r})=>{const o=Je(e,n.schema);return bI(o,t)(n,r)},QL=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(r=>r.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(r=>r!==t):delete this.callbacks[e]),this}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},tf=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=(t=e.undoable)!=null?t:!0}},XL=(e,t)=>{if(fy(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function su(e){var t;const{editor:n,from:r,to:o,text:i,rules:s,plugin:l}=e,{view:a}=n;if(a.composing)return!1;const u=a.state.doc.resolve(r);if(u.parent.type.spec.code||(t=u.nodeBefore||u.nodeAfter)!=null&&t.marks.find(f=>f.type.spec.code))return!1;let c=!1;const d=bL(u)+i;return s.forEach(f=>{if(c)return;const p=XL(d,f.find);if(!p)return;const h=a.state.tr,m=Jd({state:a.state,transaction:h}),y={from:r-(p[0].length-i.length),to:o},{commands:g,chain:v,can:k}=new Qd({editor:n,state:m});f.handler({state:m,range:y,match:p,commands:g,chain:v,can:k})===null||!h.steps.length||(f.undoable&&h.setMeta(l,{transform:h,from:r,to:o,text:i}),a.dispatch(h),c=!0)}),c}function YL(e){const{editor:t,rules:n}=e,r=new Ie({state:{init(){return null},apply(o,i,s){const l=o.getMeta(r);if(l)return l;const a=o.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:c}=a;typeof c=="string"?c=c:c=my(_.from(c),s.schema);const{from:d}=a,f=d+c.length;su({editor:t,from:d,to:f,text:c,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,l){return su({editor:t,from:i,to:s,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:i}=o.state.selection;i&&su({editor:t,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;const{$cursor:s}=o.state.selection;return s?su({editor:t,from:s.pos,to:s.pos,text:`
87
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function ZL(e){return Object.prototype.toString.call(e).slice(8,-1)}function lu(e){return ZL(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function JC(e,t){const n={...e};return lu(e)&&lu(t)&&Object.keys(t).forEach(r=>{lu(t[r])&&lu(e[r])?n[r]=JC(e[r],t[r]):n[r]=t[r]}),n}var xy=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...Se(Q(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Se(Q(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>JC(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},mi=class QC extends xy{constructor(){super(...arguments),this.type="mark"}static create(t={}){const n=typeof t=="function"?t():t;return new QC(n)}static handleExit({editor:t,mark:n}){const{tr:r}=t.state,o=t.state.selection.$from;if(o.pos===o.end()){const s=o.marks();if(!!!s.find(u=>(u==null?void 0:u.type.name)===n.name))return!1;const a=s.find(u=>(u==null?void 0:u.type.name)===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",o.pos),t.view.dispatch(r),!0}return!1}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}};function e_(e){return typeof e=="number"}var t_=class{constructor(e){this.find=e.find,this.handler=e.handler}},n_=(e,t,n)=>{if(fy(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(o=>{const i=[o.text];return i.index=o.index,i.input=e,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function r_(e){const{editor:t,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:l}=e,{commands:a,chain:u,can:c}=new Qd({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,o,(p,h)=>{var m,y,g,v,k;if((y=(m=p.type)==null?void 0:m.spec)!=null&&y.code||!(p.isText||p.isTextblock||p.isInline))return;const S=(k=(v=(g=p.content)==null?void 0:g.size)!=null?v:p.nodeSize)!=null?k:0,b=Math.max(r,h),E=Math.min(o,h+S);if(b>=E)return;const M=p.isText?p.text||"":p.textBetween(b-h,E-h,void 0,"");n_(M,i.find,s).forEach(D=>{if(D.index===void 0)return;const I=b+D.index+1,J=I+D[0].length,ne={from:n.tr.mapping.map(I),to:n.tr.mapping.map(J)},re=i.handler({state:n,range:ne,match:D,commands:a,chain:u,can:c,pasteEvent:s,dropEvent:l});d.push(re)})}),d.every(p=>p!==null)}var au=null,o_=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData("text/html",e),n};function i_(e){const{editor:t,rules:n}=e;let r=null,o=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:c,from:d,to:f,rule:p,pasteEvt:h})=>{const m=c.tr,y=Jd({state:c,transaction:m});if(!(!r_({editor:t,state:y,from:Math.max(d-1,0),to:f.b-1,rule:p,pasteEvent:h,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(c=>new Ie({view(d){const f=h=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(h.target)?d.dom.parentElement:null,r&&(au=t)},p=()=>{au&&(au=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,l=f,!i){const p=au;p!=null&&p.isEditable&&setTimeout(()=>{const h=p.state.selection;h&&p.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(d,f)=>{var p;const h=(p=f.clipboardData)==null?void 0:p.getData("text/html");return s=f,o=!!(h!=null&&h.includes("data-pm-slice")),!1}}},appendTransaction:(d,f,p)=>{const h=d[0],m=h.getMeta("uiEvent")==="paste"&&!o,y=h.getMeta("uiEvent")==="drop"&&!i,g=h.getMeta("applyPasteRules"),v=!!g;if(!m&&!y&&!v)return;if(v){let{text:b}=g;typeof b=="string"?b=b:b=my(_.from(b),p.schema);const{from:E}=g,M=E+b.length,R=o_(b);return a({rule:c,state:p,from:E,to:{b:M},pasteEvt:R})}const k=f.doc.content.findDiffStart(p.doc.content),S=f.doc.content.findDiffEnd(p.doc.content);if(!(!e_(k)||!S||k===S.b))return a({rule:c,state:p,from:k,to:S,pasteEvt:s})}}))}var nf=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=gy(e),this.schema=FC(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:iu(t.name,this.schema)},r=Q(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){const{editor:e}=this;return zc([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:iu(r.name,this.schema)},i=[],s=Q(r,"addKeyboardShortcuts",o);let l={};if(r.type==="mark"&&Q(r,"exitable",o)&&(l.ArrowRight=()=>mi.handleExit({editor:e,mark:r})),s){const f=Object.fromEntries(Object.entries(s()).map(([p,h])=>[p,()=>h({editor:e})]));l={...l,...f}}const a=xD(l);i.push(a);const u=Q(r,"addInputRules",o);if(sw(r,e.options.enableInputRules)&&u){const f=u();if(f&&f.length){const p=YL({editor:e,rules:f}),h=Array.isArray(p)?p:[p];i.push(...h)}}const c=Q(r,"addPasteRules",o);if(sw(r,e.options.enablePasteRules)&&c){const f=c();if(f&&f.length){const p=i_({editor:e,rules:f});i.push(...p)}}const d=Q(r,"addProseMirrorPlugins",o);if(d){const f=d();i.push(...f)}return i})}get attributes(){return jC(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=bs(this.extensions);return Object.fromEntries(t.filter(n=>!!Q(n,"addNodeView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Je(n.name,this.schema)},i=Q(n,"addNodeView",o);if(!i)return[];const s=i();if(!s)return[];const l=(a,u,c,d,f)=>{const p=ca(a,r);return s({node:a,view:u,getPos:c,decorations:d,innerDecorations:f,editor:e,extension:n,HTMLAttributes:p})};return[n.name,l]}))}dispatchTransaction(e){const{editor:t}=this;return zc([...this.extensions].reverse()).reduceRight((r,o)=>{const i={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:t,type:iu(o.name,this.schema)},s=Q(o,"dispatchTransaction",i);return s?l=>{s.call(i,{transaction:l,next:r})}:r},e)}get markViews(){const{editor:e}=this,{markExtensions:t}=bs(this.extensions);return Object.fromEntries(t.filter(n=>!!Q(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Rr(n.name,this.schema)},i=Q(n,"addMarkView",o);if(!i)return[];const s=(l,a,u)=>{const c=ca(l,r);return i()({mark:l,view:a,inline:u,editor:e,extension:n,HTMLAttributes:c,updateAttributes:d=>{x_(l,e,d)}})};return[n.name,s]}))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(t=>[t.name,t.storage])),e.forEach(t=>{var n;const r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:iu(t.name,this.schema)};t.type==="mark"&&((n=Se(Q(t,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(t.name);const o=Q(t,"onBeforeCreate",r),i=Q(t,"onCreate",r),s=Q(t,"onUpdate",r),l=Q(t,"onSelectionUpdate",r),a=Q(t,"onTransaction",r),u=Q(t,"onFocus",r),c=Q(t,"onBlur",r),d=Q(t,"onDestroy",r);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),u&&this.editor.on("focus",u),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};nf.resolve=gy;nf.sort=zc;nf.flatten=Zd;var s_={};dy(s_,{ClipboardTextSerializer:()=>YC,Commands:()=>ZC,Delete:()=>eE,Drop:()=>tE,Editable:()=>nE,FocusEvents:()=>oE,Keymap:()=>iE,Paste:()=>sE,Tabindex:()=>lE,TextDirection:()=>aE,focusEventsPluginKey:()=>rE});var $e=class XC extends xy{constructor(){super(...arguments),this.type="extension"}static create(t={}){const n=typeof t=="function"?t():t;return new XC(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}},YC=$e.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ie({key:new _e("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:o}=t,{ranges:i}=o,s=Math.min(...i.map(c=>c.$from.pos)),l=Math.max(...i.map(c=>c.$to.pos)),a=yy(n);return BC(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),ZC=$e.create({name:"commands",addCommands(){return{...wn}}}),eE=$e.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,o;const i=()=>{var s,l,a,u;if((u=(a=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,e))!=null?u:e.getMeta("y-sync$"))return;const c=$C(e.before,[e,...t]);UC(c).forEach(p=>{c.mapping.mapResult(p.oldRange.from).deletedAfter&&c.mapping.mapResult(p.oldRange.to).deletedBefore&&c.before.nodesBetween(p.oldRange.from,p.oldRange.to,(h,m)=>{const y=m+h.nodeSize-2,g=p.oldRange.from<=m&&y<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:h,from:m,to:y,newFrom:c.mapping.map(m),newTo:c.mapping.map(y),deletedRange:p.oldRange,newRange:p.newRange,partial:!g,editor:this.editor,transaction:e,combinedTransform:c})})});const f=c.mapping;c.steps.forEach((p,h)=>{var m,y;if(p instanceof Rn){const g=f.slice(h).map(p.from,-1),v=f.slice(h).map(p.to),k=f.invert().map(g,-1),S=f.invert().map(v),b=(m=c.doc.nodeAt(g-1))==null?void 0:m.marks.some(M=>M.eq(p.mark)),E=(y=c.doc.nodeAt(v))==null?void 0:y.marks.some(M=>M.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:k,to:S},newRange:{from:g,to:v},partial:!!(E||b),editor:this.editor,transaction:e,combinedTransform:c})}})};(o=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||o?setTimeout(i,0):i()}}),tE=$e.create({name:"drop",addProseMirrorPlugins(){return[new Ie({key:new _e("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),nE=$e.create({name:"editable",addProseMirrorPlugins(){return[new Ie({key:new _e("editable"),props:{editable:()=>this.editor.options.editable}})]}}),rE=new _e("focusEvents"),oE=$e.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new Ie({key:rE,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),iE=$e.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:a,doc:u}=l,{empty:c,$anchor:d}=a,{pos:f,parent:p}=d,h=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,m=h.parent.type.spec.isolating,y=d.pos-d.parentOffset,g=m&&h.parent.childCount===1?y===d.pos:ce.atStart(u).from===f;return!c||!p.type.isTextblock||p.textContent.length||!g||g&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},i={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return $c()||LC()?i:o},addProseMirrorPlugins(){return[new Ie({key:new _e("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(m=>m.getMeta("composition")))return;const r=e.some(m=>m.docChanged)&&!t.doc.eq(n.doc),o=e.some(m=>m.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:l}=t.selection,a=ce.atStart(t.doc).from,u=ce.atEnd(t.doc).to;if(i||!(s===a&&l===u)||!ef(n.doc))return;const f=n.tr,p=Jd({state:n,transaction:f}),{commands:h}=new Qd({editor:this.editor,state:p});if(h.clearNodes(),!!f.steps.length)return f}})]}}),sE=$e.create({name:"paste",addProseMirrorPlugins(){return[new Ie({key:new _e("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),lE=$e.create({name:"tabindex",addProseMirrorPlugins(){return[new Ie({key:new _e("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),aE=$e.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=bs(this.extensions);return[{types:e.filter(t=>t.name!=="text").map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{const n=t.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ie({key:new _e("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),l_=class pl{constructor(t,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,this.editor=n,this.currentNode=o}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return(t=this.actualDepth)!=null?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},t)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new pl(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new pl(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new pl(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=n.isInline,l=this.pos+r+(i?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!o&&!s&&a.depth<=this.depth)return;const u=new pl(a,this.editor,o,o||s?n:null);o&&(u.actualDepth=this.depth+1),t.push(u)}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===t)if(Object.keys(n).length>0){const i=o.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){const a=s[l];if(i[a]!==n[a])break}}else r=o;o=o.parent}return r}querySelector(t,n={}){return this.querySelectorAll(t,n,!0)[0]||null}querySelectorAll(t,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const i=Object.keys(n);return this.children.forEach(s=>{r&&o.length>0||(s.node.type.name===t&&i.every(a=>n[a]===s.node.attrs[a])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(t,n,r))))}),o}setAttribute(t){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}},a_=`.ProseMirror {
88
- position: relative;
89
- }
90
-
91
- .ProseMirror {
92
- word-wrap: break-word;
93
- white-space: pre-wrap;
94
- white-space: break-spaces;
95
- -webkit-font-variant-ligatures: none;
96
- font-variant-ligatures: none;
97
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
98
- }
99
-
100
- .ProseMirror [contenteditable="false"] {
101
- white-space: normal;
102
- }
103
-
104
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
105
- white-space: pre-wrap;
106
- }
107
-
108
- .ProseMirror pre {
109
- white-space: pre-wrap;
110
- }
111
-
112
- img.ProseMirror-separator {
113
- display: inline !important;
114
- border: none !important;
115
- margin: 0 !important;
116
- width: 0 !important;
117
- height: 0 !important;
118
- }
119
-
120
- .ProseMirror-gapcursor {
121
- display: none;
122
- pointer-events: none;
123
- position: absolute;
124
- margin: 0;
125
- }
126
-
127
- .ProseMirror-gapcursor:after {
128
- content: "";
129
- display: block;
130
- position: absolute;
131
- top: -2px;
132
- width: 20px;
133
- border-top: 1px solid black;
134
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
135
- }
136
-
137
- @keyframes ProseMirror-cursor-blink {
138
- to {
139
- visibility: hidden;
140
- }
141
- }
142
-
143
- .ProseMirror-hideselection *::selection {
144
- background: transparent;
145
- }
146
-
147
- .ProseMirror-hideselection *::-moz-selection {
148
- background: transparent;
149
- }
150
-
151
- .ProseMirror-hideselection * {
152
- caret-color: transparent;
153
- }
154
-
155
- .ProseMirror-focused .ProseMirror-gapcursor {
156
- display: block;
157
- }`;function u_(e,t,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const o=document.createElement("style");return t&&o.setAttribute("nonce",t),o.setAttribute("data-tiptap-style",""),o.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(o),o}var c_=class extends QL{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:RL,createMappablePosition:TL},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:o,moved:i})=>this.options.onDrop(r,o,i)),this.on("paste",({event:r,slice:o})=>this.options.onPaste(r,o)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=IC(t,this.options.autofocus);this.editorState=Zi.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e!=null&&e.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=u_(a_,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const n=zC(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(o=>{const i=typeof o=="string"?`${o}$`:o.key;n=n.filter(s=>!s.key.startsWith(i))}),t.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;const r=[...this.options.enableCoreExtensions?[nE,YC.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),ZC,oE,iE,lE,tE,sE,eE,aE.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new nf(r,this)}createCommandManager(){this.commandManager=new Qd({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=fm(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),e=fm(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),o=n?this.extensionManager.dispatchTransaction(r):r;this.editorView=new OC(e,{...t,attributes:{role:"textbox",...t==null?void 0:t.attributes},dispatchTransaction:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.prependClass(),this.injectCSS();const s=this.view.dom;s.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var c;return(c=this.capturedTransaction)==null?void 0:c.step(u)});return}const{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),o=n.includes(e),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!o)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const s=n.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),l=s==null?void 0:s.getMeta("focus"),a=s==null?void 0:s.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:s}),a&&this.emit("blur",{editor:this,event:a.event,transaction:s}),!(e.getMeta("preventUpdate")||!n.some(u=>u.docChanged)||i.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return HC(this.state,e)}isActive(e,t){const n=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return CL(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return my(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
158
-
159
- `,textSerializers:n={}}=e||{};return VC(this.state.doc,{blockSeparator:t,textSerializers:{...yy(this.schema),...n}})}get isEmpty(){return ef(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new l_(t,this)}get $doc(){return this.$pos(0)}};function Cs(e){return new tf({find:e.find,handler:({state:t,range:n,match:r})=>{const o=Se(e.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:i}=t,s=r[r.length-1],l=r[0];if(s){const a=l.search(/\S/),u=n.from+l.indexOf(s),c=u+s.length;if(vy(n.from,n.to,t.doc).filter(p=>p.mark.type.excluded.find(m=>m===e.type&&m!==p.mark.type)).filter(p=>p.to>u).length)return null;c<n.to&&i.delete(c,n.to),u>n.from&&i.delete(n.from+a,u);const f=n.from+a+s.length;i.addMark(n.from+a,f,e.type.create(o||{})),i.removeStoredMark(e.type)}},undoable:e.undoable})}function d_(e){return new tf({find:e.find,handler:({state:t,range:n,match:r})=>{const o=Se(e.getAttributes,void 0,r)||{},{tr:i}=t,s=n.from;let l=n.to;const a=e.type.create(o);if(r[1]){const u=r[0].lastIndexOf(r[1]);let c=s+u;c>l?c=l:l=c+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,s+r[0].length-1),i.replaceWith(c,l,a)}else if(r[0]){const u=e.type.isInline?s:s-1;i.insert(u,e.type.create(o)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()},undoable:e.undoable})}function hm(e){return new tf({find:e.find,handler:({state:t,range:n,match:r})=>{const o=t.doc.resolve(n.from),i=Se(e.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)},undoable:e.undoable})}function Es(e){return new tf({find:e.find,handler:({state:t,range:n,match:r,chain:o})=>{const i=Se(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),u=a&&Kg(a,e.type,i);if(!u)return null;if(s.wrap(a,u),e.keepMarks&&e.editor){const{selection:d,storedMarks:f}=t,{splittableMarks:p}=e.editor.extensionManager,h=f||d.$to.parentOffset&&d.$from.marks();if(h){const m=h.filter(y=>p.includes(y.type.name));s.ensureMarks(m)}}if(e.keepAttributes){const d=e.type.name==="bulletList"||e.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(d,i).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&To(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&s.join(n.from-1)},undoable:e.undoable})}function f_(e,t){const{selection:n}=e,{$from:r}=n;if(n instanceof ee){const i=r.index();return r.parent.canReplaceWith(i,i+1,t)}let o=r.depth;for(;o>=0;){const i=r.index(o);if(r.node(o).contentMatchAt(i).matchType(t))return!0;o-=1}return!1}var p_={};dy(p_,{createAtomBlockMarkdownSpec:()=>h_,createBlockMarkdownSpec:()=>m_,createInlineMarkdownSpec:()=>v_,parseAttributes:()=>wy,parseIndentedBlocks:()=>mm,renderNestedMarkdownContent:()=>Sy,serializeAttributes:()=>ky});function wy(e){if(!(e!=null&&e.trim()))return{};const t={},n=[],r=e.replace(/["']([^"']*)["']/g,u=>(n.push(u),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const u=o.map(c=>c.trim().slice(1));t.class=u.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(t.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(s)).forEach(([,u,c])=>{var d;const f=parseInt(((d=c.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),p=n[f];p&&(t[u]=p.slice(1,-1))});const a=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(c=>{c.match(/^[a-zA-Z][\w-]*$/)&&(t[c]=!0)}),t}function ky(e){if(!e||Object.keys(e).length===0)return"";const t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(r=>t.push(`.${r}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?t.push(n):r!==!1&&r!=null&&t.push(`${n}="${String(r)}"`))}),t.join(" ")}function h_(e){const{nodeName:t,name:n,parseAttributes:r=wy,serializeAttributes:o=ky,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=e,a=n||t,u=c=>{if(!l)return c;const d={};return l.forEach(f=>{f in c&&(d[f]=c[f])}),d};return{parseMarkdown:(c,d)=>{const f={...i,...c.attributes};return d.createNode(t,f,[])},markdownTokenizer:{name:t,level:"block",start(c){var d;const f=new RegExp(`^:::${a}(?:\\s|$)`,"m"),p=(d=c.match(f))==null?void 0:d.index;return p!==void 0?p:-1},tokenize(c,d,f){const p=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),h=c.match(p);if(!h)return;const m=h[1]||"",y=r(m);if(!s.find(v=>!(v in y)))return{type:t,raw:h[0],attributes:y}}},renderMarkdown:c=>{const d=u(c.attrs||{}),f=o(d),p=f?` {${f}}`:"";return`:::${a}${p} :::`}}}function m_(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=wy,serializeAttributes:i=ky,defaultAttributes:s={},content:l="block",allowedAttributes:a}=e,u=n||t,c=d=>{if(!a)return d;const f={};return a.forEach(p=>{p in d&&(f[p]=d[p])}),f};return{parseMarkdown:(d,f)=>{let p;if(r){const m=r(d);p=typeof m=="string"?[{type:"text",text:m}]:m}else l==="block"?p=f.parseChildren(d.tokens||[]):p=f.parseInline(d.tokens||[]);const h={...s,...d.attributes};return f.createNode(t,h,p)},markdownTokenizer:{name:t,level:"block",start(d){var f;const p=new RegExp(`^:::${u}`,"m"),h=(f=d.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(d,f,p){var h;const m=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=d.match(m);if(!y)return;const[g,v=""]=y,k=o(v);let S=1;const b=g.length;let E="";const M=/^:::([\w-]*)(\s.*)?/gm,R=d.slice(b);for(M.lastIndex=0;;){const D=M.exec(R);if(D===null)break;const I=D.index,J=D[1];if(!((h=D[2])!=null&&h.endsWith(":::"))){if(J)S+=1;else if(S-=1,S===0){const ne=R.slice(0,I);E=ne.trim();const re=d.slice(0,b+I+D[0].length);let U=[];if(E)if(l==="block")for(U=p.blockTokens(ne),U.forEach(ie=>{ie.text&&(!ie.tokens||ie.tokens.length===0)&&(ie.tokens=p.inlineTokens(ie.text))});U.length>0;){const ie=U[U.length-1];if(ie.type==="paragraph"&&(!ie.text||ie.text.trim()===""))U.pop();else break}else U=p.inlineTokens(E);return{type:t,raw:re,attributes:k,content:E,tokens:U}}}}}},renderMarkdown:(d,f)=>{const p=c(d.attrs||{}),h=i(p),m=h?` {${h}}`:"",y=f.renderChildren(d.content||[],`
160
-
161
- `);return`:::${u}${m}
162
-
163
- ${y}
164
-
165
- :::`}}}function g_(e){if(!e.trim())return{};const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(e);for(;r!==null;){const[,o,i,s]=r;t[o]=i||s,r=n.exec(e)}return t}function y_(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t}="${n}"`).join(" ")}function v_(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=g_,serializeAttributes:i=y_,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=e,u=n||t,c=f=>{if(!a)return f;const p={};return a.forEach(h=>{const m=typeof h=="string"?h:h.name,y=typeof h=="string"?void 0:h.skipIfDefault;if(m in f){const g=f[m];if(y!==void 0&&g===y)return;p[m]=g}}),p},d=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,p)=>{const h={...s,...f.attributes};if(l)return p.createNode(t,h);const m=r?r(f):f.content||"";return m?p.createNode(t,h,[p.createTextNode(m)]):p.createNode(t,h,[])},markdownTokenizer:{name:t,level:"inline",start(f){const p=l?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),h=f.match(p),m=h==null?void 0:h.index;return m!==void 0?m:-1},tokenize(f,p,h){const m=l?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),y=f.match(m);if(!y)return;let g="",v="";if(l){const[,S]=y;v=S}else{const[,S,b]=y;v=S,g=b||""}const k=o(v.trim());return{type:t,raw:y[0],content:g.trim(),attributes:k}}},renderMarkdown:f=>{let p="";r?p=r(f):f.content&&f.content.length>0&&(p=f.content.filter(g=>g.type==="text").map(g=>g.text).join(""));const h=c(f.attrs||{}),m=i(h),y=m?` ${m}`:"";return l?`[${u}${y}]`:`[${u}${y}]${p}[/${u}]`}}}function mm(e,t,n){var r,o,i,s;const l=e.split(`
166
- `),a=[];let u="",c=0;const d=t.baseIndentSize||2;for(;c<l.length;){const f=l[c],p=f.match(t.itemPattern);if(!p){if(a.length>0)break;if(f.trim()===""){c+=1,u=`${u}${f}
167
- `;continue}else return}const h=t.extractItemData(p),{indentLevel:m,mainContent:y}=h;u=`${u}${f}
168
- `;const g=[y];for(c+=1;c<l.length;){const b=l[c];if(b.trim()===""){const M=l.slice(c+1).findIndex(I=>I.trim()!=="");if(M===-1)break;if((((o=(r=l[c+1+M].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:o.length)||0)>m){g.push(b),u=`${u}${b}
169
- `,c+=1;continue}else break}if((((s=(i=b.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>m)g.push(b),u=`${u}${b}
170
- `,c+=1;else break}let v;const k=g.slice(1);if(k.length>0){const b=k.map(E=>E.slice(m+d)).join(`
171
- `);b.trim()&&(t.customNestedParser?v=t.customNestedParser(b):v=n.blockTokens(b))}const S=t.createToken(h,v);a.push(S)}if(a.length!==0)return{items:a,raw:u}}function Sy(e,t,n,r){if(!e||!Array.isArray(e.content))return"";const o=typeof n=="function"?n(r):n,[i,...s]=e.content,l=t.renderChildren([i]),a=[`${o}${l}`];return s&&s.length>0&&s.forEach(u=>{const c=t.renderChildren([u]);if(c){const d=c.split(`
172
- `).map(f=>f?t.indent(f):"").join(`
173
- `);a.push(d)}}),a.join(`
174
- `)}function x_(e,t,n={}){const{state:r}=t,{doc:o,tr:i}=r,s=e;o.descendants((l,a)=>{const u=i.mapping.map(a),c=i.mapping.map(a)+l.nodeSize;let d=null;if(l.marks.forEach(p=>{if(p!==s)return!1;d=p}),!d)return;let f=!1;if(Object.keys(n).forEach(p=>{n[p]!==d.attrs[p]&&(f=!0)}),f){const p=e.type.create({...e.attrs,...n});i.removeMark(u,c,e.type),i.addMark(u,c,p)}}),i.docChanged&&t.view.dispatch(i)}var Zt=class uE extends xy{constructor(){super(...arguments),this.type="node"}static create(t={}){const n=typeof t=="function"?t():t;return new uE(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}};function ii(e){return new t_({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{const i=Se(e.getAttributes,void 0,r,o);if(i===!1||i===null)return null;const{tr:s}=t,l=r[r.length-1],a=r[0];let u=n.to;if(l){const c=a.search(/\S/),d=n.from+a.indexOf(l),f=d+l.length;if(vy(n.from,n.to,t.doc).filter(h=>h.mark.type.excluded.find(y=>y===e.type&&y!==h.mark.type)).filter(h=>h.to>d).length)return null;f<n.to&&s.delete(f,n.to),d>n.from&&s.delete(n.from+c,d),u=n.from+c+l.length,s.addMark(n.from+c,u,e.type.create(i||{})),s.removeStoredMark(e.type)}}})}const{getOwnPropertyNames:w_,getOwnPropertySymbols:k_}=Object,{hasOwnProperty:S_}=Object.prototype;function bp(e,t){return function(r,o,i){return e(r,o,i)&&t(r,o,i)}}function uu(e){return function(n,r,o){if(!n||!r||typeof n!="object"||typeof r!="object")return e(n,r,o);const{cache:i}=o,s=i.get(n),l=i.get(r);if(s&&l)return s===r&&l===n;i.set(n,r),i.set(r,n);const a=e(n,r,o);return i.delete(n),i.delete(r),a}}function b_(e){return e!=null?e[Symbol.toStringTag]:void 0}function uw(e){return w_(e).concat(k_(e))}const C_=Object.hasOwn||((e,t)=>S_.call(e,t));function gi(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const E_="__v",M_="__o",R_="_owner",{getOwnPropertyDescriptor:cw,keys:dw}=Object;function T_(e,t){return e.byteLength===t.byteLength&&jc(new Uint8Array(e),new Uint8Array(t))}function N_(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function A_(e,t){return e.byteLength===t.byteLength&&jc(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function O_(e,t){return gi(e.getTime(),t.getTime())}function P_(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function I_(e,t){return e===t}function fw(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const o=new Array(r),i=e.entries();let s,l,a=0;for(;(s=i.next())&&!s.done;){const u=t.entries();let c=!1,d=0;for(;(l=u.next())&&!l.done;){if(o[d]){d++;continue}const f=s.value,p=l.value;if(n.equals(f[0],p[0],a,d,e,t,n)&&n.equals(f[1],p[1],f[0],p[0],e,t,n)){c=o[d]=!0;break}d++}if(!c)return!1;a++}return!0}const D_=gi;function L_(e,t,n){const r=dw(e);let o=r.length;if(dw(t).length!==o)return!1;for(;o-- >0;)if(!cE(e,t,n,r[o]))return!1;return!0}function Ys(e,t,n){const r=uw(e);let o=r.length;if(uw(t).length!==o)return!1;let i,s,l;for(;o-- >0;)if(i=r[o],!cE(e,t,n,i)||(s=cw(e,i),l=cw(t,i),(s||l)&&(!s||!l||s.configurable!==l.configurable||s.enumerable!==l.enumerable||s.writable!==l.writable)))return!1;return!0}function __(e,t){return gi(e.valueOf(),t.valueOf())}function $_(e,t){return e.source===t.source&&e.flags===t.flags}function pw(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const o=new Array(r),i=e.values();let s,l;for(;(s=i.next())&&!s.done;){const a=t.values();let u=!1,c=0;for(;(l=a.next())&&!l.done;){if(!o[c]&&n.equals(s.value,l.value,s.value,l.value,e,t,n)){u=o[c]=!0;break}c++}if(!u)return!1}return!0}function jc(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function z_(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function cE(e,t,n,r){return(r===R_||r===M_||r===E_)&&(e.$$typeof||t.$$typeof)?!0:C_(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const j_="[object ArrayBuffer]",F_="[object Arguments]",B_="[object Boolean]",V_="[object DataView]",H_="[object Date]",U_="[object Error]",W_="[object Map]",G_="[object Number]",q_="[object Object]",K_="[object RegExp]",J_="[object Set]",Q_="[object String]",X_={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Y_="[object URL]",Z_=Object.prototype.toString;function e$({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:o,areFunctionsEqual:i,areMapsEqual:s,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:u,areRegExpsEqual:c,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:h}){return function(y,g,v){if(y===g)return!0;if(y==null||g==null)return!1;const k=typeof y;if(k!==typeof g)return!1;if(k!=="object")return k==="number"?l(y,g,v):k==="function"?i(y,g,v):!1;const S=y.constructor;if(S!==g.constructor)return!1;if(S===Object)return a(y,g,v);if(Array.isArray(y))return t(y,g,v);if(S===Date)return r(y,g,v);if(S===RegExp)return c(y,g,v);if(S===Map)return s(y,g,v);if(S===Set)return d(y,g,v);const b=Z_.call(y);if(b===H_)return r(y,g,v);if(b===K_)return c(y,g,v);if(b===W_)return s(y,g,v);if(b===J_)return d(y,g,v);if(b===q_)return typeof y.then!="function"&&typeof g.then!="function"&&a(y,g,v);if(b===Y_)return p(y,g,v);if(b===U_)return o(y,g,v);if(b===F_)return a(y,g,v);if(X_[b])return f(y,g,v);if(b===j_)return e(y,g,v);if(b===V_)return n(y,g,v);if(b===B_||b===G_||b===Q_)return u(y,g,v);if(h){let E=h[b];if(!E){const M=b_(y);M&&(E=h[M])}if(E)return E(y,g,v)}return!1}}function t$({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:T_,areArraysEqual:n?Ys:N_,areDataViewsEqual:A_,areDatesEqual:O_,areErrorsEqual:P_,areFunctionsEqual:I_,areMapsEqual:n?bp(fw,Ys):fw,areNumbersEqual:D_,areObjectsEqual:n?Ys:L_,arePrimitiveWrappersEqual:__,areRegExpsEqual:$_,areSetsEqual:n?bp(pw,Ys):pw,areTypedArraysEqual:n?bp(jc,Ys):jc,areUrlsEqual:z_,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const o=uu(r.areArraysEqual),i=uu(r.areMapsEqual),s=uu(r.areObjectsEqual),l=uu(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:o,areMapsEqual:i,areObjectsEqual:s,areSetsEqual:l})}return r}function n$(e){return function(t,n,r,o,i,s,l){return e(t,n,l)}}function r$({circular:e,comparator:t,createState:n,equals:r,strict:o}){if(n)return function(l,a){const{cache:u=e?new WeakMap:void 0,meta:c}=n();return t(l,a,{cache:u,equals:r,meta:c,strict:o})};if(e)return function(l,a){return t(l,a,{cache:new WeakMap,equals:r,meta:void 0,strict:o})};const i={cache:void 0,equals:r,meta:void 0,strict:o};return function(l,a){return t(l,a,i)}}const o$=Ao();Ao({strict:!0});Ao({circular:!0});Ao({circular:!0,strict:!0});Ao({createInternalComparator:()=>gi});Ao({strict:!0,createInternalComparator:()=>gi});Ao({circular:!0,createInternalComparator:()=>gi});Ao({circular:!0,createInternalComparator:()=>gi,strict:!0});function Ao(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:o=!1}=e,i=t$(e),s=e$(i),l=n?n(s):n$(s);return r$({circular:t,comparator:s,createState:r,equals:l,strict:o})}var dE={exports:{}},fE={};/**
175
- * @license React
176
- * use-sync-external-store-shim/with-selector.production.js
177
- *
178
- * Copyright (c) Meta Platforms, Inc. and affiliates.
179
- *
180
- * This source code is licensed under the MIT license found in the
181
- * LICENSE file in the root directory of this source tree.
182
- */var rf=x,i$=Wg;function s$(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var l$=typeof Object.is=="function"?Object.is:s$,a$=i$.useSyncExternalStore,u$=rf.useRef,c$=rf.useEffect,d$=rf.useMemo,f$=rf.useDebugValue;fE.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=u$(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=d$(function(){function a(p){if(!u){if(u=!0,c=p,p=r(p),o!==void 0&&s.hasValue){var h=s.value;if(o(h,p))return d=h}return d=p}if(h=d,l$(c,p))return h;var m=r(p);return o!==void 0&&o(h,m)?(c=p,h):(c=p,d=m)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return a(t())},f===null?void 0:function(){return a(f())}]},[t,n,r,o]);var l=a$(e,i[0],i[1]);return c$(function(){s.hasValue=!0,s.value=l},[l]),f$(l),l};dE.exports=fE;var p$=dE.exports;const pE=["top","right","bottom","left"],hw=["start","end"],mw=pE.reduce((e,t)=>e.concat(t,t+"-"+hw[0],t+"-"+hw[1]),[]),Xn=Math.min,bt=Math.max,Fc=Math.round,qn=e=>({x:e,y:e}),h$={left:"right",right:"left",bottom:"top",top:"bottom"},m$={start:"end",end:"start"};function gm(e,t,n){return bt(e,Xn(t,n))}function Tr(e,t){return typeof e=="function"?e(t):e}function mn(e){return e.split("-")[0]}function An(e){return e.split("-")[1]}function hE(e){return e==="x"?"y":"x"}function by(e){return e==="y"?"height":"width"}const g$=new Set(["top","bottom"]);function Un(e){return g$.has(mn(e))?"y":"x"}function Cy(e){return hE(Un(e))}function mE(e,t,n){n===void 0&&(n=!1);const r=An(e),o=Cy(e),i=by(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Vc(s)),[s,Vc(s)]}function y$(e){const t=Vc(e);return[Bc(e),t,Bc(t)]}function Bc(e){return e.replace(/start|end/g,t=>m$[t])}const gw=["left","right"],yw=["right","left"],v$=["top","bottom"],x$=["bottom","top"];function w$(e,t,n){switch(e){case"top":case"bottom":return n?t?yw:gw:t?gw:yw;case"left":case"right":return t?v$:x$;default:return[]}}function k$(e,t,n,r){const o=An(e);let i=w$(mn(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Bc)))),i}function Vc(e){return e.replace(/left|right|bottom|top/g,t=>h$[t])}function S$(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ey(e){return typeof e!="number"?S$(e):{top:e,right:e,bottom:e,left:e}}function Ms(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function vw(e,t,n){let{reference:r,floating:o}=e;const i=Un(t),s=Cy(t),l=by(s),a=mn(t),u=i==="y",c=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2;let p;switch(a){case"top":p={x:c,y:r.y-o.height};break;case"bottom":p={x:c,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(An(t)){case"start":p[s]-=f*(n&&u?-1:1);break;case"end":p[s]+=f*(n&&u?-1:1);break}return p}async function b$(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:l,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=Tr(t,e),h=Ey(p),y=l[f?d==="floating"?"reference":"floating":d],g=Ms(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:c,strategy:a})),v=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),S=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},b=Ms(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:k,strategy:a}):v);return{top:(g.top-b.top+h.top)/S.y,bottom:(b.bottom-g.bottom+h.bottom)/S.y,left:(g.left-b.left+h.left)/S.x,right:(b.right-g.right+h.right)/S.x}}const C$=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:d}=vw(u,r,a),f=r,p={},h=0;for(let y=0;y<l.length;y++){var m;const{name:g,fn:v}=l[y],{x:k,y:S,data:b,reset:E}=await v({x:c,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:u,platform:{...s,detectOverflow:(m=s.detectOverflow)!=null?m:b$},elements:{reference:e,floating:t}});c=k??c,d=S??d,p={...p,[g]:{...p[g],...b}},E&&h<=50&&(h++,typeof E=="object"&&(E.placement&&(f=E.placement),E.rects&&(u=E.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):E.rects),{x:c,y:d}=vw(u,f,a)),y=-1)}return{x:c,y:d,placement:f,strategy:o,middlewareData:p}},E$=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:l,middlewareData:a}=t,{element:u,padding:c=0}=Tr(e,t)||{};if(u==null)return{};const d=Ey(c),f={x:n,y:r},p=Cy(o),h=by(p),m=await s.getDimensions(u),y=p==="y",g=y?"top":"left",v=y?"bottom":"right",k=y?"clientHeight":"clientWidth",S=i.reference[h]+i.reference[p]-f[p]-i.floating[h],b=f[p]-i.reference[p],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let M=E?E[k]:0;(!M||!await(s.isElement==null?void 0:s.isElement(E)))&&(M=l.floating[k]||i.floating[h]);const R=S/2-b/2,D=M/2-m[h]/2-1,I=Xn(d[g],D),J=Xn(d[v],D),ne=I,re=M-m[h]-J,U=M/2-m[h]/2+R,ie=gm(ne,U,re),ue=!a.arrow&&An(o)!=null&&U!==ie&&i.reference[h]/2-(U<ne?I:J)-m[h]/2<0,fe=ue?U<ne?U-ne:U-re:0;return{[p]:f[p]+fe,data:{[p]:ie,centerOffset:U-ie-fe,...ue&&{alignmentOffset:fe}},reset:ue}}});function M$(e,t,n){return(e?[...n.filter(o=>An(o)===e),...n.filter(o=>An(o)!==e)]:n.filter(o=>mn(o)===o)).filter(o=>e?An(o)===e||(t?Bc(o)!==o:!1):!0)}const R$=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,o;const{rects:i,middlewareData:s,placement:l,platform:a,elements:u}=t,{crossAxis:c=!1,alignment:d,allowedPlacements:f=mw,autoAlignment:p=!0,...h}=Tr(e,t),m=d!==void 0||f===mw?M$(d||null,p,f):f,y=await a.detectOverflow(t,h),g=((n=s.autoPlacement)==null?void 0:n.index)||0,v=m[g];if(v==null)return{};const k=mE(v,i,await(a.isRTL==null?void 0:a.isRTL(u.floating)));if(l!==v)return{reset:{placement:m[0]}};const S=[y[mn(v)],y[k[0]],y[k[1]]],b=[...((r=s.autoPlacement)==null?void 0:r.overflows)||[],{placement:v,overflows:S}],E=m[g+1];if(E)return{data:{index:g+1,overflows:b},reset:{placement:E}};const M=b.map(I=>{const J=An(I.placement);return[I.placement,J&&c?I.overflows.slice(0,2).reduce((ne,re)=>ne+re,0):I.overflows[0],I.overflows]}).sort((I,J)=>I[1]-J[1]),D=((o=M.filter(I=>I[2].slice(0,An(I[0])?2:3).every(J=>J<=0))[0])==null?void 0:o[0])||M[0][0];return D!==l?{data:{index:g+1,overflows:b},reset:{placement:D}}:{}}}},T$=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:l,platform:a,elements:u}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...y}=Tr(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=mn(o),v=Un(l),k=mn(l)===l,S=await(a.isRTL==null?void 0:a.isRTL(u.floating)),b=f||(k||!m?[Vc(l)]:y$(l)),E=h!=="none";!f&&E&&b.push(...k$(l,m,h,S));const M=[l,...b],R=await a.detectOverflow(t,y),D=[];let I=((r=i.flip)==null?void 0:r.overflows)||[];if(c&&D.push(R[g]),d){const U=mE(o,s,S);D.push(R[U[0]],R[U[1]])}if(I=[...I,{placement:o,overflows:D}],!D.every(U=>U<=0)){var J,ne;const U=(((J=i.flip)==null?void 0:J.index)||0)+1,ie=M[U];if(ie&&(!(d==="alignment"?v!==Un(ie):!1)||I.every(N=>Un(N.placement)===v?N.overflows[0]>0:!0)))return{data:{index:U,overflows:I},reset:{placement:ie}};let ue=(ne=I.filter(fe=>fe.overflows[0]<=0).sort((fe,N)=>fe.overflows[1]-N.overflows[1])[0])==null?void 0:ne.placement;if(!ue)switch(p){case"bestFit":{var re;const fe=(re=I.filter(N=>{if(E){const j=Un(N.placement);return j===v||j==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(j=>j>0).reduce((j,te)=>j+te,0)]).sort((N,j)=>N[1]-j[1])[0])==null?void 0:re[0];fe&&(ue=fe);break}case"initialPlacement":ue=l;break}if(o!==ue)return{reset:{placement:ue}}}return{}}}};function xw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ww(e){return pE.some(t=>e[t]>=0)}const N$=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=Tr(e,t);switch(o){case"referenceHidden":{const s=await r.detectOverflow(t,{...i,elementContext:"reference"}),l=xw(s,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:ww(l)}}}case"escaped":{const s=await r.detectOverflow(t,{...i,altBoundary:!0}),l=xw(s,n.floating);return{data:{escapedOffsets:l,escaped:ww(l)}}}default:return{}}}}};function gE(e){const t=Xn(...e.map(i=>i.left)),n=Xn(...e.map(i=>i.top)),r=bt(...e.map(i=>i.right)),o=bt(...e.map(i=>i.bottom));return{x:t,y:n,width:r-t,height:o-n}}function A$(e){const t=e.slice().sort((o,i)=>o.y-i.y),n=[];let r=null;for(let o=0;o<t.length;o++){const i=t[o];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(o=>Ms(gE(o)))}const O$=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:s}=t,{padding:l=2,x:a,y:u}=Tr(e,t),c=Array.from(await(i.getClientRects==null?void 0:i.getClientRects(r.reference))||[]),d=A$(c),f=Ms(gE(c)),p=Ey(l);function h(){if(d.length===2&&d[0].left>d[1].right&&a!=null&&u!=null)return d.find(y=>a>y.left-p.left&&a<y.right+p.right&&u>y.top-p.top&&u<y.bottom+p.bottom)||f;if(d.length>=2){if(Un(n)==="y"){const I=d[0],J=d[d.length-1],ne=mn(n)==="top",re=I.top,U=J.bottom,ie=ne?I.left:J.left,ue=ne?I.right:J.right,fe=ue-ie,N=U-re;return{top:re,bottom:U,left:ie,right:ue,width:fe,height:N,x:ie,y:re}}const y=mn(n)==="left",g=bt(...d.map(I=>I.right)),v=Xn(...d.map(I=>I.left)),k=d.filter(I=>y?I.left===v:I.right===g),S=k[0].top,b=k[k.length-1].bottom,E=v,M=g,R=M-E,D=b-S;return{top:S,bottom:b,left:E,right:M,width:R,height:D,x:E,y:S}}return f}const m=await i.getElementRects({reference:{getBoundingClientRect:h},floating:r.floating,strategy:s});return o.reference.x!==m.reference.x||o.reference.y!==m.reference.y||o.reference.width!==m.reference.width||o.reference.height!==m.reference.height?{reset:{rects:m}}:{}}}},P$=new Set(["left","top"]);async function I$(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=mn(n),l=An(n),a=Un(n)==="y",u=P$.has(s)?-1:1,c=i&&a?-1:1,d=Tr(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof h=="number"&&(p=l==="end"?h*-1:h),a?{x:p*c,y:f*u}:{x:f*u,y:p*c}}const D$=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:l}=t,a=await I$(t,e);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:i+a.y,data:{...a,placement:s}}}}},L$=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:s=!0,crossAxis:l=!1,limiter:a={fn:g=>{let{x:v,y:k}=g;return{x:v,y:k}}},...u}=Tr(e,t),c={x:n,y:r},d=await i.detectOverflow(t,u),f=Un(mn(o)),p=hE(f);let h=c[p],m=c[f];if(s){const g=p==="y"?"top":"left",v=p==="y"?"bottom":"right",k=h+d[g],S=h-d[v];h=gm(k,h,S)}if(l){const g=f==="y"?"top":"left",v=f==="y"?"bottom":"right",k=m+d[g],S=m-d[v];m=gm(k,m,S)}const y=a.fn({...t,[p]:h,[f]:m});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[p]:s,[f]:l}}}}}},_$=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:l}=t,{apply:a=()=>{},...u}=Tr(e,t),c=await s.detectOverflow(t,u),d=mn(o),f=An(o),p=Un(o)==="y",{width:h,height:m}=i.floating;let y,g;d==="top"||d==="bottom"?(y=d,g=f===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(g=d,y=f==="end"?"top":"bottom");const v=m-c.top-c.bottom,k=h-c.left-c.right,S=Xn(m-c[y],v),b=Xn(h-c[g],k),E=!t.middlewareData.shift;let M=S,R=b;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(R=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(M=v),E&&!f){const I=bt(c.left,0),J=bt(c.right,0),ne=bt(c.top,0),re=bt(c.bottom,0);p?R=h-2*(I!==0||J!==0?I+J:bt(c.left,c.right)):M=m-2*(ne!==0||re!==0?ne+re:bt(c.top,c.bottom))}await a({...t,availableWidth:R,availableHeight:M});const D=await s.getDimensions(l.floating);return h!==D.width||m!==D.height?{reset:{rects:!0}}:{}}}};function of(){return typeof window<"u"}function Is(e){return yE(e)?(e.nodeName||"").toLowerCase():"#document"}function Kt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Nr(e){var t;return(t=(yE(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function yE(e){return of()?e instanceof Node||e instanceof Kt(e).Node:!1}function In(e){return of()?e instanceof Element||e instanceof Kt(e).Element:!1}function Yn(e){return of()?e instanceof HTMLElement||e instanceof Kt(e).HTMLElement:!1}function kw(e){return!of()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Kt(e).ShadowRoot}const $$=new Set(["inline","contents"]);function Ma(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Dn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!$$.has(o)}const z$=new Set(["table","td","th"]);function j$(e){return z$.has(Is(e))}const F$=[":popover-open",":modal"];function sf(e){return F$.some(t=>{try{return e.matches(t)}catch{return!1}})}const B$=["transform","translate","scale","rotate","perspective"],V$=["transform","translate","scale","rotate","perspective","filter"],H$=["paint","layout","strict","content"];function My(e){const t=Ry(),n=In(e)?Dn(e):e;return B$.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||V$.some(r=>(n.willChange||"").includes(r))||H$.some(r=>(n.contain||"").includes(r))}function U$(e){let t=ko(e);for(;Yn(t)&&!Rs(t);){if(My(t))return t;if(sf(t))return null;t=ko(t)}return null}function Ry(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const W$=new Set(["html","body","#document"]);function Rs(e){return W$.has(Is(e))}function Dn(e){return Kt(e).getComputedStyle(e)}function lf(e){return In(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ko(e){if(Is(e)==="html")return e;const t=e.assignedSlot||e.parentNode||kw(e)&&e.host||Nr(e);return kw(t)?t.host:t}function vE(e){const t=ko(e);return Rs(t)?e.ownerDocument?e.ownerDocument.body:e.body:Yn(t)&&Ma(t)?t:vE(t)}function xE(e,t,n){var r;t===void 0&&(t=[]);const o=vE(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Kt(o);return i?(ym(s),t.concat(s,s.visualViewport||[],Ma(o)?o:[],[])):t.concat(o,xE(o,[]))}function ym(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wE(e){const t=Dn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Yn(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,l=Fc(n)!==i||Fc(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function kE(e){return In(e)?e:e.contextElement}function us(e){const t=kE(e);if(!Yn(t))return qn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=wE(t);let s=(i?Fc(n.width):n.width)/r,l=(i?Fc(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const G$=qn(0);function SE(e){const t=Kt(e);return!Ry()||!t.visualViewport?G$:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function q$(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Kt(e)?!1:t}function da(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=kE(e);let s=qn(1);t&&(r?In(r)&&(s=us(r)):s=us(e));const l=q$(i,n,r)?SE(i):qn(0);let a=(o.left+l.x)/s.x,u=(o.top+l.y)/s.y,c=o.width/s.x,d=o.height/s.y;if(i){const f=Kt(i),p=r&&In(r)?Kt(r):r;let h=f,m=ym(h);for(;m&&r&&p!==h;){const y=us(m),g=m.getBoundingClientRect(),v=Dn(m),k=g.left+(m.clientLeft+parseFloat(v.paddingLeft))*y.x,S=g.top+(m.clientTop+parseFloat(v.paddingTop))*y.y;a*=y.x,u*=y.y,c*=y.x,d*=y.y,a+=k,u+=S,h=Kt(m),m=ym(h)}}return Ms({width:c,height:d,x:a,y:u})}function af(e,t){const n=lf(e).scrollLeft;return t?t.left+n:da(Nr(e)).left+n}function bE(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-af(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function K$(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Nr(r),l=t?sf(t.floating):!1;if(r===s||l&&i)return n;let a={scrollLeft:0,scrollTop:0},u=qn(1);const c=qn(0),d=Yn(r);if((d||!d&&!i)&&((Is(r)!=="body"||Ma(s))&&(a=lf(r)),Yn(r))){const p=da(r);u=us(r),c.x=p.x+r.clientLeft,c.y=p.y+r.clientTop}const f=s&&!d&&!i?bE(s,a):qn(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+c.x+f.x,y:n.y*u.y-a.scrollTop*u.y+c.y+f.y}}function J$(e){return Array.from(e.getClientRects())}function Q$(e){const t=Nr(e),n=lf(e),r=e.ownerDocument.body,o=bt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=bt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+af(e);const l=-n.scrollTop;return Dn(r).direction==="rtl"&&(s+=bt(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:l}}const Sw=25;function X$(e,t){const n=Kt(e),r=Nr(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,l=0,a=0;if(o){i=o.width,s=o.height;const c=Ry();(!c||c&&t==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}const u=af(r);if(u<=0){const c=r.ownerDocument,d=c.body,f=getComputedStyle(d),p=c.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,h=Math.abs(r.clientWidth-d.clientWidth-p);h<=Sw&&(i-=h)}else u<=Sw&&(i+=u);return{width:i,height:s,x:l,y:a}}const Y$=new Set(["absolute","fixed"]);function Z$(e,t){const n=da(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Yn(e)?us(e):qn(1),s=e.clientWidth*i.x,l=e.clientHeight*i.y,a=o*i.x,u=r*i.y;return{width:s,height:l,x:a,y:u}}function bw(e,t,n){let r;if(t==="viewport")r=X$(e,n);else if(t==="document")r=Q$(Nr(e));else if(In(t))r=Z$(t,n);else{const o=SE(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ms(r)}function CE(e,t){const n=ko(e);return n===t||!In(n)||Rs(n)?!1:Dn(n).position==="fixed"||CE(n,t)}function ez(e,t){const n=t.get(e);if(n)return n;let r=xE(e,[]).filter(l=>In(l)&&Is(l)!=="body"),o=null;const i=Dn(e).position==="fixed";let s=i?ko(e):e;for(;In(s)&&!Rs(s);){const l=Dn(s),a=My(s);!a&&l.position==="fixed"&&(o=null),(i?!a&&!o:!a&&l.position==="static"&&!!o&&Y$.has(o.position)||Ma(s)&&!a&&CE(e,s))?r=r.filter(c=>c!==s):o=l,s=ko(s)}return t.set(e,r),r}function tz(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?sf(t)?[]:ez(t,this._c):[].concat(n),r],l=s[0],a=s.reduce((u,c)=>{const d=bw(t,c,o);return u.top=bt(d.top,u.top),u.right=Xn(d.right,u.right),u.bottom=Xn(d.bottom,u.bottom),u.left=bt(d.left,u.left),u},bw(t,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function nz(e){const{width:t,height:n}=wE(e);return{width:t,height:n}}function rz(e,t,n){const r=Yn(t),o=Nr(t),i=n==="fixed",s=da(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const a=qn(0);function u(){a.x=af(o)}if(r||!r&&!i)if((Is(t)!=="body"||Ma(o))&&(l=lf(t)),r){const p=da(t,!0,i,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else o&&u();i&&!r&&o&&u();const c=o&&!r&&!i?bE(o,l):qn(0),d=s.left+l.scrollLeft-a.x-c.x,f=s.top+l.scrollTop-a.y-c.y;return{x:d,y:f,width:s.width,height:s.height}}function Cp(e){return Dn(e).position==="static"}function Cw(e,t){if(!Yn(e)||Dn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Nr(e)===n&&(n=n.ownerDocument.body),n}function EE(e,t){const n=Kt(e);if(sf(e))return n;if(!Yn(e)){let o=ko(e);for(;o&&!Rs(o);){if(In(o)&&!Cp(o))return o;o=ko(o)}return n}let r=Cw(e,t);for(;r&&j$(r)&&Cp(r);)r=Cw(r,t);return r&&Rs(r)&&Cp(r)&&!My(r)?n:r||U$(e)||n}const oz=async function(e){const t=this.getOffsetParent||EE,n=this.getDimensions,r=await n(e.floating);return{reference:rz(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function iz(e){return Dn(e).direction==="rtl"}const sz={convertOffsetParentRelativeRectToViewportRelativeRect:K$,getDocumentElement:Nr,getClippingRect:tz,getOffsetParent:EE,getElementRects:oz,getClientRects:J$,getDimensions:nz,getScale:us,isElement:In,isRTL:iz},ME=D$,RE=R$,TE=L$,NE=T$,AE=_$,OE=N$,PE=E$,IE=O$,DE=(e,t,n)=>{const r=new Map,o={platform:sz,...n},i={...o.platform,_c:r};return C$(e,t,{...o,platform:i})};let vm,xm;if(typeof WeakMap<"u"){let e=new WeakMap;vm=t=>e.get(t),xm=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;vm=r=>{for(let o=0;o<e.length;o+=2)if(e[o]==r)return e[o+1]},xm=(r,o)=>(n==10&&(n=0),e[n++]=r,e[n++]=o)}var fr=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,o=t/this.width|0;let i=r+1,s=o+1;for(let l=1;i<this.width&&this.map[t+l]==n;l++)i++;for(let l=1;s<this.height&&this.map[t+this.width*l]==n;l++)s++;return{left:r,top:o,right:i,bottom:s}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:o,top:i,bottom:s}=this.findCell(e);return t=="horiz"?(n<0?r==0:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?i==0:s==this.height)?null:this.map[r+this.width*(n<0?i-1:s)]}rectBetween(e,t){const{left:n,right:r,top:o,bottom:i}=this.findCell(e),{left:s,right:l,top:a,bottom:u}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(o,a),right:Math.max(r,l),bottom:Math.max(i,u)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let o=e.left;o<e.right;o++){const i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,!(o==e.left&&o&&this.map[i-1]==s||r==e.top&&r&&this.map[i-this.width]==s)&&t.push(s))}return t}positionAt(e,t,n){for(let r=0,o=0;;r++){const i=o+n.child(r).nodeSize;if(r==e){let s=t+e*this.width;const l=(e+1)*this.width;for(;s<l&&this.map[s]<o;)s++;return s==l?i-1:this.map[s]}o=i}}static get(e){return vm(e)||xm(e,lz(e))}};function lz(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=az(e),n=e.childCount,r=[];let o=0,i=null;const s=[];for(let u=0,c=t*n;u<c;u++)r[u]=0;for(let u=0,c=0;u<n;u++){const d=e.child(u);c++;for(let h=0;;h++){for(;o<r.length&&r[o]!=0;)o++;if(h==d.childCount)break;const m=d.child(h),{colspan:y,rowspan:g,colwidth:v}=m.attrs;for(let k=0;k<g;k++){if(k+u>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:c,n:g-k});break}const S=o+k*t;for(let b=0;b<y;b++){r[S+b]==0?r[S+b]=c:(i||(i=[])).push({type:"collision",row:u,pos:c,n:y-b});const E=v&&v[b];if(E){const M=(S+b)%t*2,R=s[M];R==null||R!=E&&s[M+1]==1?(s[M]=E,s[M+1]=1):R==E&&s[M+1]++}}}o+=y,c+=m.nodeSize}const f=(u+1)*t;let p=0;for(;o<f;)r[o++]==0&&p++;p&&(i||(i=[])).push({type:"missing",row:u,n:p}),c++}(t===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new fr(t,n,r,i);let a=!1;for(let u=0;!a&&u<s.length;u+=2)s[u]!=null&&s[u+1]<n&&(a=!0);return a&&uz(l,s,e),l}function az(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const o=e.child(r);let i=0;if(n)for(let s=0;s<r;s++){const l=e.child(s);for(let a=0;a<l.childCount;a++){const u=l.child(a);s+u.attrs.rowspan>r&&(i+=u.attrs.colspan)}}for(let s=0;s<o.childCount;s++){const l=o.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}t==-1?t=i:t!=i&&(t=Math.max(t,i))}return t}function uz(e,t,n){e.problems||(e.problems=[]);const r={};for(let o=0;o<e.map.length;o++){const i=e.map[o];if(r[i])continue;r[i]=!0;const s=n.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=s.attrs;for(let u=0;u<a.colspan;u++){const c=t[(o+u)%e.width*2];c!=null&&(!a.colwidth||a.colwidth[u]!=c)&&((l||(l=cz(a)))[u]=c)}l&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function cz(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function Ty(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],o=r.spec.tableRole;o&&(t[o]=r)}}return t}new _e("selectingCells");function dz(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function LE(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function fz(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const n=dz(t.$head)||pz(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function pz(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if(r=="cell"||r=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if(r=="cell"||r=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function Ew(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function _E(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function $E(e,t,n){const r=e.node(-1),o=fr.get(r),i=e.start(-1),s=o.nextCell(e.pos-i,t,n);return s==null?null:e.node(0).resolve(i+s)}function Mw(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}var Kn=class ir extends ce{constructor(t,n=t){const r=t.node(-1),o=fr.get(r),i=t.start(-1),s=o.rectBetween(t.pos-i,n.pos-i),l=t.node(0),a=o.cellsInRect(s).filter(c=>c!=n.pos-i);a.unshift(n.pos-i);const u=a.map(c=>{const d=r.nodeAt(c);if(!d)throw new RangeError(`No cell with offset ${c} found`);const f=i+c+1;return new _b(l.resolve(f),l.resolve(f+d.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=t,this.$headCell=n}map(t,n){const r=t.resolve(n.map(this.$anchorCell.pos)),o=t.resolve(n.map(this.$headCell.pos));if(Ew(r)&&Ew(o)&&_E(r,o)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?ir.rowSelection(r,o):i&&this.isColSelection()?ir.colSelection(r,o):new ir(r,o)}return de.between(r,o)}content(){const t=this.$anchorCell.node(-1),n=fr.get(t),r=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let a=o.top;a<o.bottom;a++){const u=[];for(let c=a*n.width+o.left,d=o.left;d<o.right;d++,c++){const f=n.map[c];if(i[f])continue;i[f]=!0;const p=n.findCell(f);let h=t.nodeAt(f);if(!h)throw new RangeError(`No cell with offset ${f} found`);const m=o.left-p.left,y=p.right-o.right;if(m>0||y>0){let g=h.attrs;if(m>0&&(g=Mw(g,0,m)),y>0&&(g=Mw(g,g.colspan-y,y)),p.left<o.left){if(h=h.type.createAndFill(g),!h)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(g)}`)}else h=h.type.create(g,h.content)}if(p.top<o.top||p.bottom>o.bottom){const g={...h.attrs,rowspan:Math.min(p.bottom,o.bottom)-Math.max(p.top,o.top)};p.top<o.top?h=h.type.createAndFill(g):h=h.type.create(g,h.content)}u.push(h)}s.push(t.child(a).copy(_.from(u)))}const l=this.isColSelection()&&this.isRowSelection()?t:s;return new B(_.from(l),1,1)}replace(t,n=B.empty){const r=t.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){const{$from:l,$to:a}=o[s],u=t.mapping.slice(r);t.replace(u.map(l.pos),u.map(a.pos),s?B.empty:n)}const i=ce.findFrom(t.doc.resolve(t.mapping.slice(r).map(this.to)),-1);i&&t.setSelection(i)}replaceWith(t,n){this.replace(t,new B(_.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),r=fr.get(n),o=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let s=0;s<i.length;s++)t(n.nodeAt(i[s]),o+i[s])}isColSelection(){const t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;const r=t+this.$anchorCell.nodeAfter.attrs.rowspan,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const r=t.node(-1),o=fr.get(r),i=t.start(-1),s=o.findCell(t.pos-i),l=o.findCell(n.pos-i),a=t.node(0);return s.top<=l.top?(s.top>0&&(t=a.resolve(i+o.map[s.left])),l.bottom<o.height&&(n=a.resolve(i+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(i+o.map[l.left])),s.bottom<o.height&&(t=a.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new ir(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=fr.get(t),r=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(o,i)>0)return!1;const s=o+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==n.width}eq(t){return t instanceof ir&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const r=t.node(-1),o=fr.get(r),i=t.start(-1),s=o.findCell(t.pos-i),l=o.findCell(n.pos-i),a=t.node(0);return s.left<=l.left?(s.left>0&&(t=a.resolve(i+o.map[s.top*o.width])),l.right<o.width&&(n=a.resolve(i+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(i+o.map[l.top*o.width])),s.right<o.width&&(t=a.resolve(i+o.map[o.width*(s.top+1)-1]))),new ir(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new ir(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new ir(t.resolve(n),t.resolve(r))}getBookmark(){return new hz(this.$anchorCell.pos,this.$headCell.pos)}};Kn.prototype.visible=!1;ce.jsonID("cell",Kn);var hz=class zE{constructor(t,n){this.anchor=t,this.head=n}map(t){return new zE(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),r=t.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&_E(n,r)?new Kn(n,r):ce.near(r,1)}};new _e("fix-tables");function jE(e){const t=e.selection,n=fz(e),r=n.node(-1),o=n.start(-1),i=fr.get(r);return{...t instanceof Kn?i.rectBetween(t.$anchorCell.pos-o,t.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function mz(e){return function(t,n){if(!LE(t))return!1;if(n){const r=Ty(t.schema),o=jE(t),i=t.tr,s=o.map.cellsInRect(e=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:e=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=s.map(a=>o.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[a],r.cell,l[a].attrs);if(i.steps.length===0)for(let a=0;a<s.length;a++)i.setNodeMarkup(o.tableStart+s[a],r.header_cell,l[a].attrs);n(i)}return!0}}function Rw(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let o=0;o<r.length;o++){const i=t.table.nodeAt(r[o]);if(i&&i.type!==n.header_cell)return!1}return!0}function Ny(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?mz(e):function(n,r){if(!LE(n))return!1;if(r){const o=Ty(n.schema),i=jE(n),s=n.tr,l=Rw("row",i,o),a=Rw("column",i,o),u=(e==="column"?l:e==="row"&&a)?1:0,c=e=="column"?{left:0,top:u,right:1,bottom:i.map.height}:e=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,d=e=="column"?a?o.cell:o.header_cell:e=="row"?l?o.cell:o.header_cell:o.cell;i.map.cellsInRect(c).forEach(f=>{const p=f+i.tableStart,h=s.doc.nodeAt(p);h&&s.setNodeMarkup(p,d,h.attrs)}),r(s)}return!0}}Ny("row",{useDeprecatedLogic:!0});Ny("column",{useDeprecatedLogic:!0});Ny("cell",{useDeprecatedLogic:!0});function cu(e,t){const n=e.selection;if(!(n instanceof Kn))return!1;if(t){const r=e.tr,o=Ty(e.schema).cell.createAndFill().content;n.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new B(o,0,0))}),r.docChanged&&t(r)}return!0}cy({ArrowLeft:du("horiz",-1),ArrowRight:du("horiz",1),ArrowUp:du("vert",-1),ArrowDown:du("vert",1),"Shift-ArrowLeft":fu("horiz",-1),"Shift-ArrowRight":fu("horiz",1),"Shift-ArrowUp":fu("vert",-1),"Shift-ArrowDown":fu("vert",1),Backspace:cu,"Mod-Backspace":cu,Delete:cu,"Mod-Delete":cu});function Gu(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function du(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;if(i instanceof Kn)return Gu(n,r,ce.near(i.$headCell,t));if(e!="horiz"&&!i.empty)return!1;const s=FE(o,e,t);if(s==null)return!1;if(e=="horiz")return Gu(n,r,ce.near(n.doc.resolve(i.head+t),t));{const l=n.doc.resolve(s),a=$E(l,e,t);let u;return a?u=ce.near(a,1):t<0?u=ce.near(n.doc.resolve(l.before(-1)),-1):u=ce.near(n.doc.resolve(l.after(-1)),1),Gu(n,r,u)}}}function fu(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;let s;if(i instanceof Kn)s=i;else{const a=FE(o,e,t);if(a==null)return!1;s=new Kn(n.doc.resolve(a))}const l=$E(s.$headCell,e,t);return l?Gu(n,r,new Kn(s.$anchorCell,l)):!1}}function FE(e,t,n){if(!(e.state.selection instanceof de))return null;const{$head:r}=e.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const s=r.before(o),l=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(l)?s:null}}return null}new _e("tableColumnResizing");function gz(e,t){const n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),o=Math.min(e.left,t.left),s=Math.max(e.right,t.right)-o,l=r-n,a=o,u=n;return new DOMRect(a,u,s,l)}var yz=class{constructor({editor:e,element:t,view:n,updateDelay:r=250,resizeDelay:o=60,shouldShow:i,appendTo:s,getReferencedVirtualElement:l,options:a}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:c,state:d,from:f,to:p})=>{const{doc:h,selection:m}=d,{empty:y}=m,g=!h.textBetween(f,p).length&&hy(d.selection),v=this.element.contains(document.activeElement);return!(!(c.hasFocus()||v)||y||g||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:c})=>{var d;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}c!=null&&c.relatedTarget&&((d=this.element.parentNode)!=null&&d.contains(c.relatedTarget))||(c==null?void 0:c.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(c,d)=>{const f=!(d!=null&&d.selection.eq(c.state.selection)),p=!(d!=null&&d.doc.eq(c.state.doc));!f&&!p||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(c,f,p,d)},this.updateDelay))},this.updateHandler=(c,d,f,p)=>{const{composing:h}=c;if(h||!d&&!f)return;if(!this.getShouldShow(p)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:c})=>{const d=c.getMeta("bubbleMenu");d==="updatePosition"?this.updatePosition():d&&typeof d=="object"&&d.type==="updateOptions"&&this.updateOptions(d.options)};var u;this.editor=e,this.element=t,this.view=n,this.updateDelay=r,this.resizeDelay=o,this.appendTo=s,this.scrollTarget=(u=a==null?void 0:a.scrollTarget)!=null?u:window,this.getReferencedVirtualElement=l,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,i&&(this.shouldShow=i),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(NE(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(TE(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(ME(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(PE(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(AE(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(RE(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(OE(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(IE(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,t,n;const{selection:r}=this.editor.state,o=(e=this.getReferencedVirtualElement)==null?void 0:e.call(this);if(o)return o;if(!((n=(t=this.view)==null?void 0:t.dom)!=null&&n.parentNode))return;const i=KC(this.view,r.from,r.to);let s={getBoundingClientRect:()=>i,getClientRects:()=>[i]};if(r instanceof ee){let l=this.view.nodeDOM(r.from);const a=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");a&&(l=a),l&&(s={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(r instanceof Kn){const{$anchorCell:l,$headCell:a}=r,u=l?l.pos:a.pos,c=a?a.pos:l.pos,d=this.view.nodeDOM(u),f=this.view.nodeDOM(c);if(!d||!f)return;const p=d===f?d.getBoundingClientRect():gz(d.getBoundingClientRect(),f.getBoundingClientRect());s={getBoundingClientRect:()=>p,getClientRects:()=>[p]}}return s}updatePosition(){const e=this.virtualElement;e&&DE(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:n,strategy:r,middlewareData:o})=>{var i,s;if((i=o.hide)!=null&&i.referenceHidden||(s=o.hide)!=null&&s.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${t}px`,this.element.style.top=`${n}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}const o=!(t!=null&&t.selection.eq(e.state.selection)),i=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,o,i,t)}getShouldShow(e){var t;const{state:n}=this.view,{selection:r}=n,{ranges:o}=r,i=Math.min(...o.map(a=>a.$from.pos)),s=Math.max(...o.map(a=>a.$to.pos));return((t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:e,from:i,to:s}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){var t;if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){const n=(t=e.options.scrollTarget)!=null?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Ay=e=>new Ie({key:typeof e.pluginKey=="string"?new _e(e.pluginKey):e.pluginKey,view:t=>new yz({view:t,...e})});$e.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Ay({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var vz=class{constructor({editor:e,element:t,view:n,updateDelay:r=250,resizeDelay:o=60,options:i,appendTo:s,shouldShow:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:u,state:c})=>{const{selection:d}=c,{$anchor:f,empty:p}=d,h=f.depth===1,m=f.parent.isTextblock&&!f.parent.type.spec.code&&!f.parent.textContent&&f.parent.childCount===0&&!this.getTextContent(f.parent);return!(!u.hasFocus()||!p||!h||!m||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(u,c,d,f)=>{const{composing:p}=u;if(p||!c&&!d)return;if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var c;if(this.preventHide){this.preventHide=!1;return}u!=null&&u.relatedTarget&&((c=this.element.parentNode)!=null&&c.contains(u.relatedTarget))||(u==null?void 0:u.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:u})=>{const c=u.getMeta("floatingMenu");c==="updatePosition"?this.updatePosition():c&&typeof c=="object"&&c.type==="updateOptions"&&this.updateOptions(c.options)},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)};var a;this.editor=e,this.element=t,this.view=n,this.updateDelay=r,this.resizeDelay=o,this.appendTo=s,this.scrollTarget=(a=i==null?void 0:i.scrollTarget)!=null?a:window,this.floatingUIOptions={...this.floatingUIOptions,...i},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return VC(e,{textSerializers:yy(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(NE(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(TE(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(ME(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(PE(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(AE(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(RE(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(OE(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(IE(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}getShouldShow(e){var t;const{state:n}=this.view,{selection:r}=n,{ranges:o}=r,i=Math.min(...o.map(a=>a.$from.pos)),s=Math.max(...o.map(a=>a.$to.pos));return(t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,view:this.view,state:n,oldState:e,from:i,to:s})}updateOptions(e){var t;if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){const n=(t=e.options.scrollTarget)!=null?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){const{selection:e}=this.editor.state,t=KC(this.view,e.from,e.to);DE({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:r,y:o,strategy:i,middlewareData:s})=>{var l,a;if((l=s.hide)!=null&&l.referenceHidden||(a=s.hide)!=null&&a.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=i,this.element.style.left=`${r}px`,this.element.style.top=`${o}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const n=!(t!=null&&t.selection.eq(e.state.selection)),r=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,n,r,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Oy=e=>new Ie({key:typeof e.pluginKey=="string"?new _e(e.pluginKey):e.pluginKey,view:t=>new vz({view:t,...e})});$e.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta("floatingMenu","updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[Oy({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var xz=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},wz=({contentComponent:e})=>{const t=Wg.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return w.jsx(w.Fragment,{children:Object.values(t)})};function kz(){const e=new Set;let t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:BS.createPortal(r.reactElement,r.element,n)},e.forEach(o=>o())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(o=>o())}}}var Sz=class extends fn.Component{constructor(e){var t;super(e),this.editorContentRef=fn.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((t=e.editor)!=null&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;const t=this.props.editor;if(t&&!t.isDestroyed&&((e=t.view.dom)!=null&&e.parentNode)){if(t.contentComponent)return;const n=this.editorContentRef.current;n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n}),t.contentComponent=kz(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;const t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!((e=t.view.dom)!=null&&e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:e,innerRef:t,...n}=this.props;return w.jsxs(w.Fragment,{children:[w.jsx("div",{ref:xz(t,this.editorContentRef),...n}),(e==null?void 0:e.contentComponent)&&w.jsx(wz,{contentComponent:e.contentComponent})]})}},bz=x.forwardRef((e,t)=>{const n=fn.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return fn.createElement(Sz,{key:n,innerRef:t,...e})}),BE=fn.memo(bz),Cz=typeof window<"u"?x.useLayoutEffect:x.useEffect,Ez=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const t=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",t),()=>{n.off("transaction",t)}}}};function Mz(e){var t;const[n]=x.useState(()=>new Ez(e.editor)),r=p$.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,(t=e.equalityFn)!=null?t:o$);return Cz(()=>n.watch(e.editor),[e.editor,n]),x.useDebugValue(r),r}var Rz=!1,wm=typeof window>"u",Tz=wm||!!(typeof window<"u"&&window.next),Nz=class VE{constructor(t){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=t,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(t){this.editor=t,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?wm||Tz?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const t={...this.options.current,onBeforeCreate:(...r)=>{var o,i;return(i=(o=this.options.current).onBeforeCreate)==null?void 0:i.call(o,...r)},onBlur:(...r)=>{var o,i;return(i=(o=this.options.current).onBlur)==null?void 0:i.call(o,...r)},onCreate:(...r)=>{var o,i;return(i=(o=this.options.current).onCreate)==null?void 0:i.call(o,...r)},onDestroy:(...r)=>{var o,i;return(i=(o=this.options.current).onDestroy)==null?void 0:i.call(o,...r)},onFocus:(...r)=>{var o,i;return(i=(o=this.options.current).onFocus)==null?void 0:i.call(o,...r)},onSelectionUpdate:(...r)=>{var o,i;return(i=(o=this.options.current).onSelectionUpdate)==null?void 0:i.call(o,...r)},onTransaction:(...r)=>{var o,i;return(i=(o=this.options.current).onTransaction)==null?void 0:i.call(o,...r)},onUpdate:(...r)=>{var o,i;return(i=(o=this.options.current).onUpdate)==null?void 0:i.call(o,...r)},onContentError:(...r)=>{var o,i;return(i=(o=this.options.current).onContentError)==null?void 0:i.call(o,...r)},onDrop:(...r)=>{var o,i;return(i=(o=this.options.current).onDrop)==null?void 0:i.call(o,...r)},onPaste:(...r)=>{var o,i;return(i=(o=this.options.current).onPaste)==null?void 0:i.call(o,...r)},onDelete:(...r)=>{var o,i;return(i=(o=this.options.current).onDelete)==null?void 0:i.call(o,...r)}};return new c_(t)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}static compareOptions(t,n){return Object.keys(t).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&t.extensions&&n.extensions?t.extensions.length!==n.extensions.length?!1:t.extensions.every((o,i)=>{var s;return o===((s=n.extensions)==null?void 0:s[i])}):t[r]===n[r])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?VE.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(t){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=t;return}if(this.previousDeps.length===t.length&&this.previousDeps.every((r,o)=>r===t[o]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=t}scheduleDestroy(){const t=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===t){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===t&&this.setEditor(null))},1)}};function Az(e={},t=[]){const n=x.useRef(e);n.current=e;const[r]=x.useState(()=>new Nz(n)),o=Wg.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return x.useDebugValue(o),x.useEffect(r.onRender(t)),Mz({editor:o,selector:({transactionNumber:i})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&i===0?0:i+1}),o}var Py=x.createContext({editor:null});Py.Consumer;var uf=()=>x.useContext(Py),Oz=x.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Pz=()=>x.useContext(Oz);fn.forwardRef((e,t)=>{const{onDragStart:n}=Pz(),r=e.as||"div";return w.jsx(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});fn.createContext({markViewContentRef:()=>{}});var Iz=fn.forwardRef(({pluginKey:e="bubbleMenu",editor:t,updateDelay:n,resizeDelay:r,appendTo:o,shouldShow:i=null,getReferencedVirtualElement:s,options:l,children:a,...u},c)=>{const d=x.useRef(document.createElement("div"));typeof c=="function"?c(d.current):c&&(c.current=d.current);const{editor:f}=uf(),p=t||f,h={updateDelay:n,resizeDelay:r,appendTo:o,pluginKey:e,shouldShow:i,getReferencedVirtualElement:s,options:l},m=x.useRef(h);m.current=h;const[y,g]=x.useState(!1),v=x.useRef(!0);return x.useEffect(()=>{if(p!=null&&p.isDestroyed)return;if(!p){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const k=d.current;k.style.visibility="hidden",k.style.position="absolute";const S=Ay({...m.current,editor:p,element:k});p.registerPlugin(S);const b=m.current.pluginKey;return v.current=!0,g(!0),()=>{g(!1),p.unregisterPlugin(b),window.requestAnimationFrame(()=>{k.parentNode&&k.parentNode.removeChild(k)})}},[p]),x.useEffect(()=>{if(!(!y||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta("bubbleMenu",{type:"updateOptions",options:m.current}))}},[y,p,n,r,i,l,o,s]),di.createPortal(w.jsx("div",{...u,children:a}),d.current)}),Dz=fn.forwardRef(({pluginKey:e="floatingMenu",editor:t,updateDelay:n,resizeDelay:r,appendTo:o,shouldShow:i=null,options:s,children:l,...a},u)=>{const c=x.useRef(document.createElement("div"));typeof u=="function"?u(c.current):u&&(u.current=c.current);const{editor:d}=uf(),f=t||d,p={updateDelay:n,resizeDelay:r,appendTo:o,pluginKey:e,shouldShow:i,options:s},h=x.useRef(p);h.current=p;const[m,y]=x.useState(!1),g=x.useRef(!0);return x.useEffect(()=>{if(f!=null&&f.isDestroyed)return;if(!f){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const v=c.current;v.style.visibility="hidden",v.style.position="absolute";const k=Oy({...h.current,editor:f,element:v});f.registerPlugin(k);const S=h.current.pluginKey;return g.current=!0,y(!0),()=>{y(!1),f.unregisterPlugin(S),window.requestAnimationFrame(()=>{v.parentNode&&v.parentNode.removeChild(v)})}},[f]),x.useEffect(()=>{if(!(!m||!f||f.isDestroyed)){if(g.current){g.current=!1;return}f.view.dispatch(f.state.tr.setMeta("floatingMenu",{type:"updateOptions",options:h.current}))}},[m,f,n,r,i,s,o]),di.createPortal(w.jsx("div",{...a,children:l}),c.current)}),Iy=x.createContext({editor:null,isReady:!1});Iy.displayName="TiptapContext";var cf=()=>x.useContext(Iy);function HE({instance:e,children:t}){var n;const[r,o]=x.useState((n=e==null?void 0:e.isInitialized)!=null?n:!1);x.useEffect(()=>{if(!e){o(!1);return}if(e.isInitialized){o(!0);return}const l=()=>{o(!0)};return e.on("create",l),()=>{e.off("create",l)}},[e]);const i=x.useMemo(()=>({editor:e,isReady:r}),[e,r]),s=x.useMemo(()=>({editor:e}),[e]);return w.jsx(Py.Provider,{value:s,children:w.jsx(Iy.Provider,{value:i,children:t})})}HE.displayName="Tiptap";function UE({...e}){const{editor:t}=cf();return w.jsx(BE,{editor:t,...e})}UE.displayName="Tiptap.Content";function WE({children:e}){const{isReady:t}=cf();return t?null:e}WE.displayName="Tiptap.Loading";function GE({children:e,...t}){const{editor:n}=cf();return n?w.jsx(Iz,{editor:n,...t,children:e}):null}GE.displayName="Tiptap.BubbleMenu";function qE({children:e,...t}){const{editor:n}=cf();return n?w.jsx(Dz,{...t,editor:n,children:e}):null}qE.displayName="Tiptap.FloatingMenu";var Lz=Object.assign(HE,{Content:UE,Loading:WE,BubbleMenu:GE,FloatingMenu:qE}),Hc=(e,t)=>{if(e==="slot")return 0;if(e instanceof Function)return e(t);const{children:n,...r}=t??{};if(e==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},_z=/^\s*>\s$/,$z=Zt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return Hc("blockquote",{...Qe(this.options.HTMLAttributes,e),children:Hc("slot",{})})},parseMarkdown:(e,t)=>t.createNode("blockquote",void 0,t.parseChildren(e.tokens||[])),renderMarkdown:(e,t)=>{if(!e.content)return"";const n=">",r=[];return e.content.forEach(o=>{const l=t.renderChildren([o]).split(`
183
- `).map(a=>a.trim()===""?n:`${n} ${a}`);r.push(l.join(`
184
- `))}),r.join(`
185
- ${n}
186
- `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Es({find:_z,type:this.type})]}}),zz=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,jz=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Fz=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Bz=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Vz=mi.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return Hc("strong",{...Qe(this.options.HTMLAttributes,e),children:Hc("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Cs({find:zz,type:this.type}),Cs({find:Fz,type:this.type})]},addPasteRules(){return[ii({find:jz,type:this.type}),ii({find:Bz,type:this.type})]}}),Hz=/(^|[^`])`([^`]+)`(?!`)$/,Uz=/(^|[^`])`([^`]+)`(?!`)/g,Wz=mi.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",Qe(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Cs({find:Hz,type:this.type})]},addPasteRules(){return[ii({find:Uz,type:this.type})]}}),Ep=4,Gz=/^```([a-z]+)?[\s\n]$/,qz=/^~~~([a-z]+)?[\s\n]$/,Kz=Zt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Ep,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((t=e.firstElementChild)==null?void 0:t.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:e,HTMLAttributes:t}){return["pre",Qe(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n;return((n=e.raw)==null?void 0:n.startsWith("```"))===!1&&e.codeBlockStyle!=="indented"?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r="";const o=((n=e.attrs)==null?void 0:n.language)||"";return e.content?r=[`\`\`\`${o}`,t.renderChildren(e.content),"```"].join(`
187
- `):r=`\`\`\`${o}
188
-
189
- \`\`\``,r},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=(t=this.options.tabSize)!=null?t:Ep,{state:r}=e,{selection:o}=r,{$from:i,empty:s}=o;if(i.parent.type!==this.type)return!1;const l=" ".repeat(n);return s?e.commands.insertContent(l):e.commands.command(({tr:a})=>{const{from:u,to:c}=o,p=r.doc.textBetween(u,c,`
190
- `,`
191
- `).split(`
192
- `).map(h=>l+h).join(`
193
- `);return a.replaceWith(u,c,r.schema.text(p)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=(t=this.options.tabSize)!=null?t:Ep,{state:r}=e,{selection:o}=r,{$from:i,empty:s}=o;return i.parent.type!==this.type?!1:s?e.commands.command(({tr:l})=>{var a;const{pos:u}=i,c=i.start(),d=i.end(),p=r.doc.textBetween(c,d,`
194
- `,`
195
- `).split(`
196
- `);let h=0,m=0;const y=u-c;for(let E=0;E<p.length;E+=1){if(m+p[E].length>=y){h=E;break}m+=p[E].length+1}const v=((a=p[h].match(/^ */))==null?void 0:a[0])||"",k=Math.min(v.length,n);if(k===0)return!0;let S=c;for(let E=0;E<h;E+=1)S+=p[E].length+1;return l.delete(S,S+k),u-S<=k&&l.setSelection(de.create(l.doc,S)),!0}):e.commands.command(({tr:l})=>{const{from:a,to:u}=o,f=r.doc.textBetween(a,u,`
197
- `,`
198
- `).split(`
199
- `).map(p=>{var h;const m=((h=p.match(/^ */))==null?void 0:h[0])||"",y=Math.min(m.length,n);return p.slice(y)}).join(`
200
- `);return l.replaceWith(a,u,r.schema.text(f)),!0})},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
201
-
202
- `);return!i||!s?!1:e.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const l=o.after();return l===void 0?!1:r.nodeAt(l)?e.commands.command(({tr:u})=>(u.setSelection(ce.near(r.resolve(l))),!0)):e.commands.exitCode()}}},addInputRules(){return[hm({find:Gz,type:this.type,getAttributes:e=>({language:e[1]})}),hm({find:qz,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Ie({key:new _e("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=o==null?void 0:o.mode;if(!n||!i)return!1;const{tr:s,schema:l}=e.state,a=l.text(n.replace(/\r\n?/g,`
203
- `));return s.replaceSelectionWith(this.type.create({language:i},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(de.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),Jz=Zt.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
204
-
205
- `):""}),Qz=Zt.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",Qe(this.options.HTMLAttributes,e)]},renderText(){return`
206
- `},renderMarkdown:()=>`
207
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:o,storedMarks:i}=n;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=i||o.$to.parentOffset&&o.$from.marks();return t().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&a&&s){const d=a.filter(f=>l.includes(f.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Xz=Zt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,Qe(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;const r=(n=e.attrs)!=null&&n.level?parseInt(e.attrs.level,10):1,o="#".repeat(r);return e.content?`${o} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>hm({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),Yz=Zt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",Qe(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!f_(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:r}=n,o=e();return WC(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:i,tr:s,dispatch:l})=>{if(l){const{$to:a}=s.selection,u=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?s.setSelection(de.create(s.doc,a.pos+1)):a.nodeAfter.isBlock?s.setSelection(ee.create(s.doc,a.pos)):s.setSelection(de.create(s.doc,a.pos));else{const c=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=c==null?void 0:c.create();d&&(s.insert(u,d),s.setSelection(de.create(s.doc,u+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[d_({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Zz=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,ej=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,tj=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,nj=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,rj=mi.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",Qe(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Cs({find:Zz,type:this.type}),Cs({find:tj,type:this.type})]},addPasteRules(){return[ii({find:ej,type:this.type}),ii({find:nj,type:this.type})]}});const oj="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",ij="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",km="numeric",Sm="ascii",bm="alpha",Nl="asciinumeric",hl="alphanumeric",Cm="domain",KE="emoji",sj="scheme",lj="slashscheme",Mp="whitespace";function aj(e,t){return e in t||(t[e]=[]),t[e]}function Vo(e,t,n){t[km]&&(t[Nl]=!0,t[hl]=!0),t[Sm]&&(t[Nl]=!0,t[bm]=!0),t[Nl]&&(t[hl]=!0),t[bm]&&(t[hl]=!0),t[hl]&&(t[Cm]=!0),t[KE]&&(t[Cm]=!0);for(const r in t){const o=aj(r,n);o.indexOf(e)<0&&o.push(e)}}function uj(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function Dt(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Dt.groups={};Dt.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let r=0;r<t.jr.length;r++){const o=t.jr[r][0],i=t.jr[r][1];if(i&&o.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let o=0;o<e.length;o++)this.tt(e[o],t,n,r)},tr(e,t,n,r){r=r||Dt.groups;let o;return t&&t.j?o=t:(o=new Dt(t),n&&r&&Vo(t,n,r)),this.jr.push([e,o]),o},ts(e,t,n,r){let o=this;const i=e.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(e[s]);return o.tt(e[i-1],t,n,r)},tt(e,t,n,r){r=r||Dt.groups;const o=this;if(t&&t.j)return o.j[e]=t,t;const i=t;let s,l=o.go(e);if(l?(s=new Dt,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new Dt,i){if(r)if(s.t&&typeof s.t=="string"){const a=Object.assign(uj(s.t,r),n);Vo(i,a,r)}else n&&Vo(i,n,r);s.t=i}return o.j[e]=s,s}};const me=(e,t,n,r,o)=>e.ta(t,n,r,o),Ve=(e,t,n,r,o)=>e.tr(t,n,r,o),Tw=(e,t,n,r,o)=>e.ts(t,n,r,o),$=(e,t,n,r,o)=>e.tt(t,n,r,o),sr="WORD",Em="UWORD",JE="ASCIINUMERICAL",QE="ALPHANUMERICAL",fa="LOCALHOST",Mm="TLD",Rm="UTLD",qu="SCHEME",zi="SLASH_SCHEME",Dy="NUM",Tm="WS",Ly="NL",Al="OPENBRACE",Ol="CLOSEBRACE",Uc="OPENBRACKET",Wc="CLOSEBRACKET",Gc="OPENPAREN",qc="CLOSEPAREN",Kc="OPENANGLEBRACKET",Jc="CLOSEANGLEBRACKET",Qc="FULLWIDTHLEFTPAREN",Xc="FULLWIDTHRIGHTPAREN",Yc="LEFTCORNERBRACKET",Zc="RIGHTCORNERBRACKET",ed="LEFTWHITECORNERBRACKET",td="RIGHTWHITECORNERBRACKET",nd="FULLWIDTHLESSTHAN",rd="FULLWIDTHGREATERTHAN",od="AMPERSAND",id="APOSTROPHE",sd="ASTERISK",Hr="AT",ld="BACKSLASH",ad="BACKTICK",ud="CARET",Kr="COLON",_y="COMMA",cd="DOLLAR",jn="DOT",dd="EQUALS",$y="EXCLAMATION",nn="HYPHEN",Pl="PERCENT",fd="PIPE",pd="PLUS",hd="POUND",Il="QUERY",zy="QUOTE",XE="FULLWIDTHMIDDLEDOT",jy="SEMI",Fn="SLASH",Dl="TILDE",md="UNDERSCORE",YE="EMOJI",gd="SYM";var ZE=Object.freeze({__proto__:null,ALPHANUMERICAL:QE,AMPERSAND:od,APOSTROPHE:id,ASCIINUMERICAL:JE,ASTERISK:sd,AT:Hr,BACKSLASH:ld,BACKTICK:ad,CARET:ud,CLOSEANGLEBRACKET:Jc,CLOSEBRACE:Ol,CLOSEBRACKET:Wc,CLOSEPAREN:qc,COLON:Kr,COMMA:_y,DOLLAR:cd,DOT:jn,EMOJI:YE,EQUALS:dd,EXCLAMATION:$y,FULLWIDTHGREATERTHAN:rd,FULLWIDTHLEFTPAREN:Qc,FULLWIDTHLESSTHAN:nd,FULLWIDTHMIDDLEDOT:XE,FULLWIDTHRIGHTPAREN:Xc,HYPHEN:nn,LEFTCORNERBRACKET:Yc,LEFTWHITECORNERBRACKET:ed,LOCALHOST:fa,NL:Ly,NUM:Dy,OPENANGLEBRACKET:Kc,OPENBRACE:Al,OPENBRACKET:Uc,OPENPAREN:Gc,PERCENT:Pl,PIPE:fd,PLUS:pd,POUND:hd,QUERY:Il,QUOTE:zy,RIGHTCORNERBRACKET:Zc,RIGHTWHITECORNERBRACKET:td,SCHEME:qu,SEMI:jy,SLASH:Fn,SLASH_SCHEME:zi,SYM:gd,TILDE:Dl,TLD:Mm,UNDERSCORE:md,UTLD:Rm,UWORD:Em,WORD:sr,WS:Tm});const nr=/[a-z]/,Zs=new RegExp("\\p{L}","u"),Rp=new RegExp("\\p{Emoji}","u"),rr=/\d/,Tp=/\s/,Nw="\r",Np=`
208
- `,cj="️",dj="‍",Ap="";let pu=null,hu=null;function fj(e=[]){const t={};Dt.groups=t;const n=new Dt;pu==null&&(pu=Aw(oj)),hu==null&&(hu=Aw(ij)),$(n,"'",id),$(n,"{",Al),$(n,"}",Ol),$(n,"[",Uc),$(n,"]",Wc),$(n,"(",Gc),$(n,")",qc),$(n,"<",Kc),$(n,">",Jc),$(n,"(",Qc),$(n,")",Xc),$(n,"「",Yc),$(n,"」",Zc),$(n,"『",ed),$(n,"』",td),$(n,"<",nd),$(n,">",rd),$(n,"&",od),$(n,"*",sd),$(n,"@",Hr),$(n,"`",ad),$(n,"^",ud),$(n,":",Kr),$(n,",",_y),$(n,"$",cd),$(n,".",jn),$(n,"=",dd),$(n,"!",$y),$(n,"-",nn),$(n,"%",Pl),$(n,"|",fd),$(n,"+",pd),$(n,"#",hd),$(n,"?",Il),$(n,'"',zy),$(n,"/",Fn),$(n,";",jy),$(n,"~",Dl),$(n,"_",md),$(n,"\\",ld),$(n,"・",XE);const r=Ve(n,rr,Dy,{[km]:!0});Ve(r,rr,r);const o=Ve(r,nr,JE,{[Nl]:!0}),i=Ve(r,Zs,QE,{[hl]:!0}),s=Ve(n,nr,sr,{[Sm]:!0});Ve(s,rr,o),Ve(s,nr,s),Ve(o,rr,o),Ve(o,nr,o);const l=Ve(n,Zs,Em,{[bm]:!0});Ve(l,nr),Ve(l,rr,i),Ve(l,Zs,l),Ve(i,rr,i),Ve(i,nr),Ve(i,Zs,i);const a=$(n,Np,Ly,{[Mp]:!0}),u=$(n,Nw,Tm,{[Mp]:!0}),c=Ve(n,Tp,Tm,{[Mp]:!0});$(n,Ap,c),$(u,Np,a),$(u,Ap,c),Ve(u,Tp,c),$(c,Nw),$(c,Np),Ve(c,Tp,c),$(c,Ap,c);const d=Ve(n,Rp,YE,{[KE]:!0});$(d,"#"),Ve(d,Rp,d),$(d,cj,d);const f=$(d,dj);$(f,"#"),Ve(f,Rp,d);const p=[[nr,s],[rr,o]],h=[[nr,null],[Zs,l],[rr,i]];for(let m=0;m<pu.length;m++)_r(n,pu[m],Mm,sr,p);for(let m=0;m<hu.length;m++)_r(n,hu[m],Rm,Em,h);Vo(Mm,{tld:!0,ascii:!0},t),Vo(Rm,{utld:!0,alpha:!0},t),_r(n,"file",qu,sr,p),_r(n,"mailto",qu,sr,p),_r(n,"http",zi,sr,p),_r(n,"https",zi,sr,p),_r(n,"ftp",zi,sr,p),_r(n,"ftps",zi,sr,p),Vo(qu,{scheme:!0,ascii:!0},t),Vo(zi,{slashscheme:!0,ascii:!0},t),e=e.sort((m,y)=>m[0]>y[0]?1:-1);for(let m=0;m<e.length;m++){const y=e[m][0],v=e[m][1]?{[sj]:!0}:{[lj]:!0};y.indexOf("-")>=0?v[Cm]=!0:nr.test(y)?rr.test(y)?v[Nl]=!0:v[Sm]=!0:v[km]=!0,Tw(n,y,y,v)}return Tw(n,"localhost",fa,{ascii:!0}),n.jd=new Dt(gd),{start:n,tokens:Object.assign({groups:t},ZE)}}function eM(e,t){const n=pj(t.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let l=e,a=null,u=0,c=null,d=-1,f=-1;for(;s<r&&(a=l.go(n[s]));)l=a,l.accepts()?(d=0,f=0,c=l):d>=0&&(d+=n[s].length,f++),u+=n[s].length,i+=n[s].length,s++;i-=d,s-=f,u-=d,o.push({t:c.t,v:t.slice(i-u,i),s:i-u,e:i})}return o}function pj(e){const t=[],n=e.length;let r=0;for(;r<n;){let o=e.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=e.charCodeAt(r+1))<56320||i>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}function _r(e,t,n,r,o){let i;const s=t.length;for(let l=0;l<s-1;l++){const a=t[l];e.j[a]?i=e.j[a]:(i=new Dt(r),i.jr=o.slice(),e.j[a]=i),e=i}return i=new Dt(n),i.jr=o.slice(),e.j[t[s-1]]=i,i}function Aw(e){const t=[],n=[];let r=0,o="0123456789";for(;r<e.length;){let i=0;for(;o.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(""));for(let s=parseInt(e.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(e[r]),r++}return t}const pa={defaultProtocol:"http",events:null,format:Ow,formatHref:Ow,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Fy(e,t=null){let n=Object.assign({},pa);e&&(n=Object.assign(n,e instanceof Fy?e.o:e));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=o}Fy.prototype={o:pa,ignoreTags:[],defaultRender(e){return e},check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=t!=null;let o=this.o[e];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:pa[e],typeof o=="function"&&r&&(o=o(t,n))):typeof o=="function"&&r&&(o=o(t,n.t,n)),o)},getObj(e,t,n){let r=this.o[e];return typeof r=="function"&&t!=null&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}};function Ow(e){return e}function tM(e,t){this.t="token",this.v=e,this.tk=t}tM.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=pa.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),o=e.get("tagName",n,t),i=this.toFormattedString(e),s={},l=e.get("className",n,t),a=e.get("target",n,t),u=e.get("rel",n,t),c=e.getObj("attributes",n,t),d=e.getObj("events",n,t);return s.href=r,l&&(s.class=l),a&&(s.target=a),u&&(s.rel=u),c&&Object.assign(s,c),{tagName:o,attributes:s,content:i,eventListeners:d}}};function df(e,t){class n extends tM{constructor(o,i){super(o,i),this.t=e}}for(const r in t)n.prototype[r]=t[r];return n.t=e,n}const Pw=df("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Iw=df("text"),hj=df("nl"),mu=df("url",{isLink:!0,toHref(e=pa.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==fa&&e[1].t===Kr}}),tn=e=>new Dt(e);function mj({groups:e}){const t=e.domain.concat([od,sd,Hr,ld,ad,ud,cd,dd,nn,Dy,Pl,fd,pd,hd,Fn,gd,Dl,md]),n=[id,Kr,_y,jn,$y,Pl,Il,zy,jy,Kc,Jc,Al,Ol,Wc,Uc,Gc,qc,Qc,Xc,Yc,Zc,ed,td,nd,rd],r=[od,id,sd,ld,ad,ud,cd,dd,nn,Al,Ol,Pl,fd,pd,hd,Il,Fn,gd,Dl,md],o=tn(),i=$(o,Dl);me(i,r,i),me(i,e.domain,i);const s=tn(),l=tn(),a=tn();me(o,e.domain,s),me(o,e.scheme,l),me(o,e.slashscheme,a),me(s,r,i),me(s,e.domain,s);const u=$(s,Hr);$(i,Hr,u),$(l,Hr,u),$(a,Hr,u);const c=$(i,jn);me(c,r,i),me(c,e.domain,i);const d=tn();me(u,e.domain,d),me(d,e.domain,d);const f=$(d,jn);me(f,e.domain,d);const p=tn(Pw);me(f,e.tld,p),me(f,e.utld,p),$(u,fa,p);const h=$(d,nn);$(h,nn,h),me(h,e.domain,d),me(p,e.domain,d),$(p,jn,f),$(p,nn,h);const m=$(p,Kr);me(m,e.numeric,Pw);const y=$(s,nn),g=$(s,jn);$(y,nn,y),me(y,e.domain,s),me(g,r,i),me(g,e.domain,s);const v=tn(mu);me(g,e.tld,v),me(g,e.utld,v),me(v,e.domain,s),me(v,r,i),$(v,jn,g),$(v,nn,y),$(v,Hr,u);const k=$(v,Kr),S=tn(mu);me(k,e.numeric,S);const b=tn(mu),E=tn();me(b,t,b),me(b,n,E),me(E,t,b),me(E,n,E),$(v,Fn,b),$(S,Fn,b);const M=$(l,Kr),R=$(a,Kr),D=$(R,Fn),I=$(D,Fn);me(l,e.domain,s),$(l,jn,g),$(l,nn,y),me(a,e.domain,s),$(a,jn,g),$(a,nn,y),me(M,e.domain,b),$(M,Fn,b),$(M,Il,b),me(I,e.domain,b),me(I,t,b),$(I,Fn,b);const J=[[Al,Ol],[Uc,Wc],[Gc,qc],[Kc,Jc],[Qc,Xc],[Yc,Zc],[ed,td],[nd,rd]];for(let ne=0;ne<J.length;ne++){const[re,U]=J[ne],ie=$(b,re);$(E,re,ie),$(ie,U,b);const ue=tn(mu);me(ie,t,ue);const fe=tn();me(ie,n),me(ue,t,ue),me(ue,n,fe),me(fe,t,ue),me(fe,n,fe),$(ue,U,b),$(fe,U,b)}return $(o,fa,v),$(o,Ly,hj),{start:o,tokens:ZE}}function gj(e,t,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let l=e,a=null,u=null,c=0,d=null,f=-1;for(;o<r&&!(a=l.go(n[o].t));)s.push(n[o++]);for(;o<r&&(u=a||l.go(n[o].t));)a=null,l=u,l.accepts()?(f=0,d=l):f>=0&&f++,o++,c++;if(f<0)o-=c,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(Op(Iw,t,s)),s=[]),o-=f,c-=f;const p=d.t,h=n.slice(o-c,o);i.push(Op(p,t,h))}}return s.length>0&&i.push(Op(Iw,t,s)),i}function Op(e,t,n){const r=n[0].s,o=n[n.length-1].e,i=t.slice(r,o);return new e(i,n)}const yj=typeof console<"u"&&console&&console.warn||(()=>{}),vj="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Oe={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function xj(){return Dt.groups={},Oe.scanner=null,Oe.parser=null,Oe.tokenQueue=[],Oe.pluginQueue=[],Oe.customSchemes=[],Oe.initialized=!1,Oe}function Dw(e,t=!1){if(Oe.initialized&&yj(`linkifyjs: already initialized - will not register custom scheme "${e}" ${vj}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format.
209
- 1. Must only contain digits, lowercase ASCII letters or "-"
210
- 2. Cannot start or end with "-"
211
- 3. "-" cannot repeat`);Oe.customSchemes.push([e,t])}function wj(){Oe.scanner=fj(Oe.customSchemes);for(let e=0;e<Oe.tokenQueue.length;e++)Oe.tokenQueue[e][1]({scanner:Oe.scanner});Oe.parser=mj(Oe.scanner.tokens);for(let e=0;e<Oe.pluginQueue.length;e++)Oe.pluginQueue[e][1]({scanner:Oe.scanner,parser:Oe.parser});return Oe.initialized=!0,Oe}function By(e){return Oe.initialized||wj(),gj(Oe.parser.start,e,eM(Oe.scanner.start,e))}By.scan=eM;function nM(e,t=null,n=null){if(t&&typeof t=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new Fy(n),o=By(e),i=[];for(let s=0;s<o.length;s++){const l=o[s];l.isLink&&(!t||l.t===t)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}var Vy="[\0-   ᠎ -\u2029  ]",kj=new RegExp(Vy),Sj=new RegExp(`${Vy}$`),bj=new RegExp(Vy,"g");function Cj(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function Ej(e){return new Ie({key:new _e("autolink"),appendTransaction:(t,n,r)=>{const o=t.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=t.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,l=$C(n.doc,[...t]);if(UC(l).forEach(({newRange:u})=>{const c=fL(r.doc,u,p=>p.isTextblock);let d,f;if(c.length>1)d=c[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(c.length){const p=r.doc.textBetween(u.from,u.to," "," ");if(!Sj.test(p))return;d=c[0],f=r.doc.textBetween(d.pos,u.to,void 0," ")}if(d&&f){const p=f.split(kj).filter(Boolean);if(p.length<=0)return!1;const h=p[p.length-1],m=d.pos+f.lastIndexOf(h);if(!h)return!1;const y=By(h).map(g=>g.toObject(e.defaultProtocol));if(!Cj(y))return!1;y.filter(g=>g.isLink).map(g=>({...g,from:m+g.start+1,to:m+g.end+1})).filter(g=>r.schema.marks.code?!r.doc.rangeHasMark(g.from,g.to,r.schema.marks.code):!0).filter(g=>e.validate(g.value)).filter(g=>e.shouldAutoLink(g.value)).forEach(g=>{vy(g.from,g.to,r.doc).some(v=>v.mark.type===e.type)||s.addMark(g.from,g.to,e.type.create({href:g.href}))})}}),!!s.steps.length)return s}})}function Mj(e){return new Ie({key:new _e("handleClickLink"),props:{handleClick:(t,n,r)=>{var o,i;if(r.button!==0||!t.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const a=r.target;if(!a)return!1;const u=e.editor.view.dom;s=a.closest("a"),s&&!u.contains(s)&&(s=null)}if(!s)return!1;let l=!1;if(e.enableClickSelection&&(l=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){const a=HC(t.state,e.type.name),u=(o=s.href)!=null?o:a.href,c=(i=s.target)!=null?i:a.target;u&&(window.open(u,c),l=!0)}return l}}})}function Rj(e){return new Ie({key:new _e("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{shouldAutoLink:o}=e,{state:i}=t,{selection:s}=i,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(c=>{a+=c.textContent});const u=nM(a,{defaultProtocol:e.defaultProtocol}).find(c=>c.isLink&&c.value===a);return!a||!u||o!==void 0&&!o(u.value)?!1:e.editor.commands.setMark(e.type,{href:u.href})}}})}function Po(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!e||e.replace(bj,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Tj=mi.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e=="string"){Dw(e);return}Dw(e.scheme,e.optionalSlashes)})},onDestroy(){xj()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!Po(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;const o=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(o)||!/\./.test(o))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:n=>!!Po(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!Po(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Qe(this.options.HTMLAttributes,e),0]:["a",Qe(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n;const r=((n=e.attrs)==null?void 0:n.href)||"";return`[${t.renderChildren(e)}](${r})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Po(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Po(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[ii({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,o=nM(e).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Po(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>{this.options.shouldAutoLink(i.value)&&t.push({text:i.value,data:{href:i.href},index:i.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)==null?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(Ej({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Po(o,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(Mj({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(Rj({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),Nj=Object.defineProperty,Aj=(e,t)=>{for(var n in t)Nj(e,n,{get:t[n],enumerable:!0})},Oj="listItem",Lw="textStyle",_w=/^\s*([-+*])\s$/,rM=Zt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:e}){return["ul",Qe(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>e.type!=="list"||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
212
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Oj,this.editor.getAttributes(Lw)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Es({find:_w,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Es({find:_w,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Lw),editor:this.editor})),[e]}}),oM=Zt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",Qe(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{if(e.type!=="list_item")return[];let n=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(o=>o.type==="paragraph"))n=t.parseChildren(e.tokens);else{const o=e.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(n=[{type:"paragraph",content:t.parseInline(o.tokens)}],e.tokens.length>1){const s=e.tokens.slice(1),l=t.parseChildren(s);n.push(...l)}}else n=t.parseChildren(e.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(e,t,n)=>Sy(e,t,r=>{var o,i;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((i=(o=r.meta)==null?void 0:o.parentAttrs)==null?void 0:i.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Pj={};Aj(Pj,{findListItemPos:()=>Ra,getNextListDepth:()=>Hy,handleBackspace:()=>Nm,handleDelete:()=>Am,hasListBefore:()=>iM,hasListItemAfter:()=>Ij,hasListItemBefore:()=>sM,listItemHasSubList:()=>lM,nextListIsDeeper:()=>aM,nextListIsHigher:()=>uM});var Ra=(e,t)=>{const{$from:n}=t.selection,r=Je(e,t.schema);let o=null,i=n.depth,s=n.pos,l=null;for(;i>0&&l===null;)o=n.node(i),o.type===r?l=i:(i-=1,s-=1);return l===null?null:{$pos:t.doc.resolve(s),depth:l}},Hy=(e,t)=>{const n=Ra(e,t);if(!n)return!1;const[,r]=SL(t,e,n.$pos.pos+4);return r},iM=(e,t,n)=>{const{$anchor:r}=e.selection,o=Math.max(0,r.pos-2),i=e.doc.resolve(o).node();return!(!i||!n.includes(i.type.name))},sM=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-2);return!(o.index()===0||((n=o.nodeBefore)==null?void 0:n.type.name)!==e)},lM=(e,t,n)=>{if(!n)return!1;const r=Je(e,t.schema);let o=!1;return n.descendants(i=>{i.type===r&&(o=!0)}),o},Nm=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!wo(e.state,t)&&iM(e.state,t,n)){const{$anchor:l}=e.state.selection,a=e.state.doc.resolve(l.before()-1),u=[];a.node().descendants((f,p)=>{f.type.name===t&&u.push({node:f,pos:p})});const c=u.at(-1);if(!c)return!1;const d=e.state.doc.resolve(a.start()+c.pos+1);return e.chain().cut({from:l.start()-1,to:l.end()+1},d.end()).joinForward().run()}if(!wo(e.state,t)||!ML(e.state))return!1;const r=Ra(t,e.state);if(!r)return!1;const i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),s=lM(t,e.state,i);return sM(t,e.state)&&!s?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},aM=(e,t)=>{const n=Hy(e,t),r=Ra(e,t);return!r||!n?!1:n>r.depth},uM=(e,t)=>{const n=Hy(e,t),r=Ra(e,t);return!r||!n?!1:n<r.depth},Am=(e,t)=>{if(!wo(e.state,t)||!EL(e.state,t))return!1;const{selection:n}=e.state,{$from:r,$to:o}=n;return!n.empty&&r.sameParent(o)?!1:aM(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():uM(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},Ij=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-r.parentOffset-2);return!(o.index()===o.parent.childCount-1||((n=o.nodeAfter)==null?void 0:n.type.name)!==e)},cM=$e.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&Am(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&Am(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&Nm(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&Nm(e,n,r)&&(t=!0)}),t}}}}),$w=/^(\s*)(\d+)\.\s+(.*)$/,Dj=/^\s/;function Lj(e){const t=[];let n=0,r=0;for(;n<e.length;){const o=e[n],i=o.match($w);if(!i)break;const[,s,l,a]=i,u=s.length;let c=a,d=n+1;const f=[o];for(;d<e.length;){const p=e[d];if(p.match($w))break;if(p.trim()==="")f.push(p),c+=`
213
- `,d+=1;else if(p.match(Dj))f.push(p),c+=`
214
- ${p.slice(u+2)}`,d+=1;else break}t.push({indent:u,number:parseInt(l,10),content:c.trim(),raw:f.join(`
215
- `)}),r=d,n=d}return[t,r]}function dM(e,t,n){var r;const o=[];let i=0;for(;i<e.length;){const s=e[i];if(s.indent===t){const l=s.content.split(`
216
- `),a=((r=l[0])==null?void 0:r.trim())||"",u=[];a&&u.push({type:"paragraph",raw:a,tokens:n.inlineTokens(a)});const c=l.slice(1).join(`
217
- `).trim();if(c){const p=n.blockTokens(c);u.push(...p)}let d=i+1;const f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){const p=Math.min(...f.map(m=>m.indent)),h=dM(f,p,n);u.push({type:"list",ordered:!0,start:f[0].number,items:h,raw:f.map(m=>m.raw).join(`
218
- `)})}o.push({type:"list_item",raw:s.raw,tokens:u}),i=d}else i+=1}return o}function _j(e,t){return e.map(n=>{if(n.type!=="list_item")return t.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(o=>{if(o.type==="paragraph"||o.type==="list"||o.type==="blockquote"||o.type==="code")r.push(...t.parseChildren([o]));else if(o.type==="text"&&o.tokens){const i=t.parseChildren([o]);r.push({type:"paragraph",content:i})}else{const i=t.parseChildren([o]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var $j="listItem",zw="textStyle",jw=/^(\d+)\.\s$/,fM=Zt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",Qe(this.options.HTMLAttributes,n),0]:["ol",Qe(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{if(e.type!=="list"||!e.ordered)return[];const n=e.start||1,r=e.items?_j(e.items,t):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
219
- `):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{const t=e.match(/^(\s*)(\d+)\.\s+/),n=t==null?void 0:t.index;return n!==void 0?n:-1},tokenize:(e,t,n)=>{var r;const o=e.split(`
220
- `),[i,s]=Lj(o);if(i.length===0)return;const l=dM(i,0,n);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:l,raw:o.slice(0,s).join(`
221
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes($j,this.editor.getAttributes(zw)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Es({find:jw,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Es({find:jw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(zw)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),zj=/^\s*(\[([( |x])?\])\s$/,jj=Zt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return t===""||t==="true"},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",Qe(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{const n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){const r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;const o=`- [${(n=e.attrs)!=null&&n.checked?"x":" "}] `;return Sy(e,t,o)},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),u=d=>{var f,p;l.ariaLabel=((p=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:p.call(f,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};u(e),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const h=n();if(typeof h!="number")return!1;const m=p.doc.nodeAt(h);return p.setNodeMarkup(h,void 0,{...m==null?void 0:m.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{o.setAttribute(d,f)}),o.dataset.checked=e.attrs.checked,l.checked=e.attrs.checked,i.append(l,s),o.append(i,a),Object.entries(t).forEach(([d,f])=>{o.setAttribute(d,f)});let c=new Set(Object.keys(t));return{dom:o,contentDOM:a,update:d=>{if(d.type!==this.type)return!1;o.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,u(d);const f=r.extensionManager.attributes,p=ca(d,f),h=new Set(Object.keys(p)),m=this.options.HTMLAttributes;return c.forEach(y=>{h.has(y)||(y in m?o.setAttribute(y,m[y]):o.removeAttribute(y))}),Object.entries(p).forEach(([y,g])=>{g==null?y in m?o.setAttribute(y,m[y]):o.removeAttribute(y):o.setAttribute(y,g)}),c=h,!0}}}},addInputRules(){return[Es({find:zj,type:this.type,getAttributes:e=>({checked:e[e.length-1]==="x"})})]}}),Fj=Zt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",Qe(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
222
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;const n=(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:t.index;return n!==void 0?n:-1},tokenize(e,t,n){const r=i=>{const s=mm(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(i)},o=mm(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});$e.create({name:"listKit",addExtensions(){const e=[];return this.options.bulletList!==!1&&e.push(rM.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(oM.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(cM.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(fM.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(jj.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Fj.configure(this.options.taskList)),e}});var Fw="&nbsp;",Bj=" ",Vj=Zt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",Qe(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const n=e.tokens||[];if(n.length===1&&n[0].type==="image")return t.parseChildren([n[0]]);const r=t.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===Fw||r[0].text===Bj)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,r)},renderMarkdown:(e,t)=>{if(!e)return"";const n=Array.isArray(e.content)?e.content:[];return n.length===0?Fw:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Hj=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Uj=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Wj=mi.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",Qe(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Cs({find:Hj,type:this.type})]},addPasteRules(){return[ii({find:Uj,type:this.type})]}}),Gj=Zt.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),qj=mi.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",Qe(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,t,n){const o=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!o)return;const i=o[2].trim();return{type:"underline",raw:o[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Kj(e={}){return new Ie({view(t){return new Jj(t,e)}})}class Jj{constructor(t,n){var r;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return t.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,l=i.height/o.offsetHeight;if(n){let d=t.nodeBefore,f=t.nodeAfter;if(d||f){let p=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(p){let h=p.getBoundingClientRect(),m=d?h.bottom:h.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:h.left,right:h.right,top:m-y,bottom:m+y}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,c;if(!a||a==document.body&&getComputedStyle(a).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,p=d.height/a.offsetHeight;u=d.left-a.scrollLeft*f,c=d.top-a.scrollTop*p}this.element.style.left=(r.left-u)/s+"px",this.element.style.top=(r.top-c)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,t):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Ab(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}class Ue extends ce{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return Ue.valid(r)?new Ue(r):ce.near(r)}content(){return B.empty}eq(t){return t instanceof Ue&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Ue(t.resolve(n.pos))}getBookmark(){return new Uy(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!Qj(t)||!Xj(t))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(t.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(t,n,r=!1){e:for(;;){if(!r&&Ue.valid(t))return t;let o=t.pos,i=null;for(let s=t.depth;;s--){let l=t.node(s);if(n>0?t.indexAfter(s)<l.childCount:t.index(s)>0){i=l.child(n>0?t.indexAfter(s):t.index(s)-1);break}else if(s==0)return null;o+=n;let a=t.doc.resolve(o);if(Ue.valid(a))return a}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!ee.isSelectable(i)){t=t.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let l=t.doc.resolve(o);if(Ue.valid(l))return l}return null}}}Ue.prototype.visible=!1;Ue.findFrom=Ue.findGapCursorFrom;ce.jsonID("gapcursor",Ue);class Uy{constructor(t){this.pos=t}map(t){return new Uy(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return Ue.valid(n)?new Ue(n):ce.near(n)}}function pM(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Qj(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||pM(o.type))return!0;if(o.inlineContent)return!1}}return!0}function Xj(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||pM(o.type))return!0;if(o.inlineContent)return!1}}return!0}function Yj(){return new Ie({props:{decorations:nF,createSelectionBetween(e,t,n){return t.pos==n.pos&&Ue.valid(n)?new Ue(n):null},handleClick:eF,handleKeyDown:Zj,handleDOMEvents:{beforeinput:tF}}})}const Zj=cy({ArrowLeft:gu("horiz",-1),ArrowRight:gu("horiz",1),ArrowUp:gu("vert",-1),ArrowDown:gu("vert",1)});function gu(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,o,i){let s=r.selection,l=t>0?s.$to:s.$from,a=s.empty;if(s instanceof de){if(!i.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(t>0?l.after():l.before())}let u=Ue.findGapCursorFrom(l,t,a);return u?(o&&o(r.tr.setSelection(new Ue(u))),!0):!1}}function eF(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Ue.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&ee.isSelectable(e.state.doc.nodeAt(o.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Ue(r))),!0)}function tF(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof Ue))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=_.empty;for(let s=r.length-1;s>=0;s--)o=_.from(r[s].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new B(o,0,0));return i.setSelection(de.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function nF(e){if(!(e.selection instanceof Ue))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",je.create(e.doc,[Ct.widget(e.selection.head,t,{key:"gapcursor"})])}var yd=200,lt=function(){};lt.prototype.append=function(t){return t.length?(t=lt.from(t),!this.length&&t||t.length<yd&&this.leafAppend(t)||this.length<yd&&t.leafPrepend(this)||this.appendInner(t)):this};lt.prototype.prepend=function(t){return t.length?lt.from(t).append(this):this};lt.prototype.appendInner=function(t){return new rF(this,t)};lt.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?lt.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};lt.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};lt.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};lt.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(t(i,s))},n,r),o};lt.from=function(t){return t instanceof lt?t:t&&t.length?new hM(t):lt.empty};var hM=function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new t(this.values.slice(o,i))},t.prototype.getInner=function(o){return this.values[o]},t.prototype.forEachInner=function(o,i,s,l){for(var a=i;a<s;a++)if(o(this.values[a],l+a)===!1)return!1},t.prototype.forEachInvertedInner=function(o,i,s,l){for(var a=i-1;a>=s;a--)if(o(this.values[a],l+a)===!1)return!1},t.prototype.leafAppend=function(o){if(this.length+o.length<=yd)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=yd)return new t(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(lt);lt.empty=new hM([]);var rF=function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,o,i,s){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},t.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(o,l),i,s)===!1)return!1},t.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},t.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new t(this.left,o)},t.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new t(o,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(lt);const oF=500;class Mn{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=t.tr,l,a,u=[],c=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,c.push(d);return}if(o){c.push(new Bn(d.map));let p=d.step.map(o.slice(i)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],u.push(new Bn(h,void 0,void 0,u.length+c.length))),i--,h&&o.appendMap(h,i)}else s.maybeStep(d.step);if(d.selection)return l=o?d.selection.map(o.slice(i)):d.selection,a=new Mn(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(t,n,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let c=0;c<t.steps.length;c++){let d=t.steps[c].invert(t.docs[c]),f=new Bn(t.mapping.maps[c],d,n),p;(p=a&&a.merge(f))&&(f=p,c?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(s++,n=void 0),o||(a=f)}let u=s-r.depth;return u>sF&&(l=iF(l,u),s-=u),new Mn(l.append(i),s)}remapping(t,n){let r=new oa;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=t?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},t,n),r}addMaps(t){return this.eventCount==0?this:new Mn(this.items.append(t.map(n=>new Bn(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=t.mapping,s=t.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=n;this.items.forEach(f=>{let p=i.getMirror(--a);if(p==null)return;s=Math.min(s,p);let h=i.maps[p];if(f.step){let m=t.steps[p].invert(t.docs[p]),y=f.selection&&f.selection.map(i.slice(a+1,p));y&&l++,r.push(new Bn(h,m,y))}else r.push(new Bn(h))},o);let u=[];for(let f=n;f<s;f++)u.push(new Bn(i.maps[f]));let c=this.items.slice(0,o).append(u).append(r),d=new Mn(c,l);return d.emptyItemCount()>oF&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=t)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(n.slice(r)),u=a&&a.getMap();if(r--,u&&n.appendMap(u,r),a){let c=s.selection&&s.selection.map(n.slice(r));c&&i++;let d=new Bn(u.invert(),a,c),f,p=o.length-1;(f=o.length&&o[p].merge(d))?o[p]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new Mn(lt.from(o.reverse()),i)}}Mn.empty=new Mn(lt.empty,0);function iF(e,t){let n;return e.forEach((r,o)=>{if(r.selection&&t--==0)return n=o,!1}),e.slice(n)}class Bn{constructor(t,n,r,o){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=o}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new Bn(n.getMap().invert(),n,this.selection)}}}class Ur{constructor(t,n,r,o,i){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const sF=20;function lF(e,t,n,r){let o=n.getMeta(Jo),i;if(o)return o.historyState;n.getMeta(cF)&&(e=new Ur(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(s&&s.getMeta(Jo))return s.getMeta(Jo).redo?new Ur(e.done.addTransform(n,void 0,r,Ku(t)),e.undone,Bw(n.mapping.maps),e.prevTime,e.prevComposition):new Ur(e.done,e.undone.addTransform(n,void 0,r,Ku(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=e.prevTime==0||!s&&e.prevComposition!=l&&(e.prevTime<(n.time||0)-r.newGroupDelay||!aF(n,e.prevRanges)),u=s?Pp(e.prevRanges,n.mapping):Bw(n.mapping.maps);return new Ur(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,Ku(t)),Mn.empty,u,n.time,l??e.prevComposition)}else return(i=n.getMeta("rebased"))?new Ur(e.done.rebased(n,i),e.undone.rebased(n,i),Pp(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Ur(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Pp(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function aF(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<t.length;i+=2)r<=t[i+1]&&o>=t[i]&&(n=!0)}),n}function Bw(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,o,i,s)=>t.push(i,s));return t}function Pp(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}function uF(e,t,n){let r=Ku(t),o=Jo.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),a=new Ur(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(Jo,{redo:n,historyState:a})}let Ip=!1,Vw=null;function Ku(e){let t=e.plugins;if(Vw!=t){Ip=!1,Vw=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){Ip=!0;break}}return Ip}const Jo=new _e("history"),cF=new _e("closeHistory");function dF(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Ie({key:Jo,state:{init(){return new Ur(Mn.empty,Mn.empty,null,0,-1)},apply(t,n,r){return lF(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,o=r=="historyUndo"?gM:r=="historyRedo"?yM:null;return!o||!t.editable?!1:(n.preventDefault(),o(t.state,t.dispatch))}}}})}function mM(e,t){return(n,r)=>{let o=Jo.getState(n);if(!o||(e?o.undone:o.done).eventCount==0)return!1;if(r){let i=uF(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const gM=mM(!1,!0),yM=mM(!0,!0);$e.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(t=>t!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{const t=(e==null?void 0:e.node)||this.editor.state.doc;if(((e==null?void 0:e.mode)||this.options.mode)==="textSize"){const r=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(r)}return t.nodeSize},this.storage.words=e=>{const t=(e==null?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Ie({key:new _e("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;const o=this.options.limit;if(o==null||o===0){e=!0;return}const i=this.storage.characters({node:r.doc});if(i>o){const s=i-o,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(l,a);return e=!0,u}e=!0},filterTransaction:(t,n)=>{const r=this.options.limit;if(!t.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:n.doc}),i=this.storage.characters({node:t.doc});if(i<=r||o>r&&i>r&&i<=o)return!0;if(o>r&&i>r&&i>o||!t.getMeta("paste"))return!1;const l=t.selection.$head.pos,a=i-r,u=l-a,c=l;return t.deleteRange(u,c),!(this.storage.characters({node:t.doc})>r)}})]}});var fF=$e.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Kj(this.options)]}});$e.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ie({key:new _e("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=t,i=[];if(!n||!r)return je.create(e,[]);let s=0;this.options.mode==="deepest"&&e.descendants((a,u)=>{if(a.isText)return;if(!(o>=u&&o<=u+a.nodeSize-1))return!1;s+=1});let l=0;return e.descendants((a,u)=>{if(a.isText||!(o>=u&&o<=u+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(Ct.node(u,u+a.nodeSize,{class:this.options.className}))}),je.create(e,i)}}})]}});var pF=$e.create({name:"gapCursor",addProseMirrorPlugins(){return[Yj()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=Se(Q(e,"allowGapCursor",n)))!=null?t:null}}}),Hw="placeholder";function hF(e){return e.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}$e.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Hw,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const e=this.options.dataAttribute?`data-${hF(this.options.dataAttribute)}`:`data-${Hw}`;return[new Ie({key:new _e("placeholder"),props:{decorations:({doc:t,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=n,i=[];if(!r)return null;const s=this.editor.isEmpty;return t.descendants((l,a)=>{const u=o>=a&&o<=a+l.nodeSize,c=!l.isLeaf&&ef(l);if((u||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const f=Ct.node(a,a+l.nodeSize,{class:d.join(" "),[e]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:a,hasAnchor:u}):this.options.placeholder});i.push(f)}return this.options.includeChildren}),je.create(t,i)}}})]}});$e.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new Ie({key:new _e("selection"),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||WC(n.selection)||e.view.dragging?null:je.create(n.doc,[Ct.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function Uw({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(t==null?void 0:t.type)===e}var mF=$e.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var e;const t=new _e(this.name),n=this.options.node||((e=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(n).includes(o.name));return[new Ie({key:t,appendTransaction:(o,i,s)=>{const{doc:l,tr:a,schema:u}=s,c=t.getState(s),d=l.content.size,f=u.nodes[n];if(c)return a.insert(d,f.create())},state:{init:(o,i)=>{const s=i.tr.doc.lastChild;return!Uw({node:s,types:r})},apply:(o,i)=>{if(!o.docChanged||o.getMeta("__uniqueIDTransaction"))return i;const s=o.doc.lastChild;return!Uw({node:s,types:r})}}})]}}),gF=$e.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>gM(e,t),redo:()=>({state:e,dispatch:t})=>yM(e,t)}},addProseMirrorPlugins(){return[dF(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),yF=$e.create({name:"starterKit",addExtensions(){var e,t,n,r;const o=[];return this.options.bold!==!1&&o.push(Vz.configure(this.options.bold)),this.options.blockquote!==!1&&o.push($z.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(rM.configure(this.options.bulletList)),this.options.code!==!1&&o.push(Wz.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(Kz.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(Jz.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(fF.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(pF.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(Qz.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(Xz.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(gF.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(Yz.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(rj.configure(this.options.italic)),this.options.listItem!==!1&&o.push(oM.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(cM.configure((e=this.options)==null?void 0:e.listKeymap)),this.options.link!==!1&&o.push(Tj.configure((t=this.options)==null?void 0:t.link)),this.options.orderedList!==!1&&o.push(fM.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(Vj.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(Wj.configure(this.options.strike)),this.options.text!==!1&&o.push(Gj.configure(this.options.text)),this.options.underline!==!1&&o.push(qj.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&o.push(mF.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),vF=yF;function Wy(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var yi=Wy();function vM(e){yi=e}var Ll={exec:()=>null};function xe(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(o,i)=>{let s=typeof i=="string"?i:i.source;return s=s.replace(Et.caret,"$1"),n=n.replace(o,s),r},getRegex:()=>new RegExp(n,t)};return r}var xF=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Et={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},wF=/^(?:[ \t]*(?:\n|$))+/,kF=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,SF=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ta=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,bF=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Gy=/(?:[*+-]|\d{1,9}[.)])/,xM=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,wM=xe(xM).replace(/bull/g,Gy).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),CF=xe(xM).replace(/bull/g,Gy).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),qy=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,EF=/^[^\n]+/,Ky=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,MF=xe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ky).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),RF=xe(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Gy).getRegex(),ff="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Jy=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,TF=xe("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Jy).replace("tag",ff).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),kM=xe(qy).replace("hr",Ta).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ff).getRegex(),NF=xe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",kM).getRegex(),Qy={blockquote:NF,code:kF,def:MF,fences:SF,heading:bF,hr:Ta,html:TF,lheading:wM,list:RF,newline:wF,paragraph:kM,table:Ll,text:EF},Ww=xe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ta).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ff).getRegex(),AF={...Qy,lheading:CF,table:Ww,paragraph:xe(qy).replace("hr",Ta).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ww).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ff).getRegex()},OF={...Qy,html:xe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Jy).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ll,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:xe(qy).replace("hr",Ta).replace("heading",` *#{1,6} *[^
223
- ]`).replace("lheading",wM).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},PF=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,IF=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,SM=/^( {2,}|\\)\n(?!\s*$)/,DF=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,pf=/[\p{P}\p{S}]/u,Xy=/[\s\p{P}\p{S}]/u,bM=/[^\s\p{P}\p{S}]/u,LF=xe(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Xy).getRegex(),CM=/(?!~)[\p{P}\p{S}]/u,_F=/(?!~)[\s\p{P}\p{S}]/u,$F=/(?:[^\s\p{P}\p{S}]|~)/u,zF=xe(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",xF?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),EM=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,jF=xe(EM,"u").replace(/punct/g,pf).getRegex(),FF=xe(EM,"u").replace(/punct/g,CM).getRegex(),MM="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",BF=xe(MM,"gu").replace(/notPunctSpace/g,bM).replace(/punctSpace/g,Xy).replace(/punct/g,pf).getRegex(),VF=xe(MM,"gu").replace(/notPunctSpace/g,$F).replace(/punctSpace/g,_F).replace(/punct/g,CM).getRegex(),HF=xe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,bM).replace(/punctSpace/g,Xy).replace(/punct/g,pf).getRegex(),UF=xe(/\\(punct)/,"gu").replace(/punct/g,pf).getRegex(),WF=xe(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),GF=xe(Jy).replace("(?:-->|$)","-->").getRegex(),qF=xe("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",GF).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),vd=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,KF=xe(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",vd).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),RM=xe(/^!?\[(label)\]\[(ref)\]/).replace("label",vd).replace("ref",Ky).getRegex(),TM=xe(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ky).getRegex(),JF=xe("reflink|nolink(?!\\()","g").replace("reflink",RM).replace("nolink",TM).getRegex(),Gw=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Yy={_backpedal:Ll,anyPunctuation:UF,autolink:WF,blockSkip:zF,br:SM,code:IF,del:Ll,emStrongLDelim:jF,emStrongRDelimAst:BF,emStrongRDelimUnd:HF,escape:PF,link:KF,nolink:TM,punctuation:LF,reflink:RM,reflinkSearch:JF,tag:qF,text:DF,url:Ll},QF={...Yy,link:xe(/^!?\[(label)\]\((.*?)\)/).replace("label",vd).getRegex(),reflink:xe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",vd).getRegex()},Om={...Yy,emStrongRDelimAst:VF,emStrongLDelim:FF,url:xe(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Gw).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:xe(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Gw).getRegex()},XF={...Om,br:xe(SM).replace("{2,}","*").getRegex(),text:xe(Om.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},yu={normal:Qy,gfm:AF,pedantic:OF},el={normal:Yy,gfm:Om,breaks:XF,pedantic:QF},YF={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},qw=e=>YF[e];function lr(e,t){if(t){if(Et.escapeTest.test(e))return e.replace(Et.escapeReplace,qw)}else if(Et.escapeTestNoEncode.test(e))return e.replace(Et.escapeReplaceNoEncode,qw);return e}function Kw(e){try{e=encodeURI(e).replace(Et.percentDecode,"%")}catch{return null}return e}function Jw(e,t){var i;let n=e.replace(Et.findPipe,(s,l,a)=>{let u=!1,c=l;for(;--c>=0&&a[c]==="\\";)u=!u;return u?"|":" |"}),r=n.split(Et.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(Et.slashPipe,"|");return r}function tl(e,t,n){let r=e.length;if(r===0)return"";let o=0;for(;o<r&&e.charAt(r-o-1)===t;)o++;return e.slice(0,r-o)}function ZF(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Qw(e,t,n,r,o){let i=t.href,s=t.title||null,l=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let a={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:s,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,a}function e3(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
224
- `).map(i=>{let s=i.match(n.other.beginningSpace);if(s===null)return i;let[l]=s;return l.length>=o.length?i.slice(o.length):i}).join(`
225
- `)}var xd=class{constructor(e){Ee(this,"options");Ee(this,"rules");Ee(this,"lexer");this.options=e||yi}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:tl(n,`
226
- `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=e3(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=tl(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:tl(t[0],`
227
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=tl(t[0],`
228
- `).split(`
229
- `),r="",o="",i=[];for(;n.length>0;){let s=!1,l=[],a;for(a=0;a<n.length;a++)if(this.rules.other.blockquoteStart.test(n[a]))l.push(n[a]),s=!0;else if(!s)l.push(n[a]);else break;n=n.slice(a);let u=l.join(`
230
- `),c=u.replace(this.rules.other.blockquoteSetextReplace,`
231
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
232
- ${u}`:u,o=o?`${o}
233
- ${c}`:c;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=d,n.length===0)break;let f=i.at(-1);if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){let p=f,h=p.raw+`
234
- `+n.join(`
235
- `),m=this.blockquote(h);i[i.length-1]=m,r=r.substring(0,r.length-p.raw.length)+m.raw,o=o.substring(0,o.length-p.text.length)+m.text;break}else if((f==null?void 0:f.type)==="list"){let p=f,h=p.raw+`
236
- `+n.join(`
237
- `),m=this.list(h);i[i.length-1]=m,r=r.substring(0,r.length-f.raw.length)+m.raw,o=o.substring(0,o.length-p.raw.length)+m.raw,n=h.substring(i.at(-1).raw.length).split(`
238
- `);continue}}return{type:"blockquote",raw:r,tokens:i,text:o}}}list(e){var n,r;let t=this.rules.block.list.exec(e);if(t){let o=t[1].trim(),i=o.length>1,s={type:"list",raw:"",ordered:i,start:i?+o.slice(0,-1):"",loose:!1,items:[]};o=i?`\\d{1,9}\\${o.slice(-1)}`:`\\${o}`,this.options.pedantic&&(o=i?o:"[*+-]");let l=this.rules.other.listItemRegex(o),a=!1;for(;e;){let c=!1,d="",f="";if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let p=t[2].split(`
239
- `,1)[0].replace(this.rules.other.listReplaceTabs,g=>" ".repeat(3*g.length)),h=e.split(`
240
- `,1)[0],m=!p.trim(),y=0;if(this.options.pedantic?(y=2,f=p.trimStart()):m?y=t[1].length+1:(y=t[2].search(this.rules.other.nonSpaceChar),y=y>4?1:y,f=p.slice(y),y+=t[1].length),m&&this.rules.other.blankLine.test(h)&&(d+=h+`
241
- `,e=e.substring(h.length+1),c=!0),!c){let g=this.rules.other.nextBulletRegex(y),v=this.rules.other.hrRegex(y),k=this.rules.other.fencesBeginRegex(y),S=this.rules.other.headingBeginRegex(y),b=this.rules.other.htmlBeginRegex(y);for(;e;){let E=e.split(`
242
- `,1)[0],M;if(h=E,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),M=h):M=h.replace(this.rules.other.tabCharGlobal," "),k.test(h)||S.test(h)||b.test(h)||g.test(h)||v.test(h))break;if(M.search(this.rules.other.nonSpaceChar)>=y||!h.trim())f+=`
243
- `+M.slice(y);else{if(m||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||k.test(p)||S.test(p)||v.test(p))break;f+=`
244
- `+h}!m&&!h.trim()&&(m=!0),d+=E+`
245
- `,e=e.substring(E.length+1),p=M.slice(y)}}s.loose||(a?s.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(a=!0)),s.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(f),loose:!1,text:f,tokens:[]}),s.raw+=d}let u=s.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let c of s.items){if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),c.task){if(c.text=c.text.replace(this.rules.other.listReplaceTask,""),((n=c.tokens[0])==null?void 0:n.type)==="text"||((r=c.tokens[0])==null?void 0:r.type)==="paragraph"){c.tokens[0].raw=c.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),c.tokens[0].text=c.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}}let d=this.rules.other.listTaskCheckbox.exec(c.raw);if(d){let f={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};c.checked=f.checked,s.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=f.raw+c.tokens[0].raw,c.tokens[0].text=f.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(f)):c.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):c.tokens.unshift(f)}}if(!s.loose){let d=c.tokens.filter(p=>p.type==="space"),f=d.length>0&&d.some(p=>this.rules.other.anyLine.test(p.raw));s.loose=f}}if(s.loose)for(let c of s.items){c.loose=!0;for(let d of c.tokens)d.type==="text"&&(d.type="paragraph")}return s}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:r,title:o}}}table(e){var s;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Jw(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(s=t[3])!=null&&s.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
246
- `):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let l of r)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<n.length;l++)i.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:i.align[l]});for(let l of o)i.rows.push(Jw(l,i.header.length).map((a,u)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:i.align[u]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
247
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=tl(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=ZF(t[2],"()");if(i===-2)return;if(i>-1){let s=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,s).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],o=i[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Qw(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[r.toLowerCase()];if(!o){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return Qw(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,s,l=o,a=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+o);(r=u.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(s=[...i].length,r[3]||r[4]){l+=s;continue}else if((r[5]||r[6])&&o%3&&!((o+s)%3)){a+=s;continue}if(l-=s,l>0)continue;s=Math.min(s,s+l+a);let c=[...r[0]][0].length,d=e.slice(0,o+r.index+c+s);if(Math.min(o,s)%2){let p=d.slice(1,-1);return{type:"em",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}let f=d.slice(2,-2);return{type:"strong",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let r,o;if(t[2]==="@")r=t[0],o="mailto:"+r;else{let i;do i=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(i!==t[0]);r=t[0],t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Cn=class Pm{constructor(t){Ee(this,"tokens");Ee(this,"options");Ee(this,"state");Ee(this,"inlineQueue");Ee(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||yi,this.options.tokenizer=this.options.tokenizer||new xd,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Et,block:yu.normal,inline:el.normal};this.options.pedantic?(n.block=yu.pedantic,n.inline=el.pedantic):this.options.gfm&&(n.block=yu.gfm,this.options.breaks?n.inline=el.breaks:n.inline=el.gfm),this.tokenizer.rules=n}static get rules(){return{block:yu,inline:el}}static lex(t,n){return new Pm(n).lex(t)}static lexInline(t,n){return new Pm(n).inlineTokens(t)}lex(t){t=t.replace(Et.carriageReturn,`
248
- `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var o,i,s;for(this.options.pedantic&&(t=t.replace(Et.tabCharGlobal," ").replace(Et.spaceLine,""));t;){let l;if((i=(o=this.options.extensions)==null?void 0:o.block)!=null&&i.some(u=>(l=u.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);let u=n.at(-1);l.raw.length===1&&u!==void 0?u.raw+=`
249
- `:n.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
250
- `)?"":`
251
- `)+l.raw,u.text+=`
252
- `+l.text,this.inlineQueue.at(-1).src=u.text):n.push(l);continue}if(l=this.tokenizer.fences(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.heading(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.hr(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.blockquote(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.list(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.html(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.def(t)){t=t.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
253
- `)?"":`
254
- `)+l.raw,u.text+=`
255
- `+l.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},n.push(l));continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),n.push(l);continue}let a=t;if((s=this.options.extensions)!=null&&s.startBlock){let u=1/0,c=t.slice(1),d;this.options.extensions.startBlock.forEach(f=>{d=f.call({lexer:this},c),typeof d=="number"&&d>=0&&(u=Math.min(u,d))}),u<1/0&&u>=0&&(a=t.substring(0,u+1))}if(this.state.top&&(l=this.tokenizer.paragraph(a))){let u=n.at(-1);r&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=(u.raw.endsWith(`
256
- `)?"":`
257
- `)+l.raw,u.text+=`
258
- `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(l),r=a.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
259
- `)?"":`
260
- `)+l.raw,u.text+=`
261
- `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(l);continue}if(t){let u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var a,u,c,d,f;let r=t,o=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)p.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,o.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(o=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)i=o[2]?o[2].length:0,r=r.slice(0,o.index+i)+"["+"a".repeat(o[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((u=(a=this.options.hooks)==null?void 0:a.emStrongMask)==null?void 0:u.call({lexer:this},r))??r;let s=!1,l="";for(;t;){s||(l=""),s=!1;let p;if((d=(c=this.options.extensions)==null?void 0:c.inline)!=null&&d.some(m=>(p=m.call({lexer:this},t,n))?(t=t.substring(p.raw.length),n.push(p),!0):!1))continue;if(p=this.tokenizer.escape(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.tag(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.link(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(p.raw.length);let m=n.at(-1);p.type==="text"&&(m==null?void 0:m.type)==="text"?(m.raw+=p.raw,m.text+=p.text):n.push(p);continue}if(p=this.tokenizer.emStrong(t,r,l)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.codespan(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.br(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.del(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.autolink(t)){t=t.substring(p.raw.length),n.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(t))){t=t.substring(p.raw.length),n.push(p);continue}let h=t;if((f=this.options.extensions)!=null&&f.startInline){let m=1/0,y=t.slice(1),g;this.options.extensions.startInline.forEach(v=>{g=v.call({lexer:this},y),typeof g=="number"&&g>=0&&(m=Math.min(m,g))}),m<1/0&&m>=0&&(h=t.substring(0,m+1))}if(p=this.tokenizer.inlineText(h)){t=t.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(l=p.raw.slice(-1)),s=!0;let m=n.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=p.raw,m.text+=p.text):n.push(p);continue}if(t){let m="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return n}},wd=class{constructor(t){Ee(this,"options");Ee(this,"parser");this.options=t||yi}space(t){return""}code({text:t,lang:n,escaped:r}){var s;let o=(s=(n||"").match(Et.notSpaceStart))==null?void 0:s[0],i=t.replace(Et.endingNewline,"")+`
262
- `;return o?'<pre><code class="language-'+lr(o)+'">'+(r?i:lr(i,!0))+`</code></pre>
263
- `:"<pre><code>"+(r?i:lr(i,!0))+`</code></pre>
264
- `}blockquote({tokens:t}){return`<blockquote>
265
- ${this.parser.parse(t)}</blockquote>
266
- `}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:n}){return`<h${n}>${this.parser.parseInline(t)}</h${n}>
267
- `}hr(t){return`<hr>
268
- `}list(t){let n=t.ordered,r=t.start,o="";for(let l=0;l<t.items.length;l++){let a=t.items[l];o+=this.listitem(a)}let i=n?"ol":"ul",s=n&&r!==1?' start="'+r+'"':"";return"<"+i+s+`>
269
- `+o+"</"+i+`>
270
- `}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
271
- `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
272
- `}table(t){let n="",r="";for(let i=0;i<t.header.length;i++)r+=this.tablecell(t.header[i]);n+=this.tablerow({text:r});let o="";for(let i=0;i<t.rows.length;i++){let s=t.rows[i];r="";for(let l=0;l<s.length;l++)r+=this.tablecell(s[l]);o+=this.tablerow({text:r})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
273
- <thead>
274
- `+n+`</thead>
275
- `+o+`</table>
276
- `}tablerow({text:t}){return`<tr>
277
- ${t}</tr>
278
- `}tablecell(t){let n=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+n+`</${r}>
279
- `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${lr(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:n,tokens:r}){let o=this.parser.parseInline(r),i=Kw(t);if(i===null)return o;t=i;let s='<a href="'+t+'"';return n&&(s+=' title="'+lr(n)+'"'),s+=">"+o+"</a>",s}image({href:t,title:n,text:r,tokens:o}){o&&(r=this.parser.parseInline(o,this.parser.textRenderer));let i=Kw(t);if(i===null)return lr(r);t=i;let s=`<img src="${t}" alt="${r}"`;return n&&(s+=` title="${lr(n)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:lr(t.text)}},Zy=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},En=class Im{constructor(t){Ee(this,"options");Ee(this,"renderer");Ee(this,"textRenderer");this.options=t||yi,this.options.renderer=this.options.renderer||new wd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Zy}static parse(t,n){return new Im(n).parse(t)}static parseInline(t,n){return new Im(n).parseInline(t)}parse(t){var r,o;let n="";for(let i=0;i<t.length;i++){let s=t[i];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[s.type]){let a=s,u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){n+=u||"";continue}}let l=s;switch(l.type){case"space":{n+=this.renderer.space(l);break}case"hr":{n+=this.renderer.hr(l);break}case"heading":{n+=this.renderer.heading(l);break}case"code":{n+=this.renderer.code(l);break}case"table":{n+=this.renderer.table(l);break}case"blockquote":{n+=this.renderer.blockquote(l);break}case"list":{n+=this.renderer.list(l);break}case"checkbox":{n+=this.renderer.checkbox(l);break}case"html":{n+=this.renderer.html(l);break}case"def":{n+=this.renderer.def(l);break}case"paragraph":{n+=this.renderer.paragraph(l);break}case"text":{n+=this.renderer.text(l);break}default:{let a='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(t,n=this.renderer){var o,i;let r="";for(let s=0;s<t.length;s++){let l=t[s];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[l.type]){let u=this.options.extensions.renderers[l.type].call({parser:this},l);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){r+=u||"";continue}}let a=l;switch(a.type){case"escape":{r+=n.text(a);break}case"html":{r+=n.html(a);break}case"link":{r+=n.link(a);break}case"image":{r+=n.image(a);break}case"checkbox":{r+=n.checkbox(a);break}case"strong":{r+=n.strong(a);break}case"em":{r+=n.em(a);break}case"codespan":{r+=n.codespan(a);break}case"br":{r+=n.br(a);break}case"del":{r+=n.del(a);break}case"text":{r+=n.text(a);break}default:{let u='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}},Au,ml=(Au=class{constructor(e){Ee(this,"options");Ee(this,"block");this.options=e||yi}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Cn.lex:Cn.lexInline}provideParser(){return this.block?En.parse:En.parseInline}},Ee(Au,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Ee(Au,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Au),t3=class{constructor(...t){Ee(this,"defaults",Wy());Ee(this,"options",this.setOptions);Ee(this,"parse",this.parseMarkdown(!0));Ee(this,"parseInline",this.parseMarkdown(!1));Ee(this,"Parser",En);Ee(this,"Renderer",wd);Ee(this,"TextRenderer",Zy);Ee(this,"Lexer",Cn);Ee(this,"Tokenizer",xd);Ee(this,"Hooks",ml);this.use(...t)}walkTokens(t,n){var o,i;let r=[];for(let s of t)switch(r=r.concat(n.call(this,s)),s.type){case"table":{let l=s;for(let a of l.header)r=r.concat(this.walkTokens(a.tokens,n));for(let a of l.rows)for(let u of a)r=r.concat(this.walkTokens(u.tokens,n));break}case"list":{let l=s;r=r.concat(this.walkTokens(l.items,n));break}default:{let l=s;(i=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&i[l.type]?this.defaults.extensions.childTokens[l.type].forEach(a=>{let u=l[a].flat(1/0);r=r.concat(this.walkTokens(u,n))}):l.tokens&&(r=r.concat(this.walkTokens(l.tokens,n)))}}return r}use(...t){let n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{let o={...r};if(o.async=this.defaults.async||o.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=n.renderers[i.name];s?n.renderers[i.name]=function(...l){let a=i.renderer.apply(this,l);return a===!1&&(a=s.apply(this,l)),a}:n.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=n[i.level];s?s.unshift(i.tokenizer):n[i.level]=[i.tokenizer],i.start&&(i.level==="block"?n.startBlock?n.startBlock.push(i.start):n.startBlock=[i.start]:i.level==="inline"&&(n.startInline?n.startInline.push(i.start):n.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(n.childTokens[i.name]=i.childTokens)}),o.extensions=n),r.renderer){let i=this.defaults.renderer||new wd(this.defaults);for(let s in r.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let l=s,a=r.renderer[l],u=i[l];i[l]=(...c)=>{let d=a.apply(i,c);return d===!1&&(d=u.apply(i,c)),d||""}}o.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new xd(this.defaults);for(let s in r.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let l=s,a=r.tokenizer[l],u=i[l];i[l]=(...c)=>{let d=a.apply(i,c);return d===!1&&(d=u.apply(i,c)),d}}o.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new ml;for(let s in r.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let l=s,a=r.hooks[l],u=i[l];ml.passThroughHooks.has(s)?i[l]=c=>{if(this.defaults.async&&ml.passThroughHooksRespectAsync.has(s))return(async()=>{let f=await a.call(i,c);return u.call(i,f)})();let d=a.call(i,c);return u.call(i,d)}:i[l]=(...c)=>{if(this.defaults.async)return(async()=>{let f=await a.apply(i,c);return f===!1&&(f=await u.apply(i,c)),f})();let d=a.apply(i,c);return d===!1&&(d=u.apply(i,c)),d}}o.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,s=r.walkTokens;o.walkTokens=function(l){let a=[];return a.push(s.call(this,l)),i&&(a=a.concat(i.call(this,l))),a}}this.defaults={...this.defaults,...o}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return Cn.lex(t,n??this.defaults)}parser(t,n){return En.parse(t,n??this.defaults)}parseMarkdown(t){return(n,r)=>{let o={...r},i={...this.defaults,...o},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&o.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let l=i.hooks?await i.hooks.preprocess(n):n,a=await(i.hooks?await i.hooks.provideLexer():t?Cn.lex:Cn.lexInline)(l,i),u=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(u,i.walkTokens));let c=await(i.hooks?await i.hooks.provideParser():t?En.parse:En.parseInline)(u,i);return i.hooks?await i.hooks.postprocess(c):c})().catch(s);try{i.hooks&&(n=i.hooks.preprocess(n));let l=(i.hooks?i.hooks.provideLexer():t?Cn.lex:Cn.lexInline)(n,i);i.hooks&&(l=i.hooks.processAllTokens(l)),i.walkTokens&&this.walkTokens(l,i.walkTokens);let a=(i.hooks?i.hooks.provideParser():t?En.parse:En.parseInline)(l,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(l){return s(l)}}}onError(t,n){return r=>{if(r.message+=`
280
- Please report this to https://github.com/markedjs/marked.`,t){let o="<p>An error occurred:</p><pre>"+lr(r.message+"",!0)+"</pre>";return n?Promise.resolve(o):o}if(n)return Promise.reject(r);throw r}}},si=new t3;function be(e,t){return si.parse(e,t)}be.options=be.setOptions=function(e){return si.setOptions(e),be.defaults=si.defaults,vM(be.defaults),be};be.getDefaults=Wy;be.defaults=yi;be.use=function(...e){return si.use(...e),be.defaults=si.defaults,vM(be.defaults),be};be.walkTokens=function(e,t){return si.walkTokens(e,t)};be.parseInline=si.parseInline;be.Parser=En;be.parser=En.parse;be.Renderer=wd;be.TextRenderer=Zy;be.Lexer=Cn;be.lexer=Cn.lex;be.Tokenizer=xd;be.Hooks=ml;be.parse=be;be.options;be.setOptions;be.use;be.walkTokens;be.parseInline;En.parse;Cn.lex;function n3(e,t){const r=t.split(`
281
- `).flatMap(o=>[o,""]).map(o=>`${e}${o}`).join(`
282
- `);return r.slice(0,r.length-1)}function r3(e,t){const n=[];return Array.from(e.keys()).forEach(r=>{(!t||!t.marks||!t.marks.map(o=>o.type).includes(r))&&n.push(r)}),n}function o3(e,t){const n=[];return Array.from(t.entries()).forEach(([r,o])=>{e.has(r)||n.push({type:r,mark:o})}),n}function i3(e,t,n,r){const o=!n,i=n&&n.type==="text"&&(!n.marks||n.marks.length===0),s=n&&n.type==="text"&&n.marks&&!r(t,new Map(n.marks.map(a=>[a.type,a]))),l=[];if(o||i||s)if(n&&n.type==="text"&&n.marks){const a=new Map(n.marks.map(u=>[u.type,u]));Array.from(e.keys()).forEach(u=>{a.has(u)||l.push(u)})}else(o||i)&&l.push(...Array.from(e.keys()));return l}function s3(e,t){let n="";return Array.from(e.keys()).reverse().forEach(r=>{const o=e.get(r),i=t(r,o);i&&(n=i+n)}),e.clear(),n}function l3(e,t,n){let r="";return Array.from(e.entries()).forEach(([o,i])=>{const s=n(o,i);s&&(r+=s),t.set(o,i)}),r}function Dp(e){const n=(e.raw||e.text||"").match(/^(\s*)[-+*]\s+\[([ xX])\]\s+/);return n?{isTask:!0,checked:n[2].toLowerCase()==="x",indentLevel:n[1].length}:{isTask:!1,indentLevel:0}}function vu(e,t){return typeof e!="string"?"json":t}var a3=class{constructor(e){this.baseExtensions=[],this.extensions=[],this.lastParseResult=null;var t,n,r,o,i;this.markedInstance=(t=e==null?void 0:e.marked)!=null?t:be,this.lexer=new this.markedInstance.Lexer,this.indentStyle=(r=(n=e==null?void 0:e.indentation)==null?void 0:n.style)!=null?r:"space",this.indentSize=(i=(o=e==null?void 0:e.indentation)==null?void 0:o.size)!=null?i:2,this.baseExtensions=(e==null?void 0:e.extensions)||[],e!=null&&e.markedOptions&&typeof this.markedInstance.setOptions=="function"&&this.markedInstance.setOptions(e.markedOptions),this.registry=new Map,this.nodeTypeRegistry=new Map,e!=null&&e.extensions&&(this.baseExtensions=e.extensions,Zd(e.extensions).forEach(l=>this.registerExtension(l,!1))),this.lexer=new this.markedInstance.Lexer}get instance(){return this.markedInstance}get indentCharacter(){return this.indentStyle==="space"?" ":" "}get indentString(){return this.indentCharacter.repeat(this.indentSize)}hasMarked(){return!!this.markedInstance}registerExtension(e,t=!0){var n,r;this.extensions.push(e);const o=e.name,i=Q(e,"markdownTokenName")||o,s=Q(e,"parseMarkdown"),l=Q(e,"renderMarkdown"),a=Q(e,"markdownTokenizer"),u=(n=Q(e,"markdownOptions"))!=null?n:null,c=(r=u==null?void 0:u.indentsContent)!=null?r:!1,d={tokenName:i,nodeName:o,parseMarkdown:s,renderMarkdown:l,isIndenting:c,tokenizer:a};if(i&&s){const f=this.registry.get(i)||[];f.push(d),this.registry.set(i,f)}if(l){const f=this.nodeTypeRegistry.get(o)||[];f.push(d),this.nodeTypeRegistry.set(o,f)}a&&this.hasMarked()&&(this.registerTokenizer(a),t&&(this.lexer=new this.markedInstance.Lexer))}registerTokenizer(e){if(!this.hasMarked())return;const{name:t,start:n,level:r="inline",tokenize:o}=e,l={inlineTokens:c=>this.lexer.inlineTokens(c),blockTokens:c=>this.lexer.blockTokens(c)};let a;n?a=typeof n=="function"?n:c=>c.indexOf(n):a=c=>{const d=o(c,[],l);return d&&d.raw?c.indexOf(d.raw):-1};const u={name:t,level:r,start:a,tokenizer:(c,d)=>{const f=o(c,d,l);if(f&&f.type)return{...f,type:f.type||t,raw:f.raw||"",tokens:f.tokens||[]}},childTokens:[]};this.markedInstance.use({extensions:[u]})}getHandlersForToken(e){try{return this.registry.get(e)||[]}catch{return[]}}getHandlerForToken(e){const t=this.getHandlersForToken(e);if(t.length>0)return t[0];const n=this.getHandlersForNodeType(e);return n.length>0?n[0]:void 0}getHandlersForNodeType(e){try{return this.nodeTypeRegistry.get(e)||[]}catch{return[]}}serialize(e){return e?Array.isArray(e)?this.renderNodes(e,e):this.renderNodes(e,e):""}parse(e){if(!this.hasMarked())throw new Error("No marked instance available for parsing");const t=this.markedInstance.lexer(e);return{type:"doc",content:this.parseTokens(t)}}parseTokens(e){return e.map(t=>this.parseToken(t)).filter(t=>t!==null).flatMap(t=>Array.isArray(t)?t:[t])}parseToken(e){if(!e.type)return null;if(e.type==="list")return this.parseListToken(e);const t=this.getHandlersForToken(e.type),n=this.createParseHelpers();if(t.find(o=>{if(!o.parseMarkdown)return!1;const i=o.parseMarkdown(e,n),s=this.normalizeParseResult(i);return s&&(!Array.isArray(s)||s.length>0)?(this.lastParseResult=s,!0):!1})&&this.lastParseResult){const o=this.lastParseResult;return this.lastParseResult=null,o}return this.parseFallbackToken(e)}parseListToken(e){if(!e.items||e.items.length===0)return this.parseTokenWithHandlers(e);const t=e.items.some(l=>Dp(l).isTask),n=e.items.some(l=>!Dp(l).isTask);if(!t||!n||this.getHandlersForToken("taskList").length===0)return this.parseTokenWithHandlers(e);const r=[];let o=[],i=null;for(let l=0;l<e.items.length;l+=1){const a=e.items[l],{isTask:u,checked:c,indentLevel:d}=Dp(a);let f=a;if(u){const m=(a.raw||a.text||"").split(`
283
- `),y=m[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),g=y?y[2]:"";let v=[];if(m.length>1&&m.slice(1).join(`
284
- `).trim()){const S=m.slice(1),b=S.filter(E=>E.trim());if(b.length>0){const E=Math.min(...b.map(D=>D.length-D.trimStart().length)),R=S.map(D=>D.trim()?D.slice(E):"").join(`
285
- `).trim();R&&(v=this.markedInstance.lexer(`${R}
286
- `))}}f={type:"taskItem",raw:"",mainContent:g,indentLevel:d,checked:c??!1,text:g,tokens:this.lexer.inlineTokens(g),nestedTokens:v}}const p=u?"taskList":"list";i!==p?(o.length>0&&r.push({type:i,items:o}),o=[f],i=p):o.push(f)}o.length>0&&r.push({type:i,items:o});const s=[];for(let l=0;l<r.length;l+=1){const a=r[l],u={...e,type:a.type,items:a.items},c=this.parseToken(u);c&&(Array.isArray(c)?s.push(...c):s.push(c))}return s.length>0?s:null}parseTokenWithHandlers(e){if(!e.type)return null;const t=this.getHandlersForToken(e.type),n=this.createParseHelpers();if(t.find(o=>{if(!o.parseMarkdown)return!1;const i=o.parseMarkdown(e,n),s=this.normalizeParseResult(i);return s&&(!Array.isArray(s)||s.length>0)?(this.lastParseResult=s,!0):!1})&&this.lastParseResult){const o=this.lastParseResult;return this.lastParseResult=null,o}return this.parseFallbackToken(e)}createParseHelpers(){return{parseInline:e=>this.parseInlineTokens(e),parseChildren:e=>this.parseTokens(e),createTextNode:(e,t)=>({type:"text",text:e,marks:t||void 0}),createNode:(e,t,n)=>{const r={type:e,attrs:t||void 0,content:n||void 0};return(!t||Object.keys(t).length===0)&&delete r.attrs,r},applyMark:(e,t,n)=>({mark:e,content:t,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(e){var t,n,r,o;const i=[];for(let s=0;s<e.length;s+=1){const l=e[s];if(l.type==="text")i.push({type:"text",text:l.text||""});else if(l.type==="html"){const a=((n=(t=l.raw)!=null?t:l.text)!=null?n:"").toString(),u=/^<\/[\s]*[\w-]+/i.test(a),c=a.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!u&&c&&!/\/>$/.test(a)){const f=c[1],p=this.escapeRegex(f),h=new RegExp(`^<\\/\\s*${p}\\b`,"i");let m=-1;const y=[a];for(let g=s+1;g<e.length;g+=1){const v=e[g],k=((o=(r=v.raw)!=null?r:v.text)!=null?o:"").toString();if(y.push(k),v.type==="html"&&h.test(k)){m=g;break}}if(m!==-1){const g=y.join(""),v={type:"html",raw:g,text:g,block:!1},k=this.parseHTMLToken(v);if(k){const S=this.normalizeParseResult(k);Array.isArray(S)?i.push(...S):S&&i.push(S)}s=m;continue}}const d=this.parseHTMLToken(l);if(d){const f=this.normalizeParseResult(d);Array.isArray(f)?i.push(...f):f&&i.push(f)}}else if(l.type){const a=this.getHandlerForToken(l.type);if(a&&a.parseMarkdown){const u=this.createParseHelpers(),c=a.parseMarkdown(l,u);if(this.isMarkResult(c)){const d=this.applyMarkToContent(c.mark,c.content,c.attrs);i.push(...d)}else{const d=this.normalizeParseResult(c);Array.isArray(d)?i.push(...d):d&&i.push(d)}}else l.tokens&&i.push(...this.parseInlineTokens(l.tokens))}}return i}applyMarkToContent(e,t,n){return t.map(r=>{if(r.type==="text"){const o=r.marks||[],i=n?{type:e,attrs:n}:{type:e};return{...r,marks:[...o,i]}}return{...r,content:r.content?this.applyMarkToContent(e,r.content,n):void 0}})}isMarkResult(e){return e&&typeof e=="object"&&"mark"in e}normalizeParseResult(e){return e?this.isMarkResult(e)?e.content:e:null}parseFallbackToken(e){switch(e.type){case"paragraph":return{type:"paragraph",content:e.tokens?this.parseInlineTokens(e.tokens):[]};case"heading":return{type:"heading",attrs:{level:e.depth||1},content:e.tokens?this.parseInlineTokens(e.tokens):[]};case"text":return{type:"text",text:e.text||""};case"html":return this.parseHTMLToken(e);case"space":return null;default:return e.tokens?this.parseTokens(e.tokens):null}}parseHTMLToken(e){const t=e.text||e.raw||"";if(!t.trim())return null;if(typeof window>"u")return e.block?{type:"paragraph",content:[{type:"text",text:t}]}:{type:"text",text:t};try{const n=vL(t,this.baseExtensions);return n.type==="doc"&&n.content?e.block?n.content:n.content.length===1&&n.content[0].type==="paragraph"&&n.content[0].content?n.content[0].content:n.content:n}catch(n){throw new Error(`Failed to parse HTML in markdown: ${n}`)}}renderNodeToMarkdown(e,t,n=0,r=0){var o;if(e.type==="text")return e.text||"";if(!e.type)return"";const i=this.getHandlerForToken(e.type);if(!i)return"";const s={renderChildren:(u,c)=>{const d=i.isIndenting?r+1:r;return!Array.isArray(u)&&u.content?this.renderNodes(u.content,e,c||"",n,d):this.renderNodes(u,e,c||"",n,d)},indent:u=>this.indentString+u,wrapInBlock:n3},l={index:n,level:r,parentType:t==null?void 0:t.type,meta:{parentAttrs:t==null?void 0:t.attrs}};return((o=i.renderMarkdown)==null?void 0:o.call(i,e,s,l))||""}renderNodes(e,t,n="",r=0,o=0){return Array.isArray(e)?this.renderNodesWithMarkBoundaries(e,t,n,o):e.type?this.renderNodeToMarkdown(e,t,r,o):""}renderNodesWithMarkBoundaries(e,t,n="",r=0){const o=[],i=new Map;return e.forEach((s,l)=>{const a=l<e.length-1?e[l+1]:null;if(s.type)if(s.type==="text"){let u=s.text||"";const c=new Map((s.marks||[]).map(g=>[g.type,g])),d=o3(i,c),f=r3(c,a);let p="";if(f.length>0){const g=u.match(/(\s+)$/);g&&(p=g[1],u=u.slice(0,-p.length))}f.forEach(g=>{const v=c.get(g),k=this.getMarkClosing(g,v);k&&(u+=k),i.has(g)&&i.delete(g)});let h="";if(d.length>0){const g=u.match(/^(\s+)/);g&&(h=g[1],u=u.slice(h.length))}d.forEach(({type:g,mark:v})=>{const k=this.getMarkOpening(g,v);k&&(u=k+u),f.includes(g)||i.set(g,v)}),u=h+u;const m=i3(i,c,a,this.markSetsEqual.bind(this));let y="";if(m.length>0){const g=u.match(/(\s+)$/);g&&(y=g[1],u=u.slice(0,-y.length))}m.forEach(g=>{const v=i.get(g),k=this.getMarkClosing(g,v);k&&(u+=k),i.delete(g)}),u+=y,u+=p,o.push(u)}else{const u=new Map(i),c=s3(i,this.getMarkClosing.bind(this)),d=this.renderNodeToMarkdown(s,t,l,r),f=s.type==="hardBreak"?"":l3(u,i,this.getMarkOpening.bind(this));o.push(c+d+f)}}),o.join(n)}getMarkOpening(e,t){const n=this.getHandlersForNodeType(e),r=n.length>0?n[0]:void 0;if(!r||!r.renderMarkdown)return"";const o="__TIPTAP_MARKDOWN_PLACEHOLDER__",i={type:e,attrs:t.attrs||{},content:[{type:"text",text:o}]};try{const s=r.renderMarkdown(i,{renderChildren:()=>o,indent:a=>a,wrapInBlock:(a,u)=>a+u},{index:0,level:0,parentType:"text",meta:{}}),l=s.indexOf(o);return l>=0?s.substring(0,l):""}catch(s){throw new Error(`Failed to get mark opening for ${e}: ${s}`)}}getMarkClosing(e,t){const n=this.getHandlersForNodeType(e),r=n.length>0?n[0]:void 0;if(!r||!r.renderMarkdown)return"";const o="__TIPTAP_MARKDOWN_PLACEHOLDER__",i={type:e,attrs:t.attrs||{},content:[{type:"text",text:o}]};try{const s=r.renderMarkdown(i,{renderChildren:()=>o,indent:u=>u,wrapInBlock:(u,c)=>u+c},{index:0,level:0,parentType:"text",meta:{}}),l=s.indexOf(o),a=l+o.length;return l>=0?s.substring(a):""}catch(s){throw new Error(`Failed to get mark closing for ${e}: ${s}`)}}markSetsEqual(e,t){return e.size!==t.size?!1:Array.from(e.keys()).every(n=>t.has(n))}},Xw=a3,u3=$e.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(e,t)=>{if(!(t!=null&&t.contentType)||vu(e,t==null?void 0:t.contentType)!=="markdown"||!this.editor.markdown)return wn.setContent(e,t);const r=this.editor.markdown.parse(e);return wn.setContent(r,t)},insertContent:(e,t)=>{if(!(t!=null&&t.contentType)||vu(e,t==null?void 0:t.contentType)!=="markdown"||!this.editor.markdown)return wn.insertContent(e,t);const r=this.editor.markdown.parse(e);return wn.insertContent(r,t)},insertContentAt:(e,t,n)=>{if(!(n!=null&&n.contentType)||vu(t,n==null?void 0:n.contentType)!=="markdown"||!this.editor.markdown)return wn.insertContentAt(e,t,n);const o=this.editor.markdown.parse(t);return wn.insertContentAt(e,o,n)}}},addStorage(){return{manager:new Xw({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new Xw({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||vu(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const t=this.editor.markdown.parse(this.editor.options.content);this.editor.options.content=t}});/**
287
- * @license lucide-react v0.563.0 - ISC
288
- *
289
- * This source code is licensed under the ISC license.
290
- * See the LICENSE file in the root directory of this source tree.
291
- */const NM=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
292
- * @license lucide-react v0.563.0 - ISC
293
- *
294
- * This source code is licensed under the ISC license.
295
- * See the LICENSE file in the root directory of this source tree.
296
- */const c3=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
297
- * @license lucide-react v0.563.0 - ISC
298
- *
299
- * This source code is licensed under the ISC license.
300
- * See the LICENSE file in the root directory of this source tree.
301
- */const d3=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
302
- * @license lucide-react v0.563.0 - ISC
303
- *
304
- * This source code is licensed under the ISC license.
305
- * See the LICENSE file in the root directory of this source tree.
306
- */const Yw=e=>{const t=d3(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
307
- * @license lucide-react v0.563.0 - ISC
308
- *
309
- * This source code is licensed under the ISC license.
310
- * See the LICENSE file in the root directory of this source tree.
311
- */var f3={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
312
- * @license lucide-react v0.563.0 - ISC
313
- *
314
- * This source code is licensed under the ISC license.
315
- * See the LICENSE file in the root directory of this source tree.
316
- */const p3=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
317
- * @license lucide-react v0.563.0 - ISC
318
- *
319
- * This source code is licensed under the ISC license.
320
- * See the LICENSE file in the root directory of this source tree.
321
- */const h3=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...l},a)=>x.createElement("svg",{ref:a,...f3,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:NM("lucide",o),...!i&&!p3(l)&&{"aria-hidden":"true"},...l},[...s.map(([u,c])=>x.createElement(u,c)),...Array.isArray(i)?i:[i]]));/**
322
- * @license lucide-react v0.563.0 - ISC
323
- *
324
- * This source code is licensed under the ISC license.
325
- * See the LICENSE file in the root directory of this source tree.
326
- */const we=(e,t)=>{const n=x.forwardRef(({className:r,...o},i)=>x.createElement(h3,{ref:i,iconNode:t,className:NM(`lucide-${c3(Yw(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Yw(e),n};/**
327
- * @license lucide-react v0.563.0 - ISC
328
- *
329
- * This source code is licensed under the ISC license.
330
- * See the LICENSE file in the root directory of this source tree.
331
- */const m3=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],g3=we("archive",m3);/**
332
- * @license lucide-react v0.563.0 - ISC
333
- *
334
- * This source code is licensed under the ISC license.
335
- * See the LICENSE file in the root directory of this source tree.
336
- */const y3=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],Lp=we("arrow-down-wide-narrow",y3);/**
337
- * @license lucide-react v0.563.0 - ISC
338
- *
339
- * This source code is licensed under the ISC license.
340
- * See the LICENSE file in the root directory of this source tree.
341
- */const v3=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],xu=we("arrow-up-narrow-wide",v3);/**
342
- * @license lucide-react v0.563.0 - ISC
343
- *
344
- * This source code is licensed under the ISC license.
345
- * See the LICENSE file in the root directory of this source tree.
346
- */const x3=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],w3=we("bold",x3);/**
347
- * @license lucide-react v0.563.0 - ISC
348
- *
349
- * This source code is licensed under the ISC license.
350
- * See the LICENSE file in the root directory of this source tree.
351
- */const k3=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],S3=we("check",k3);/**
352
- * @license lucide-react v0.563.0 - ISC
353
- *
354
- * This source code is licensed under the ISC license.
355
- * See the LICENSE file in the root directory of this source tree.
356
- */const b3=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ju=we("chevron-down",b3);/**
357
- * @license lucide-react v0.563.0 - ISC
358
- *
359
- * This source code is licensed under the ISC license.
360
- * See the LICENSE file in the root directory of this source tree.
361
- */const C3=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Zw=we("chevron-right",C3);/**
362
- * @license lucide-react v0.563.0 - ISC
363
- *
364
- * This source code is licensed under the ISC license.
365
- * See the LICENSE file in the root directory of this source tree.
366
- */const E3=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],M3=we("chevron-up",E3);/**
367
- * @license lucide-react v0.563.0 - ISC
368
- *
369
- * This source code is licensed under the ISC license.
370
- * See the LICENSE file in the root directory of this source tree.
371
- */const R3=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],T3=we("circle-alert",R3);/**
372
- * @license lucide-react v0.563.0 - ISC
373
- *
374
- * This source code is licensed under the ISC license.
375
- * See the LICENSE file in the root directory of this source tree.
376
- */const N3=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],A3=we("code-xml",N3);/**
377
- * @license lucide-react v0.563.0 - ISC
378
- *
379
- * This source code is licensed under the ISC license.
380
- * See the LICENSE file in the root directory of this source tree.
381
- */const O3=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],P3=we("ellipsis-vertical",O3);/**
382
- * @license lucide-react v0.563.0 - ISC
383
- *
384
- * This source code is licensed under the ISC license.
385
- * See the LICENSE file in the root directory of this source tree.
386
- */const I3=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],D3=we("file-text",I3);/**
387
- * @license lucide-react v0.563.0 - ISC
388
- *
389
- * This source code is licensed under the ISC license.
390
- * See the LICENSE file in the root directory of this source tree.
391
- */const L3=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],_3=we("funnel",L3);/**
392
- * @license lucide-react v0.563.0 - ISC
393
- *
394
- * This source code is licensed under the ISC license.
395
- * See the LICENSE file in the root directory of this source tree.
396
- */const $3=[["path",{d:"M3 7V5c0-1.1.9-2 2-2h2",key:"adw53z"}],["path",{d:"M17 3h2c1.1 0 2 .9 2 2v2",key:"an4l38"}],["path",{d:"M21 17v2c0 1.1-.9 2-2 2h-2",key:"144t0e"}],["path",{d:"M7 21H5c-1.1 0-2-.9-2-2v-2",key:"rtnfgi"}],["rect",{width:"7",height:"5",x:"7",y:"7",rx:"1",key:"1eyiv7"}],["rect",{width:"7",height:"5",x:"10",y:"12",rx:"1",key:"1qlmkx"}]],z3=we("group",$3);/**
397
- * @license lucide-react v0.563.0 - ISC
398
- *
399
- * This source code is licensed under the ISC license.
400
- * See the LICENSE file in the root directory of this source tree.
401
- */const j3=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],F3=we("hash",j3);/**
402
- * @license lucide-react v0.563.0 - ISC
403
- *
404
- * This source code is licensed under the ISC license.
405
- * See the LICENSE file in the root directory of this source tree.
406
- */const B3=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],V3=we("heading-2",B3);/**
407
- * @license lucide-react v0.563.0 - ISC
408
- *
409
- * This source code is licensed under the ISC license.
410
- * See the LICENSE file in the root directory of this source tree.
411
- */const H3=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],U3=we("heading-3",H3);/**
412
- * @license lucide-react v0.563.0 - ISC
413
- *
414
- * This source code is licensed under the ISC license.
415
- * See the LICENSE file in the root directory of this source tree.
416
- */const W3=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],AM=we("info",W3);/**
417
- * @license lucide-react v0.563.0 - ISC
418
- *
419
- * This source code is licensed under the ISC license.
420
- * See the LICENSE file in the root directory of this source tree.
421
- */const G3=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],q3=we("italic",G3);/**
422
- * @license lucide-react v0.563.0 - ISC
423
- *
424
- * This source code is licensed under the ISC license.
425
- * See the LICENSE file in the root directory of this source tree.
426
- */const K3=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],J3=we("link-2",K3);/**
427
- * @license lucide-react v0.563.0 - ISC
428
- *
429
- * This source code is licensed under the ISC license.
430
- * See the LICENSE file in the root directory of this source tree.
431
- */const Q3=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],X3=we("list-ordered",Q3);/**
432
- * @license lucide-react v0.563.0 - ISC
433
- *
434
- * This source code is licensed under the ISC license.
435
- * See the LICENSE file in the root directory of this source tree.
436
- */const Y3=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Z3=we("list",Y3);/**
437
- * @license lucide-react v0.563.0 - ISC
438
- *
439
- * This source code is licensed under the ISC license.
440
- * See the LICENSE file in the root directory of this source tree.
441
- */const eB=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],tB=we("loader-circle",eB);/**
442
- * @license lucide-react v0.563.0 - ISC
443
- *
444
- * This source code is licensed under the ISC license.
445
- * See the LICENSE file in the root directory of this source tree.
446
- */const nB=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],OM=we("pin",nB);/**
447
- * @license lucide-react v0.563.0 - ISC
448
- *
449
- * This source code is licensed under the ISC license.
450
- * See the LICENSE file in the root directory of this source tree.
451
- */const rB=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],oB=we("plus",rB);/**
452
- * @license lucide-react v0.563.0 - ISC
453
- *
454
- * This source code is licensed under the ISC license.
455
- * See the LICENSE file in the root directory of this source tree.
456
- */const iB=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],sB=we("quote",iB);/**
457
- * @license lucide-react v0.563.0 - ISC
458
- *
459
- * This source code is licensed under the ISC license.
460
- * See the LICENSE file in the root directory of this source tree.
461
- */const lB=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],PM=we("search",lB);/**
462
- * @license lucide-react v0.563.0 - ISC
463
- *
464
- * This source code is licensed under the ISC license.
465
- * See the LICENSE file in the root directory of this source tree.
466
- */const aB=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],uB=we("strikethrough",aB);/**
467
- * @license lucide-react v0.563.0 - ISC
468
- *
469
- * This source code is licensed under the ISC license.
470
- * See the LICENSE file in the root directory of this source tree.
471
- */const cB=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],dB=we("trash-2",cB);/**
472
- * @license lucide-react v0.563.0 - ISC
473
- *
474
- * This source code is licensed under the ISC license.
475
- * See the LICENSE file in the root directory of this source tree.
476
- */const fB=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],pB=we("unlink",fB);/**
477
- * @license lucide-react v0.563.0 - ISC
478
- *
479
- * This source code is licensed under the ISC license.
480
- * See the LICENSE file in the root directory of this source tree.
481
- */const hB=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],IM=we("x",hB);function DM(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=DM(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function LM(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=DM(e))&&(r&&(r+=" "),r+=t);return r}const ek=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,tk=LM,mB=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return tk(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(u=>{const c=n==null?void 0:n[u],d=i==null?void 0:i[u];if(c===null)return null;const f=ek(c)||ek(d);return o[u][f]}),l=n&&Object.entries(n).reduce((u,c)=>{let[d,f]=c;return f===void 0||(u[d]=f),u},{}),a=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,c)=>{let{class:d,className:f,...p}=c;return Object.entries(p).every(h=>{let[m,y]=h;return Array.isArray(y)?y.includes({...i,...l}[m]):{...i,...l}[m]===y})?[...u,d,f]:u},[]);return tk(e,s,a,n==null?void 0:n.class,n==null?void 0:n.className)},gB=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},yB=(e,t)=>({classGroupId:e,validator:t}),_M=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),kd="-",nk=[],vB="arbitrary..",xB=e=>{const t=kB(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return wB(s);const l=s.split(kd),a=l[0]===""&&l.length>1?1:0;return $M(l,a,t)},getConflictingClassGroupIds:(s,l)=>{if(l){const a=r[s],u=n[s];return a?u?gB(u,a):a:u||nk}return n[s]||nk}}},$M=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],i=n.nextPart.get(o);if(i){const u=$M(e,t+1,i);if(u)return u}const s=n.validators;if(s===null)return;const l=t===0?e.join(kd):e.slice(t).join(kd),a=s.length;for(let u=0;u<a;u++){const c=s[u];if(c.validator(l))return c.classGroupId}},wB=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?vB+r:void 0})(),kB=e=>{const{theme:t,classGroups:n}=e;return SB(n,t)},SB=(e,t)=>{const n=_M();for(const r in e){const o=e[r];ev(o,n,r,t)}return n},ev=(e,t,n,r)=>{const o=e.length;for(let i=0;i<o;i++){const s=e[i];bB(s,t,n,r)}},bB=(e,t,n,r)=>{if(typeof e=="string"){CB(e,t,n);return}if(typeof e=="function"){EB(e,t,n,r);return}MB(e,t,n,r)},CB=(e,t,n)=>{const r=e===""?t:zM(t,e);r.classGroupId=n},EB=(e,t,n,r)=>{if(RB(e)){ev(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(yB(n,e))},MB=(e,t,n,r)=>{const o=Object.entries(e),i=o.length;for(let s=0;s<i;s++){const[l,a]=o[s];ev(a,zM(t,l),n,r)}},zM=(e,t)=>{let n=e;const r=t.split(kd),o=r.length;for(let i=0;i<o;i++){const s=r[i];let l=n.nextPart.get(s);l||(l=_M(),n.nextPart.set(s,l)),n=l}return n},RB=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,TB=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(i,s)=>{n[i]=s,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(i){let s=n[i];if(s!==void 0)return s;if((s=r[i])!==void 0)return o(i,s),s},set(i,s){i in n?n[i]=s:o(i,s)}}},Dm="!",rk=":",NB=[],ok=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),AB=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const i=[];let s=0,l=0,a=0,u;const c=o.length;for(let m=0;m<c;m++){const y=o[m];if(s===0&&l===0){if(y===rk){i.push(o.slice(a,m)),a=m+1;continue}if(y==="/"){u=m;continue}}y==="["?s++:y==="]"?s--:y==="("?l++:y===")"&&l--}const d=i.length===0?o:o.slice(a);let f=d,p=!1;d.endsWith(Dm)?(f=d.slice(0,-1),p=!0):d.startsWith(Dm)&&(f=d.slice(1),p=!0);const h=u&&u>a?u-a:void 0;return ok(i,p,f,h)};if(t){const o=t+rk,i=r;r=s=>s.startsWith(o)?i(s.slice(o.length)):ok(NB,!1,s,void 0,!0)}if(n){const o=r;r=i=>n({className:i,parseClassName:o})}return r},OB=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let i=0;i<n.length;i++){const s=n[i],l=s[0]==="[",a=t.has(s);l||a?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(s)):o.push(s)}return o.length>0&&(o.sort(),r.push(...o)),r}},PB=e=>({cache:TB(e.cacheSize),parseClassName:AB(e),sortModifiers:OB(e),...xB(e)}),IB=/\s+/,DB=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:i}=t,s=[],l=e.trim().split(IB);let a="";for(let u=l.length-1;u>=0;u-=1){const c=l[u],{isExternal:d,modifiers:f,hasImportantModifier:p,baseClassName:h,maybePostfixModifierPosition:m}=n(c);if(d){a=c+(a.length>0?" "+a:a);continue}let y=!!m,g=r(y?h.substring(0,m):h);if(!g){if(!y){a=c+(a.length>0?" "+a:a);continue}if(g=r(h),!g){a=c+(a.length>0?" "+a:a);continue}y=!1}const v=f.length===0?"":f.length===1?f[0]:i(f).join(":"),k=p?v+Dm:v,S=k+g;if(s.indexOf(S)>-1)continue;s.push(S);const b=o(g,y);for(let E=0;E<b.length;++E){const M=b[E];s.push(k+M)}a=c+(a.length>0?" "+a:a)}return a},LB=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=jM(n))&&(o&&(o+=" "),o+=r);return o},jM=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=jM(e[r]))&&(n&&(n+=" "),n+=t);return n},_B=(e,...t)=>{let n,r,o,i;const s=a=>{const u=t.reduce((c,d)=>d(c),e());return n=PB(u),r=n.cache.get,o=n.cache.set,i=l,l(a)},l=a=>{const u=r(a);if(u)return u;const c=DB(a,n);return o(a,c),c};return i=s,(...a)=>i(LB(...a))},$B=[],Ze=e=>{const t=n=>n[e]||$B;return t.isThemeGetter=!0,t},FM=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,BM=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zB=/^\d+\/\d+$/,jB=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,FB=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,BB=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,VB=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,HB=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Oi=e=>zB.test(e),ge=e=>!!e&&!Number.isNaN(Number(e)),$r=e=>!!e&&Number.isInteger(Number(e)),_p=e=>e.endsWith("%")&&ge(e.slice(0,-1)),or=e=>jB.test(e),UB=()=>!0,WB=e=>FB.test(e)&&!BB.test(e),VM=()=>!1,GB=e=>VB.test(e),qB=e=>HB.test(e),KB=e=>!q(e)&&!K(e),JB=e=>Ds(e,WM,VM),q=e=>FM.test(e),Io=e=>Ds(e,GM,WB),$p=e=>Ds(e,e4,ge),ik=e=>Ds(e,HM,VM),QB=e=>Ds(e,UM,qB),wu=e=>Ds(e,qM,GB),K=e=>BM.test(e),nl=e=>Ls(e,GM),XB=e=>Ls(e,t4),sk=e=>Ls(e,HM),YB=e=>Ls(e,WM),ZB=e=>Ls(e,UM),ku=e=>Ls(e,qM,!0),Ds=(e,t,n)=>{const r=FM.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Ls=(e,t,n=!1)=>{const r=BM.exec(e);return r?r[1]?t(r[1]):n:!1},HM=e=>e==="position"||e==="percentage",UM=e=>e==="image"||e==="url",WM=e=>e==="length"||e==="size"||e==="bg-size",GM=e=>e==="length",e4=e=>e==="number",t4=e=>e==="family-name",qM=e=>e==="shadow",n4=()=>{const e=Ze("color"),t=Ze("font"),n=Ze("text"),r=Ze("font-weight"),o=Ze("tracking"),i=Ze("leading"),s=Ze("breakpoint"),l=Ze("container"),a=Ze("spacing"),u=Ze("radius"),c=Ze("shadow"),d=Ze("inset-shadow"),f=Ze("text-shadow"),p=Ze("drop-shadow"),h=Ze("blur"),m=Ze("perspective"),y=Ze("aspect"),g=Ze("ease"),v=Ze("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],b=()=>[...S(),K,q],E=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],R=()=>[K,q,a],D=()=>[Oi,"full","auto",...R()],I=()=>[$r,"none","subgrid",K,q],J=()=>["auto",{span:["full",$r,K,q]},$r,K,q],ne=()=>[$r,"auto",K,q],re=()=>["auto","min","max","fr",K,q],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ie=()=>["start","end","center","stretch","center-safe","end-safe"],ue=()=>["auto",...R()],fe=()=>[Oi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],N=()=>[e,K,q],j=()=>[...S(),sk,ik,{position:[K,q]}],te=()=>["no-repeat",{repeat:["","x","y","space","round"]}],he=()=>["auto","cover","contain",YB,JB,{size:[K,q]}],A=()=>[_p,nl,Io],V=()=>["","none","full",u,K,q],Y=()=>["",ge,nl,Io],G=()=>["solid","dashed","dotted","double"],pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],O=()=>[ge,_p,sk,ik],H=()=>["","none",h,K,q],se=()=>["none",ge,K,q],ke=()=>["none",ge,K,q],Me=()=>[ge,K,q],Vt=()=>[Oi,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[or],breakpoint:[or],color:[UB],container:[or],"drop-shadow":[or],ease:["in","out","in-out"],font:[KB],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[or],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[or],shadow:[or],spacing:["px",ge],text:[or],"text-shadow":[or],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Oi,q,K,y]}],container:["container"],columns:[{columns:[ge,q,K,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:b()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{start:D()}],end:[{end:D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[$r,"auto",K,q]}],basis:[{basis:[Oi,"full","auto",l,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ge,Oi,"auto","initial","none",q]}],grow:[{grow:["",ge,K,q]}],shrink:[{shrink:["",ge,K,q]}],order:[{order:[$r,"first","last","none",K,q]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:J()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:J()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":re()}],"auto-rows":[{"auto-rows":re()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...U(),"normal"]}],"justify-items":[{"justify-items":[...ie(),"normal"]}],"justify-self":[{"justify-self":["auto",...ie()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...ie(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ie(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...ie(),"baseline"]}],"place-self":[{"place-self":["auto",...ie()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:ue()}],mx:[{mx:ue()}],my:[{my:ue()}],ms:[{ms:ue()}],me:[{me:ue()}],mt:[{mt:ue()}],mr:[{mr:ue()}],mb:[{mb:ue()}],ml:[{ml:ue()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:fe()}],w:[{w:[l,"screen",...fe()]}],"min-w":[{"min-w":[l,"screen","none",...fe()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[s]},...fe()]}],h:[{h:["screen","lh",...fe()]}],"min-h":[{"min-h":["screen","lh","none",...fe()]}],"max-h":[{"max-h":["screen","lh",...fe()]}],"font-size":[{text:["base",n,nl,Io]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,K,$p]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",_p,q]}],"font-family":[{font:[XB,q,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,K,q]}],"line-clamp":[{"line-clamp":[ge,"none",K,$p]}],leading:[{leading:[i,...R()]}],"list-image":[{"list-image":["none",K,q]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",K,q]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[ge,"from-font","auto",K,Io]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[ge,"auto",K,q]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",K,q]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",K,q]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:j()}],"bg-repeat":[{bg:te()}],"bg-size":[{bg:he()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$r,K,q],radial:["",K,q],conic:[$r,K,q]},ZB,QB]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:A()}],"gradient-via-pos":[{via:A()}],"gradient-to-pos":[{to:A()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:Y()}],"border-w-x":[{"border-x":Y()}],"border-w-y":[{"border-y":Y()}],"border-w-s":[{"border-s":Y()}],"border-w-e":[{"border-e":Y()}],"border-w-t":[{"border-t":Y()}],"border-w-r":[{"border-r":Y()}],"border-w-b":[{"border-b":Y()}],"border-w-l":[{"border-l":Y()}],"divide-x":[{"divide-x":Y()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Y()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ge,K,q]}],"outline-w":[{outline:["",ge,nl,Io]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","none",c,ku,wu]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",d,ku,wu]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[ge,Io]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":Y()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",f,ku,wu]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[ge,K,q]}],"mix-blend":[{"mix-blend":[...pe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":pe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ge]}],"mask-image-linear-from-pos":[{"mask-linear-from":O()}],"mask-image-linear-to-pos":[{"mask-linear-to":O()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":O()}],"mask-image-t-to-pos":[{"mask-t-to":O()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":O()}],"mask-image-r-to-pos":[{"mask-r-to":O()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":O()}],"mask-image-b-to-pos":[{"mask-b-to":O()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":O()}],"mask-image-l-to-pos":[{"mask-l-to":O()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":O()}],"mask-image-x-to-pos":[{"mask-x-to":O()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":O()}],"mask-image-y-to-pos":[{"mask-y-to":O()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[K,q]}],"mask-image-radial-from-pos":[{"mask-radial-from":O()}],"mask-image-radial-to-pos":[{"mask-radial-to":O()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[ge]}],"mask-image-conic-from-pos":[{"mask-conic-from":O()}],"mask-image-conic-to-pos":[{"mask-conic-to":O()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:j()}],"mask-repeat":[{mask:te()}],"mask-size":[{mask:he()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",K,q]}],filter:[{filter:["","none",K,q]}],blur:[{blur:H()}],brightness:[{brightness:[ge,K,q]}],contrast:[{contrast:[ge,K,q]}],"drop-shadow":[{"drop-shadow":["","none",p,ku,wu]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",ge,K,q]}],"hue-rotate":[{"hue-rotate":[ge,K,q]}],invert:[{invert:["",ge,K,q]}],saturate:[{saturate:[ge,K,q]}],sepia:[{sepia:["",ge,K,q]}],"backdrop-filter":[{"backdrop-filter":["","none",K,q]}],"backdrop-blur":[{"backdrop-blur":H()}],"backdrop-brightness":[{"backdrop-brightness":[ge,K,q]}],"backdrop-contrast":[{"backdrop-contrast":[ge,K,q]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ge,K,q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ge,K,q]}],"backdrop-invert":[{"backdrop-invert":["",ge,K,q]}],"backdrop-opacity":[{"backdrop-opacity":[ge,K,q]}],"backdrop-saturate":[{"backdrop-saturate":[ge,K,q]}],"backdrop-sepia":[{"backdrop-sepia":["",ge,K,q]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",K,q]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ge,"initial",K,q]}],ease:[{ease:["linear","initial",g,K,q]}],delay:[{delay:[ge,K,q]}],animate:[{animate:["none",v,K,q]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,K,q]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:se()}],"rotate-x":[{"rotate-x":se()}],"rotate-y":[{"rotate-y":se()}],"rotate-z":[{"rotate-z":se()}],scale:[{scale:ke()}],"scale-x":[{"scale-x":ke()}],"scale-y":[{"scale-y":ke()}],"scale-z":[{"scale-z":ke()}],"scale-3d":["scale-3d"],skew:[{skew:Me()}],"skew-x":[{"skew-x":Me()}],"skew-y":[{"skew-y":Me()}],transform:[{transform:[K,q,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Vt()}],"translate-x":[{"translate-x":Vt()}],"translate-y":[{"translate-y":Vt()}],"translate-z":[{"translate-z":Vt()}],"translate-none":["translate-none"],accent:[{accent:N()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",K,q]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",K,q]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[ge,nl,Io,$p]}],stroke:[{stroke:["none",...N()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},r4=_B(n4);function Ft(...e){return r4(LM(e))}const o4=mB("inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium transition-colors focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"border border-primary bg-primary text-primary-foreground hover:bg-primary/90",secondary:"border border-secondary bg-secondary text-secondary-foreground hover:bg-secondary/85",outline:"border border-primary bg-background text-primary hover:bg-accent hover:text-accent-foreground",ghost:"bg-transparent text-foreground hover:text-foreground"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3 text-xs",xs:"h-6 px-2 text-xs",icon:"h-8 w-8"}},defaultVariants:{variant:"default",size:"default"}}),Re=x.forwardRef(({className:e,variant:t,size:n,...r},o)=>w.jsx("button",{className:Ft(o4({variant:t,size:n,className:e})),ref:o,...r}));Re.displayName="Button";function go(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function lk(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function So(...e){return t=>{let n=!1;const r=e.map(o=>{const i=lk(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():lk(e[o],null)}}}}function vi(...e){return x.useCallback(So(...e),e)}function i4(e,t){const n=x.createContext(t),r=i=>{const{children:s,...l}=i,a=x.useMemo(()=>l,Object.values(l));return w.jsx(n.Provider,{value:a,children:s})};r.displayName=e+"Provider";function o(i){const s=x.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function s4(e,t=[]){let n=[];function r(i,s){const l=x.createContext(s),a=n.length;n=[...n,s];const u=d=>{var g;const{scope:f,children:p,...h}=d,m=((g=f==null?void 0:f[e])==null?void 0:g[a])||l,y=x.useMemo(()=>h,Object.values(h));return w.jsx(m.Provider,{value:y,children:p})};u.displayName=i+"Provider";function c(d,f){var m;const p=((m=f==null?void 0:f[e])==null?void 0:m[a])||l,h=x.useContext(p);if(h)return h;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[u,c]}const o=()=>{const i=n.map(s=>x.createContext(s));return function(l){const a=(l==null?void 0:l[e])||i;return x.useMemo(()=>({[`__scope${e}`]:{...l,[e]:a}}),[l,a])}};return o.scopeName=e,[r,l4(o,...t)]}function l4(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((l,{useScope:a,scopeName:u})=>{const d=a(i)[`__scope${u}`];return{...l,...d}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var ha=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},a4=Ed[" useId ".trim().toString()]||(()=>{}),u4=0;function kr(e){const[t,n]=x.useState(a4());return ha(()=>{n(r=>r??String(u4++))},[e]),t?`radix-${t}`:""}var c4=Ed[" useInsertionEffect ".trim().toString()]||ha;function d4({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=f4({defaultProp:t,onChange:n}),l=e!==void 0,a=l?e:o;{const c=x.useRef(e!==void 0);x.useEffect(()=>{const d=c.current;d!==l&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=l},[l,r])}const u=x.useCallback(c=>{var d;if(l){const f=p4(c)?c(e):c;f!==e&&((d=s.current)==null||d.call(s,f))}else i(c)},[l,e,i,s]);return[a,u]}function f4({defaultProp:e,onChange:t}){const[n,r]=x.useState(e),o=x.useRef(n),i=x.useRef(t);return c4(()=>{i.current=t},[t]),x.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function p4(e){return typeof e=="function"}function KM(e){const t=h4(e),n=x.forwardRef((r,o)=>{const{children:i,...s}=r,l=x.Children.toArray(i),a=l.find(g4);if(a){const u=a.props.children,c=l.map(d=>d===a?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:d);return w.jsx(t,{...s,ref:o,children:x.isValidElement(u)?x.cloneElement(u,void 0,c):null})}return w.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function h4(e){const t=x.forwardRef((n,r)=>{const{children:o,...i}=n;if(x.isValidElement(o)){const s=v4(o),l=y4(i,o.props);return o.type!==x.Fragment&&(l.ref=r?So(r,s):s),x.cloneElement(o,l)}return x.Children.count(o)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var m4=Symbol("radix.slottable");function g4(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===m4}function y4(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const a=i(...l);return o(...l),a}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function v4(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var x4=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ar=x4.reduce((e,t)=>{const n=KM(`Primitive.${t}`),r=x.forwardRef((o,i)=>{const{asChild:s,...l}=o,a=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(a,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function w4(e,t){e&&di.flushSync(()=>e.dispatchEvent(t))}function ma(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function k4(e,t=globalThis==null?void 0:globalThis.document){const n=ma(e);x.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var S4="DismissableLayer",Lm="dismissableLayer.update",b4="dismissableLayer.pointerDownOutside",C4="dismissableLayer.focusOutside",ak,JM=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),QM=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...a}=e,u=x.useContext(JM),[c,d]=x.useState(null),f=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=x.useState({}),h=vi(t,M=>d(M)),m=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(y),v=c?m.indexOf(c):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=g,b=R4(M=>{const R=M.target,D=[...u.branches].some(I=>I.contains(R));!S||D||(o==null||o(M),s==null||s(M),M.defaultPrevented||l==null||l())},f),E=T4(M=>{const R=M.target;[...u.branches].some(I=>I.contains(R))||(i==null||i(M),s==null||s(M),M.defaultPrevented||l==null||l())},f);return k4(M=>{v===u.layers.size-1&&(r==null||r(M),!M.defaultPrevented&&l&&(M.preventDefault(),l()))},f),x.useEffect(()=>{if(c)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ak=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),uk(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=ak)}},[c,f,n,u]),x.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),uk())},[c,u]),x.useEffect(()=>{const M=()=>p({});return document.addEventListener(Lm,M),()=>document.removeEventListener(Lm,M)},[]),w.jsx(Ar.div,{...a,ref:h,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:go(e.onFocusCapture,E.onFocusCapture),onBlurCapture:go(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:go(e.onPointerDownCapture,b.onPointerDownCapture)})});QM.displayName=S4;var E4="DismissableLayerBranch",M4=x.forwardRef((e,t)=>{const n=x.useContext(JM),r=x.useRef(null),o=vi(t,r);return x.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),w.jsx(Ar.div,{...e,ref:o})});M4.displayName=E4;function R4(e,t=globalThis==null?void 0:globalThis.document){const n=ma(e),r=x.useRef(!1),o=x.useRef(()=>{});return x.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let a=function(){XM(b4,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=a,t.addEventListener("click",o.current,{once:!0})):a()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function T4(e,t=globalThis==null?void 0:globalThis.document){const n=ma(e),r=x.useRef(!1);return x.useEffect(()=>{const o=i=>{i.target&&!r.current&&XM(C4,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function uk(){const e=new CustomEvent(Lm);document.dispatchEvent(e)}function XM(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?w4(o,i):o.dispatchEvent(i)}var zp="focusScope.autoFocusOnMount",jp="focusScope.autoFocusOnUnmount",ck={bubbles:!1,cancelable:!0},N4="FocusScope",YM=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[l,a]=x.useState(null),u=ma(o),c=ma(i),d=x.useRef(null),f=vi(t,m=>a(m)),p=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let m=function(k){if(p.paused||!l)return;const S=k.target;l.contains(S)?d.current=S:jr(d.current,{select:!0})},y=function(k){if(p.paused||!l)return;const S=k.relatedTarget;S!==null&&(l.contains(S)||jr(d.current,{select:!0}))},g=function(k){if(document.activeElement===document.body)for(const b of k)b.removedNodes.length>0&&jr(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",y);const v=new MutationObserver(g);return l&&v.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",y),v.disconnect()}}},[r,l,p.paused]),x.useEffect(()=>{if(l){fk.add(p);const m=document.activeElement;if(!l.contains(m)){const g=new CustomEvent(zp,ck);l.addEventListener(zp,u),l.dispatchEvent(g),g.defaultPrevented||(A4(L4(ZM(l)),{select:!0}),document.activeElement===m&&jr(l))}return()=>{l.removeEventListener(zp,u),setTimeout(()=>{const g=new CustomEvent(jp,ck);l.addEventListener(jp,c),l.dispatchEvent(g),g.defaultPrevented||jr(m??document.body,{select:!0}),l.removeEventListener(jp,c),fk.remove(p)},0)}}},[l,u,c,p]);const h=x.useCallback(m=>{if(!n&&!r||p.paused)return;const y=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(y&&g){const v=m.currentTarget,[k,S]=O4(v);k&&S?!m.shiftKey&&g===S?(m.preventDefault(),n&&jr(k,{select:!0})):m.shiftKey&&g===k&&(m.preventDefault(),n&&jr(S,{select:!0})):g===v&&m.preventDefault()}},[n,r,p.paused]);return w.jsx(Ar.div,{tabIndex:-1,...s,ref:f,onKeyDown:h})});YM.displayName=N4;function A4(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(jr(r,{select:t}),document.activeElement!==n)return}function O4(e){const t=ZM(e),n=dk(t,e),r=dk(t.reverse(),e);return[n,r]}function ZM(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function dk(e,t){for(const n of e)if(!P4(n,{upTo:t}))return n}function P4(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function I4(e){return e instanceof HTMLInputElement&&"select"in e}function jr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&I4(e)&&t&&e.select()}}var fk=D4();function D4(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=pk(e,t),e.unshift(t)},remove(t){var n;e=pk(e,t),(n=e[0])==null||n.resume()}}}function pk(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function L4(e){return e.filter(t=>t.tagName!=="A")}var _4="Portal",eR=x.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[o,i]=x.useState(!1);ha(()=>i(!0),[]);const s=n||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?BS.createPortal(w.jsx(Ar.div,{...r,ref:t}),s):null});eR.displayName=_4;function $4(e,t){return x.useReducer((n,r)=>t[n][r]??n,e)}var hf=e=>{const{present:t,children:n}=e,r=z4(t),o=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),i=vi(r.ref,j4(o));return typeof n=="function"||r.isPresent?x.cloneElement(o,{ref:i}):null};hf.displayName="Presence";function z4(e){const[t,n]=x.useState(),r=x.useRef(null),o=x.useRef(e),i=x.useRef("none"),s=e?"mounted":"unmounted",[l,a]=$4(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const u=Su(r.current);i.current=l==="mounted"?u:"none"},[l]),ha(()=>{const u=r.current,c=o.current;if(c!==e){const f=i.current,p=Su(u);e?a("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?a("UNMOUNT"):a(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,a]),ha(()=>{if(t){let u;const c=t.ownerDocument.defaultView??window,d=p=>{const m=Su(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&m&&(a("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},f=p=>{p.target===t&&(i.current=Su(r.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{c.clearTimeout(u),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else a("ANIMATION_END")},[t,a]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:x.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Su(e){return(e==null?void 0:e.animationName)||"none"}function j4(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Fp=0;function F4(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??hk()),document.body.insertAdjacentElement("beforeend",e[1]??hk()),Fp++,()=>{Fp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Fp--}},[])}function hk(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Hn=function(){return Hn=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Hn.apply(this,arguments)};function tR(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function B4(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Qu="right-scroll-bar-position",Xu="width-before-scroll-bar",V4="with-scroll-bars-hidden",H4="--removed-body-scroll-bar-size";function Bp(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function U4(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var W4=typeof window<"u"?x.useLayoutEffect:x.useEffect,mk=new WeakMap;function G4(e,t){var n=U4(null,function(r){return e.forEach(function(o){return Bp(o,r)})});return W4(function(){var r=mk.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(l){i.has(l)||Bp(l,null)}),i.forEach(function(l){o.has(l)||Bp(l,s)})}mk.set(n,e)},[e]),n}function q4(e){return e}function K4(e,t){t===void 0&&(t=q4);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(l){return l!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var l=n;n=[],l.forEach(i),s=n}var a=function(){var c=s;s=[],c.forEach(i)},u=function(){return Promise.resolve().then(a)};u(),n={push:function(c){s.push(c),u()},filter:function(c){return s=s.filter(c),n}}}};return o}function J4(e){e===void 0&&(e={});var t=K4(null);return t.options=Hn({async:!0,ssr:!1},e),t}var nR=function(e){var t=e.sideCar,n=tR(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,Hn({},n))};nR.isSideCarExport=!0;function Q4(e,t){return e.useMedium(t),nR}var rR=J4(),Vp=function(){},mf=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:Vp,onWheelCapture:Vp,onTouchMoveCapture:Vp}),o=r[0],i=r[1],s=e.forwardProps,l=e.children,a=e.className,u=e.removeScrollBar,c=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,h=e.noIsolation,m=e.inert,y=e.allowPinchZoom,g=e.as,v=g===void 0?"div":g,k=e.gapMode,S=tR(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),b=f,E=G4([n,t]),M=Hn(Hn({},S),o);return x.createElement(x.Fragment,null,c&&x.createElement(b,{sideCar:rR,removeScrollBar:u,shards:d,noRelative:p,noIsolation:h,inert:m,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:k}),s?x.cloneElement(x.Children.only(l),Hn(Hn({},M),{ref:E})):x.createElement(v,Hn({},M,{className:a,ref:E}),l))});mf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};mf.classNames={fullWidth:Xu,zeroRight:Qu};var X4=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Y4(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=X4();return t&&e.setAttribute("nonce",t),e}function Z4(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function eV(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var tV=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Y4())&&(Z4(t,n),eV(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nV=function(){var e=tV();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},oR=function(){var e=nV(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},rV={left:0,top:0,right:0,gap:0},Hp=function(e){return parseInt(e||"",10)||0},oV=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Hp(n),Hp(r),Hp(o)]},iV=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return rV;var t=oV(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},sV=oR(),cs="data-scroll-locked",lV=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,l=e.gap;return n===void 0&&(n="margin"),`
482
- .`.concat(V4,` {
483
- overflow: hidden `).concat(r,`;
484
- padding-right: `).concat(l,"px ").concat(r,`;
485
- }
486
- body[`).concat(cs,`] {
487
- overflow: hidden `).concat(r,`;
488
- overscroll-behavior: contain;
489
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
490
- padding-left: `.concat(o,`px;
491
- padding-top: `).concat(i,`px;
492
- padding-right: `).concat(s,`px;
493
- margin-left:0;
494
- margin-top:0;
495
- margin-right: `).concat(l,"px ").concat(r,`;
496
- `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
497
- }
498
-
499
- .`).concat(Qu,` {
500
- right: `).concat(l,"px ").concat(r,`;
501
- }
502
-
503
- .`).concat(Xu,` {
504
- margin-right: `).concat(l,"px ").concat(r,`;
505
- }
506
-
507
- .`).concat(Qu," .").concat(Qu,` {
508
- right: 0 `).concat(r,`;
509
- }
510
-
511
- .`).concat(Xu," .").concat(Xu,` {
512
- margin-right: 0 `).concat(r,`;
513
- }
514
-
515
- body[`).concat(cs,`] {
516
- `).concat(H4,": ").concat(l,`px;
517
- }
518
- `)},gk=function(){var e=parseInt(document.body.getAttribute(cs)||"0",10);return isFinite(e)?e:0},aV=function(){x.useEffect(function(){return document.body.setAttribute(cs,(gk()+1).toString()),function(){var e=gk()-1;e<=0?document.body.removeAttribute(cs):document.body.setAttribute(cs,e.toString())}},[])},uV=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;aV();var i=x.useMemo(function(){return iV(o)},[o]);return x.createElement(sV,{styles:lV(i,!t,o,n?"":"!important")})},_m=!1;if(typeof window<"u")try{var bu=Object.defineProperty({},"passive",{get:function(){return _m=!0,!0}});window.addEventListener("test",bu,bu),window.removeEventListener("test",bu,bu)}catch{_m=!1}var Pi=_m?{passive:!1}:!1,cV=function(e){return e.tagName==="TEXTAREA"},iR=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!cV(e)&&n[t]==="visible")},dV=function(e){return iR(e,"overflowY")},fV=function(e){return iR(e,"overflowX")},yk=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=sR(e,r);if(o){var i=lR(e,r),s=i[1],l=i[2];if(s>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},pV=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},hV=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},sR=function(e,t){return e==="v"?dV(t):fV(t)},lR=function(e,t){return e==="v"?pV(t):hV(t)},mV=function(e,t){return e==="h"&&t==="rtl"?-1:1},gV=function(e,t,n,r,o){var i=mV(e,window.getComputedStyle(t).direction),s=i*r,l=n.target,a=t.contains(l),u=!1,c=s>0,d=0,f=0;do{if(!l)break;var p=lR(e,l),h=p[0],m=p[1],y=p[2],g=m-y-i*h;(h||g)&&sR(e,l)&&(d+=g,f+=h);var v=l.parentNode;l=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!a&&l!==document.body||a&&(t.contains(l)||t===l));return(c&&Math.abs(d)<1||!c&&Math.abs(f)<1)&&(u=!0),u},Cu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},vk=function(e){return[e.deltaX,e.deltaY]},xk=function(e){return e&&"current"in e?e.current:e},yV=function(e,t){return e[0]===t[0]&&e[1]===t[1]},vV=function(e){return`
519
- .block-interactivity-`.concat(e,` {pointer-events: none;}
520
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
521
- `)},xV=0,Ii=[];function wV(e){var t=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),o=x.useState(xV++)[0],i=x.useState(oR)[0],s=x.useRef(e);x.useEffect(function(){s.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=B4([e.lockRef.current],(e.shards||[]).map(xk),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=x.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var g=Cu(m),v=n.current,k="deltaX"in m?m.deltaX:v[0]-g[0],S="deltaY"in m?m.deltaY:v[1]-g[1],b,E=m.target,M=Math.abs(k)>Math.abs(S)?"h":"v";if("touches"in m&&M==="h"&&E.type==="range")return!1;var R=window.getSelection(),D=R&&R.anchorNode,I=D?D===E||D.contains(E):!1;if(I)return!1;var J=yk(M,E);if(!J)return!0;if(J?b=M:(b=M==="v"?"h":"v",J=yk(M,E)),!J)return!1;if(!r.current&&"changedTouches"in m&&(k||S)&&(r.current=b),!b)return!0;var ne=r.current||b;return gV(ne,y,m,ne==="h"?k:S)},[]),a=x.useCallback(function(m){var y=m;if(!(!Ii.length||Ii[Ii.length-1]!==i)){var g="deltaY"in y?vk(y):Cu(y),v=t.current.filter(function(b){return b.name===y.type&&(b.target===y.target||y.target===b.shadowParent)&&yV(b.delta,g)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var k=(s.current.shards||[]).map(xk).filter(Boolean).filter(function(b){return b.contains(y.target)}),S=k.length>0?l(y,k[0]):!s.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),u=x.useCallback(function(m,y,g,v){var k={name:m,delta:y,target:g,should:v,shadowParent:kV(g)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(S){return S!==k})},1)},[]),c=x.useCallback(function(m){n.current=Cu(m),r.current=void 0},[]),d=x.useCallback(function(m){u(m.type,vk(m),m.target,l(m,e.lockRef.current))},[]),f=x.useCallback(function(m){u(m.type,Cu(m),m.target,l(m,e.lockRef.current))},[]);x.useEffect(function(){return Ii.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",a,Pi),document.addEventListener("touchmove",a,Pi),document.addEventListener("touchstart",c,Pi),function(){Ii=Ii.filter(function(m){return m!==i}),document.removeEventListener("wheel",a,Pi),document.removeEventListener("touchmove",a,Pi),document.removeEventListener("touchstart",c,Pi)}},[]);var p=e.removeScrollBar,h=e.inert;return x.createElement(x.Fragment,null,h?x.createElement(i,{styles:vV(o)}):null,p?x.createElement(uV,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function kV(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const SV=Q4(rR,wV);var aR=x.forwardRef(function(e,t){return x.createElement(mf,Hn({},e,{ref:t,sideCar:SV}))});aR.classNames=mf.classNames;var bV=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Di=new WeakMap,Eu=new WeakMap,Mu={},Up=0,uR=function(e){return e&&(e.host||uR(e.parentNode))},CV=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=uR(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},EV=function(e,t,n,r){var o=CV(t,Array.isArray(e)?e:[e]);Mu[n]||(Mu[n]=new WeakMap);var i=Mu[n],s=[],l=new Set,a=new Set(o),u=function(d){!d||l.has(d)||(l.add(d),u(d.parentNode))};o.forEach(u);var c=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(f){if(l.has(f))c(f);else try{var p=f.getAttribute(r),h=p!==null&&p!=="false",m=(Di.get(f)||0)+1,y=(i.get(f)||0)+1;Di.set(f,m),i.set(f,y),s.push(f),m===1&&h&&Eu.set(f,!0),y===1&&f.setAttribute(n,"true"),h||f.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return c(t),l.clear(),Up++,function(){s.forEach(function(d){var f=Di.get(d)-1,p=i.get(d)-1;Di.set(d,f),i.set(d,p),f||(Eu.has(d)||d.removeAttribute(r),Eu.delete(d)),p||d.removeAttribute(n)}),Up--,Up||(Di=new WeakMap,Di=new WeakMap,Eu=new WeakMap,Mu={})}},MV=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=bV(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),EV(r,o,n,"aria-hidden")):function(){return null}},gf="Dialog",[cR]=s4(gf),[RV,Ln]=cR(gf),dR=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,l=x.useRef(null),a=x.useRef(null),[u,c]=d4({prop:r,defaultProp:o??!1,onChange:i,caller:gf});return w.jsx(RV,{scope:t,triggerRef:l,contentRef:a,contentId:kr(),titleId:kr(),descriptionId:kr(),open:u,onOpenChange:c,onOpenToggle:x.useCallback(()=>c(d=>!d),[c]),modal:s,children:n})};dR.displayName=gf;var fR="DialogTrigger",TV=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ln(fR,n),i=vi(t,o.triggerRef);return w.jsx(Ar.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":rv(o.open),...r,ref:i,onClick:go(e.onClick,o.onOpenToggle)})});TV.displayName=fR;var tv="DialogPortal",[NV,pR]=cR(tv,{forceMount:void 0}),hR=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=Ln(tv,t);return w.jsx(NV,{scope:t,forceMount:n,children:x.Children.map(r,s=>w.jsx(hf,{present:n||i.open,children:w.jsx(eR,{asChild:!0,container:o,children:s})}))})};hR.displayName=tv;var Sd="DialogOverlay",mR=x.forwardRef((e,t)=>{const n=pR(Sd,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Ln(Sd,e.__scopeDialog);return i.modal?w.jsx(hf,{present:r||i.open,children:w.jsx(OV,{...o,ref:t})}):null});mR.displayName=Sd;var AV=KM("DialogOverlay.RemoveScroll"),OV=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ln(Sd,n);return w.jsx(aR,{as:AV,allowPinchZoom:!0,shards:[o.contentRef],children:w.jsx(Ar.div,{"data-state":rv(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),li="DialogContent",gR=x.forwardRef((e,t)=>{const n=pR(li,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Ln(li,e.__scopeDialog);return w.jsx(hf,{present:r||i.open,children:i.modal?w.jsx(PV,{...o,ref:t}):w.jsx(IV,{...o,ref:t})})});gR.displayName=li;var PV=x.forwardRef((e,t)=>{const n=Ln(li,e.__scopeDialog),r=x.useRef(null),o=vi(t,n.contentRef,r);return x.useEffect(()=>{const i=r.current;if(i)return MV(i)},[]),w.jsx(yR,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:go(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:go(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0;(s.button===2||l)&&i.preventDefault()}),onFocusOutside:go(e.onFocusOutside,i=>i.preventDefault())})}),IV=x.forwardRef((e,t)=>{const n=Ln(li,e.__scopeDialog),r=x.useRef(!1),o=x.useRef(!1);return w.jsx(yR,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,l;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var a,u;(a=e.onInteractOutside)==null||a.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),yR=x.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,l=Ln(li,n),a=x.useRef(null),u=vi(t,a);return F4(),w.jsxs(w.Fragment,{children:[w.jsx(YM,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:w.jsx(QM,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":rv(l.open),...s,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),w.jsxs(w.Fragment,{children:[w.jsx(DV,{titleId:l.titleId}),w.jsx(_V,{contentRef:a,descriptionId:l.descriptionId})]})]})}),nv="DialogTitle",vR=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ln(nv,n);return w.jsx(Ar.h2,{id:o.titleId,...r,ref:t})});vR.displayName=nv;var xR="DialogDescription",wR=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ln(xR,n);return w.jsx(Ar.p,{id:o.descriptionId,...r,ref:t})});wR.displayName=xR;var kR="DialogClose",SR=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ln(kR,n);return w.jsx(Ar.button,{type:"button",...r,ref:t,onClick:go(e.onClick,()=>o.onOpenChange(!1))})});SR.displayName=kR;function rv(e){return e?"open":"closed"}var bR="DialogTitleWarning",[V5,CR]=i4(bR,{contentName:li,titleName:nv,docsSlug:"dialog"}),DV=({titleId:e})=>{const t=CR(bR),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
522
-
523
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
524
-
525
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},LV="DialogDescriptionWarning",_V=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${CR(LV).contentName}}.`;return x.useEffect(()=>{var i;const o=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},ER=dR,MR=hR,ov=mR,iv=gR,RR=vR,TR=wR,$V=SR;const NR=ER,zV=MR,AR=x.forwardRef(({className:e,...t},n)=>w.jsx(ov,{ref:n,className:Ft("fixed inset-0 z-40 bg-black/40 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));AR.displayName=ov.displayName;const sv=x.forwardRef(({className:e,children:t,...n},r)=>w.jsxs(zV,{children:[w.jsx(AR,{}),w.jsxs(iv,{ref:r,className:Ft("fixed left-[50%] top-[50%] z-50 w-full max-w-lg translate-x-[-50%] translate-y-[-50%] rounded-lg border border-border bg-card p-4 shadow-xl outline-none",e),...n,children:[t,w.jsxs($V,{className:"absolute right-3 top-3 rounded-sm text-muted-foreground transition-opacity hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[w.jsx(IM,{className:"h-4 w-4"}),w.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));sv.displayName=iv.displayName;const OR=({className:e,...t})=>w.jsx("div",{className:Ft("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});OR.displayName="DialogHeader";const PR=x.forwardRef(({className:e,...t},n)=>w.jsx(RR,{ref:n,className:Ft("text-lg font-semibold leading-none tracking-tight",e),...t}));PR.displayName=RR.displayName;const IR=x.forwardRef(({className:e,...t},n)=>w.jsx(TR,{ref:n,className:Ft("text-sm text-muted-foreground",e),...t}));IR.displayName=TR.displayName;function jV({status:e,onManualSave:t,errorMessage:n}){return n?w.jsxs("span",{className:"group relative inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive","aria-live":"polite",title:"Save error",children:[w.jsx(T3,{className:"h-4 w-4"}),w.jsx("span",{className:"text-[11px] font-medium",children:"Save error"}),w.jsx("span",{className:"pointer-events-none absolute left-full ml-2 w-64 rounded-md border border-border bg-popover px-2 py-1 text-[11px] text-foreground opacity-0 shadow-sm transition-opacity group-hover:opacity-100",children:n})]}):e==="saving"?w.jsxs("span",{className:"group relative inline-flex items-center text-muted-foreground/70","aria-live":"polite",title:"Saving",children:[w.jsx(tB,{className:"h-4 w-4 animate-spin text-emerald-400/80"}),w.jsx("span",{className:"pointer-events-none absolute left-full ml-2 rounded-md border border-border bg-popover px-2 py-1 text-[11px] text-foreground opacity-0 shadow-sm transition-opacity group-hover:opacity-100",children:"Saving"})]}):w.jsxs("span",{className:"group relative inline-flex items-center text-muted-foreground/70","aria-live":"polite",title:e==="idle"?"No changes":"Saved",children:[w.jsx(S3,{className:"h-4 w-4 text-emerald-400/80"}),w.jsx("span",{className:"pointer-events-none absolute left-full ml-2 rounded-md border border-border bg-popover px-2 py-1 text-[11px] text-foreground opacity-0 shadow-sm transition-opacity group-hover:opacity-100",children:e==="idle"?"No changes":"Saved"})]})}function FV({value:e,onChange:t,onConfirm:n,onCancel:r,showActions:o,inputRef:i,disabled:s}){return w.jsx("div",{className:"flex min-w-[220px] flex-1 flex-col gap-2",children:w.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[w.jsx("input",{ref:i,className:"min-w-[160px] flex-1 border-b border-dashed border-muted-foreground/60 bg-transparent text-lg font-semibold text-foreground outline-none transition-colors focus:border-foreground",value:e,onChange:l=>t(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),n==null||n()),l.key==="Escape"&&(l.preventDefault(),r==null||r())},placeholder:"Untitled","aria-label":"Document name",disabled:s}),o?w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(Re,{type:"button",size:"xs",onClick:n,children:"Confirm"}),w.jsx(Re,{type:"button",size:"xs",variant:"ghost",onClick:r,children:"Cancel"})]}):null]})})}function BV({docType:e,title:t,titleInputRef:n,onTitleChange:r,deriveFileName:o,onManualSave:i,saveStatus:s,errorStatus:l,conflict:a,showMetadataButton:u,onShowMetadata:c,fileName:d,isPinned:f,onTogglePinned:p,onArchive:h,onDelete:m,availableTags:y=[],selectedTags:g=[],onToggleTag:v,tagInput:k,onTagInputChange:S,onTagAdd:b,tagStatus:E}){const[M,R]=x.useState(t),[D,I]=x.useState(!1),J=x.useMemo(()=>y.filter(j=>!g.includes(j)),[y,g]),ne=J.length>0,re=M!==t,U=x.useMemo(()=>o==null?void 0:o(M),[o,M]),ue=!!(re&&U&&U!==d)?U:void 0;x.useEffect(()=>{R(t)},[t]),x.useEffect(()=>{e||I(!1)},[e]);const fe=()=>{re&&r(M)},N=()=>{R(t)};return w.jsx("section",{className:"border border-border bg-card",children:w.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-stretch md:gap-0",children:[w.jsxs("div",{className:"flex flex-col gap-2 px-4 py-3 md:flex-1 md:pr-4 md:border-r md:border-border",children:[w.jsx(FV,{value:M,onChange:R,onConfirm:fe,onCancel:N,showActions:re,inputRef:n,disabled:!e}),w.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u?w.jsx(Re,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-md bg-transparent opacity-60 hover:bg-transparent hover:opacity-100",onClick:c,"aria-label":"Show document info",title:"Show document info",children:w.jsx(AM,{className:"h-4 w-4"})}):null,p?w.jsx(Re,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-md bg-transparent",onClick:p,"aria-label":f?"Unpin document":"Pin document",title:f?"Unpin":"Pin",children:w.jsx(OM,{className:`h-4 w-4 ${f?"text-foreground":"text-muted-foreground"}`})}):null,h?w.jsx(Re,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-md bg-transparent",onClick:h,"aria-label":"Archive document",title:"Archive",children:w.jsx(g3,{className:"h-4 w-4 text-muted-foreground"})}):null,m?w.jsx(Re,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-md bg-transparent",onClick:m,"aria-label":"Delete document",title:"Delete",children:w.jsx(dB,{className:"h-4 w-4 text-muted-foreground"})}):null,w.jsx("span",{className:"h-5 w-px bg-border/70","aria-hidden":"true"}),w.jsx(jV,{status:s,onManualSave:i,errorMessage:l}),w.jsx("span",{className:"h-5 w-px bg-border/70","aria-hidden":"true"}),w.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[w.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Current"}),d?w.jsx("span",{className:"rounded bg-muted px-2 py-1 font-mono text-xs text-foreground",children:d}):w.jsx("span",{children:"No file name yet"}),ue?w.jsxs(w.Fragment,{children:[w.jsx("span",{className:"h-4 w-px bg-border/70","aria-hidden":"true"}),w.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Next"}),w.jsx("span",{className:"rounded bg-muted px-2 py-1 font-mono text-xs text-foreground",children:ue})]}):null]})]}),a?w.jsx("span",{className:"text-xs text-destructive",children:"File changed on disk. Reload or save to override."}):null]}),e?w.jsxs("div",{className:"flex flex-col justify-center gap-2 px-4 py-3 text-sm md:w-[320px] md:pl-4",children:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Tags"}),w.jsx(Re,{type:"button",size:"xs",variant:"ghost",onClick:()=>I(!0),children:"Edit"})]}),g.length?w.jsx("div",{className:"flex flex-wrap gap-2",children:g.map(j=>w.jsx("span",{className:"rounded-full border border-border bg-muted px-2.5 py-1 text-[11px] text-muted-foreground",children:j},j))}):w.jsx("span",{className:"text-xs text-muted-foreground",children:"No tags yet."}),w.jsx(NR,{open:D,onOpenChange:I,children:w.jsxs(sv,{className:"max-w-xl",children:[w.jsxs(OR,{className:"text-left",children:[w.jsx(PR,{children:"Edit tags"}),w.jsx(IR,{children:"Add new tags or pick from existing ones."})]}),w.jsxs("div",{className:"mt-4 space-y-4",children:[w.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[w.jsx("input",{className:"h-8 w-full min-w-[160px] flex-1 rounded-md border border-input bg-background px-2 text-xs focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:k??"",onChange:j=>S==null?void 0:S(j.target.value),placeholder:"Add a tag"}),w.jsx(Re,{type:"button",size:"sm",variant:"outline",onClick:b,disabled:!(k!=null&&k.trim()),children:"Add"}),E?w.jsx("span",{className:"text-xs text-destructive",children:E}):null]}),w.jsxs("div",{className:"space-y-2",children:[w.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Selected"}),g.length?w.jsx("div",{className:"flex flex-wrap gap-2",children:g.map(j=>w.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-full border border-border bg-muted px-2.5 py-1 text-[11px] text-muted-foreground transition-colors hover:border-destructive/50 hover:text-destructive",onClick:()=>v==null?void 0:v(j),"aria-label":`Remove tag ${j}`,children:[w.jsx("span",{children:j}),w.jsx(IM,{className:"h-3 w-3"})]},j))}):w.jsx("span",{className:"text-xs text-muted-foreground",children:"No tags yet."})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Suggestions"}),ne?w.jsx("div",{className:"flex flex-wrap gap-2",children:J.map(j=>w.jsx("button",{type:"button",className:"rounded-full border border-border bg-muted px-2.5 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary/40 hover:bg-primary/10 hover:text-primary",onClick:()=>v==null?void 0:v(j),children:j},j))}):w.jsx("span",{className:"text-xs text-muted-foreground",children:"No suggestions yet."})]})]})]})})]}):null]})})}/**
526
- * table-core
527
- *
528
- * Copyright (c) TanStack
529
- *
530
- * This source code is licensed under the MIT license found in the
531
- * LICENSE.md file in the root directory of this source tree.
532
- *
533
- * @license MIT
534
- */function to(e,t){return typeof e=="function"?e(t):e}function Qt(e,t){return n=>{t.setState(r=>({...r,[e]:to(n,r[e])}))}}function yf(e){return e instanceof Function}function VV(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function DR(e,t){const n=[],r=o=>{o.forEach(i=>{n.push(i);const s=t(i);s!=null&&s.length&&r(s)})};return r(e),n}function le(e,t,n){let r=[],o;return i=>{let s;n.key&&n.debug&&(s=Date.now());const l=e(i);if(!(l.length!==r.length||l.some((c,d)=>r[d]!==c)))return o;r=l;let u;if(n.key&&n.debug&&(u=Date.now()),o=t(...l),n==null||n.onChange==null||n.onChange(o),n.key&&n.debug&&n!=null&&n.debug()){const c=Math.round((Date.now()-s)*100)/100,d=Math.round((Date.now()-u)*100)/100,f=d/16,p=(h,m)=>{for(h=String(h);h.length<m;)h=" "+h;return h};console.info(`%c⏱ ${p(d,5)} /${p(c,5)} ms`,`
535
- font-size: .6rem;
536
- font-weight: bold;
537
- color: hsl(${Math.max(0,Math.min(120-120*f,120))}deg 100% 31%);`,n==null?void 0:n.key)}return o}}function ae(e,t,n,r){return{debug:()=>{var o;return(o=e==null?void 0:e.debugAll)!=null?o:e[t]},key:!1,onChange:r}}function HV(e,t,n,r){const o=()=>{var s;return(s=i.getValue())!=null?s:e.options.renderFallbackValue},i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:o,getContext:le(()=>[e,n,t,i],(s,l,a,u)=>({table:s,column:l,row:a,cell:u,getValue:u.getValue,renderValue:u.renderValue}),ae(e.options,"debugCells"))};return e._features.forEach(s=>{s.createCell==null||s.createCell(i,n,t,e)},{}),i}function UV(e,t,n,r){var o,i;const l={...e._getDefaultColumnDef(),...t},a=l.accessorKey;let u=(o=(i=l.id)!=null?i:a?typeof String.prototype.replaceAll=="function"?a.replaceAll(".","_"):a.replace(/\./g,"_"):void 0)!=null?o:typeof l.header=="string"?l.header:void 0,c;if(l.accessorFn?c=l.accessorFn:a&&(a.includes(".")?c=f=>{let p=f;for(const m of a.split(".")){var h;p=(h=p)==null?void 0:h[m]}return p}:c=f=>f[l.accessorKey]),!u)throw new Error;let d={id:`${String(u)}`,accessorFn:c,parent:r,depth:n,columnDef:l,columns:[],getFlatColumns:le(()=>[!0],()=>{var f;return[d,...(f=d.columns)==null?void 0:f.flatMap(p=>p.getFlatColumns())]},ae(e.options,"debugColumns")),getLeafColumns:le(()=>[e._getOrderColumnsFn()],f=>{var p;if((p=d.columns)!=null&&p.length){let h=d.columns.flatMap(m=>m.getLeafColumns());return f(h)}return[d]},ae(e.options,"debugColumns"))};for(const f of e._features)f.createColumn==null||f.createColumn(d,e);return d}const yt="debugHeaders";function wk(e,t,n){var r;let i={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const s=[],l=a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders.map(l),s.push(a)};return l(i),s},getContext:()=>({table:e,header:i,column:t})};return e._features.forEach(s=>{s.createHeader==null||s.createHeader(i,e)}),i}const WV={createTable:e=>{e.getHeaderGroups=le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,o)=>{var i,s;const l=(i=r==null?void 0:r.map(d=>n.find(f=>f.id===d)).filter(Boolean))!=null?i:[],a=(s=o==null?void 0:o.map(d=>n.find(f=>f.id===d)).filter(Boolean))!=null?s:[],u=n.filter(d=>!(r!=null&&r.includes(d.id))&&!(o!=null&&o.includes(d.id)));return Ru(t,[...l,...u,...a],e)},ae(e.options,yt)),e.getCenterHeaderGroups=le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,o)=>(n=n.filter(i=>!(r!=null&&r.includes(i.id))&&!(o!=null&&o.includes(i.id))),Ru(t,n,e,"center")),ae(e.options,yt)),e.getLeftHeaderGroups=le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var o;const i=(o=r==null?void 0:r.map(s=>n.find(l=>l.id===s)).filter(Boolean))!=null?o:[];return Ru(t,i,e,"left")},ae(e.options,yt)),e.getRightHeaderGroups=le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var o;const i=(o=r==null?void 0:r.map(s=>n.find(l=>l.id===s)).filter(Boolean))!=null?o:[];return Ru(t,i,e,"right")},ae(e.options,yt)),e.getFooterGroups=le(()=>[e.getHeaderGroups()],t=>[...t].reverse(),ae(e.options,yt)),e.getLeftFooterGroups=le(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),ae(e.options,yt)),e.getCenterFooterGroups=le(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),ae(e.options,yt)),e.getRightFooterGroups=le(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),ae(e.options,yt)),e.getFlatHeaders=le(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),ae(e.options,yt)),e.getLeftFlatHeaders=le(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),ae(e.options,yt)),e.getCenterFlatHeaders=le(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),ae(e.options,yt)),e.getRightFlatHeaders=le(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),ae(e.options,yt)),e.getCenterLeafHeaders=le(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),ae(e.options,yt)),e.getLeftLeafHeaders=le(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),ae(e.options,yt)),e.getRightLeafHeaders=le(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),ae(e.options,yt)),e.getLeafHeaders=le(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var o,i,s,l,a,u;return[...(o=(i=t[0])==null?void 0:i.headers)!=null?o:[],...(s=(l=n[0])==null?void 0:l.headers)!=null?s:[],...(a=(u=r[0])==null?void 0:u.headers)!=null?a:[]].map(c=>c.getLeafHeaders()).flat()},ae(e.options,yt))}};function Ru(e,t,n,r){var o,i;let s=0;const l=function(f,p){p===void 0&&(p=1),s=Math.max(s,p),f.filter(h=>h.getIsVisible()).forEach(h=>{var m;(m=h.columns)!=null&&m.length&&l(h.columns,p+1)},0)};l(e);let a=[];const u=(f,p)=>{const h={depth:p,id:[r,`${p}`].filter(Boolean).join("_"),headers:[]},m=[];f.forEach(y=>{const g=[...m].reverse()[0],v=y.column.depth===h.depth;let k,S=!1;if(v&&y.column.parent?k=y.column.parent:(k=y.column,S=!0),g&&(g==null?void 0:g.column)===k)g.subHeaders.push(y);else{const b=wk(n,k,{id:[r,p,k.id,y==null?void 0:y.id].filter(Boolean).join("_"),isPlaceholder:S,placeholderId:S?`${m.filter(E=>E.column===k).length}`:void 0,depth:p,index:m.length});b.subHeaders.push(y),m.push(b)}h.headers.push(y),y.headerGroup=h}),a.push(h),p>0&&u(m,p-1)},c=t.map((f,p)=>wk(n,f,{depth:s,index:p}));u(c,s-1),a.reverse();const d=f=>f.filter(h=>h.column.getIsVisible()).map(h=>{let m=0,y=0,g=[0];h.subHeaders&&h.subHeaders.length?(g=[],d(h.subHeaders).forEach(k=>{let{colSpan:S,rowSpan:b}=k;m+=S,g.push(b)})):m=1;const v=Math.min(...g);return y=y+v,h.colSpan=m,h.rowSpan=y,{colSpan:m,rowSpan:y}});return d((o=(i=a[0])==null?void 0:i.headers)!=null?o:[]),a}const vf=(e,t,n,r,o,i,s)=>{let l={id:t,index:r,original:n,depth:o,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:a=>{if(l._valuesCache.hasOwnProperty(a))return l._valuesCache[a];const u=e.getColumn(a);if(u!=null&&u.accessorFn)return l._valuesCache[a]=u.accessorFn(l.original,r),l._valuesCache[a]},getUniqueValues:a=>{if(l._uniqueValuesCache.hasOwnProperty(a))return l._uniqueValuesCache[a];const u=e.getColumn(a);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(l._uniqueValuesCache[a]=u.columnDef.getUniqueValues(l.original,r),l._uniqueValuesCache[a]):(l._uniqueValuesCache[a]=[l.getValue(a)],l._uniqueValuesCache[a])},renderValue:a=>{var u;return(u=l.getValue(a))!=null?u:e.options.renderFallbackValue},subRows:i??[],getLeafRows:()=>DR(l.subRows,a=>a.subRows),getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let a=[],u=l;for(;;){const c=u.getParentRow();if(!c)break;a.push(c),u=c}return a.reverse()},getAllCells:le(()=>[e.getAllLeafColumns()],a=>a.map(u=>HV(e,l,u,u.id)),ae(e.options,"debugRows")),_getAllCellsByColumnId:le(()=>[l.getAllCells()],a=>a.reduce((u,c)=>(u[c.column.id]=c,u),{}),ae(e.options,"debugRows"))};for(let a=0;a<e._features.length;a++){const u=e._features[a];u==null||u.createRow==null||u.createRow(l,e)}return l},GV={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},LR=(e,t,n)=>{var r,o;const i=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((o=e.getValue(t))==null||(o=o.toString())==null||(o=o.toLowerCase())==null)&&o.includes(i))};LR.autoRemove=e=>On(e);const _R=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};_R.autoRemove=e=>On(e);const $R=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===(n==null?void 0:n.toLowerCase())};$R.autoRemove=e=>On(e);const zR=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};zR.autoRemove=e=>On(e);const jR=(e,t,n)=>!n.some(r=>{var o;return!((o=e.getValue(t))!=null&&o.includes(r))});jR.autoRemove=e=>On(e)||!(e!=null&&e.length);const FR=(e,t,n)=>n.some(r=>{var o;return(o=e.getValue(t))==null?void 0:o.includes(r)});FR.autoRemove=e=>On(e)||!(e!=null&&e.length);const BR=(e,t,n)=>e.getValue(t)===n;BR.autoRemove=e=>On(e);const VR=(e,t,n)=>e.getValue(t)==n;VR.autoRemove=e=>On(e);const lv=(e,t,n)=>{let[r,o]=n;const i=e.getValue(t);return i>=r&&i<=o};lv.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,o=typeof n!="number"?parseFloat(n):n,i=t===null||Number.isNaN(r)?-1/0:r,s=n===null||Number.isNaN(o)?1/0:o;if(i>s){const l=i;i=s,s=l}return[i,s]};lv.autoRemove=e=>On(e)||On(e[0])&&On(e[1]);const cr={includesString:LR,includesStringSensitive:_R,equalsString:$R,arrIncludes:zR,arrIncludesAll:jR,arrIncludesSome:FR,equals:BR,weakEquals:VR,inNumberRange:lv};function On(e){return e==null||e===""}const qV={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Qt("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);return typeof r=="string"?cr.includesString:typeof r=="number"?cr.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?cr.equals:Array.isArray(r)?cr.arrIncludes:cr.weakEquals},e.getFilterFn=()=>{var n,r;return yf(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:cr[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,o;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const o=e.getFilterFn(),i=r==null?void 0:r.find(c=>c.id===e.id),s=to(n,i?i.value:void 0);if(kk(o,s,e)){var l;return(l=r==null?void 0:r.filter(c=>c.id!==e.id))!=null?l:[]}const a={id:e.id,value:s};if(i){var u;return(u=r==null?void 0:r.map(c=>c.id===e.id?a:c))!=null?u:[]}return r!=null&&r.length?[...r,a]:[a]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=o=>{var i;return(i=to(t,o))==null?void 0:i.filter(s=>{const l=n.find(a=>a.id===s.id);if(l){const a=l.getFilterFn();if(kk(a,s.value,l))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function kk(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const KV=(e,t,n)=>n.reduce((r,o)=>{const i=o.getValue(e);return r+(typeof i=="number"?i:0)},0),JV=(e,t,n)=>{let r;return n.forEach(o=>{const i=o.getValue(e);i!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}),r},QV=(e,t,n)=>{let r;return n.forEach(o=>{const i=o.getValue(e);i!=null&&(r<i||r===void 0&&i>=i)&&(r=i)}),r},XV=(e,t,n)=>{let r,o;return n.forEach(i=>{const s=i.getValue(e);s!=null&&(r===void 0?s>=s&&(r=o=s):(r>s&&(r=s),o<s&&(o=s)))}),[r,o]},YV=(e,t)=>{let n=0,r=0;if(t.forEach(o=>{let i=o.getValue(e);i!=null&&(i=+i)>=i&&(++n,r+=i)}),n)return r/n},ZV=(e,t)=>{if(!t.length)return;const n=t.map(i=>i.getValue(e));if(!VV(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),o=n.sort((i,s)=>i-s);return n.length%2!==0?o[r]:(o[r-1]+o[r])/2},eH=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),tH=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,nH=(e,t)=>t.length,Wp={sum:KV,min:JV,max:QV,extent:XV,mean:YV,median:ZV,unique:eH,uniqueCount:tH,count:nH},rH={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Qt("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((r=t.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);if(typeof r=="number")return Wp.sum;if(Object.prototype.toString.call(r)==="[object Date]")return Wp.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return yf(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:Wp[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=n.subRows)!=null&&o.length)}}};function oH(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(i=>!t.includes(i.id));return n==="remove"?r:[...t.map(i=>e.find(s=>s.id===i)).filter(Boolean),...r]}const iH={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Qt("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=le(n=>[_l(t,n)],n=>n.findIndex(r=>r.id===e.id),ae(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=_l(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const o=_l(t,n);return((r=o[o.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=le(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>o=>{let i=[];if(!(t!=null&&t.length))i=o;else{const s=[...t],l=[...o];for(;l.length&&s.length;){const a=s.shift(),u=l.findIndex(c=>c.id===a);u>-1&&i.push(l.splice(u,1)[0])}i=[...i,...l]}return oH(i,n,r)},ae(e.options,"debugTable"))}},Gp=()=>({left:[],right:[]}),sH={getInitialState:e=>({columnPinning:Gp(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Qt("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(o=>o.id).filter(Boolean);t.setColumnPinning(o=>{var i,s;if(n==="right"){var l,a;return{left:((l=o==null?void 0:o.left)!=null?l:[]).filter(d=>!(r!=null&&r.includes(d))),right:[...((a=o==null?void 0:o.right)!=null?a:[]).filter(d=>!(r!=null&&r.includes(d))),...r]}}if(n==="left"){var u,c;return{left:[...((u=o==null?void 0:o.left)!=null?u:[]).filter(d=>!(r!=null&&r.includes(d))),...r],right:((c=o==null?void 0:o.right)!=null?c:[]).filter(d=>!(r!=null&&r.includes(d)))}}return{left:((i=o==null?void 0:o.left)!=null?i:[]).filter(d=>!(r!=null&&r.includes(d))),right:((s=o==null?void 0:o.right)!=null?s:[]).filter(d=>!(r!=null&&r.includes(d)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var o,i,s;return((o=r.columnDef.enablePinning)!=null?o:!0)&&((i=(s=t.options.enableColumnPinning)!=null?s:t.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(l=>l.id),{left:r,right:o}=t.getState().columnPinning,i=n.some(l=>r==null?void 0:r.includes(l)),s=n.some(l=>o==null?void 0:o.includes(l));return i?"left":s?"right":!1},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();return o?(n=(r=t.getState().columnPinning)==null||(r=r[o])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,o)=>{const i=[...r??[],...o??[]];return n.filter(s=>!i.includes(s.column.id))},ae(t.options,"debugRows")),e.getLeftVisibleCells=le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(i=>n.find(s=>s.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),ae(t.options,"debugRows")),e.getRightVisibleCells=le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(i=>n.find(s=>s.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),ae(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?Gp():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:Gp())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var o,i;return!!((o=r.left)!=null&&o.length||(i=r.right)!=null&&i.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(o=>o.id===r)).filter(Boolean),ae(e.options,"debugColumns")),e.getRightLeafColumns=le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(o=>o.id===r)).filter(Boolean),ae(e.options,"debugColumns")),e.getCenterLeafColumns=le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const o=[...n??[],...r??[]];return t.filter(i=>!o.includes(i.id))},ae(e.options,"debugColumns"))}};function lH(e){return e||(typeof document<"u"?document:null)}const Tu={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},qp=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),aH={getDefaultColumnDef:()=>Tu,getInitialState:e=>({columnSizing:{},columnSizingInfo:qp(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Qt("columnSizing",e),onColumnSizingInfoChange:Qt("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,o;const i=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:Tu.minSize,(r=i??e.columnDef.size)!=null?r:Tu.size),(o=e.columnDef.maxSize)!=null?o:Tu.maxSize)},e.getStart=le(n=>[n,_l(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((o,i)=>o+i.getSize(),0),ae(t.options,"debugColumns")),e.getAfter=le(n=>[n,_l(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((o,i)=>o+i.getSize(),0),ae(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...o}=n;return o})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=o=>{if(o.subHeaders.length)o.subHeaders.forEach(r);else{var i;n+=(i=o.column.getSize())!=null?i:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),o=r==null?void 0:r.getCanResize();return i=>{if(!r||!o||(i.persist==null||i.persist(),Kp(i)&&i.touches&&i.touches.length>1))return;const s=e.getSize(),l=e?e.getLeafHeaders().map(g=>[g.column.id,g.column.getSize()]):[[r.id,r.getSize()]],a=Kp(i)?Math.round(i.touches[0].clientX):i.clientX,u={},c=(g,v)=>{typeof v=="number"&&(t.setColumnSizingInfo(k=>{var S,b;const E=t.options.columnResizeDirection==="rtl"?-1:1,M=(v-((S=k==null?void 0:k.startOffset)!=null?S:0))*E,R=Math.max(M/((b=k==null?void 0:k.startSize)!=null?b:0),-.999999);return k.columnSizingStart.forEach(D=>{let[I,J]=D;u[I]=Math.round(Math.max(J+J*R,0)*100)/100}),{...k,deltaOffset:M,deltaPercentage:R}}),(t.options.columnResizeMode==="onChange"||g==="end")&&t.setColumnSizing(k=>({...k,...u})))},d=g=>c("move",g),f=g=>{c("end",g),t.setColumnSizingInfo(v=>({...v,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=lH(n),h={moveHandler:g=>d(g.clientX),upHandler:g=>{p==null||p.removeEventListener("mousemove",h.moveHandler),p==null||p.removeEventListener("mouseup",h.upHandler),f(g.clientX)}},m={moveHandler:g=>(g.cancelable&&(g.preventDefault(),g.stopPropagation()),d(g.touches[0].clientX),!1),upHandler:g=>{var v;p==null||p.removeEventListener("touchmove",m.moveHandler),p==null||p.removeEventListener("touchend",m.upHandler),g.cancelable&&(g.preventDefault(),g.stopPropagation()),f((v=g.touches[0])==null?void 0:v.clientX)}},y=uH()?{passive:!1}:!1;Kp(i)?(p==null||p.addEventListener("touchmove",m.moveHandler,y),p==null||p.addEventListener("touchend",m.upHandler,y)):(p==null||p.addEventListener("mousemove",h.moveHandler,y),p==null||p.addEventListener("mouseup",h.upHandler,y)),t.setColumnSizingInfo(g=>({...g,startOffset:a,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?qp():(n=e.initialState.columnSizingInfo)!=null?n:qp())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0}}};let Nu=null;function uH(){if(typeof Nu=="boolean")return Nu;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Nu=e,Nu}function Kp(e){return e.type==="touchstart"}const cH={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Qt("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const o=e.columns;return(n=o.length?o.some(i=>i.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=le(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),ae(t.options,"debugRows")),e.getVisibleCells=le(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,o)=>[...n,...r,...o],ae(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>le(()=>[r(),r().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),ae(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,i)=>({...o,[i.id]:n||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function _l(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const dH={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},fH={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Qt("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,o,i;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&((i=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>cr.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return yf(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:cr[r]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},pH={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Qt("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,o;if(!t){e._queue(()=>{t=!0});return}if((r=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var o,i;e.setExpanded(r?{}:(o=(i=e.initialState)==null?void 0:i.expanded)!=null?o:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const s=i.split(".");r=Math.max(r,s.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var o;const i=r===!0?!0:!!(r!=null&&r[e.id]);let s={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(l=>{s[l]=!0}):s=r,n=(o=n)!=null?o:!i,!i&&n)return{...s,[e.id]:!0};if(i&&!n){const{[e.id]:l,...a}=s;return a}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r!=null&&r[e.id])},e.getCanExpand=()=>{var n,r,o;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((o=e.subRows)!=null&&o.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},$m=0,zm=10,Jp=()=>({pageIndex:$m,pageSize:zm}),hH={getInitialState:e=>({...e,pagination:{...Jp(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Qt("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,o;if(!t){e._queue(()=>{t=!0});return}if((r=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const o=i=>to(r,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=r=>{var o;e.setPagination(r?Jp():(o=e.initialState.pagination)!=null?o:Jp())},e.setPageIndex=r=>{e.setPagination(o=>{let i=to(r,o.pageIndex);const s=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,s)),{...o,pageIndex:i}})},e.resetPageIndex=r=>{var o,i;e.setPageIndex(r?$m:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?o:$m)},e.resetPageSize=r=>{var o,i;e.setPageSize(r?zm:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?o:zm)},e.setPageSize=r=>{e.setPagination(o=>{const i=Math.max(1,to(r,o.pageSize)),s=o.pageSize*o.pageIndex,l=Math.floor(s/i);return{...o,pageIndex:l,pageSize:i}})},e.setPageCount=r=>e.setPagination(o=>{var i;let s=to(r,(i=e.options.pageCount)!=null?i:-1);return typeof s=="number"&&(s=Math.max(-1,s)),{...o,pageCount:s}}),e.getPageOptions=le(()=>[e.getPageCount()],r=>{let o=[];return r&&r>0&&(o=[...new Array(r)].fill(null).map((i,s)=>s)),o},ae(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:r<o-1},e.previousPage=()=>e.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},Qp=()=>({top:[],bottom:[]}),mH={getInitialState:e=>({rowPinning:Qp(),...e}),getDefaultOptions:e=>({onRowPinningChange:Qt("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,o)=>{const i=r?e.getLeafRows().map(a=>{let{id:u}=a;return u}):[],s=o?e.getParentRows().map(a=>{let{id:u}=a;return u}):[],l=new Set([...s,e.id,...i]);t.setRowPinning(a=>{var u,c;if(n==="bottom"){var d,f;return{top:((d=a==null?void 0:a.top)!=null?d:[]).filter(m=>!(l!=null&&l.has(m))),bottom:[...((f=a==null?void 0:a.bottom)!=null?f:[]).filter(m=>!(l!=null&&l.has(m))),...Array.from(l)]}}if(n==="top"){var p,h;return{top:[...((p=a==null?void 0:a.top)!=null?p:[]).filter(m=>!(l!=null&&l.has(m))),...Array.from(l)],bottom:((h=a==null?void 0:a.bottom)!=null?h:[]).filter(m=>!(l!=null&&l.has(m)))}}return{top:((u=a==null?void 0:a.top)!=null?u:[]).filter(m=>!(l!=null&&l.has(m))),bottom:((c=a==null?void 0:a.bottom)!=null?c:[]).filter(m=>!(l!=null&&l.has(m)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:o}=t.options;return typeof r=="function"?r(e):(n=r??o)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:o}=t.getState().rowPinning,i=n.some(l=>r==null?void 0:r.includes(l)),s=n.some(l=>o==null?void 0:o.includes(l));return i?"top":s?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();if(!o)return-1;const i=(n=o==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(s=>{let{id:l}=s;return l});return(r=i==null?void 0:i.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?Qp():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:Qp())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var o,i;return!!((o=r.top)!=null&&o.length||(i=r.bottom)!=null&&i.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=(t,n,r)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(n??[]).map(s=>{const l=e.getRow(s,!0);return l.getIsAllParentsExpanded()?l:null}):(n??[]).map(s=>t.find(l=>l.id===s))).filter(Boolean).map(s=>({...s,position:r}))},e.getTopRows=le(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),ae(e.options,"debugRows")),e.getBottomRows=le(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),ae(e.options,"debugRows")),e.getCenterRows=le(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const o=new Set([...n??[],...r??[]]);return t.filter(i=>!o.has(i.id))},ae(e.options,"debugRows"))}},gH={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Qt("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach(i=>{i.getCanSelect()&&(r[i.id]=!0)}):o.forEach(i=>{delete r[i.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),o={...n};return e.getRowModel().rows.forEach(i=>{jm(o,i.id,r,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=le(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Xp(e,n):{rows:[],flatRows:[],rowsById:{}},ae(e.options,"debugTable")),e.getFilteredSelectedRowModel=le(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Xp(e,n):{rows:[],flatRows:[],rowsById:{}},ae(e.options,"debugTable")),e.getGroupedSelectedRowModel=le(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Xp(e,n):{rows:[],flatRows:[],rowsById:{}},ae(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(o=>o.getCanSelect()&&!n[o.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(o=>!n[o.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const o=e.getIsSelected();t.setRowSelection(i=>{var s;if(n=typeof n<"u"?n:!o,e.getCanSelect()&&o===n)return i;const l={...i};return jm(l,e.id,n,(s=r==null?void 0:r.selectChildren)!=null?s:!0,t),l})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return av(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return Fm(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return Fm(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var o;n&&e.toggleSelected((o=r.target)==null?void 0:o.checked)}}}},jm=(e,t,n,r,o)=>{var i;const s=o.getRow(t,!0);n?(s.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),s.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(i=s.subRows)!=null&&i.length&&s.getCanSelectSubRows()&&s.subRows.forEach(l=>jm(e,l.id,n,r,o))};function Xp(e,t){const n=e.getState().rowSelection,r=[],o={},i=function(s,l){return s.map(a=>{var u;const c=av(a,n);if(c&&(r.push(a),o[a.id]=a),(u=a.subRows)!=null&&u.length&&(a={...a,subRows:i(a.subRows)}),c)return a}).filter(Boolean)};return{rows:i(t.rows),flatRows:r,rowsById:o}}function av(e,t){var n;return(n=t[e.id])!=null?n:!1}function Fm(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let o=!0,i=!1;return e.subRows.forEach(s=>{if(!(i&&!o)&&(s.getCanSelect()&&(av(s,t)?i=!0:o=!1),s.subRows&&s.subRows.length)){const l=Fm(s,t);l==="all"?i=!0:(l==="some"&&(i=!0),o=!1)}}),o?"all":i?"some":!1}const Bm=/([0-9]+)/gm,yH=(e,t,n)=>HR(bo(e.getValue(n)).toLowerCase(),bo(t.getValue(n)).toLowerCase()),vH=(e,t,n)=>HR(bo(e.getValue(n)),bo(t.getValue(n))),xH=(e,t,n)=>uv(bo(e.getValue(n)).toLowerCase(),bo(t.getValue(n)).toLowerCase()),wH=(e,t,n)=>uv(bo(e.getValue(n)),bo(t.getValue(n))),kH=(e,t,n)=>{const r=e.getValue(n),o=t.getValue(n);return r>o?1:r<o?-1:0},SH=(e,t,n)=>uv(e.getValue(n),t.getValue(n));function uv(e,t){return e===t?0:e>t?1:-1}function bo(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function HR(e,t){const n=e.split(Bm).filter(Boolean),r=t.split(Bm).filter(Boolean);for(;n.length&&r.length;){const o=n.shift(),i=r.shift(),s=parseInt(o,10),l=parseInt(i,10),a=[s,l].sort();if(isNaN(a[0])){if(o>i)return 1;if(i>o)return-1;continue}if(isNaN(a[1]))return isNaN(s)?-1:1;if(s>l)return 1;if(l>s)return-1}return n.length-r.length}const rl={alphanumeric:yH,alphanumericCaseSensitive:vH,text:xH,textCaseSensitive:wH,datetime:kH,basic:SH},bH={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Qt("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const o of n){const i=o==null?void 0:o.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return rl.datetime;if(typeof i=="string"&&(r=!0,i.split(Bm).length>1))return rl.alphanumeric}return r?rl.text:rl.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return yf(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:rl[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const o=e.getNextSortingOrder(),i=typeof n<"u"&&n!==null;t.setSorting(s=>{const l=s==null?void 0:s.find(p=>p.id===e.id),a=s==null?void 0:s.findIndex(p=>p.id===e.id);let u=[],c,d=i?n:o==="desc";if(s!=null&&s.length&&e.getCanMultiSort()&&r?l?c="toggle":c="add":s!=null&&s.length&&a!==s.length-1?c="replace":l?c="toggle":c="replace",c==="toggle"&&(i||o||(c="remove")),c==="add"){var f;u=[...s,{id:e.id,desc:d}],u.splice(0,u.length-((f=t.options.maxMultiSortColCount)!=null?f:Number.MAX_SAFE_INTEGER))}else c==="toggle"?u=s.map(p=>p.id===e.id?{...p,desc:d}:p):c==="remove"?u=s.filter(p=>p.id!==e.id):u=[{id:e.id,desc:d}];return u})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,o;const i=e.getFirstSortDir(),s=e.getIsSorted();return s?s!==i&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(o=t.options.enableMultiRemove)!=null)||o)?!1:s==="desc"?"asc":"desc":i},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(o=>o.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},CH=[WV,cH,iH,sH,GV,qV,dH,fH,bH,rH,pH,hH,mH,gH,aH];function EH(e){var t,n;const r=[...CH,...(t=e._features)!=null?t:[]];let o={_features:r};const i=o._features.reduce((f,p)=>Object.assign(f,p.getDefaultOptions==null?void 0:p.getDefaultOptions(o)),{}),s=f=>o.options.mergeOptions?o.options.mergeOptions(i,f):{...i,...f};let a={...{},...(n=e.initialState)!=null?n:{}};o._features.forEach(f=>{var p;a=(p=f.getInitialState==null?void 0:f.getInitialState(a))!=null?p:a});const u=[];let c=!1;const d={_features:r,options:{...i,...e},initialState:a,_queue:f=>{u.push(f),c||(c=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();c=!1}).catch(p=>setTimeout(()=>{throw p})))},reset:()=>{o.setState(o.initialState)},setOptions:f=>{const p=to(f,o.options);o.options=s(p)},getState:()=>o.options.state,setState:f=>{o.options.onStateChange==null||o.options.onStateChange(f)},_getRowId:(f,p,h)=>{var m;return(m=o.options.getRowId==null?void 0:o.options.getRowId(f,p,h))!=null?m:`${h?[h.id,p].join("."):p}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(f,p)=>{let h=(p?o.getPrePaginationRowModel():o.getRowModel()).rowsById[f];if(!h&&(h=o.getCoreRowModel().rowsById[f],!h))throw new Error;return h},_getDefaultColumnDef:le(()=>[o.options.defaultColumn],f=>{var p;return f=(p=f)!=null?p:{},{header:h=>{const m=h.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:h=>{var m,y;return(m=(y=h.renderValue())==null||y.toString==null?void 0:y.toString())!=null?m:null},...o._features.reduce((h,m)=>Object.assign(h,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...f}},ae(e,"debugColumns")),_getColumnDefs:()=>o.options.columns,getAllColumns:le(()=>[o._getColumnDefs()],f=>{const p=function(h,m,y){return y===void 0&&(y=0),h.map(g=>{const v=UV(o,g,y,m),k=g;return v.columns=k.columns?p(k.columns,v,y+1):[],v})};return p(f)},ae(e,"debugColumns")),getAllFlatColumns:le(()=>[o.getAllColumns()],f=>f.flatMap(p=>p.getFlatColumns()),ae(e,"debugColumns")),_getAllFlatColumnsById:le(()=>[o.getAllFlatColumns()],f=>f.reduce((p,h)=>(p[h.id]=h,p),{}),ae(e,"debugColumns")),getAllLeafColumns:le(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(f,p)=>{let h=f.flatMap(m=>m.getLeafColumns());return p(h)},ae(e,"debugColumns")),getColumn:f=>o._getAllFlatColumnsById()[f]};Object.assign(o,d);for(let f=0;f<o._features.length;f++){const p=o._features[f];p==null||p.createTable==null||p.createTable(o)}return o}function MH(){return e=>le(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(o,i,s){i===void 0&&(i=0);const l=[];for(let u=0;u<o.length;u++){const c=vf(e,e._getRowId(o[u],u,s),o[u],u,i,void 0,s==null?void 0:s.id);if(n.flatRows.push(c),n.rowsById[c.id]=c,l.push(c),e.options.getSubRows){var a;c.originalSubRows=e.options.getSubRows(o[u],u),(a=c.originalSubRows)!=null&&a.length&&(c.subRows=r(c.originalSubRows,i+1,c))}}return l};return n.rows=r(t),n},ae(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function RH(){return e=>le(()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows],(t,n,r)=>!n.rows.length||t!==!0&&!Object.keys(t??{}).length||!r?n:TH(n),ae(e.options,"debugTable"))}function TH(e){const t=[],n=r=>{var o;t.push(r),(o=r.subRows)!=null&&o.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function NH(e,t,n){return n.options.filterFromLeafRows?AH(e,t,n):OH(e,t,n)}function AH(e,t,n){var r;const o=[],i={},s=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,l=function(a,u){u===void 0&&(u=0);const c=[];for(let f=0;f<a.length;f++){var d;let p=a[f];const h=vf(n,p.id,p.original,p.index,p.depth,void 0,p.parentId);if(h.columnFilters=p.columnFilters,(d=p.subRows)!=null&&d.length&&u<s){if(h.subRows=l(p.subRows,u+1),p=h,t(p)&&!h.subRows.length){c.push(p),i[p.id]=p,o.push(p);continue}if(t(p)||h.subRows.length){c.push(p),i[p.id]=p,o.push(p);continue}}else p=h,t(p)&&(c.push(p),i[p.id]=p,o.push(p))}return c};return{rows:l(e),flatRows:o,rowsById:i}}function OH(e,t,n){var r;const o=[],i={},s=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,l=function(a,u){u===void 0&&(u=0);const c=[];for(let f=0;f<a.length;f++){let p=a[f];if(t(p)){var d;if((d=p.subRows)!=null&&d.length&&u<s){const m=vf(n,p.id,p.original,p.index,p.depth,void 0,p.parentId);m.subRows=l(p.subRows,u+1),p=m}c.push(p),o.push(p),i[p.id]=p}}return c};return{rows:l(e),flatRows:o,rowsById:i}}function PH(){return e=>le(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let f=0;f<t.flatRows.length;f++)t.flatRows[f].columnFilters={},t.flatRows[f].columnFiltersMeta={};return t}const o=[],i=[];(n??[]).forEach(f=>{var p;const h=e.getColumn(f.id);if(!h)return;const m=h.getFilterFn();m&&o.push({id:f.id,filterFn:m,resolvedValue:(p=m.resolveFilterValue==null?void 0:m.resolveFilterValue(f.value))!=null?p:f.value})});const s=(n??[]).map(f=>f.id),l=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(f=>f.getCanGlobalFilter());r&&l&&a.length&&(s.push("__global__"),a.forEach(f=>{var p;i.push({id:f.id,filterFn:l,resolvedValue:(p=l.resolveFilterValue==null?void 0:l.resolveFilterValue(r))!=null?p:r})}));let u,c;for(let f=0;f<t.flatRows.length;f++){const p=t.flatRows[f];if(p.columnFilters={},o.length)for(let h=0;h<o.length;h++){u=o[h];const m=u.id;p.columnFilters[m]=u.filterFn(p,m,u.resolvedValue,y=>{p.columnFiltersMeta[m]=y})}if(i.length){for(let h=0;h<i.length;h++){c=i[h];const m=c.id;if(c.filterFn(p,m,c.resolvedValue,y=>{p.columnFiltersMeta[m]=y})){p.columnFilters.__global__=!0;break}}p.columnFilters.__global__!==!0&&(p.columnFilters.__global__=!1)}}const d=f=>{for(let p=0;p<s.length;p++)if(f.columnFilters[s[p]]===!1)return!1;return!0};return NH(t.rows,d,e)},ae(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function IH(){return e=>le(()=>[e.getState().grouping,e.getPreGroupedRowModel()],(t,n)=>{if(!n.rows.length||!t.length)return n.rows.forEach(a=>{a.depth=0,a.parentId=void 0}),n;const r=t.filter(a=>e.getColumn(a)),o=[],i={},s=function(a,u,c){if(u===void 0&&(u=0),u>=r.length)return a.map(h=>(h.depth=u,o.push(h),i[h.id]=h,h.subRows&&(h.subRows=s(h.subRows,u+1,h.id)),h));const d=r[u],f=DH(a,d);return Array.from(f.entries()).map((h,m)=>{let[y,g]=h,v=`${d}:${y}`;v=c?`${c}>${v}`:v;const k=s(g,u+1,v);k.forEach(E=>{E.parentId=v});const S=u?DR(g,E=>E.subRows):g,b=vf(e,v,S[0].original,m,u,void 0,c);return Object.assign(b,{groupingColumnId:d,groupingValue:y,subRows:k,leafRows:S,getValue:E=>{if(r.includes(E)){if(b._valuesCache.hasOwnProperty(E))return b._valuesCache[E];if(g[0]){var M;b._valuesCache[E]=(M=g[0].getValue(E))!=null?M:void 0}return b._valuesCache[E]}if(b._groupingValuesCache.hasOwnProperty(E))return b._groupingValuesCache[E];const R=e.getColumn(E),D=R==null?void 0:R.getAggregationFn();if(D)return b._groupingValuesCache[E]=D(E,S,g),b._groupingValuesCache[E]}}),k.forEach(E=>{o.push(E),i[E.id]=E}),b})},l=s(n.rows,0);return l.forEach(a=>{o.push(a),i[a.id]=a}),{rows:l,flatRows:o,rowsById:i}},ae(e.options,"debugTable","getGroupedRowModel",()=>{e._queue(()=>{e._autoResetExpanded(),e._autoResetPageIndex()})}))}function DH(e,t){const n=new Map;return e.reduce((r,o)=>{const i=`${o.getGroupingValue(t)}`,s=r.get(i);return s?s.push(o):r.set(i,[o]),r},n)}function LH(){return e=>le(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,o=[],i=r.filter(a=>{var u;return(u=e.getColumn(a.id))==null?void 0:u.getCanSort()}),s={};i.forEach(a=>{const u=e.getColumn(a.id);u&&(s[a.id]={sortUndefined:u.columnDef.sortUndefined,invertSorting:u.columnDef.invertSorting,sortingFn:u.getSortingFn()})});const l=a=>{const u=a.map(c=>({...c}));return u.sort((c,d)=>{for(let p=0;p<i.length;p+=1){var f;const h=i[p],m=s[h.id],y=m.sortUndefined,g=(f=h==null?void 0:h.desc)!=null?f:!1;let v=0;if(y){const k=c.getValue(h.id),S=d.getValue(h.id),b=k===void 0,E=S===void 0;if(b||E){if(y==="first")return b?-1:1;if(y==="last")return b?1:-1;v=b&&E?0:b?y:-y}}if(v===0&&(v=m.sortingFn(c,d,h.id)),v!==0)return g&&(v*=-1),m.invertSorting&&(v*=-1),v}return c.index-d.index}),u.forEach(c=>{var d;o.push(c),(d=c.subRows)!=null&&d.length&&(c.subRows=l(c.subRows))}),u};return{rows:l(n.rows),flatRows:o,rowsById:n.rowsById}},ae(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
538
- * react-table
539
- *
540
- * Copyright (c) TanStack
541
- *
542
- * This source code is licensed under the MIT license found in the
543
- * LICENSE.md file in the root directory of this source tree.
544
- *
545
- * @license MIT
546
- */function Li(e,t){return e?_H(e)?x.createElement(e,t):e:null}function _H(e){return $H(e)||typeof e=="function"||zH(e)}function $H(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function zH(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function jH(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=x.useState(()=>({current:EH(t)})),[r,o]=x.useState(()=>n.current.initialState);return n.current.setOptions(i=>({...i,...e,state:{...r,...e.state},onStateChange:s=>{o(s),e.onStateChange==null||e.onStateChange(s)}})),n.current}function FH({data:e,columns:t,getRowId:n,initialSorting:r=[],initialGrouping:o=[],initialColumnOrder:i=[],initialColumnVisibility:s={},resetKey:l,onViewChange:a}){const[u,c]=x.useState(r),[d,f]=x.useState([]),[p,h]=x.useState(o),[m,y]=x.useState(i),[g,v]=x.useState(s),[k,S]=x.useState(!0),[b,E]=x.useState(""),[M,R]=x.useState(!1),D=x.useRef({sorting:r,grouping:o,columnOrder:i,columnVisibility:s});x.useEffect(()=>{D.current={sorting:r,grouping:o,columnOrder:i,columnVisibility:s}},[o,r,i,s]);const I=x.useMemo(()=>t.map(O=>O.id?O.id:"accessorKey"in O&&O.accessorKey?String(O.accessorKey):"").filter(O=>O.length>0),[t]),J=x.useCallback(O=>i.length>0||O.length!==I.length?O:O.every((se,ke)=>se===I[ke])?[]:O,[I,i.length]),ne=x.useCallback(O=>Object.keys(s).length>0?O:I.every(se=>O[se]??!0)?{}:O,[I,s]);x.useEffect(()=>{if(I.length===0)return;const O=D.current;c(O.sorting),h(O.grouping),y(O.columnOrder.length>0?O.columnOrder:I),v(O.columnVisibility),S(!0)},[I,l]),x.useEffect(()=>{a==null||a({sorting:u,grouping:p,columnOrder:J(m),columnVisibility:ne(g)})},[m,g,p,J,ne,a,u]);const re=jH({data:e,columns:t,state:{sorting:u,columnFilters:d,grouping:p,columnOrder:m,columnVisibility:g,expanded:k,globalFilter:b},onSortingChange:c,onColumnFiltersChange:f,onGroupingChange:h,onColumnOrderChange:y,onColumnVisibilityChange:v,onExpandedChange:S,onGlobalFilterChange:E,getRowId:n,getCoreRowModel:MH(),getFilteredRowModel:PH(),getSortedRowModel:LH(),getGroupedRowModel:IH(),getExpandedRowModel:RH(),enableGrouping:!0,groupedColumnMode:"remove",autoResetExpanded:!1,initialState:{expanded:!0}}),U=re.getAllColumns(),ie=U.filter(O=>O.getCanSort()),ue=U.filter(O=>O.getCanGroup()),fe=re.getAllLeafColumns(),N=u[0],j=(N==null?void 0:N.id)??"",te=(N==null?void 0:N.desc)??!1,he=p[0]??"",A=x.useMemo(()=>{if(!j||ie.some(se=>se.id===j))return ie;const H=U.find(se=>se.id===j);return H?[...ie,H]:ie},[j,U,ie]),V=x.useMemo(()=>{if(!he||ue.some(se=>se.id===he))return ue;const H=U.find(se=>se.id===he);return H?[...ue,H]:ue},[he,U,ue]),Y=()=>{c([]),f([]),h([]),S(!0),E("")},G=(O,H)=>{y(se=>{const ke=se.indexOf(O);if(ke===-1)return se;const Me=H==="up"?ke-1:ke+1;if(Me<0||Me>=se.length)return se;const Vt=[...se],[xi]=Vt.splice(ke,1);return Vt.splice(Me,0,xi),Vt})},pe=O=>{v(H=>({...H,[O]:!(H[O]??!0)}))};return w.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3",children:[w.jsxs("div",{className:"flex flex-wrap items-center gap-2 border border-border bg-card p-2",children:[w.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[w.jsx(_3,{className:"h-4 w-4"}),w.jsx("span",{children:"Filter"})]}),w.jsx("input",{value:b,onChange:O=>E(O.target.value),placeholder:"Search",className:"h-8 w-48 border border-input bg-background px-2 text-xs focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2"}),w.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[w.jsx(xu,{className:"h-4 w-4"}),w.jsx("span",{children:"Sort"})]}),w.jsxs("select",{value:j,onChange:O=>{const H=O.target.value;if(!H){c([]);return}c([{id:H,desc:te}])},className:"h-8 border border-input bg-background px-2 text-xs focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",children:[w.jsx("option",{value:"",children:"No sort"}),A.map(O=>w.jsx("option",{value:O.id,children:O.id},O.id))]}),w.jsx(Re,{type:"button",variant:"ghost",size:"icon",onClick:()=>{j&&c([{id:j,desc:!te}])},children:te?w.jsx(Lp,{className:"h-4 w-4"}):w.jsx(xu,{className:"h-4 w-4"})}),w.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[w.jsx(z3,{className:"h-4 w-4"}),w.jsx("span",{children:"Group"})]}),w.jsxs("select",{value:he,onChange:O=>{const H=O.target.value;h(H?[H]:[]),S(!0)},className:"h-8 border border-input bg-background px-2 text-xs focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",children:[w.jsx("option",{value:"",children:"No group"}),V.map(O=>w.jsx("option",{value:O.id,children:O.id},O.id))]}),w.jsx(Re,{type:"button",variant:"ghost",size:"sm",onClick:Y,children:"Clear"}),w.jsx(Re,{type:"button",variant:"ghost",size:"sm",onClick:()=>R(!0),children:"Columns"}),w.jsxs("div",{className:"ml-auto text-xs text-muted-foreground",children:[re.getFilteredRowModel().rows.length," rows"]})]}),M?w.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:w.jsxs("div",{className:"w-full max-w-lg border border-border bg-background",children:[w.jsxs("div",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[w.jsx("h4",{className:"text-sm font-semibold",children:"Columns"}),w.jsx(Re,{type:"button",size:"sm",variant:"ghost",onClick:()=>R(!1),children:"Close"})]}),w.jsx("div",{className:"max-h-[60vh] overflow-auto px-4 py-3",children:w.jsx("div",{className:"flex flex-col gap-2",children:fe.length===0?w.jsx("div",{className:"border border-border px-3 py-6 text-center text-sm text-muted-foreground",children:"No columns to display."}):m.map(O=>fe.find(H=>H.id===O)).filter(O=>!!O).map((O,H)=>{const se=O.getIsVisible(),ke=H===0,Me=H===m.length-1;return w.jsxs("div",{className:"flex items-center gap-2 border border-border px-3 py-2 text-xs",children:[w.jsx("input",{type:"checkbox",checked:se,onChange:()=>pe(O.id)}),w.jsx("span",{className:"flex-1 truncate",children:O.id}),w.jsxs("div",{className:"flex items-center gap-1",children:[w.jsx(Re,{type:"button",size:"icon",variant:"ghost",disabled:ke,onClick:()=>G(O.id,"up"),children:w.jsx(M3,{className:"h-4 w-4"})}),w.jsx(Re,{type:"button",size:"icon",variant:"ghost",disabled:Me,onClick:()=>G(O.id,"down"),children:w.jsx(Ju,{className:"h-4 w-4"})})]})]},O.id)})})}),w.jsxs("div",{className:"flex justify-between border-t border-border px-4 py-3",children:[w.jsx(Re,{type:"button",size:"sm",variant:"ghost",onClick:()=>{y(i.length>0?i:I),v(s)},children:"Reset columns"}),w.jsx(Re,{type:"button",size:"sm",onClick:()=>R(!1),children:"Done"})]})]})}):null,w.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:he?w.jsx("div",{className:"flex min-h-0 flex-col gap-3",children:re.getGroupedRowModel().rows.length===0?w.jsx("div",{className:"border border-border px-3 py-10 text-center text-sm text-muted-foreground",children:"No rows to display."}):re.getGroupedRowModel().rows.map(O=>{const H=O.groupingValue===void 0||O.groupingValue===null?"(empty)":String(O.groupingValue),se=O.getLeafRows();return w.jsxs("div",{className:"border border-border",children:[w.jsxs("button",{type:"button",onClick:O.getToggleExpandedHandler(),className:"flex w-full items-center gap-2 border-b border-border bg-muted px-3 py-2 text-left text-xs font-medium text-foreground",children:[O.getIsExpanded()?w.jsx(Ju,{className:"h-4 w-4"}):w.jsx(Zw,{className:"h-4 w-4"}),w.jsx("span",{children:H}),w.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",se.length,")"]})]}),O.getIsExpanded()&&w.jsxs("table",{className:"w-full border-collapse text-sm",children:[w.jsx("thead",{className:"sticky top-0 bg-muted",children:re.getHeaderGroups().map(ke=>w.jsx("tr",{children:ke.headers.map(Me=>w.jsx("th",{className:Ft("border-b border-border px-3 py-2 text-left font-medium text-foreground",Me.column.getCanSort()&&"cursor-pointer select-none"),onClick:Me.column.getCanSort()?Me.column.getToggleSortingHandler():void 0,children:w.jsxs("div",{className:"flex items-center gap-1",children:[Me.isPlaceholder?null:Li(Me.column.columnDef.header,Me.getContext()),{asc:w.jsx(xu,{className:"h-3 w-3"}),desc:w.jsx(Lp,{className:"h-3 w-3"})}[Me.column.getIsSorted()]??null]})},Me.id))},ke.id))}),w.jsx("tbody",{children:se.length===0?w.jsx("tr",{children:w.jsx("td",{colSpan:re.getVisibleLeafColumns().length,className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No rows to display."})}):se.map(ke=>w.jsx("tr",{className:"border-b border-border last:border-0",children:ke.getVisibleCells().map(Me=>w.jsx("td",{className:"px-3 py-2 align-top",children:Li(Me.column.columnDef.cell,Me.getContext())},Me.id))},ke.id))})]})]},O.id)})}):w.jsx("div",{className:"min-h-0 border border-border",children:w.jsxs("table",{className:"w-full border-collapse text-sm",children:[w.jsx("thead",{className:"sticky top-0 bg-muted",children:re.getHeaderGroups().map(O=>w.jsx("tr",{children:O.headers.map(H=>w.jsx("th",{className:Ft("border-b border-border px-3 py-2 text-left font-medium text-foreground",H.column.getCanSort()&&"cursor-pointer select-none"),onClick:H.column.getCanSort()?H.column.getToggleSortingHandler():void 0,children:w.jsxs("div",{className:"flex items-center gap-1",children:[H.isPlaceholder?null:Li(H.column.columnDef.header,H.getContext()),{asc:w.jsx(xu,{className:"h-3 w-3"}),desc:w.jsx(Lp,{className:"h-3 w-3"})}[H.column.getIsSorted()]??null]})},H.id))},O.id))}),w.jsx("tbody",{children:re.getRowModel().rows.length===0?w.jsx("tr",{children:w.jsx("td",{colSpan:re.getAllLeafColumns().length,className:"px-3 py-10 text-center text-sm text-muted-foreground",children:"No rows to display."})}):re.getRowModel().rows.map(O=>w.jsx("tr",{className:"border-b border-border last:border-0",children:O.getVisibleCells().map(H=>w.jsx("td",{className:"px-3 py-2 align-top",children:H.getIsGrouped()?w.jsxs("button",{type:"button",onClick:O.getToggleExpandedHandler(),className:"flex items-center gap-1 text-left text-xs font-medium text-muted-foreground",children:[O.getIsExpanded()?w.jsx(Ju,{className:"h-4 w-4"}):w.jsx(Zw,{className:"h-4 w-4"}),Li(H.column.columnDef.cell,H.getContext()),w.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",O.subRows.length,")"]})]}):H.getIsAggregated()?Li(H.column.columnDef.aggregatedCell??H.column.columnDef.cell,H.getContext()):H.getIsPlaceholder()?null:Li(H.column.columnDef.cell,H.getContext())},H.id))},O.id))})]})})})]})}var Sk=1,BH=.9,VH=.8,HH=.17,Yp=.1,Zp=.999,UH=.9999,WH=.99,GH=/[\\\/_+.#"@\[\(\{&]/,qH=/[\\\/_+.#"@\[\(\{&]/g,KH=/[\s-]/,UR=/[\s-]/g;function Vm(e,t,n,r,o,i,s){if(i===t.length)return o===e.length?Sk:WH;var l=`${o},${i}`;if(s[l]!==void 0)return s[l];for(var a=r.charAt(i),u=n.indexOf(a,o),c=0,d,f,p,h;u>=0;)d=Vm(e,t,n,r,u+1,i+1,s),d>c&&(u===o?d*=Sk:GH.test(e.charAt(u-1))?(d*=VH,p=e.slice(o,u-1).match(qH),p&&o>0&&(d*=Math.pow(Zp,p.length))):KH.test(e.charAt(u-1))?(d*=BH,h=e.slice(o,u-1).match(UR),h&&o>0&&(d*=Math.pow(Zp,h.length))):(d*=HH,o>0&&(d*=Math.pow(Zp,u-o))),e.charAt(u)!==t.charAt(i)&&(d*=UH)),(d<Yp&&n.charAt(u-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(u-1)!==r.charAt(i))&&(f=Vm(e,t,n,r,u+1,i+2,s),f*Yp>d&&(d=f*Yp)),d>c&&(c=d),u=n.indexOf(a,u+1);return s[l]=c,c}function bk(e){return e.toLowerCase().replace(UR," ")}function JH(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Vm(e,t,bk(e),bk(t),0,0,{})}var QH=Symbol.for("react.lazy"),bd=Ed[" use ".trim().toString()];function XH(e){return typeof e=="object"&&e!==null&&"then"in e}function WR(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===QH&&"_payload"in e&&XH(e._payload)}function YH(e){const t=ZH(e),n=x.forwardRef((r,o)=>{let{children:i,...s}=r;WR(i)&&typeof bd=="function"&&(i=bd(i._payload));const l=x.Children.toArray(i),a=l.find(t5);if(a){const u=a.props.children,c=l.map(d=>d===a?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:d);return w.jsx(t,{...s,ref:o,children:x.isValidElement(u)?x.cloneElement(u,void 0,c):null})}return w.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function ZH(e){const t=x.forwardRef((n,r)=>{let{children:o,...i}=n;if(WR(o)&&typeof bd=="function"&&(o=bd(o._payload)),x.isValidElement(o)){const s=r5(o),l=n5(i,o.props);return o.type!==x.Fragment&&(l.ref=r?So(r,s):s),x.cloneElement(o,l)}return x.Children.count(o)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var e5=Symbol("radix.slottable");function t5(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===e5}function n5(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const a=i(...l);return o(...l),a}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function r5(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var o5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Oo=o5.reduce((e,t)=>{const n=YH(`Primitive.${t}`),r=x.forwardRef((o,i)=>{const{asChild:s,...l}=o,a=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(a,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),ol='[cmdk-group=""]',eh='[cmdk-group-items=""]',i5='[cmdk-group-heading=""]',GR='[cmdk-item=""]',Ck=`${GR}:not([aria-disabled="true"])`,Hm="cmdk-item-select",ji="data-value",s5=(e,t,n)=>JH(e,t,n),qR=x.createContext(void 0),Na=()=>x.useContext(qR),KR=x.createContext(void 0),cv=()=>x.useContext(KR),JR=x.createContext(void 0),QR=x.forwardRef((e,t)=>{let n=Fi(()=>{var A,V;return{search:"",value:(V=(A=e.value)!=null?A:e.defaultValue)!=null?V:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Fi(()=>new Set),o=Fi(()=>new Map),i=Fi(()=>new Map),s=Fi(()=>new Set),l=XR(e),{label:a,children:u,value:c,onValueChange:d,filter:f,shouldFilter:p,loop:h,disablePointerSelection:m=!1,vimBindings:y=!0,...g}=e,v=kr(),k=kr(),S=kr(),b=x.useRef(null),E=y5();ai(()=>{if(c!==void 0){let A=c.trim();n.current.value=A,M.emit()}},[c]),ai(()=>{E(6,re)},[]);let M=x.useMemo(()=>({subscribe:A=>(s.current.add(A),()=>s.current.delete(A)),snapshot:()=>n.current,setState:(A,V,Y)=>{var G,pe,O,H;if(!Object.is(n.current[A],V)){if(n.current[A]=V,A==="search")ne(),I(),E(1,J);else if(A==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let se=document.getElementById(S);se?se.focus():(G=document.getElementById(v))==null||G.focus()}if(E(7,()=>{var se;n.current.selectedItemId=(se=U())==null?void 0:se.id,M.emit()}),Y||E(5,re),((pe=l.current)==null?void 0:pe.value)!==void 0){let se=V??"";(H=(O=l.current).onValueChange)==null||H.call(O,se);return}}M.emit()}},emit:()=>{s.current.forEach(A=>A())}}),[]),R=x.useMemo(()=>({value:(A,V,Y)=>{var G;V!==((G=i.current.get(A))==null?void 0:G.value)&&(i.current.set(A,{value:V,keywords:Y}),n.current.filtered.items.set(A,D(V,Y)),E(2,()=>{I(),M.emit()}))},item:(A,V)=>(r.current.add(A),V&&(o.current.has(V)?o.current.get(V).add(A):o.current.set(V,new Set([A]))),E(3,()=>{ne(),I(),n.current.value||J(),M.emit()}),()=>{i.current.delete(A),r.current.delete(A),n.current.filtered.items.delete(A);let Y=U();E(4,()=>{ne(),(Y==null?void 0:Y.getAttribute("id"))===A&&J(),M.emit()})}),group:A=>(o.current.has(A)||o.current.set(A,new Set),()=>{i.current.delete(A),o.current.delete(A)}),filter:()=>l.current.shouldFilter,label:a||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:v,inputId:S,labelId:k,listInnerRef:b}),[]);function D(A,V){var Y,G;let pe=(G=(Y=l.current)==null?void 0:Y.filter)!=null?G:s5;return A?pe(A,n.current.search,V):0}function I(){if(!n.current.search||l.current.shouldFilter===!1)return;let A=n.current.filtered.items,V=[];n.current.filtered.groups.forEach(G=>{let pe=o.current.get(G),O=0;pe.forEach(H=>{let se=A.get(H);O=Math.max(se,O)}),V.push([G,O])});let Y=b.current;ie().sort((G,pe)=>{var O,H;let se=G.getAttribute("id"),ke=pe.getAttribute("id");return((O=A.get(ke))!=null?O:0)-((H=A.get(se))!=null?H:0)}).forEach(G=>{let pe=G.closest(eh);pe?pe.appendChild(G.parentElement===pe?G:G.closest(`${eh} > *`)):Y.appendChild(G.parentElement===Y?G:G.closest(`${eh} > *`))}),V.sort((G,pe)=>pe[1]-G[1]).forEach(G=>{var pe;let O=(pe=b.current)==null?void 0:pe.querySelector(`${ol}[${ji}="${encodeURIComponent(G[0])}"]`);O==null||O.parentElement.appendChild(O)})}function J(){let A=ie().find(Y=>Y.getAttribute("aria-disabled")!=="true"),V=A==null?void 0:A.getAttribute(ji);M.setState("value",V||void 0)}function ne(){var A,V,Y,G;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let pe=0;for(let O of r.current){let H=(V=(A=i.current.get(O))==null?void 0:A.value)!=null?V:"",se=(G=(Y=i.current.get(O))==null?void 0:Y.keywords)!=null?G:[],ke=D(H,se);n.current.filtered.items.set(O,ke),ke>0&&pe++}for(let[O,H]of o.current)for(let se of H)if(n.current.filtered.items.get(se)>0){n.current.filtered.groups.add(O);break}n.current.filtered.count=pe}function re(){var A,V,Y;let G=U();G&&(((A=G.parentElement)==null?void 0:A.firstChild)===G&&((Y=(V=G.closest(ol))==null?void 0:V.querySelector(i5))==null||Y.scrollIntoView({block:"nearest"})),G.scrollIntoView({block:"nearest"}))}function U(){var A;return(A=b.current)==null?void 0:A.querySelector(`${GR}[aria-selected="true"]`)}function ie(){var A;return Array.from(((A=b.current)==null?void 0:A.querySelectorAll(Ck))||[])}function ue(A){let V=ie()[A];V&&M.setState("value",V.getAttribute(ji))}function fe(A){var V;let Y=U(),G=ie(),pe=G.findIndex(H=>H===Y),O=G[pe+A];(V=l.current)!=null&&V.loop&&(O=pe+A<0?G[G.length-1]:pe+A===G.length?G[0]:G[pe+A]),O&&M.setState("value",O.getAttribute(ji))}function N(A){let V=U(),Y=V==null?void 0:V.closest(ol),G;for(;Y&&!G;)Y=A>0?m5(Y,ol):g5(Y,ol),G=Y==null?void 0:Y.querySelector(Ck);G?M.setState("value",G.getAttribute(ji)):fe(A)}let j=()=>ue(ie().length-1),te=A=>{A.preventDefault(),A.metaKey?j():A.altKey?N(1):fe(1)},he=A=>{A.preventDefault(),A.metaKey?ue(0):A.altKey?N(-1):fe(-1)};return x.createElement(Oo.div,{ref:t,tabIndex:-1,...g,"cmdk-root":"",onKeyDown:A=>{var V;(V=g.onKeyDown)==null||V.call(g,A);let Y=A.nativeEvent.isComposing||A.keyCode===229;if(!(A.defaultPrevented||Y))switch(A.key){case"n":case"j":{y&&A.ctrlKey&&te(A);break}case"ArrowDown":{te(A);break}case"p":case"k":{y&&A.ctrlKey&&he(A);break}case"ArrowUp":{he(A);break}case"Home":{A.preventDefault(),ue(0);break}case"End":{A.preventDefault(),j();break}case"Enter":{A.preventDefault();let G=U();if(G){let pe=new Event(Hm);G.dispatchEvent(pe)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:R.inputId,id:R.labelId,style:x5},a),xf(e,A=>x.createElement(KR.Provider,{value:M},x.createElement(qR.Provider,{value:R},A))))}),l5=x.forwardRef((e,t)=>{var n,r;let o=kr(),i=x.useRef(null),s=x.useContext(JR),l=Na(),a=XR(e),u=(r=(n=a.current)==null?void 0:n.forceMount)!=null?r:s==null?void 0:s.forceMount;ai(()=>{if(!u)return l.item(o,s==null?void 0:s.id)},[u]);let c=YR(o,i,[e.value,e.children,i],e.keywords),d=cv(),f=Co(E=>E.value&&E.value===c.current),p=Co(E=>u||l.filter()===!1?!0:E.search?E.filtered.items.get(o)>0:!0);x.useEffect(()=>{let E=i.current;if(!(!E||e.disabled))return E.addEventListener(Hm,h),()=>E.removeEventListener(Hm,h)},[p,e.onSelect,e.disabled]);function h(){var E,M;m(),(M=(E=a.current).onSelect)==null||M.call(E,c.current)}function m(){d.setState("value",c.current,!0)}if(!p)return null;let{disabled:y,value:g,onSelect:v,forceMount:k,keywords:S,...b}=e;return x.createElement(Oo.div,{ref:So(i,t),...b,id:o,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!f,"data-disabled":!!y,"data-selected":!!f,onPointerMove:y||l.getDisablePointerSelection()?void 0:m,onClick:y?void 0:h},e.children)}),a5=x.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...i}=e,s=kr(),l=x.useRef(null),a=x.useRef(null),u=kr(),c=Na(),d=Co(p=>o||c.filter()===!1?!0:p.search?p.filtered.groups.has(s):!0);ai(()=>c.group(s),[]),YR(s,l,[e.value,e.heading,a]);let f=x.useMemo(()=>({id:s,forceMount:o}),[o]);return x.createElement(Oo.div,{ref:So(l,t),...i,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},n&&x.createElement("div",{ref:a,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),xf(e,p=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},x.createElement(JR.Provider,{value:f},p))))}),u5=x.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=x.useRef(null),i=Co(s=>!s.search);return!n&&!i?null:x.createElement(Oo.div,{ref:So(o,t),...r,"cmdk-separator":"",role:"separator"})}),c5=x.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,i=cv(),s=Co(u=>u.search),l=Co(u=>u.selectedItemId),a=Na();return x.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),x.createElement(Oo.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":a.listId,"aria-labelledby":a.labelId,"aria-activedescendant":l,id:a.inputId,type:"text",value:o?e.value:s,onChange:u=>{o||i.setState("search",u.target.value),n==null||n(u.target.value)}})}),d5=x.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=x.useRef(null),s=x.useRef(null),l=Co(u=>u.selectedItemId),a=Na();return x.useEffect(()=>{if(s.current&&i.current){let u=s.current,c=i.current,d,f=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{let p=u.offsetHeight;c.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return f.observe(u),()=>{cancelAnimationFrame(d),f.unobserve(u)}}},[]),x.createElement(Oo.div,{ref:So(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:a.listId},xf(e,u=>x.createElement("div",{ref:So(s,a.listInnerRef),"cmdk-list-sizer":""},u)))}),f5=x.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:i,container:s,...l}=e;return x.createElement(ER,{open:n,onOpenChange:r},x.createElement(MR,{container:s},x.createElement(ov,{"cmdk-overlay":"",className:o}),x.createElement(iv,{"aria-label":e.label,"cmdk-dialog":"",className:i},x.createElement(QR,{ref:t,...l}))))}),p5=x.forwardRef((e,t)=>Co(n=>n.filtered.count===0)?x.createElement(Oo.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),h5=x.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...i}=e;return x.createElement(Oo.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},xf(e,s=>x.createElement("div",{"aria-hidden":!0},s)))}),Bt=Object.assign(QR,{List:d5,Item:l5,Input:c5,Group:a5,Separator:u5,Dialog:f5,Empty:p5,Loading:h5});function m5(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function g5(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function XR(e){let t=x.useRef(e);return ai(()=>{t.current=e}),t}var ai=typeof window>"u"?x.useEffect:x.useLayoutEffect;function Fi(e){let t=x.useRef();return t.current===void 0&&(t.current=e()),t}function Co(e){let t=cv(),n=()=>e(t.snapshot());return x.useSyncExternalStore(t.subscribe,n,n)}function YR(e,t,n,r=[]){let o=x.useRef(),i=Na();return ai(()=>{var s;let l=(()=>{var u;for(let c of n){if(typeof c=="string")return c.trim();if(typeof c=="object"&&"current"in c)return c.current?(u=c.current.textContent)==null?void 0:u.trim():o.current}})(),a=r.map(u=>u.trim());i.value(e,l,a),(s=t.current)==null||s.setAttribute(ji,l),o.current=l}),o}var y5=()=>{let[e,t]=x.useState(),n=Fi(()=>new Map);return ai(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function v5(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function xf({asChild:e,children:t},n){return e&&x.isValidElement(t)?x.cloneElement(v5(t),{ref:t.ref},n(t.props.children)):n(t)}var x5={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const ZR=x.forwardRef(({className:e,...t},n)=>w.jsx(Bt,{ref:n,className:Ft("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));ZR.displayName=Bt.displayName;const w5=({children:e,...t})=>w.jsx(NR,{...t,children:w.jsx(sv,{className:"overflow-hidden p-0 shadow-2xl",children:w.jsx(ZR,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]]:border-b [&_[cmdk-input-wrapper]]:border-border [&_[cmdk-input]]:h-11 [&_[cmdk-input]]:px-2 [&_[cmdk-input]]:text-sm [&_[cmdk-input]]:outline-none [&_[cmdk-item]]:flex [&_[cmdk-item]]:cursor-default [&_[cmdk-item]]:select-none [&_[cmdk-item]]:items-center [&_[cmdk-item]]:justify-between [&_[cmdk-item]]:rounded-md [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-2 [&_[cmdk-item]]:text-sm [&_[cmdk-item]]:outline-none [&_[cmdk-item][data-disabled=true]]:opacity-50 [&_[cmdk-item][data-selected=true]]:bg-accent [&_[cmdk-item][data-selected=true]]:text-accent-foreground",children:e})})}),eT=x.forwardRef(({className:e,...t},n)=>w.jsxs("div",{className:"flex items-center gap-2 px-3","cmdk-input-wrapper":"",children:[w.jsx(PM,{className:"h-4 w-4 text-muted-foreground"}),w.jsx(Bt.Input,{ref:n,className:Ft("flex h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",e),...t})]}));eT.displayName=Bt.Input.displayName;const tT=x.forwardRef(({className:e,...t},n)=>w.jsx(Bt.List,{ref:n,className:Ft("max-h-[360px] overflow-y-auto overflow-x-hidden",e),...t}));tT.displayName=Bt.List.displayName;const nT=x.forwardRef((e,t)=>w.jsx(Bt.Empty,{ref:t,className:"py-6 text-center text-sm text-muted-foreground",...e}));nT.displayName=Bt.Empty.displayName;const Yu=x.forwardRef(({className:e,...t},n)=>w.jsx(Bt.Group,{ref:n,className:Ft("overflow-hidden p-1 text-foreground",e),...t}));Yu.displayName=Bt.Group.displayName;const rT=x.forwardRef(({className:e,...t},n)=>w.jsx(Bt.Separator,{ref:n,className:Ft("-mx-1 h-px bg-border",e),...t}));rT.displayName=Bt.Separator.displayName;const Zu=x.forwardRef(({className:e,...t},n)=>w.jsx(Bt.Item,{ref:n,className:Ft("relative flex cursor-default select-none items-center",e),...t}));Zu.displayName=Bt.Item.displayName;const Ek=e=>e.displayName??e.name,k5=({open:e,onOpenChange:t,docs:n,activeDoc:r,commands:o,onSelectDoc:i,onRunCommand:s})=>{const l=o.filter(u=>u.scope==="doc"),a=o.filter(u=>u.scope==="global");return w.jsxs(w5,{open:e,onOpenChange:t,children:[w.jsx(eT,{placeholder:"Search docs or run a command..."}),w.jsxs(tT,{children:[w.jsx(nT,{children:"No matches found."}),n.length>0?w.jsx(Yu,{heading:"Docs",children:n.map(u=>w.jsx(Zu,{value:`${Ek(u)} ${u.name}`,onSelect:()=>i(u),children:w.jsxs("span",{className:"flex items-center gap-2",children:[w.jsx(D3,{className:"h-4 w-4 text-muted-foreground"}),w.jsxs("span",{className:"flex flex-col",children:[w.jsx("span",{children:Ek(u)}),w.jsx("span",{className:"text-xs text-muted-foreground",children:u.name})]})]})},u.name))}):null,n.length>0&&(l.length>0||a.length>0)?w.jsx(rT,{}):null,l.length>0?w.jsx(Yu,{heading:"Document commands",children:l.map(u=>w.jsxs(Zu,{value:`${u.label} ${(u.keywords??[]).join(" ")}`,onSelect:()=>s(u),disabled:!r,children:[w.jsxs("span",{className:"flex items-center gap-2",children:[w.jsx(AM,{className:"h-4 w-4 text-muted-foreground"}),w.jsx("span",{children:u.label})]}),r?null:w.jsx("span",{className:"text-xs text-muted-foreground",children:"Select a document first"})]},u.id))}):null,a.length>0?w.jsx(Yu,{heading:"Global commands",children:a.map(u=>w.jsx(Zu,{value:`${u.label} ${(u.keywords??[]).join(" ")}`,onSelect:()=>s(u),children:w.jsxs("span",{className:"flex items-center gap-2",children:[w.jsx(F3,{className:"h-4 w-4 text-muted-foreground"}),w.jsx("span",{children:u.label})]})},u.id))}):null]})]})};var S5=fn.forwardRef(({pluginKey:e="bubbleMenu",editor:t,updateDelay:n,resizeDelay:r,appendTo:o,shouldShow:i=null,getReferencedVirtualElement:s,options:l,children:a,...u},c)=>{const d=x.useRef(document.createElement("div"));typeof c=="function"?c(d.current):c&&(c.current=d.current);const{editor:f}=uf(),p=t||f,h={updateDelay:n,resizeDelay:r,appendTo:o,pluginKey:e,shouldShow:i,getReferencedVirtualElement:s,options:l},m=x.useRef(h);m.current=h;const[y,g]=x.useState(!1),v=x.useRef(!0);return x.useEffect(()=>{if(p!=null&&p.isDestroyed)return;if(!p){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const k=d.current;k.style.visibility="hidden",k.style.position="absolute";const S=Ay({...m.current,editor:p,element:k});p.registerPlugin(S);const b=m.current.pluginKey;return v.current=!0,g(!0),()=>{g(!1),p.unregisterPlugin(b),window.requestAnimationFrame(()=>{k.parentNode&&k.parentNode.removeChild(k)})}},[p]),x.useEffect(()=>{if(!(!y||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta("bubbleMenu",{type:"updateOptions",options:m.current}))}},[y,p,n,r,i,l,o,s]),di.createPortal(w.jsx("div",{...u,children:a}),d.current)});fn.forwardRef(({pluginKey:e="floatingMenu",editor:t,updateDelay:n,resizeDelay:r,appendTo:o,shouldShow:i=null,options:s,children:l,...a},u)=>{const c=x.useRef(document.createElement("div"));typeof u=="function"?u(c.current):u&&(u.current=c.current);const{editor:d}=uf(),f=t||d,p={updateDelay:n,resizeDelay:r,appendTo:o,pluginKey:e,shouldShow:i,options:s},h=x.useRef(p);h.current=p;const[m,y]=x.useState(!1),g=x.useRef(!0);return x.useEffect(()=>{if(f!=null&&f.isDestroyed)return;if(!f){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const v=c.current;v.style.visibility="hidden",v.style.position="absolute";const k=Oy({...h.current,editor:f,element:v});f.registerPlugin(k);const S=h.current.pluginKey;return g.current=!0,y(!0),()=>{y(!1),f.unregisterPlugin(S),window.requestAnimationFrame(()=>{v.parentNode&&v.parentNode.removeChild(v)})}},[f]),x.useEffect(()=>{if(!(!m||!f||f.isDestroyed)){if(g.current){g.current=!1;return}f.view.dispatch(f.state.tr.setMeta("floatingMenu",{type:"updateOptions",options:h.current}))}},[m,f,n,r,i,s,o]),di.createPortal(w.jsx("div",{...a,children:l}),c.current)});const xn=e=>`tiptap-bubble-button${e?" is-active":""}`;function b5({editor:e}){const t=x.useCallback(()=>{const n=e.getAttributes("link").href,r=window.prompt("Enter URL",n??"");if(r===null)return;const o=r.trim();if(!o){e.chain().focus().extendMarkRange("link").unsetLink().run();return}e.chain().focus().extendMarkRange("link").setLink({href:o}).run()},[e]);return w.jsxs(S5,{editor:e,options:{offset:8},shouldShow:({editor:n,state:r})=>{if(!n.isEditable)return!1;const{empty:o}=r.selection;return!o||n.isActive("link")},className:"tiptap-bubble-menu",children:[w.jsx("button",{type:"button",className:xn(e.isActive("bold")),onClick:()=>e.chain().focus().toggleBold().run(),"aria-label":"Toggle bold",children:w.jsx(w3,{className:"h-4 w-4"})}),w.jsx("button",{type:"button",className:xn(e.isActive("italic")),onClick:()=>e.chain().focus().toggleItalic().run(),"aria-label":"Toggle italic",children:w.jsx(q3,{className:"h-4 w-4"})}),w.jsx("button",{type:"button",className:xn(e.isActive("strike")),onClick:()=>e.chain().focus().toggleStrike().run(),"aria-label":"Toggle strikethrough",children:w.jsx(uB,{className:"h-4 w-4"})}),w.jsx("button",{type:"button",className:xn(e.isActive("code")),onClick:()=>e.chain().focus().toggleCode().run(),"aria-label":"Toggle inline code",children:w.jsx(A3,{className:"h-4 w-4"})}),w.jsx("span",{className:"tiptap-bubble-separator","aria-hidden":"true"}),w.jsx("button",{type:"button",className:xn(e.isActive("heading",{level:2})),onClick:()=>e.chain().focus().toggleHeading({level:2}).run(),"aria-label":"Toggle heading level 2",children:w.jsx(V3,{className:"h-4 w-4"})}),w.jsx("button",{type:"button",className:xn(e.isActive("heading",{level:3})),onClick:()=>e.chain().focus().toggleHeading({level:3}).run(),"aria-label":"Toggle heading level 3",children:w.jsx(U3,{className:"h-4 w-4"})}),w.jsx("button",{type:"button",className:xn(e.isActive("bulletList")),onClick:()=>e.chain().focus().toggleBulletList().run(),"aria-label":"Toggle bullet list",children:w.jsx(Z3,{className:"h-4 w-4"})}),w.jsx("button",{type:"button",className:xn(e.isActive("orderedList")),onClick:()=>e.chain().focus().toggleOrderedList().run(),"aria-label":"Toggle ordered list",children:w.jsx(X3,{className:"h-4 w-4"})}),w.jsx("button",{type:"button",className:xn(e.isActive("blockquote")),onClick:()=>e.chain().focus().toggleBlockquote().run(),"aria-label":"Toggle blockquote",children:w.jsx(sB,{className:"h-4 w-4"})}),w.jsx("span",{className:"tiptap-bubble-separator","aria-hidden":"true"}),w.jsx("button",{type:"button",className:xn(e.isActive("link")),onClick:t,"aria-label":"Add or edit link",children:w.jsx(J3,{className:"h-4 w-4"})}),w.jsx("button",{type:"button",className:xn(),onClick:()=>e.chain().focus().extendMarkRange("link").unsetLink().run(),"aria-label":"Remove link",disabled:!e.isActive("link"),children:w.jsx(pB,{className:"h-4 w-4"})})]})}const Um=e=>{var t;(t=e.openCreateDialog)==null||t.call(e,"markdown")},oT=e=>{var t;(t=e.openCreateDialog)==null||t.call(e,"json")},Wm=async e=>{var t;e.activeDoc&&await((t=e.toggleDocPinned)==null?void 0:t.call(e,e.activeDoc))},Gm=async e=>{var t;e.activeDoc&&await((t=e.archiveDoc)==null?void 0:t.call(e,e.activeDoc))},qm=async e=>{var t;e.activeDoc&&await((t=e.deleteDoc)==null?void 0:t.call(e,e.activeDoc))},C5=()=>[{id:"doc.create.markdown",label:"Create markdown document",scope:"global",keywords:["new","create","markdown","doc"],run:Um},{id:"doc.create.json",label:"Create JSON document",scope:"global",keywords:["new","create","json","table","doc"],run:oT},{id:"doc.pin",label:"Pin document",scope:"doc",keywords:["pin","document","info"],run:Wm},{id:"doc.archive",label:"Archive document",scope:"doc",keywords:["archive","document","info"],run:Gm},{id:"doc.delete",label:"Delete document",scope:"doc",keywords:["delete","remove","document","info"],run:qm}],E5=e=>e instanceof HTMLElement?!!e.closest("[data-command-palette-ignore]"):!1,M5=()=>{const[e,t]=x.useState(!1);return x.useEffect(()=>{const n=r=>{r.key.toLowerCase()==="k"&&(!r.metaKey&&!r.ctrlKey||E5(r.target)||(r.preventDefault(),t(o=>!o)))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[]),{open:e,setOpen:t}},$n="/api",R5=/^\uFEFF?\s*<!--\s*hyperdoc:([A-Za-z0-9+/=]+)\s*-->\s*(?:\r?\n|$)/i,T5=/^\uFEFF?\s*<!--\s*hyperdoc:[A-Za-z0-9+/=]+\s*-->\s*(?:\r?\n|$)/i,N5=/^\s*<!--\s*title:\s*.+?\s*-->\s*(?:\r?\n|$)/i,Mk=e=>e.replace(/^\uFEFF/,""),A5=e=>{if(!e)return e;const t=e.match(/^\s*(?:\r?\n)/);return t?e.slice(t[0].length):e},O5=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`client_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`,P5=e=>!e||!e.id?[]:[{id:e.id,desc:!!e.desc}],I5=e=>e?[e]:[],D5=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[],L5=e=>!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([,t])=>typeof t=="boolean")),_5=(e,t)=>{if(!e||!t)return!1;const n=e.sorting[0],r=t.sorting[0];if(!!n!=!!r||n&&r&&(n.id!==r.id||!!n.desc!=!!r.desc))return!1;const o=e.grouping[0]??"",i=t.grouping[0]??"";if(o!==i||e.columnOrder.length!==t.columnOrder.length||e.columnOrder.some((a,u)=>a!==t.columnOrder[u]))return!1;const s=Object.keys(e.columnVisibility).sort(),l=Object.keys(t.columnVisibility).sort();if(s.length!==l.length)return!1;for(let a=0;a<s.length;a+=1){const u=s[a];if(u!==l[a]||e.columnVisibility[u]!==t.columnVisibility[u])return!1}return!0};function $5(){var Lv,_v;const[e,t]=x.useState([]),[n,r]=x.useState(null),[o,i]=x.useState(""),[s,l]=x.useState(""),[a,u]=x.useState(""),c=x.useRef(!1),d=x.useRef(0),f=x.useRef(""),p=x.useRef(null),h=x.useRef(""),[m,y]=x.useState("idle"),g=x.useRef(null),v=x.useRef(null),k=x.useRef(null),[S,b]=x.useState(null),[E,M]=x.useState(""),[R,D]=x.useState(!1),[I,J]=x.useState(!1),[ne,re]=x.useState(""),[U,ie]=x.useState("markdown"),[ue,fe]=x.useState(""),[N,j]=x.useState(null),[te,he]=x.useState(null),[A,V]=x.useState(null),[Y,G]=x.useState(0),[pe,O]=x.useState("table"),[H,se]=x.useState(!1),[ke,Me]=x.useState(!1),[Vt,xi]=x.useState(null),[wi,iT]=x.useState([]),[_s,$s]=x.useState(""),[ki,Aa]=x.useState([]),[Zn,wf]=x.useState([]),[Oa,kf]=x.useState(""),[Si,dv]=x.useState([]),[Sf,zs]=x.useState(!1),[Ot,Pa]=x.useState([]),[bf,Ia]=x.useState(""),[fv,js]=x.useState(""),gn=QS(),sT=Sa(),Cf=x.useRef(null),Ef=x.useRef(null),pv=x.useRef(null),Mf=x.useRef(!1),hv=x.useRef(O5()),[bi,Ci]=x.useState(null),[Rf,lT]=x.useState(null),{open:aT,setOpen:Ei}=M5(),uT=x.useMemo(()=>C5(),[]),De=Az({extensions:[vF.configure({codeBlock:{languageClassPrefix:"language-"}}),u3.configure({markedOptions:{breaks:!0}})],content:"",editorProps:{attributes:{class:"h-full min-h-0 w-full border border-input bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2"}}}),Fs=x.useCallback(()=>{if(!De)return"";const C=De;return C.getMarkdown?C.getMarkdown():""},[De]),Tf=x.useCallback(C=>{if(!De)return;const T=De;if(T.markdown){const P=T.markdown.parse(C);De.commands.setContent(P,{emitUpdate:!1})}else De.commands.setContent(C,{emitUpdate:!1})},[De]),Da=x.useCallback(async()=>{try{const T=await(await fetch(`${$n}/docs`)).json();t(T)}catch(C){l(String(C))}},[]);x.useEffect(()=>{Da().catch(()=>{})},[Da]);const La=x.useCallback(C=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(C)==="1"}catch{return!1}},[]),Mi=x.useCallback(async()=>{try{const T=await(await fetch(`${$n}/tags`)).json();if(!T||!Array.isArray(T.tags))return;iT([...new Set(T.tags)].sort()),$s("")}catch(C){$s(String(C))}},[]);x.useEffect(()=>{Mi().catch(()=>{})},[Mi]);const cT=x.useCallback(C=>C.split("/").map(T=>decodeURIComponent(T)).join("/"),[]),mv=x.useCallback((C,T)=>{const P=C.trim();if(!P)return"";const L=P.endsWith(".md"),F=P.endsWith(".json");return L||F?P:`${P}.${T==="json"?"json":"md"}`},[]),Bs=x.useCallback((C,T)=>mv(C,T),[mv]),gv=x.useCallback(C=>{try{const T=atob(C),P=Uint8Array.from(T,L=>L.charCodeAt(0));return new TextDecoder().decode(P)}catch{return null}},[]),yv=x.useCallback(C=>{const T=new TextEncoder().encode(C);let P="";return T.forEach(L=>{P+=String.fromCharCode(L)}),btoa(P)},[]),vv=x.useCallback(C=>{const T=C.match(R5);if(!T)return null;const P=gv(T[1]);if(!P)return null;try{const L=JSON.parse(P);if(!L||typeof L!="object"||Array.isArray(L))return null;const F=typeof L.title=="string"?L.title:null,oe=Array.isArray(L.tags)?L.tags.filter(Z=>typeof Z=="string"):[],X=L.pinned===!0;return{title:F,tags:oe,pinned:X}}catch{return null}},[gv]),xv=x.useCallback(C=>{let T="",P=!1,L=!1,F=!1,oe=!1;for(let X=0;X<C.length;X+=1){const Z=C[X],Xe=C[X+1];if(F){Z===`
547
- `&&(F=!1,T+=Z);continue}if(oe){Z==="*"&&Xe==="/"&&(oe=!1,X+=1);continue}if(P){if(T+=Z,L){L=!1;continue}if(Z==="\\"){L=!0;continue}Z==='"'&&(P=!1);continue}if(Z==='"'){P=!0,T+=Z;continue}if(Z==="/"&&Xe==="/"){F=!0,X+=1;continue}if(Z==="/"&&Xe==="*"){oe=!0,X+=1;continue}T+=Z}return T},[]),wv=x.useCallback(C=>{let T="",P=!1,L=!1;for(let F=0;F<C.length;F+=1){const oe=C[F];if(P){if(T+=oe,L){L=!1;continue}if(oe==="\\"){L=!0;continue}oe==='"'&&(P=!1);continue}if(oe==='"'){P=!0,T+=oe;continue}if(oe===","){let X=F+1;for(;X<C.length&&/\s/.test(C[X]);)X+=1;if(C[X]==="}"||C[X]==="]")continue}T+=oe}return T},[]),_a=x.useCallback(C=>{const T=C.replace(/^\uFEFF/,"");try{const P=JSON.parse(T);return!P||typeof P!="object"||Array.isArray(P)?null:P}catch{try{const P=wv(xv(T)),L=JSON.parse(P);return!L||typeof L!="object"||Array.isArray(L)?null:L}catch{return null}}},[xv,wv]),Vs=x.useCallback(C=>{const T=_a(C);if(!T)return null;const P=T.metadata;if(!P||typeof P!="object"||Array.isArray(P))return{tags:[]};const L=P,F=Array.isArray(L.tags)?L.tags.filter(X=>typeof X=="string"):[],oe=L.pinned===!0;return{tags:F,pinned:oe}},[_a]),dT=x.useCallback((C,T)=>{var P,L;return T==="markdown"?((P=vv(C))==null?void 0:P.tags)??[]:T==="json"?((L=Vs(C))==null?void 0:L.tags)??[]:[]},[Vs,vv]),Nf=x.useCallback(C=>{const T=JSON.stringify({v:1,title:C.title,tags:C.tags,...C.pinned?{pinned:!0}:{}});return`<!-- hyperdoc:${yv(T)} -->
548
-
549
- `},[yv]),kv=x.useCallback(C=>{let T=C.replace(/^\uFEFF/,""),P="";for(;T!==P;)P=T,T=T.replace(T5,"").replace(N5,"");return A5(T)},[]),Af=x.useCallback((C,T,P)=>{if(T==="markdown"){const L=Mk(kv(C));return`${Nf({title:null,tags:P.tags,pinned:P.pinned})}${L}`}if(T==="json"){const L=_a(C);if(!L)return null;const F=L.metadata,oe=F&&typeof F=="object"&&!Array.isArray(F)?{...F}:{};P.tags.length>0?oe.tags=P.tags:delete oe.tags,P.pinned?oe.pinned=!0:delete oe.pinned;const X={...L};return Object.keys(oe).length>0?X.metadata=oe:delete X.metadata,JSON.stringify(X,null,2)}return C},[Nf,Mk,_a,kv]),$a=x.useCallback(C=>{const T=C.trim().toLowerCase();return!T||!/^[a-z]+$/.test(T)?"":T},[]),er=x.useCallback(C=>C.split("/").map(T=>encodeURIComponent(T)).join("/"),[]),Sv=sT.pathname.replace(/^\/+/,""),Or=Sv?cT(Sv):"";x.useEffect(()=>{if(!Or||(n==null?void 0:n.name)===Or)return;const C=e.find(T=>T.name===Or);if(!C){s!==`Doc not found: ${Or}`&&l(`Doc not found: ${Or}`);return}s&&l(""),r(C)},[Or,e,n==null?void 0:n.name,s]),x.useEffect(()=>{if(Or||e.length===0)return;const C=e[0];gn(`/${er(C.name)}`,{replace:!0})},[Or,e,er,gn]);const bv=async C=>{if(p.current===C.name||f.current===C.name)return;p.current=C.name;const T=await fetch(`${$n}/doc/${encodeURIComponent(C.name)}`,{cache:"no-store"}),P=T.headers.get("content-type")??"";let L="",F=null,oe=null;if(P.includes("application/json")?(oe=await T.json(),L=oe.content??"",F=oe.metadata??null):L=await T.text(),C.type==="markdown"?Aa((F==null?void 0:F.tags)??[]):Aa(dT(L,C.type)),xi(oe&&typeof oe.mtimeMs=="number"?oe.mtimeMs:null),i(L),u(L),se(!1),Me(!1),fe(""),j(null),he(null),V(null),C.type==="markdown"&&De&&(Tf(L),h.current=L,c.current=!0),C.type==="markdown"&&(F==null?void 0:F.pinned)!==void 0&&(t(X=>X.map(Z=>Z.name===C.name?{...Z,pinned:F.pinned}:Z)),r(X=>X&&X.name===C.name?{...X,pinned:F.pinned}:X)),C.type==="json"){const X=Vs(L);(X==null?void 0:X.pinned)!==void 0&&(t(Z=>Z.map(Xe=>Xe.name===C.name?{...Xe,pinned:X.pinned}:Xe)),r(Z=>Z&&Z.name===C.name?{...Z,pinned:X.pinned}:Z))}f.current=C.name,p.current=null};x.useEffect(()=>{n&&(f.current="",bv(n).catch(C=>l(String(C))))},[n==null?void 0:n.name]),x.useEffect(()=>{De&&(!n||n.type!=="markdown"||o&&h.current!==o&&(Tf(o),h.current=o,c.current=!0))},[n==null?void 0:n.name,n==null?void 0:n.type,o,De,Tf]),x.useEffect(()=>{n||xi(null)},[n]);const Cv=x.useMemo(()=>n?(n.displayName??n.name.replace(/\.(md|json)$/i,"")).trim():"",[n==null?void 0:n.displayName,n==null?void 0:n.name]);x.useEffect(()=>{if(!n){Pa([]),Ia(""),js("");return}Pa(ki),Ia(""),js("")},[n==null?void 0:n.name,n==null?void 0:n.type,ki,Cv]),x.useEffect(()=>{Rf&&(!n||n.name!==Rf.name||(requestAnimationFrame(()=>{var C;return(C=pv.current)==null?void 0:C.focus()}),lT(null)))},[n,Rf]),x.useEffect(()=>{!n||n.type!=="json"||O("table")},[n==null?void 0:n.name,n==null?void 0:n.type]),x.useEffect(()=>{if(!Sf)return;const C=T=>{T.key==="Escape"&&zs(!1)};return window.addEventListener("keydown",C),()=>{window.removeEventListener("keydown",C)}},[Sf]),x.useEffect(()=>{zs(!1)},[n==null?void 0:n.name]);const Ev=x.useCallback((C,T)=>{if(C.length!==T.length)return!1;const P=[...C].sort(),L=[...T].sort();return P.every((F,oe)=>F===L[oe])},[]),Ri=x.useCallback(async(C,T)=>{if(!n)return null;const P=(T==null?void 0:T.name)??n.name,L=(T==null?void 0:T.type)??n.type,F=n.name===P,oe=(T==null?void 0:T.tags)??(F?Ot:[]),X=(T==null?void 0:T.pinned)??(F?n.pinned??!1:!1);let Z=C;if(L==="markdown"){const Dr=Af(Z,L,{tags:oe,pinned:X});if(Dr===null)return l("Cannot update metadata. JSON must be an object."),null;Z=Dr}else if(L==="json"&&((T==null?void 0:T.tags)!==void 0||(T==null?void 0:T.pinned)!==void 0)){const za=Af(C,L,{tags:oe,pinned:X});if(za===null)return l("Cannot update metadata. JSON must be an object."),null;Z=za}const Xe=250;F&&(g.current&&(clearTimeout(g.current),g.current=null),v.current=Date.now(),y("saving")),Mf.current=!0;const Pr=(T==null?void 0:T.baseVersion)??(F?Vt:null),Ye=await fetch(`${$n}/doc/${encodeURIComponent(P)}`,{method:"PUT",headers:{"Content-Type":"text/plain",...Pr!=null?{"x-hyperdoc-base-version":String(Pr)}:{},"x-hyperdoc-client-id":hv.current},body:Z});setTimeout(()=>{Mf.current=!1},500);const Pt=Dr=>{if(!F)return;const za=v.current??Date.now(),TT=Date.now()-za,NT=Math.max(0,Xe-TT);g.current=setTimeout(()=>{y(Dr),g.current=null},NT)};if(Ye.status===409){try{const Dr=await Ye.json();F&&typeof Dr.mtimeMs=="number"&&xi(Dr.mtimeMs)}catch{}return F&&Me(!0),l("Conflict: file changed on disk."),Pt("idle"),null}if(!Ye.ok)return l(`Save failed: ${Ye.status}`),Pt("idle"),null;const Ir=await Ye.json();return F&&(xi(Ir.mtimeMs??null),u(Z),se(!1),Me(!1)),Pt("saved"),Z},[n,Af,Vt,Ot]),fT=async C=>{if(!n)return;const T=Bs(C,n.type);if(T===n.name)return;const P=await fetch(`${$n}/doc/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:n.name,to:T})});if(!P.ok){l(`Rename failed: ${P.status}`);return}const L=await P.json();r(F=>F&&{...F,...L}),t(F=>{const oe=F.map(X=>X.name===n.name?{...X,...L}:X);return oe.sort((X,Z)=>(X.displayName??X.name).localeCompare(Z.displayName??Z.name)),oe}),gn(`/${er(L.name)}`,{replace:!0})},Mv=async()=>{if(!n)return;const C=n.type==="markdown"&&De?Fs():o,T=!Ev(Ot,ki);if(H||T){const L=n.type==="markdown"||T?Ot:void 0;if(!await Ri(C,{tags:L,pinned:n.type==="markdown"?n.pinned??!1:void 0}))return}T&&(Aa(Ot),Mi().catch(()=>{}))},Rv=x.useCallback(async()=>{if(!n||!H||ke||La("hyperdoc.disableAutosave"))return;const C=n.type==="markdown"&&De?Fs():o;await Ri(C,{pinned:n.type==="markdown"?n.pinned??!1:void 0})},[n,ke,o,De,Fs,H,La,Ri]),Tv=x.useCallback(async C=>{var T,P;try{const L=(n==null?void 0:n.name)===C.name;let F="",oe=null,X=[],Z=C.pinned??!1;if(L&&n)n.type==="markdown"?H?De?F=Fs():F=o:F=a:F=o,X=Ot,Z=n.pinned??Z,oe=Vt;else{const Ye=await fetch(`${$n}/doc/${encodeURIComponent(C.name)}`,{cache:"no-store"});if(!Ye.ok){l(`Failed to fetch document: ${Ye.statusText}`);return}const Pt=await Ye.json();if(F=Pt.content??"",oe=Pt.mtimeMs??null,C.type==="markdown")X=((T=Pt.metadata)==null?void 0:T.tags)??C.tags??[],Z=((P=Pt.metadata)==null?void 0:P.pinned)??Z;else{const Ir=Vs(F);X=(Ir==null?void 0:Ir.tags)??C.tags??[],Z=(Ir==null?void 0:Ir.pinned)??Z}}const Xe=!Z,Pr=await Ri(F,{name:C.name,type:C.type,tags:X,pinned:Xe,baseVersion:oe});if(!Pr)return;t(Ye=>Ye.map(Pt=>Pt.name===C.name?{...Pt,pinned:Xe}:Pt)),L&&n&&(r(Ye=>Ye&&{...Ye,pinned:Xe}),n.type==="json"&&i(Pr))}catch(L){l(`Failed to toggle pinned: ${String(L)}`)}},[n,o,Vt,De,Fs,Ot,H,a,Vs,Ri]),Nv=x.useCallback(async C=>{try{const T=await fetch(`${$n}/doc/${encodeURIComponent(C.name)}/archive`,{method:"POST"});if(!T.ok){l(`Archive failed: ${T.statusText}`);return}t(P=>P.filter(L=>L.name!==C.name)),(n==null?void 0:n.name)===C.name&&(r(null),gn("/",{replace:!0}))}catch(T){l(`Archive failed: ${String(T)}`)}},[n,gn]),Av=x.useCallback(async C=>{try{const T=await fetch(`${$n}/doc/${encodeURIComponent(C.name)}`,{method:"DELETE"});if(!T.ok){l(`Delete failed: ${T.statusText}`);return}t(P=>P.filter(L=>L.name!==C.name)),(n==null?void 0:n.name)===C.name&&(r(null),gn("/",{replace:!0}))}catch(T){l(`Delete failed: ${String(T)}`)}},[n,gn]);x.useEffect(()=>{if(!n||!H||ke||!S)return;const C=350;return k.current&&clearTimeout(k.current),y("saving"),v.current=Date.now(),k.current=setTimeout(()=>{Rv().catch(()=>{}),k.current=null},C),()=>{k.current&&(clearTimeout(k.current),k.current=null)}},[n,Rv,ke,H,S]),x.useEffect(()=>{if(!n)return;!Ev(Ot,ki)&&Mv().catch(()=>{})},[Ot]),x.useEffect(()=>{if(!De||!n||n.type!=="markdown")return;const C=()=>{if(c.current){c.current=!1,se(!1);return}b(Date.now()),se(!0)};return De.on("update",C),()=>{De.off("update",C)}},[De,n]),x.useEffect(()=>{!n||n.type!=="json"||se(o!==a)},[o,n,a]);const Of=x.useCallback(C=>{const T=(L,F)=>{if(F>2)return null;try{return JSON.parse(L)}catch{return null}},P=T(C,0);if(!P)return{error:"Invalid JSON",payload:null};if(Array.isArray(P))return{error:null,payload:{data:P}};if(typeof P=="object"&&P!==null){const L=P;if(typeof L.content=="string"){const F=T(L.content,1);if(Array.isArray(F))return{error:null,payload:{data:F}};if(typeof F=="object"&&F!==null)return{error:null,payload:F}}return{error:null,payload:P}}return{error:"JSON must be an object or array.",payload:null}},[]);x.useEffect(()=>{var L,F,oe,X;if(!n||n.type!=="json")return;const{error:C,payload:T}=Of(o);if(!T){fe(C??"Invalid JSON"),j(null),he(null),V(null);return}if(!Array.isArray(T.data)){fe("JSON `data` must be an array of objects."),j(null),he(null),V(null);return}if(!T.data.every(Z=>Z&&typeof Z=="object"&&!Array.isArray(Z))){fe("JSON `data` must be an array of objects."),j(null),he(null),V(null);return}fe(""),j(T.data);const P={sorting:P5((L=T.metadata)==null?void 0:L.sortBy),grouping:I5((F=T.metadata)==null?void 0:F.groupBy),columnOrder:D5((oe=T.metadata)==null?void 0:oe.columnOrder),columnVisibility:L5((X=T.metadata)==null?void 0:X.columnVisibility)};he(P),V(P),G(Z=>Z+1)},[o,n,Of]),x.useEffect(()=>{if(!I)return;const C=P=>{Cf.current&&(Cf.current.contains(P.target)||J(!1))},T=P=>{P.key==="Escape"&&J(!1)};return document.addEventListener("mousedown",C),document.addEventListener("keydown",T),()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",T)}},[I]),x.useEffect(()=>{if(!bi)return;const C=P=>{Ef.current&&(Ef.current.contains(P.target)||Ci(null))},T=P=>{P.key==="Escape"&&Ci(null)};return document.addEventListener("mousedown",C),document.addEventListener("keydown",T),()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",T)}},[bi]),x.useEffect(()=>{R&&M("")},[R]);const Ov=C=>{ie(C),re(""),wf([]),kf(""),J(!1),D(!0)},Pv=x.useMemo(()=>({activeDoc:n,announce:l,openCreateDialog:Ov,toggleDocPinned:Tv,archiveDoc:Nv,deleteDoc:Av}),[n,Nv,Av,Ov,Tv]),yn=x.useCallback(async(C,T)=>{if(!C)return;const P={...Pv,...T};await C(P)},[Pv]),pT=x.useCallback(C=>{Ei(!1),gn(`/${er(C.name)}`,{replace:!0})},[er,gn,Ei]),hT=x.useCallback(C=>{Ei(!1),yn(C.run)},[yn,Ei]),mT=x.useMemo(()=>Bs(ne,U),[Bs,ne,U]),Iv=x.useMemo(()=>{const C=new Set([...wi,...Zn]);return Array.from(C).sort()},[wi,Zn]),gT=x.useMemo(()=>{const C=new Set([...wi,...Ot]);return Array.from(C).sort()},[Ot,wi]),yT=x.useCallback(C=>{wf(T=>T.includes(C)?T.filter(P=>P!==C):[...T,C].sort())},[]),vT=x.useCallback(()=>{const C=$a(Oa);if(!C){$s("Tags must be lowercase letters only.");return}wf(T=>T.includes(C)?T:[...T,C].sort()),kf(""),$s("")},[$a,Oa]),xT=x.useCallback(C=>{Pa(T=>T.includes(C)?T.filter(P=>P!==C):[...T,C].sort())},[]),wT=x.useCallback(()=>{const C=$a(bf);if(!C){js("Tags must be lowercase letters only.");return}Pa(T=>T.includes(C)?T:[...T,C].sort()),Ia(""),js("")},[bf,$a]),kT=async()=>{M("");const C=Bs(ne,U),P=await(async F=>{const oe=ne.trim(),X=U==="markdown"?`${Nf({title:oe||null,tags:Zn})}`:void 0,Z=U==="json"&&Zn.length>0?JSON.stringify({data:[],metadata:{tags:Zn}},null,2):void 0;return await fetch(`${$n}/docs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:oe,name:F,type:U,content:U==="markdown"?X:Z})})})(C);if(!P.ok){M(`Create failed: ${P.status}`);return}const L=await P.json();t(F=>{const oe=[...F,L];return oe.sort((X,Z)=>(X.displayName??X.name).localeCompare(Z.displayName??Z.name)),oe}),re(""),M(""),D(!1),r(L),Zn.length>0&&(Aa(Zn),Mi().catch(()=>{})),Da().catch(()=>{}),gn(`/${er(L.name)}`,{replace:!0})},Dv=x.useCallback(C=>{const T=Array.from(C.matchAll(/@([^\s]+?\.md)/g));if(T.length===0)return C;let P=0;const L=[];return T.forEach((F,oe)=>{const X=F[0],Z=F[1],Xe=e.find(Pt=>Pt.name===Z),Pr=Xe!=null&&Xe.displayName?`@${Xe.displayName}`:X,Ye=F.index??0;Ye>P&&L.push(C.slice(P,Ye)),L.push(w.jsx(iP,{to:`/${er(Z)}`,className:"text-primary underline underline-offset-2",children:Pr},`${Z}-${oe}`)),P=Ye+X.length}),P<C.length&&L.push(C.slice(P)),w.jsx("span",{children:L})},[e,er]),ST=async C=>{if(!n||n.type!=="json")return;const P=Of(o).payload,L={...P??{},data:(P==null?void 0:P.data)??N??[],metadata:{...(P==null?void 0:P.metadata)??{},sortBy:C.sorting[0]?{id:C.sorting[0].id,desc:!!C.sorting[0].desc}:null,groupBy:C.grouping[0]??null,columnOrder:C.columnOrder.length>0?C.columnOrder:null,columnVisibility:Object.keys(C.columnVisibility).length>0?C.columnVisibility:null}},F=JSON.stringify(L,null,2);i(F),se(F!==a),await Ri(F,{tags:Ot,pinned:void 0}),he(C),V(C)},bT=x.useMemo(()=>!N||N.length===0?[]:Array.from(new Set(N.flatMap(T=>Object.keys(T)))).map(T=>({accessorKey:T,header:T,cell:({getValue:P})=>Dv(String(P()??""))})),[N,Dv]),CT=x.useCallback(C=>{V(C)},[]);x.useEffect(()=>{if(La("hyperdoc.disableEvents"))return;const C=new EventSource(`${$n}/events`);return C.onmessage=T=>{try{const P=Date.now();if(P-d.current<200)return;d.current=P;const L=JSON.parse(T.data);if(typeof L.name=="string"&&(L.name.endsWith(".md")||L.name.endsWith(".json"))&&Mi().catch(()=>{}),Da().catch(()=>{}),!n||L.name!==n.name||L.sourceId&&L.sourceId===hv.current||Mf.current)return;if(H){Me(!0);return}bv(n).catch(F=>l(String(F)))}catch{}},()=>{C.close()}},[n,H,La,Mi]);const ET=x.useMemo(()=>{const T=(Si.length===0?e:e.filter(P=>Si.every(L=>{var F;return(F=P.tags)==null?void 0:F.includes(L)}))).map((P,L)=>({doc:P,index:L})).sort((P,L)=>P.doc.pinned===L.doc.pinned?P.index-L.index:P.doc.pinned?-1:1).map(({doc:P})=>P);return Si.length===0,T},[e,Si]),en=x.useMemo(()=>{if(!n)return null;if(n.type==="markdown")return{type:"markdown",metadata:{base64:null,decoded:null,json:{tags:ki,pinned:n.pinned??!1},error:null},rawMarkdown:o};if(n.type==="json")try{const C=JSON.parse(o);return{type:"json",prettyJson:JSON.stringify(C,null,2),error:null,rawJson:o}}catch{return{type:"json",prettyJson:null,error:"Invalid JSON",rawJson:o}}return null},[n,ki,o]),MT=x.useCallback(C=>{dv(T=>T.includes(C)?T.filter(P=>P!==C):[...T,C].sort())},[]),RT=x.useCallback(()=>{dv([])},[]);return w.jsxs("div",{className:"flex h-screen font-sans",children:[w.jsx("aside",{className:"flex h-screen w-64 flex-col border-r border-border p-4",children:w.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6",children:[w.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between rounded-md border border-input bg-background px-3 text-sm text-muted-foreground transition-colors hover:bg-accent/40",onClick:()=>Ei(!0),"aria-label":"Open command palette",children:[w.jsxs("span",{className:"flex items-center gap-2",children:[w.jsx(PM,{className:"h-4 w-4"}),w.jsx("span",{children:"Search111"})]}),w.jsx("span",{className:"rounded-md border border-border px-1.5 py-0.5 font-mono text-[10px] uppercase",children:navigator.platform.includes("Mac")?"⌘ K":"Ctrl K"})]}),w.jsxs("section",{className:"flex min-h-0 flex-[0_1_auto] flex-col",children:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Tags"}),Si.length>0?w.jsx(Re,{type:"button",variant:"ghost",className:"h-auto px-0 py-0 text-xs font-medium text-muted-foreground hover:text-foreground",onClick:RT,children:"Clear"}):null]}),w.jsxs("div",{className:"mt-2 min-h-0 flex-1 overflow-y-auto pr-1",children:[wi.length>0?w.jsx("ul",{className:"flex flex-wrap gap-2",children:wi.map(C=>w.jsx("li",{className:`rounded-full border px-2 py-1 text-xs ${Si.includes(C)?"border-primary bg-primary/10 text-primary":"border-border bg-muted text-muted-foreground"}`,children:w.jsx("button",{type:"button",className:"text-left",onClick:()=>MT(C),children:C})},C))}):w.jsx("div",{className:"text-xs text-muted-foreground",children:"No tags yet."}),_s?w.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:_s}):null]})]}),w.jsxs("section",{className:"flex min-h-0 flex-[1_1_auto] flex-col",children:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Docs"}),w.jsxs("div",{className:"relative",ref:Cf,children:[w.jsxs("div",{className:"flex",children:[w.jsx(Re,{type:"button",size:"icon",variant:"ghost",onClick:()=>yn(Um),children:w.jsx(oB,{className:"h-4 w-4"})}),w.jsx(Re,{type:"button",size:"icon",variant:"ghost",onClick:()=>J(C=>!C),"aria-expanded":I,"aria-haspopup":"menu",children:w.jsx(Ju,{className:"h-4 w-4"})})]}),I?w.jsxs("div",{className:"absolute right-0 z-20 mt-2 w-44 rounded-md border border-border bg-popover p-1 text-sm shadow-lg",children:[w.jsx("button",{type:"button",className:"flex w-full items-center justify-between rounded px-2 py-1 text-left hover:bg-accent",onClick:()=>yn(Um),children:"New Markdown"}),w.jsx("button",{type:"button",className:"flex w-full items-center justify-between rounded px-2 py-1 text-left hover:bg-accent",onClick:()=>yn(oT),children:"New Data Table"})]}):null]})]}),w.jsx("div",{className:"mt-3 min-h-0 flex-1 overflow-y-auto pr-1",children:w.jsx("ul",{className:"space-y-1",children:ET.map(C=>w.jsxs("li",{className:`flex items-center rounded-md px-2 py-2 ${(n==null?void 0:n.name)===C.name?"glassy-highlight":"hover:bg-accent/40"} ${bi===C.name?"bg-accent/40":""}`,children:[w.jsx(Re,{onClick:()=>gn(`/${er(C.name)}`,{replace:!0}),variant:"ghost",className:"flex-1 justify-start rounded-md bg-transparent px-0 hover:bg-transparent",children:w.jsxs("span",{className:"flex items-center gap-2",children:[C.pinned?w.jsx(OM,{className:"h-3 w-3 text-muted-foreground"}):null,w.jsxs("span",{className:"flex flex-col items-start gap-0.5 leading-tight",children:[w.jsx("span",{className:"flex items-center gap-1",children:C.displayName??C.name}),w.jsx("span",{className:"text-[10px] text-muted-foreground",children:C.name})]})]})}),w.jsxs("div",{className:"relative",ref:bi===C.name?Ef:null,children:[w.jsx(Re,{type:"button",size:"icon",variant:"ghost",className:"rounded-md bg-transparent hover:bg-transparent",onClick:()=>Ci(T=>T===C.name?null:C.name),"aria-expanded":bi===C.name,"aria-haspopup":"menu",children:w.jsx(P3,{className:"h-4 w-4"})}),bi===C.name?w.jsxs("div",{className:"absolute right-0 z-20 mt-2 w-40 rounded-md border border-border bg-card p-1 text-sm shadow-lg",children:[w.jsx("button",{type:"button",className:"flex w-full items-center justify-between rounded px-2 py-1 text-left hover:bg-accent",onClick:async()=>{Ci(null),await yn(Wm,{activeDoc:C})},children:C.pinned?"Unpin":"Pin"}),w.jsx("button",{type:"button",className:"flex w-full items-center justify-between rounded px-2 py-1 text-left hover:bg-accent",onClick:async()=>{Ci(null),await yn(Gm,{activeDoc:C})},children:"Archive"}),w.jsx("button",{type:"button",className:"flex w-full items-center justify-between rounded px-2 py-1 text-left hover:bg-accent",onClick:async()=>{Ci(null),await yn(qm,{activeDoc:C})},children:"Delete"})]}):null]})]},C.name))})})]})]})}),w.jsxs("main",{className:"flex min-h-0 flex-1 flex-col gap-3 p-4",children:[w.jsx(BV,{docType:(n==null?void 0:n.type)??null,title:Cv,titleInputRef:pv,onTitleChange:C=>{fT(C).catch(()=>{})},deriveFileName:n?C=>Bs(C,n.type):void 0,saveStatus:m,onManualSave:()=>Mv().catch(()=>{}),errorStatus:s,conflict:ke,showMetadataButton:(n==null?void 0:n.type)==="markdown"||(n==null?void 0:n.type)==="json",onShowMetadata:()=>zs(!0),fileName:(n==null?void 0:n.name)??"",isPinned:(n==null?void 0:n.pinned)??!1,onTogglePinned:n?()=>yn(Wm):void 0,onArchive:n?()=>yn(Gm):void 0,onDelete:n?()=>yn(qm):void 0,availableTags:gT,selectedTags:Ot,onToggleTag:xT,tagInput:bf,onTagInputChange:C=>{Ia(C),fv&&js("")},onTagAdd:wT,tagStatus:fv}),w.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-3",children:(n==null?void 0:n.type)==="markdown"?w.jsx("div",{className:"min-h-0 flex-1",children:w.jsxs(Lz,{instance:De,children:[De?w.jsx(b5,{editor:De}):null,w.jsx(BE,{editor:De,className:"tiptap-editor tiptap-content h-full"})]})}):w.jsxs(w.Fragment,{children:[pe==="table"&&te&&A&&!_5(te,A)?w.jsxs("div",{className:"flex flex-wrap items-center gap-3 border border-border bg-card px-3 py-2 text-sm",children:[w.jsx("span",{className:"text-muted-foreground",children:"View changes are temporary. Save to make them the default."}),w.jsx(Re,{type:"button",size:"sm",onClick:()=>ST(A),children:"Save as default"}),w.jsx(Re,{type:"button",size:"sm",variant:"ghost",onClick:()=>{V(te),G(C=>C+1)},children:"Reset view"})]}):null,pe==="table"&&N?w.jsx(FH,{data:N,columns:bT,initialSorting:(A==null?void 0:A.sorting)??[],initialGrouping:(A==null?void 0:A.grouping)??[],initialColumnOrder:(A==null?void 0:A.columnOrder)??[],initialColumnVisibility:(A==null?void 0:A.columnVisibility)??{},resetKey:Y,onViewChange:CT}):null,ue?w.jsx("div",{className:"text-sm text-destructive",children:ue}):null,pe==="json"?w.jsx("textarea",{className:"min-h-0 w-full flex-1 border border-input bg-background px-3 py-2 font-mono text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:o,onChange:C=>{i(C.target.value),b(Date.now())},placeholder:"Select a file to edit"}):null]})})]}),w.jsx(k5,{open:aT,onOpenChange:Ei,docs:e,activeDoc:n,commands:uT,onSelectDoc:pT,onRunCommand:hT}),Sf&&n?w.jsx("div",{className:"fixed inset-0 z-40 flex items-center justify-center bg-black/40 p-4",onClick:()=>zs(!1),children:w.jsxs("div",{className:"w-full max-w-lg rounded-lg border border-border bg-card p-5 shadow-xl",role:"dialog","aria-modal":"true","aria-label":"Document info",onClick:C=>C.stopPropagation(),children:[w.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[w.jsx("h3",{className:"text-base font-semibold",children:"Document info"}),w.jsx("button",{type:"button",className:"text-sm text-muted-foreground hover:text-foreground",onClick:()=>zs(!1),children:"Close"})]}),en?w.jsx("div",{className:"space-y-4",children:en.type==="markdown"?w.jsxs(w.Fragment,{children:[w.jsxs("div",{children:[w.jsx("div",{className:"text-xs text-muted-foreground",children:"Metadata (JSON)"}),w.jsx("pre",{className:"max-h-64 overflow-auto rounded-md border border-border bg-muted p-3 text-xs text-foreground",children:(Lv=en.metadata)!=null&&Lv.json?JSON.stringify(en.metadata.json,null,2):en.metadata?"—":"No metadata header found."}),(_v=en.metadata)!=null&&_v.error?w.jsx("div",{className:"mt-2 text-xs text-destructive",children:en.metadata.error}):null]}),w.jsxs("div",{children:[w.jsx("div",{className:"text-xs text-muted-foreground",children:"Markdown"}),w.jsx("pre",{className:"max-h-64 overflow-auto rounded-md border border-border bg-muted p-3 text-xs text-foreground",children:en.rawMarkdown||"—"})]})]}):w.jsxs("div",{children:[w.jsx("div",{className:"text-xs text-muted-foreground",children:"JSON"}),w.jsx("pre",{className:"max-h-64 overflow-auto rounded-md border border-border bg-muted p-3 text-xs text-foreground",children:en.prettyJson??en.rawJson??"—"}),en.error?w.jsx("div",{className:"mt-2 text-xs text-destructive",children:en.error}):null]})}):null]})}):null,R?w.jsx("div",{className:"fixed inset-0 z-30 flex items-center justify-center bg-black/40 p-4",children:w.jsxs("div",{className:"w-full max-w-md rounded-lg border border-border bg-card p-5 shadow-xl",children:[w.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[w.jsx("h3",{className:"text-base font-semibold",children:U==="json"?"New Data Table":"New Markdown Document"}),w.jsx("button",{type:"button",className:"text-sm text-muted-foreground hover:text-foreground",onClick:()=>D(!1),children:"Close"})]}),w.jsxs("div",{className:"space-y-3",children:[w.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[w.jsx("span",{className:"text-muted-foreground",children:"Name"}),w.jsx("input",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:ne,onChange:C=>re(C.target.value),placeholder:"Quarterly plan"})]}),w.jsxs("div",{className:"text-sm text-muted-foreground",children:["Type:"," ",w.jsx("span",{className:"font-medium text-foreground",children:U==="json"?"Data table":"Markdown document"})]}),w.jsxs("div",{className:"text-xs text-muted-foreground",children:["File name:"," ",w.jsx("span",{className:"font-mono text-foreground",children:mT||"—"})]}),w.jsxs("div",{className:"flex flex-col gap-2 text-sm",children:[w.jsx("span",{className:"text-muted-foreground",children:"Tags"}),U==="markdown"?w.jsxs(w.Fragment,{children:[Iv.length>0?w.jsx("div",{className:"flex flex-wrap gap-2",children:Iv.map(C=>w.jsxs("label",{className:`flex items-center gap-1 rounded-full border px-2 py-1 text-xs ${Zn.includes(C)?"border-primary bg-primary/10 text-primary":"border-border bg-muted text-muted-foreground"}`,children:[w.jsx("input",{type:"checkbox",className:"hidden",checked:Zn.includes(C),onChange:()=>yT(C)}),w.jsx("span",{children:C})]},C))}):w.jsx("div",{className:"text-xs text-muted-foreground",children:"No tags yet."}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("input",{className:"h-8 w-full rounded-md border border-input bg-background px-2 text-xs focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:Oa,onChange:C=>{kf(C.target.value),_s&&$s("")},placeholder:"Add a tag"}),w.jsx(Re,{type:"button",size:"sm",variant:"outline",onClick:vT,disabled:!Oa.trim(),children:"Add"})]})]}):w.jsx("div",{className:"text-xs text-muted-foreground",children:"Tags are only available for Markdown docs."}),_s?w.jsx("div",{className:"text-xs text-destructive",children:_s}):null]}),E?w.jsx("div",{className:"text-sm text-destructive",children:E}):null]}),w.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[w.jsx(Re,{type:"button",variant:"ghost",onClick:()=>D(!1),children:"Cancel"}),w.jsx(Re,{type:"button",onClick:()=>kT().catch(()=>{}),children:"Create"})]})]})}):null]})}const Rk=document.getElementById("root");Rk&&VS(Rk).render(w.jsx(nP,{children:w.jsx(JO,{children:w.jsx(tb,{path:"/*",element:w.jsx($5,{})})})}));