write/frontend/dist/assets/index-0vatXfR-.js
2026-06-26 18:13:18 -04:00

232 lines
524 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function nv(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function wp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Cp={exports:{}},ml={},Ep={exports:{}},J={};/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Ds=Symbol.for("react.element"),rv=Symbol.for("react.portal"),iv=Symbol.for("react.fragment"),sv=Symbol.for("react.strict_mode"),ov=Symbol.for("react.profiler"),lv=Symbol.for("react.provider"),av=Symbol.for("react.context"),uv=Symbol.for("react.forward_ref"),cv=Symbol.for("react.suspense"),dv=Symbol.for("react.memo"),fv=Symbol.for("react.lazy"),jd=Symbol.iterator;function hv(t){return t===null||typeof t!="object"?null:(t=jd&&t[jd]||t["@@iterator"],typeof t=="function"?t:null)}var Np={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},bp=Object.assign,Mp={};function gi(t,e,n){this.props=t,this.context=e,this.refs=Mp,this.updater=n||Np}gi.prototype.isReactComponent={};gi.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};gi.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Tp(){}Tp.prototype=gi.prototype;function oc(t,e,n){this.props=t,this.context=e,this.refs=Mp,this.updater=n||Np}var lc=oc.prototype=new Tp;lc.constructor=oc;bp(lc,gi.prototype);lc.isPureReactComponent=!0;var zd=Array.isArray,Op=Object.prototype.hasOwnProperty,ac={current:null},Dp={key:!0,ref:!0,__self:!0,__source:!0};function Pp(t,e,n){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)Op.call(e,r)&&!Dp.hasOwnProperty(r)&&(i[r]=e[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1<l){for(var a=Array(l),u=0;u<l;u++)a[u]=arguments[u+2];i.children=a}if(t&&t.defaultProps)for(r in l=t.defaultProps,l)i[r]===void 0&&(i[r]=l[r]);return{$$typeof:Ds,type:t,key:s,ref:o,props:i,_owner:ac.current}}function pv(t,e){return{$$typeof:Ds,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function uc(t){return typeof t=="object"&&t!==null&&t.$$typeof===Ds}function mv(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var Bd=/\/+/g;function Gl(t,e){return typeof t=="object"&&t!==null&&t.key!=null?mv(""+t.key):e.toString(36)}function mo(t,e,n,r,i){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case Ds:case rv:o=!0}}if(o)return o=t,i=i(o),t=r===""?"."+Gl(o,0):r,zd(i)?(n="",t!=null&&(n=t.replace(Bd,"$&/")+"/"),mo(i,e,n,"",function(u){return u})):i!=null&&(uc(i)&&(i=pv(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(Bd,"$&/")+"/")+t)),e.push(i)),1;if(o=0,r=r===""?".":r+":",zd(t))for(var l=0;l<t.length;l++){s=t[l];var a=r+Gl(s,l);o+=mo(s,e,n,a,i)}else if(a=hv(t),typeof a=="function")for(t=a.call(t),l=0;!(s=t.next()).done;)s=s.value,a=r+Gl(s,l++),o+=mo(s,e,n,a,i);else if(s==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function Vs(t,e,n){if(t==null)return t;var r=[],i=0;return mo(t,r,"","",function(s){return e.call(n,s,i++)}),r}function gv(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var Xe={current:null},go={transition:null},yv={ReactCurrentDispatcher:Xe,ReactCurrentBatchConfig:go,ReactCurrentOwner:ac};function Ap(){throw Error("act(...) is not supported in production builds of React.")}J.Children={map:Vs,forEach:function(t,e,n){Vs(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Vs(t,function(){e++}),e},toArray:function(t){return Vs(t,function(e){return e})||[]},only:function(t){if(!uc(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};J.Component=gi;J.Fragment=iv;J.Profiler=ov;J.PureComponent=oc;J.StrictMode=sv;J.Suspense=cv;J.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yv;J.act=Ap;J.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=bp({},t.props),i=t.key,s=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=ac.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(a in e)Op.call(e,a)&&!Dp.hasOwnProperty(a)&&(r[a]=e[a]===void 0&&l!==void 0?l[a]:e[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:Ds,type:t.type,key:i,ref:s,props:r,_owner:o}};J.createContext=function(t){return t={$$typeof:av,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:lv,_context:t},t.Consumer=t};J.createElement=Pp;J.createFactory=function(t){var e=Pp.bind(null,t);return e.type=t,e};J.createRef=function(){return{current:null}};J.forwardRef=function(t){return{$$typeof:uv,render:t}};J.isValidElement=uc;J.lazy=function(t){return{$$typeof:fv,_payload:{_status:-1,_result:t},_init:gv}};J.memo=function(t,e){return{$$typeof:dv,type:t,compare:e===void 0?null:e}};J.startTransition=function(t){var e=go.transition;go.transition={};try{t()}finally{go.transition=e}};J.unstable_act=Ap;J.useCallback=function(t,e){return Xe.current.useCallback(t,e)};J.useContext=function(t){return Xe.current.useContext(t)};J.useDebugValue=function(){};J.useDeferredValue=function(t){return Xe.current.useDeferredValue(t)};J.useEffect=function(t,e){return Xe.current.useEffect(t,e)};J.useId=function(){return Xe.current.useId()};J.useImperativeHandle=function(t,e,n){return Xe.current.useImperativeHandle(t,e,n)};J.useInsertionEffect=function(t,e){return Xe.current.useInsertionEffect(t,e)};J.useLayoutEffect=function(t,e){return Xe.current.useLayoutEffect(t,e)};J.useMemo=function(t,e){return Xe.current.useMemo(t,e)};J.useReducer=function(t,e,n){return Xe.current.useReducer(t,e,n)};J.useRef=function(t){return Xe.current.useRef(t)};J.useState=function(t){return Xe.current.useState(t)};J.useSyncExternalStore=function(t,e,n){return Xe.current.useSyncExternalStore(t,e,n)};J.useTransition=function(){return Xe.current.useTransition()};J.version="18.3.1";Ep.exports=J;var k=Ep.exports;const be=wp(k),vv=nv({__proto__:null,default:be},[k]);/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var xv=k,Sv=Symbol.for("react.element"),kv=Symbol.for("react.fragment"),wv=Object.prototype.hasOwnProperty,Cv=xv.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ev={key:!0,ref:!0,__self:!0,__source:!0};function Ip(t,e,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)wv.call(e,r)&&!Ev.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Sv,type:t,key:s,ref:o,props:i,_owner:Cv.current}}ml.Fragment=kv;ml.jsx=Ip;ml.jsxs=Ip;Cp.exports=ml;var y=Cp.exports,Ha={},Rp={exports:{}},pt={},Lp={exports:{}},jp={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/(function(t){function e(D,j){var z=D.length;D.push(j);e:for(;0<z;){var A=z-1>>>1,$=D[A];if(0<i($,j))D[A]=j,D[z]=$,z=A;else break e}}function n(D){return D.length===0?null:D[0]}function r(D){if(D.length===0)return null;var j=D[0],z=D.pop();if(z!==j){D[0]=z;e:for(var A=0,$=D.length,ee=$>>>1;A<ee;){var he=2*(A+1)-1,pe=D[he],et=he+1,fn=D[et];if(0>i(pe,z))et<$&&0>i(fn,pe)?(D[A]=fn,D[et]=z,A=et):(D[A]=pe,D[he]=z,A=he);else if(et<$&&0>i(fn,z))D[A]=fn,D[et]=z,A=et;else break e}}return j}function i(D,j){var z=D.sortIndex-j.sortIndex;return z!==0?z:D.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var a=[],u=[],c=1,d=null,f=3,h=!1,p=!1,m=!1,x=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 S(D){for(var j=n(u);j!==null;){if(j.callback===null)r(u);else if(j.startTime<=D)r(u),j.sortIndex=j.expirationTime,e(a,j);else break;j=n(u)}}function w(D){if(m=!1,S(D),!p)if(n(a)!==null)p=!0,X(E);else{var j=n(u);j!==null&&U(w,j.startTime-D)}}function E(D,j){p=!1,m&&(m=!1,g(M),M=-1),h=!0;var z=f;try{for(S(j),d=n(a);d!==null&&(!(d.expirationTime>j)||D&&!T());){var A=d.callback;if(typeof A=="function"){d.callback=null,f=d.priorityLevel;var $=A(d.expirationTime<=j);j=t.unstable_now(),typeof $=="function"?d.callback=$:d===n(a)&&r(a),S(j)}else r(a);d=n(a)}if(d!==null)var ee=!0;else{var he=n(u);he!==null&&U(w,he.startTime-j),ee=!1}return ee}finally{d=null,f=z,h=!1}}var b=!1,C=null,M=-1,_=5,N=-1;function T(){return!(t.unstable_now()-N<_)}function V(){if(C!==null){var D=t.unstable_now();N=D;var j=!0;try{j=C(!0,D)}finally{j?G():(b=!1,C=null)}}else b=!1}var G;if(typeof v=="function")G=function(){v(V)};else if(typeof MessageChannel<"u"){var Y=new MessageChannel,ke=Y.port2;Y.port1.onmessage=V,G=function(){ke.postMessage(null)}}else G=function(){x(V,0)};function X(D){C=D,b||(b=!0,G())}function U(D,j){M=x(function(){D(t.unstable_now())},j)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(D){D.callback=null},t.unstable_continueExecution=function(){p||h||(p=!0,X(E))},t.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<D?Math.floor(1e3/D):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(a)},t.unstable_next=function(D){switch(f){case 1:case 2:case 3:var j=3;break;default:j=f}var z=f;f=j;try{return D()}finally{f=z}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(D,j){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var z=f;f=D;try{return j()}finally{f=z}},t.unstable_scheduleCallback=function(D,j,z){var A=t.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?A+z:A):z=A,D){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=z+$,D={id:c++,callback:j,priorityLevel:D,startTime:z,expirationTime:$,sortIndex:-1},z>A?(D.sortIndex=z,e(u,D),n(a)===null&&D===n(u)&&(m?(g(M),M=-1):m=!0,U(w,z-A))):(D.sortIndex=$,e(a,D),p||h||(p=!0,X(E))),D},t.unstable_shouldYield=T,t.unstable_wrapCallback=function(D){var j=f;return function(){var z=f;f=j;try{return D.apply(this,arguments)}finally{f=z}}}})(jp);Lp.exports=jp;var Nv=Lp.exports;/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var bv=k,ht=Nv;function P(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var zp=new Set,Zi={};function Tr(t,e){si(t,e),si(t+"Capture",e)}function si(t,e){for(Zi[t]=e,t=0;t<e.length;t++)zp.add(e[t])}var ln=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Wa=Object.prototype.hasOwnProperty,Mv=/^[: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]*$/,Fd={},_d={};function Tv(t){return Wa.call(_d,t)?!0:Wa.call(Fd,t)?!1:Mv.test(t)?_d[t]=!0:(Fd[t]=!0,!1)}function Ov(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Dv(t,e,n,r){if(e===null||typeof e>"u"||Ov(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Ze(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Be={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Be[t]=new Ze(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Be[e]=new Ze(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Be[t]=new Ze(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Be[t]=new Ze(t,2,!1,t,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(t){Be[t]=new Ze(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Be[t]=new Ze(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Be[t]=new Ze(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Be[t]=new Ze(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Be[t]=new Ze(t,5,!1,t.toLowerCase(),null,!1,!1)});var cc=/[\-:]([a-z])/g;function dc(t){return t[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(t){var e=t.replace(cc,dc);Be[e]=new Ze(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(cc,dc);Be[e]=new Ze(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(cc,dc);Be[e]=new Ze(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Be[t]=new Ze(t,1,!1,t.toLowerCase(),null,!1,!1)});Be.xlinkHref=new Ze("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Be[t]=new Ze(t,1,!1,t.toLowerCase(),null,!0,!0)});function fc(t,e,n,r){var i=Be.hasOwnProperty(e)?Be[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(Dv(e,n,i,r)&&(n=null),r||i===null?Tv(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=n===null?i.type===3?!1:"":n:(e=i.attributeName,r=i.attributeNamespace,n===null?t.removeAttribute(e):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var dn=bv.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Us=Symbol.for("react.element"),zr=Symbol.for("react.portal"),Br=Symbol.for("react.fragment"),hc=Symbol.for("react.strict_mode"),Ka=Symbol.for("react.profiler"),Bp=Symbol.for("react.provider"),Fp=Symbol.for("react.context"),pc=Symbol.for("react.forward_ref"),Ja=Symbol.for("react.suspense"),qa=Symbol.for("react.suspense_list"),mc=Symbol.for("react.memo"),gn=Symbol.for("react.lazy"),_p=Symbol.for("react.offscreen"),$d=Symbol.iterator;function Ci(t){return t===null||typeof t!="object"?null:(t=$d&&t[$d]||t["@@iterator"],typeof t=="function"?t:null)}var ue=Object.assign,Ql;function Ai(t){if(Ql===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Ql=e&&e[1]||""}return`
`+Ql+t}var Yl=!1;function Xl(t,e){if(!t||Yl)return"";Yl=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var r=u}Reflect.construct(t,[],e)}else{try{e.call()}catch(u){r=u}t.call(e.prototype)}else{try{throw Error()}catch(u){r=u}t()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var i=u.stack.split(`
`),s=r.stack.split(`
`),o=i.length-1,l=s.length-1;1<=o&&0<=l&&i[o]!==s[l];)l--;for(;1<=o&&0<=l;o--,l--)if(i[o]!==s[l]){if(o!==1||l!==1)do if(o--,l--,0>l||i[o]!==s[l]){var a=`
`+i[o].replace(" at new "," at ");return t.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",t.displayName)),a}while(1<=o&&0<=l);break}}}finally{Yl=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Ai(t):""}function Pv(t){switch(t.tag){case 5:return Ai(t.type);case 16:return Ai("Lazy");case 13:return Ai("Suspense");case 19:return Ai("SuspenseList");case 0:case 2:case 15:return t=Xl(t.type,!1),t;case 11:return t=Xl(t.type.render,!1),t;case 1:return t=Xl(t.type,!0),t;default:return""}}function Ga(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Br:return"Fragment";case zr:return"Portal";case Ka:return"Profiler";case hc:return"StrictMode";case Ja:return"Suspense";case qa:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Fp:return(t.displayName||"Context")+".Consumer";case Bp:return(t._context.displayName||"Context")+".Provider";case pc:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case mc:return e=t.displayName||null,e!==null?e:Ga(t.type)||"Memo";case gn:e=t._payload,t=t._init;try{return Ga(t(e))}catch{}}return null}function Av(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ga(e);case 8:return e===hc?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function $n(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function $p(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Iv(t){var e=$p(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Hs(t){t._valueTracker||(t._valueTracker=Iv(t))}function Vp(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=$p(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Po(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Qa(t,e){var n=e.checked;return ue({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Vd(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=$n(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Up(t,e){e=e.checked,e!=null&&fc(t,"checked",e,!1)}function Ya(t,e){Up(t,e);var n=$n(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Xa(t,e.type,n):e.hasOwnProperty("defaultValue")&&Xa(t,e.type,$n(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Ud(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Xa(t,e,n){(e!=="number"||Po(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Ii=Array.isArray;function Yr(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+$n(n),e=null,i=0;i<t.length;i++){if(t[i].value===n){t[i].selected=!0,r&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function Za(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(P(91));return ue({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Hd(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(P(92));if(Ii(n)){if(1<n.length)throw Error(P(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:$n(n)}}function Hp(t,e){var n=$n(e.value),r=$n(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function Wd(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Wp(t){switch(t){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 eu(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Wp(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Ws,Kp=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,i){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,i)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Ws=Ws||document.createElement("div"),Ws.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Ws.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function es(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Fi={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},Rv=["Webkit","ms","Moz","O"];Object.keys(Fi).forEach(function(t){Rv.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Fi[e]=Fi[t]})});function Jp(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Fi.hasOwnProperty(t)&&Fi[t]?(""+e).trim():e+"px"}function qp(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Jp(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var Lv=ue({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 tu(t,e){if(e){if(Lv[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(P(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(P(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(P(61))}if(e.style!=null&&typeof e.style!="object")throw Error(P(62))}}function nu(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 ru=null;function gc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var iu=null,Xr=null,Zr=null;function Kd(t){if(t=Is(t)){if(typeof iu!="function")throw Error(P(280));var e=t.stateNode;e&&(e=Sl(e),iu(t.stateNode,t.type,e))}}function Gp(t){Xr?Zr?Zr.push(t):Zr=[t]:Xr=t}function Qp(){if(Xr){var t=Xr,e=Zr;if(Zr=Xr=null,Kd(t),e)for(t=0;t<e.length;t++)Kd(e[t])}}function Yp(t,e){return t(e)}function Xp(){}var Zl=!1;function Zp(t,e,n){if(Zl)return t(e,n);Zl=!0;try{return Yp(t,e,n)}finally{Zl=!1,(Xr!==null||Zr!==null)&&(Xp(),Qp())}}function ts(t,e){var n=t.stateNode;if(n===null)return null;var r=Sl(n);if(r===null)return null;n=r[e];e:switch(e){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)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(P(231,e,typeof n));return n}var su=!1;if(ln)try{var Ei={};Object.defineProperty(Ei,"passive",{get:function(){su=!0}}),window.addEventListener("test",Ei,Ei),window.removeEventListener("test",Ei,Ei)}catch{su=!1}function jv(t,e,n,r,i,s,o,l,a){var u=Array.prototype.slice.call(arguments,3);try{e.apply(n,u)}catch(c){this.onError(c)}}var _i=!1,Ao=null,Io=!1,ou=null,zv={onError:function(t){_i=!0,Ao=t}};function Bv(t,e,n,r,i,s,o,l,a){_i=!1,Ao=null,jv.apply(zv,arguments)}function Fv(t,e,n,r,i,s,o,l,a){if(Bv.apply(this,arguments),_i){if(_i){var u=Ao;_i=!1,Ao=null}else throw Error(P(198));Io||(Io=!0,ou=u)}}function Or(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function em(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Jd(t){if(Or(t)!==t)throw Error(P(188))}function _v(t){var e=t.alternate;if(!e){if(e=Or(t),e===null)throw Error(P(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return Jd(i),t;if(s===r)return Jd(i),e;s=s.sibling}throw Error(P(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o)throw Error(P(189))}}if(n.alternate!==r)throw Error(P(190))}if(n.tag!==3)throw Error(P(188));return n.stateNode.current===n?t:e}function tm(t){return t=_v(t),t!==null?nm(t):null}function nm(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=nm(t);if(e!==null)return e;t=t.sibling}return null}var rm=ht.unstable_scheduleCallback,qd=ht.unstable_cancelCallback,$v=ht.unstable_shouldYield,Vv=ht.unstable_requestPaint,fe=ht.unstable_now,Uv=ht.unstable_getCurrentPriorityLevel,yc=ht.unstable_ImmediatePriority,im=ht.unstable_UserBlockingPriority,Ro=ht.unstable_NormalPriority,Hv=ht.unstable_LowPriority,sm=ht.unstable_IdlePriority,gl=null,Ht=null;function Wv(t){if(Ht&&typeof Ht.onCommitFiberRoot=="function")try{Ht.onCommitFiberRoot(gl,t,void 0,(t.current.flags&128)===128)}catch{}}var Lt=Math.clz32?Math.clz32:qv,Kv=Math.log,Jv=Math.LN2;function qv(t){return t>>>=0,t===0?32:31-(Kv(t)/Jv|0)|0}var Ks=64,Js=4194304;function Ri(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Lo(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Ri(l):(s&=o,s!==0&&(r=Ri(s)))}else o=n&~i,o!==0?r=Ri(o):s!==0&&(r=Ri(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-Lt(e),i=1<<n,r|=t[n],e&=~i;return r}function Gv(t,e){switch(t){case 1:case 2:case 4:return e+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 e+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 Qv(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,s=t.pendingLanes;0<s;){var o=31-Lt(s),l=1<<o,a=i[o];a===-1?(!(l&n)||l&r)&&(i[o]=Gv(l,e)):a<=e&&(t.expiredLanes|=l),s&=~l}}function lu(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function om(){var t=Ks;return Ks<<=1,!(Ks&4194240)&&(Ks=64),t}function ea(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function Ps(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Lt(e),t[e]=n}function Yv(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var i=31-Lt(n),s=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~s}}function vc(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-Lt(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var Q=0;function lm(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var am,xc,um,cm,dm,au=!1,qs=[],On=null,Dn=null,Pn=null,ns=new Map,rs=new Map,Sn=[],Xv="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 Gd(t,e){switch(t){case"focusin":case"focusout":On=null;break;case"dragenter":case"dragleave":Dn=null;break;case"mouseover":case"mouseout":Pn=null;break;case"pointerover":case"pointerout":ns.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":rs.delete(e.pointerId)}}function Ni(t,e,n,r,i,s){return t===null||t.nativeEvent!==s?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},e!==null&&(e=Is(e),e!==null&&xc(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function Zv(t,e,n,r,i){switch(e){case"focusin":return On=Ni(On,t,e,n,r,i),!0;case"dragenter":return Dn=Ni(Dn,t,e,n,r,i),!0;case"mouseover":return Pn=Ni(Pn,t,e,n,r,i),!0;case"pointerover":var s=i.pointerId;return ns.set(s,Ni(ns.get(s)||null,t,e,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,rs.set(s,Ni(rs.get(s)||null,t,e,n,r,i)),!0}return!1}function fm(t){var e=nr(t.target);if(e!==null){var n=Or(e);if(n!==null){if(e=n.tag,e===13){if(e=em(n),e!==null){t.blockedOn=e,dm(t.priority,function(){um(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function yo(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=uu(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);ru=r,n.target.dispatchEvent(r),ru=null}else return e=Is(n),e!==null&&xc(e),t.blockedOn=n,!1;e.shift()}return!0}function Qd(t,e,n){yo(t)&&n.delete(e)}function e1(){au=!1,On!==null&&yo(On)&&(On=null),Dn!==null&&yo(Dn)&&(Dn=null),Pn!==null&&yo(Pn)&&(Pn=null),ns.forEach(Qd),rs.forEach(Qd)}function bi(t,e){t.blockedOn===e&&(t.blockedOn=null,au||(au=!0,ht.unstable_scheduleCallback(ht.unstable_NormalPriority,e1)))}function is(t){function e(i){return bi(i,t)}if(0<qs.length){bi(qs[0],t);for(var n=1;n<qs.length;n++){var r=qs[n];r.blockedOn===t&&(r.blockedOn=null)}}for(On!==null&&bi(On,t),Dn!==null&&bi(Dn,t),Pn!==null&&bi(Pn,t),ns.forEach(e),rs.forEach(e),n=0;n<Sn.length;n++)r=Sn[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Sn.length&&(n=Sn[0],n.blockedOn===null);)fm(n),n.blockedOn===null&&Sn.shift()}var ei=dn.ReactCurrentBatchConfig,jo=!0;function t1(t,e,n,r){var i=Q,s=ei.transition;ei.transition=null;try{Q=1,Sc(t,e,n,r)}finally{Q=i,ei.transition=s}}function n1(t,e,n,r){var i=Q,s=ei.transition;ei.transition=null;try{Q=4,Sc(t,e,n,r)}finally{Q=i,ei.transition=s}}function Sc(t,e,n,r){if(jo){var i=uu(t,e,n,r);if(i===null)ca(t,e,r,zo,n),Gd(t,r);else if(Zv(i,t,e,n,r))r.stopPropagation();else if(Gd(t,r),e&4&&-1<Xv.indexOf(t)){for(;i!==null;){var s=Is(i);if(s!==null&&am(s),s=uu(t,e,n,r),s===null&&ca(t,e,r,zo,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else ca(t,e,r,null,n)}}var zo=null;function uu(t,e,n,r){if(zo=null,t=gc(r),t=nr(t),t!==null)if(e=Or(t),e===null)t=null;else if(n=e.tag,n===13){if(t=em(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return zo=t,null}function hm(t){switch(t){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(Uv()){case yc:return 1;case im:return 4;case Ro:case Hv:return 16;case sm:return 536870912;default:return 16}default:return 16}}var Cn=null,kc=null,vo=null;function pm(){if(vo)return vo;var t,e=kc,n=e.length,r,i="value"in Cn?Cn.value:Cn.textContent,s=i.length;for(t=0;t<n&&e[t]===i[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===i[s-r];r++);return vo=i.slice(t,1<r?1-r:void 0)}function xo(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Gs(){return!0}function Yd(){return!1}function mt(t){function e(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var l in t)t.hasOwnProperty(l)&&(n=t[l],this[l]=n?n(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Gs:Yd,this.isPropagationStopped=Yd,this}return ue(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Gs)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Gs)},persist:function(){},isPersistent:Gs}),e}var yi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wc=mt(yi),As=ue({},yi,{view:0,detail:0}),r1=mt(As),ta,na,Mi,yl=ue({},As,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Cc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Mi&&(Mi&&t.type==="mousemove"?(ta=t.screenX-Mi.screenX,na=t.screenY-Mi.screenY):na=ta=0,Mi=t),ta)},movementY:function(t){return"movementY"in t?t.movementY:na}}),Xd=mt(yl),i1=ue({},yl,{dataTransfer:0}),s1=mt(i1),o1=ue({},As,{relatedTarget:0}),ra=mt(o1),l1=ue({},yi,{animationName:0,elapsedTime:0,pseudoElement:0}),a1=mt(l1),u1=ue({},yi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),c1=mt(u1),d1=ue({},yi,{data:0}),Zd=mt(d1),f1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},h1={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"},p1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function m1(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=p1[t])?!!e[t]:!1}function Cc(){return m1}var g1=ue({},As,{key:function(t){if(t.key){var e=f1[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=xo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?h1[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Cc,charCode:function(t){return t.type==="keypress"?xo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?xo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),y1=mt(g1),v1=ue({},yl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ef=mt(v1),x1=ue({},As,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Cc}),S1=mt(x1),k1=ue({},yi,{propertyName:0,elapsedTime:0,pseudoElement:0}),w1=mt(k1),C1=ue({},yl,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),E1=mt(C1),N1=[9,13,27,32],Ec=ln&&"CompositionEvent"in window,$i=null;ln&&"documentMode"in document&&($i=document.documentMode);var b1=ln&&"TextEvent"in window&&!$i,mm=ln&&(!Ec||$i&&8<$i&&11>=$i),tf=" ",nf=!1;function gm(t,e){switch(t){case"keyup":return N1.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ym(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Fr=!1;function M1(t,e){switch(t){case"compositionend":return ym(e);case"keypress":return e.which!==32?null:(nf=!0,tf);case"textInput":return t=e.data,t===tf&&nf?null:t;default:return null}}function T1(t,e){if(Fr)return t==="compositionend"||!Ec&&gm(t,e)?(t=pm(),vo=kc=Cn=null,Fr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return mm&&e.locale!=="ko"?null:e.data;default:return null}}var O1={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 rf(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!O1[t.type]:e==="textarea"}function vm(t,e,n,r){Gp(r),e=Bo(e,"onChange"),0<e.length&&(n=new wc("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var Vi=null,ss=null;function D1(t){Om(t,0)}function vl(t){var e=Vr(t);if(Vp(e))return t}function P1(t,e){if(t==="change")return e}var xm=!1;if(ln){var ia;if(ln){var sa="oninput"in document;if(!sa){var sf=document.createElement("div");sf.setAttribute("oninput","return;"),sa=typeof sf.oninput=="function"}ia=sa}else ia=!1;xm=ia&&(!document.documentMode||9<document.documentMode)}function of(){Vi&&(Vi.detachEvent("onpropertychange",Sm),ss=Vi=null)}function Sm(t){if(t.propertyName==="value"&&vl(ss)){var e=[];vm(e,ss,t,gc(t)),Zp(D1,e)}}function A1(t,e,n){t==="focusin"?(of(),Vi=e,ss=n,Vi.attachEvent("onpropertychange",Sm)):t==="focusout"&&of()}function I1(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return vl(ss)}function R1(t,e){if(t==="click")return vl(e)}function L1(t,e){if(t==="input"||t==="change")return vl(e)}function j1(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var zt=typeof Object.is=="function"?Object.is:j1;function ls(t,e){if(zt(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Wa.call(e,i)||!zt(t[i],e[i]))return!1}return!0}function lf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function af(t,e){var n=lf(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=lf(n)}}function km(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?km(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function wm(){for(var t=window,e=Po();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Po(t.document)}return e}function Nc(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function z1(t){var e=wm(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&km(n.ownerDocument.documentElement,n)){if(r!==null&&Nc(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=af(n,s);var o=af(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var B1=ln&&"documentMode"in document&&11>=document.documentMode,_r=null,cu=null,Ui=null,du=!1;function uf(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;du||_r==null||_r!==Po(r)||(r=_r,"selectionStart"in r&&Nc(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}),Ui&&ls(Ui,r)||(Ui=r,r=Bo(cu,"onSelect"),0<r.length&&(e=new wc("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=_r)))}function Qs(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var $r={animationend:Qs("Animation","AnimationEnd"),animationiteration:Qs("Animation","AnimationIteration"),animationstart:Qs("Animation","AnimationStart"),transitionend:Qs("Transition","TransitionEnd")},oa={},Cm={};ln&&(Cm=document.createElement("div").style,"AnimationEvent"in window||(delete $r.animationend.animation,delete $r.animationiteration.animation,delete $r.animationstart.animation),"TransitionEvent"in window||delete $r.transitionend.transition);function xl(t){if(oa[t])return oa[t];if(!$r[t])return t;var e=$r[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in Cm)return oa[t]=e[n];return t}var Em=xl("animationend"),Nm=xl("animationiteration"),bm=xl("animationstart"),Mm=xl("transitionend"),Tm=new Map,cf="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 Hn(t,e){Tm.set(t,e),Tr(e,[t])}for(var la=0;la<cf.length;la++){var aa=cf[la],F1=aa.toLowerCase(),_1=aa[0].toUpperCase()+aa.slice(1);Hn(F1,"on"+_1)}Hn(Em,"onAnimationEnd");Hn(Nm,"onAnimationIteration");Hn(bm,"onAnimationStart");Hn("dblclick","onDoubleClick");Hn("focusin","onFocus");Hn("focusout","onBlur");Hn(Mm,"onTransitionEnd");si("onMouseEnter",["mouseout","mouseover"]);si("onMouseLeave",["mouseout","mouseover"]);si("onPointerEnter",["pointerout","pointerover"]);si("onPointerLeave",["pointerout","pointerover"]);Tr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Tr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Tr("onBeforeInput",["compositionend","keypress","textInput","paste"]);Tr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Tr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Tr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Li="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(" "),$1=new Set("cancel close invalid load scroll toggle".split(" ").concat(Li));function df(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,Fv(r,e,void 0,t),t.currentTarget=null}function Om(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;e:{var s=void 0;if(e)for(var o=r.length-1;0<=o;o--){var l=r[o],a=l.instance,u=l.currentTarget;if(l=l.listener,a!==s&&i.isPropagationStopped())break e;df(i,l,u),s=a}else for(o=0;o<r.length;o++){if(l=r[o],a=l.instance,u=l.currentTarget,l=l.listener,a!==s&&i.isPropagationStopped())break e;df(i,l,u),s=a}}}if(Io)throw t=ou,Io=!1,ou=null,t}function re(t,e){var n=e[gu];n===void 0&&(n=e[gu]=new Set);var r=t+"__bubble";n.has(r)||(Dm(e,t,2,!1),n.add(r))}function ua(t,e,n){var r=0;e&&(r|=4),Dm(n,t,r,e)}var Ys="_reactListening"+Math.random().toString(36).slice(2);function as(t){if(!t[Ys]){t[Ys]=!0,zp.forEach(function(n){n!=="selectionchange"&&($1.has(n)||ua(n,!1,t),ua(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Ys]||(e[Ys]=!0,ua("selectionchange",!1,e))}}function Dm(t,e,n,r){switch(hm(e)){case 1:var i=t1;break;case 4:i=n1;break;default:i=Sc}n=i.bind(null,e,n,t),i=void 0,!su||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):i!==void 0?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function ca(t,e,n,r,i){var s=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var a=o.tag;if((a===3||a===4)&&(a=o.stateNode.containerInfo,a===i||a.nodeType===8&&a.parentNode===i))return;o=o.return}for(;l!==null;){if(o=nr(l),o===null)return;if(a=o.tag,a===5||a===6){r=s=o;continue e}l=l.parentNode}}r=r.return}Zp(function(){var u=s,c=gc(n),d=[];e:{var f=Tm.get(t);if(f!==void 0){var h=wc,p=t;switch(t){case"keypress":if(xo(n)===0)break e;case"keydown":case"keyup":h=y1;break;case"focusin":p="focus",h=ra;break;case"focusout":p="blur",h=ra;break;case"beforeblur":case"afterblur":h=ra;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":h=Xd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=s1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=S1;break;case Em:case Nm:case bm:h=a1;break;case Mm:h=w1;break;case"scroll":h=r1;break;case"wheel":h=E1;break;case"copy":case"cut":case"paste":h=c1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=ef}var m=(e&4)!==0,x=!m&&t==="scroll",g=m?f!==null?f+"Capture":null:f;m=[];for(var v=u,S;v!==null;){S=v;var w=S.stateNode;if(S.tag===5&&w!==null&&(S=w,g!==null&&(w=ts(v,g),w!=null&&m.push(us(v,w,S)))),x)break;v=v.return}0<m.length&&(f=new h(f,p,null,n,c),d.push({event:f,listeners:m}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",h=t==="mouseout"||t==="pointerout",f&&n!==ru&&(p=n.relatedTarget||n.fromElement)&&(nr(p)||p[an]))break e;if((h||f)&&(f=c.window===c?c:(f=c.ownerDocument)?f.defaultView||f.parentWindow:window,h?(p=n.relatedTarget||n.toElement,h=u,p=p?nr(p):null,p!==null&&(x=Or(p),p!==x||p.tag!==5&&p.tag!==6)&&(p=null)):(h=null,p=u),h!==p)){if(m=Xd,w="onMouseLeave",g="onMouseEnter",v="mouse",(t==="pointerout"||t==="pointerover")&&(m=ef,w="onPointerLeave",g="onPointerEnter",v="pointer"),x=h==null?f:Vr(h),S=p==null?f:Vr(p),f=new m(w,v+"leave",h,n,c),f.target=x,f.relatedTarget=S,w=null,nr(c)===u&&(m=new m(g,v+"enter",p,n,c),m.target=S,m.relatedTarget=x,w=m),x=w,h&&p)t:{for(m=h,g=p,v=0,S=m;S;S=Pr(S))v++;for(S=0,w=g;w;w=Pr(w))S++;for(;0<v-S;)m=Pr(m),v--;for(;0<S-v;)g=Pr(g),S--;for(;v--;){if(m===g||g!==null&&m===g.alternate)break t;m=Pr(m),g=Pr(g)}m=null}else m=null;h!==null&&ff(d,f,h,m,!1),p!==null&&x!==null&&ff(d,x,p,m,!0)}}e:{if(f=u?Vr(u):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var E=P1;else if(rf(f))if(xm)E=L1;else{E=I1;var b=A1}else(h=f.nodeName)&&h.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(E=R1);if(E&&(E=E(t,u))){vm(d,E,n,c);break e}b&&b(t,f,u),t==="focusout"&&(b=f._wrapperState)&&b.controlled&&f.type==="number"&&Xa(f,"number",f.value)}switch(b=u?Vr(u):window,t){case"focusin":(rf(b)||b.contentEditable==="true")&&(_r=b,cu=u,Ui=null);break;case"focusout":Ui=cu=_r=null;break;case"mousedown":du=!0;break;case"contextmenu":case"mouseup":case"dragend":du=!1,uf(d,n,c);break;case"selectionchange":if(B1)break;case"keydown":case"keyup":uf(d,n,c)}var C;if(Ec)e:{switch(t){case"compositionstart":var M="onCompositionStart";break e;case"compositionend":M="onCompositionEnd";break e;case"compositionupdate":M="onCompositionUpdate";break e}M=void 0}else Fr?gm(t,n)&&(M="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(M="onCompositionStart");M&&(mm&&n.locale!=="ko"&&(Fr||M!=="onCompositionStart"?M==="onCompositionEnd"&&Fr&&(C=pm()):(Cn=c,kc="value"in Cn?Cn.value:Cn.textContent,Fr=!0)),b=Bo(u,M),0<b.length&&(M=new Zd(M,t,null,n,c),d.push({event:M,listeners:b}),C?M.data=C:(C=ym(n),C!==null&&(M.data=C)))),(C=b1?M1(t,n):T1(t,n))&&(u=Bo(u,"onBeforeInput"),0<u.length&&(c=new Zd("onBeforeInput","beforeinput",null,n,c),d.push({event:c,listeners:u}),c.data=C))}Om(d,e)})}function us(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Bo(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=ts(t,n),s!=null&&r.unshift(us(t,s,i)),s=ts(t,e),s!=null&&r.push(us(t,s,i))),t=t.return}return r}function Pr(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function ff(t,e,n,r,i){for(var s=e._reactName,o=[];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,i?(a=ts(n,s),a!=null&&o.unshift(us(n,a,l))):i||(a=ts(n,s),a!=null&&o.push(us(n,a,l)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var V1=/\r\n?/g,U1=/\u0000|\uFFFD/g;function hf(t){return(typeof t=="string"?t:""+t).replace(V1,`
`).replace(U1,"")}function Xs(t,e,n){if(e=hf(e),hf(t)!==e&&n)throw Error(P(425))}function Fo(){}var fu=null,hu=null;function pu(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var mu=typeof setTimeout=="function"?setTimeout:void 0,H1=typeof clearTimeout=="function"?clearTimeout:void 0,pf=typeof Promise=="function"?Promise:void 0,W1=typeof queueMicrotask=="function"?queueMicrotask:typeof pf<"u"?function(t){return pf.resolve(null).then(t).catch(K1)}:mu;function K1(t){setTimeout(function(){throw t})}function da(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){t.removeChild(i),is(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);is(e)}function An(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function mf(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var vi=Math.random().toString(36).slice(2),Vt="__reactFiber$"+vi,cs="__reactProps$"+vi,an="__reactContainer$"+vi,gu="__reactEvents$"+vi,J1="__reactListeners$"+vi,q1="__reactHandles$"+vi;function nr(t){var e=t[Vt];if(e)return e;for(var n=t.parentNode;n;){if(e=n[an]||n[Vt]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=mf(t);t!==null;){if(n=t[Vt])return n;t=mf(t)}return e}t=n,n=t.parentNode}return null}function Is(t){return t=t[Vt]||t[an],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Vr(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(P(33))}function Sl(t){return t[cs]||null}var yu=[],Ur=-1;function Wn(t){return{current:t}}function se(t){0>Ur||(t.current=yu[Ur],yu[Ur]=null,Ur--)}function ne(t,e){Ur++,yu[Ur]=t.current,t.current=e}var Vn={},Ue=Wn(Vn),rt=Wn(!1),yr=Vn;function oi(t,e){var n=t.type.contextTypes;if(!n)return Vn;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function it(t){return t=t.childContextTypes,t!=null}function _o(){se(rt),se(Ue)}function gf(t,e,n){if(Ue.current!==Vn)throw Error(P(168));ne(Ue,e),ne(rt,n)}function Pm(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(P(108,Av(t)||"Unknown",i));return ue({},n,r)}function $o(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Vn,yr=Ue.current,ne(Ue,t),ne(rt,rt.current),!0}function yf(t,e,n){var r=t.stateNode;if(!r)throw Error(P(169));n?(t=Pm(t,e,yr),r.__reactInternalMemoizedMergedChildContext=t,se(rt),se(Ue),ne(Ue,t)):se(rt),ne(rt,n)}var Xt=null,kl=!1,fa=!1;function Am(t){Xt===null?Xt=[t]:Xt.push(t)}function G1(t){kl=!0,Am(t)}function Kn(){if(!fa&&Xt!==null){fa=!0;var t=0,e=Q;try{var n=Xt;for(Q=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}Xt=null,kl=!1}catch(i){throw Xt!==null&&(Xt=Xt.slice(t+1)),rm(yc,Kn),i}finally{Q=e,fa=!1}}return null}var Hr=[],Wr=0,Vo=null,Uo=0,yt=[],vt=0,vr=null,Zt=1,en="";function Xn(t,e){Hr[Wr++]=Uo,Hr[Wr++]=Vo,Vo=t,Uo=e}function Im(t,e,n){yt[vt++]=Zt,yt[vt++]=en,yt[vt++]=vr,vr=t;var r=Zt;t=en;var i=32-Lt(r)-1;r&=~(1<<i),n+=1;var s=32-Lt(e)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Zt=1<<32-Lt(e)+i|n<<i|r,en=s+t}else Zt=1<<s|n<<i|r,en=t}function bc(t){t.return!==null&&(Xn(t,1),Im(t,1,0))}function Mc(t){for(;t===Vo;)Vo=Hr[--Wr],Hr[Wr]=null,Uo=Hr[--Wr],Hr[Wr]=null;for(;t===vr;)vr=yt[--vt],yt[vt]=null,en=yt[--vt],yt[vt]=null,Zt=yt[--vt],yt[vt]=null}var dt=null,ut=null,oe=!1,It=null;function Rm(t,e){var n=St(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function vf(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,dt=t,ut=An(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,dt=t,ut=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=vr!==null?{id:Zt,overflow:en}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=St(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,dt=t,ut=null,!0):!1;default:return!1}}function vu(t){return(t.mode&1)!==0&&(t.flags&128)===0}function xu(t){if(oe){var e=ut;if(e){var n=e;if(!vf(t,e)){if(vu(t))throw Error(P(418));e=An(n.nextSibling);var r=dt;e&&vf(t,e)?Rm(r,n):(t.flags=t.flags&-4097|2,oe=!1,dt=t)}}else{if(vu(t))throw Error(P(418));t.flags=t.flags&-4097|2,oe=!1,dt=t}}}function xf(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;dt=t}function Zs(t){if(t!==dt)return!1;if(!oe)return xf(t),oe=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!pu(t.type,t.memoizedProps)),e&&(e=ut)){if(vu(t))throw Lm(),Error(P(418));for(;e;)Rm(t,e),e=An(e.nextSibling)}if(xf(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(P(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){ut=An(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}ut=null}}else ut=dt?An(t.stateNode.nextSibling):null;return!0}function Lm(){for(var t=ut;t;)t=An(t.nextSibling)}function li(){ut=dt=null,oe=!1}function Tc(t){It===null?It=[t]:It.push(t)}var Q1=dn.ReactCurrentBatchConfig;function Ti(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(P(309));var r=n.stateNode}if(!r)throw Error(P(147,t));var i=r,s=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var l=i.refs;o===null?delete l[s]:l[s]=o},e._stringRef=s,e)}if(typeof t!="string")throw Error(P(284));if(!n._owner)throw Error(P(290,t))}return t}function eo(t,e){throw t=Object.prototype.toString.call(e),Error(P(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function Sf(t){var e=t._init;return e(t._payload)}function jm(t){function e(g,v){if(t){var S=g.deletions;S===null?(g.deletions=[v],g.flags|=16):S.push(v)}}function n(g,v){if(!t)return null;for(;v!==null;)e(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 i(g,v){return g=jn(g,v),g.index=0,g.sibling=null,g}function s(g,v,S){return g.index=S,t?(S=g.alternate,S!==null?(S=S.index,S<v?(g.flags|=2,v):S):(g.flags|=2,v)):(g.flags|=1048576,v)}function o(g){return t&&g.alternate===null&&(g.flags|=2),g}function l(g,v,S,w){return v===null||v.tag!==6?(v=xa(S,g.mode,w),v.return=g,v):(v=i(v,S),v.return=g,v)}function a(g,v,S,w){var E=S.type;return E===Br?c(g,v,S.props.children,w,S.key):v!==null&&(v.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===gn&&Sf(E)===v.type)?(w=i(v,S.props),w.ref=Ti(g,v,S),w.return=g,w):(w=bo(S.type,S.key,S.props,null,g.mode,w),w.ref=Ti(g,v,S),w.return=g,w)}function u(g,v,S,w){return v===null||v.tag!==4||v.stateNode.containerInfo!==S.containerInfo||v.stateNode.implementation!==S.implementation?(v=Sa(S,g.mode,w),v.return=g,v):(v=i(v,S.children||[]),v.return=g,v)}function c(g,v,S,w,E){return v===null||v.tag!==7?(v=cr(S,g.mode,w,E),v.return=g,v):(v=i(v,S),v.return=g,v)}function d(g,v,S){if(typeof v=="string"&&v!==""||typeof v=="number")return v=xa(""+v,g.mode,S),v.return=g,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Us:return S=bo(v.type,v.key,v.props,null,g.mode,S),S.ref=Ti(g,null,v),S.return=g,S;case zr:return v=Sa(v,g.mode,S),v.return=g,v;case gn:var w=v._init;return d(g,w(v._payload),S)}if(Ii(v)||Ci(v))return v=cr(v,g.mode,S,null),v.return=g,v;eo(g,v)}return null}function f(g,v,S,w){var E=v!==null?v.key:null;if(typeof S=="string"&&S!==""||typeof S=="number")return E!==null?null:l(g,v,""+S,w);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Us:return S.key===E?a(g,v,S,w):null;case zr:return S.key===E?u(g,v,S,w):null;case gn:return E=S._init,f(g,v,E(S._payload),w)}if(Ii(S)||Ci(S))return E!==null?null:c(g,v,S,w,null);eo(g,S)}return null}function h(g,v,S,w,E){if(typeof w=="string"&&w!==""||typeof w=="number")return g=g.get(S)||null,l(v,g,""+w,E);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Us:return g=g.get(w.key===null?S:w.key)||null,a(v,g,w,E);case zr:return g=g.get(w.key===null?S:w.key)||null,u(v,g,w,E);case gn:var b=w._init;return h(g,v,S,b(w._payload),E)}if(Ii(w)||Ci(w))return g=g.get(S)||null,c(v,g,w,E,null);eo(v,w)}return null}function p(g,v,S,w){for(var E=null,b=null,C=v,M=v=0,_=null;C!==null&&M<S.length;M++){C.index>M?(_=C,C=null):_=C.sibling;var N=f(g,C,S[M],w);if(N===null){C===null&&(C=_);break}t&&C&&N.alternate===null&&e(g,C),v=s(N,v,M),b===null?E=N:b.sibling=N,b=N,C=_}if(M===S.length)return n(g,C),oe&&Xn(g,M),E;if(C===null){for(;M<S.length;M++)C=d(g,S[M],w),C!==null&&(v=s(C,v,M),b===null?E=C:b.sibling=C,b=C);return oe&&Xn(g,M),E}for(C=r(g,C);M<S.length;M++)_=h(C,g,M,S[M],w),_!==null&&(t&&_.alternate!==null&&C.delete(_.key===null?M:_.key),v=s(_,v,M),b===null?E=_:b.sibling=_,b=_);return t&&C.forEach(function(T){return e(g,T)}),oe&&Xn(g,M),E}function m(g,v,S,w){var E=Ci(S);if(typeof E!="function")throw Error(P(150));if(S=E.call(S),S==null)throw Error(P(151));for(var b=E=null,C=v,M=v=0,_=null,N=S.next();C!==null&&!N.done;M++,N=S.next()){C.index>M?(_=C,C=null):_=C.sibling;var T=f(g,C,N.value,w);if(T===null){C===null&&(C=_);break}t&&C&&T.alternate===null&&e(g,C),v=s(T,v,M),b===null?E=T:b.sibling=T,b=T,C=_}if(N.done)return n(g,C),oe&&Xn(g,M),E;if(C===null){for(;!N.done;M++,N=S.next())N=d(g,N.value,w),N!==null&&(v=s(N,v,M),b===null?E=N:b.sibling=N,b=N);return oe&&Xn(g,M),E}for(C=r(g,C);!N.done;M++,N=S.next())N=h(C,g,M,N.value,w),N!==null&&(t&&N.alternate!==null&&C.delete(N.key===null?M:N.key),v=s(N,v,M),b===null?E=N:b.sibling=N,b=N);return t&&C.forEach(function(V){return e(g,V)}),oe&&Xn(g,M),E}function x(g,v,S,w){if(typeof S=="object"&&S!==null&&S.type===Br&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case Us:e:{for(var E=S.key,b=v;b!==null;){if(b.key===E){if(E=S.type,E===Br){if(b.tag===7){n(g,b.sibling),v=i(b,S.props.children),v.return=g,g=v;break e}}else if(b.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===gn&&Sf(E)===b.type){n(g,b.sibling),v=i(b,S.props),v.ref=Ti(g,b,S),v.return=g,g=v;break e}n(g,b);break}else e(g,b);b=b.sibling}S.type===Br?(v=cr(S.props.children,g.mode,w,S.key),v.return=g,g=v):(w=bo(S.type,S.key,S.props,null,g.mode,w),w.ref=Ti(g,v,S),w.return=g,g=w)}return o(g);case zr:e:{for(b=S.key;v!==null;){if(v.key===b)if(v.tag===4&&v.stateNode.containerInfo===S.containerInfo&&v.stateNode.implementation===S.implementation){n(g,v.sibling),v=i(v,S.children||[]),v.return=g,g=v;break e}else{n(g,v);break}else e(g,v);v=v.sibling}v=Sa(S,g.mode,w),v.return=g,g=v}return o(g);case gn:return b=S._init,x(g,v,b(S._payload),w)}if(Ii(S))return p(g,v,S,w);if(Ci(S))return m(g,v,S,w);eo(g,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,v!==null&&v.tag===6?(n(g,v.sibling),v=i(v,S),v.return=g,g=v):(n(g,v),v=xa(S,g.mode,w),v.return=g,g=v),o(g)):n(g,v)}return x}var ai=jm(!0),zm=jm(!1),Ho=Wn(null),Wo=null,Kr=null,Oc=null;function Dc(){Oc=Kr=Wo=null}function Pc(t){var e=Ho.current;se(Ho),t._currentValue=e}function Su(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function ti(t,e){Wo=t,Oc=Kr=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(nt=!0),t.firstContext=null)}function Et(t){var e=t._currentValue;if(Oc!==t)if(t={context:t,memoizedValue:e,next:null},Kr===null){if(Wo===null)throw Error(P(308));Kr=t,Wo.dependencies={lanes:0,firstContext:t}}else Kr=Kr.next=t;return e}var rr=null;function Ac(t){rr===null?rr=[t]:rr.push(t)}function Bm(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,Ac(e)):(n.next=i.next,i.next=n),e.interleaved=n,un(t,r)}function un(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var yn=!1;function Ic(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Fm(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function nn(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function In(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,q&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,un(t,n)}return i=r.interleaved,i===null?(e.next=e,Ac(r)):(e.next=i.next,i.next=e),r.interleaved=e,un(t,n)}function So(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,vc(t,n)}}function kf(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Ko(t,e,n,r){var i=t.updateQueue;yn=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var a=l,u=a.next;a.next=null,o===null?s=u:o.next=u,o=a;var c=t.alternate;c!==null&&(c=c.updateQueue,l=c.lastBaseUpdate,l!==o&&(l===null?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=a))}if(s!==null){var d=i.baseState;o=0,c=u=a=null,l=s;do{var f=l.lane,h=l.eventTime;if((r&f)===f){c!==null&&(c=c.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var p=t,m=l;switch(f=e,h=n,m.tag){case 1:if(p=m.payload,typeof p=="function"){d=p.call(h,d,f);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,f=typeof p=="function"?p.call(h,d,f):p,f==null)break e;d=ue({},d,f);break e;case 2:yn=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,f=i.effects,f===null?i.effects=[l]:f.push(l))}else h={eventTime:h,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(u=c=h,a=d):c=c.next=h,o|=f;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;f=l,l=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(c===null&&(a=d),i.baseState=a,i.firstBaseUpdate=u,i.lastBaseUpdate=c,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);Sr|=o,t.lanes=o,t.memoizedState=d}}function wf(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(P(191,i));i.call(r)}}}var Rs={},Wt=Wn(Rs),ds=Wn(Rs),fs=Wn(Rs);function ir(t){if(t===Rs)throw Error(P(174));return t}function Rc(t,e){switch(ne(fs,e),ne(ds,t),ne(Wt,Rs),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:eu(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=eu(e,t)}se(Wt),ne(Wt,e)}function ui(){se(Wt),se(ds),se(fs)}function _m(t){ir(fs.current);var e=ir(Wt.current),n=eu(e,t.type);e!==n&&(ne(ds,t),ne(Wt,n))}function Lc(t){ds.current===t&&(se(Wt),se(ds))}var le=Wn(0);function Jo(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var ha=[];function jc(){for(var t=0;t<ha.length;t++)ha[t]._workInProgressVersionPrimary=null;ha.length=0}var ko=dn.ReactCurrentDispatcher,pa=dn.ReactCurrentBatchConfig,xr=0,ae=null,we=null,Ne=null,qo=!1,Hi=!1,hs=0,Y1=0;function Fe(){throw Error(P(321))}function zc(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!zt(t[n],e[n]))return!1;return!0}function Bc(t,e,n,r,i,s){if(xr=s,ae=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ko.current=t===null||t.memoizedState===null?tx:nx,t=n(r,i),Hi){s=0;do{if(Hi=!1,hs=0,25<=s)throw Error(P(301));s+=1,Ne=we=null,e.updateQueue=null,ko.current=rx,t=n(r,i)}while(Hi)}if(ko.current=Go,e=we!==null&&we.next!==null,xr=0,Ne=we=ae=null,qo=!1,e)throw Error(P(300));return t}function Fc(){var t=hs!==0;return hs=0,t}function _t(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ne===null?ae.memoizedState=Ne=t:Ne=Ne.next=t,Ne}function Nt(){if(we===null){var t=ae.alternate;t=t!==null?t.memoizedState:null}else t=we.next;var e=Ne===null?ae.memoizedState:Ne.next;if(e!==null)Ne=e,we=t;else{if(t===null)throw Error(P(310));we=t,t={memoizedState:we.memoizedState,baseState:we.baseState,baseQueue:we.baseQueue,queue:we.queue,next:null},Ne===null?ae.memoizedState=Ne=t:Ne=Ne.next=t}return Ne}function ps(t,e){return typeof e=="function"?e(t):e}function ma(t){var e=Nt(),n=e.queue;if(n===null)throw Error(P(311));n.lastRenderedReducer=t;var r=we,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var l=o=null,a=null,u=s;do{var c=u.lane;if((xr&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:t(r,u.action);else{var d={lane:c,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};a===null?(l=a=d,o=r):a=a.next=d,ae.lanes|=c,Sr|=c}u=u.next}while(u!==null&&u!==s);a===null?o=r:a.next=l,zt(r,e.memoizedState)||(nt=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=a,n.lastRenderedState=r}if(t=n.interleaved,t!==null){i=t;do s=i.lane,ae.lanes|=s,Sr|=s,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function ga(t){var e=Nt(),n=e.queue;if(n===null)throw Error(P(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,s=e.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=t(s,o.action),o=o.next;while(o!==i);zt(s,e.memoizedState)||(nt=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),n.lastRenderedState=s}return[s,r]}function $m(){}function Vm(t,e){var n=ae,r=Nt(),i=e(),s=!zt(r.memoizedState,i);if(s&&(r.memoizedState=i,nt=!0),r=r.queue,_c(Wm.bind(null,n,r,t),[t]),r.getSnapshot!==e||s||Ne!==null&&Ne.memoizedState.tag&1){if(n.flags|=2048,ms(9,Hm.bind(null,n,r,i,e),void 0,null),Me===null)throw Error(P(349));xr&30||Um(n,e,i)}return i}function Um(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=ae.updateQueue,e===null?(e={lastEffect:null,stores:null},ae.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function Hm(t,e,n,r){e.value=n,e.getSnapshot=r,Km(e)&&Jm(t)}function Wm(t,e,n){return n(function(){Km(e)&&Jm(t)})}function Km(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!zt(t,n)}catch{return!0}}function Jm(t){var e=un(t,1);e!==null&&jt(e,t,1,-1)}function Cf(t){var e=_t();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:t},e.queue=t,t=t.dispatch=ex.bind(null,ae,t),[e.memoizedState,t]}function ms(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=ae.updateQueue,e===null?(e={lastEffect:null,stores:null},ae.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function qm(){return Nt().memoizedState}function wo(t,e,n,r){var i=_t();ae.flags|=t,i.memoizedState=ms(1|e,n,void 0,r===void 0?null:r)}function wl(t,e,n,r){var i=Nt();r=r===void 0?null:r;var s=void 0;if(we!==null){var o=we.memoizedState;if(s=o.destroy,r!==null&&zc(r,o.deps)){i.memoizedState=ms(e,n,s,r);return}}ae.flags|=t,i.memoizedState=ms(1|e,n,s,r)}function Ef(t,e){return wo(8390656,8,t,e)}function _c(t,e){return wl(2048,8,t,e)}function Gm(t,e){return wl(4,2,t,e)}function Qm(t,e){return wl(4,4,t,e)}function Ym(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function Xm(t,e,n){return n=n!=null?n.concat([t]):null,wl(4,4,Ym.bind(null,e,t),n)}function $c(){}function Zm(t,e){var n=Nt();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&zc(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function eg(t,e){var n=Nt();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&zc(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function tg(t,e,n){return xr&21?(zt(n,e)||(n=om(),ae.lanes|=n,Sr|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,nt=!0),t.memoizedState=n)}function X1(t,e){var n=Q;Q=n!==0&&4>n?n:4,t(!0);var r=pa.transition;pa.transition={};try{t(!1),e()}finally{Q=n,pa.transition=r}}function ng(){return Nt().memoizedState}function Z1(t,e,n){var r=Ln(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},rg(t))ig(e,n);else if(n=Bm(t,e,n,r),n!==null){var i=qe();jt(n,t,r,i),sg(n,e,r)}}function ex(t,e,n){var r=Ln(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(rg(t))ig(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,zt(l,o)){var a=e.interleaved;a===null?(i.next=i,Ac(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}n=Bm(t,e,i,r),n!==null&&(i=qe(),jt(n,t,r,i),sg(n,e,r))}}function rg(t){var e=t.alternate;return t===ae||e!==null&&e===ae}function ig(t,e){Hi=qo=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function sg(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,vc(t,n)}}var Go={readContext:Et,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useInsertionEffect:Fe,useLayoutEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useMutableSource:Fe,useSyncExternalStore:Fe,useId:Fe,unstable_isNewReconciler:!1},tx={readContext:Et,useCallback:function(t,e){return _t().memoizedState=[t,e===void 0?null:e],t},useContext:Et,useEffect:Ef,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,wo(4194308,4,Ym.bind(null,e,t),n)},useLayoutEffect:function(t,e){return wo(4194308,4,t,e)},useInsertionEffect:function(t,e){return wo(4,2,t,e)},useMemo:function(t,e){var n=_t();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=_t();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=Z1.bind(null,ae,t),[r.memoizedState,t]},useRef:function(t){var e=_t();return t={current:t},e.memoizedState=t},useState:Cf,useDebugValue:$c,useDeferredValue:function(t){return _t().memoizedState=t},useTransition:function(){var t=Cf(!1),e=t[0];return t=X1.bind(null,t[1]),_t().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=ae,i=_t();if(oe){if(n===void 0)throw Error(P(407));n=n()}else{if(n=e(),Me===null)throw Error(P(349));xr&30||Um(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,Ef(Wm.bind(null,r,s,t),[t]),r.flags|=2048,ms(9,Hm.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=_t(),e=Me.identifierPrefix;if(oe){var n=en,r=Zt;n=(r&~(1<<32-Lt(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=hs++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=Y1++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},nx={readContext:Et,useCallback:Zm,useContext:Et,useEffect:_c,useImperativeHandle:Xm,useInsertionEffect:Gm,useLayoutEffect:Qm,useMemo:eg,useReducer:ma,useRef:qm,useState:function(){return ma(ps)},useDebugValue:$c,useDeferredValue:function(t){var e=Nt();return tg(e,we.memoizedState,t)},useTransition:function(){var t=ma(ps)[0],e=Nt().memoizedState;return[t,e]},useMutableSource:$m,useSyncExternalStore:Vm,useId:ng,unstable_isNewReconciler:!1},rx={readContext:Et,useCallback:Zm,useContext:Et,useEffect:_c,useImperativeHandle:Xm,useInsertionEffect:Gm,useLayoutEffect:Qm,useMemo:eg,useReducer:ga,useRef:qm,useState:function(){return ga(ps)},useDebugValue:$c,useDeferredValue:function(t){var e=Nt();return we===null?e.memoizedState=t:tg(e,we.memoizedState,t)},useTransition:function(){var t=ga(ps)[0],e=Nt().memoizedState;return[t,e]},useMutableSource:$m,useSyncExternalStore:Vm,useId:ng,unstable_isNewReconciler:!1};function Pt(t,e){if(t&&t.defaultProps){e=ue({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function ku(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:ue({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var Cl={isMounted:function(t){return(t=t._reactInternals)?Or(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=qe(),i=Ln(t),s=nn(r,i);s.payload=e,n!=null&&(s.callback=n),e=In(t,s,i),e!==null&&(jt(e,t,i,r),So(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=qe(),i=Ln(t),s=nn(r,i);s.tag=1,s.payload=e,n!=null&&(s.callback=n),e=In(t,s,i),e!==null&&(jt(e,t,i,r),So(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=qe(),r=Ln(t),i=nn(n,r);i.tag=2,e!=null&&(i.callback=e),e=In(t,i,r),e!==null&&(jt(e,t,r,n),So(e,t,r))}};function Nf(t,e,n,r,i,s,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,s,o):e.prototype&&e.prototype.isPureReactComponent?!ls(n,r)||!ls(i,s):!0}function og(t,e,n){var r=!1,i=Vn,s=e.contextType;return typeof s=="object"&&s!==null?s=Et(s):(i=it(e)?yr:Ue.current,r=e.contextTypes,s=(r=r!=null)?oi(t,i):Vn),e=new e(n,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Cl,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=s),e}function bf(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&Cl.enqueueReplaceState(e,e.state,null)}function wu(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs={},Ic(t);var s=e.contextType;typeof s=="object"&&s!==null?i.context=Et(s):(s=it(e)?yr:Ue.current,i.context=oi(t,s)),i.state=t.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(ku(t,e,s,n),i.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&Cl.enqueueReplaceState(i,i.state,null),Ko(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function ci(t,e){try{var n="",r=e;do n+=Pv(r),r=r.return;while(r);var i=n}catch(s){i=`
Error generating stack: `+s.message+`
`+s.stack}return{value:t,source:e,stack:i,digest:null}}function ya(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Cu(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var ix=typeof WeakMap=="function"?WeakMap:Map;function lg(t,e,n){n=nn(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Yo||(Yo=!0,Iu=r),Cu(t,e)},n}function ag(t,e,n){n=nn(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){Cu(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Cu(t,e),typeof r!="function"&&(Rn===null?Rn=new Set([this]):Rn.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function Mf(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new ix;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=vx.bind(null,t,e,n),e.then(t,t))}function Tf(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function Of(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=nn(-1,1),e.tag=2,In(n,e,1))),n.lanes|=1),t)}var sx=dn.ReactCurrentOwner,nt=!1;function Je(t,e,n,r){e.child=t===null?zm(e,null,n,r):ai(e,t.child,n,r)}function Df(t,e,n,r,i){n=n.render;var s=e.ref;return ti(e,i),r=Bc(t,e,n,r,s,i),n=Fc(),t!==null&&!nt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,cn(t,e,i)):(oe&&n&&bc(e),e.flags|=1,Je(t,e,r,i),e.child)}function Pf(t,e,n,r,i){if(t===null){var s=n.type;return typeof s=="function"&&!Gc(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,ug(t,e,s,r,i)):(t=bo(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:ls,n(o,r)&&t.ref===e.ref)return cn(t,e,i)}return e.flags|=1,t=jn(s,r),t.ref=e.ref,t.return=e,e.child=t}function ug(t,e,n,r,i){if(t!==null){var s=t.memoizedProps;if(ls(s,r)&&t.ref===e.ref)if(nt=!1,e.pendingProps=r=s,(t.lanes&i)!==0)t.flags&131072&&(nt=!0);else return e.lanes=t.lanes,cn(t,e,i)}return Eu(t,e,n,r,i)}function cg(t,e,n){var r=e.pendingProps,i=r.children,s=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},ne(qr,lt),lt|=n;else{if(!(n&1073741824))return t=s!==null?s.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,ne(qr,lt),lt|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,ne(qr,lt),lt|=r}else s!==null?(r=s.baseLanes|n,e.memoizedState=null):r=n,ne(qr,lt),lt|=r;return Je(t,e,i,n),e.child}function dg(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Eu(t,e,n,r,i){var s=it(n)?yr:Ue.current;return s=oi(e,s),ti(e,i),n=Bc(t,e,n,r,s,i),r=Fc(),t!==null&&!nt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,cn(t,e,i)):(oe&&r&&bc(e),e.flags|=1,Je(t,e,n,i),e.child)}function Af(t,e,n,r,i){if(it(n)){var s=!0;$o(e)}else s=!1;if(ti(e,i),e.stateNode===null)Co(t,e),og(e,n,r),wu(e,n,r,i),r=!0;else if(t===null){var o=e.stateNode,l=e.memoizedProps;o.props=l;var a=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Et(u):(u=it(n)?yr:Ue.current,u=oi(e,u));var c=n.getDerivedStateFromProps,d=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||a!==u)&&bf(e,o,r,u),yn=!1;var f=e.memoizedState;o.state=f,Ko(e,r,o,i),a=e.memoizedState,l!==r||f!==a||rt.current||yn?(typeof c=="function"&&(ku(e,n,c,r),a=e.memoizedState),(l=yn||Nf(e,n,l,r,f,a,u))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=a),o.props=r,o.state=a,o.context=u,r=l):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,Fm(t,e),l=e.memoizedProps,u=e.type===e.elementType?l:Pt(e.type,l),o.props=u,d=e.pendingProps,f=o.context,a=n.contextType,typeof a=="object"&&a!==null?a=Et(a):(a=it(n)?yr:Ue.current,a=oi(e,a));var h=n.getDerivedStateFromProps;(c=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==d||f!==a)&&bf(e,o,r,a),yn=!1,f=e.memoizedState,o.state=f,Ko(e,r,o,i);var p=e.memoizedState;l!==d||f!==p||rt.current||yn?(typeof h=="function"&&(ku(e,n,h,r),p=e.memoizedState),(u=yn||Nf(e,n,u,r,f,p,a)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,p,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,p,a)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=p),o.props=r,o.state=p,o.context=a,r=u):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return Nu(t,e,n,r,s,i)}function Nu(t,e,n,r,i,s){dg(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return i&&yf(e,n,!1),cn(t,e,s);r=e.stateNode,sx.current=e;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=ai(e,t.child,null,s),e.child=ai(e,null,l,s)):Je(t,e,l,s),e.memoizedState=r.state,i&&yf(e,n,!0),e.child}function fg(t){var e=t.stateNode;e.pendingContext?gf(t,e.pendingContext,e.pendingContext!==e.context):e.context&&gf(t,e.context,!1),Rc(t,e.containerInfo)}function If(t,e,n,r,i){return li(),Tc(i),e.flags|=256,Je(t,e,n,r),e.child}var bu={dehydrated:null,treeContext:null,retryLane:0};function Mu(t){return{baseLanes:t,cachePool:null,transitions:null}}function hg(t,e,n){var r=e.pendingProps,i=le.current,s=!1,o=(e.flags&128)!==0,l;if((l=o)||(l=t!==null&&t.memoizedState===null?!1:(i&2)!==0),l?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),ne(le,i&1),t===null)return xu(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,s?(r=e.mode,s=e.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=bl(o,r,0,null),t=cr(t,r,n,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=Mu(n),e.memoizedState=bu,t):Vc(e,o));if(i=t.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return ox(t,e,o,r,l,i,n);if(s){s=r.fallback,o=e.mode,i=t.child,l=i.sibling;var a={mode:"hidden",children:r.children};return!(o&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=a,e.deletions=null):(r=jn(i,a),r.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=jn(l,s):(s=cr(s,o,n,null),s.flags|=2),s.return=e,r.return=e,r.sibling=s,e.child=r,r=s,s=e.child,o=t.child.memoizedState,o=o===null?Mu(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=t.childLanes&~n,e.memoizedState=bu,r}return s=t.child,t=s.sibling,r=jn(s,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function Vc(t,e){return e=bl({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function to(t,e,n,r){return r!==null&&Tc(r),ai(e,t.child,null,n),t=Vc(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function ox(t,e,n,r,i,s,o){if(n)return e.flags&256?(e.flags&=-257,r=ya(Error(P(422))),to(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=bl({mode:"visible",children:r.children},i,0,null),s=cr(s,i,o,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&ai(e,t.child,null,o),e.child.memoizedState=Mu(o),e.memoizedState=bu,s);if(!(e.mode&1))return to(t,e,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var l=r.dgst;return r=l,s=Error(P(419)),r=ya(s,r,void 0),to(t,e,o,r)}if(l=(o&t.childLanes)!==0,nt||l){if(r=Me,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,un(t,i),jt(r,t,i,-1))}return qc(),r=ya(Error(P(421))),to(t,e,o,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=xx.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,ut=An(i.nextSibling),dt=e,oe=!0,It=null,t!==null&&(yt[vt++]=Zt,yt[vt++]=en,yt[vt++]=vr,Zt=t.id,en=t.overflow,vr=e),e=Vc(e,r.children),e.flags|=4096,e)}function Rf(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),Su(t.return,e,n)}function va(t,e,n,r,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function pg(t,e,n){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(Je(t,e,r.children,n),r=le.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Rf(t,n,e);else if(t.tag===19)Rf(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(ne(le,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&Jo(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),va(e,!1,i,n,s);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&Jo(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}va(e,!0,n,null,s);break;case"together":va(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Co(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function cn(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Sr|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(P(153));if(e.child!==null){for(t=e.child,n=jn(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=jn(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function lx(t,e,n){switch(e.tag){case 3:fg(e),li();break;case 5:_m(e);break;case 1:it(e.type)&&$o(e);break;case 4:Rc(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;ne(Ho,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(ne(le,le.current&1),e.flags|=128,null):n&e.child.childLanes?hg(t,e,n):(ne(le,le.current&1),t=cn(t,e,n),t!==null?t.sibling:null);ne(le,le.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return pg(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ne(le,le.current),r)break;return null;case 22:case 23:return e.lanes=0,cg(t,e,n)}return cn(t,e,n)}var mg,Tu,gg,yg;mg=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Tu=function(){};gg=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,ir(Wt.current);var s=null;switch(n){case"input":i=Qa(t,i),r=Qa(t,r),s=[];break;case"select":i=ue({},i,{value:void 0}),r=ue({},r,{value:void 0}),s=[];break;case"textarea":i=Za(t,i),r=Za(t,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=Fo)}tu(n,r);var o;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var l=i[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Zi.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var a=r[u];if(l=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&a!==l&&(a!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(n||(n={}),n[o]=a[o])}else n||(s||(s=[]),s.push(u,n)),n=a;else u==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(s=s||[]).push(u,a)):u==="children"?typeof a!="string"&&typeof a!="number"||(s=s||[]).push(u,""+a):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Zi.hasOwnProperty(u)?(a!=null&&u==="onScroll"&&re("scroll",t),s||l===a||(s=[])):(s=s||[]).push(u,a))}n&&(s=s||[]).push("style",n);var u=s;(e.updateQueue=u)&&(e.flags|=4)}};yg=function(t,e,n,r){n!==r&&(e.flags|=4)};function Oi(t,e){if(!oe)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function _e(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function ax(t,e,n){var r=e.pendingProps;switch(Mc(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _e(e),null;case 1:return it(e.type)&&_o(),_e(e),null;case 3:return r=e.stateNode,ui(),se(rt),se(Ue),jc(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Zs(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,It!==null&&(ju(It),It=null))),Tu(t,e),_e(e),null;case 5:Lc(e);var i=ir(fs.current);if(n=e.type,t!==null&&e.stateNode!=null)gg(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(P(166));return _e(e),null}if(t=ir(Wt.current),Zs(e)){r=e.stateNode,n=e.type;var s=e.memoizedProps;switch(r[Vt]=e,r[cs]=s,t=(e.mode&1)!==0,n){case"dialog":re("cancel",r),re("close",r);break;case"iframe":case"object":case"embed":re("load",r);break;case"video":case"audio":for(i=0;i<Li.length;i++)re(Li[i],r);break;case"source":re("error",r);break;case"img":case"image":case"link":re("error",r),re("load",r);break;case"details":re("toggle",r);break;case"input":Vd(r,s),re("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},re("invalid",r);break;case"textarea":Hd(r,s),re("invalid",r)}tu(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var l=s[o];o==="children"?typeof l=="string"?r.textContent!==l&&(s.suppressHydrationWarning!==!0&&Xs(r.textContent,l,t),i=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&Xs(r.textContent,l,t),i=["children",""+l]):Zi.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&re("scroll",r)}switch(n){case"input":Hs(r),Ud(r,s,!0);break;case"textarea":Hs(r),Wd(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Fo)}r=i,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Wp(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[Vt]=e,t[cs]=r,mg(t,e,!1,!1),e.stateNode=t;e:{switch(o=nu(n,r),n){case"dialog":re("cancel",t),re("close",t),i=r;break;case"iframe":case"object":case"embed":re("load",t),i=r;break;case"video":case"audio":for(i=0;i<Li.length;i++)re(Li[i],t);i=r;break;case"source":re("error",t),i=r;break;case"img":case"image":case"link":re("error",t),re("load",t),i=r;break;case"details":re("toggle",t),i=r;break;case"input":Vd(t,r),i=Qa(t,r),re("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=ue({},r,{value:void 0}),re("invalid",t);break;case"textarea":Hd(t,r),i=Za(t,r),re("invalid",t);break;default:i=r}tu(n,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var a=l[s];s==="style"?qp(t,a):s==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&Kp(t,a)):s==="children"?typeof a=="string"?(n!=="textarea"||a!=="")&&es(t,a):typeof a=="number"&&es(t,""+a):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Zi.hasOwnProperty(s)?a!=null&&s==="onScroll"&&re("scroll",t):a!=null&&fc(t,s,a,o))}switch(n){case"input":Hs(t),Ud(t,r,!1);break;case"textarea":Hs(t),Wd(t);break;case"option":r.value!=null&&t.setAttribute("value",""+$n(r.value));break;case"select":t.multiple=!!r.multiple,s=r.value,s!=null?Yr(t,!!r.multiple,s,!1):r.defaultValue!=null&&Yr(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=Fo)}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&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return _e(e),null;case 6:if(t&&e.stateNode!=null)yg(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(P(166));if(n=ir(fs.current),ir(Wt.current),Zs(e)){if(r=e.stateNode,n=e.memoizedProps,r[Vt]=e,(s=r.nodeValue!==n)&&(t=dt,t!==null))switch(t.tag){case 3:Xs(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Xs(r.nodeValue,n,(t.mode&1)!==0)}s&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Vt]=e,e.stateNode=r}return _e(e),null;case 13:if(se(le),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(oe&&ut!==null&&e.mode&1&&!(e.flags&128))Lm(),li(),e.flags|=98560,s=!1;else if(s=Zs(e),r!==null&&r.dehydrated!==null){if(t===null){if(!s)throw Error(P(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(P(317));s[Vt]=e}else li(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;_e(e),s=!1}else It!==null&&(ju(It),It=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||le.current&1?Ce===0&&(Ce=3):qc())),e.updateQueue!==null&&(e.flags|=4),_e(e),null);case 4:return ui(),Tu(t,e),t===null&&as(e.stateNode.containerInfo),_e(e),null;case 10:return Pc(e.type._context),_e(e),null;case 17:return it(e.type)&&_o(),_e(e),null;case 19:if(se(le),s=e.memoizedState,s===null)return _e(e),null;if(r=(e.flags&128)!==0,o=s.rendering,o===null)if(r)Oi(s,!1);else{if(Ce!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=Jo(t),o!==null){for(e.flags|=128,Oi(s,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)s=n,t=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=t,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,t=o.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return ne(le,le.current&1|2),e.child}t=t.sibling}s.tail!==null&&fe()>di&&(e.flags|=128,r=!0,Oi(s,!1),e.lanes=4194304)}else{if(!r)if(t=Jo(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Oi(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!oe)return _e(e),null}else 2*fe()-s.renderingStartTime>di&&n!==1073741824&&(e.flags|=128,r=!0,Oi(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=fe(),e.sibling=null,n=le.current,ne(le,r?n&1|2:n&1),e):(_e(e),null);case 22:case 23:return Jc(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?lt&1073741824&&(_e(e),e.subtreeFlags&6&&(e.flags|=8192)):_e(e),null;case 24:return null;case 25:return null}throw Error(P(156,e.tag))}function ux(t,e){switch(Mc(e),e.tag){case 1:return it(e.type)&&_o(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return ui(),se(rt),se(Ue),jc(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Lc(e),null;case 13:if(se(le),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(P(340));li()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return se(le),null;case 4:return ui(),null;case 10:return Pc(e.type._context),null;case 22:case 23:return Jc(),null;case 24:return null;default:return null}}var no=!1,Ve=!1,cx=typeof WeakSet=="function"?WeakSet:Set,R=null;function Jr(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ce(t,e,r)}else n.current=null}function Ou(t,e,n){try{n()}catch(r){ce(t,e,r)}}var Lf=!1;function dx(t,e){if(fu=jo,t=wm(),Nc(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,a=-1,u=0,c=0,d=t,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(l=o+i),d!==s||r!==0&&d.nodeType!==3||(a=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===t)break t;if(f===n&&++u===i&&(l=o),f===s&&++c===r&&(a=o),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(hu={focusedElem:t,selectionRange:n},jo=!1,R=e;R!==null;)if(e=R,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,R=t;else for(;R!==null;){e=R;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,x=p.memoizedState,g=e.stateNode,v=g.getSnapshotBeforeUpdate(e.elementType===e.type?m:Pt(e.type,m),x);g.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(P(163))}}catch(w){ce(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,R=t;break}R=e.return}return p=Lf,Lf=!1,p}function Wi(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&Ou(e,n,s)}i=i.next}while(i!==r)}}function El(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Du(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function vg(t){var e=t.alternate;e!==null&&(t.alternate=null,vg(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Vt],delete e[cs],delete e[gu],delete e[J1],delete e[q1])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function xg(t){return t.tag===5||t.tag===3||t.tag===4}function jf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||xg(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Pu(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Fo));else if(r!==4&&(t=t.child,t!==null))for(Pu(t,e,n),t=t.sibling;t!==null;)Pu(t,e,n),t=t.sibling}function Au(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Au(t,e,n),t=t.sibling;t!==null;)Au(t,e,n),t=t.sibling}var Ae=null,At=!1;function pn(t,e,n){for(n=n.child;n!==null;)Sg(t,e,n),n=n.sibling}function Sg(t,e,n){if(Ht&&typeof Ht.onCommitFiberUnmount=="function")try{Ht.onCommitFiberUnmount(gl,n)}catch{}switch(n.tag){case 5:Ve||Jr(n,e);case 6:var r=Ae,i=At;Ae=null,pn(t,e,n),Ae=r,At=i,Ae!==null&&(At?(t=Ae,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Ae.removeChild(n.stateNode));break;case 18:Ae!==null&&(At?(t=Ae,n=n.stateNode,t.nodeType===8?da(t.parentNode,n):t.nodeType===1&&da(t,n),is(t)):da(Ae,n.stateNode));break;case 4:r=Ae,i=At,Ae=n.stateNode.containerInfo,At=!0,pn(t,e,n),Ae=r,At=i;break;case 0:case 11:case 14:case 15:if(!Ve&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Ou(n,e,o),i=i.next}while(i!==r)}pn(t,e,n);break;case 1:if(!Ve&&(Jr(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){ce(n,e,l)}pn(t,e,n);break;case 21:pn(t,e,n);break;case 22:n.mode&1?(Ve=(r=Ve)||n.memoizedState!==null,pn(t,e,n),Ve=r):pn(t,e,n);break;default:pn(t,e,n)}}function zf(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new cx),e.forEach(function(r){var i=Sx.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Dt(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=t,o=e,l=o;e:for(;l!==null;){switch(l.tag){case 5:Ae=l.stateNode,At=!1;break e;case 3:Ae=l.stateNode.containerInfo,At=!0;break e;case 4:Ae=l.stateNode.containerInfo,At=!0;break e}l=l.return}if(Ae===null)throw Error(P(160));Sg(s,o,i),Ae=null,At=!1;var a=i.alternate;a!==null&&(a.return=null),i.return=null}catch(u){ce(i,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)kg(e,t),e=e.sibling}function kg(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Dt(e,t),Ft(t),r&4){try{Wi(3,t,t.return),El(3,t)}catch(m){ce(t,t.return,m)}try{Wi(5,t,t.return)}catch(m){ce(t,t.return,m)}}break;case 1:Dt(e,t),Ft(t),r&512&&n!==null&&Jr(n,n.return);break;case 5:if(Dt(e,t),Ft(t),r&512&&n!==null&&Jr(n,n.return),t.flags&32){var i=t.stateNode;try{es(i,"")}catch(m){ce(t,t.return,m)}}if(r&4&&(i=t.stateNode,i!=null)){var s=t.memoizedProps,o=n!==null?n.memoizedProps:s,l=t.type,a=t.updateQueue;if(t.updateQueue=null,a!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&Up(i,s),nu(l,o);var u=nu(l,s);for(o=0;o<a.length;o+=2){var c=a[o],d=a[o+1];c==="style"?qp(i,d):c==="dangerouslySetInnerHTML"?Kp(i,d):c==="children"?es(i,d):fc(i,c,d,u)}switch(l){case"input":Ya(i,s);break;case"textarea":Hp(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var h=s.value;h!=null?Yr(i,!!s.multiple,h,!1):f!==!!s.multiple&&(s.defaultValue!=null?Yr(i,!!s.multiple,s.defaultValue,!0):Yr(i,!!s.multiple,s.multiple?[]:"",!1))}i[cs]=s}catch(m){ce(t,t.return,m)}}break;case 6:if(Dt(e,t),Ft(t),r&4){if(t.stateNode===null)throw Error(P(162));i=t.stateNode,s=t.memoizedProps;try{i.nodeValue=s}catch(m){ce(t,t.return,m)}}break;case 3:if(Dt(e,t),Ft(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{is(e.containerInfo)}catch(m){ce(t,t.return,m)}break;case 4:Dt(e,t),Ft(t);break;case 13:Dt(e,t),Ft(t),i=t.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Wc=fe())),r&4&&zf(t);break;case 22:if(c=n!==null&&n.memoizedState!==null,t.mode&1?(Ve=(u=Ve)||c,Dt(e,t),Ve=u):Dt(e,t),Ft(t),r&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!c&&t.mode&1)for(R=t,c=t.child;c!==null;){for(d=R=c;R!==null;){switch(f=R,h=f.child,f.tag){case 0:case 11:case 14:case 15:Wi(4,f,f.return);break;case 1:Jr(f,f.return);var p=f.stateNode;if(typeof p.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,p.props=e.memoizedProps,p.state=e.memoizedState,p.componentWillUnmount()}catch(m){ce(r,n,m)}}break;case 5:Jr(f,f.return);break;case 22:if(f.memoizedState!==null){Ff(d);continue}}h!==null?(h.return=f,R=h):Ff(d)}c=c.sibling}e:for(c=null,d=t;;){if(d.tag===5){if(c===null){c=d;try{i=d.stateNode,u?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=d.stateNode,a=d.memoizedProps.style,o=a!=null&&a.hasOwnProperty("display")?a.display:null,l.style.display=Jp("display",o))}catch(m){ce(t,t.return,m)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(m){ce(t,t.return,m)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===t)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Dt(e,t),Ft(t),r&4&&zf(t);break;case 21:break;default:Dt(e,t),Ft(t)}}function Ft(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(xg(n)){var r=n;break e}n=n.return}throw Error(P(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(es(i,""),r.flags&=-33);var s=jf(t);Au(t,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,l=jf(t);Pu(t,l,o);break;default:throw Error(P(161))}}catch(a){ce(t,t.return,a)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function fx(t,e,n){R=t,wg(t)}function wg(t,e,n){for(var r=(t.mode&1)!==0;R!==null;){var i=R,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||no;if(!o){var l=i.alternate,a=l!==null&&l.memoizedState!==null||Ve;l=no;var u=Ve;if(no=o,(Ve=a)&&!u)for(R=i;R!==null;)o=R,a=o.child,o.tag===22&&o.memoizedState!==null?_f(i):a!==null?(a.return=o,R=a):_f(i);for(;s!==null;)R=s,wg(s),s=s.sibling;R=i,no=l,Ve=u}Bf(t)}else i.subtreeFlags&8772&&s!==null?(s.return=i,R=s):Bf(t)}}function Bf(t){for(;R!==null;){var e=R;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Ve||El(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!Ve)if(n===null)r.componentDidMount();else{var i=e.elementType===e.type?n.memoizedProps:Pt(e.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&wf(e,s,r);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}wf(e,o,n)}break;case 5:var l=e.stateNode;if(n===null&&e.flags&4){n=l;var a=e.memoizedProps;switch(e.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(e.memoizedState===null){var u=e.alternate;if(u!==null){var c=u.memoizedState;if(c!==null){var d=c.dehydrated;d!==null&&is(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(P(163))}Ve||e.flags&512&&Du(e)}catch(f){ce(e,e.return,f)}}if(e===t){R=null;break}if(n=e.sibling,n!==null){n.return=e.return,R=n;break}R=e.return}}function Ff(t){for(;R!==null;){var e=R;if(e===t){R=null;break}var n=e.sibling;if(n!==null){n.return=e.return,R=n;break}R=e.return}}function _f(t){for(;R!==null;){var e=R;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{El(4,e)}catch(a){ce(e,n,a)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(a){ce(e,i,a)}}var s=e.return;try{Du(e)}catch(a){ce(e,s,a)}break;case 5:var o=e.return;try{Du(e)}catch(a){ce(e,o,a)}}}catch(a){ce(e,e.return,a)}if(e===t){R=null;break}var l=e.sibling;if(l!==null){l.return=e.return,R=l;break}R=e.return}}var hx=Math.ceil,Qo=dn.ReactCurrentDispatcher,Uc=dn.ReactCurrentOwner,kt=dn.ReactCurrentBatchConfig,q=0,Me=null,ye=null,ze=0,lt=0,qr=Wn(0),Ce=0,gs=null,Sr=0,Nl=0,Hc=0,Ki=null,tt=null,Wc=0,di=1/0,Qt=null,Yo=!1,Iu=null,Rn=null,ro=!1,En=null,Xo=0,Ji=0,Ru=null,Eo=-1,No=0;function qe(){return q&6?fe():Eo!==-1?Eo:Eo=fe()}function Ln(t){return t.mode&1?q&2&&ze!==0?ze&-ze:Q1.transition!==null?(No===0&&(No=om()),No):(t=Q,t!==0||(t=window.event,t=t===void 0?16:hm(t.type)),t):1}function jt(t,e,n,r){if(50<Ji)throw Ji=0,Ru=null,Error(P(185));Ps(t,n,r),(!(q&2)||t!==Me)&&(t===Me&&(!(q&2)&&(Nl|=n),Ce===4&&kn(t,ze)),st(t,r),n===1&&q===0&&!(e.mode&1)&&(di=fe()+500,kl&&Kn()))}function st(t,e){var n=t.callbackNode;Qv(t,e);var r=Lo(t,t===Me?ze:0);if(r===0)n!==null&&qd(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&qd(n),e===1)t.tag===0?G1($f.bind(null,t)):Am($f.bind(null,t)),W1(function(){!(q&6)&&Kn()}),n=null;else{switch(lm(r)){case 1:n=yc;break;case 4:n=im;break;case 16:n=Ro;break;case 536870912:n=sm;break;default:n=Ro}n=Dg(n,Cg.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function Cg(t,e){if(Eo=-1,No=0,q&6)throw Error(P(327));var n=t.callbackNode;if(ni()&&t.callbackNode!==n)return null;var r=Lo(t,t===Me?ze:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Zo(t,r);else{e=r;var i=q;q|=2;var s=Ng();(Me!==t||ze!==e)&&(Qt=null,di=fe()+500,ur(t,e));do try{gx();break}catch(l){Eg(t,l)}while(!0);Dc(),Qo.current=s,q=i,ye!==null?e=0:(Me=null,ze=0,e=Ce)}if(e!==0){if(e===2&&(i=lu(t),i!==0&&(r=i,e=Lu(t,i))),e===1)throw n=gs,ur(t,0),kn(t,r),st(t,fe()),n;if(e===6)kn(t,r);else{if(i=t.current.alternate,!(r&30)&&!px(i)&&(e=Zo(t,r),e===2&&(s=lu(t),s!==0&&(r=s,e=Lu(t,s))),e===1))throw n=gs,ur(t,0),kn(t,r),st(t,fe()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(P(345));case 2:Zn(t,tt,Qt);break;case 3:if(kn(t,r),(r&130023424)===r&&(e=Wc+500-fe(),10<e)){if(Lo(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){qe(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=mu(Zn.bind(null,t,tt,Qt),e);break}Zn(t,tt,Qt);break;case 4:if(kn(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var o=31-Lt(r);s=1<<o,o=e[o],o>i&&(i=o),r&=~s}if(r=i,r=fe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*hx(r/1960))-r,10<r){t.timeoutHandle=mu(Zn.bind(null,t,tt,Qt),r);break}Zn(t,tt,Qt);break;case 5:Zn(t,tt,Qt);break;default:throw Error(P(329))}}}return st(t,fe()),t.callbackNode===n?Cg.bind(null,t):null}function Lu(t,e){var n=Ki;return t.current.memoizedState.isDehydrated&&(ur(t,e).flags|=256),t=Zo(t,e),t!==2&&(e=tt,tt=n,e!==null&&ju(e)),t}function ju(t){tt===null?tt=t:tt.push.apply(tt,t)}function px(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!zt(s(),i))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function kn(t,e){for(e&=~Hc,e&=~Nl,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Lt(e),r=1<<n;t[n]=-1,e&=~r}}function $f(t){if(q&6)throw Error(P(327));ni();var e=Lo(t,0);if(!(e&1))return st(t,fe()),null;var n=Zo(t,e);if(t.tag!==0&&n===2){var r=lu(t);r!==0&&(e=r,n=Lu(t,r))}if(n===1)throw n=gs,ur(t,0),kn(t,e),st(t,fe()),n;if(n===6)throw Error(P(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Zn(t,tt,Qt),st(t,fe()),null}function Kc(t,e){var n=q;q|=1;try{return t(e)}finally{q=n,q===0&&(di=fe()+500,kl&&Kn())}}function kr(t){En!==null&&En.tag===0&&!(q&6)&&ni();var e=q;q|=1;var n=kt.transition,r=Q;try{if(kt.transition=null,Q=1,t)return t()}finally{Q=r,kt.transition=n,q=e,!(q&6)&&Kn()}}function Jc(){lt=qr.current,se(qr)}function ur(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,H1(n)),ye!==null)for(n=ye.return;n!==null;){var r=n;switch(Mc(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&_o();break;case 3:ui(),se(rt),se(Ue),jc();break;case 5:Lc(r);break;case 4:ui();break;case 13:se(le);break;case 19:se(le);break;case 10:Pc(r.type._context);break;case 22:case 23:Jc()}n=n.return}if(Me=t,ye=t=jn(t.current,null),ze=lt=e,Ce=0,gs=null,Hc=Nl=Sr=0,tt=Ki=null,rr!==null){for(e=0;e<rr.length;e++)if(n=rr[e],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}rr=null}return t}function Eg(t,e){do{var n=ye;try{if(Dc(),ko.current=Go,qo){for(var r=ae.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}qo=!1}if(xr=0,Ne=we=ae=null,Hi=!1,hs=0,Uc.current=null,n===null||n.return===null){Ce=1,gs=e,ye=null;break}e:{var s=t,o=n.return,l=n,a=e;if(e=ze,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 h=Tf(o);if(h!==null){h.flags&=-257,Of(h,o,l,s,e),h.mode&1&&Mf(s,u,e),e=h,a=u;var p=e.updateQueue;if(p===null){var m=new Set;m.add(a),e.updateQueue=m}else p.add(a);break e}else{if(!(e&1)){Mf(s,u,e),qc();break e}a=Error(P(426))}}else if(oe&&l.mode&1){var x=Tf(o);if(x!==null){!(x.flags&65536)&&(x.flags|=256),Of(x,o,l,s,e),Tc(ci(a,l));break e}}s=a=ci(a,l),Ce!==4&&(Ce=2),Ki===null?Ki=[s]:Ki.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var g=lg(s,a,e);kf(s,g);break e;case 1:l=a;var v=s.type,S=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(Rn===null||!Rn.has(S)))){s.flags|=65536,e&=-e,s.lanes|=e;var w=ag(s,l,e);kf(s,w);break e}}s=s.return}while(s!==null)}Mg(n)}catch(E){e=E,ye===n&&n!==null&&(ye=n=n.return);continue}break}while(!0)}function Ng(){var t=Qo.current;return Qo.current=Go,t===null?Go:t}function qc(){(Ce===0||Ce===3||Ce===2)&&(Ce=4),Me===null||!(Sr&268435455)&&!(Nl&268435455)||kn(Me,ze)}function Zo(t,e){var n=q;q|=2;var r=Ng();(Me!==t||ze!==e)&&(Qt=null,ur(t,e));do try{mx();break}catch(i){Eg(t,i)}while(!0);if(Dc(),q=n,Qo.current=r,ye!==null)throw Error(P(261));return Me=null,ze=0,Ce}function mx(){for(;ye!==null;)bg(ye)}function gx(){for(;ye!==null&&!$v();)bg(ye)}function bg(t){var e=Og(t.alternate,t,lt);t.memoizedProps=t.pendingProps,e===null?Mg(t):ye=e,Uc.current=null}function Mg(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=ux(n,e),n!==null){n.flags&=32767,ye=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Ce=6,ye=null;return}}else if(n=ax(n,e,lt),n!==null){ye=n;return}if(e=e.sibling,e!==null){ye=e;return}ye=e=t}while(e!==null);Ce===0&&(Ce=5)}function Zn(t,e,n){var r=Q,i=kt.transition;try{kt.transition=null,Q=1,yx(t,e,n,r)}finally{kt.transition=i,Q=r}return null}function yx(t,e,n,r){do ni();while(En!==null);if(q&6)throw Error(P(327));n=t.finishedWork;var i=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(P(177));t.callbackNode=null,t.callbackPriority=0;var s=n.lanes|n.childLanes;if(Yv(t,s),t===Me&&(ye=Me=null,ze=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ro||(ro=!0,Dg(Ro,function(){return ni(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=kt.transition,kt.transition=null;var o=Q;Q=1;var l=q;q|=4,Uc.current=null,dx(t,n),kg(n,t),z1(hu),jo=!!fu,hu=fu=null,t.current=n,fx(n),Vv(),q=l,Q=o,kt.transition=s}else t.current=n;if(ro&&(ro=!1,En=t,Xo=i),s=t.pendingLanes,s===0&&(Rn=null),Wv(n.stateNode),st(t,fe()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)i=e[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Yo)throw Yo=!1,t=Iu,Iu=null,t;return Xo&1&&t.tag!==0&&ni(),s=t.pendingLanes,s&1?t===Ru?Ji++:(Ji=0,Ru=t):Ji=0,Kn(),null}function ni(){if(En!==null){var t=lm(Xo),e=kt.transition,n=Q;try{if(kt.transition=null,Q=16>t?16:t,En===null)var r=!1;else{if(t=En,En=null,Xo=0,q&6)throw Error(P(331));var i=q;for(q|=4,R=t.current;R!==null;){var s=R,o=s.child;if(R.flags&16){var l=s.deletions;if(l!==null){for(var a=0;a<l.length;a++){var u=l[a];for(R=u;R!==null;){var c=R;switch(c.tag){case 0:case 11:case 15:Wi(8,c,s)}var d=c.child;if(d!==null)d.return=c,R=d;else for(;R!==null;){c=R;var f=c.sibling,h=c.return;if(vg(c),c===u){R=null;break}if(f!==null){f.return=h,R=f;break}R=h}}}var p=s.alternate;if(p!==null){var m=p.child;if(m!==null){p.child=null;do{var x=m.sibling;m.sibling=null,m=x}while(m!==null)}}R=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,R=o;else e:for(;R!==null;){if(s=R,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Wi(9,s,s.return)}var g=s.sibling;if(g!==null){g.return=s.return,R=g;break e}R=s.return}}var v=t.current;for(R=v;R!==null;){o=R;var S=o.child;if(o.subtreeFlags&2064&&S!==null)S.return=o,R=S;else e:for(o=v;R!==null;){if(l=R,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:El(9,l)}}catch(E){ce(l,l.return,E)}if(l===o){R=null;break e}var w=l.sibling;if(w!==null){w.return=l.return,R=w;break e}R=l.return}}if(q=i,Kn(),Ht&&typeof Ht.onPostCommitFiberRoot=="function")try{Ht.onPostCommitFiberRoot(gl,t)}catch{}r=!0}return r}finally{Q=n,kt.transition=e}}return!1}function Vf(t,e,n){e=ci(n,e),e=lg(t,e,1),t=In(t,e,1),e=qe(),t!==null&&(Ps(t,1,e),st(t,e))}function ce(t,e,n){if(t.tag===3)Vf(t,t,n);else for(;e!==null;){if(e.tag===3){Vf(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Rn===null||!Rn.has(r))){t=ci(n,t),t=ag(e,t,1),e=In(e,t,1),t=qe(),e!==null&&(Ps(e,1,t),st(e,t));break}}e=e.return}}function vx(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=qe(),t.pingedLanes|=t.suspendedLanes&n,Me===t&&(ze&n)===n&&(Ce===4||Ce===3&&(ze&130023424)===ze&&500>fe()-Wc?ur(t,0):Hc|=n),st(t,e)}function Tg(t,e){e===0&&(t.mode&1?(e=Js,Js<<=1,!(Js&130023424)&&(Js=4194304)):e=1);var n=qe();t=un(t,e),t!==null&&(Ps(t,e,n),st(t,n))}function xx(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Tg(t,n)}function Sx(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(P(314))}r!==null&&r.delete(e),Tg(t,n)}var Og;Og=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||rt.current)nt=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return nt=!1,lx(t,e,n);nt=!!(t.flags&131072)}else nt=!1,oe&&e.flags&1048576&&Im(e,Uo,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Co(t,e),t=e.pendingProps;var i=oi(e,Ue.current);ti(e,n),i=Bc(null,e,r,t,i,n);var s=Fc();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,it(r)?(s=!0,$o(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Ic(e),i.updater=Cl,e.stateNode=i,i._reactInternals=e,wu(e,r,t,n),e=Nu(null,e,r,!0,s,n)):(e.tag=0,oe&&s&&bc(e),Je(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Co(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=wx(r),t=Pt(r,t),i){case 0:e=Eu(null,e,r,t,n);break e;case 1:e=Af(null,e,r,t,n);break e;case 11:e=Df(null,e,r,t,n);break e;case 14:e=Pf(null,e,r,Pt(r.type,t),n);break e}throw Error(P(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Pt(r,i),Eu(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Pt(r,i),Af(t,e,r,i,n);case 3:e:{if(fg(e),t===null)throw Error(P(387));r=e.pendingProps,s=e.memoizedState,i=s.element,Fm(t,e),Ko(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=ci(Error(P(423)),e),e=If(t,e,r,n,i);break e}else if(r!==i){i=ci(Error(P(424)),e),e=If(t,e,r,n,i);break e}else for(ut=An(e.stateNode.containerInfo.firstChild),dt=e,oe=!0,It=null,n=zm(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(li(),r===i){e=cn(t,e,n);break e}Je(t,e,r,n)}e=e.child}return e;case 5:return _m(e),t===null&&xu(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,pu(r,i)?o=null:s!==null&&pu(r,s)&&(e.flags|=32),dg(t,e),Je(t,e,o,n),e.child;case 6:return t===null&&xu(e),null;case 13:return hg(t,e,n);case 4:return Rc(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=ai(e,null,r,n):Je(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Pt(r,i),Df(t,e,r,i,n);case 7:return Je(t,e,e.pendingProps,n),e.child;case 8:return Je(t,e,e.pendingProps.children,n),e.child;case 12:return Je(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,ne(Ho,r._currentValue),r._currentValue=o,s!==null)if(zt(s.value,o)){if(s.children===i.children&&!rt.current){e=cn(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(s.tag===1){a=nn(-1,n&-n),a.tag=2;var u=s.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}}s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Su(s.return,n,e),l.lanes|=n;break}a=a.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(P(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Su(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Je(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,ti(e,n),i=Et(i),r=r(i),e.flags|=1,Je(t,e,r,n),e.child;case 14:return r=e.type,i=Pt(r,e.pendingProps),i=Pt(r.type,i),Pf(t,e,r,i,n);case 15:return ug(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Pt(r,i),Co(t,e),e.tag=1,it(r)?(t=!0,$o(e)):t=!1,ti(e,n),og(e,r,i),wu(e,r,i,n),Nu(null,e,r,!0,t,n);case 19:return pg(t,e,n);case 22:return cg(t,e,n)}throw Error(P(156,e.tag))};function Dg(t,e){return rm(t,e)}function kx(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,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 St(t,e,n,r){return new kx(t,e,n,r)}function Gc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function wx(t){if(typeof t=="function")return Gc(t)?1:0;if(t!=null){if(t=t.$$typeof,t===pc)return 11;if(t===mc)return 14}return 2}function jn(t,e){var n=t.alternate;return n===null?(n=St(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function bo(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")Gc(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Br:return cr(n.children,i,s,e);case hc:o=8,i|=8;break;case Ka:return t=St(12,n,e,i|2),t.elementType=Ka,t.lanes=s,t;case Ja:return t=St(13,n,e,i),t.elementType=Ja,t.lanes=s,t;case qa:return t=St(19,n,e,i),t.elementType=qa,t.lanes=s,t;case _p:return bl(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Bp:o=10;break e;case Fp:o=9;break e;case pc:o=11;break e;case mc:o=14;break e;case gn:o=16,r=null;break e}throw Error(P(130,t==null?t:typeof t,""))}return e=St(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function cr(t,e,n,r){return t=St(7,t,r,e),t.lanes=n,t}function bl(t,e,n,r){return t=St(22,t,r,e),t.elementType=_p,t.lanes=n,t.stateNode={isHidden:!1},t}function xa(t,e,n){return t=St(6,t,null,e),t.lanes=n,t}function Sa(t,e,n){return e=St(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Cx(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ea(0),this.expirationTimes=ea(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ea(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Qc(t,e,n,r,i,s,o,l,a){return t=new Cx(t,e,n,l,a),e===1?(e=1,s===!0&&(e|=8)):e=0,s=St(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ic(s),t}function Ex(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:zr,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function Pg(t){if(!t)return Vn;t=t._reactInternals;e:{if(Or(t)!==t||t.tag!==1)throw Error(P(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(it(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(P(171))}if(t.tag===1){var n=t.type;if(it(n))return Pm(t,n,e)}return e}function Ag(t,e,n,r,i,s,o,l,a){return t=Qc(n,r,!0,t,i,s,o,l,a),t.context=Pg(null),n=t.current,r=qe(),i=Ln(n),s=nn(r,i),s.callback=e??null,In(n,s,i),t.current.lanes=i,Ps(t,i,r),st(t,r),t}function Ml(t,e,n,r){var i=e.current,s=qe(),o=Ln(i);return n=Pg(n),e.context===null?e.context=n:e.pendingContext=n,e=nn(s,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=In(i,e,o),t!==null&&(jt(t,i,o,s),So(t,i,o)),o}function el(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Uf(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Yc(t,e){Uf(t,e),(t=t.alternate)&&Uf(t,e)}function Nx(){return null}var Ig=typeof reportError=="function"?reportError:function(t){console.error(t)};function Xc(t){this._internalRoot=t}Tl.prototype.render=Xc.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(P(409));Ml(t,e,null,null)};Tl.prototype.unmount=Xc.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;kr(function(){Ml(null,t,null,null)}),e[an]=null}};function Tl(t){this._internalRoot=t}Tl.prototype.unstable_scheduleHydration=function(t){if(t){var e=cm();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Sn.length&&e!==0&&e<Sn[n].priority;n++);Sn.splice(n,0,t),n===0&&fm(t)}};function Zc(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Ol(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Hf(){}function bx(t,e,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var u=el(o);s.call(u)}}var o=Ag(e,r,t,0,null,!1,!1,"",Hf);return t._reactRootContainer=o,t[an]=o.current,as(t.nodeType===8?t.parentNode:t),kr(),o}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var l=r;r=function(){var u=el(a);l.call(u)}}var a=Qc(t,0,!1,null,null,!1,!1,"",Hf);return t._reactRootContainer=a,t[an]=a.current,as(t.nodeType===8?t.parentNode:t),kr(function(){Ml(e,a,n,r)}),a}function Dl(t,e,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var l=i;i=function(){var a=el(o);l.call(a)}}Ml(e,o,t,i)}else o=bx(n,e,t,i,r);return el(o)}am=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Ri(e.pendingLanes);n!==0&&(vc(e,n|1),st(e,fe()),!(q&6)&&(di=fe()+500,Kn()))}break;case 13:kr(function(){var r=un(t,1);if(r!==null){var i=qe();jt(r,t,1,i)}}),Yc(t,1)}};xc=function(t){if(t.tag===13){var e=un(t,134217728);if(e!==null){var n=qe();jt(e,t,134217728,n)}Yc(t,134217728)}};um=function(t){if(t.tag===13){var e=Ln(t),n=un(t,e);if(n!==null){var r=qe();jt(n,t,e,r)}Yc(t,e)}};cm=function(){return Q};dm=function(t,e){var n=Q;try{return Q=t,e()}finally{Q=n}};iu=function(t,e,n){switch(e){case"input":if(Ya(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=Sl(r);if(!i)throw Error(P(90));Vp(r),Ya(r,i)}}}break;case"textarea":Hp(t,n);break;case"select":e=n.value,e!=null&&Yr(t,!!n.multiple,e,!1)}};Yp=Kc;Xp=kr;var Mx={usingClientEntryPoint:!1,Events:[Is,Vr,Sl,Gp,Qp,Kc]},Di={findFiberByHostInstance:nr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Tx={bundleType:Di.bundleType,version:Di.version,rendererPackageName:Di.rendererPackageName,rendererConfig:Di.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:dn.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=tm(t),t===null?null:t.stateNode},findFiberByHostInstance:Di.findFiberByHostInstance||Nx,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 io=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!io.isDisabled&&io.supportsFiber)try{gl=io.inject(Tx),Ht=io}catch{}}pt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Mx;pt.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Zc(e))throw Error(P(200));return Ex(t,e,null,n)};pt.createRoot=function(t,e){if(!Zc(t))throw Error(P(299));var n=!1,r="",i=Ig;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=Qc(t,1,!1,null,null,n,!1,r,i),t[an]=e.current,as(t.nodeType===8?t.parentNode:t),new Xc(e)};pt.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(P(188)):(t=Object.keys(t).join(","),Error(P(268,t)));return t=tm(e),t=t===null?null:t.stateNode,t};pt.flushSync=function(t){return kr(t)};pt.hydrate=function(t,e,n){if(!Ol(e))throw Error(P(200));return Dl(null,t,e,!0,n)};pt.hydrateRoot=function(t,e,n){if(!Zc(t))throw Error(P(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=Ig;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=Ag(e,null,t,1,n??null,i,!1,s,o),t[an]=e.current,as(t),r)for(t=0;t<r.length;t++)n=r[t],i=n._getVersion,i=i(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,i]:e.mutableSourceEagerHydrationData.push(n,i);return new Tl(e)};pt.render=function(t,e,n){if(!Ol(e))throw Error(P(200));return Dl(null,t,e,!1,n)};pt.unmountComponentAtNode=function(t){if(!Ol(t))throw Error(P(40));return t._reactRootContainer?(kr(function(){Dl(null,null,t,!1,function(){t._reactRootContainer=null,t[an]=null})}),!0):!1};pt.unstable_batchedUpdates=Kc;pt.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!Ol(n))throw Error(P(200));if(t==null||t._reactInternals===void 0)throw Error(P(38));return Dl(t,e,n,!1,r)};pt.version="18.3.1-next-f1338f8080-20240426";function Rg(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Rg)}catch(t){console.error(t)}}Rg(),Rp.exports=pt;var Pl=Rp.exports;const Ox=wp(Pl);var Wf=Pl;Ha.createRoot=Wf.createRoot,Ha.hydrateRoot=Wf.hydrateRoot;/**
* @remix-run/router v1.23.2
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function ys(){return ys=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ys.apply(this,arguments)}var Nn;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Nn||(Nn={}));const Kf="popstate";function Dx(t){t===void 0&&(t={});function e(r,i){let{pathname:s,search:o,hash:l}=r.location;return zu("",{pathname:s,search:o,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:Lg(i)}return Ax(e,n,null,t)}function xe(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function ed(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Px(){return Math.random().toString(36).substr(2,8)}function Jf(t,e){return{usr:t.state,key:t.key,idx:e}}function zu(t,e,n,r){return n===void 0&&(n=null),ys({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?xi(e):e,{state:n,key:e&&e.key||r||Px()})}function Lg(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function xi(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function Ax(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,l=Nn.Pop,a=null,u=c();u==null&&(u=0,o.replaceState(ys({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function d(){l=Nn.Pop;let x=c(),g=x==null?null:x-u;u=x,a&&a({action:l,location:m.location,delta:g})}function f(x,g){l=Nn.Push;let v=zu(m.location,x,g);u=c()+1;let S=Jf(v,u),w=m.createHref(v);try{o.pushState(S,"",w)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;i.location.assign(w)}s&&a&&a({action:l,location:m.location,delta:1})}function h(x,g){l=Nn.Replace;let v=zu(m.location,x,g);u=c();let S=Jf(v,u),w=m.createHref(v);o.replaceState(S,"",w),s&&a&&a({action:l,location:m.location,delta:0})}function p(x){let g=i.location.origin!=="null"?i.location.origin:i.location.href,v=typeof x=="string"?x:Lg(x);return v=v.replace(/ $/,"%20"),xe(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 t(i,o)},listen(x){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(Kf,d),a=x,()=>{i.removeEventListener(Kf,d),a=null}},createHref(x){return e(i,x)},createURL:p,encodeLocation(x){let g=p(x);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:f,replace:h,go(x){return o.go(x)}};return m}var qf;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(qf||(qf={}));function Ix(t,e,n){return n===void 0&&(n="/"),Rx(t,e,n)}function Rx(t,e,n,r){let i=typeof e=="string"?xi(e):e,s=Bg(i.pathname||"/",n);if(s==null)return null;let o=jg(t);Lx(o);let l=null;for(let a=0;l==null&&a<o.length;++a){let u=Jx(s);l=Hx(o[a],u)}return l}function jg(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let i=(s,o,l)=>{let a={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};a.relativePath.startsWith("/")&&(xe(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=dr([r,a.relativePath]),c=n.concat(a);s.children&&s.children.length>0&&(xe(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),jg(s.children,e,c,u)),!(s.path==null&&!s.index)&&e.push({path:u,score:Vx(u,s.index),routesMeta:c})};return t.forEach((s,o)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,o);else for(let a of zg(s.path))i(s,o,a)}),e}function zg(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=zg(r.join("/")),l=[];return l.push(...o.map(a=>a===""?s:[s,a].join("/"))),i&&l.push(...o),l.map(a=>t.startsWith("/")&&a===""?"/":a)}function Lx(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:Ux(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const jx=/^:[\w-]+$/,zx=3,Bx=2,Fx=1,_x=10,$x=-2,Gf=t=>t==="*";function Vx(t,e){let n=t.split("/"),r=n.length;return n.some(Gf)&&(r+=$x),e&&(r+=Bx),n.filter(i=>!Gf(i)).reduce((i,s)=>i+(jx.test(s)?zx:s===""?Fx:_x),r)}function Ux(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function Hx(t,e,n){let{routesMeta:r}=t,i={},s="/",o=[];for(let l=0;l<r.length;++l){let a=r[l],u=l===r.length-1,c=s==="/"?e:e.slice(s.length)||"/",d=Wx({path:a.relativePath,caseSensitive:a.caseSensitive,end:u},c),f=a.route;if(!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:dr([s,d.pathname]),pathnameBase:Xx(dr([s,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(s=dr([s,d.pathnameBase]))}return o}function Wx(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=Kx(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),l=i.slice(1);return{params:r.reduce((u,c,d)=>{let{paramName:f,isOptional:h}=c;if(f==="*"){let m=l[d]||"";o=s.slice(0,s.length-m.length).replace(/(.)\/+$/,"$1")}const p=l[d];return h&&!p?u[f]=void 0:u[f]=(p||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:o,pattern:t}}function Kx(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),ed(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,a)=>(r.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function Jx(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return ed(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Bg(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const qx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Gx=t=>qx.test(t);function Qx(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?xi(t):t,s;if(n)if(Gx(n))s=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),ed(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?s=Qf(n.substring(1),"/"):s=Qf(n,e)}else s=e;return{pathname:s,search:Zx(r),hash:eS(i)}}function Qf(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function ka(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` 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 Yx(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Fg(t,e){let n=Yx(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function _g(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=xi(t):(i=ys({},t),xe(!i.pathname||!i.pathname.includes("?"),ka("?","pathname","search",i)),xe(!i.pathname||!i.pathname.includes("#"),ka("#","pathname","hash",i)),xe(!i.search||!i.search.includes("#"),ka("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=n;else{let d=e.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),d-=1;i.pathname=f.join("/")}l=d>=0?e[d]:"/"}let a=Qx(i,l),u=o&&o!=="/"&&o.endsWith("/"),c=(s||o===".")&&n.endsWith("/");return!a.pathname.endsWith("/")&&(u||c)&&(a.pathname+="/"),a}const dr=t=>t.join("/").replace(/\/\/+/g,"/"),Xx=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Zx=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,eS=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function tS(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const $g=["post","put","patch","delete"];new Set($g);const nS=["get",...$g];new Set(nS);/**
* React Router v6.30.3
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function vs(){return vs=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},vs.apply(this,arguments)}const td=k.createContext(null),rS=k.createContext(null),Ls=k.createContext(null),Al=k.createContext(null),Jn=k.createContext({outlet:null,matches:[],isDataRoute:!1}),Vg=k.createContext(null);function js(){return k.useContext(Al)!=null}function nd(){return js()||xe(!1),k.useContext(Al).location}function Ug(t){k.useContext(Ls).static||k.useLayoutEffect(t)}function rd(){let{isDataRoute:t}=k.useContext(Jn);return t?yS():iS()}function iS(){js()||xe(!1);let t=k.useContext(td),{basename:e,future:n,navigator:r}=k.useContext(Ls),{matches:i}=k.useContext(Jn),{pathname:s}=nd(),o=JSON.stringify(Fg(i,n.v7_relativeSplatPath)),l=k.useRef(!1);return Ug(()=>{l.current=!0}),k.useCallback(function(u,c){if(c===void 0&&(c={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let d=_g(u,JSON.parse(o),s,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:dr([e,d.pathname])),(c.replace?r.replace:r.push)(d,c.state,c)},[e,r,o,s,t])}function sS(){let{matches:t}=k.useContext(Jn),e=t[t.length-1];return e?e.params:{}}function oS(t,e){return lS(t,e)}function lS(t,e,n,r){js()||xe(!1);let{navigator:i}=k.useContext(Ls),{matches:s}=k.useContext(Jn),o=s[s.length-1],l=o?o.params:{};o&&o.pathname;let a=o?o.pathnameBase:"/";o&&o.route;let u=nd(),c;if(e){var d;let x=typeof e=="string"?xi(e):e;a==="/"||(d=x.pathname)!=null&&d.startsWith(a)||xe(!1),c=x}else c=u;let f=c.pathname||"/",h=f;if(a!=="/"){let x=a.replace(/^\//,"").split("/");h="/"+f.replace(/^\//,"").split("/").slice(x.length).join("/")}let p=Ix(t,{pathname:h}),m=fS(p&&p.map(x=>Object.assign({},x,{params:Object.assign({},l,x.params),pathname:dr([a,i.encodeLocation?i.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?a:dr([a,i.encodeLocation?i.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),s,n,r);return e&&m?k.createElement(Al.Provider,{value:{location:vs({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:Nn.Pop}},m):m}function aS(){let t=gS(),e=tS(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return k.createElement(k.Fragment,null,k.createElement("h2",null,"Unexpected Application Error!"),k.createElement("h3",{style:{fontStyle:"italic"}},e),n?k.createElement("pre",{style:i},n):null,null)}const uS=k.createElement(aS,null);class cS extends k.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?k.createElement(Jn.Provider,{value:this.props.routeContext},k.createElement(Vg.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function dS(t){let{routeContext:e,match:n,children:r}=t,i=k.useContext(td);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),k.createElement(Jn.Provider,{value:e},r)}function fS(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var s;if(!n)return null;if(n.errors)t=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,l=(i=n)==null?void 0:i.errors;if(l!=null){let c=o.findIndex(d=>d.route.id&&(l==null?void 0:l[d.route.id])!==void 0);c>=0||xe(!1),o=o.slice(0,Math.min(o.length,c+1))}let a=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let c=0;c<o.length;c++){let d=o[c];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(u=c),d.route.id){let{loaderData:f,errors:h}=n,p=d.route.loader&&f[d.route.id]===void 0&&(!h||h[d.route.id]===void 0);if(d.route.lazy||p){a=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,d,f)=>{let h,p=!1,m=null,x=null;n&&(h=l&&d.route.id?l[d.route.id]:void 0,m=d.route.errorElement||uS,a&&(u<0&&f===0?(vS("route-fallback"),p=!0,x=null):u===f&&(p=!0,x=d.route.hydrateFallbackElement||null)));let g=e.concat(o.slice(0,f+1)),v=()=>{let S;return h?S=m:p?S=x:d.route.Component?S=k.createElement(d.route.Component,null):d.route.element?S=d.route.element:S=c,k.createElement(dS,{match:d,routeContext:{outlet:c,matches:g,isDataRoute:n!=null},children:S})};return n&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?k.createElement(cS,{location:n.location,revalidation:n.revalidation,component:m,error:h,children:v(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):v()},null)}var Hg=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(Hg||{}),Wg=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Wg||{});function hS(t){let e=k.useContext(td);return e||xe(!1),e}function pS(t){let e=k.useContext(rS);return e||xe(!1),e}function mS(t){let e=k.useContext(Jn);return e||xe(!1),e}function Kg(t){let e=mS(),n=e.matches[e.matches.length-1];return n.route.id||xe(!1),n.route.id}function gS(){var t;let e=k.useContext(Vg),n=pS(),r=Kg();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function yS(){let{router:t}=hS(Hg.UseNavigateStable),e=Kg(Wg.UseNavigateStable),n=k.useRef(!1);return Ug(()=>{n.current=!0}),k.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,vs({fromRouteId:e},s)))},[t,e])}const Yf={};function vS(t,e,n){Yf[t]||(Yf[t]=!0)}function xS(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function so(t){let{to:e,replace:n,state:r,relative:i}=t;js()||xe(!1);let{future:s,static:o}=k.useContext(Ls),{matches:l}=k.useContext(Jn),{pathname:a}=nd(),u=rd(),c=_g(e,Fg(l,s.v7_relativeSplatPath),a,i==="path"),d=JSON.stringify(c);return k.useEffect(()=>u(JSON.parse(d),{replace:n,state:r,relative:i}),[u,d,i,n,r]),null}function Rr(t){xe(!1)}function SS(t){let{basename:e="/",children:n=null,location:r,navigationType:i=Nn.Pop,navigator:s,static:o=!1,future:l}=t;js()&&xe(!1);let a=e.replace(/^\/*/,"/"),u=k.useMemo(()=>({basename:a,navigator:s,static:o,future:vs({v7_relativeSplatPath:!1},l)}),[a,l,s,o]);typeof r=="string"&&(r=xi(r));let{pathname:c="/",search:d="",hash:f="",state:h=null,key:p="default"}=r,m=k.useMemo(()=>{let x=Bg(c,a);return x==null?null:{location:{pathname:x,search:d,hash:f,state:h,key:p},navigationType:i}},[a,c,d,f,h,p,i]);return m==null?null:k.createElement(Ls.Provider,{value:u},k.createElement(Al.Provider,{children:n,value:m}))}function kS(t){let{children:e,location:n}=t;return oS(Bu(e),n)}new Promise(()=>{});function Bu(t,e){e===void 0&&(e=[]);let n=[];return k.Children.forEach(t,(r,i)=>{if(!k.isValidElement(r))return;let s=[...e,i];if(r.type===k.Fragment){n.push.apply(n,Bu(r.props.children,s));return}r.type!==Rr&&xe(!1),!r.props.index||!r.props.children||xe(!1);let o={id:r.props.id||s.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&&(o.children=Bu(r.props.children,s)),n.push(o)}),n}/**
* React Router DOM v6.30.3
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/const wS="6";try{window.__reactRouterVersion=wS}catch{}const CS="startTransition",Xf=vv[CS];function ES(t){let{basename:e,children:n,future:r,window:i}=t,s=k.useRef();s.current==null&&(s.current=Dx({window:i,v5Compat:!0}));let o=s.current,[l,a]=k.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},c=k.useCallback(d=>{u&&Xf?Xf(()=>a(d)):a(d)},[a,u]);return k.useLayoutEffect(()=>o.listen(c),[o,c]),k.useEffect(()=>xS(r),[r]),k.createElement(SS,{basename:e,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}var Zf;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Zf||(Zf={}));var eh;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(eh||(eh={}));const id="sw-token";function sd(){return localStorage.getItem(id)}function NS(t){localStorage.setItem(id,t)}function Jg(){localStorage.removeItem(id)}function bS(){const t=sd();if(!t)return null;try{const e=JSON.parse(atob(t.split(".")[1]));return e.exp*1e3<Date.now()?(Jg(),null):e}catch{return null}}async function Ee(t,e,n,r={}){const i=sd(),s=n instanceof FormData,o={...!s&&n?{"Content-Type":"application/json"}:{},...i?{Authorization:`Bearer ${i}`}:{},...r},l=await fetch(e,{method:t,headers:o,body:s?n:n?JSON.stringify(n):void 0}),a=await l.json().catch(()=>({}));if(!l.ok)throw Object.assign(new Error(a.error||"Request failed"),{status:l.status});return a}async function th(t){var o,l;const e=sd(),n=await fetch(t,{headers:{Authorization:`Bearer ${e}`}});if(!n.ok)throw new Error("Export failed");const r=await n.blob(),i=((l=(o=n.headers.get("content-disposition"))==null?void 0:o.match(/filename="([^"]+)"/))==null?void 0:l[1])||"export",s=document.createElement("a");s.href=URL.createObjectURL(r),s.download=i,s.click(),URL.revokeObjectURL(s.href)}const ie={login:async(t,e)=>{const n=await Ee("POST","/api/auth/login",{username:t,password:e});return NS(n.token),n.user},logout:Jg,changePassword:(t,e)=>Ee("PUT","/api/auth/password",{current:t,newPassword:e}),getStories:()=>Ee("GET","/api/stories"),getStory:t=>Ee("GET",`/api/stories/${t}`),createStory:t=>Ee("POST","/api/stories",t),updateStory:(t,e)=>Ee("PUT",`/api/stories/${t}`,e),deleteStory:t=>Ee("DELETE",`/api/stories/${t}`),uploadImage:async t=>{const e=new FormData;return e.append("file",t),(await Ee("POST","/api/images",e)).url},getNotes:t=>Ee("GET",`/api/stories/${t}/notes`),createNote:t=>Ee("POST",`/api/stories/${t}/notes`),updateNote:(t,e,n)=>Ee("PUT",`/api/stories/${t}/notes/${e}`,n),deleteNote:(t,e)=>Ee("DELETE",`/api/stories/${t}/notes/${e}`),lintCheck:(t,e="en-US")=>Ee("POST","/api/lint/check",{text:t,language:e}),getPrompt:()=>Ee("GET","/api/prompts"),exportEpub:t=>th(`/api/stories/${t}/export/epub`),exportOdt:t=>th(`/api/stories/${t}/export/odt`),admin:{getUsers:t=>Ee("GET","/api/admin/users",null,{"x-admin-password":t}),createUser:(t,e)=>Ee("POST","/api/admin/users",e,{"x-admin-password":t}),resetPassword:(t,e,n)=>Ee("PUT",`/api/admin/users/${e}/password`,{password:n},{"x-admin-password":t}),deleteUser:(t,e)=>Ee("DELETE",`/api/admin/users/${e}`,null,{"x-admin-password":t})}},qg=k.createContext(null);function MS({children:t}){const[e,n]=k.useState([]),r=k.useCallback((i,s="info")=>{const o=Date.now()+Math.random();n(l=>[...l,{id:o,message:i,type:s}]),setTimeout(()=>n(l=>l.filter(a=>a.id!==o)),4e3)},[]);return y.jsxs(qg.Provider,{value:r,children:[t,y.jsx("div",{className:"toast-container","aria-live":"polite",children:e.map(i=>y.jsx("div",{className:`toast toast--${i.type}`,children:i.message},i.id))})]})}function od(){return k.useContext(qg)}const Gg=k.createContext(null);function TS({children:t}){const[e,n]=k.useState(null),r=k.useCallback((s,o={})=>new Promise(l=>n({message:s,opts:o,resolve:l})),[]);function i(s){e==null||e.resolve(s),n(null)}return y.jsxs(Gg.Provider,{value:r,children:[t,e&&y.jsx("div",{className:"confirm-backdrop",onClick:()=>i(!1),children:y.jsxs("div",{className:"confirm-box",onClick:s=>s.stopPropagation(),role:"dialog","aria-modal":!0,children:[y.jsx("p",{className:"confirm-message",children:e.message}),y.jsxs("div",{className:"confirm-actions",children:[y.jsx("button",{className:"btn btn-ghost",onClick:()=>i(!1),children:e.opts.cancelLabel||"Cancel"}),y.jsx("button",{className:"btn btn-primary",style:e.opts.danger?{background:"var(--danger)",borderColor:"var(--danger)"}:{},onClick:()=>i(!0),autoFocus:!0,children:e.opts.confirmLabel||"OK"})]})]})})]})}function ld(){return k.useContext(Gg)}function OS({onLogin:t}){const[e,n]=k.useState(""),[r,i]=k.useState(""),[s,o]=k.useState(""),[l,a]=k.useState(!1);async function u(c){c.preventDefault(),a(!0),o("");try{const d=await ie.login(e,r);t(d)}catch(d){o(d.message||"Wrong username or password")}finally{a(!1)}}return y.jsx("div",{className:"login-page",children:y.jsxs("div",{className:"login-box",children:[y.jsx("div",{className:"login-quill",children:"✍"}),y.jsx("h1",{className:"login-title",children:"Grimoire"}),y.jsx("p",{className:"login-sub",children:"Your stories, your magic"}),y.jsxs("form",{onSubmit:u,className:"login-form",children:[y.jsx("input",{type:"text",placeholder:"Username",value:e,onChange:c=>n(c.target.value),required:!0,className:"input",autoComplete:"username",autoCapitalize:"none"}),y.jsx("input",{type:"password",placeholder:"Password",value:r,onChange:c=>i(c.target.value),required:!0,className:"input",autoComplete:"current-password"}),s&&y.jsx("p",{className:"error-msg",children:s}),y.jsx("button",{type:"submit",className:"btn btn-primary",disabled:l,children:l?"Opening…":"Enter"})]})]})})}const Qg="sw-streak",ad="sw-goal";function Gr(){return new Date().toISOString().slice(0,10)}function DS(){return new Date(Date.now()-864e5).toISOString().slice(0,10)}function Yg(){try{return JSON.parse(localStorage.getItem(Qg))||{lastDate:null,streak:0}}catch{return{lastDate:null,streak:0}}}function PS(){const t=Gr(),e=Yg();if(e.lastDate===t)return e.streak;const n={lastDate:t,streak:e.lastDate===DS()?e.streak+1:1};return localStorage.setItem(Qg,JSON.stringify(n)),n.streak}function ud(){try{const t=JSON.parse(localStorage.getItem(ad));return t?t.date===Gr()?t:{...t,date:Gr(),count:0}:{target:0,date:Gr(),count:0}}catch{return{target:0,date:Gr(),count:0}}}function AS(t){localStorage.setItem(ad,JSON.stringify({...ud(),target:t}))}function IS(t){if(t<=0)return 0;const e=ud(),n={...e,date:Gr(),count:(e.count||0)+t};return localStorage.setItem(ad,JSON.stringify(n)),n.count}function RS(t){return!t||typeof t!="object"?0:JSON.stringify(t).replace(/"[^"]*":/g," ").replace(/[^a-zA-Z\s]/g," ").trim().split(/\s+/).filter(n=>n.length>1).length}function LS(t){const e=Date.now()-new Date(t),n=Math.floor(e/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);if(r<24)return`${r}h ago`;const i=Math.floor(r/24);return i<7?`${i}d ago`:new Date(t).toLocaleDateString()}function jS({story:t,onClick:e,onDelete:n}){const r=t.cover_image||null,i=RS(t.content);return y.jsxs("div",{className:"story-card",onClick:e,role:"button",tabIndex:0,onKeyDown:s=>s.key==="Enter"&&e(),children:[r?y.jsx("img",{src:r,alt:"",className:"story-card-cover"}):y.jsx("div",{className:"story-card-placeholder"}),y.jsxs("div",{className:"story-card-body",children:[y.jsx("h2",{className:"story-card-title",children:t.title}),y.jsxs("p",{className:"story-card-meta",children:[i," words · ",LS(t.updated_at)]}),y.jsx("button",{className:"story-card-delete",onClick:n,title:"Delete story","aria-label":"Delete story",children:"×"})]})]})}function zS({onLogout:t}){const[e,n]=k.useState([]),[r,i]=k.useState(!0),[s,o]=k.useState(""),[l,a]=k.useState(0),[u,c]=k.useState({target:0,count:0}),[d,f]=k.useState(!1),[h,p]=k.useState(""),[m,x]=k.useState(!1),[g,v]=k.useState({current:"",next:"",confirm:""}),[S,w]=k.useState(""),[E,b]=k.useState(!1),C=rd(),M=ld(),_=od();k.useEffect(()=>{ie.getStories().then(n).catch(()=>_("Could not load stories","error")).finally(()=>i(!1)),a(Yg().streak),c(ud())},[]);const N=e.filter(U=>!s||U.title.toLowerCase().includes(s.toLowerCase()));async function T(){const U=await ie.createStory({title:"Untitled Story",content:{}});C(`/story/${U.id}`)}async function V(U,D,j){U.stopPropagation(),await M(`Delete "${j}"? This cannot be undone.`,{confirmLabel:"Delete",cancelLabel:"Keep it",danger:!0})&&(await ie.deleteStory(D),n(A=>A.filter($=>$.id!==D)),_("Story deleted"))}function G(){ie.logout(),t()}async function Y(U){if(U.preventDefault(),w(""),g.next!==g.confirm){w("Passwords do not match");return}if(g.next.length<6){w("New password must be at least 6 characters");return}try{await ie.changePassword(g.current,g.next),b(!0),v({current:"",next:"",confirm:""}),setTimeout(()=>{x(!1),b(!1)},1500)}catch(D){w(D.message)}}function ke(U){U.preventDefault();const D=parseInt(h);!D||D<1||(AS(D),c(j=>({...j,target:D})),f(!1),_(`Daily goal set to ${D} words`))}const X=u.target>0?Math.min(100,Math.round(u.count/u.target*100)):0;return y.jsxs("div",{className:"stories-page",children:[y.jsxs("header",{className:"stories-header",children:[y.jsx("h1",{className:"page-title",children:"My Stories"}),y.jsxs("div",{className:"header-actions",children:[y.jsx("button",{onClick:T,className:"btn btn-primary",children:"+ New Story"}),y.jsx("button",{onClick:()=>{x(U=>!U),w(""),b(!1)},className:"btn btn-ghost",children:"Password"}),y.jsx("button",{onClick:G,className:"btn btn-ghost",children:"Sign Out"})]})]}),m&&y.jsxs("form",{className:"goal-form",onSubmit:Y,style:{alignItems:"flex-start",flexDirection:"column",maxWidth:320},children:[y.jsx("label",{className:"goal-label",children:"Change password"}),y.jsx("input",{type:"password",className:"input",placeholder:"Current password",value:g.current,onChange:U=>v(D=>({...D,current:U.target.value})),required:!0,autoFocus:!0}),y.jsx("input",{type:"password",className:"input",placeholder:"New password",value:g.next,onChange:U=>v(D=>({...D,next:U.target.value})),required:!0}),y.jsx("input",{type:"password",className:"input",placeholder:"Confirm new",value:g.confirm,onChange:U=>v(D=>({...D,confirm:U.target.value})),required:!0}),S&&y.jsx("p",{className:"error-msg",children:S}),E&&y.jsx("p",{className:"success-msg",children:"Password updated!"}),y.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[y.jsx("button",{type:"submit",className:"btn btn-primary",children:"Update"}),y.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>x(!1),children:"Cancel"})]})]}),y.jsxs("div",{className:"stats-bar",children:[l>0&&y.jsxs("div",{className:"stat-chip",children:[y.jsx("span",{className:"stat-icon",children:"🔥"}),y.jsxs("span",{children:[l," day streak"]})]}),y.jsx("div",{className:"stat-chip goal-chip",onClick:()=>{p(u.target||""),f(!0)},children:u.target>0?y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"stat-icon",children:"✍"}),y.jsxs("span",{children:[u.count," / ",u.target," words today"]}),y.jsx("span",{className:"goal-bar-wrap",children:y.jsx("span",{className:"goal-bar",style:{width:X+"%"}})}),y.jsxs("span",{className:"goal-pct",children:[X,"%"]})]}):y.jsx("span",{className:"goal-set-cta",children:"+ Set a daily writing goal"})})]}),d&&y.jsxs("form",{className:"goal-form",onSubmit:ke,children:[y.jsx("label",{className:"goal-label",children:"Daily word goal:"}),y.jsx("input",{type:"number",min:"1",className:"input goal-input",value:h,onChange:U=>p(U.target.value),placeholder:"e.g. 500",autoFocus:!0}),y.jsx("button",{type:"submit",className:"btn btn-primary",children:"Set"}),y.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>f(!1),children:"Cancel"})]}),y.jsx("div",{className:"search-bar",children:y.jsx("input",{type:"search",className:"input search-input",placeholder:"Search stories…",value:s,onChange:U=>o(U.target.value)})}),r?y.jsx("div",{className:"loading",children:"Loading your stories…"}):N.length===0&&s?y.jsxs("div",{className:"empty-state",children:[y.jsxs("p",{children:['No stories match "',s,'"']}),y.jsx("button",{className:"btn btn-ghost",onClick:()=>o(""),children:"Clear search"})]}):N.length===0?y.jsxs("div",{className:"empty-state",children:[y.jsx("span",{className:"empty-quill",children:"📖"}),y.jsx("p",{children:"No stories yet. Time to write one!"}),y.jsx("button",{onClick:T,className:"btn btn-primary",children:"Start Writing"})]}):y.jsx("div",{className:"stories-grid",children:N.map(U=>y.jsx(jS,{story:U,onClick:()=>C(`/story/${U.id}`),onDelete:D=>V(D,U.id,U.title)},U.id))})]})}function Ie(t){this.content=t}Ie.prototype={constructor:Ie,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new Ie(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ie(n)},addToStart:function(t,e){return new Ie([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ie(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new Ie(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Ie.from(t),t.size?new Ie(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ie.from(t),t.size?new Ie(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ie.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Ie.from=function(t){if(t instanceof Ie)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ie(e)};function Xg(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=Xg(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Zg(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){n-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let u=0,c=Math.min(o.text.length,l.text.length);for(;u<c&&o.text[o.text.length-u-1]==l.text[l.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(o.content.size||l.content.size){let u=Zg(o.content,l.content,n-1,r-1);if(u)return u}n-=a,r-=a}}class O{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,l=0;l<n;o++){let a=this.content[o],u=l+a.nodeSize;if(u>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let c=l+1;a.nodesBetween(Math.max(0,e-c),Math.min(a.content.size,n-c),r,i+c)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(l,a)=>{let u=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=u},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new O(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),i+=l.nodeSize),o=a}return new O(r,i)}cutByIndex(e,n){return e==n?O.empty:e==0&&n==this.content.length?this:new O(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new O(i,s)}addToStart(e){return new O([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new O(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.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(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Xg(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Zg(this,e,n,r)}findIndex(e){if(e==0)return oo(0,e);if(e==this.size)return oo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?oo(n+1,s):oo(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return O.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new O(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return O.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new O(n||e,r)}static from(e){if(!e)return O.empty;if(e instanceof O)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new O([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}O.empty=new O([],0);const wa={index:0,offset:0};function oo(t,e){return wa.index=t,wa.offset=e,wa}function tl(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!tl(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!tl(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Z=class Fu{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&tl(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Fu.none;if(e instanceof Fu)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};Z.none=[];class nl extends Error{}class I{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=ty(this.content,e+this.openStart,n);return r&&new I(r,this.openStart,this.openEnd)}removeBetween(e,n){return new I(ey(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return I.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new I(O.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new I(e,r,i)}}I.empty=new I(O.empty,0,0);function ey(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(i==e||s.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(ey(s.content,e-i-1,n-i-1)))}function ty(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=ty(o.content,e-s-1,n,o);return l&&t.replaceChild(i,o.copy(l))}function BS(t,e,n){if(n.openStart>t.depth)throw new nl("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new nl("Inconsistent open depths");return ny(t,e,n,0)}function ny(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=ny(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,l=o.content;return hr(o,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=FS(n,t);return hr(s,iy(t,o,l,e,r))}else return hr(s,rl(t,e,r))}function ry(t,e){if(!e.type.compatibleContent(t.type))throw new nl("Cannot join "+e.type.name+" onto "+t.type.name)}function _u(t,e,n){let r=t.node(n);return ry(r,e.node(n)),r}function fr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function qi(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(fr(t.nodeAfter,r),s++));for(let l=s;l<o;l++)fr(i.child(l),r);e&&e.depth==n&&e.textOffset&&fr(e.nodeBefore,r)}function hr(t,e){return t.type.checkContent(e),t.copy(e)}function iy(t,e,n,r,i){let s=t.depth>i&&_u(t,e,i+1),o=r.depth>i&&_u(n,r,i+1),l=[];return qi(null,t,i,l),s&&o&&e.index(i)==n.index(i)?(ry(s,o),fr(hr(s,iy(t,e,n,r,i+1)),l)):(s&&fr(hr(s,rl(t,e,i+1)),l),qi(e,n,i,l),o&&fr(hr(o,rl(n,r,i+1)),l)),qi(r,null,i,l),new O(l)}function rl(t,e,n){let r=[];if(qi(null,t,n,r),t.depth>n){let i=_u(t,e,n+1);fr(hr(i,rl(t,e,n+1)),r)}return qi(e,null,n,r),new O(r)}function FS(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(O.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class xs{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Z.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let l=r;r=i,i=l}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new il(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),u=s-a;if(r.push(o,l,i+a),!u||(o=o.child(l),o.isText))break;s=u-1,i+=a+1}return new xs(n,r,s)}static resolveCached(e,n){let r=nh.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else nh.set(e,r=new _S);let i=r.elts[r.i]=xs.resolve(e,n);return r.i=(r.i+1)%$S,i}}class _S{constructor(){this.elts=[],this.i=0}}const $S=12,nh=new WeakMap;class il{constructor(e,n,r){this.$from=e,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 VS=Object.create(null);let rn=class $u{constructor(e,n,r,i=Z.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||O.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&tl(this.attrs,n||e.defaultAttrs||VS)&&Z.sameSet(this.marks,r||Z.none)}copy(e=null){return e==this.content?this:new $u(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new $u(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return I.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),l=i.start(o),u=i.node(o).content.cut(i.pos-l,s.pos-l);return new I(u,i.depth-o,s.depth-o)}replace(e,n,r){return BS(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return xs.resolveCached(this,e)}resolveNoCache(e){return xs.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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 e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),sy(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=O.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Z.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Z.sameSet(e,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 e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,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(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=O.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};rn.prototype.text=void 0;class sl extends rn{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):sy(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new sl(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new sl(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function sy(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class wr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new US(e,n);if(r.next==null)return wr.empty;let i=oy(r);r.next&&r.err("Unexpected trailing text");let s=QS(GS(i));return YS(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,l){let a=o.matchFragment(e,r);if(a&&(!n||a.validEnd))return O.from(l.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:c,next:d}=o.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,l.concat(c));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
`)}}wr.empty=new wr(!0);class US{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.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(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function oy(t){let e=[];do e.push(HS(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function HS(t){let e=[];do e.push(WS(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function WS(t){let e=qS(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=KS(t,e);else break;return e}function rh(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function KS(t,e){let n=rh(t),r=n;return t.eat(",")&&(t.next!="}"?r=rh(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function JS(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function qS(t){if(t.eat("(")){let e=oy(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=JS(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function GS(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,l,a){let u={term:a,to:l};return e[o].push(u),u}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,u)=>a.concat(s(u,l)),[]);if(o.type=="seq")for(let a=0;;a++){let u=s(o.exprs[a],l);if(a==o.exprs.length-1)return u;i(u,l=n())}else if(o.type=="star"){let a=n();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=n();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let u=0;u<o.min;u++){let c=n();i(s(o.expr,a),c),a=c}if(o.max==-1)i(s(o.expr,a),a);else for(let u=o.min;u<o.max;u++){let c=n();r(a,c),i(s(o.expr,a),c),a=c}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function ly(t,e){return e-t}function ih(t,e){let n=[];return r(e),n.sort(ly);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&n.indexOf(a)==-1&&r(a)}}}function QS(t){let e=Object.create(null);return n(ih(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let c=0;c<i.length;c++)i[c][0]==l&&(u=i[c][1]);ih(t,a).forEach(c=>{u||i.push([l,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let s=e[r.join(",")]=new wr(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(ly);s.next.push({type:i[o][0],next:e[l.join(",")]||n(l)})}return s}}function YS(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:u}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(u)==-1&&r.push(u)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ay(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function uy(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function cy(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function dy(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new ZS(t,r,e[r]);return n}let sh=class fy{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=dy(e,r.attrs),this.defaultAttrs=ay(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==wr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:uy(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new rn(this,this.computeAttrs(e),O.from(n),Z.setFrom(r))}createChecked(e=null,n,r){return n=O.from(n),this.checkContent(n),new rn(this,this.computeAttrs(e),n,Z.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=O.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(O.empty,!0);return s?new rn(this,e,n.append(s),Z.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){cy(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Z.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new fy(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function XS(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class ZS{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?XS(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Il{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=dy(e,i.attrs),this.excluded=null;let s=ay(this.attrs);this.instance=s?new Z(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Z(this,uy(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Il(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){cy(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class hy{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Ie.from(e.nodes),n.marks=Ie.from(e.marks||{}),this.nodes=sh.compile(this.spec.nodes,this),this.marks=Il.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=wr.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?oh(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:oh(this,o.split(" "))}this.nodeFromJSON=i=>rn.fromJSON(this,i),this.markFromJSON=i=>Z.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof sh){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new sl(r,r.defaultAttrs,e,Z.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function oh(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let l in t.marks){let a=t.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function ek(t){return t.tag!=null}function tk(t){return t.style!=null}class zn{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(ek(i))this.tags.push(i);else if(tk(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new ah(this,n,!1);return r.addAll(e,Z.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new ah(this,n,!0);return r.addAll(e,Z.none,n.from,n.to),I.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(ik(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(o.getAttrs){let a=o.getAttrs(n);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let l=n[o];if((l.priority==null?50:l.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=uh(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=uh(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new zn(e,zn.schemaRules(e)))}}const py={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},nk={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},my={ol:!0,ul:!0},Ss=1,Vu=2,Gi=4;function lh(t,e,n){return e!=null?(e?Ss:0)|(e==="full"?Vu:0):t&&t.whitespace=="pre"?Ss|Vu:n&~Gi}class lo{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=Z.none,this.match=s||(o&Gi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(O.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ss)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=O.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(O.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!py.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ah{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=lh(null,n.preserveWhitespace,0)|(r?Gi:0);i?s=new lo(i.type,i.attrs,Z.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new lo(null,null,Z.none,!0,null,o):s=new lo(e.schema.topNodeType,null,Z.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&Vu?"full":this.localPreserveWS||(i.options&Ss)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(o.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=i.content[i.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;my.hasOwnProperty(o)&&this.parser.normalizeLists&&rk(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:nk.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let u,c=this.needsBlock;if(py.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),u=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=a&&a.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),u&&this.sync(s),this.needsBlock=c}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,a,u,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(s,o,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(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,n.attrs||null,r,n.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],u=a.findWrapping(e);if(u&&(!i||i.length>u.length+l)&&(i=u,s=a,!u.length))break;if(a.solid){if(r)break;l+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=Z.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):ch(l.type,e.type))&&(o=l.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=lh(e,s,o.options);o.options&Gi&&o.content.length==0&&(l|=Gi);let a=Z.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):ch(u.type,e))?(a=u.addToSet(a),!1):!0),this.nodes.push(new lo(e,n,a,i,null,l)),this.open++,r}closeExtra(e=!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(e));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(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Ss)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let u=n[l];if(u==""){if(l==n.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let c=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;a--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.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 rk(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&my.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function ik(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function uh(t){let e={};for(let n in t)e[n]=t[n];return e}function ch(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:u,next:c}=l.edge(a);if(u==e||s.indexOf(c)<0&&o(c))return!0}};if(o(i.contentMatch))return!0}}class Dr{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Ca(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let u=o.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(s[l][0])||u.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let u=o.marks[a++],c=this.serializeMark(u,o.isInline,n);c&&(s.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Mo(Ca(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Mo(Ca(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Mo(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Dr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=dh(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return dh(e.marks)}}function dh(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Ca(t){return t.document||window.document}const fh=new WeakMap;function sk(t){let e=fh.get(t);return e===void 0&&fh.set(t,e=ok(t)),e}function ok(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Mo(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=sk(r))&&s.indexOf(e)>-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 o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let l,a=n?t.createElementNS(n,i):t.createElement(i),u=e[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<e.length;d++){let f=e[d];if(f===0){if(d<e.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:h,contentDOM:p}=Mo(t,f,n,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const gy=65535,yy=Math.pow(2,16);function lk(t,e){return t+e*yy}function hh(t){return t&gy}function ak(t){return(t-(t&gy))/yy}const vy=1,xy=2,To=4,Sy=8;class Uu{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Sy)>0}get deletedBefore(){return(this.delInfo&(vy|To))>0}get deletedAfter(){return(this.delInfo&(xy|To))>0}get deletedAcross(){return(this.delInfo&To)>0}}class at{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&at.empty)return at.empty}recover(e){let n=0,r=hh(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+ak(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let u=this.ranges[l+s],c=this.ranges[l+o],d=a+u;if(e<=d){let f=u?e==a?-1:e==d?1:n:n,h=a+i+(f<0?0:c);if(r)return h;let p=e==(n<0?a:d)?null:lk(l/3,e-a),m=e==a?xy:e==d?vy:To;return(n<0?e!=a:e!=d)&&(m|=Sy),new Uu(h,m,p)}i+=c-u}return r?e+i:new Uu(e+i,0,null)}touches(e,n){let r=0,i=hh(n),s=this.inverted?2:1,o=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>e)break;let u=this.ranges[l+s],c=a+u;if(e<=c&&l==i*3)return!0;r+=this.ranges[l+o]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),u=this.ranges[i+n],c=this.ranges[i+r];e(l,l+u,a,a+c),s+=c-u}}invert(){return new at(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?at.empty:new at(e<0?[0,-e,0]:[0,0,e])}}at.empty=new at([]);class ks{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new ks(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new ks;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],l=o.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new Uu(e,i,null)}}const Ea=Object.create(null);class We{getMap(){return at.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ea[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ea)throw new RangeError("Duplicate use of step JSON ID "+e);return Ea[e]=n,n.prototype.jsonID=e,n}}class ve{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new ve(e,null)}static fail(e){return new ve(null,e)}static fromReplace(e,n,r,i){try{return ve.ok(e.replace(n,r,i))}catch(s){if(s instanceof nl)return ve.fail(s.message);throw s}}}function cd(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(cd(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return O.fromArray(r)}class bn extends We{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new I(cd(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return ve.fromReplace(e,this.from,this.to,s)}invert(){return new Ut(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new bn(n.pos,r.pos,this.mark)}merge(e){return e instanceof bn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new bn(n.from,n.to,e.markFromJSON(n.mark))}}We.jsonID("addMark",bn);class Ut extends We{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new I(cd(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return ve.fromReplace(e,this.from,this.to,r)}invert(){return new bn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Ut(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ut&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ut(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ut(n.from,n.to,e.markFromJSON(n.mark))}}We.jsonID("removeMark",Ut);class Mn extends We{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ve.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return ve.fromReplace(e,this.pos,this.pos+1,new I(O.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Mn(this.pos,n.marks[i]);return new Mn(this.pos,this.mark)}}return new Cr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Mn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Mn(n.pos,e.markFromJSON(n.mark))}}We.jsonID("addNodeMark",Mn);class Cr extends We{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ve.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return ve.fromReplace(e,this.pos,this.pos+1,new I(O.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Mn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Cr(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Cr(n.pos,e.markFromJSON(n.mark))}}We.jsonID("removeNodeMark",Cr);class me extends We{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Hu(e,this.from,this.to)?ve.fail("Structure replace would overwrite content"):ve.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new at([this.from,this.to-this.from,this.slice.size])}invert(e){return new me(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&me.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new me(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof me)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?I.empty:new I(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new me(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?I.empty:new I(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new me(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new me(n.from,n.to,I.fromJSON(e,n.slice),!!n.structure)}}me.MAP_BIAS=1;We.jsonID("replace",me);class Te extends We{constructor(e,n,r,i,s,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Hu(e,this.from,this.gapFrom)||Hu(e,this.gapTo,this.to)))return ve.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return ve.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?ve.fromReplace(e,this.from,this.to,r):ve.fail("Content does not fit in gap")}getMap(){return new at([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Te(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Te(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,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 Te(n.from,n.to,n.gapFrom,n.gapTo,I.fromJSON(e,n.slice),n.insert,!!n.structure)}}We.jsonID("replaceAround",Te);function Hu(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function uk(t,e,n,r){let i=[],s=[],o,l;t.doc.nodesBetween(e,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,e),h=Math.min(u+a.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[m])?o.to=h:i.push(o=new Ut(f,h,d[m])));l&&l.to==f?l.to=h:s.push(l=new bn(f,h,r))}}),i.forEach(a=>t.step(a)),s.forEach(a=>t.step(a))}function ck(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof Il){let u=o.marks,c;for(;c=r.isInSet(u);)(a||(a=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let u=Math.min(l+o.nodeSize,n);for(let c=0;c<a.length;c++){let d=a[c],f;for(let h=0;h<i.length;h++){let p=i[h];p.step==s-1&&d.eq(i[h].style)&&(f=p)}f?(f.to=u,f.step=s):i.push({style:d,from:Math.max(l,e),to:u,step:s})}}}),i.forEach(o=>t.step(new Ut(o.from,o.to,o.style)))}function dd(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let u=s.child(a),c=l+u.nodeSize,d=r.matchType(u.type);if(!d)o.push(new me(l,c,I.empty));else{r=d;for(let f=0;f<u.marks.length;f++)n.allowsMarkType(u.marks[f].type)||t.step(new Ut(l,c,u.marks[f]));if(i&&u.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(u.text);)p||(p=new I(O.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),o.push(new me(l+f.index,l+f.index+f[0].length,p))}}l=c}if(!r.validEnd){let a=r.fillBefore(O.empty,!0);t.replace(l,l,new I(a,0,0))}for(let a=o.length-1;a>=0;a--)t.step(o[a])}function dk(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Si(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),l=t.$from.index(r)+i,a=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(l,a,n))return r;if(r==0||o.type.spec.isolating||!dk(o,l,a))break;l&&(i=1),a<o.childCount&&(s=1)}return null}function fk(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),l=i.after(s+1),a=o,u=l,c=O.empty,d=0;for(let p=s,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,c=O.from(r.node(p).copy(c)),d++):a--;let f=O.empty,h=0;for(let p=s,m=!1;p>n;p--)m||i.after(p+1)<i.end(p)?(m=!0,f=O.from(i.node(p).copy(f)),h++):u++;t.step(new Te(a,u,o,l,new I(c.append(f),d,h),c.size-d,!0))}function fd(t,e,n=null,r=t){let i=hk(t,e),s=i&&pk(r,e);return s?i.map(ph).concat({type:e,attrs:n}).concat(s.map(ph)):null}function ph(t){return{type:t,attrs:null}}function hk(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function pk(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let u=r;a&&u<i;u++)a=a.matchType(n.child(u).type);return!a||!a.validEnd?null:o}function mk(t,e,n){let r=O.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let l=n[o].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=O.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new Te(i,s,i,s,new I(r,0,0),n.length,!0))}function gk(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,a)&&yk(t.doc,t.mapping.slice(s).map(l),r)){let u=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?u=!1:!h&&p&&(u=!0)}u===!1&&wy(t,o,l,s),dd(t,t.mapping.slice(s).map(l,1),r,void 0,u===null);let c=t.mapping.slice(s),d=c.map(l,1),f=c.map(l+o.nodeSize,1);return t.step(new Te(d,f,d+1,f-1,new I(O.from(r.create(a,null,o.marks)),0,0),1,!0)),u===!0&&ky(t,o,l,s),!1}})}function ky(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function wy(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
`))}})}function yk(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function vk(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Te(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new I(O.from(o),0,0),1,!0))}function sn(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,c=n-2;u>s;u--,c--){let d=i.node(u),f=i.index(u);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[c+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[c]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function xk(t,e,n=1,r){let i=t.doc.resolve(e),s=O.empty,o=O.empty;for(let l=i.depth,a=i.depth-n,u=n-1;l>a;l--,u--){s=O.from(i.node(l).copy(s));let c=r&&r[u];o=O.from(c?c.type.create(c.attrs,o):i.node(l).copy(o))}t.step(new me(e,e,new I(s.append(o),n,n),!0))}function qn(t,e){let n=t.resolve(e),r=n.index();return Cy(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Sk(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function Cy(t,e){return!!(t&&e&&!t.isLeaf&&Sk(t,e))}function Rl(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&Cy(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function kk(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let c=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);c&&!d?r=!1:!c&&d&&(r=!0)}let l=t.steps.length;if(r===!1){let c=t.doc.resolve(e+n);wy(t,c.node(),c.before(),l)}o.inlineContent&&dd(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let a=t.mapping.slice(l),u=a.map(e-n);if(t.step(new me(u,a.map(e+n,-1),I.empty,!0)),r===!0){let c=t.doc.resolve(u);ky(t,c.node(),c.before(),t.steps.length)}return t}function wk(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function Ey(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),u=r.node(o),c=!1;if(s==1)c=u.canReplace(a,a,i);else{let d=u.contentMatchAt(a).findWrapping(i.firstChild.type);c=d&&u.canReplaceWith(a,a,d[0])}if(c)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function Ll(t,e,n=e,r=I.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return Ny(i,s,r)?new me(e,n,r):new Ck(i,s,r).fit()}function Ny(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Ck{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=O.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=O.from(e.node(i).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 e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new I(s,o,l);return e>-1?new Te(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new me(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Na(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:u}=this.frontier[l],c,d=null;if(n==1&&(o?u.matchType(o.type)||(d=u.fillBefore(O.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:d};if(n==2&&o&&(c=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:c};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Na(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new I(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Na(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new I(ji(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new I(ji(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-e,u=0,c=[],{match:d,type:f}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)c.push(i.child(m));d=d.matchFragment(i)}let h=l.size+e-(o.content.size-o.openEnd);for(;u<l.childCount;){let m=l.child(u),x=d.matchType(m.type);if(!x)break;u++,(u>1||a==0||m.content.size)&&(d=x,c.push(by(m.mark(f.allowedMarks(m.marks)),u==1?a:0,u==l.childCount?h:-1)))}let p=u==l.childCount;p||(h=-1),this.placed=zi(this.placed,n,O.from(c)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,x=l;m<h;m++){let g=x.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),x=g.content}this.unplaced=p?e==0?I.empty:new I(ji(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new I(ji(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!ba(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=ba(e,n,i,r,s);if(o){for(let l=n-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],c=ba(e,l,u,a,!0);if(!c||c.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=zi(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=zi(this.placed,this.depth,O.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(O.empty,!0);n.childCount&&(this.placed=zi(this.placed,this.frontier.length,n))}}function ji(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(ji(t.firstChild.content,e-1,n)))}function zi(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(zi(t.lastChild.content,e-1,n)))}function Na(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function by(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,by(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(O.empty,!0)))),t.copy(r)}function ba(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!Ek(n,s.content,o)?l:null}function Ek(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Nk(t){return t.spec.defining||t.spec.definingForContent}function bk(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(Ny(i,s,r))return t.step(new me(e,n,r));let o=Ty(i,s);o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?l=f:i.before(f)==h&&o.splice(1,0,-f)}let a=o.indexOf(l),u=[],c=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(u.push(p),h==r.openStart)break;f=p.content}for(let f=c-1;f>=0;f--){let h=u[f],p=Nk(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(l)-1)))c=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+c+1)%(r.openStart+1),p=u[h];if(p)for(let m=0;m<o.length;m++){let x=o[(m+a)%o.length],g=!0;x<0&&(g=!1,x=-x);let v=i.node(x-1),S=i.index(x-1);if(v.canReplaceWith(S,S,p.type,p.marks))return t.replace(i.before(x),g?s.after(x):n,new I(My(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=o.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=o[f];h<0||(e=i.before(h),n=s.after(h))}}function My(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(My(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(O.empty,!0))}return t}function Mk(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=wk(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new I(O.from(r),0,0))}function Tk(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),l=!1;for(let a=r.depth;a>o;a--)r.node(a).type.spec.isolating&&(l=!0);for(let a=i.depth;a>o;a--)i.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=r.depth;a>0&&e==r.start(a);a--)e=r.before(a);for(let a=i.depth;a>0&&n==i.start(a);a--)n=i.before(a);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=Ty(r,i);for(let o=0;o<s.length;o++){let l=s[o],a=o==s.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return t.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function Ty(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class ri extends We{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return ve.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return ve.fromReplace(e,this.pos,this.pos+1,new I(O.from(i),0,n.isLeaf?0:1))}getMap(){return at.empty}invert(e){return new ri(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ri(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ri(n.pos,n.attr,n.value)}}We.jsonID("attr",ri);class ws extends We{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return ve.ok(r)}getMap(){return at.empty}invert(e){return new ws(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new ws(n.attr,n.value)}}We.jsonID("docAttr",ws);let fi=class extends Error{};fi=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};fi.prototype=Object.create(Error.prototype);fi.prototype.constructor=fi;fi.prototype.name="TransformError";class Ok{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ks}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new fi(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,l,a)=>{e=Math.min(e,l),n=Math.max(n,a)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=I.empty){let i=Ll(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new I(O.from(r),0,0))}delete(e,n){return this.replace(e,n,I.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return bk(this,e,n,r),this}replaceRangeWith(e,n,r){return Mk(this,e,n,r),this}deleteRange(e,n){return Tk(this,e,n),this}lift(e,n){return fk(this,e,n),this}join(e,n=1){return kk(this,e,n),this}wrap(e,n){return mk(this,e,n),this}setBlockType(e,n=e,r,i=null){return gk(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return vk(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new ri(e,n,r)),this}setDocAttribute(e,n){return this.step(new ws(e,n)),this}addNodeMark(e,n){return this.step(new Mn(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Z)n.isInSet(r.marks)&&this.step(new Cr(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new Cr(e,s)),i=s.removeFromSet(i);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,n=1,r){return xk(this,e,n,r),this}addMark(e,n,r){return uk(this,e,n,r),this}removeMark(e,n,r){return ck(this,e,n,r),this}clearIncompatible(e,n,r){return dd(this,e,n,r),this}}const Ma=Object.create(null);class W{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Dk(e.min(n),e.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 e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=I.empty){let r=n.content.lastChild,i=null;for(let l=0;l<n.openEnd;l++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:u}=o[l],c=e.mapping.slice(s);e.replaceRange(c.map(a.pos),c.map(u.pos),l?I.empty:n),l==0&&yh(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:l}=i[s],a=e.mapping.slice(r),u=a.map(o.pos),c=a.map(l.pos);s?e.deleteRange(u,c):(e.replaceRangeWith(u,c,n),yh(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new H(e):Lr(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?Lr(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Lr(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new ft(e.node(0))}static atStart(e){return Lr(e,e,0,0,1)||new ft(e)}static atEnd(e){return Lr(e,e,e.content.size,e.childCount,-1)||new ft(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ma[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ma)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ma[e]=n,n.prototype.jsonID=e,n}getBookmark(){return H.between(this.$anchor,this.$head).getBookmark()}}W.prototype.visible=!0;class Dk{constructor(e,n){this.$from=e,this.$to=n}}let mh=!1;function gh(t){!mh&&!t.parent.inlineContent&&(mh=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class H extends W{constructor(e,n=e){gh(e),gh(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return W.near(r);let i=e.resolve(n.map(this.anchor));return new H(i.parent.inlineContent?i:r,r)}replace(e,n=I.empty){if(super.replace(e,n),n==I.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof H&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new jl(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new H(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=W.findFrom(n,r,!0)||W.findFrom(n,-r,!0);if(s)n=s.$head;else return W.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(W.findFrom(e,-r,!0)||W.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new H(e,n)}}W.jsonID("text",H);class jl{constructor(e,n){this.anchor=e,this.head=n}map(e){return new jl(e.map(this.anchor),e.map(this.head))}resolve(e){return H.between(e.resolve(this.anchor),e.resolve(this.head))}}class F extends W{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?W.near(s):new F(s)}content(){return new I(O.from(this.node),0,0)}eq(e){return e instanceof F&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new hd(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new F(e.resolve(n.anchor))}static create(e,n){return new F(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}F.prototype.visible=!1;W.jsonID("node",F);class hd{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new jl(r,r):new hd(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&F.isSelectable(r)?new F(n):W.near(n)}}class ft extends W{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=I.empty){if(n==I.empty){e.delete(0,e.doc.content.size);let r=W.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ft(e)}map(e){return new ft(e)}eq(e){return e instanceof ft}getBookmark(){return Pk}}W.jsonID("all",ft);const Pk={map(){return this},resolve(t){return new ft(t)}};function Lr(t,e,n,r,i,s=!1){if(e.inlineContent)return H.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&F.isSelectable(l))return F.create(t,n-(i<0?l.nodeSize:0))}else{let a=Lr(t,l,n+i,i<0?l.childCount:0,i,s);if(a)return a}n+=l.nodeSize*i}return null}function yh(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof me||i instanceof Te))return;let s=t.mapping.maps[r],o;s.forEach((l,a,u,c)=>{o==null&&(o=c)}),t.setSelection(W.near(t.doc.resolve(o),n))}const vh=1,ao=2,xh=4;class Ak extends Ok{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.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(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|vh)&~ao,this.storedMarks=null,this}get selectionSet(){return(this.updated&vh)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ao,this}ensureMarks(e){return Z.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&ao)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ao,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Z.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(W.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=xh,this}get scrolledIntoView(){return(this.updated&xh)>0}}function Sh(t,e){return!e||!t?t:t.bind(e)}class Bi{constructor(e,n,r){this.name=e,this.init=Sh(n.init,r),this.apply=Sh(n.apply,r)}}const Ik=[new Bi("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Bi("selection",{init(t,e){return t.selection||W.atStart(e.doc)},apply(t){return t.selection}}),new Bi("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Bi("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Ta{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Ik.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 Bi(r.key,r.spec.state,r))})}}class Qr{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=i?i[o].n:0,u=i?i[o].state:this,c=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,u,r);if(c&&r.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Qr(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new Ak(this)}static create(e){let n=new Ta(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Qr(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Ta(this.schema,e.plugins),r=n.fields,i=new Qr(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Ta(e.schema,e.plugins),s=new Qr(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=rn.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=W.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],u=a.spec.state;if(a.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){s[o.name]=u.fromJSON.call(a,e,n[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function Oy(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Oy(i,e,{})),n[r]=i}return n}class Ke{constructor(e){this.spec=e,this.props={},e.props&&Oy(e.props,this,this.props),this.key=e.key?e.key.key:Dy("plugin")}getState(e){return e[this.key]}}const Oa=Object.create(null);function Dy(t){return t in Oa?t+"$"+ ++Oa[t]:(Oa[t]=0,t+"$")}class Mt{constructor(e="key"){this.key=Dy(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Re=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},hi=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Wu=null;const Yt=function(t,e,n){let r=Wu||(Wu=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Rk=function(){Wu=null},Er=function(t,e,n,r){return n&&(kh(t,e,n,r,-1)||kh(t,e,n,r,1))},Lk=/^(img|br|input|textarea|hr)$/i;function kh(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:xt(t))){let o=t.parentNode;if(!o||o.nodeType!=1||zs(t)||Lk.test(t.nodeName)||t.contentEditable=="false")return!1;e=Re(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?xt(t):0}else return!1}}function xt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function jk(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=xt(t)}else if(t.parentNode&&!zs(t))e=Re(t),t=t.parentNode;else return null}}function zk(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!zs(t))e=Re(t)+1,t=t.parentNode;else return null}}function Bk(t,e,n){for(let r=e==0,i=e==xt(t);r||i;){if(t==n)return!0;let s=Re(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==xt(t)}}function zs(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const zl=function(t){return t.focusNode&&Er(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function er(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Fk(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function _k(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(xt(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(xt(r.startContainer),r.startOffset)}}}const Kt=typeof navigator<"u"?navigator:null,wh=typeof document<"u"?document:null,Gn=Kt&&Kt.userAgent||"",Ku=/Edge\/(\d+)/.exec(Gn),Py=/MSIE \d/.exec(Gn),Ju=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Gn),ot=!!(Py||Ju||Ku),Bn=Py?document.documentMode:Ju?+Ju[1]:Ku?+Ku[1]:0,wt=!ot&&/gecko\/(\d+)/i.test(Gn);wt&&+(/Firefox\/(\d+)/.exec(Gn)||[0,0])[1];const qu=!ot&&/Chrome\/(\d+)/.exec(Gn),je=!!qu,Ay=qu?+qu[1]:0,He=!ot&&!!Kt&&/Apple Computer/.test(Kt.vendor),pi=He&&(/Mobile\/\w+/.test(Gn)||!!Kt&&Kt.maxTouchPoints>2),gt=pi||(Kt?/Mac/.test(Kt.platform):!1),Iy=Kt?/Win/.test(Kt.platform):!1,tn=/Android \d/.test(Gn),Bs=!!wh&&"webkitFontSmoothing"in wh.documentElement.style,$k=Bs?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Vk(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Gt(t,e){return typeof t=="number"?t:t[e]}function Uk(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Ch(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=hi(o);continue}let l=o,a=l==s.body,u=a?Vk(s):Uk(l),c=0,d=0;if(e.top<u.top+Gt(r,"top")?d=-(u.top-e.top+Gt(i,"top")):e.bottom>u.bottom-Gt(r,"bottom")&&(d=e.bottom-e.top>u.bottom-u.top?e.top+Gt(i,"top")-u.top:e.bottom-u.bottom+Gt(i,"bottom")),e.left<u.left+Gt(r,"left")?c=-(u.left-e.left+Gt(i,"left")):e.right>u.right-Gt(r,"right")&&(c=e.right-u.right+Gt(i,"right")),c||d)if(a)s.defaultView.scrollBy(c,d);else{let h=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),c&&(l.scrollLeft+=c);let m=l.scrollLeft-h,x=l.scrollTop-p;e={left:e.left-m,top:e.top-x,right:e.right-m,bottom:e.bottom-x}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:hi(o)}}function Hk(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=t.root.elementFromPoint(s,o);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:Ry(t.dom)}}function Ry(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=hi(r));return e}function Wk({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Ly(n,r==0?0:r-e)}function Ly(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Ar=null;function Kk(t){if(t.setActive)return t.setActive();if(Ar)return t.focus(Ar);let e=Ry(t);t.focus(Ar==null?{get preventScroll(){return Ar={preventScroll:!0},!0}}:void 0),Ar||(Ar=!1,Ly(e,0))}function jy(t,e){let n,r=2e8,i,s=0,o=e.top,l=e.top,a,u;for(let c=t.firstChild,d=0;c;c=c.nextSibling,d++){let f;if(c.nodeType==1)f=c.getClientRects();else if(c.nodeType==3)f=Yt(c).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=c,r=m,i=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,c.nodeType==1&&m&&(s=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=c,u={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!n&&a&&(n=a,i=u,r=0),n&&n.nodeType==3?Jk(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:jy(n,i)}function Jk(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=mn(r,1);if(o.top!=o.bottom&&pd(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function pd(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function qk(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Gk(t,e,n){let{node:r,offset:i}=jy(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function Qk(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let l=t.docView.nearestDesc(s,!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)&&(!o&&a.left>r.left||a.top>r.top?i=l.posBefore:(!o&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),o=!0),!l.contentDOM&&i<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;s=l.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function zy(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let u=l[a];if(pd(e,u))return zy(o,e,u)}}if((s=(s+1)%r)==i)break}return t}function Yk(t,e){let n=t.dom.ownerDocument,r,i=0,s=_k(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let u=t.dom.getBoundingClientRect();if(!pd(e,u)||(o=zy(t.dom,e,u),!o))return null}if(He)for(let u=o;r&&u;u=hi(u))u.draggable&&(r=void 0);if(o=qk(o,e),r){if(wt&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let c=r.childNodes[i],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let u;Bs&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=Qk(t,r,i,e))}l==null&&(l=Gk(t,o,e));let a=t.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Eh(t){return t.top<t.bottom||t.left<t.right}function mn(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Eh(r))return r}return Array.prototype.find.call(n,Eh)||t.getBoundingClientRect()}const Xk=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function By(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=Bs||wt;if(r.nodeType==3)if(o&&(Xk.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let a=mn(Yt(r,i,i),n);if(wt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let u=mn(Yt(r,i-1,i-1),-1);if(u.top==a.top){let c=mn(Yt(r,i,i+1),-1);if(c.top!=a.top)return Pi(c,c.left<u.left)}}return a}else{let a=i,u=i,c=n<0?1:-1;return n<0&&!i?(u++,c=-1):n>=0&&i==r.nodeValue.length?(a--,c=1):n<0?a--:u++,Pi(mn(Yt(r,a,u),c),c<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==xt(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Da(a.getBoundingClientRect(),!1)}if(s==null&&i<xt(r)){let a=r.childNodes[i];if(a.nodeType==1)return Da(a.getBoundingClientRect(),!0)}return Da(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==xt(r))){let a=r.childNodes[i-1],u=a.nodeType==3?Yt(a,xt(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return Pi(mn(u,1),!1)}if(s==null&&i<xt(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let u=a?a.nodeType==3?Yt(a,0,o?0:1):a.nodeType==1?a:null:null;if(u)return Pi(mn(u,-1),!0)}return Pi(mn(r.nodeType==3?Yt(r):r,-n),n>=0)}function Pi(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Da(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Fy(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function Zk(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Fy(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=By(t,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Yt(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"?o.top-c.top>(c.bottom-o.top)*2:c.bottom-o.bottom>(o.bottom-c.top)*2))return!1}}return!0})}const ew=/[\u0590-\u08ac]/;function tw(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=t.domSelection();return l?!ew.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?s:o:Fy(t,e,()=>{let{focusNode:a,focusOffset:u,anchorNode:c,anchorOffset:d}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),x=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&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),x}):r.pos==r.start()||r.pos==r.end()}let Nh=null,bh=null,Mh=!1;function nw(t,e,n){return Nh==e&&bh==n?Mh:(Nh=e,bh=n,Mh=n=="up"||n=="down"?Zk(t,e,n):tw(t,e,n))}const Ct=0,Th=1,sr=2,Jt=3;class Fs{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Ct,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.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(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Re(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let l=i.children[o];if(l.size){i=l;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.size;if(l>e||o instanceof $y){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof _y&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Re(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Re(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,l=0;;l++){let a=this.children[l],u=o+a.size;if(i==-1&&e<=u){let c=o+a.border;if(e>=c&&n<=u-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,c);e=o;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=Re(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-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)){s=Re(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],x=p+m.size;if(s>p&&o<x)return m.setSelection(e-p-m.border,n-p-m.border,r,i);p=x}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),u=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((wt||He)&&e==n){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
`),d&&p==h.nodeValue.length)for(let m=h,x;m;m=m.parentNode){if(x=m.nextSibling){x.nodeName=="BR"&&(l=a={node:x.parentNode,offset:Re(x)+1});break}let g=m.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(wt&&c.focusNode&&c.focusNode!=a.node&&c.focusNode.nodeType==1){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||d&&He)&&Er(l.node,l.offset,c.anchorNode,c.anchorOffset)&&Er(a.node,a.offset,c.focusNode,c.focusOffset))return;let f=!1;if((u.extend||e==n)&&!(d&&wt)){u.collapse(l.node,l.offset);try{e!=n&&u.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let l=r+s.border,a=o-s.border;if(e>=l&&n<=a){this.dirty=e==r||n==o?sr:Th,e==l&&n==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Jt:s.markDirty(e-l,n-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?sr:Jt}r=o}this.dirty=sr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?sr:Th;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class _y extends Fs{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Ct&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.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 rw extends Fs{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Nr extends Fs{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=Dr.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Nr(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Jt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Jt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Ct){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ct}}slice(e,n,r){let i=Nr.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=Qu(s,n,o,r)),e>0&&(s=Qu(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Fn extends Fs{constructor(e,n,r,i,s,o,l,a,u){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,n,r,i,s,o){let l=s.nodeViews[n.type.name],a,u=l&&l(n,s,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),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}=Dr.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=Hy(c,r,n),u?a=new iw(e,n,r,i,c,d||null,f,u,s,o+1):n.isText?new Bl(e,n,r,i,c,f,s):new Fn(e,n,r,i,c,d||null,f,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.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)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>O.empty)}return e}matchesNode(e,n,r){return this.dirty==Ct&&e.eq(this.node)&&ol(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new ow(this,o&&o.node,e);uw(this.node,this.innerDeco,(u,c,d)=>{u.spec.marks?a.syncToMarks(u.spec.marks,r,e,c):u.type.side>=0&&!d&&a.syncToMarks(c==this.node.childCount?Z.none:this.node.child(c).marks,r,e,c),a.placeWidget(u,e,i)},(u,c,d,f)=>{a.syncToMarks(u.marks,r,e,f);let h;a.findNodeMatch(u,c,d,f)||l&&e.state.selection.from>i&&e.state.selection.to<i+u.nodeSize&&(h=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(u,c,d,h,e)||a.updateNextNode(u,c,d,e,f,i)||a.addNode(u,c,d,e,i),i+=u.nodeSize}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==sr)&&(o&&this.protectLocalComposition(e,o),Vy(this.contentDOM,this.children,e),pi&&cw(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof H)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=dw(this.node.content,o,r-n,i-n);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new rw(this,s,n,i);e.input.compositionNodes.push(o),this.children=Qu(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==Jt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Ct}updateOuterDeco(e){if(ol(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Uy(this.dom,this.nodeDOM,Gu(this.outerDeco,this.node,n),Gu(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}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 Oh(t,e,n,r,i){Hy(r,e,t);let s=new Fn(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Bl extends Fn{constructor(e,n,r,i,s,o,l){super(e,n,r,i,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Jt||this.dirty!=Ct&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Ct||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Ct,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Bl(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Jt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class $y extends Fs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ct&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class iw extends Fn{constructor(e,n,r,i,s,o,l,a,u,c){super(e,n,r,i,s,o,l,u,c),this.spec=a}update(e,n,r,i){if(this.dirty==Jt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Vy(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==t){for(;l!=r;)r=Dh(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(l,r);if(o instanceof Nr){let a=r?r.previousSibling:t.lastChild;Vy(o.contentDOM,o.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=Dh(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Qi=function(t){t&&(this.nodeName=t)};Qi.prototype=Object.create(null);const or=[new Qi];function Gu(t,e,n){if(t.length==0)return or;let r=n?or[0]:new Qi,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new Qi(o.nodeName));for(let l in o){let a=o[l];a!=null&&(n&&i.length==1&&i.push(r=new Qi(e.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 i}function Uy(t,e,n,r){if(n==or&&r==or)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],l=n[s];if(s){let a;l&&l.nodeName==o.nodeName&&i!=t&&(a=i.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=or[0]),i=a}sw(i,l||or[0],o)}return i}function sw(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function Hy(t,e,n){return Uy(t,t,or,Gu(e,n,t.nodeType!=1))}function ol(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Dh(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class ow{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=lw(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,o=this.stack.length>>1,l=Math.min(o,e.length);for(;s<l&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=Ct,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1,u=this.top.children.length;i<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(e[o])&&!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=Nr.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,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(e,n,r)&&!this.preMatch.matched.has(u)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==Jt&&o.dom==o.contentDOM&&(o.dirty=sr),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof Fn){let u=this.preMatch.matched.get(a);if(u!=null&&u!=s)return!1;let c=a.dom,d,f=this.isLocked(c)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Jt&&ol(n,a.outerDeco));if(!f&&a.update(e,n,r,i))return this.destroyBetween(this.index,l),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,n,r,i,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=sr,d.updateChildren(i,o+1),d.dirty=Ct),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!ol(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=Fn.create(this.top,n,r,i,s,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,i,s){let o=Fn.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new _y(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Nr;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Bl)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((He||je)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new $y(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function lw(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let l;for(;;)if(r){let u=n.children[r-1];if(u instanceof Nr)n=u,r=u.children.length;else{l=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function aw(t,e){return t.type.side-e.type.side}function uw(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let u=0;u<t.childCount;u++){let c=t.child(u);r(c,i,e.forChild(s,c),u),s+=c.nodeSize}return}let o=0,l=[],a=null;for(let u=0;;){let c,d;for(;o<i.length&&i[o].to==s;){let x=i[o++];x.widget&&(c?(d||(d=[c])).push(x):c=x)}if(c)if(d){d.sort(aw);for(let x=0;x<d.length;x++)n(d[x],u,!!a)}else n(c,u,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(u<t.childCount)h=u,f=t.child(u++);else break;for(let x=0;x<l.length;x++)l[x].to<=s&&l.splice(x--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)l.push(i[o++]);let p=s+f.nodeSize;if(f.isText){let x=p;o<i.length&&i[o].from<x&&(x=i[o].from);for(let g=0;g<l.length;g++)l[g].to<x&&(x=l[g].to);x<p&&(a=f.cut(x-s),f=f.cut(0,x-s),p=x,h=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=f.isInline&&!f.isLeaf?l.filter(x=>!x.inline):l.slice();r(f,m,e.forChild(s,f),h),s=p}}function cw(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function dw(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),l=s;if(s+=o.nodeSize,!o.isText)continue;let a=o.text;for(;i<t.childCount;){let u=t.child(i++);if(s+=u.nodeSize,!u.isText)break;a+=u.text}if(s>=n){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let u=l<r?a.lastIndexOf(e,r-l-1):-1;if(u>=0&&u+e.length+l>=n)return l+u;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Qu(t,e,n,r,i){let s=[];for(let o=0,l=0;o<t.length;o++){let a=t[o],u=l,c=l+=a.size;u>=n||c<=e?s.push(a):(u<e&&s.push(a.slice(0,e-u,r)),i&&(s.push(i),i=void 0),c>n&&s.push(a.slice(n-u,a.size,r)))}return s}function md(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,u;if(zl(n)){for(a=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&F.isSelectable(d)&&i.parent&&!(d.isInline&&Bk(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;u=new F(o==f?l:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,f=o;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,o]=f==t.state.selection.anchor?[f,d]:[d,f],l=r.resolve(o)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let c=r.resolve(a);if(!u){let d=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;u=gd(t,c,l,d)}return u}function Wy(t){return t.editable?t.hasFocus():Jy(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function on(t,e=!1){let n=t.state.selection;if(Ky(t,n),!!Wy(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&je){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Er(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)hw(t);else{let{anchor:r,head:i}=n,s,o;Ph&&!(n instanceof H)&&(n.$from.parent.inlineContent||(s=Ah(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=Ah(t,n.to))),t.docView.setSelection(r,i,t,e),Ph&&(s&&Ih(s),o&&Ih(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&fw(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Ph=He||je&&Ay<63;function Ah(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(He&&i&&i.contentEditable=="false")return Pa(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Pa(i);if(s)return Pa(s)}}function Pa(t){return t.contentEditable="true",He&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Ih(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function fw(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Wy(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function hw(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Re(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ot&&Bn<=11&&(n.disabled=!0,n.disabled=!1)}function Ky(t,e){if(e instanceof F){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Rh(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Rh(t)}function Rh(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function gd(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||H.between(e,n,r)}function Lh(t){return t.editable&&!t.hasFocus()?!1:Jy(t)}function Jy(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function pw(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Er(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Yu(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&W.findFrom(s,e)}function vn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function jh(t,e,n){let r=t.state.selection;if(r instanceof H)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return vn(t,new H(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Yu(t.state,e);return i&&i instanceof F?vn(t,i):!1}else if(!(gt&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?F.isSelectable(s)?vn(t,new F(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Bs?vn(t,new H(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof F&&r.node.isInline)return vn(t,new H(e>0?r.$to:r.$from));{let i=Yu(t.state,e);return i?vn(t,i):!1}}}function ll(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Yi(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ir(t,e){return e<0?mw(t):gw(t)}function mw(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(wt&&n.nodeType==1&&r<ll(n)&&Yi(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(Yi(l,-1))i=n,s=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(qy(n))break;{let l=n.previousSibling;for(;l&&Yi(l,-1);)i=n.parentNode,s=Re(l),l=l.previousSibling;if(l)n=l,r=ll(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Xu(t,n,r):i&&Xu(t,i,s)}function gw(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=ll(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let l=n.childNodes[r];if(Yi(l,1))s=n,o=++r;else break}else{if(qy(n))break;{let l=n.nextSibling;for(;l&&Yi(l,1);)s=l.parentNode,o=Re(l)+1,l=l.nextSibling;if(l)n=l,r=0,i=ll(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Xu(t,s,o)}function qy(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function yw(t,e){for(;t&&e==t.childNodes.length&&!zs(t);)e=Re(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function vw(t,e){for(;t&&!e&&!zs(t);)e=Re(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Xu(t,e,n){if(e.nodeType!=3){let s,o;(o=yw(e,n))?(e=o,n=0):(s=vw(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(zl(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&on(t)},50)}function zh(t,e){let n=t.state.doc.resolve(e);if(!(je||Iy)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Bh(t,e,n){let r=t.state.selection;if(r instanceof H&&!r.empty||n.indexOf("s")>-1||gt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Yu(t.state,e);if(o&&o instanceof F)return vn(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof ft?W.near(o,e):W.findFrom(o,e);return l?vn(t,l):!1}return!1}function Fh(t,e){if(!(t.state.selection instanceof H))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function _h(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function xw(t){if(!He||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;_h(t,r,"true"),setTimeout(()=>_h(t,r,"false"),20)}return!1}function Sw(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function kw(t,e){let n=e.keyCode,r=Sw(e);if(n==8||gt&&n==72&&r=="c")return Fh(t,-1)||Ir(t,-1);if(n==46&&!e.shiftKey||gt&&n==68&&r=="c")return Fh(t,1)||Ir(t,1);if(n==13||n==27)return!0;if(n==37||gt&&n==66&&r=="c"){let i=n==37?zh(t,t.state.selection.from)=="ltr"?-1:1:-1;return jh(t,i,r)||Ir(t,i)}else if(n==39||gt&&n==70&&r=="c"){let i=n==39?zh(t,t.state.selection.from)=="ltr"?1:-1:1;return jh(t,i,r)||Ir(t,i)}else{if(n==38||gt&&n==80&&r=="c")return Bh(t,-1,r)||Ir(t,-1);if(n==40||gt&&n==78&&r=="c")return xw(t)||Bh(t,1,r)||Ir(t,1);if(r==(gt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function yd(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=t.someProp("clipboardSerializer")||Dr.fromSchema(t.state.schema),l=e0(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let u=a.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=Zy[u.nodeName.toLowerCase()]);){for(let h=c.length-1;h>=0;h--){let p=l.createElement(c[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}u=a.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
`);return{dom:a,text:f,slice:e}}function Gy(t,e,n,r,i){let s=i.parent.type.spec.code,o,l;if(!n&&!e)return null;let a=!!e&&(r||s||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,s||r,t)}),s)return l=new I(O.from(t.state.schema.text(e.replace(/\r\n?/g,`
`))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(d)l=d;else{let f=i.marks(),{schema:h}=t.state,p=Dr.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let x=o.appendChild(document.createElement("p"));m&&x.appendChild(p.serializeNode(h.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=Nw(n),Bs&&bw(o);let u=o&&o.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=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||zn.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||c),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!ww.test(f.parentNode.nodeName)?{ignore:!0}:null}})),c)l=Mw($h(l,+c[1],+c[2]),c[4]);else if(l=I.maxOpen(Cw(l.content,i),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=$h(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}const ww=/^(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 Cw(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),u;if(!a)return o=null;if(u=o.length&&s.length&&Yy(a,s,l,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=Xy(o[o.length-1],s.length));let c=Qy(l,a);o.push(c),i=i.matchType(c.type),s=a}}),o)return O.from(o)}return t}function Qy(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,O.from(t));return t}function Yy(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=Yy(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(O.from(Qy(n,t,i+1))))}}function Xy(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Xy(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(O.empty,!0);return t.copy(n.append(r))}function Zu(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(s=0),i<r-1&&(l=Zu(l,e,n,r,i+1,s)),i>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(O.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function $h(t,e,n){return e<t.openStart&&(t=new I(Zu(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new I(Zu(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Zy={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 Vh=null;function e0(){return Vh||(Vh=document.implementation.createHTMLDocument("title"))}let Aa=null;function Ew(t){let e=window.trustedTypes;return e?(Aa||(Aa=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Aa.createHTML(t)):t}function Nw(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=e0().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Zy[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=Ew(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function bw(t){let e=t.querySelectorAll(je?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Mw(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=O.from(a.create(r[l+1],i)),s++,o++}return new I(i,s,o)}const Ge={},Qe={},Tw={touchstart:!0,touchmove:!0};class Ow{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 Dw(t){for(let e in Ge){let n=Ge[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Aw(t,r)&&!vd(t,r)&&(t.editable||!(r.type in Qe))&&n(t,r)},Tw[e]?{passive:!0}:void 0)}He&&t.dom.addEventListener("input",()=>null),ec(t)}function Tn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Pw(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function ec(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>vd(t,r))})}function vd(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Aw(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Iw(t,e){!vd(t,e)&&Ge[e.type]&&(t.editable||!(e.type in Qe))&&Ge[e.type](t,e)}Qe.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!n0(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(tn&&je&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),pi&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,er(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||kw(t,n)?n.preventDefault():Tn(t,"key")};Qe.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Qe.keypress=(t,e)=>{let n=e;if(n0(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||gt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof H)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Fl(t){return{left:t.clientX,top:t.clientY}}function Rw(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function xd(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,l=>o>s.depth?l(t,n,s.nodeAfter,s.before(o),i,!0):l(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function ii(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Lw(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&F.isSelectable(r)?(ii(t,new F(n)),!0):!1}function jw(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof F&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(F.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(ii(t,F.create(t.state.doc,i)),!0):!1}function zw(t,e,n,r,i){return xd(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?jw(t,n):Lw(t,n))}function Bw(t,e,n,r){return xd(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function Fw(t,e,n,r){return xd(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||_w(t,n,r)}function _w(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(ii(t,H.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)ii(t,H.create(r,l+1,l+1+o.content.size));else if(F.isSelectable(o))ii(t,F.create(r,l));else continue;return!0}}function Sd(t){return al(t)}const t0=gt?"metaKey":"ctrlKey";Ge.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Sd(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&Rw(n,t.input.lastClick)&&!n[t0]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(Fl(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new $w(t,o,n,!!r)):(s=="doubleClick"?Bw:Fw)(t,o.pos,o.inside,n)?n.preventDefault():Tn(t,"pointer"))};class $w{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[t0],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let c=e.state.doc.resolve(n.pos);s=c.parent,o=c.depth?c.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:u}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||u instanceof F&&u.from<=o&&u.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&wt&&!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()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Tn(e,"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(()=>on(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Fl(e))),this.updateAllowDefault(e),this.allowDefault||!n?Tn(this.view,"pointer"):zw(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||He&&this.mightDrag&&!this.mightDrag.node.isAtom||je&&!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)?(ii(this.view,W.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Tn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Tn(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ge.touchstart=t=>{t.input.lastTouch=Date.now(),Sd(t),Tn(t,"pointer")};Ge.touchmove=t=>{t.input.lastTouch=Date.now(),Tn(t,"pointer")};Ge.contextmenu=t=>Sd(t);function n0(t,e){return t.composing?!0:He&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Vw=tn?5e3:-1;Qe.compositionstart=Qe.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof H&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||je&&Iy&&Uw(t)))t.markCursor=t.state.storedMarks||n.marks(),al(t,!0),t.markCursor=null;else if(al(t,!e.selection.empty),wt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}r0(t,Vw)};function Uw(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Qe.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,r0(t,20))};function r0(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>al(t),e))}function i0(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Ww());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Hw(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=jk(e.focusNode,e.focusOffset),r=zk(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function Ww(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function al(t,e=!1){if(!(tn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),i0(t),e||t.docView&&t.docView.dirty){let n=md(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Kw(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Cs=ot&&Bn<15||pi&&$k<604;Ge.copy=Qe.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Cs?null:n.clipboardData,o=r.content(),{dom:l,text:a}=yd(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):Kw(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Jw(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function qw(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Es(t,r.value,null,i,e):Es(t,r.textContent,r.innerHTML,i,e)},50)}function Es(t,e,n,r,i){let s=Gy(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,i,s||I.empty)))return!0;if(!s)return!1;let o=Jw(s),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function s0(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Qe.paste=(t,e)=>{let n=e;if(t.composing&&!tn)return;let r=Cs?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Es(t,s0(r),r.getData("text/html"),i,n)?n.preventDefault():qw(t,n)};class o0{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const Gw=gt?"altKey":"ctrlKey";function l0(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[Gw]}Ge.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Fl(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof F?i.to-1:i.to))){if(r&&r.mightDrag)o=F.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=F.create(t.state.doc,d.posBefore))}}let l=(o||t.state.selection).content(),{dom:a,text:u,slice:c}=yd(t,l);(!n.dataTransfer.files.length||!je||Ay>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Cs?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Cs||n.dataTransfer.setData("text/plain",u),t.dragging=new o0(c,l0(t,n),o)};Ge.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Qe.dragover=Qe.dragenter=(t,e)=>e.preventDefault();Qe.drop=(t,e)=>{try{Qw(t,e,t.dragging)}finally{t.dragging=null}};function Qw(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Fl(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",h=>{s=h(s,t,!1)}):s=Gy(t,s0(e.dataTransfer),Cs?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&l0(t,e));if(t.someProp("handleDrop",h=>h(t,e,s||I.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let l=s?Ey(t.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let a=t.state.tr;if(o){let{node:h}=n;h?h.replace(a):a.deleteSelection()}let u=a.mapping.map(l),c=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=a.doc;if(c?a.replaceRangeWith(u,u,s.content.firstChild):a.replaceRange(u,u,s),a.doc.eq(d))return;let f=a.doc.resolve(u);if(c&&F.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))a.setSelection(new F(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,m,x,g)=>h=g),a.setSelection(gd(t,f,a.doc.resolve(h)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}Ge.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&on(t)},20))};Ge.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Ge.beforeinput=(t,e)=>{if(je&&tn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,er(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Qe)Ge[t]=Qe[t];function Ns(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class ul{constructor(e,n){this.toDOM=e,this.spec=n||pr,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new ct(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof ul&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ns(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class _n{constructor(e,n){this.attrs=e,this.spec=n||pr}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new ct(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof _n&&Ns(this.attrs,e.attrs)&&Ns(this.spec,e.spec)}static is(e){return e.type instanceof _n}destroy(){}}class kd{constructor(e,n){this.attrs=e,this.spec=n||pr}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new ct(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof kd&&Ns(this.attrs,e.attrs)&&Ns(this.spec,e.spec)}destroy(){}}class ct{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new ct(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new ct(e,e,new ul(n,r))}static inline(e,n,r,i){return new ct(e,n,new _n(r,i))}static node(e,n,r,i){return new ct(e,n,new kd(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof _n}get widget(){return this.type instanceof ul}}const jr=[],pr={};class ge{constructor(e,n){this.local=e.length?e:jr,this.children=n.length?n:jr}static create(e,n){return n.length?cl(n,e,0,pr):$e}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,i+l,s)}}map(e,n,r){return this==$e||e.maps.length==0?this:this.mapInner(e,n,0,0,r||pr)}mapInner(e,n,r,i,s){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(n,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?Yw(this.children,o||[],e,n,r,i,s):o?new ge(o.sort(mr),jr):$e}add(e,n){return n.length?this==$e?ge.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((l,a)=>{let u=a+r,c;if(c=u0(n,l,u)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,c,u+1):i.splice(s,0,a,a+l.nodeSize,cl(c,l,u+1,pr)),s+=3}});let o=a0(s?c0(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new ge(o.length?this.local.concat(o).sort(mr):this.local,i||this.children)}remove(e){return e.length==0||this==$e?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,l=r[s]+n,a=r[s+1]+n;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>l&&d.to<a&&(e[c]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[s+2].removeInner(o,l+1);u!=$e?r[s+2]=u:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<i.length;l++)i[l].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ge(i,r):$e}forChild(e,n){if(this==$e)return this;if(n.isLeaf)return ge.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>s&&a.type instanceof _n){let u=Math.max(s,a.from)-s,c=Math.min(o,a.to)-s;u<c&&(i||(i=[])).push(a.copy(u,c))}}if(i){let l=new ge(i.sort(mr),jr);return r?new wn([l,r]):l}return r||$e}eq(e){if(this==e)return!0;if(!(e instanceof ge)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return wd(this.localsInner(e))}localsInner(e){if(this==$e)return jr;if(e.inlineContent||!this.local.some(_n.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof _n||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ge.empty=new ge([],[]);ge.removeOverlap=wd;const $e=ge.empty;class wn{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,pr));return wn.from(r)}forChild(e,n){if(n.isLeaf)return ge.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=$e&&(s instanceof wn?r=r.concat(s.members):r.push(s))}return wn.from(r)}eq(e){if(!(e instanceof wn)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?wd(r?n:n.sort(mr)):jr}static from(e){switch(e.length){case 0:return $e;case 1:return e[0];default:return new wn(e.every(n=>n instanceof ge)?e:e.reduce((n,r)=>n.concat(r instanceof ge?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Yw(t,e,n,r,i,s,o){let l=t.slice();for(let u=0,c=s;u<n.maps.length;u++){let d=0;n.maps[u].forEach((f,h,p,m)=>{let x=m-p-(h-f);for(let g=0;g<l.length;g+=3){let v=l[g+1];if(v<0||f>v+c-d)continue;let S=l[g]+c-d;h>=S?l[g+1]=f<=S?-2:-1:f>=c&&x&&(l[g]+=x,l[g+1]+=x)}d+=x}),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(t[u]+s),d=c-i;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[u+1]+s,-1),h=f-i,{index:p,offset:m}=r.content.findIndex(d),x=r.maybeChild(p);if(x&&m==d&&m+x.nodeSize==h){let g=l[u+2].mapInner(n,x,c+1,t[u]+s+1,o);g!=$e?(l[u]=d,l[u+1]=h,l[u+2]=g):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=Xw(l,t,e,n,i,s,o),c=cl(u,r,0,o);e=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 h=c.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,c.children[d],c.children[d+1],c.children[d+2])}}return new ge(e.sort(mr),l)}function a0(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new ct(i.from+e,i.to+e,i.type))}return n}function Xw(t,e,n,r,i,s,o){function l(a,u){for(let c=0;c<a.local.length;c++){let d=a.local[c].map(r,i,u);d?n.push(d):o.onRemove&&o.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<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+s+1);return n}function u0(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function c0(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function cl(t,e,n,r){let i=[],s=!1;e.forEach((l,a)=>{let u=u0(t,l,a+n);if(u){s=!0;let c=cl(u,l,n+a+1,r);c!=$e&&i.push(a,a+l.nodeSize,c)}});let o=a0(s?c0(t):t,-n).sort(mr);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||i.length?new ge(o,i):$e}function mr(t,e){return t.from-e.from||t.to-e.to}function wd(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),Uh(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),Uh(e,i,r.copy(s.from,r.to)));break}}}return e}function Uh(t,e,n){for(;e<t.length&&mr(n,t[e])>0;)e++;t.splice(e,0,n)}function Ia(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=$e&&e.push(r)}),t.cursorWrapper&&e.push(ge.create(t.state.doc,[t.cursorWrapper.deco])),wn.from(e)}const Zw={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},eC=ot&&Bn<=11;class tC{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class nC{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new tC,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);ot&&Bn<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():He&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),eC&&(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,Zw)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[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(Lh(this.view)){if(this.suppressingSelectionUpdates)return on(this.view);if(ot&&Bn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Er(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=hi(s))n.add(s);for(let s=e.anchorNode;s;s=hi(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Lh(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],a);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(l=!0))}if(a.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of a)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){c.parentNode.removeChild(c);break}d=d.firstChild}}}else if(wt&&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 h=f.parentNode;h&&h.nodeName=="LI"&&(!d||sC(e,d)!=h)&&f.remove()}}}let u=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&zl(r)&&(u=md(e))&&u.eq(W.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,on(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),rC(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,oC(e,a)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||on(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(ot&&Bn<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:f}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=i&&i.parentNode==e.target?Re(i)+1:0,l=r.localPosFromDOM(e.target,o,-1),a=s&&s.parentNode==e.target?Re(s):e.target.childNodes.length,u=r.localPosFromDOM(e.target,a,1);return{from:l,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Hh=new WeakMap,Wh=!1;function rC(t){if(!Hh.has(t)&&(Hh.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=wt,Wh)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."),Wh=!0}}function Kh(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return Er(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function iC(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Kh(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Kh(t,n):null}function sC(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function oC(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(s,l.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function lC(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),u,c=a.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(u=[{node:c,offset:a.anchorOffset}],zl(a)||u.push({node:a.focusNode,offset:a.focusOffset})),je&&t.input.lastKeyCode===8)for(let x=s;x>i;x--){let g=r.childNodes[x-1],v=g.pmViewDesc;if(g.nodeName=="BR"&&!v){s=x;break}if(!v||v.size)break}let d=t.state.doc,f=t.someProp("domParser")||zn.fromSchema(t.state.schema),h=d.resolve(o),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:aC,context:h});if(u&&u[0].pos!=null){let x=u[0].pos,g=u[1]&&u[1].pos;g==null&&(g=x),p={anchor:x+o,head:g+o}}return{doc:m,sel:p,from:o,to:l}}function aC(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(He&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||He&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const uC=/^(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 cC(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let C=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,M=md(t,C);if(M&&!t.state.selection.eq(M)){if(je&&tn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",N=>N(t,er(13,"Enter"))))return;let _=t.state.tr.setSelection(M);C=="pointer"?_.setMeta("pointer",!0):C=="key"&&_.scrollIntoView(),s&&_.setMeta("composition",s),t.dispatch(_)}return}let o=t.state.doc.resolve(e),l=o.sharedDepth(n);e=o.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,u=lC(t,e,n),c=t.state.doc,d=c.slice(u.from,u.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=hC(d.content,u.doc.content,u.from,f,h);if(p&&t.input.domChangeCount++,(pi&&t.input.lastIOSEnter>Date.now()-225||tn)&&i.some(C=>C.nodeType==1&&!uC.test(C.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",C=>C(t,er(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof H&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(u.sel){let C=Jh(t,t.state.doc,u.sel);if(C&&!C.eq(t.state.selection)){let M=t.state.tr.setSelection(C);s&&M.setMeta("composition",s),t.dispatch(M)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof H&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),ot&&Bn<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>u.from&&u.doc.textBetween(p.start-u.from-1,p.start-u.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=u.doc.resolveNoCache(p.start-u.from),x=u.doc.resolveNoCache(p.endB-u.from),g=c.resolve(p.start),v=m.sameParent(x)&&m.parent.inlineContent&&g.end()>=p.endA;if((pi&&t.input.lastIOSEnter>Date.now()-225&&(!v||i.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!v&&m.pos<u.doc.content.size&&(!m.sameParent(x)||!m.parent.inlineContent)&&m.pos<x.pos&&!/\S/.test(u.doc.textBetween(m.pos,x.pos,"","")))&&t.someProp("handleKeyDown",C=>C(t,er(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&fC(c,p.start,p.endA,m,x)&&t.someProp("handleKeyDown",C=>C(t,er(8,"Backspace")))){tn&&je&&t.domObserver.suppressSelectionUpdates();return}je&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),tn&&!v&&m.start()!=x.start()&&x.parentOffset==0&&m.depth==x.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==p.endA&&(p.endB-=2,x=u.doc.resolveNoCache(p.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(C){return C(t,er(13,"Enter"))})},20));let S=p.start,w=p.endA,E=C=>{let M=C||t.state.tr.replace(S,w,u.doc.slice(p.start-u.from,p.endB-u.from));if(u.sel){let _=Jh(t,M.doc,u.sel);_&&!(je&&t.composing&&_.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(_.head==S||_.head==M.mapping.map(w)-1)||ot&&_.empty&&_.head==S)&&M.setSelection(_)}return s&&M.setMeta("composition",s),M.scrollIntoView()},b;if(v)if(m.pos==x.pos){ot&&Bn<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>on(t),20));let C=E(t.state.tr.delete(S,w)),M=c.resolve(p.start).marksAcross(c.resolve(p.endA));M&&C.ensureMarks(M),t.dispatch(C)}else if(p.endA==p.endB&&(b=dC(m.parent.content.cut(m.parentOffset,x.parentOffset),g.parent.content.cut(g.parentOffset,p.endA-g.start())))){let C=E(t.state.tr);b.type=="add"?C.addMark(S,w,b.mark):C.removeMark(S,w,b.mark),t.dispatch(C)}else if(m.parent.child(m.index()).isText&&m.index()==x.index()-(x.textOffset?0:1)){let C=m.parent.textBetween(m.parentOffset,x.parentOffset),M=()=>E(t.state.tr.insertText(C,S,w));t.someProp("handleTextInput",_=>_(t,S,w,C,M))||t.dispatch(M())}else t.dispatch(E());else t.dispatch(E())}function Jh(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:gd(t,e.resolve(n.anchor),e.resolve(n.head))}function dC(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,l,a;for(let c=0;c<r.length;c++)i=r[c].removeFromSet(i);for(let c=0;c<n.length;c++)s=n[c].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],o="add",a=c=>c.mark(l.addToSet(c.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",a=c=>c.mark(l.removeFromSet(c.marks));else return null;let u=[];for(let c=0;c<e.childCount;c++)u.push(a(e.child(c)));if(O.from(u).eq(t))return{mark:l,type:o}}function fC(t,e,n,r,i){if(n-e<=i.pos-r.pos||Ra(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&n==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Ra(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Ra(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Ra(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function hC(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let a=Math.max(0,s-Math.min(o,l));r-=o+a-s}if(o<s&&t.size<e.size){let a=r<=s&&r>=o?s-r:0;s-=a,s&&s<e.size&&qh(e.textBetween(s-1,s+1))&&(s+=a?1:-1),l=s+(l-o),o=s}else if(l<s){let a=r<=s&&r>=l?s-r:0;s-=a,s&&s<t.size&&qh(t.textBetween(s-1,s+1))&&(s+=a?1:-1),o=s+(o-l),l=s}return{start:s,endA:o,endB:l}}function qh(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class d0{constructor(e,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 Ow,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Zh),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Yh(this),Qh(this),this.nodeViews=Xh(this),this.docView=Oh(this.state.doc,Gh(this),Ia(this),this.dom,this),this.domObserver=new nC(this,(r,i,s,o)=>cC(this,r,i,s,o)),this.domObserver.start(),Dw(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ec(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Zh),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(i0(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=Xh(this);mC(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&ec(this),this.editable=Yh(this),Qh(this);let a=Ia(this),u=Gh(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,u,a);(d||!e.selection.eq(i.selection))&&(o=!0);let f=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Hk(this);if(o){this.domObserver.stop();let h=d&&(ot||je)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&pC(i.selection,e.selection);if(d){let p=je?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Hw(this)),(s||!this.docView.update(e.doc,u,a,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Oh(e.doc,u,a,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&pw(this))?on(this,h):(Ky(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():f&&Wk(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof F){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Ch(this,n.getBoundingClientRect(),e)}else Ch(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.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,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new o0(e.slice,e.move,i<0?void 0:F.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(i=n?n(l):l))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let l=s[o].props[e];if(l!=null&&(i=n?n(l):l))return i}}hasFocus(){if(ot){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Kk(this.dom),on(this),this.domObserver.start()}get root(){let e=this._root;if(e==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 e||document}updateRoot(){this._root=null}posAtCoords(e){return Yk(this,e)}coordsAtPos(e,n=1){return By(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return nw(this,n||this.state,e)}pasteHTML(e,n){return Es(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Es(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return yd(this,e)}destroy(){this.docView&&(Pw(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ia(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Rk())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Iw(this,e)}domSelectionRange(){let e=this.domSelection();return e?He&&this.root.nodeType===11&&Fk(this.dom.ownerDocument)==this.dom&&iC(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}d0.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Gh(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[ct.node(0,t.state.doc.content.size,e)]}function Qh(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:ct.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Yh(t){return!t.someProp("editable",e=>e(t.state)===!1)}function pC(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Xh(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function mC(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function Zh(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Un={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:"'"},dl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},gC=typeof navigator<"u"&&/Mac/.test(navigator.platform),yC=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Le=0;Le<10;Le++)Un[48+Le]=Un[96+Le]=String(Le);for(var Le=1;Le<=24;Le++)Un[Le+111]="F"+Le;for(var Le=65;Le<=90;Le++)Un[Le]=String.fromCharCode(Le+32),dl[Le]=String.fromCharCode(Le);for(var La in Un)dl.hasOwnProperty(La)||(dl[La]=Un[La]);function vC(t){var e=gC&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||yC&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?dl:Un)[t.keyCode]||t.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 xC=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),SC=typeof navigator<"u"&&/Win/.test(navigator.platform);function kC(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))xC?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function wC(t){let e=Object.create(null);for(let n in t)e[kC(n)]=t[n];return e}function ja(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function CC(t){return new Ke({props:{handleKeyDown:f0(t)}})}function f0(t){let e=wC(t);return function(n,r){let i=vC(r),s,o=e[ja(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[ja(i,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(SC&&r.ctrlKey&&r.altKey)&&(s=Un[r.keyCode])&&s!=i){let l=e[ja(s,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}const Cd=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function h0(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const p0=(t,e,n)=>{let r=h0(t,n);if(!r)return!1;let i=Ed(r);if(!i){let o=r.blockRange(),l=o&&Si(o);return l==null?!1:(e&&e(t.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(C0(t,i,e,-1))return!0;if(r.parent.content.size==0&&(mi(s,"end")||F.isSelectable(s)))for(let o=r.depth;;o--){let l=Ll(t.doc,r.before(o),r.after(o),I.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(mi(s,"end")?W.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):F.create(a.doc,i.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},EC=(t,e,n)=>{let r=h0(t,n);if(!r)return!1;let i=Ed(r);return i?m0(t,i,e):!1},NC=(t,e,n)=>{let r=y0(t,n);if(!r)return!1;let i=Nd(r);return i?m0(t,i,e):!1};function m0(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let o=e.nodeAfter,l=o,a=e.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=Ll(t.doc,s,a,I.empty);if(!u||u.from!=s||u instanceof me&&u.slice.size>=a-s)return!1;if(n){let c=t.tr.step(u);c.setSelection(H.create(c.doc,s)),n(c.scrollIntoView())}return!0}function mi(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const g0=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=Ed(r)}let o=s&&s.nodeBefore;return!o||!F.isSelectable(o)?!1:(e&&e(t.tr.setSelection(F.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Ed(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function y0(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const v0=(t,e,n)=>{let r=y0(t,n);if(!r)return!1;let i=Nd(r);if(!i)return!1;let s=i.nodeAfter;if(C0(t,i,e,1))return!0;if(r.parent.content.size==0&&(mi(s,"start")||F.isSelectable(s))){let o=Ll(t.doc,r.before(),r.after(),I.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(mi(s,"start")?W.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):F.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},x0=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=Nd(r)}let o=s&&s.nodeAfter;return!o||!F.isSelectable(o)?!1:(e&&e(t.tr.setSelection(F.create(t.doc,s.pos)).scrollIntoView()),!0)};function Nd(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const bC=(t,e)=>{let n=t.selection,r=n instanceof F,i;if(r){if(n.node.isTextblock||!qn(t.doc,n.from))return!1;i=n.from}else if(i=Rl(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(F.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},MC=(t,e)=>{let n=t.selection,r;if(n instanceof F){if(n.node.isTextblock||!qn(t.doc,n.to))return!1;r=n.to}else if(r=Rl(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},TC=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Si(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},S0=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
`).scrollIntoView()),!0)};function bd(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const OC=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=bd(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,o.createAndFill());a.setSelection(W.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},k0=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof ft||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=bd(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=t.tr.insert(o,s.createAndFill());l.setSelection(H.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},w0=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(sn(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Si(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function DC(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof F&&e.selection.node.isBlock)return!r.parentOffset||!sn(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,l,a=!1,u=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),u=r.start(h)==r.pos-(r.depth-h),l=bd(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),s.unshift(a&&l?{type:l}:null),o=h;break}else{if(h==1)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof H||e.selection instanceof ft)&&c.deleteSelection();let d=c.mapping.map(r.pos),f=sn(c.doc,d,s.length,s);if(f||(s[0]=l?{type:l}:null,f=sn(c.doc,d,s.length,s)),!f)return!1;if(c.split(d,s.length,s),!a&&u&&r.node(o).type!=l){let h=c.mapping.map(r.before(o)),p=c.doc.resolve(h);l&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,l)&&c.setNodeMarkup(c.mapping.map(r.before(o)),l)}return n&&n(c.scrollIntoView()),!0}}const PC=DC(),AC=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(F.create(t.doc,i))),!0)};function IC(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||qn(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function C0(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&IC(t,e,n))return!0;let u=!a&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(n){let h=e.pos+s.nodeSize,p=O.empty;for(let g=o.length-1;g>=0;g--)p=O.from(o[g].create(null,p));p=O.from(i.copy(p));let m=t.tr.step(new Te(e.pos-1,h,e.pos,h,new I(p,1,0),o.length,!0)),x=m.doc.resolve(h+2*o.length);x.nodeAfter&&x.nodeAfter.type==i.type&&qn(m.doc,x.pos)&&m.join(x.pos),n(m.scrollIntoView())}return!0}let c=s.type.spec.isolating||r>0&&a?null:W.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),f=d&&Si(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(u&&mi(s,"start",!0)&&mi(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=s,x=1;for(;!m.isTextblock;m=m.firstChild)x++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let g=O.empty;for(let S=p.length-1;S>=0;S--)g=O.from(p[S].copy(g));let v=t.tr.step(new Te(e.pos-p.length,e.pos+s.nodeSize,e.pos+x,e.pos+s.nodeSize-x,new I(g,p.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function E0(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(H.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const RC=E0(-1),LC=E0(1);function jC(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),l=o&&fd(o,t,e);return l?(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0):!1}}function ep(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[s];n.doc.nodesBetween(o,l,(a,u)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)i=!0;else{let c=n.doc.resolve(u),d=c.index();i=c.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[o];s.setBlockType(l,a,t,e)}r(s.scrollIntoView())}return!0}}function Md(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}Md(Cd,p0,g0);Md(Cd,v0,x0);Md(S0,k0,w0,PC);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function zC(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let l=r?n.tr:null;return BC(l,o,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function BC(t,e,n,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=o.resolve(e.start-2);s=new il(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new il(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=fd(s,n,r,e);return l?(t&&FC(t,e,l,i,n),!0):!1}function FC(t,e,n,r,i){let s=O.empty;for(let c=n.length-1;c>=0;c--)s=O.from(n[c].type.create(n[c].attrs,s));t.step(new Te(e.start-(r?2:0),e.end,e.start,e.end,new I(s,0,0),n.length,!0));let o=0;for(let c=0;c<n.length;c++)n[c].type==i&&(o=c+1);let l=n.length-o,a=e.start+n.length-(r?2:0),u=e.parent;for(let c=e.startIndex,d=e.endIndex,f=!0;c<d;c++,f=!1)!f&&sn(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=u.child(c).nodeSize;return t}function _C(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?$C(e,n,t,s):VC(e,n,s):!0:!1}}function $C(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Te(s-1,o,s,o,new I(O.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new il(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const l=Si(r);if(l==null)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(s,-1)-1);return qn(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}function VC(t,e,n){let r=t.tr,i=n.parent;for(let h=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==i.childCount,u=s.node(-1),c=s.index(-1);if(!u.canReplace(c+(l?0:1),c+1,o.content.append(a?O.empty:O.from(i))))return!1;let d=s.pos,f=d+o.nodeSize;return r.step(new Te(d-(l?1:0),f+(a?1:0),d+1,f-1,new I((l?O.empty:O.from(i.copy(O.empty))).append(a?O.empty:O.from(i.copy(O.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function UC(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=t)return!1;if(n){let u=a.lastChild&&a.lastChild.type==l.type,c=O.from(u?t.create():null),d=new I(O.from(t.create(null,O.from(l.type.create(null,c)))),u?3:1,0),f=s.start,h=s.end;n(e.tr.step(new Te(f-(u?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}function _l(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}class $l{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:n,state:r}=this,{view:i}=n,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>{const d=a(...c)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l=[],a=!!e,u=e||s.tr,c=()=>(!a&&n&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(u),l.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...m)=>{const x=this.buildProps(u,n),g=h(...m)(x);return l.push(g),d}])),run:c};return d}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([a,u])=>[a,(...c)=>u(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l={tr:e,editor:i,view:o,state:_l({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,u])=>[a,(...c)=>u(...c)(l)]))}};return l}}class HC{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}once(e,n){const r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function L(t,e,n){return t.config[e]===void 0&&t.parent?L(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?L(t.parent,e,n):null}):t.config[e]}function Vl(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function N0(t){const e=[],{nodeExtensions:n,markExtensions:r}=Vl(t),i=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage,extensions:i},a=L(o,"addGlobalAttributes",l);if(!a)return;a().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...s,...h}})})})})}),i.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage},a=L(o,"addAttributes",l);if(!a)return;const u=a();Object.entries(u).forEach(([c,d])=>{const f={...s,...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,e.push({type:o.name,name:c,attribute:f})})}),e}function De(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Se(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const l=s?String(s).split(" "):[],a=r[i]?r[i].split(" "):[],u=l.filter(c=>!a.includes(c));r[i]=[...a,...u].join(" ")}else if(i==="style"){const l=s?s.split(";").map(c=>c.trim()).filter(Boolean):[],a=r[i]?r[i].split(";").map(c=>c.trim()).filter(Boolean):[],u=new Map;a.forEach(c=>{const[d,f]=c.split(":").map(h=>h.trim());u.set(d,f)}),l.forEach(c=>{const[d,f]=c.split(":").map(h=>h.trim());u.set(d,f)}),r[i]=Array.from(u.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else r[i]=s}),r},{})}function fl(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Se(n,r),{})}function b0(t){return typeof t=="function"}function K(t,e=void 0,...n){return b0(t)?e?t.bind(e)(...n):t(...n):t}function WC(t={}){return Object.keys(t).length===0&&t.constructor===Object}function KC(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function tp(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(n):KC(n.getAttribute(o.name));return l==null?s:{...s,[o.name]:l}},{});return{...r,...i}}}}function np(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&WC(n)?!1:n!=null))}function M0(t,e){var n;const r=N0(t),{nodeExtensions:i,markExtensions:s}=Vl(t),o=(n=i.find(u=>L(u,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(i.map(u=>{const c=r.filter(g=>g.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},f=t.reduce((g,v)=>{const S=L(v,"extendNodeSchema",d);return{...g,...S?S(u):{}}},{}),h=np({...f,content:K(L(u,"content",d)),marks:K(L(u,"marks",d)),group:K(L(u,"group",d)),inline:K(L(u,"inline",d)),atom:K(L(u,"atom",d)),selectable:K(L(u,"selectable",d)),draggable:K(L(u,"draggable",d)),code:K(L(u,"code",d)),whitespace:K(L(u,"whitespace",d)),linebreakReplacement:K(L(u,"linebreakReplacement",d)),defining:K(L(u,"defining",d)),isolating:K(L(u,"isolating",d)),attrs:Object.fromEntries(c.map(g=>{var v;return[g.name,{default:(v=g==null?void 0:g.attribute)===null||v===void 0?void 0:v.default}]}))}),p=K(L(u,"parseHTML",d));p&&(h.parseDOM=p.map(g=>tp(g,c)));const m=L(u,"renderHTML",d);m&&(h.toDOM=g=>m({node:g,HTMLAttributes:fl(g,c)}));const x=L(u,"renderText",d);return x&&(h.toText=x),[u.name,h]})),a=Object.fromEntries(s.map(u=>{const c=r.filter(x=>x.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},f=t.reduce((x,g)=>{const v=L(g,"extendMarkSchema",d);return{...x,...v?v(u):{}}},{}),h=np({...f,inclusive:K(L(u,"inclusive",d)),excludes:K(L(u,"excludes",d)),group:K(L(u,"group",d)),spanning:K(L(u,"spanning",d)),code:K(L(u,"code",d)),attrs:Object.fromEntries(c.map(x=>{var g;return[x.name,{default:(g=x==null?void 0:x.attribute)===null||g===void 0?void 0:g.default}]}))}),p=K(L(u,"parseHTML",d));p&&(h.parseDOM=p.map(x=>tp(x,c)));const m=L(u,"renderHTML",d);return m&&(h.toDOM=x=>m({mark:x,HTMLAttributes:fl(x,c)})),[u.name,h]}));return new hy({topNode:o,nodes:l,marks:a})}function za(t,e){return e.nodes[t]||e.marks[t]||null}function rp(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Ul(t,e){const n=Dr.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const JC=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,l)=>{var a,u;const c=((u=(a=i.type.spec).toText)===null||u===void 0?void 0:u.call(a,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-s))}),n};function Td(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Hl{constructor(e){this.find=e.find,this.handler=e.handler}}const qC=(t,e)=>{if(Td(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,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 uo(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:l}=t,{view:a}=n;if(a.composing)return!1;const u=a.state.doc.resolve(r);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let c=!1;const d=JC(u)+s;return o.forEach(f=>{if(c)return;const h=qC(d,f.find);if(!h)return;const p=a.state.tr,m=_l({state:a.state,transaction:p}),x={from:r-(h[0].length-s.length),to:i},{commands:g,chain:v,can:S}=new $l({editor:n,state:m});f.handler({state:m,range:x,match:h,commands:g,chain:v,can:S})===null||!p.steps.length||(p.setMeta(l,{transform:p,from:r,to:i,text:s}),a.dispatch(p),c=!0)}),c}function GC(t){const{editor:e,rules:n}=t,r=new Ke({state:{init(){return null},apply(i,s,o){const l=i.getMeta(r);if(l)return l;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:c}=a;typeof c=="string"?c=c:c=Ul(O.from(c),o.schema);const{from:d}=a,f=d+c.length;uo({editor:e,from:d,to:f,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,l){return uo({editor:e,from:s,to:o,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&uo({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?uo({editor:e,from:o.pos,to:o.pos,text:`
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function QC(t){return Object.prototype.toString.call(t).slice(8,-1)}function co(t){return QC(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Wl(t,e){const n={...t};return co(t)&&co(e)&&Object.keys(e).forEach(r=>{co(e[r])&&co(t[r])?n[r]=Wl(t[r],e[r]):n[r]=e[r]}),n}class bt{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=K(L(this,"addOptions",{name:this.name}))),this.storage=K(L(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new bt(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Wl(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new bt(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=K(L(n,"addOptions",{name:n.name})),n.storage=K(L(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(u=>(u==null?void 0:u.type.name)===n.name))return!1;const a=o.find(u=>(u==null?void 0:u.type.name)===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function YC(t){return typeof t=="number"}class XC{constructor(e){this.find=e.find,this.handler=e.handler}}const ZC=(t,e,n)=>{if(Td(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function eE(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=t,{commands:a,chain:u,can:c}=new $l({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const m=Math.max(r,p),x=Math.min(i,p+h.content.size),g=h.textBetween(m-p,x-p,void 0,"");ZC(g,s.find,o).forEach(S=>{if(S.index===void 0)return;const w=m+S.index+1,E=w+S[0].length,b={from:n.tr.mapping.map(w),to:n.tr.mapping.map(E)},C=s.handler({state:n,range:b,match:S,commands:a,chain:u,can:c,pasteEvent:o,dropEvent:l});d.push(C)})}),d.every(h=>h!==null)}let fo=null;const tE=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function nE(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=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:h,pasteEvt:p})=>{const m=c.tr,x=_l({state:c,transaction:m});if(!(!eE({editor:e,state:x,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(c=>new Ke({view(d){const f=p=>{var m;r=!((m=d.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?d.dom.parentElement:null,r&&(fo=e)},h=()=>{fo&&(fo=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(s=r===d.dom.parentElement,l=f,!s){const h=fo;h!=null&&h.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return o=f,i=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!i,x=p.getMeta("uiEvent")==="drop"&&!s,g=p.getMeta("applyPasteRules"),v=!!g;if(!m&&!x&&!v)return;if(v){let{text:E}=g;typeof E=="string"?E=E:E=Ul(O.from(E),h.schema);const{from:b}=g,C=b+E.length,M=tE(E);return a({rule:c,state:h,from:b,to:{b:C},pasteEvt:M})}const S=f.doc.content.findDiffStart(h.doc.content),w=f.doc.content.findDiffEnd(h.doc.content);if(!(!YC(S)||!w||S===w.b))return a({rule:c,state:h,from:S,to:w,pasteEvt:o})}}))}function rE(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class lr{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=lr.resolve(e),this.schema=M0(this.extensions,n),this.setupExtensions()}static resolve(e){const n=lr.sort(lr.flatten(e)),r=rE(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=L(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=L(r,"priority")||100,o=L(i,"priority")||100;return s>o?-1:s<o?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:za(n.name,this.schema)},i=L(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=lr.sort([...this.extensions].reverse()),r=[],i=[],s=n.map(o=>{const l={name:o.name,options:o.options,storage:o.storage,editor:e,type:za(o.name,this.schema)},a=[],u=L(o,"addKeyboardShortcuts",l);let c={};if(o.type==="mark"&&L(o,"exitable",l)&&(c.ArrowRight=()=>bt.handleExit({editor:e,mark:o})),u){const m=Object.fromEntries(Object.entries(u()).map(([x,g])=>[x,()=>g({editor:e})]));c={...c,...m}}const d=CC(c);a.push(d);const f=L(o,"addInputRules",l);rp(o,e.options.enableInputRules)&&f&&r.push(...f());const h=L(o,"addPasteRules",l);rp(o,e.options.enablePasteRules)&&h&&i.push(...h());const p=L(o,"addProseMirrorPlugins",l);if(p){const m=p();a.push(...m)}return a}).flat();return[GC({editor:e,rules:r}),...nE({editor:e,rules:i}),...s]}get attributes(){return N0(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=Vl(this.extensions);return Object.fromEntries(n.filter(r=>!!L(r,"addNodeView")).map(r=>{const i=this.attributes.filter(a=>a.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:De(r.name,this.schema)},o=L(r,"addNodeView",s);if(!o)return[];const l=(a,u,c,d,f)=>{const h=fl(a,i);return o()({node:a,view:u,getPos:c,decorations:d,innerDecorations:f,editor:e,extension:r,HTMLAttributes:h})};return[r.name,l]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:za(e.name,this.schema)};e.type==="mark"&&(!((n=K(L(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=L(e,"onBeforeCreate",r),s=L(e,"onCreate",r),o=L(e,"onUpdate",r),l=L(e,"onSelectionUpdate",r),a=L(e,"onTransaction",r),u=L(e,"onFocus",r),c=L(e,"onBlur",r),d=L(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),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)})}}class Pe{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=K(L(this,"addOptions",{name:this.name}))),this.storage=K(L(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Pe(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Wl(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Pe({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=K(L(n,"addOptions",{name:n.name})),n.storage=K(L(n,"addStorage",{name:n.name,options:n.options})),n}}function T0(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
`,textSerializers:o={}}=n||{};let l="";return t.nodesBetween(r,i,(a,u,c,d)=>{var f;a.isBlock&&u>r&&(l+=s);const h=o==null?void 0:o[a.type.name];if(h)return c&&(l+=h({node:a,pos:u,parent:c,index:d,range:e})),!1;a.isText&&(l+=(f=a==null?void 0:a.text)===null||f===void 0?void 0:f.slice(Math.max(r,u)-u,i-u))}),l}function O0(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const iE=Pe.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ke({key:new Mt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(c=>c.$from.pos)),l=Math.max(...s.map(c=>c.$to.pos)),a=O0(n);return T0(r,{from:o,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),sE=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),oE=(t=!1)=>({commands:e})=>e.setContent("",t),lE=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:u,mapping:c}=e,d=u.resolve(c.map(a)),f=u.resolve(c.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;const p=Si(h);if(l.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},aE=t=>e=>t(e),uE=()=>({state:t,dispatch:e})=>k0(t,e),cE=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new H(r.doc.resolve(Math.max(o-1,0)))),!0},dE=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const l=i.before(s),a=i.after(s);t.delete(l,a).scrollIntoView()}return!0}return!1},fE=t=>({tr:e,state:n,dispatch:r})=>{const i=De(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const a=s.before(o),u=s.after(o);e.delete(a,u).scrollIntoView()}return!0}return!1},hE=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},pE=()=>({state:t,dispatch:e})=>Cd(t,e),mE=()=>({commands:t})=>t.keyboardShortcut("Enter"),gE=()=>({state:t,dispatch:e})=>OC(t,e);function hl(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Td(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function D0(t,e,n={}){return t.find(r=>r.type===e&&hl(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function ip(t,e,n={}){return!!D0(t,e,n)}function Kl(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(c=>c.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(c=>c.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!D0([...i.node.marks],e,n)))return;let o=i.index,l=t.start()+i.offset,a=o+1,u=l+i.node.nodeSize;for(;o>0&&ip([...t.parent.child(o-1).marks],e,n);)o-=1,l-=t.parent.child(o).nodeSize;for(;a<t.parent.childCount&&ip([...t.parent.child(a).marks],e,n);)u+=t.parent.child(a).nodeSize,a+=1;return{from:l,to:u}}function Qn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const yE=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=Qn(t,r.schema),{doc:o,selection:l}=n,{$from:a,from:u,to:c}=l;if(i){const d=Kl(a,s,e);if(d&&d.from<=u&&d.to>=c){const f=H.create(o,d.from,d.to);n.setSelection(f)}}return!0},vE=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function P0(t){return t instanceof H}function ar(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function A0(t,e=null){if(!e)return null;const n=W.atStart(t),r=W.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?H.create(t,ar(0,i,s),ar(t.content.size,i,s)):H.create(t,ar(e,i,s),ar(e,i,s))}function tc(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function bs(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function xE(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const SE=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(bs()||tc())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),xE()&&!bs()&&!tc()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!P0(n.state.selection))return o(),!0;const l=A0(i.doc,t)||n.state.selection,a=n.state.selection.eq(l);return s&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},kE=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),wE=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),I0=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&I0(r)}return t};function ho(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return I0(n)}function Ms(t,e,n){if(t instanceof rn||t instanceof O)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return O.fromArray(t.map(l=>e.nodeFromJSON(l)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),Ms("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,l="";const a=new hy({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(o=!0,l=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?zn.fromSchema(a).parseSlice(ho(t),n.parseOptions):zn.fromSchema(a).parse(ho(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=zn.fromSchema(e);return n.slice?s.parseSlice(ho(t),n.parseOptions).content:s.parse(ho(t),n.parseOptions)}return Ms("",e,n)}function CE(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof me||i instanceof Te))return;const s=t.mapping.maps[r];let o=0;s.forEach((l,a,u,c)=>{o===0&&(o=c)}),t.setSelection(W.near(t.doc.resolve(o),n))}const EE=t=>!("type"in t),NE=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=x=>{s.emit("contentError",{editor:s,error:x,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Ms(e,s.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(x){a(x)}try{l=Ms(e,s.schema,{parseOptions:u,errorOnInvalidContent:(o=n.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(x){return a(x),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((EE(l)?l:[l]).forEach(x=>{x.check(),f=f?x.isText&&x.marks.length===0:!1,h=h?x.isBlock:!1}),c===d&&h){const{parent:x}=r.doc.resolve(c);x.isTextblock&&!x.type.spec.code&&!x.childCount&&(c-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(x=>x.text||"").join("");else if(e instanceof O){let x="";e.forEach(g=>{g.text&&(x+=g.text)}),m=x}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,c,d)}else m=l,r.replaceWith(c,d,m);n.updateSelection&&CE(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},bE=()=>({state:t,dispatch:e})=>bC(t,e),ME=()=>({state:t,dispatch:e})=>MC(t,e),TE=()=>({state:t,dispatch:e})=>p0(t,e),OE=()=>({state:t,dispatch:e})=>v0(t,e),DE=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Rl(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},PE=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Rl(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},AE=()=>({state:t,dispatch:e})=>EC(t,e),IE=()=>({state:t,dispatch:e})=>NC(t,e);function R0(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function RE(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))bs()||R0()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const LE=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=RE(t).split(/-(?!$)/),o=s.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,l))});return a==null||a.steps.forEach(u=>{const c=u.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function Ts(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?De(e,t.schema):null,l=[];t.doc.nodesBetween(r,i,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(i,f+d.nodeSize);l.push({node:d,from:h,to:p})});const a=i-r,u=l.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>hl(d.node.attrs,n,{strict:!1}));return s?!!u.length:u.reduce((d,f)=>d+f.to-f.from,0)>=a}const jE=(t,e={})=>({state:n,dispatch:r})=>{const i=De(t,n.schema);return Ts(n,i,e)?TC(n,r):!1},zE=()=>({state:t,dispatch:e})=>w0(t,e),BE=t=>({state:e,dispatch:n})=>{const r=De(t,e.schema);return _C(r)(e,n)},FE=()=>({state:t,dispatch:e})=>S0(t,e);function Jl(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function sp(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const _E=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const l=Jl(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(s=De(t,r.schema)),l==="mark"&&(o=Qn(t,r.schema)),i&&n.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(u,c)=>{s&&s===u.type&&n.setNodeMarkup(c,void 0,sp(u.attrs,e)),o&&u.marks.length&&u.marks.forEach(d=>{o===d.type&&n.addMark(c,c+u.nodeSize,o.create(sp(d.attrs,e)))})})}),!0):!1},$E=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),VE=()=>({tr:t,dispatch:e})=>{if(e){const n=new ft(t.doc);t.setSelection(n)}return!0},UE=()=>({state:t,dispatch:e})=>g0(t,e),HE=()=>({state:t,dispatch:e})=>x0(t,e),WE=()=>({state:t,dispatch:e})=>AC(t,e),KE=()=>({state:t,dispatch:e})=>LC(t,e),JE=()=>({state:t,dispatch:e})=>RC(t,e);function nc(t,e,n={},r={}){return Ms(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const qE=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{var a,u;const{doc:c}=s;if(n.preserveWhitespace!=="full"){const d=nc(t,i.schema,n,{errorOnInvalidContent:(a=r.errorOnInvalidContent)!==null&&a!==void 0?a:i.options.enableContentCheck});return o&&s.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!e),!0}return o&&s.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:c.content.size},t,{parseOptions:n,errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck})};function L0(t,e){const n=Qn(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function GE(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function QE(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Od(t){return e=>QE(e.$from,t)}function YE(t,e){const n=lr.resolve(t);return M0(n,e)}function XE(t,e){const n=YE(e),r=rn.fromJSON(n,t);return Ul(r.content,n)}function ZE(t,e){const n={from:0,to:t.content.size};return T0(t,n,e)}function eN(t,e){const n=De(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,l=>{s.push(l)});const o=s.reverse().find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function tN(t,e){const n=Jl(typeof e=="string"?e:e.name,t.schema);return n==="node"?eN(t,e):n==="mark"?L0(t,e):{}}function j0(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=Kl(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function Oo(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function rc(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?Qn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>hl(d.attrs,n,{strict:!1}));let o=0;const l=[];if(i.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;t.doc.nodesBetween(h,p,(m,x)=>{if(!m.isText&&!m.marks.length)return;const g=Math.max(h,x),v=Math.min(p,x+m.nodeSize),S=v-g;o+=S,l.push(...m.marks.map(w=>({mark:w,from:g,to:v})))})}),o===0)return!1;const a=l.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>hl(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),u=l.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+u:a)>=o}function nN(t,e,n={}){if(!e)return Ts(t,null,n)||rc(t,null,n);const r=Jl(e,t.schema);return r==="node"?Ts(t,e,n):r==="mark"?rc(t,e,n):!1}function op(t,e){const{nodeExtensions:n}=Vl(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=K(L(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function ql(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(ql(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function rN(t){return t instanceof F}function iN(t,e,n){var r;const{selection:i}=e;let s=null;if(P0(i)&&(s=i.$cursor),s){const l=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(l)||!l.some(a=>a.type.excludes(n))}const{ranges:o}=i;return o.some(({$from:l,$to:a})=>{let u=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(c,d,f)=>{if(u)return!1;if(c.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(c.marks)||!c.marks.some(m=>m.type.excludes(n));u=h&&p}return!u}),u})}const sN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:l}=s,a=Qn(t,r.schema);if(i)if(o){const u=L0(r,a);n.addStoredMark(a.create({...u,...e}))}else l.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;r.doc.nodesBetween(c,d,(f,h)=>{const p=Math.max(h,c),m=Math.min(h+f.nodeSize,d);f.marks.find(g=>g.type===a)?f.marks.forEach(g=>{a===g.type&&n.addMark(p,m,a.create({...g.attrs,...e}))}):n.addMark(p,m,a.create(e))})});return iN(r,n,a)},oN=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),lN=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=De(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:l})=>ep(s,{...o,...e})(n)?!0:l.clearNodes()).command(({state:l})=>ep(s,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},aN=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=ar(t,0,r.content.size),s=F.create(r,i);e.setSelection(s)}return!0},uN=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=H.atStart(r).from,l=H.atEnd(r).to,a=ar(i,o,l),u=ar(s,o,l),c=H.create(r,a,u);e.setSelection(c)}return!0},cN=t=>({state:e,dispatch:n})=>{const r=De(t,e.schema);return UC(r)(e,n)};function lp(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}const dN=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:l,$to:a}=s,u=i.extensionManager.attributes,c=Oo(u,l.node().type.name,l.node().attrs);if(s instanceof F&&s.node.isBlock)return!l.parentOffset||!sn(o,l.pos)?!1:(r&&(t&&lp(n,i.extensionManager.splittableMarks),e.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:GE(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:c}]:void 0,p=sn(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&sn(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:c}]:void 0),r){if(p&&(s instanceof H&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const m=e.mapping.map(l.before()),x=e.doc.resolve(m);l.node(-1).canReplaceWith(x.index(),x.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&lp(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},fN=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const l=De(t,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=s.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(i){let g=O.empty;const v=a.index(-1)?1:a.index(-2)?2:3;for(let M=a.depth-v;M>=a.depth-3;M-=1)g=O.from(a.node(M).copy(g));const S=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,w={...Oo(f,a.node().type.name,a.node().attrs),...e},E=((o=l.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(w))||void 0;g=g.append(O.from(l.createAndFill(null,E)||void 0));const b=a.before(a.depth-(v-1));n.replace(b,a.after(-S),new I(g,4-v,0));let C=-1;n.doc.nodesBetween(b,n.doc.content.size,(M,_)=>{if(C>-1)return!1;M.isTextblock&&M.content.size===0&&(C=_+1)}),C>-1&&n.setSelection(H.near(n.doc.resolve(C))),n.scrollIntoView()}return!0}const h=u.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...Oo(f,d.type.name,d.attrs),...e},m={...Oo(f,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,u.pos);const x=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!sn(n.doc,a.pos,2))return!1;if(i){const{selection:g,storedMarks:v}=r,{splittableMarks:S}=s.extensionManager,w=v||g.$to.parentOffset&&g.$from.marks();if(n.split(a.pos,2,x).scrollIntoView(),!w||!i)return!0;const E=w.filter(b=>S.includes(b.type.name));n.ensureMarks(E)}return!0},Ba=(t,e)=>{const n=Od(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&qn(t.doc,n.pos)&&t.join(n.pos),!0},Fa=(t,e)=>{const n=Od(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&qn(t.doc,r)&&t.join(r),!0},hN=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:u,can:c})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=De(t,o.schema),p=De(e,o.schema),{selection:m,storedMarks:x}=o,{$from:g,$to:v}=m,S=g.blockRange(v),w=x||m.$to.parentOffset&&m.$from.marks();if(!S)return!1;const E=Od(b=>op(b.type.name,d))(m);if(S.depth>=1&&E&&S.depth-E.depth<=1){if(E.node.type===h)return u.liftListItem(p);if(op(E.node.type.name,d)&&h.validContent(E.node.content)&&l)return a().command(()=>(s.setNodeMarkup(E.pos,h),!0)).command(()=>Ba(s,h)).command(()=>Fa(s,h)).run()}return!n||!w||!l?a().command(()=>c().wrapInList(h,r)?!0:u.clearNodes()).wrapInList(h,r).command(()=>Ba(s,h)).command(()=>Fa(s,h)).run():a().command(()=>{const b=c().wrapInList(h,r),C=w.filter(M=>f.includes(M.type.name));return s.ensureMarks(C),b?!0:u.clearNodes()}).wrapInList(h,r).command(()=>Ba(s,h)).command(()=>Fa(s,h)).run()},pN=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=Qn(t,r.schema);return rc(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},mN=(t,e,n={})=>({state:r,commands:i})=>{const s=De(t,r.schema),o=De(e,r.schema),l=Ts(r,s,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?i.setNode(o,a):i.setNode(s,{...a,...n})},gN=(t,e={})=>({state:n,commands:r})=>{const i=De(t,n.schema);return Ts(n,i,e)?r.lift(i):r.wrapIn(i,e)},yN=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,l=s.transform;for(let a=l.steps.length-1;a>=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(s.text){const a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,a))}else o.delete(s.from,s.to)}return!0}}return!1},vN=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},xN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=n,a=Qn(t,r.schema),{$from:u,empty:c,ranges:d}=l;if(!i)return!0;if(c&&o){let{from:f,to:h}=l;const p=(s=u.marks().find(x=>x.type===a))===null||s===void 0?void 0:s.attrs,m=Kl(u,a,p);m&&(f=m.from,h=m.to),n.removeMark(f,h,a)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,a)});return n.removeStoredMark(a),!0},SN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const l=Jl(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(s=De(t,r.schema)),l==="mark"&&(o=Qn(t,r.schema)),i&&n.selection.ranges.forEach(a=>{const u=a.$from.pos,c=a.$to.pos;let d,f,h,p;n.selection.empty?r.doc.nodesBetween(u,c,(m,x)=>{s&&s===m.type&&(h=Math.max(x,u),p=Math.min(x+m.nodeSize,c),d=x,f=m)}):r.doc.nodesBetween(u,c,(m,x)=>{x<u&&s&&s===m.type&&(h=Math.max(x,u),p=Math.min(x+m.nodeSize,c),d=x,f=m),x>=u&&x<=c&&(s&&s===m.type&&n.setNodeMarkup(x,void 0,{...m.attrs,...e}),o&&m.marks.length&&m.marks.forEach(g=>{if(o===g.type){const v=Math.max(x,u),S=Math.min(x+m.nodeSize,c);n.addMark(v,S,o.create({...g.attrs,...e}))}}))}),f&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(m=>{o===m.type&&n.addMark(h,p,o.create({...m.attrs,...e}))}))}),!0):!1},kN=(t,e={})=>({state:n,dispatch:r})=>{const i=De(t,n.schema);return jC(i,e)(n,r)},wN=(t,e={})=>({state:n,dispatch:r})=>{const i=De(t,n.schema);return zC(i,e)(n,r)};var CN=Object.freeze({__proto__:null,blur:sE,clearContent:oE,clearNodes:lE,command:aE,createParagraphNear:uE,cut:cE,deleteCurrentNode:dE,deleteNode:fE,deleteRange:hE,deleteSelection:pE,enter:mE,exitCode:gE,extendMarkRange:yE,first:vE,focus:SE,forEach:kE,insertContent:wE,insertContentAt:NE,joinBackward:TE,joinDown:ME,joinForward:OE,joinItemBackward:DE,joinItemForward:PE,joinTextblockBackward:AE,joinTextblockForward:IE,joinUp:bE,keyboardShortcut:LE,lift:jE,liftEmptyBlock:zE,liftListItem:BE,newlineInCode:FE,resetAttributes:_E,scrollIntoView:$E,selectAll:VE,selectNodeBackward:UE,selectNodeForward:HE,selectParentNode:WE,selectTextblockEnd:KE,selectTextblockStart:JE,setContent:qE,setMark:sN,setMeta:oN,setNode:lN,setNodeSelection:aN,setTextSelection:uN,sinkListItem:cN,splitBlock:dN,splitListItem:fN,toggleList:hN,toggleMark:pN,toggleNode:mN,toggleWrap:gN,undoInputRule:yN,unsetAllMarks:vN,unsetMark:xN,updateAttributes:SN,wrapIn:kN,wrapInList:wN});const EN=Pe.create({name:"commands",addCommands(){return{...CN}}}),NN=Pe.create({name:"drop",addProseMirrorPlugins(){return[new Ke({key:new Mt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),bN=Pe.create({name:"editable",addProseMirrorPlugins(){return[new Ke({key:new Mt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),MN=new Mt("focusEvents"),TN=Pe.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ke({key:MN,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),ON=Pe.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:u}=l,{empty:c,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,x=d.pos-d.parentOffset,g=m&&p.parent.childCount===1?x===d.pos:W.atStart(u).from===f;return!c||!h.type.isTextblock||h.textContent.length||!g||g&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return bs()||R0()?s:i},addProseMirrorPlugins(){return[new Ke({key:new Mt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),i=t.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:l}=e.selection,a=W.atStart(e.doc).from,u=W.atEnd(e.doc).to;if(s||!(o===a&&l===u)||!ql(n.doc))return;const f=n.tr,h=_l({state:n,transaction:f}),{commands:p}=new $l({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),DN=Pe.create({name:"paste",addProseMirrorPlugins(){return[new Ke({key:new Mt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),PN=Pe.create({name:"tabindex",addProseMirrorPlugins(){return[new Ke({key:new Mt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class tr{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You cant 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},e)}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 e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new tr(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new tr(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new tr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=this.pos+r+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(o);if(!i&&l.depth<=this.depth)return;const a=new tr(l,this.editor,i,i?n:null);i&&(a.actualDepth=this.depth+1),e.push(new tr(l,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let l=0;l<o.length;l+=1){const a=o[l];if(s[a]!==n[a])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(a=>n[a]===o.node.attrs[a])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const AN=`.ProseMirror {
position: relative;
}
.ProseMirror {
word-wrap: break-word;
white-space: pre-wrap;
white-space: break-spaces;
-webkit-font-variant-ligatures: none;
font-variant-ligatures: none;
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
}
.ProseMirror [contenteditable="false"] {
white-space: normal;
}
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
white-space: pre-wrap;
}
.ProseMirror pre {
white-space: pre-wrap;
}
img.ProseMirror-separator {
display: inline !important;
border: none !important;
margin: 0 !important;
width: 0 !important;
height: 0 !important;
}
.ProseMirror-gapcursor {
display: none;
pointer-events: none;
position: absolute;
margin: 0;
}
.ProseMirror-gapcursor:after {
content: "";
display: block;
position: absolute;
top: -2px;
width: 20px;
border-top: 1px solid black;
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}
@keyframes ProseMirror-cursor-blink {
to {
visibility: hidden;
}
}
.ProseMirror-hideselection *::selection {
background: transparent;
}
.ProseMirror-hideselection *::-moz-selection {
background: transparent;
}
.ProseMirror-hideselection * {
caret-color: transparent;
}
.ProseMirror-focused .ProseMirror-gapcursor {
display: block;
}
.tippy-box[data-animation=fade][data-state=hidden] {
opacity: 0
}`;function IN(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}let RN=class extends HC{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),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:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}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&&document&&(this.css=IN(AN,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){const r=b0(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let r=n;if([].concat(e).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;r=r.filter(l=>!l.key.startsWith(o))}),n.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,n;const i=[...this.options.enableCoreExtensions?[bN,iE.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),EN,TN,ON,PN,NN,DN].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new lr(i,this)}createCommandManager(){this.commandManager=new $l({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=nc(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(o){if(!(o instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(o.message))throw o;this.emit("contentError",{editor:this,error:o,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(l=>l.name!=="collaboration"),this.createExtensionManager()}}),n=nc(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=A0(n,this.options.autofocus);this.view=new d0(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:Qr.create({doc:n,selection:r||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const s=this.view.dom;s.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(o)});return}const n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return tN(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return nN(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ul(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
`,textSerializers:r={}}=e||{};return ZE(this.state.doc,{blockSeparator:n,textSerializers:{...O0(this.schema),...r}})}get isEmpty(){return ql(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new tr(n,this)}get $doc(){return this.$pos(0)}};function br(t){return new Hl({find:t.find,handler:({state:e,range:n,match:r})=>{const i=K(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),u=n.from+l.indexOf(o),c=u+o.length;if(j0(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>u).length)return null;c<n.to&&s.delete(c,n.to),u>n.from&&s.delete(n.from+a,u);const f=n.from+a+o.length;s.addMark(n.from+a,f,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function z0(t){return new Hl({find:t.find,handler:({state:e,range:n,match:r})=>{const i=K(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let l=n.to;const a=t.type.create(i);if(r[1]){const u=r[0].lastIndexOf(r[1]);let c=o+u;c>l?c=l:l=c+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,o+r[0].length-1),s.replaceWith(c,l,a)}else if(r[0]){const u=t.type.isInline?o:o-1;s.insert(u,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()}})}function ic(t){return new Hl({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=K(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)}})}function Os(t){return new Hl({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=K(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),a=o.doc.resolve(n.from).blockRange(),u=a&&fd(a,t.type,s);if(!u)return null;if(o.wrap(a,u),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(x=>h.includes(x.type.name));o.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const c=o.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&qn(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&o.join(n.from-1)}})}class Ye{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=K(L(this,"addOptions",{name:this.name}))),this.storage=K(L(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ye(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Wl(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Ye(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=K(L(n,"addOptions",{name:n.name})),n.storage=K(L(n,"addStorage",{name:n.name,options:n.options})),n}}class LN{constructor(e,n,r){this.isDragging=!1,this.component=e,this.editor=n.editor,this.options={stopEvent:null,ignoreMutation:null,...r},this.extension=n.extension,this.node=n.node,this.decorations=n.decorations,this.innerDecorations=n.innerDecorations,this.view=n.view,this.HTMLAttributes=n.HTMLAttributes,this.getPos=n.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var n,r,i,s,o,l,a;const{view:u}=this.editor,c=e.target,d=c.nodeType===3?(n=c.parentElement)===null||n===void 0?void 0:n.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(c)||!d)return;let f=0,h=0;if(this.dom!==d){const v=this.dom.getBoundingClientRect(),S=d.getBoundingClientRect(),w=(i=e.offsetX)!==null&&i!==void 0?i:(s=e.nativeEvent)===null||s===void 0?void 0:s.offsetX,E=(o=e.offsetY)!==null&&o!==void 0?o:(l=e.nativeEvent)===null||l===void 0?void 0:l.offsetY;f=S.x-v.x+w,h=S.y-v.y+E}const p=this.dom.cloneNode(!0);(a=e.dataTransfer)===null||a===void 0||a.setDragImage(p,f,h);const m=this.getPos();if(typeof m!="number")return;const x=F.create(u.state.doc,m),g=u.state.tr.setSelection(x);u.dispatch(g)}stopEvent(e){var n;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});const r=e.target;if(!(this.dom.contains(r)&&!(!((n=this.contentDOM)===null||n===void 0)&&n.contains(r))))return!1;const s=e.type.startsWith("drag"),o=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!o&&!s)return!0;const{isEditable:a}=this.editor,{isDragging:u}=this,c=!!this.node.type.spec.draggable,d=F.isSelectable(this.node),f=e.type==="copy",h=e.type==="paste",p=e.type==="cut",m=e.type==="mousedown";if(!c&&d&&s&&e.target===this.dom&&e.preventDefault(),c&&s&&!u&&e.target===this.dom)return e.preventDefault(),!1;if(c&&a&&!u&&m){const x=r.closest("[data-drag-handle]");x&&(this.dom===x||this.dom.contains(x))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(u||o||f||h||p||m&&d)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type==="selection"||this.dom.contains(e.target)&&e.type==="childList"&&(bs()||tc())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(r=>r.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:n})=>{const r=this.getPos();return typeof r!="number"?!1:(n.setNodeMarkup(r,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){const e=this.getPos();if(typeof e!="number")return;const n=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:n})}}function Mr(t){return new XC({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=K(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,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(j0(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(x=>x===t.type&&x!==p.mark.type)).filter(p=>p.to>d).length)return null;f<n.to&&o.delete(f,n.to),d>n.from&&o.delete(n.from+c,d),u=n.from+c+l.length,o.addMark(n.from+c,u,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}function jN(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof F){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}const zN=/^\s*>\s$/,BN=Ye.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Se(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Os({find:zN,type:this.type})]}}),FN=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_N=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,$N=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,VN=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,UN=bt.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Se(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[br({find:FN,type:this.type}),br({find:$N,type:this.type})]},addPasteRules(){return[Mr({find:_N,type:this.type}),Mr({find:VN,type:this.type})]}}),HN="listItem",ap="textStyle",up=/^\s*([-+*])\s$/,WN=Ye.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:t}){return["ul",Se(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(HN,this.editor.getAttributes(ap)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Os({find:up,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Os({find:up,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ap),editor:this.editor})),[t]}}),KN=/(^|[^`])`([^`]+)`(?!`)/,JN=/(^|[^`])`([^`]+)`(?!`)/g,qN=bt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Se(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[br({find:KN,type:this.type})]},addPasteRules(){return[Mr({find:JN,type:this.type})]}}),GN=/^```([a-z]+)?[\s\n]$/,QN=/^~~~([a-z]+)?[\s\n]$/,YN=Ye.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,s=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Se(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
`);return!s||!o?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:u})=>(u.setSelection(W.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[ic({find:GN,type:this.type,getAttributes:t=>({language:t[1]})}),ic({find:QN,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ke({key:new Mt("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i==null?void 0:i.mode;if(!n||!s)return!1;const{tr:o,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
`));return o.replaceSelectionWith(this.type.create({language:s},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(H.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),XN=Ye.create({name:"doc",topNode:!0,content:"block+"});function ZN(t={}){return new Ke({view(e){return new eb(e,t)}})}class eb{constructor(e,n){var r;this.editorView=e,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(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let x=this.width/2*l;r={left:p.left,right:p.right,top:m-x,bottom:m+x}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;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,h=d.height/a.offsetHeight;u=d.left-a.scrollLeft*f,c=d.top-a.scrollTop*h}this.element.style.left=(r.left-u)/o+"px",this.element.style.top=(r.top-c)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Ey(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const tb=Pe.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[ZN(this.options)]}});class de extends W{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return de.valid(r)?new de(r):W.near(r)}content(){return I.empty}eq(e){return e instanceof de&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new de(e.resolve(n.pos))}getBookmark(){return new Dd(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!nb(e)||!rb(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&de.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let a=e.doc.resolve(i);if(de.valid(a))return a}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!F.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let l=e.doc.resolve(i);if(de.valid(l))return l}return null}}}de.prototype.visible=!1;de.findFrom=de.findGapCursorFrom;W.jsonID("gapcursor",de);class Dd{constructor(e){this.pos=e}map(e){return new Dd(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return de.valid(n)?new de(n):W.near(n)}}function B0(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function nb(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||B0(i.type))return!0;if(i.inlineContent)return!1}}return!0}function rb(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||B0(i.type))return!0;if(i.inlineContent)return!1}}return!0}function ib(){return new Ke({props:{decorations:ab,createSelectionBetween(t,e,n){return e.pos==n.pos&&de.valid(n)?new de(n):null},handleClick:ob,handleKeyDown:sb,handleDOMEvents:{beforeinput:lb}}})}const sb=f0({ArrowLeft:po("horiz",-1),ArrowRight:po("horiz",1),ArrowUp:po("vert",-1),ArrowDown:po("vert",1)});function po(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof H){if(!s.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let u=de.findGapCursorFrom(l,e,a);return u?(i&&i(r.tr.setSelection(new de(u))),!0):!1}}function ob(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!de.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&F.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new de(r))),!0)}function lb(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof de))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=O.empty;for(let o=r.length-1;o>=0;o--)i=O.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new I(i,0,0));return s.setSelection(H.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function ab(t){if(!(t.selection instanceof de))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ge.create(t.doc,[ct.widget(t.selection.head,e,{key:"gapcursor"})])}const ub=Pe.create({name:"gapCursor",addProseMirrorPlugins(){return[ib()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=K(L(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),cb=Ye.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Se(this.options.HTMLAttributes,t)]},renderText(){return`
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&a&&o){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()}}}),db=Ye.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(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Se(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>ic({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var pl=200,Oe=function(){};Oe.prototype.append=function(e){return e.length?(e=Oe.from(e),!this.length&&e||e.length<pl&&this.leafAppend(e)||this.length<pl&&e.leafPrepend(this)||this.appendInner(e)):this};Oe.prototype.prepend=function(e){return e.length?Oe.from(e).append(this):this};Oe.prototype.appendInner=function(e){return new fb(this,e)};Oe.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Oe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Oe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Oe.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Oe.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};Oe.from=function(e){return e instanceof Oe?e:e&&e.length?new F0(e):Oe.empty};var F0=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=pl)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=pl)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Oe);Oe.empty=new F0([]);var fb=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Oe);const hb=500;class Rt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,l,a,u=[],c=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,c.push(d);return}if(i){c.push(new $t(d.map));let h=d.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],u.push(new $t(p,void 0,void 0,u.length+c.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return l=i?d.selection.map(i.slice(s)):d.selection,a=new Rt(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,n,r,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),f=new $t(e.mapping.maps[c],d,n),h;(h=a&&a.merge(f))&&(f=h,c?s.pop():l=l.slice(0,l.length-1)),s.push(f),n&&(o++,n=void 0),i||(a=f)}let u=o-r.depth;return u>mb&&(l=pb(l,u),o-=u),new Rt(l.append(s),o)}remapping(e,n){let r=new ks;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Rt(this.items.append(e.map(n=>new $t(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=n;this.items.forEach(f=>{let h=s.getMirror(--a);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),x=f.selection&&f.selection.map(s.slice(a+1,h));x&&l++,r.push(new $t(p,m,x))}else r.push(new $t(p))},i);let u=[];for(let f=n;f<o;f++)u.push(new $t(s.maps[f]));let c=this.items.slice(0,i).append(u).append(r),d=new Rt(c,l);return d.emptyItemCount()>hb&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(n.slice(r)),u=a&&a.getMap();if(r--,u&&n.appendMap(u,r),a){let c=o.selection&&o.selection.map(n.slice(r));c&&s++;let d=new $t(u.invert(),a,c),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else o.map&&r--},this.items.length,0),new Rt(Oe.from(i.reverse()),s)}}Rt.empty=new Rt(Oe.empty,0);function pb(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class $t{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new $t(n.getMap().invert(),n,this.selection)}}}class xn{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const mb=20;function gb(t,e,n,r){let i=n.getMeta(gr),s;if(i)return i.historyState;n.getMeta(xb)&&(t=new xn(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(gr))return o.getMeta(gr).redo?new xn(t.done.addTransform(n,void 0,r,Do(e)),t.undone,cp(n.mapping.maps),t.prevTime,t.prevComposition):new xn(t.done,t.undone.addTransform(n,void 0,r,Do(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!o&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!yb(n,t.prevRanges)),u=o?_a(t.prevRanges,n.mapping):cp(n.mapping.maps);return new xn(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Do(e)),Rt.empty,u,n.time,l??t.prevComposition)}else return(s=n.getMeta("rebased"))?new xn(t.done.rebased(n,s),t.undone.rebased(n,s),_a(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new xn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),_a(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function yb(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function cp(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function _a(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function vb(t,e,n){let r=Do(e),i=gr.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),a=new xn(n?l:s.remaining,n?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(gr,{redo:n,historyState:a})}let $a=!1,dp=null;function Do(t){let e=t.plugins;if(dp!=e){$a=!1,dp=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){$a=!0;break}}return $a}const gr=new Mt("history"),xb=new Mt("closeHistory");function Sb(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ke({key:gr,state:{init(){return new xn(Rt.empty,Rt.empty,null,0,-1)},apply(e,n,r){return gb(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?$0:r=="historyRedo"?V0:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function _0(t,e){return(n,r)=>{let i=gr.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=vb(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const $0=_0(!1,!0),V0=_0(!0,!0),kb=Pe.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>$0(t,e),redo:()=>({state:t,dispatch:e})=>V0(t,e)}},addProseMirrorPlugins(){return[Sb(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()}}}),wb=Ye.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Se(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!jN(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$from:r,$to:i}=n,s=t();return r.parentOffset===0?s.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):rN(n)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:o,dispatch:l})=>{var a;if(l){const{$to:u}=o.selection,c=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(H.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(F.create(o.doc,u.pos)):o.setSelection(H.create(o.doc,u.pos));else{const d=(a=u.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();d&&(o.insert(c,d),o.setSelection(H.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[z0({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Cb=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Eb=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Nb=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,bb=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Mb=bt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Se(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[br({find:Cb,type:this.type}),br({find:Nb,type:this.type})]},addPasteRules(){return[Mr({find:Eb,type:this.type}),Mr({find:bb,type:this.type})]}}),Tb=Ye.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Se(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Ob="listItem",fp="textStyle",hp=/^(\d+)\.\s$/,Db=Ye.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:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Se(this.options.HTMLAttributes,n),0]:["ol",Se(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Ob,this.editor.getAttributes(fp)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Os({find:hp,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Os({find:hp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(fp)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Pb=Ye.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Se(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Ab=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ib=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Rb=bt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Se(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[br({find:Ab,type:this.type})]},addPasteRules(){return[Mr({find:Ib,type:this.type})]}}),Lb=Ye.create({name:"text",group:"inline"}),Pd=Pe.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(UN.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(BN.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(WN.configure(this.options.bulletList)),this.options.code!==!1&&t.push(qN.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(YN.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(XN.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(tb.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(ub.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(cb.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(db.configure(this.options.heading)),this.options.history!==!1&&t.push(kb.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(wb.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(Mb.configure(this.options.italic)),this.options.listItem!==!1&&t.push(Tb.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(Db.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(Pb.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(Rb.configure(this.options.strike)),this.options.text!==!1&&t.push(Lb.configure(this.options.text)),t}}),Ad=bt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Se(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),jb=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Id=Ye.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Se(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[z0({find:jb,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),U0=Pe.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),zb=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Bb=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,H0=bt.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",Se(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[br({find:zb,type:this.type})]},addPasteRules(){return[Mr({find:Bb,type:this.type})]}}),Fb=[Pd,Ad,Id,U0.configure({types:["heading","paragraph"]}),H0.configure({multicolor:!0})],_b=`
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: Georgia, "Times New Roman", serif;
font-size: 12pt;
line-height: 1.8;
color: #111;
max-width: 6.5in;
margin: 0 auto;
padding: 1in;
}
h1 {
font-size: 18pt;
margin-top: 2em;
margin-bottom: 0.5em;
page-break-before: always;
padding-bottom: 0.25em;
border-bottom: 1px solid #ccc;
}
h1.story-title { page-break-before: avoid; }
h2 { font-size: 14pt; margin-top: 1.5em; margin-bottom: 0.4em; }
h3 { font-size: 12pt; font-style: italic; margin-top: 1em; margin-bottom: 0.3em; }
p { margin-bottom: 0.4em; text-indent: 1.5em; }
h1+p, h2+p, h3+p { text-indent: 0; }
blockquote {
border-left: 3px solid #aaa;
padding-left: 1em;
margin: 1em 0;
font-style: italic;
color: #444;
}
img { max-width: 100%; }
ul, ol { padding-left: 1.5em; margin: 0.5em 0; }
hr { border: none; text-align: center; margin: 1.5em 0; }
hr::after { content: '✦ ✦ ✦'; letter-spacing: 0.5em; color: #888; font-size: 10pt; }
mark { border-radius: 2px; padding: 0.05em 0.15em; }
s { opacity: 0.6; }
@page { margin: 1in; }
@media print {
body { padding: 0; max-width: 100%; }
}
`;function $b(t,e){let n="";if(e&&Object.keys(e).length>0)try{n=XE(e,Fb)}catch{n="<p>(Could not render content)</p>"}const r=window.open("","_blank");if(!r){alert("Allow pop-ups to export as PDF.");return}r.document.write(`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>${t}</title>
<style>${_b}</style>
</head>
<body>
<h1 class="story-title">${t}</h1>
${n}
</body>
</html>`),r.document.close(),r.addEventListener("load",()=>{r.focus(),r.print()})}function W0(t){return t?t.type==="text"?t.text||"":(t.content||[]).map(W0).join(" "):""}function pp(t){return!t||typeof t!="object"?0:W0(t).trim().split(/\s+/).filter(e=>e.length>0).length}const K0="sw-milestones",Vb=[500,1e3,5e3,1e4,25e3,5e4,1e5],Ub={500:"500 words — you're off!",1e3:"1,000 words — a great start!",5e3:"5,000 words — keep going!",1e4:"10,000 words — you're flying!",25e3:"25,000 words — incredible!",5e4:"50,000 words — a whole novel!",1e5:"100,000 words — legendary!"};function Hb(){try{return JSON.parse(localStorage.getItem(K0))||{}}catch{return{}}}function Wb(t,e){const n=Hb(),r=new Set(n[t]||[]);for(const i of Vb)if(e>=i&&!r.has(i))return r.add(i),n[t]=[...r],localStorage.setItem(K0,JSON.stringify(n)),Ub[i];return null}function Kb(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var J0={exports:{}},Va={};/**
* @license React
* use-sync-external-store-shim.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var mp;function Jb(){if(mp)return Va;mp=1;var t=be;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function l(d,f){var h=f(),p=r({inst:{value:h,getSnapshot:f}}),m=p[0].inst,x=p[1];return s(function(){m.value=h,m.getSnapshot=f,a(m)&&x({inst:m})},[d,h,f]),i(function(){return a(m)&&x({inst:m}),d(function(){a(m)&&x({inst:m})})},[d]),o(h),h}function a(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function u(d,f){return f()}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:l;return Va.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:c,Va}J0.exports=Jb();var Rd=J0.exports;const qb=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},Gb=({contentComponent:t})=>{const e=Rd.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return be.createElement(be.Fragment,null,Object.values(e))};function Qb(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:Ox.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}class Yb extends be.Component{constructor(e){var n;super(e),this.editorContentRef=be.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((n=e.editor)===null||n===void 0)&&n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.options.element.childNodes),e.setOptions({element:n}),e.contentComponent=Qb(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;const n=document.createElement("div");n.append(...e.options.element.childNodes),e.setOptions({element:n})}render(){const{editor:e,innerRef:n,...r}=this.props;return be.createElement(be.Fragment,null,be.createElement("div",{ref:qb(n,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&be.createElement(Gb,{contentComponent:e.contentComponent}))}}const Xb=k.forwardRef((t,e)=>{const n=be.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return be.createElement(Yb,{key:n,innerRef:e,...t})}),q0=be.memo(Xb);var Zb=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;for(i of e.entries())if(!t(i[1],n.get(i[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(e[i]!==n[i])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var o=s[i];if(!(o==="_owner"&&e.$$typeof)&&!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n},eM=Kb(Zb),G0={exports:{}},Ua={};/**
* @license React
* use-sync-external-store-shim/with-selector.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var gp;function tM(){if(gp)return Ua;gp=1;var t=be,e=Rd;function n(u,c){return u===c&&(u!==0||1/u===1/c)||u!==u&&c!==c}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,l=t.useMemo,a=t.useDebugValue;return Ua.useSyncExternalStoreWithSelector=function(u,c,d,f,h){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=l(function(){function g(b){if(!v){if(v=!0,S=b,b=f(b),h!==void 0&&m.hasValue){var C=m.value;if(h(C,b))return w=C}return w=b}if(C=w,r(S,b))return C;var M=f(b);return h!==void 0&&h(C,M)?C:(S=b,w=M)}var v=!1,S,w,E=d===void 0?null:d;return[function(){return g(c())},E===null?void 0:function(){return g(E())}]},[c,d,f,h]);var x=i(u,p[0],p[1]);return o(function(){m.hasValue=!0,m.value=x},[x]),a(x),x},Ua}G0.exports=tM();var nM=G0.exports;const rM=typeof window<"u"?k.useLayoutEffect:k.useEffect;class iM{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 n=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},r=this.editor;return r.on("transaction",n),()=>{r.off("transaction",n)}}}}function sM(t){var e;const[n]=k.useState(()=>new iM(t.editor)),r=nM.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:eM);return rM(()=>n.watch(t.editor),[t.editor,n]),k.useDebugValue(r),r}const oM=!1,sc=typeof window>"u",lM=sc||!!(typeof window<"u"&&window.next);class Ld{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,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(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?sc||lM?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)===null||s===void 0?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)===null||s===void 0?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)===null||s===void 0?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)===null||s===void 0?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)===null||s===void 0?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)===null||s===void 0?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)===null||s===void 0?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)===null||s===void 0?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)===null||s===void 0?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)===null||s===void 0?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)===null||s===void 0?void 0:s.call(i,...r)}};return new RN(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,s)=>{var o;return i===((o=n.extensions)===null||o===void 0?void 0:o[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Ld.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function Q0(t={},e=[]){const n=k.useRef(t);n.current=t;const[r]=k.useState(()=>new Ld(n)),i=Rd.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return k.useDebugValue(i),k.useEffect(r.onRender(e)),sM({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&s===0?0:s+1}),i}const aM=k.createContext({editor:null});aM.Consumer;const Y0=k.createContext({onDragStart:void 0}),uM=()=>k.useContext(Y0),cM=be.forwardRef((t,e)=>{const{onDragStart:n}=uM(),r=t.as||"div";return be.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function yp(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function vp(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function dM(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function fM(t){if(yp(t)||vp(t))return!0;if(dM(t)){const e=t.type;if(e)return yp(e)||vp(e)}return!1}function hM(){try{if(k.version)return parseInt(k.version.split(".")[0],10)>=19}catch{}return!1}class pM{constructor(e,{editor:n,props:r={},as:i="div",className:s=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=n,this.props=r,this.element=document.createElement(i),this.element.classList.add("react-renderer"),s&&this.element.classList.add(...s.split(" ")),this.editor.isInitialized?Pl.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var e;const n=this.component,r=this.props,i=this.editor,s=hM(),o=fM(n),l={...r};l.ref&&!(s||o)&&delete l.ref,!l.ref&&(s||o)&&(l.ref=a=>{this.ref=a}),this.reactElement=be.createElement(n,{...l}),(e=i==null?void 0:i.contentComponent)===null||e===void 0||e.setRenderer(this.id,this)}updateProps(e={}){this.props={...this.props,...e},this.render()}destroy(){var e;const n=this.editor;(e=n==null?void 0:n.contentComponent)===null||e===void 0||e.removeRenderer(this.id)}updateAttributes(e){Object.keys(e).forEach(n=>{this.element.setAttribute(n,e[n])})}}class mM extends LN{constructor(e,n,r){if(super(e,n,r),!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const i=this.dom.querySelector("[data-node-view-content]");if(!i)return;i.appendChild(this.contentDOMElement)}}mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(u={})=>this.updateAttributes(u),deleteNode:()=>this.deleteNode(),ref:k.createRef()};if(!this.component.displayName){const u=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=u(this.extension.name)}const i={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:u=>{u&&this.contentDOMElement&&u.firstChild!==this.contentDOMElement&&(u.hasAttribute("data-node-view-wrapper")&&u.removeAttribute("data-node-view-wrapper"),u.appendChild(this.contentDOMElement))}},s=this.component,o=k.memo(u=>be.createElement(Y0.Provider,{value:i},k.createElement(s,u)));o.displayName="ReactNodeView";let l=this.node.isInline?"span":"div";this.options.as&&(l=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new pM(o,{editor:this.editor,props:e,as:l,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var e;if(this.renderer.element.firstElementChild&&!(!((e=this.renderer.element.firstElementChild)===null||e===void 0)&&e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:e,to:n}=this.editor.state.selection,r=this.getPos();if(typeof r=="number")if(e<=r&&n>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,n,r){const i=s=>{this.renderer.updateProps(s),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const s=this.node,o=this.decorations,l=this.innerDecorations;return this.node=e,this.decorations=n,this.innerDecorations=r,this.options.update({oldNode:s,oldDecorations:o,newNode:e,newDecorations:n,oldInnerDecorations:l,innerDecorations:r,updateProps:()=>i({node:e,decorations:n,innerDecorations:r})})}return e===this.node&&this.decorations===n&&this.innerDecorations===r||(this.node=e,this.decorations=n,this.innerDecorations=r,i({node:e,decorations:n,innerDecorations:r})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const n=this.editor.extensionManager.attributes,r=fl(this.node,n);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}}function X0(t,e){return n=>n.editor.contentComponent?new mM(t,n,e):{}}const Z0=Pe.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Ke({key:new Mt("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!n)return null;const s=this.editor.isEmpty;return t.descendants((o,l)=>{const a=r>=l&&r<=l+o.nodeSize,u=!o.isLeaf&&ql(o);if((a||!this.options.showOnlyCurrent)&&u){const c=[this.options.emptyNodeClass];s&&c.push(this.options.emptyEditorClass);const d=ct.node(l,l+o.nodeSize,{class:c.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:a}):this.options.placeholder});i.push(d)}return this.options.includeChildren}),ge.create(t,i)}}})]}}),gM=Pe.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Ke({key:new Mt("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit;if(i==null||i===0){t=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const o=s-i,l=0,a=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(l,a);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=s-r,u=l-a,c=l;return e.deleteRange(u,c),!(this.storage.characters({node:e.doc})>r)}})]}});function yM(t,e,n){const r=[],i=[];return t.nodesBetween(e,n,(s,o)=>{if(s.isText){for(let l=0;l<s.text.length;l++){const a=o+l;a>=e&&a<n&&(r.push(s.text[l]),i.push(a))}return!1}s.isBlock&&r.length>0&&r[r.length-1]!==`
`&&(r.push(`
`),i.push(null))}),{text:r.join(""),posMap:i}}function vM(t,e,n){if(n<0||n>=t.length||!/\w/.test(t[n]))return{pmFrom:null,pmTo:null};let r=n;for(;r>0&&/\w/.test(t[r-1]);)r--;let i=n;for(;i<t.length&&/\w/.test(t[i]);)i++;if(r===i)return{pmFrom:null,pmTo:null};let s=null,o=null;for(let l=r;l<i;l++)e[l]!==null&&(s===null&&(s=e[l]),o=e[l]+1);return{pmFrom:s,pmTo:o}}function xM(t,e,n){const r=n.startOffset;let i=r+n.text.length;for(;i>r&&!/\w/.test(t[i-1]);)i--;let s=null,o=null;for(let l=r;l<i&&l<e.length;l++)e[l]!==null&&(s===null&&(s=e[l]),o=e[l]+1);return{pmFrom:s,pmTo:o}}function SM({editor:t,onImageUpload:e,fontSize:n,onFontSizeChange:r,onLint:i,lintStatus:s,lintCount:o,applyReadingMark:l,clearReadingMark:a}){const u=k.useRef(),[c,d]=k.useState(!1),f=k.useRef(!1),[h,p]=k.useState([]),[m,x]=k.useState(()=>localStorage.getItem("sw-tts-voice")||""),[g,v]=k.useState(()=>parseFloat(localStorage.getItem("sw-tts-rate")||"1")),[S,w]=k.useState(!1),E=k.useCallback(()=>{var $;const A=(($=window.speechSynthesis)==null?void 0:$.getVoices())??[];A.length&&(p(A),x(ee=>{if(ee&&A.find(pe=>pe.voiceURI===ee))return ee;const he=A.find(pe=>!pe.name.toLowerCase().includes("espeak")&&pe.lang.startsWith("en"))||A.find(pe=>pe.lang.startsWith("en"))||A[0];return he?he.voiceURI:""}))},[]);k.useEffect(()=>(E(),window.speechSynthesis.addEventListener("voiceschanged",E),()=>window.speechSynthesis.removeEventListener("voiceschanged",E)),[E]),k.useEffect(()=>{localStorage.setItem("sw-tts-voice",m)},[m]),k.useEffect(()=>{localStorage.setItem("sw-tts-rate",g)},[g]);const b=k.useRef(m),C=k.useRef(g);k.useEffect(()=>{b.current=m},[m]),k.useEffect(()=>{C.current=g},[g]);const[M,_]=k.useState(!1),N=k.useRef(!1),T=k.useRef(null);k.useEffect(()=>{N.current=M},[M]),k.useEffect(()=>()=>document.documentElement.classList.remove("typewriter"),[]),k.useEffect(()=>{if(!t)return;function A(){N.current&&(T.current&&cancelAnimationFrame(T.current),T.current=requestAnimationFrame(()=>{try{const $=t.view.coordsAtPos(t.state.selection.$head.pos),ee=Math.round($.top-window.innerHeight*.5);Math.abs(ee)>2&&window.scrollBy(0,ee)}catch{}}))}return t.on("update",A),t.on("selectionUpdate",A),()=>{t.off("update",A),t.off("selectionUpdate",A),T.current&&cancelAnimationFrame(T.current)}},[t]);function V(){const A=!M;_(A),N.current=A,document.documentElement.classList.toggle("typewriter",A),A&&requestAnimationFrame(()=>{try{const $=t.view.coordsAtPos(t.state.selection.$head.pos);window.scrollBy(0,Math.round($.top-window.innerHeight*.5))}catch{}})}function G(){if(!("speechSynthesis"in window))return;const{from:A}=t.state.selection,$=t.state.doc.content.size,{text:ee,posMap:he}=yM(t.state.doc,A,$),pe=[];let et;const fn=/[^.!?…]+[.!?…]*['"'"]?\s*/g;for(;(et=fn.exec(ee))!==null;)et[0].trim()&&pe.push({text:et[0],startOffset:et.index});if(!pe.length)if(ee.trim())pe.push({text:ee,startOffset:0});else return;speechSynthesis.cancel(),f.current=!0,d(!0);const _s=window.speechSynthesis.getVoices().find(hn=>hn.voiceURI===b.current);let $s=0;function ki(){if(!f.current||$s>=pe.length){f.current=!1,d(!1),a==null||a();return}const hn=pe[$s++],qt=new SpeechSynthesisUtterance(hn.text);_s&&(qt.voice=_s),qt.rate=C.current,qt.onstart=()=>{const{pmFrom:Tt,pmTo:wi}=xM(ee,he,hn);Tt!==null&&(l==null||l(Tt,wi),requestAnimationFrame(()=>{var Yn;(Yn=t.view.dom.querySelector(".reading-word"))==null||Yn.scrollIntoView({behavior:"smooth",block:"center"})}))},qt.onboundary=Tt=>{if(Tt.name==="sentence")return;const wi=hn.startOffset+(Tt.charIndex??0),{pmFrom:Yn,pmTo:B}=vM(ee,he,wi);Yn!==null&&(l==null||l(Yn,B),requestAnimationFrame(()=>{var te;(te=t.view.dom.querySelector(".reading-word"))==null||te.scrollIntoView({behavior:"smooth",block:"center"})}))},qt.onend=ki,qt.onerror=Tt=>{Tt.error!=="interrupted"&&(f.current=!1,d(!1),a==null||a())},speechSynthesis.speak(qt)}ki()}function Y(){f.current=!1,d(!1),speechSynthesis.cancel(),a==null||a()}if(!t)return null;const ke=()=>y.jsxs("svg",{width:"13",height:"11",viewBox:"0 0 13 11",fill:"currentColor","aria-hidden":"true",children:[y.jsx("rect",{x:"0",y:"0",width:"13",height:"1.8"}),y.jsx("rect",{x:"0",y:"3.1",width:"9",height:"1.8"}),y.jsx("rect",{x:"0",y:"6.2",width:"11",height:"1.8"}),y.jsx("rect",{x:"0",y:"9.3",width:"7",height:"1.8"})]}),X=()=>y.jsxs("svg",{width:"13",height:"11",viewBox:"0 0 13 11",fill:"currentColor","aria-hidden":"true",children:[y.jsx("rect",{x:"0",y:"0",width:"13",height:"1.8"}),y.jsx("rect",{x:"2",y:"3.1",width:"9",height:"1.8"}),y.jsx("rect",{x:"1",y:"6.2",width:"11",height:"1.8"}),y.jsx("rect",{x:"3",y:"9.3",width:"7",height:"1.8"})]}),U=()=>y.jsxs("svg",{width:"13",height:"11",viewBox:"0 0 13 11",fill:"currentColor","aria-hidden":"true",children:[y.jsx("rect",{x:"0",y:"0",width:"13",height:"1.8"}),y.jsx("rect",{x:"4",y:"3.1",width:"9",height:"1.8"}),y.jsx("rect",{x:"2",y:"6.2",width:"11",height:"1.8"}),y.jsx("rect",{x:"6",y:"9.3",width:"7",height:"1.8"})]}),D=()=>y.jsxs("svg",{width:"13",height:"11",viewBox:"0 0 13 11",fill:"currentColor","aria-hidden":"true",children:[y.jsx("rect",{x:"0",y:"0",width:"13",height:"1.8"}),y.jsx("rect",{x:"0",y:"3.1",width:"13",height:"1.8"}),y.jsx("rect",{x:"0",y:"6.2",width:"13",height:"1.8"}),y.jsx("rect",{x:"0",y:"9.3",width:"9",height:"1.8"})]});async function j(A){const $=A.target.files[0];if($){A.target.value="";try{const ee=await e($);t.chain().focus().setImage({src:ee}).run()}catch{alert("Image upload failed. Try again.")}}}function z(A,$,ee,he){return y.jsx("button",{className:`toolbar-btn${ee?" active":""}`,onMouseDown:pe=>{pe.preventDefault(),$()},title:he||A,children:A},A)}return y.jsxs("div",{className:"toolbar",role:"toolbar","aria-label":"Formatting",children:[z("Ch.",()=>t.chain().focus().toggleHeading({level:1}).run(),t.isActive("heading",{level:1}),"Chapter heading"),z("H2",()=>t.chain().focus().toggleHeading({level:2}).run(),t.isActive("heading",{level:2}),"Section heading"),z("H3",()=>t.chain().focus().toggleHeading({level:3}).run(),t.isActive("heading",{level:3}),"Sub-heading"),y.jsx("span",{className:"toolbar-sep"}),z("B",()=>t.chain().focus().toggleBold().run(),t.isActive("bold"),"Bold (Ctrl+B)"),z("I",()=>t.chain().focus().toggleItalic().run(),t.isActive("italic"),"Italic (Ctrl+I)"),z("U",()=>t.chain().focus().toggleUnderline().run(),t.isActive("underline"),"Underline (Ctrl+U)"),z(y.jsx("s",{children:"S"}),()=>t.chain().focus().toggleStrike().run(),t.isActive("strike"),"Strikethrough"),y.jsx("span",{className:"toolbar-sep"}),[{Icon:ke,align:"left",label:"Align left"},{Icon:X,align:"center",label:"Align centre"},{Icon:U,align:"right",label:"Align right"},{Icon:D,align:"justify",label:"Justify"}].map(({Icon:A,align:$,label:ee})=>y.jsx("button",{className:`toolbar-btn${t.isActive({textAlign:$})?" active":""}`,onMouseDown:he=>{he.preventDefault(),t.chain().focus().setTextAlign($).run()},title:ee,children:y.jsx(A,{})},$)),y.jsx("span",{className:"toolbar-sep"}),z("•—",()=>t.chain().focus().toggleBulletList().run(),t.isActive("bulletList"),"Bullet list"),z("1.",()=>t.chain().focus().toggleOrderedList().run(),t.isActive("orderedList"),"Numbered list"),z('"…"',()=>t.chain().focus().toggleBlockquote().run(),t.isActive("blockquote"),"Quote block"),y.jsx("button",{className:"toolbar-btn",onMouseDown:A=>{A.preventDefault(),t.chain().focus().setHorizontalRule().run()},title:"Scene break (✦ ✦ ✦)",children:"✦"}),y.jsx("span",{className:"toolbar-sep"}),y.jsx("button",{className:"toolbar-btn",onMouseDown:A=>{A.preventDefault(),u.current.click()},title:"Insert photo",children:"Photo"}),y.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:j,style:{display:"none"}}),y.jsx("span",{className:"toolbar-sep"}),["#fef08a","#fda4af","#93c5fd","#86efac"].map(A=>y.jsx("button",{className:`toolbar-btn highlight-swatch${t.isActive("highlight",{color:A})?" active":""}`,style:{"--swatch":A},onMouseDown:$=>{$.preventDefault(),t.chain().focus().toggleHighlight({color:A}).run()},title:"Highlight"},A)),y.jsx("span",{className:"toolbar-sep"}),y.jsx("button",{className:"toolbar-btn font-btn",onMouseDown:A=>{A.preventDefault(),r(-1)},title:"Smaller text",children:"A"}),y.jsxs("span",{className:"toolbar-font-size",children:[n,"px"]}),y.jsx("button",{className:"toolbar-btn font-btn",onMouseDown:A=>{A.preventDefault(),r(1)},title:"Larger text",children:"A+"}),y.jsx("span",{className:"toolbar-sep"}),y.jsx("button",{className:`toolbar-btn${M?" active":""}`,onMouseDown:A=>{A.preventDefault(),V()},title:"Typewriter mode — keeps cursor centred on screen",children:"⌨"}),i&&y.jsx("button",{className:`toolbar-btn lint-btn${s==="done"&&o===0?" lint-clean":s==="done"&&o>0?" lint-errors":s==="stale"?" lint-stale":""}`,onMouseDown:A=>{A.preventDefault(),i()},disabled:s==="checking",title:s==="checking"?"Checking…":s==="done"&&o===0?"No issues found — click to re-check":s==="done"?`${o} issue${o!==1?"s":""} — click to re-check`:s==="stale"?"Text changed — click to re-check":"Check spelling & grammar",children:s==="checking"?"…":s==="done"&&o===0?"✓":s==="done"?`${o}`:s==="stale"?"ABC*":"ABC"}),y.jsxs("div",{className:"tts-settings-wrap",children:[y.jsx("button",{className:`toolbar-btn${S?" active":""}`,onMouseDown:A=>{A.preventDefault(),w($=>!$)},title:"Read-aloud settings (voice & speed)",children:"⚙"}),S&&y.jsxs("div",{className:"tts-menu",children:[y.jsx("label",{className:"tts-label",children:"Voice"}),y.jsxs("select",{className:"tts-select",value:m,onChange:A=>x(A.target.value),children:[h.length===0&&y.jsx("option",{value:"",children:"Loading…"}),h.map(A=>y.jsxs("option",{value:A.voiceURI,children:[A.name,A.localService?"":" ☁"]},A.voiceURI))]}),y.jsxs("label",{className:"tts-label",children:["Speed — ",g.toFixed(1),"×"]}),y.jsx("input",{type:"range",min:"0.5",max:"2",step:"0.1",value:g,onChange:A=>v(parseFloat(A.target.value)),className:"tts-slider"})]})]}),y.jsx("button",{className:`toolbar-btn read-aloud-btn${c?" reading-active":""}`,onMouseDown:A=>{A.preventDefault(),c?Y():G()},title:c?"Stop reading":"Read aloud from cursor (reads to end of story)",children:c?"⏹":"🔊"})]})}const kM=["25%","50%","75%","100%"];function ev({node:t,updateAttributes:e,deleteNode:n,selected:r}){const{src:i,alt:s,width:o="100%",align:l="center"}=t.attrs,a={width:o,display:"block",marginLeft:l==="left"?"0":"auto",marginRight:l==="right"?"0":"auto"};return y.jsxs(cM,{className:"image-view-wrap",children:[y.jsx("img",{src:i,alt:s||"",style:a,draggable:"false"}),r&&y.jsxs("div",{className:"image-controls",contentEditable:!1,children:[y.jsx("div",{className:"image-ctrl-group",children:kM.map(u=>y.jsx("button",{className:`img-ctrl-btn${o===u?" active":""}`,onMouseDown:c=>{c.preventDefault(),e({width:u})},children:u},u))}),y.jsx("span",{className:"image-ctrl-sep"}),y.jsx("div",{className:"image-ctrl-group",children:[["left","←"],["center","↔"],["right","→"]].map(([u,c])=>y.jsx("button",{className:`img-ctrl-btn${l===u?" active":""}`,onMouseDown:d=>{d.preventDefault(),e({align:u})},children:c},u))}),y.jsx("span",{className:"image-ctrl-sep"}),y.jsx("button",{className:"img-ctrl-btn img-ctrl-delete",onMouseDown:u=>{u.preventDefault(),n()},title:"Remove image",children:"🗑"})]})]})}const wM=Id.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),width:{default:"100%"},align:{default:"center"}}},addNodeView(){return X0(ev)}}).configure({allowBase64:!1,inline:!1}),CM=bt.create({name:"readingWord",inclusive:!1,parseHTML(){return[]},renderHTML({HTMLAttributes:t}){return["span",Se({class:"reading-word"},t),0]}}),EM=bt.create({name:"lintError",inclusive:!1,addAttributes(){return{kind:{default:"grammar"},message:{default:""},replacements:{default:[],parseHTML:t=>JSON.parse(t.getAttribute("data-r")||"[]"),renderHTML:t=>({"data-r":JSON.stringify(t.replacements??[])})}}},parseHTML(){return[]},renderHTML({HTMLAttributes:t}){return["span",Se({"data-lint":"",class:`lint-mark lint-mark--${t.kind}`},t),0]}});function NM(t){const e=[],n=[];return t.descendants((r,i)=>{if(r.isText){for(let s=0;s<r.text.length;s++)e.push(r.text[s]),n.push(i+s);return!1}r.isBlock&&e.length>0&&e[e.length-1]!==`
`&&(e.push(`
`),n.push(null))}),{text:e.join(""),posMap:n}}function xp(t){const{tr:e,doc:n,schema:r}=t.state,i=r.marks.lintError;i&&(n.descendants((s,o)=>{s.isText&&s.marks.filter(l=>l.type===i).forEach(()=>e.removeMark(o,o+s.nodeSize,i))}),t.view.dispatch(e))}function tv(t){if(!t)return t;const e={...t};return e.marks&&(e.marks=e.marks.filter(n=>n.type!=="lintError"&&n.type!=="readingWord"),e.marks.length||delete e.marks),e.content&&(e.content=e.content.map(tv)),e}const bM=k.forwardRef(function({content:e,onChange:n,onImageUpload:r,fontSize:i,onFontSizeChange:s},o){const l=k.useRef(!1),[a,u]=k.useState("idle"),[c,d]=k.useState(0),[f,h]=k.useState(null),p=k.useRef("idle"),m=k.useRef(null),x=k.useRef(null),g=k.useRef(!1),v=Q0({extensions:[Pd,Ad,wM,EM,CM,Z0.configure({placeholder:"Begin your story here…"}),gM,U0.configure({types:["heading","paragraph"]}),H0.configure({multicolor:!0})],content:"",onUpdate({editor:N}){g.current||(n(tv(N.getJSON())),clearTimeout(m.current),m.current=setTimeout(()=>{var T;return(T=x.current)==null?void 0:T.call(x)},3e3))}});k.useImperativeHandle(o,()=>({insertPrompt:N=>{v&&v.chain().focus().insertContent({type:"blockquote",content:[{type:"paragraph",content:[{type:"text",text:N}]}]}).run()}})),k.useEffect(()=>{v&&!l.current&&(e&&Object.keys(e).length>0&&v.commands.setContent(e,!1),l.current=!0)},[v,e]);const S=k.useCallback(async()=>{if(!(!v||p.current==="checking")){p.current="checking",u("checking");try{const{text:N,posMap:T}=NM(v.state.doc);if(!N.trim()){g.current=!0,xp(v),g.current=!1,d(0),u("done"),p.current="done";return}const V=await ie.lintCheck(N);g.current=!0,xp(v);const{tr:G,schema:Y}=v.state,ke=Y.marks.lintError;for(const X of V.matches){let U=null,D=null;for(let j=X.offset;j<X.offset+X.length&&j<T.length;j++)T[j]!==null&&(U===null&&(U=T[j]),D=T[j]+1);U!==null&&G.addMark(U,D,ke.create({kind:X.kind,message:X.message,replacements:X.replacements}))}v.view.dispatch(G),g.current=!1,d(V.matches.length),u("done"),p.current="done"}catch(N){g.current=!1,console.error("[lint] Check failed:",N),u("idle"),p.current="idle"}}},[v]);k.useEffect(()=>{x.current=S},[S]),k.useEffect(()=>()=>clearTimeout(m.current),[]);const w=k.useCallback((N,T)=>{if(!v)return;const V=v.state.schema.marks.readingWord;if(!V)return;const{tr:G}=v.state;v.state.doc.descendants((Y,ke)=>{Y.isText&&Y.marks.filter(X=>X.type===V).forEach(()=>G.removeMark(ke,ke+Y.nodeSize,V))}),G.addMark(N,T,V.create()),g.current=!0,v.view.dispatch(G),g.current=!1},[v]),E=k.useCallback(()=>{if(!v)return;const N=v.state.schema.marks.readingWord;if(!N)return;const{tr:T}=v.state;v.state.doc.descendants((V,G)=>{V.isText&&V.marks.filter(Y=>Y.type===N).forEach(()=>T.removeMark(G,G+V.nodeSize,N))}),g.current=!0,v.view.dispatch(T),g.current=!1},[v]);function b(N){if(!v)return;const T=N.target.closest("[data-lint]");if(!T){h(null);return}const V=v.view.posAtCoords({left:N.clientX,top:N.clientY});if(!V)return;const G=v.state.doc.resolve(V.pos),Y=v.state.schema.marks.lintError,ke=G.marks().find(D=>D.type===Y);if(!ke)return;const X=Kl(G,Y);if(!X)return;const U=T.getBoundingClientRect();h({top:U.bottom+8,left:Math.max(8,Math.min(U.left,window.innerWidth-270)),message:ke.attrs.message,replacements:ke.attrs.replacements||[],from:X.from,to:X.to})}function C(N){if(!f||!v)return;const{from:T,to:V}=f;v.chain().setTextSelection({from:T,to:V}).insertContent(N).focus().run(),h(null),setTimeout(S,600)}function M(){if(!f||!v)return;const{from:N,to:T}=f,{tr:V,schema:G}=v.state;V.removeMark(N,T,G.marks.lintError),v.view.dispatch(V),h(null),d(Y=>Math.max(0,Y-1))}const _=(v==null?void 0:v.storage.characterCount.words())??0;return y.jsxs("div",{className:"editor-outer",style:{"--editor-font-size":(i||17)+"px"},children:[y.jsx(SM,{editor:v,onImageUpload:r,fontSize:i,onFontSizeChange:s,onLint:S,lintStatus:a,lintCount:c,applyReadingMark:w,clearReadingMark:E}),y.jsxs("div",{className:"editor-wrap",onClick:b,children:[y.jsx(q0,{editor:v,className:"editor-body",spellCheck:!1}),y.jsxs("div",{className:"word-count",children:[_.toLocaleString()," ",_===1?"word":"words"]})]}),f&&Pl.createPortal(y.jsxs("div",{className:"lint-popover",style:{top:f.top,left:f.left},onMouseDown:N=>N.preventDefault(),onClick:N=>N.stopPropagation(),children:[y.jsx("p",{className:"lint-popover-msg",children:f.message}),f.replacements.length>0&&y.jsx("div",{className:"lint-suggestions",children:f.replacements.map((N,T)=>y.jsx("button",{className:"lint-suggestion",onClick:()=>C(N),children:N},T))}),y.jsxs("div",{className:"lint-popover-actions",children:[y.jsx("button",{className:"btn btn-ghost lint-ignore",onClick:M,children:"Ignore"}),y.jsx("button",{className:"btn btn-ghost lint-close",onClick:()=>h(null),children:"✕"})]})]}),document.body)]})});function MM(t){var n;const e=[];for(const r of(t==null?void 0:t.content)||[])r.type==="heading"&&((n=r.attrs)==null?void 0:n.level)===1&&e.push((r.content||[]).map(i=>i.text||"").join("")||"Untitled Chapter");return e}function TM({content:t,open:e,onClose:n}){const r=k.useMemo(()=>MM(t),[t]),i=k.useRef();k.useEffect(()=>{if(!e)return;function o(l){l.key==="Escape"&&n()}return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e,n]);function s(o){const l=document.querySelectorAll(".editor-body h1");l[o]&&(l[o].scrollIntoView({behavior:"smooth",block:"start"}),window.innerWidth<768&&n())}return y.jsxs(y.Fragment,{children:[e&&y.jsx("div",{className:"panel-backdrop",onClick:n}),y.jsxs("aside",{className:`chapter-panel${e?" open":""}`,ref:i,"aria-label":"Chapters",children:[y.jsxs("div",{className:"chapter-panel-header",children:[y.jsx("span",{className:"chapter-panel-title",children:"Chapters"}),y.jsx("button",{className:"chapter-panel-close",onClick:n,"aria-label":"Close",children:"×"})]}),r.length===0?y.jsxs("p",{className:"chapter-panel-empty",children:["Use the ",y.jsx("strong",{children:"Ch."})," button to add chapter headings and they'll appear here."]}):y.jsx("ol",{className:"chapter-list",children:r.map((o,l)=>y.jsx("li",{children:y.jsxs("button",{className:"chapter-btn",onClick:()=>s(l),children:[y.jsxs("span",{className:"chapter-num",children:["Ch. ",l+1]}),y.jsx("span",{className:"chapter-name",children:o})]})},l))})]})]})}const OM=Id.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),width:{default:"100%"},align:{default:"center"}}},addNodeView(){return X0(ev)}}).configure({allowBase64:!1,inline:!1});function DM({content:t,onChange:e,onImageUpload:n}){const r=k.useRef(!1),i=k.useRef(),s=Q0({extensions:[Pd,Ad,OM,Z0.configure({placeholder:"Write your note here…"})],content:"",onUpdate({editor:a}){e(a.getJSON())}});k.useEffect(()=>{s&&!r.current&&(t&&Object.keys(t).length>0&&s.commands.setContent(t,!1),r.current=!0)},[s,t]);async function o(a){const u=a.target.files[0];if(u){a.target.value="";try{const c=await n(u);s.chain().focus().setImage({src:c}).run()}catch{alert("Image upload failed. Try again.")}}}function l(a,u,c,d){return y.jsx("button",{className:`toolbar-btn${c?" active":""}`,onMouseDown:f=>{f.preventDefault(),u()},title:d||String(a),children:a},String(a))}return s?y.jsxs("div",{className:"note-editor-outer",children:[y.jsxs("div",{className:"note-toolbar",role:"toolbar","aria-label":"Note formatting",children:[l("B",()=>s.chain().focus().toggleBold().run(),s.isActive("bold"),"Bold (Ctrl+B)"),l("I",()=>s.chain().focus().toggleItalic().run(),s.isActive("italic"),"Italic (Ctrl+I)"),l("U",()=>s.chain().focus().toggleUnderline().run(),s.isActive("underline"),"Underline (Ctrl+U)"),y.jsx("span",{className:"toolbar-sep"}),l("H2",()=>s.chain().focus().toggleHeading({level:2}).run(),s.isActive("heading",{level:2}),"Heading"),l("H3",()=>s.chain().focus().toggleHeading({level:3}).run(),s.isActive("heading",{level:3}),"Sub-heading"),y.jsx("span",{className:"toolbar-sep"}),l("•—",()=>s.chain().focus().toggleBulletList().run(),s.isActive("bulletList"),"Bullet list"),l('"…"',()=>s.chain().focus().toggleBlockquote().run(),s.isActive("blockquote"),"Quote block"),y.jsx("span",{className:"toolbar-sep"}),y.jsx("button",{className:"toolbar-btn",onMouseDown:a=>{a.preventDefault(),i.current.click()},title:"Insert image",children:"Photo"}),y.jsx("input",{ref:i,type:"file",accept:"image/*",onChange:o,style:{display:"none"}})]}),y.jsx("div",{className:"note-editor-wrap",children:y.jsx(q0,{editor:s,className:"note-editor-body"})})]}):null}function PM(t){return t?new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"}):""}function AM(t){function e(r){return(r||[]).flatMap(i=>i.text?[i.text]:e(i.content))}const n=e((t==null?void 0:t.content)||[]).join(" ").trim();return n?n.slice(0,90)+(n.length>90?"…":""):"No content yet"}function IM({storyId:t,open:e,onClose:n}){const r=od(),i=ld(),[s,o]=k.useState([]),[l,a]=k.useState(!1),[u,c]=k.useState(null),[d,f]=k.useState(""),h=k.useRef(""),p=k.useRef({}),m=k.useRef(null),x=k.useRef(null);k.useEffect(()=>{e&&!l&&ie.getNotes(t).then(T=>{o(T),a(!0)}).catch(()=>r("Could not load notes","error"))},[e,l,t,r]),k.useEffect(()=>{if(!e)return;function T(V){V.key==="Escape"&&(V.stopPropagation(),u?(S(u.id),c(null)):n())}return document.addEventListener("keydown",T,!0),()=>document.removeEventListener("keydown",T,!0)},[e,u,n]);const g=k.useCallback(async T=>{if(T)try{const V=await ie.updateNote(t,T,{title:h.current,content:p.current});o(G=>G.map(Y=>Y.id===T?V:Y))}catch{r("Could not save note","error")}},[t,r]);function v(T){clearTimeout(m.current),m.current=setTimeout(()=>g(T),1500)}function S(T){clearTimeout(m.current),g(T)}k.useEffect(()=>()=>clearTimeout(m.current),[]);function w(T){x.current&&x.current!==T.id&&S(x.current),x.current=T.id,h.current=T.title,p.current=T.content||{},f(T.title),c(T)}async function E(){try{const T=await ie.createNote(t);o(V=>[T,...V]),w(T)}catch{r("Could not create note","error")}}function b(T){h.current=T.target.value,f(T.target.value),v(u.id)}function C(T){p.current=T,v(u.id)}function M(){S(u.id),x.current=null,c(null)}async function _(){if(await i(`Delete "${u.title||"this note"}"?`,{confirmLabel:"Delete",danger:!0}))try{clearTimeout(m.current),await ie.deleteNote(t,u.id),o(V=>V.filter(G=>G.id!==u.id)),x.current=null,c(null)}catch{r("Could not delete note","error")}}function N(){u&&S(u.id),n()}return y.jsxs(y.Fragment,{children:[e&&y.jsx("div",{className:"panel-backdrop",onClick:N}),y.jsx("aside",{className:`notes-panel${e?" open":""}`,"aria-label":"Notes",children:u?y.jsxs("div",{className:"note-edit-view",children:[y.jsxs("div",{className:"notes-panel-header",children:[y.jsx("button",{className:"note-back-btn btn btn-ghost",onClick:M,children:"← Notes"}),y.jsx("button",{className:"chapter-panel-close",onClick:N,"aria-label":"Close",children:"×"})]}),y.jsx("input",{className:"note-title-input",value:d,onChange:b,placeholder:"Note title…"}),y.jsx("div",{className:"note-editor-scroll",children:y.jsx(DM,{content:u.content,onChange:C,onImageUpload:ie.uploadImage},u.id)}),y.jsx("div",{className:"note-edit-footer",children:y.jsx("button",{className:"btn btn-ghost note-delete-btn",onClick:_,children:"Delete note"})})]}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"notes-panel-header",children:[y.jsx("span",{className:"notes-panel-title",children:"Notes"}),y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[y.jsx("button",{className:"note-new-btn btn btn-ghost",onClick:E,title:"New note",children:"+ New"}),y.jsx("button",{className:"chapter-panel-close",onClick:N,"aria-label":"Close",children:"×"})]})]}),l?s.length===0?y.jsxs("div",{className:"notes-empty",children:[y.jsx("p",{className:"notes-empty-msg",children:"No notes yet."}),y.jsx("button",{className:"btn btn-primary notes-empty-cta",onClick:E,children:"+ Create first note"})]}):y.jsx("ol",{className:"notes-list",children:s.map(T=>y.jsx("li",{children:y.jsxs("button",{className:"note-item",onClick:()=>w(T),children:[y.jsx("span",{className:"note-item-title",children:T.title||"Untitled"}),y.jsx("span",{className:"note-item-snippet",children:AM(T.content)}),y.jsx("span",{className:"note-item-date",children:PM(T.updated_at)})]})},T.id))}):y.jsx("p",{className:"chapter-panel-empty",children:"Loading…"})]})})]})}const Sp=13,kp=26,RM=(()=>{const t=["A door appears in your bedroom wall overnight. It wasn't there when you went to sleep.","You find a letter in your pocket written in your own handwriting — dated next week.","The last dragon in the world lands in your garden. It is very small and very scared.","Your shadow starts leaving notes under your pillow.","Every story you write comes true — but always with one small, wrong detail.","A train arrives at your station that isn't on any timetable. The conductor says you have been expected.","You discover you have one magical power: you can always find things that are lost. Not everything that is lost wants to be found.","The stars rearrange themselves every night. Last night you finally worked out what language they're writing in.","A bookshop appears on your street that wasn't there yesterday. Inside are books about your life — including things that haven't happened yet.","Everyone in your town wakes up speaking a different language. Everyone except you.","The person chosen to save the world is seventy-three years old, very tired, and was just about to have a cup of tea.","You are the only one who can hear the sea talking. It is furious about something."];let e=[];const n=r=>[...r].sort(()=>Math.random()-.5);return{next(){return e.length||(e=n(t)),{prompt:e.pop(),source:"local",model:null}}}})();function LM(){const{id:t}=sS(),e=rd(),n=od(),r=ld(),[i,s]=k.useState(null),[o,l]=k.useState(!1),[a,u]=k.useState(""),[c,d]=k.useState({}),[f,h]=k.useState("saved"),[p,m]=k.useState(!1),[x,g]=k.useState(!1),[v,S]=k.useState(!1),[w,E]=k.useState(!1),[b,C]=k.useState(null),[M,_]=k.useState(null),[N,T]=k.useState(null),[V,G]=k.useState(()=>Math.max(Sp,Math.min(kp,parseInt(localStorage.getItem("sw-fontsize"))||17))),Y=k.useRef(null),ke=k.useRef(""),X=k.useRef({}),U=k.useRef(0),D=k.useRef(),j=k.useRef([]),z=k.useRef([]),A=k.useRef(),$=k.useRef(null);k.useEffect(()=>{ie.getStory(t).then(B=>{s(B),u(B.title),d(B.content||{}),ke.current=B.title,X.current=B.content||{},U.current=pp(B.content)}).catch(()=>l(!0))},[t]),k.useEffect(()=>{ki()},[]),k.useEffect(()=>{localStorage.setItem("sw-fontsize",V)},[V]);const ee=k.useCallback(async()=>{h("saving");try{await ie.updateStory(t,{title:ke.current,content:X.current}),h("saved");const B=PS(),te=pp(X.current),Ot=te-U.current;Ot>0&&(IS(Ot),U.current=te);const Bt=Wb(t,te);Bt&&n(`🎉 ${Bt}`,"success"),B>1&&B%7===0&&n(`🔥 ${B} day writing streak!`,"success")}catch(B){console.error("Save failed:",B),h("error"),n("Could not save — check your connection","error")}},[t,n]);k.useEffect(()=>{$.current=ee},[ee]);function he(){h("unsaved"),clearTimeout(Y.current),Y.current=setTimeout(()=>{var B;return(B=$.current)==null?void 0:B.call($)},2e3)}k.useEffect(()=>()=>clearTimeout(Y.current),[]),k.useEffect(()=>{function B(te){var Ot;(te.ctrlKey||te.metaKey)&&te.key==="s"&&(te.preventDefault(),clearTimeout(Y.current),(Ot=$.current)==null||Ot.call($)),te.key==="Escape"&&(E(!1),m(!1),g(!1),S(!1),C(null)),(te.key==="F11"||te.altKey&&te.key==="z")&&(te.preventDefault(),E(Bt=>!Bt))}return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[]);function pe(B){ke.current=B.target.value,u(B.target.value),he()}function et(B){X.current=B,d(B),he()}function fn(B){G(te=>Math.max(Sp,Math.min(kp,te+B)))}async function _s(B){const te=B.target.files[0];if(te){B.target.value="";try{const Ot=await ie.uploadImage(te);s(Bt=>({...Bt,cover_image:Ot})),await ie.updateStory(t,{cover_image:Ot}),n("Cover image updated")}catch{n("Cover upload failed","error")}}}async function $s(){await r("Remove the cover image?",{confirmLabel:"Remove",danger:!0})&&(s(te=>({...te,cover_image:null})),await ie.updateStory(t,{cover_image:null}))}function ki(){const B=5-j.current.length-z.current.length;for(let te=0;te<B;te++){const Ot=ie.getPrompt().then(Bt=>{j.current.push(Bt)}).catch(()=>{}).finally(()=>{z.current=z.current.filter(Bt=>Bt!==Ot)});z.current=[...z.current,Ot]}}function hn(){const B=j.current.shift()??RM.next();C(B.prompt),_(B.source??"local"),T(B.model??null),ki()}function qt(){var B;b&&((B=A.current)==null||B.insertPrompt(b),C(null),n("Prompt inserted as a quote block"))}async function Tt(B){if(S(!1),B==="pdf"){$b(ke.current||a,X.current);return}if(B==="epub"){await ie.exportEpub(t);return}B==="odt"&&await ie.exportOdt(t)}function wi(){var B;clearTimeout(Y.current),(B=$.current)==null||B.call($).finally(()=>e("/"))}if(o)return y.jsxs("div",{className:"loading",children:["Could not load story."," ",y.jsx("button",{className:"btn btn-ghost",style:{marginLeft:"1rem"},onClick:()=>e("/"),children:"Go back"})]});if(!i)return y.jsx("div",{className:"loading",children:"Opening story…"});const Yn={saved:"Saved",saving:"Saving…",unsaved:"Unsaved",error:"Error saving"};return y.jsxs("div",{className:`editor-page${w?" focus-mode":""}${p?" panel-open":""}`,children:[y.jsx(TM,{content:c,open:p,onClose:()=>m(!1)}),y.jsx(IM,{storyId:t,open:x,onClose:()=>g(!1)}),y.jsxs("div",{className:"editor-main",children:[y.jsxs("div",{className:"editor-topbar",children:[y.jsxs("div",{className:"topbar-left",children:[y.jsxs("button",{onClick:wi,className:"btn btn-ghost back-btn",children:["← ",y.jsx("span",{children:"Stories"})]}),y.jsxs("button",{className:`btn btn-ghost${p?" active":""}`,onClick:()=>m(B=>!B),title:"Toggle chapter list",children:["☰ ",y.jsx("span",{children:"Chapters"})]}),y.jsxs("button",{className:`btn btn-ghost${x?" active":""}`,onClick:()=>g(B=>!B),title:"Toggle notes",children:["✎ ",y.jsx("span",{children:"Notes"})]}),y.jsxs("button",{className:`btn btn-ghost${w?" active":""}`,onClick:()=>E(B=>!B),title:"Focus mode (F11 or Alt+Z)",children:[w?"⊠":"⊡"," ",y.jsx("span",{children:w?"Exit Focus":"Focus"})]})]}),y.jsxs("div",{className:"topbar-right",children:[y.jsxs("div",{className:"prompt-wrap",children:[y.jsxs("button",{className:"btn btn-ghost",onClick:hn,title:"Get a writing prompt",children:["💡 ",y.jsx("span",{children:"Prompt"})]}),b&&y.jsxs("div",{className:"prompt-popover",children:[M&&y.jsx("span",{className:`prompt-source-icon prompt-source--${M}`,title:M==="ollama"?`AI · ${N||"ollama"}`:"Built-in prompt",children:M==="ollama"?"🤖":"📚"}),y.jsx("p",{className:"prompt-text",children:b}),y.jsxs("div",{className:"prompt-actions",children:[y.jsx("button",{className:"btn btn-ghost",onClick:hn,children:"↻ Another"}),y.jsx("button",{className:"btn btn-primary",onClick:qt,children:"Insert"}),y.jsx("button",{className:"btn btn-ghost",onClick:()=>C(null),children:"×"})]})]})]}),y.jsx("span",{className:`save-status save-status--${f}`,children:Yn[f]}),y.jsxs("div",{className:"export-wrap",children:[y.jsxs("button",{className:"btn btn-ghost",onClick:()=>S(B=>!B),children:[y.jsx("span",{children:"Export"})," ▾"]}),v&&y.jsxs("div",{className:"export-menu",children:[y.jsx("button",{onClick:()=>Tt("pdf"),children:"PDF (print)"}),y.jsx("button",{onClick:()=>Tt("epub"),children:"EPUB (.epub)"}),y.jsx("button",{onClick:()=>Tt("odt"),children:"Open Document (.odt)"})]})]})]})]}),y.jsxs("div",{className:"editor-container",children:[y.jsxs("div",{className:"cover-area",children:[i.cover_image?y.jsxs("div",{className:"cover-preview",children:[y.jsx("img",{src:i.cover_image,alt:"Cover",className:"cover-img"}),y.jsxs("div",{className:"cover-actions",children:[y.jsx("button",{className:"btn btn-ghost cover-btn",onClick:()=>D.current.click(),children:"Change cover"}),y.jsx("button",{className:"btn btn-ghost cover-btn",onClick:$s,children:"Remove"})]})]}):y.jsx("button",{className:"cover-add",onClick:()=>D.current.click(),children:"+ Add cover image"}),y.jsx("input",{ref:D,type:"file",accept:"image/*",onChange:_s,style:{display:"none"}})]}),y.jsx("input",{className:"story-title-input",value:a,onChange:pe,placeholder:"Story title…"}),y.jsx(bM,{ref:A,content:i.content,onChange:et,onImageUpload:ie.uploadImage,fontSize:V,onFontSizeChange:fn})]})]}),w&&y.jsx("button",{className:"focus-exit",onClick:()=>E(!1),title:"Exit focus mode (Esc)",children:"Exit Focus"})]})}function jM(){const[t,e]=k.useState(""),[n,r]=k.useState(!1),[i,s]=k.useState([]),[o,l]=k.useState(""),[a,u]=k.useState({name:"",username:"",password:""}),[c,d]=k.useState(""),[f,h]=k.useState(""),[p,m]=k.useState(!1),[x,g]=k.useState(null),[v,S]=k.useState(""),[w,E]=k.useState("");async function b(N){N.preventDefault(),l("");try{const T=await ie.admin.getUsers(t);s(T),r(!0)}catch{l("Wrong password")}}async function C(N){N.preventDefault(),d(""),h(""),m(!0);try{const T=await ie.admin.createUser(t,a);s(V=>[T,...V]),u({name:"",username:"",password:""}),h(`Account created for ${T.name}!`)}catch(T){d(T.message)}finally{m(!1)}}async function M(N,T){N.preventDefault(),E("");try{await ie.admin.resetPassword(t,T,v),E("Password updated"),S(""),setTimeout(()=>{g(null),E("")},1500)}catch(V){E(V.message)}}async function _(N,T){confirm(`Delete ${T}'s account and all their stories?`)&&(await ie.admin.deleteUser(t,N),s(V=>V.filter(G=>G.id!==N)))}return n?y.jsxs("div",{className:"stories-page",children:[y.jsxs("header",{className:"stories-header",children:[y.jsx("h1",{className:"page-title",children:"Admin"}),y.jsx("a",{href:"/",className:"btn btn-ghost",children:"← Back to App"})]}),y.jsxs("div",{className:"admin-grid",children:[y.jsxs("section",{className:"admin-card",children:[y.jsx("h2",{className:"admin-section-title",children:"Add Account"}),y.jsxs("form",{onSubmit:C,className:"login-form",children:[y.jsx("input",{type:"text",placeholder:"Display name",value:a.name,onChange:N=>u(T=>({...T,name:N.target.value})),required:!0,className:"input"}),y.jsx("input",{type:"text",placeholder:"Username",value:a.username,onChange:N=>u(T=>({...T,username:N.target.value})),required:!0,className:"input",autoCapitalize:"none"}),y.jsx("input",{type:"password",placeholder:"Password",value:a.password,onChange:N=>u(T=>({...T,password:N.target.value})),required:!0,className:"input"}),c&&y.jsx("p",{className:"error-msg",children:c}),f&&y.jsx("p",{className:"success-msg",children:f}),y.jsx("button",{type:"submit",className:"btn btn-primary",disabled:p,children:p?"Creating…":"Create Account"})]})]}),y.jsxs("section",{className:"admin-card",children:[y.jsxs("h2",{className:"admin-section-title",children:["Accounts (",i.length,")"]}),i.length===0?y.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:"No accounts yet."}):y.jsx("ul",{className:"user-list",children:i.map(N=>y.jsxs("li",{className:"user-row",style:{flexDirection:"column",alignItems:"stretch",gap:"0.5rem"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[y.jsxs("div",{children:[y.jsx("strong",{children:N.name}),y.jsxs("span",{className:"user-email",children:["@",N.username]})]}),y.jsxs("div",{style:{display:"flex",gap:"0.4rem"},children:[y.jsx("button",{className:"btn btn-ghost",style:{fontSize:"0.72rem",padding:"0.25rem 0.5rem"},onClick:()=>{g(x===N.id?null:N.id),S(""),E("")},children:x===N.id?"Cancel":"Reset PW"}),y.jsx("button",{className:"btn btn-ghost",style:{fontSize:"0.72rem",padding:"0.25rem 0.5rem",color:"var(--danger)",borderColor:"var(--danger)"},onClick:()=>_(N.id,N.name),children:"Delete"})]})]}),x===N.id&&y.jsxs("form",{onSubmit:T=>M(T,N.id),style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[y.jsx("input",{type:"password",placeholder:"New password",value:v,onChange:T=>S(T.target.value),required:!0,minLength:6,className:"input",style:{flex:1,minWidth:0},autoFocus:!0}),y.jsx("button",{type:"submit",className:"btn btn-primary",style:{flexShrink:0},children:"Set"}),w&&y.jsx("p",{className:w==="Password updated"?"success-msg":"error-msg",style:{width:"100%",margin:0},children:w})]})]},N.id))})]})]})]}):y.jsx("div",{className:"login-page",children:y.jsxs("div",{className:"login-box",children:[y.jsx("div",{className:"login-quill",children:"🔑"}),y.jsx("h1",{className:"login-title",children:"Admin"}),y.jsx("p",{className:"login-sub",children:"Enter admin password"}),y.jsxs("form",{onSubmit:b,className:"login-form",children:[y.jsx("input",{type:"password",placeholder:"Admin password",value:t,onChange:N=>e(N.target.value),required:!0,className:"input",autoComplete:"current-password"}),o&&y.jsx("p",{className:"error-msg",children:o}),y.jsx("button",{type:"submit",className:"btn btn-primary",children:"Unlock"})]})]})})}const zM={grunge:{label:"Midnight",bg:"#09090f",accent:"#c8901a",dot:"#ddd8f2"},gothic:{label:"Gothic Night",bg:"#0f0810",accent:"#c4244e",dot:"#d4b8d8"},forest:{label:"Enchanted Forest",bg:"#080e0a",accent:"#3d9e50",dot:"#a8c4a0"},manuscript:{label:"Aged Manuscript",bg:"#f4e8d0",accent:"#8b4513",dot:"#2a1f0e"},noir:{label:"Neon Noir",bg:"#080808",accent:"#9933ff",dot:"#e0e0e0"}};function BM({theme:t,setTheme:e,themes:n}){const[r,i]=k.useState(!1);return y.jsxs("div",{className:"theme-picker",children:[y.jsx("button",{className:"theme-toggle",onClick:()=>i(s=>!s),title:"Change theme","aria-label":"Change theme","aria-expanded":r,children:"🎨"}),r&&y.jsx("div",{className:"theme-menu",role:"listbox","aria-label":"Themes",children:n.map(s=>{const{label:o,bg:l,accent:a,dot:u}=zM[s];return y.jsxs("button",{role:"option","aria-selected":t===s,className:`theme-option${t===s?" active":""}`,onClick:()=>{e(s),i(!1)},children:[y.jsx("span",{className:"theme-swatch",style:{background:l,border:`2px solid ${a}`},children:y.jsx("span",{style:{color:u},children:"Aa"})}),y.jsx("span",{className:"theme-label",children:o})]},s)})})]})}const Xi=[{id:"lora",label:"Lora",category:"Serif",family:"'Lora', Georgia, serif"},{id:"merriweather",label:"Merriweather",category:"Serif",family:"'Merriweather', Georgia, serif"},{id:"playfair",label:"Playfair Display",category:"Serif",family:"'Playfair Display', 'Palatino Linotype', serif"},{id:"garamond",label:"EB Garamond",category:"Serif",family:"'EB Garamond', 'Palatino Linotype', serif"},{id:"baskerville",label:"Libre Baskerville",category:"Serif",family:"'Libre Baskerville', Georgia, serif"},{id:"crimson",label:"Crimson Text",category:"Serif",family:"'Crimson Text', Georgia, serif"},{id:"cormorant",label:"Cormorant Garamond",category:"Serif",family:"'Cormorant Garamond', 'Palatino Linotype', serif"},{id:"pt-serif",label:"PT Serif",category:"Serif",family:"'PT Serif', Georgia, serif"},{id:"literata",label:"Literata",category:"Serif",family:"'Literata', Georgia, serif"},{id:"vollkorn",label:"Vollkorn",category:"Serif",family:"'Vollkorn', Georgia, serif"},{id:"inter",label:"Inter",category:"Sans",family:"'Inter', system-ui, sans-serif"},{id:"source-sans",label:"Source Sans 3",category:"Sans",family:"'Source Sans 3', system-ui, sans-serif"},{id:"nunito",label:"Nunito",category:"Sans",family:"'Nunito', system-ui, sans-serif"},{id:"special-elite",label:"Special Elite",category:"Typewriter",family:"'Special Elite', 'Courier New', monospace"},{id:"courier-prime",label:"Courier Prime",category:"Typewriter",family:"'Courier Prime', 'Courier New', monospace"}];function FM({fontId:t,setFont:e}){const[n,r]=k.useState(!1),i=Xi.find(s=>s.id===t)??Xi[0];return y.jsxs("div",{className:"font-picker",children:[y.jsx("button",{className:"font-toggle",onClick:()=>r(s=>!s),title:"Change writing font","aria-label":"Change writing font","aria-expanded":n,style:{fontFamily:i.family},children:"Aa"}),n&&y.jsxs("div",{className:"font-menu",role:"listbox","aria-label":"Writing fonts",children:[y.jsx("p",{className:"font-menu-label",children:"Writing font"}),Xi.map(s=>y.jsxs("button",{role:"option","aria-selected":t===s.id,className:`font-option${t===s.id?" active":""}`,onClick:()=>{e(s.id),r(!1)},children:[y.jsx("span",{className:"font-preview",style:{fontFamily:s.family},children:"Aa"}),y.jsxs("span",{className:"font-info",children:[y.jsx("span",{className:"font-name",style:{fontFamily:s.family},children:s.label}),y.jsx("span",{className:"font-category",children:s.category})]})]},s.id))]})]})}const _M=["grunge","gothic","forest","manuscript","noir"];function $M(){const[t,e]=k.useState(()=>bS()),[n,r]=k.useState(()=>localStorage.getItem("sw-theme")||"grunge"),[i,s]=k.useState(()=>localStorage.getItem("sw-font")||"lora");return k.useEffect(()=>{document.documentElement.setAttribute("data-theme",n),localStorage.setItem("sw-theme",n)},[n]),k.useEffect(()=>{const o=Xi.find(l=>l.id===i)??Xi[0];document.documentElement.style.setProperty("--font-body",o.family),localStorage.setItem("sw-font",i)},[i]),y.jsx(MS,{children:y.jsxs(TS,{children:[y.jsxs(kS,{children:[y.jsx(Rr,{path:"/login",element:t?y.jsx(so,{to:"/"}):y.jsx(OS,{onLogin:e})}),y.jsx(Rr,{path:"/admin",element:y.jsx(jM,{})}),y.jsx(Rr,{path:"/",element:t?y.jsx(zS,{onLogout:()=>e(null)}):y.jsx(so,{to:"/login"})}),y.jsx(Rr,{path:"/story/:id",element:t?y.jsx(LM,{}):y.jsx(so,{to:"/login"})}),y.jsx(Rr,{path:"*",element:y.jsx(so,{to:"/"})})]}),t&&y.jsx(BM,{theme:n,setTheme:r,themes:_M}),t&&y.jsx(FM,{fontId:i,setFont:s})]})})}Ha.createRoot(document.getElementById("root")).render(y.jsx(ES,{children:y.jsx($M,{})}));