tandem-editor 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +407 -28
- package/dist/channel/index.js +41 -7
- package/dist/channel/index.js.map +1 -1
- package/dist/cli/index.js +477 -58
- package/dist/cli/index.js.map +1 -1
- package/dist/client/assets/index-B1Cd5UGT.js +349 -0
- package/dist/client/index.html +48 -1
- package/dist/monitor/index.js +24 -2
- package/dist/monitor/index.js.map +1 -1
- package/dist/server/index.js +61109 -59854
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/client/assets/index-mo5ZOPfU.js +0 -349
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
var bz=Object.defineProperty;var xz=(t,e,n)=>e in t?bz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Vd=(t,e,n)=>xz(t,typeof e!="symbol"?e+"":e,n);(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 l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).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 Jp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Fy={exports:{}},Zc={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var sC;function Sz(){if(sC)return Zc;sC=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var l=null;if(s!==void 0&&(l=""+s),i.key!==void 0&&(l=""+i.key),"key"in i){s={};for(var c in i)c!=="key"&&(s[c]=i[c])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:l,ref:i!==void 0?i:null,props:s}}return Zc.Fragment=e,Zc.jsx=n,Zc.jsxs=n,Zc}var oC;function wz(){return oC||(oC=1,Fy.exports=Sz()),Fy.exports}var k=wz(),qy={exports:{}},He={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react.production.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var lC;function vz(){if(lC)return He;lC=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),g=Symbol.iterator;function b(_){return _===null||typeof _!="object"?null:(_=g&&_[g]||_["@@iterator"],typeof _=="function"?_:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,C={};function E(_,V,T){this.props=_,this.context=V,this.refs=C,this.updater=T||S}E.prototype.isReactComponent={},E.prototype.setState=function(_,V){if(typeof _!="object"&&typeof _!="function"&&_!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,_,V,"setState")},E.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function B(){}B.prototype=E.prototype;function I(_,V,T){this.props=_,this.context=V,this.refs=C,this.updater=T||S}var ne=I.prototype=new B;ne.constructor=I,v(ne,E.prototype),ne.isPureReactComponent=!0;var F=Array.isArray;function R(){}var N={H:null,A:null,T:null,S:null},Z=Object.prototype.hasOwnProperty;function j(_,V,T){var Y=T.ref;return{$$typeof:t,type:_,key:V,ref:Y!==void 0?Y:null,props:T}}function ie(_,V){return j(_.type,V,_.props)}function re(_){return typeof _=="object"&&_!==null&&_.$$typeof===t}function se(_){var V={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function(T){return V[T]})}var be=/\/+/g;function ue(_,V){return typeof _=="object"&&_!==null&&_.key!=null?se(""+_.key):V.toString(36)}function H(_){switch(_.status){case"fulfilled":return _.value;case"rejected":throw _.reason;default:switch(typeof _.status=="string"?_.then(R,R):(_.status="pending",_.then(function(V){_.status==="pending"&&(_.status="fulfilled",_.value=V)},function(V){_.status==="pending"&&(_.status="rejected",_.reason=V)})),_.status){case"fulfilled":return _.value;case"rejected":throw _.reason}}throw _}function L(_,V,T,Y,fe){var oe=typeof _;(oe==="undefined"||oe==="boolean")&&(_=null);var Ne=!1;if(_===null)Ne=!0;else switch(oe){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(_.$$typeof){case t:case e:Ne=!0;break;case p:return Ne=_._init,L(Ne(_._payload),V,T,Y,fe)}}if(Ne)return fe=fe(_),Ne=Y===""?"."+ue(_,0):Y,F(fe)?(T="",Ne!=null&&(T=Ne.replace(be,"$&/")+"/"),L(fe,V,T,"",function(mt){return mt})):fe!=null&&(re(fe)&&(fe=ie(fe,T+(fe.key==null||_&&_.key===fe.key?"":(""+fe.key).replace(be,"$&/")+"/")+Ne)),V.push(fe)),1;Ne=0;var Fe=Y===""?".":Y+":";if(F(_))for(var Ue=0;Ue<_.length;Ue++)Y=_[Ue],oe=Fe+ue(Y,Ue),Ne+=L(Y,V,T,oe,fe);else if(Ue=b(_),typeof Ue=="function")for(_=Ue.call(_),Ue=0;!(Y=_.next()).done;)Y=Y.value,oe=Fe+ue(Y,Ue++),Ne+=L(Y,V,T,oe,fe);else if(oe==="object"){if(typeof _.then=="function")return L(H(_),V,T,Y,fe);throw V=String(_),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(_).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return Ne}function G(_,V,T){if(_==null)return _;var Y=[],fe=0;return L(_,Y,"","",function(oe){return V.call(T,oe,fe++)}),Y}function me(_){if(_._status===-1){var V=_._result;V=V(),V.then(function(T){(_._status===0||_._status===-1)&&(_._status=1,_._result=T)},function(T){(_._status===0||_._status===-1)&&(_._status=2,_._result=T)}),_._status===-1&&(_._status=0,_._result=V)}if(_._status===1)return _._result.default;throw _._result}var Te=typeof reportError=="function"?reportError:function(_){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof _=="object"&&_!==null&&typeof _.message=="string"?String(_.message):String(_),error:_});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",_);return}console.error(_)},M={map:G,forEach:function(_,V,T){G(_,function(){V.apply(this,arguments)},T)},count:function(_){var V=0;return G(_,function(){V++}),V},toArray:function(_){return G(_,function(V){return V})||[]},only:function(_){if(!re(_))throw Error("React.Children.only expected to receive a single React element child.");return _}};return He.Activity=m,He.Children=M,He.Component=E,He.Fragment=n,He.Profiler=i,He.PureComponent=I,He.StrictMode=r,He.Suspense=f,He.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,He.__COMPILER_RUNTIME={__proto__:null,c:function(_){return N.H.useMemoCache(_)}},He.cache=function(_){return function(){return _.apply(null,arguments)}},He.cacheSignal=function(){return null},He.cloneElement=function(_,V,T){if(_==null)throw Error("The argument must be a React element, but you passed "+_+".");var Y=v({},_.props),fe=_.key;if(V!=null)for(oe in V.key!==void 0&&(fe=""+V.key),V)!Z.call(V,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&V.ref===void 0||(Y[oe]=V[oe]);var oe=arguments.length-2;if(oe===1)Y.children=T;else if(1<oe){for(var Ne=Array(oe),Fe=0;Fe<oe;Fe++)Ne[Fe]=arguments[Fe+2];Y.children=Ne}return j(_.type,fe,Y)},He.createContext=function(_){return _={$$typeof:l,_currentValue:_,_currentValue2:_,_threadCount:0,Provider:null,Consumer:null},_.Provider=_,_.Consumer={$$typeof:s,_context:_},_},He.createElement=function(_,V,T){var Y,fe={},oe=null;if(V!=null)for(Y in V.key!==void 0&&(oe=""+V.key),V)Z.call(V,Y)&&Y!=="key"&&Y!=="__self"&&Y!=="__source"&&(fe[Y]=V[Y]);var Ne=arguments.length-2;if(Ne===1)fe.children=T;else if(1<Ne){for(var Fe=Array(Ne),Ue=0;Ue<Ne;Ue++)Fe[Ue]=arguments[Ue+2];fe.children=Fe}if(_&&_.defaultProps)for(Y in Ne=_.defaultProps,Ne)fe[Y]===void 0&&(fe[Y]=Ne[Y]);return j(_,oe,fe)},He.createRef=function(){return{current:null}},He.forwardRef=function(_){return{$$typeof:c,render:_}},He.isValidElement=re,He.lazy=function(_){return{$$typeof:p,_payload:{_status:-1,_result:_},_init:me}},He.memo=function(_,V){return{$$typeof:d,type:_,compare:V===void 0?null:V}},He.startTransition=function(_){var V=N.T,T={};N.T=T;try{var Y=_(),fe=N.S;fe!==null&&fe(T,Y),typeof Y=="object"&&Y!==null&&typeof Y.then=="function"&&Y.then(R,Te)}catch(oe){Te(oe)}finally{V!==null&&T.types!==null&&(V.types=T.types),N.T=V}},He.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},He.use=function(_){return N.H.use(_)},He.useActionState=function(_,V,T){return N.H.useActionState(_,V,T)},He.useCallback=function(_,V){return N.H.useCallback(_,V)},He.useContext=function(_){return N.H.useContext(_)},He.useDebugValue=function(){},He.useDeferredValue=function(_,V){return N.H.useDeferredValue(_,V)},He.useEffect=function(_,V){return N.H.useEffect(_,V)},He.useEffectEvent=function(_){return N.H.useEffectEvent(_)},He.useId=function(){return N.H.useId()},He.useImperativeHandle=function(_,V,T){return N.H.useImperativeHandle(_,V,T)},He.useInsertionEffect=function(_,V){return N.H.useInsertionEffect(_,V)},He.useLayoutEffect=function(_,V){return N.H.useLayoutEffect(_,V)},He.useMemo=function(_,V){return N.H.useMemo(_,V)},He.useOptimistic=function(_,V){return N.H.useOptimistic(_,V)},He.useReducer=function(_,V,T){return N.H.useReducer(_,V,T)},He.useRef=function(_){return N.H.useRef(_)},He.useState=function(_){return N.H.useState(_)},He.useSyncExternalStore=function(_,V,T){return N.H.useSyncExternalStore(_,V,T)},He.useTransition=function(){return N.H.useTransition()},He.version="19.2.4",He}var aC;function Mx(){return aC||(aC=1,qy.exports=vz()),qy.exports}var O=Mx();const hn=Jp(O);var Yy={exports:{}},Jc={},Ky={exports:{}},Wy={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var cC;function kz(){return cC||(cC=1,(function(t){function e(L,G){var me=L.length;L.push(G);e:for(;0<me;){var Te=me-1>>>1,M=L[Te];if(0<i(M,G))L[Te]=G,L[me]=M,me=Te;else break e}}function n(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var G=L[0],me=L.pop();if(me!==G){L[0]=me;e:for(var Te=0,M=L.length,_=M>>>1;Te<_;){var V=2*(Te+1)-1,T=L[V],Y=V+1,fe=L[Y];if(0>i(T,me))Y<M&&0>i(fe,T)?(L[Te]=fe,L[Y]=me,Te=Y):(L[Te]=T,L[V]=me,Te=V);else if(Y<M&&0>i(fe,me))L[Te]=fe,L[Y]=me,Te=Y;else break e}}return G}function i(L,G){var me=L.sortIndex-G.sortIndex;return me!==0?me:L.id-G.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var l=Date,c=l.now();t.unstable_now=function(){return l.now()-c}}var f=[],d=[],p=1,m=null,g=3,b=!1,S=!1,v=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function ne(L){for(var G=n(d);G!==null;){if(G.callback===null)r(d);else if(G.startTime<=L)r(d),G.sortIndex=G.expirationTime,e(f,G);else break;G=n(d)}}function F(L){if(v=!1,ne(L),!S)if(n(f)!==null)S=!0,R||(R=!0,se());else{var G=n(d);G!==null&&H(F,G.startTime-L)}}var R=!1,N=-1,Z=5,j=-1;function ie(){return C?!0:!(t.unstable_now()-j<Z)}function re(){if(C=!1,R){var L=t.unstable_now();j=L;var G=!0;try{e:{S=!1,v&&(v=!1,B(N),N=-1),b=!0;var me=g;try{t:{for(ne(L),m=n(f);m!==null&&!(m.expirationTime>L&&ie());){var Te=m.callback;if(typeof Te=="function"){m.callback=null,g=m.priorityLevel;var M=Te(m.expirationTime<=L);if(L=t.unstable_now(),typeof M=="function"){m.callback=M,ne(L),G=!0;break t}m===n(f)&&r(f),ne(L)}else r(f);m=n(f)}if(m!==null)G=!0;else{var _=n(d);_!==null&&H(F,_.startTime-L),G=!1}}break e}finally{m=null,g=me,b=!1}G=void 0}}finally{G?se():R=!1}}}var se;if(typeof I=="function")se=function(){I(re)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,ue=be.port2;be.port1.onmessage=re,se=function(){ue.postMessage(null)}}else se=function(){E(re,0)};function H(L,G){N=E(function(){L(t.unstable_now())},G)}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(L){L.callback=null},t.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Z=0<L?Math.floor(1e3/L):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function(L){switch(g){case 1:case 2:case 3:var G=3;break;default:G=g}var me=g;g=G;try{return L()}finally{g=me}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(L,G){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var me=g;g=L;try{return G()}finally{g=me}},t.unstable_scheduleCallback=function(L,G,me){var Te=t.unstable_now();switch(typeof me=="object"&&me!==null?(me=me.delay,me=typeof me=="number"&&0<me?Te+me:Te):me=Te,L){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=me+M,L={id:p++,callback:G,priorityLevel:L,startTime:me,expirationTime:M,sortIndex:-1},me>Te?(L.sortIndex=me,e(d,L),n(f)===null&&L===n(d)&&(v?(B(N),N=-1):v=!0,H(F,me-Te))):(L.sortIndex=M,e(f,L),S||b||(S=!0,R||(R=!0,se()))),L},t.unstable_shouldYield=ie,t.unstable_wrapCallback=function(L){var G=g;return function(){var me=g;g=G;try{return L.apply(this,arguments)}finally{g=me}}}})(Wy)),Wy}var uC;function Cz(){return uC||(uC=1,Ky.exports=kz()),Ky.exports}var Gy={exports:{}},Ln={};/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var fC;function Ez(){if(fC)return Ln;fC=1;var t=Mx();function e(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(f,d,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:m==null?null:""+m,children:f,containerInfo:d,implementation:p}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(f,d){if(f==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Ln.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Ln.createPortal=function(f,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return s(f,d,null,p)},Ln.flushSync=function(f){var d=l.T,p=r.p;try{if(l.T=null,r.p=2,f)return f()}finally{l.T=d,r.p=p,r.d.f()}},Ln.preconnect=function(f,d){typeof f=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(f,d))},Ln.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},Ln.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var p=d.as,m=c(p,d.crossOrigin),g=typeof d.integrity=="string"?d.integrity:void 0,b=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?r.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:m,integrity:g,fetchPriority:b}):p==="script"&&r.d.X(f,{crossOrigin:m,integrity:g,fetchPriority:b,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Ln.preinitModule=function(f,d){if(typeof f=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=c(d.as,d.crossOrigin);r.d.M(f,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(f)},Ln.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,m=c(p,d.crossOrigin);r.d.L(f,p,{crossOrigin:m,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Ln.preloadModule=function(f,d){if(typeof f=="string")if(d){var p=c(d.as,d.crossOrigin);r.d.m(f,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(f)},Ln.requestFormReset=function(f){r.d.r(f)},Ln.unstable_batchedUpdates=function(f,d){return f(d)},Ln.useFormState=function(f,d,p){return l.H.useFormState(f,d,p)},Ln.useFormStatus=function(){return l.H.useHostTransitionStatus()},Ln.version="19.2.4",Ln}var dC;function oM(){if(dC)return Gy.exports;dC=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Gy.exports=Ez(),Gy.exports}/**
|
|
34
|
-
* @license React
|
|
35
|
-
* react-dom-client.production.js
|
|
36
|
-
*
|
|
37
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the MIT license found in the
|
|
40
|
-
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var hC;function Tz(){if(hC)return Jc;hC=1;var t=Cz(),e=Mx(),n=oM();function r(o){var a="https://react.dev/errors/"+o;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+o+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function s(o){var a=o,u=o;if(o.alternate)for(;a.return;)a=a.return;else{o=a;do a=o,(a.flags&4098)!==0&&(u=a.return),o=a.return;while(o)}return a.tag===3?u:null}function l(o){if(o.tag===13){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function c(o){if(o.tag===31){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function f(o){if(s(o)!==o)throw Error(r(188))}function d(o){var a=o.alternate;if(!a){if(a=s(o),a===null)throw Error(r(188));return a!==o?null:o}for(var u=o,h=a;;){var y=u.return;if(y===null)break;var x=y.alternate;if(x===null){if(h=y.return,h!==null){u=h;continue}break}if(y.child===x.child){for(x=y.child;x;){if(x===u)return f(y),o;if(x===h)return f(y),a;x=x.sibling}throw Error(r(188))}if(u.return!==h.return)u=y,h=x;else{for(var w=!1,A=y.child;A;){if(A===u){w=!0,u=y,h=x;break}if(A===h){w=!0,h=y,u=x;break}A=A.sibling}if(!w){for(A=x.child;A;){if(A===u){w=!0,u=x,h=y;break}if(A===h){w=!0,h=x,u=y;break}A=A.sibling}if(!w)throw Error(r(189))}}if(u.alternate!==h)throw Error(r(190))}if(u.tag!==3)throw Error(r(188));return u.stateNode.current===u?o:a}function p(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o;for(o=o.child;o!==null;){if(a=p(o),a!==null)return a;o=o.sibling}return null}var m=Object.assign,g=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),B=Symbol.for("react.consumer"),I=Symbol.for("react.context"),ne=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),ie=Symbol.for("react.memo_cache_sentinel"),re=Symbol.iterator;function se(o){return o===null||typeof o!="object"?null:(o=re&&o[re]||o["@@iterator"],typeof o=="function"?o:null)}var be=Symbol.for("react.client.reference");function ue(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===be?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case v:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case F:return"Suspense";case R:return"SuspenseList";case j:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case S:return"Portal";case I:return o.displayName||"Context";case B:return(o._context.displayName||"Context")+".Consumer";case ne:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case N:return a=o.displayName||null,a!==null?a:ue(o.type)||"Memo";case Z:a=o._payload,o=o._init;try{return ue(o(a))}catch{}}return null}var H=Array.isArray,L=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me={pending:!1,data:null,method:null,action:null},Te=[],M=-1;function _(o){return{current:o}}function V(o){0>M||(o.current=Te[M],Te[M]=null,M--)}function T(o,a){M++,Te[M]=o.current,o.current=a}var Y=_(null),fe=_(null),oe=_(null),Ne=_(null);function Fe(o,a){switch(T(oe,a),T(fe,o),T(Y,null),a.nodeType){case 9:case 11:o=(o=a.documentElement)&&(o=o.namespaceURI)?Mk(o):0;break;default:if(o=a.tagName,a=a.namespaceURI)a=Mk(a),o=Ok(a,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}V(Y),T(Y,o)}function Ue(){V(Y),V(fe),V(oe)}function mt(o){o.memoizedState!==null&&T(Ne,o);var a=Y.current,u=Ok(a,o.type);a!==u&&(T(fe,o),T(Y,u))}function _e(o){fe.current===o&&(V(Y),V(fe)),Ne.current===o&&(V(Ne),Yc._currentValue=me)}var ze,Lt;function Rt(o){if(ze===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);ze=a&&a[1]||"",Lt=-1<u.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+ze+o+Lt}var Nt=!1;function wn(o,a){if(!o||Nt)return"";Nt=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(W){var q=W}Reflect.construct(o,[],ee)}else{try{ee.call()}catch(W){q=W}o.call(ee.prototype)}}else{try{throw Error()}catch(W){q=W}(ee=o())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(W){if(W&&q&&typeof W.stack=="string")return[W.stack,q.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=h.DetermineComponentFrameRoot(),w=x[0],A=x[1];if(w&&A){var D=w.split(`
|
|
44
|
-
`),$=A.split(`
|
|
45
|
-
`);for(y=h=0;h<D.length&&!D[h].includes("DetermineComponentFrameRoot");)h++;for(;y<$.length&&!$[y].includes("DetermineComponentFrameRoot");)y++;if(h===D.length||y===$.length)for(h=D.length-1,y=$.length-1;1<=h&&0<=y&&D[h]!==$[y];)y--;for(;1<=h&&0<=y;h--,y--)if(D[h]!==$[y]){if(h!==1||y!==1)do if(h--,y--,0>y||D[h]!==$[y]){var X=`
|
|
46
|
-
`+D[h].replace(" at new "," at ");return o.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",o.displayName)),X}while(1<=h&&0<=y);break}}}finally{Nt=!1,Error.prepareStackTrace=u}return(u=o?o.displayName||o.name:"")?Rt(u):""}function ei(o,a){switch(o.tag){case 26:case 27:case 5:return Rt(o.type);case 16:return Rt("Lazy");case 13:return o.child!==a&&a!==null?Rt("Suspense Fallback"):Rt("Suspense");case 19:return Rt("SuspenseList");case 0:case 15:return wn(o.type,!1);case 11:return wn(o.type.render,!1);case 1:return wn(o.type,!0);case 31:return Rt("Activity");default:return""}}function dr(o){try{var a="",u=null;do a+=ei(o,u),u=o,o=o.return;while(o);return a}catch(h){return`
|
|
47
|
-
Error generating stack: `+h.message+`
|
|
48
|
-
`+h.stack}}var hr=Object.prototype.hasOwnProperty,Jn=t.unstable_scheduleCallback,Jt=t.unstable_cancelCallback,di=t.unstable_shouldYield,ys=t.unstable_requestPaint,qt=t.unstable_now,pr=t.unstable_getCurrentPriorityLevel,J=t.unstable_ImmediatePriority,de=t.unstable_UserBlockingPriority,Ae=t.unstable_NormalPriority,K=t.unstable_LowPriority,pe=t.unstable_IdlePriority,De=t.log,Je=t.unstable_setDisableYieldValue,Re=null,Ie=null;function le(o){if(typeof De=="function"&&Je(o),Ie&&typeof Ie.setStrictMode=="function")try{Ie.setStrictMode(Re,o)}catch{}}var Ze=Math.clz32?Math.clz32:Rm,It=Math.log,vn=Math.LN2;function Rm(o){return o>>>=0,o===0?32:31-(It(o)/vn|0)|0}var ye=256,St=262144,Yt=4194304;function kn(o){var a=o&42;if(a!==0)return a;switch(o&-o){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Or(o,a,u){var h=o.pendingLanes;if(h===0)return 0;var y=0,x=o.suspendedLanes,w=o.pingedLanes;o=o.warmLanes;var A=h&134217727;return A!==0?(h=A&~x,h!==0?y=kn(h):(w&=A,w!==0?y=kn(w):u||(u=A&~o,u!==0&&(y=kn(u))))):(A=h&~x,A!==0?y=kn(A):w!==0?y=kn(w):u||(u=h&~o,u!==0&&(y=kn(u)))),y===0?0:a!==0&&a!==y&&(a&x)===0&&(x=y&-y,u=a&-a,x>=u||x===32&&(u&4194048)!==0)?a:y}function bs(o,a){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&a)===0}function vo(o,a){switch(o){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32: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 a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function wl(){var o=Yt;return Yt<<=1,(Yt&62914560)===0&&(Yt=4194304),o}function ko(o){for(var a=[],u=0;31>u;u++)a.push(o);return a}function ji(o,a){o.pendingLanes|=a,a!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Af(o,a,u,h,y,x){var w=o.pendingLanes;o.pendingLanes=u,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=u,o.entangledLanes&=u,o.errorRecoveryDisabledLanes&=u,o.shellSuspendCounter=0;var A=o.entanglements,D=o.expirationTimes,$=o.hiddenUpdates;for(u=w&~u;0<u;){var X=31-Ze(u),ee=1<<X;A[X]=0,D[X]=-1;var q=$[X];if(q!==null)for($[X]=null,X=0;X<q.length;X++){var W=q[X];W!==null&&(W.lane&=-536870913)}u&=~ee}h!==0&&Mf(o,h,0),x!==0&&y===0&&o.tag!==0&&(o.suspendedLanes|=x&~(w&~a))}function Mf(o,a,u){o.pendingLanes|=a,o.suspendedLanes&=~a;var h=31-Ze(a);o.entangledLanes|=a,o.entanglements[h]=o.entanglements[h]|1073741824|u&261930}function xs(o,a){var u=o.entangledLanes|=a;for(o=o.entanglements;u;){var h=31-Ze(u),y=1<<h;y&a|o[h]&a&&(o[h]|=a),u&=~y}}function dS(o,a){var u=a&-a;return u=(u&42)!==0?1:Nm(u),(u&(o.suspendedLanes|a))!==0?0:u}function Nm(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;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:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function zm(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function hS(){var o=G.p;return o!==0?o:(o=window.event,o===void 0?32:Xk(o.type))}function pS(o,a){var u=G.p;try{return G.p=o,a()}finally{G.p=u}}var Ss=Math.random().toString(36).slice(2),Cn="__reactFiber$"+Ss,Xn="__reactProps$"+Ss,vl="__reactContainer$"+Ss,Lm="__reactEvents$"+Ss,lR="__reactListeners$"+Ss,aR="__reactHandles$"+Ss,mS="__reactResources$"+Ss,lc="__reactMarker$"+Ss;function jm(o){delete o[Cn],delete o[Xn],delete o[Lm],delete o[lR],delete o[aR]}function kl(o){var a=o[Cn];if(a)return a;for(var u=o.parentNode;u;){if(a=u[vl]||u[Cn]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(o=jk(o);o!==null;){if(u=o[Cn])return u;o=jk(o)}return a}o=u,u=o.parentNode}return null}function Cl(o){if(o=o[Cn]||o[vl]){var a=o.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return o}return null}function ac(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o.stateNode;throw Error(r(33))}function El(o){var a=o[mS];return a||(a=o[mS]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function cn(o){o[lc]=!0}var gS=new Set,yS={};function Co(o,a){Tl(o,a),Tl(o+"Capture",a)}function Tl(o,a){for(yS[o]=a,o=0;o<a.length;o++)gS.add(a[o])}var cR=RegExp("^[: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]*$"),bS={},xS={};function uR(o){return hr.call(xS,o)?!0:hr.call(bS,o)?!1:cR.test(o)?xS[o]=!0:(bS[o]=!0,!1)}function Of(o,a,u){if(uR(a))if(u===null)o.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":o.removeAttribute(a);return;case"boolean":var h=a.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){o.removeAttribute(a);return}}o.setAttribute(a,""+u)}}function _f(o,a,u){if(u===null)o.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(a);return}o.setAttribute(a,""+u)}}function Ii(o,a,u,h){if(h===null)o.removeAttribute(u);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(u);return}o.setAttributeNS(a,u,""+h)}}function _r(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function SS(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function fR(o,a,u){var h=Object.getOwnPropertyDescriptor(o.constructor.prototype,a);if(!o.hasOwnProperty(a)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var y=h.get,x=h.set;return Object.defineProperty(o,a,{configurable:!0,get:function(){return y.call(this)},set:function(w){u=""+w,x.call(this,w)}}),Object.defineProperty(o,a,{enumerable:h.enumerable}),{getValue:function(){return u},setValue:function(w){u=""+w},stopTracking:function(){o._valueTracker=null,delete o[a]}}}}function Im(o){if(!o._valueTracker){var a=SS(o)?"checked":"value";o._valueTracker=fR(o,a,""+o[a])}}function wS(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var u=a.getValue(),h="";return o&&(h=SS(o)?o.checked?"true":"false":o.value),o=h,o!==u?(a.setValue(o),!0):!1}function Df(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var dR=/[\n"\\]/g;function Dr(o){return o.replace(dR,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Bm(o,a,u,h,y,x,w,A){o.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?o.type=w:o.removeAttribute("type"),a!=null?w==="number"?(a===0&&o.value===""||o.value!=a)&&(o.value=""+_r(a)):o.value!==""+_r(a)&&(o.value=""+_r(a)):w!=="submit"&&w!=="reset"||o.removeAttribute("value"),a!=null?Um(o,w,_r(a)):u!=null?Um(o,w,_r(u)):h!=null&&o.removeAttribute("value"),y==null&&x!=null&&(o.defaultChecked=!!x),y!=null&&(o.checked=y&&typeof y!="function"&&typeof y!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?o.name=""+_r(A):o.removeAttribute("name")}function vS(o,a,u,h,y,x,w,A){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(o.type=x),a!=null||u!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){Im(o);return}u=u!=null?""+_r(u):"",a=a!=null?""+_r(a):u,A||a===o.value||(o.value=a),o.defaultValue=a}h=h??y,h=typeof h!="function"&&typeof h!="symbol"&&!!h,o.checked=A?o.checked:!!h,o.defaultChecked=!!h,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(o.name=w),Im(o)}function Um(o,a,u){a==="number"&&Df(o.ownerDocument)===o||o.defaultValue===""+u||(o.defaultValue=""+u)}function Al(o,a,u,h){if(o=o.options,a){a={};for(var y=0;y<u.length;y++)a["$"+u[y]]=!0;for(u=0;u<o.length;u++)y=a.hasOwnProperty("$"+o[u].value),o[u].selected!==y&&(o[u].selected=y),y&&h&&(o[u].defaultSelected=!0)}else{for(u=""+_r(u),a=null,y=0;y<o.length;y++){if(o[y].value===u){o[y].selected=!0,h&&(o[y].defaultSelected=!0);return}a!==null||o[y].disabled||(a=o[y])}a!==null&&(a.selected=!0)}}function kS(o,a,u){if(a!=null&&(a=""+_r(a),a!==o.value&&(o.value=a),u==null)){o.defaultValue!==a&&(o.defaultValue=a);return}o.defaultValue=u!=null?""+_r(u):""}function CS(o,a,u,h){if(a==null){if(h!=null){if(u!=null)throw Error(r(92));if(H(h)){if(1<h.length)throw Error(r(93));h=h[0]}u=h}u==null&&(u=""),a=u}u=_r(a),o.defaultValue=u,h=o.textContent,h===u&&h!==""&&h!==null&&(o.value=h),Im(o)}function Ml(o,a){if(a){var u=o.firstChild;if(u&&u===o.lastChild&&u.nodeType===3){u.nodeValue=a;return}}o.textContent=a}var hR=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function ES(o,a,u){var h=a.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?h?o.setProperty(a,""):a==="float"?o.cssFloat="":o[a]="":h?o.setProperty(a,u):typeof u!="number"||u===0||hR.has(a)?a==="float"?o.cssFloat=u:o[a]=(""+u).trim():o[a]=u+"px"}function TS(o,a,u){if(a!=null&&typeof a!="object")throw Error(r(62));if(o=o.style,u!=null){for(var h in u)!u.hasOwnProperty(h)||a!=null&&a.hasOwnProperty(h)||(h.indexOf("--")===0?o.setProperty(h,""):h==="float"?o.cssFloat="":o[h]="");for(var y in a)h=a[y],a.hasOwnProperty(y)&&u[y]!==h&&ES(o,y,h)}else for(var x in a)a.hasOwnProperty(x)&&ES(o,x,a[x])}function Hm(o){if(o.indexOf("-")===-1)return!1;switch(o){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 pR=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),mR=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Rf(o){return mR.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Bi(){}var Vm=null;function Pm(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Ol=null,_l=null;function AS(o){var a=Cl(o);if(a&&(o=a.stateNode)){var u=o[Xn]||null;e:switch(o=a.stateNode,a.type){case"input":if(Bm(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),a=u.name,u.type==="radio"&&a!=null){for(u=o;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Dr(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var h=u[a];if(h!==o&&h.form===o.form){var y=h[Xn]||null;if(!y)throw Error(r(90));Bm(h,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(a=0;a<u.length;a++)h=u[a],h.form===o.form&&wS(h)}break e;case"textarea":kS(o,u.value,u.defaultValue);break e;case"select":a=u.value,a!=null&&Al(o,!!u.multiple,a,!1)}}}var $m=!1;function MS(o,a,u){if($m)return o(a,u);$m=!0;try{var h=o(a);return h}finally{if($m=!1,(Ol!==null||_l!==null)&&(xd(),Ol&&(a=Ol,o=_l,_l=Ol=null,AS(a),o)))for(a=0;a<o.length;a++)AS(o[a])}}function cc(o,a){var u=o.stateNode;if(u===null)return null;var h=u[Xn]||null;if(h===null)return null;u=h[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(o=o.type,h=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!h;break e;default:o=!1}if(o)return null;if(u&&typeof u!="function")throw Error(r(231,a,typeof u));return u}var Ui=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fm=!1;if(Ui)try{var uc={};Object.defineProperty(uc,"passive",{get:function(){Fm=!0}}),window.addEventListener("test",uc,uc),window.removeEventListener("test",uc,uc)}catch{Fm=!1}var ws=null,qm=null,Nf=null;function OS(){if(Nf)return Nf;var o,a=qm,u=a.length,h,y="value"in ws?ws.value:ws.textContent,x=y.length;for(o=0;o<u&&a[o]===y[o];o++);var w=u-o;for(h=1;h<=w&&a[u-h]===y[x-h];h++);return Nf=y.slice(o,1<h?1-h:void 0)}function zf(o){var a=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&a===13&&(o=13)):o=a,o===10&&(o=13),32<=o||o===13?o:0}function Lf(){return!0}function _S(){return!1}function Qn(o){function a(u,h,y,x,w){this._reactName=u,this._targetInst=y,this.type=h,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var A in o)o.hasOwnProperty(A)&&(u=o[A],this[A]=u?u(x):x[A]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Lf:_S,this.isPropagationStopped=_S,this}return m(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=Lf)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Lf)},persist:function(){},isPersistent:Lf}),a}var Eo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},jf=Qn(Eo),fc=m({},Eo,{view:0,detail:0}),gR=Qn(fc),Ym,Km,dc,If=m({},fc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gm,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==dc&&(dc&&o.type==="mousemove"?(Ym=o.screenX-dc.screenX,Km=o.screenY-dc.screenY):Km=Ym=0,dc=o),Ym)},movementY:function(o){return"movementY"in o?o.movementY:Km}}),DS=Qn(If),yR=m({},If,{dataTransfer:0}),bR=Qn(yR),xR=m({},fc,{relatedTarget:0}),Wm=Qn(xR),SR=m({},Eo,{animationName:0,elapsedTime:0,pseudoElement:0}),wR=Qn(SR),vR=m({},Eo,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),kR=Qn(vR),CR=m({},Eo,{data:0}),RS=Qn(CR),ER={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},TR={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"},AR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function MR(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=AR[o])?!!a[o]:!1}function Gm(){return MR}var OR=m({},fc,{key:function(o){if(o.key){var a=ER[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=zf(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?TR[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gm,charCode:function(o){return o.type==="keypress"?zf(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?zf(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),_R=Qn(OR),DR=m({},If,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),NS=Qn(DR),RR=m({},fc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gm}),NR=Qn(RR),zR=m({},Eo,{propertyName:0,elapsedTime:0,pseudoElement:0}),LR=Qn(zR),jR=m({},If,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),IR=Qn(jR),BR=m({},Eo,{newState:0,oldState:0}),UR=Qn(BR),HR=[9,13,27,32],Zm=Ui&&"CompositionEvent"in window,hc=null;Ui&&"documentMode"in document&&(hc=document.documentMode);var VR=Ui&&"TextEvent"in window&&!hc,zS=Ui&&(!Zm||hc&&8<hc&&11>=hc),LS=" ",jS=!1;function IS(o,a){switch(o){case"keyup":return HR.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function BS(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Dl=!1;function PR(o,a){switch(o){case"compositionend":return BS(a);case"keypress":return a.which!==32?null:(jS=!0,LS);case"textInput":return o=a.data,o===LS&&jS?null:o;default:return null}}function $R(o,a){if(Dl)return o==="compositionend"||!Zm&&IS(o,a)?(o=OS(),Nf=qm=ws=null,Dl=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return zS&&a.locale!=="ko"?null:a.data;default:return null}}var FR={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 US(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!FR[o.type]:a==="textarea"}function HS(o,a,u,h){Ol?_l?_l.push(h):_l=[h]:Ol=h,a=Td(a,"onChange"),0<a.length&&(u=new jf("onChange","change",null,u,h),o.push({event:u,listeners:a}))}var pc=null,mc=null;function qR(o){vk(o,0)}function Bf(o){var a=ac(o);if(wS(a))return o}function VS(o,a){if(o==="change")return a}var PS=!1;if(Ui){var Jm;if(Ui){var Xm="oninput"in document;if(!Xm){var $S=document.createElement("div");$S.setAttribute("oninput","return;"),Xm=typeof $S.oninput=="function"}Jm=Xm}else Jm=!1;PS=Jm&&(!document.documentMode||9<document.documentMode)}function FS(){pc&&(pc.detachEvent("onpropertychange",qS),mc=pc=null)}function qS(o){if(o.propertyName==="value"&&Bf(mc)){var a=[];HS(a,mc,o,Pm(o)),MS(qR,a)}}function YR(o,a,u){o==="focusin"?(FS(),pc=a,mc=u,pc.attachEvent("onpropertychange",qS)):o==="focusout"&&FS()}function KR(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Bf(mc)}function WR(o,a){if(o==="click")return Bf(a)}function GR(o,a){if(o==="input"||o==="change")return Bf(a)}function ZR(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var mr=typeof Object.is=="function"?Object.is:ZR;function gc(o,a){if(mr(o,a))return!0;if(typeof o!="object"||o===null||typeof a!="object"||a===null)return!1;var u=Object.keys(o),h=Object.keys(a);if(u.length!==h.length)return!1;for(h=0;h<u.length;h++){var y=u[h];if(!hr.call(a,y)||!mr(o[y],a[y]))return!1}return!0}function YS(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function KS(o,a){var u=YS(o);o=0;for(var h;u;){if(u.nodeType===3){if(h=o+u.textContent.length,o<=a&&h>=a)return{node:u,offset:a-o};o=h}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=YS(u)}}function WS(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?WS(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function GS(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var a=Df(o.document);a instanceof o.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)o=a.contentWindow;else break;a=Df(o.document)}return a}function Qm(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a&&(a==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||a==="textarea"||o.contentEditable==="true")}var JR=Ui&&"documentMode"in document&&11>=document.documentMode,Rl=null,eg=null,yc=null,tg=!1;function ZS(o,a,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;tg||Rl==null||Rl!==Df(h)||(h=Rl,"selectionStart"in h&&Qm(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),yc&&gc(yc,h)||(yc=h,h=Td(eg,"onSelect"),0<h.length&&(a=new jf("onSelect","select",null,a,u),o.push({event:a,listeners:h}),a.target=Rl)))}function To(o,a){var u={};return u[o.toLowerCase()]=a.toLowerCase(),u["Webkit"+o]="webkit"+a,u["Moz"+o]="moz"+a,u}var Nl={animationend:To("Animation","AnimationEnd"),animationiteration:To("Animation","AnimationIteration"),animationstart:To("Animation","AnimationStart"),transitionrun:To("Transition","TransitionRun"),transitionstart:To("Transition","TransitionStart"),transitioncancel:To("Transition","TransitionCancel"),transitionend:To("Transition","TransitionEnd")},ng={},JS={};Ui&&(JS=document.createElement("div").style,"AnimationEvent"in window||(delete Nl.animationend.animation,delete Nl.animationiteration.animation,delete Nl.animationstart.animation),"TransitionEvent"in window||delete Nl.transitionend.transition);function Ao(o){if(ng[o])return ng[o];if(!Nl[o])return o;var a=Nl[o],u;for(u in a)if(a.hasOwnProperty(u)&&u in JS)return ng[o]=a[u];return o}var XS=Ao("animationend"),QS=Ao("animationiteration"),ew=Ao("animationstart"),XR=Ao("transitionrun"),QR=Ao("transitionstart"),eN=Ao("transitioncancel"),tw=Ao("transitionend"),nw=new Map,rg="abort auxClick beforeToggle 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(" ");rg.push("scrollEnd");function ti(o,a){nw.set(o,a),Co(a,[o])}var Uf=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Rr=[],zl=0,ig=0;function Hf(){for(var o=zl,a=ig=zl=0;a<o;){var u=Rr[a];Rr[a++]=null;var h=Rr[a];Rr[a++]=null;var y=Rr[a];Rr[a++]=null;var x=Rr[a];if(Rr[a++]=null,h!==null&&y!==null){var w=h.pending;w===null?y.next=y:(y.next=w.next,w.next=y),h.pending=y}x!==0&&rw(u,y,x)}}function Vf(o,a,u,h){Rr[zl++]=o,Rr[zl++]=a,Rr[zl++]=u,Rr[zl++]=h,ig|=h,o.lanes|=h,o=o.alternate,o!==null&&(o.lanes|=h)}function sg(o,a,u,h){return Vf(o,a,u,h),Pf(o)}function Mo(o,a){return Vf(o,null,null,a),Pf(o)}function rw(o,a,u){o.lanes|=u;var h=o.alternate;h!==null&&(h.lanes|=u);for(var y=!1,x=o.return;x!==null;)x.childLanes|=u,h=x.alternate,h!==null&&(h.childLanes|=u),x.tag===22&&(o=x.stateNode,o===null||o._visibility&1||(y=!0)),o=x,x=x.return;return o.tag===3?(x=o.stateNode,y&&a!==null&&(y=31-Ze(u),o=x.hiddenUpdates,h=o[y],h===null?o[y]=[a]:h.push(a),a.lane=u|536870912),x):null}function Pf(o){if(50<Uc)throw Uc=0,py=null,Error(r(185));for(var a=o.return;a!==null;)o=a,a=o.return;return o.tag===3?o.stateNode:null}var Ll={};function tN(o,a,u,h){this.tag=o,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gr(o,a,u,h){return new tN(o,a,u,h)}function og(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Hi(o,a){var u=o.alternate;return u===null?(u=gr(o.tag,a,o.key,o.mode),u.elementType=o.elementType,u.type=o.type,u.stateNode=o.stateNode,u.alternate=o,o.alternate=u):(u.pendingProps=a,u.type=o.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=o.flags&65011712,u.childLanes=o.childLanes,u.lanes=o.lanes,u.child=o.child,u.memoizedProps=o.memoizedProps,u.memoizedState=o.memoizedState,u.updateQueue=o.updateQueue,a=o.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=o.sibling,u.index=o.index,u.ref=o.ref,u.refCleanup=o.refCleanup,u}function iw(o,a){o.flags&=65011714;var u=o.alternate;return u===null?(o.childLanes=0,o.lanes=a,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=u.childLanes,o.lanes=u.lanes,o.child=u.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=u.memoizedProps,o.memoizedState=u.memoizedState,o.updateQueue=u.updateQueue,o.type=u.type,a=u.dependencies,o.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),o}function $f(o,a,u,h,y,x){var w=0;if(h=o,typeof o=="function")og(o)&&(w=1);else if(typeof o=="string")w=oz(o,u,Y.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case j:return o=gr(31,u,a,y),o.elementType=j,o.lanes=x,o;case v:return Oo(u.children,y,x,a);case C:w=8,y|=24;break;case E:return o=gr(12,u,a,y|2),o.elementType=E,o.lanes=x,o;case F:return o=gr(13,u,a,y),o.elementType=F,o.lanes=x,o;case R:return o=gr(19,u,a,y),o.elementType=R,o.lanes=x,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case I:w=10;break e;case B:w=9;break e;case ne:w=11;break e;case N:w=14;break e;case Z:w=16,h=null;break e}w=29,u=Error(r(130,o===null?"null":typeof o,"")),h=null}return a=gr(w,u,a,y),a.elementType=o,a.type=h,a.lanes=x,a}function Oo(o,a,u,h){return o=gr(7,o,h,a),o.lanes=u,o}function lg(o,a,u){return o=gr(6,o,null,a),o.lanes=u,o}function sw(o){var a=gr(18,null,null,0);return a.stateNode=o,a}function ag(o,a,u){return a=gr(4,o.children!==null?o.children:[],o.key,a),a.lanes=u,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}var ow=new WeakMap;function Nr(o,a){if(typeof o=="object"&&o!==null){var u=ow.get(o);return u!==void 0?u:(a={value:o,source:a,stack:dr(a)},ow.set(o,a),a)}return{value:o,source:a,stack:dr(a)}}var jl=[],Il=0,Ff=null,bc=0,zr=[],Lr=0,vs=null,hi=1,pi="";function Vi(o,a){jl[Il++]=bc,jl[Il++]=Ff,Ff=o,bc=a}function lw(o,a,u){zr[Lr++]=hi,zr[Lr++]=pi,zr[Lr++]=vs,vs=o;var h=hi;o=pi;var y=32-Ze(h)-1;h&=~(1<<y),u+=1;var x=32-Ze(a)+y;if(30<x){var w=y-y%5;x=(h&(1<<w)-1).toString(32),h>>=w,y-=w,hi=1<<32-Ze(a)+y|u<<y|h,pi=x+o}else hi=1<<x|u<<y|h,pi=o}function cg(o){o.return!==null&&(Vi(o,1),lw(o,1,0))}function ug(o){for(;o===Ff;)Ff=jl[--Il],jl[Il]=null,bc=jl[--Il],jl[Il]=null;for(;o===vs;)vs=zr[--Lr],zr[Lr]=null,pi=zr[--Lr],zr[Lr]=null,hi=zr[--Lr],zr[Lr]=null}function aw(o,a){zr[Lr++]=hi,zr[Lr++]=pi,zr[Lr++]=vs,hi=a.id,pi=a.overflow,vs=o}var En=null,Mt=null,st=!1,ks=null,jr=!1,fg=Error(r(519));function Cs(o){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw xc(Nr(a,o)),fg}function cw(o){var a=o.stateNode,u=o.type,h=o.memoizedProps;switch(a[Cn]=o,a[Xn]=h,u){case"dialog":tt("cancel",a),tt("close",a);break;case"iframe":case"object":case"embed":tt("load",a);break;case"video":case"audio":for(u=0;u<Vc.length;u++)tt(Vc[u],a);break;case"source":tt("error",a);break;case"img":case"image":case"link":tt("error",a),tt("load",a);break;case"details":tt("toggle",a);break;case"input":tt("invalid",a),vS(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":tt("invalid",a);break;case"textarea":tt("invalid",a),CS(a,h.value,h.defaultValue,h.children)}u=h.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||a.textContent===""+u||h.suppressHydrationWarning===!0||Tk(a.textContent,u)?(h.popover!=null&&(tt("beforetoggle",a),tt("toggle",a)),h.onScroll!=null&&tt("scroll",a),h.onScrollEnd!=null&&tt("scrollend",a),h.onClick!=null&&(a.onclick=Bi),a=!0):a=!1,a||Cs(o,!0)}function uw(o){for(En=o.return;En;)switch(En.tag){case 5:case 31:case 13:jr=!1;return;case 27:case 3:jr=!0;return;default:En=En.return}}function Bl(o){if(o!==En)return!1;if(!st)return uw(o),st=!0,!1;var a=o.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=o.type,u=!(u!=="form"&&u!=="button")||Oy(o.type,o.memoizedProps)),u=!u),u&&Mt&&Cs(o),uw(o),a===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Mt=Lk(o)}else if(a===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Mt=Lk(o)}else a===27?(a=Mt,Bs(o.type)?(o=zy,zy=null,Mt=o):Mt=a):Mt=En?Br(o.stateNode.nextSibling):null;return!0}function _o(){Mt=En=null,st=!1}function dg(){var o=ks;return o!==null&&(rr===null?rr=o:rr.push.apply(rr,o),ks=null),o}function xc(o){ks===null?ks=[o]:ks.push(o)}var hg=_(null),Do=null,Pi=null;function Es(o,a,u){T(hg,a._currentValue),a._currentValue=u}function $i(o){o._currentValue=hg.current,V(hg)}function pg(o,a,u){for(;o!==null;){var h=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,h!==null&&(h.childLanes|=a)):h!==null&&(h.childLanes&a)!==a&&(h.childLanes|=a),o===u)break;o=o.return}}function mg(o,a,u,h){var y=o.child;for(y!==null&&(y.return=o);y!==null;){var x=y.dependencies;if(x!==null){var w=y.child;x=x.firstContext;e:for(;x!==null;){var A=x;x=y;for(var D=0;D<a.length;D++)if(A.context===a[D]){x.lanes|=u,A=x.alternate,A!==null&&(A.lanes|=u),pg(x.return,u,o),h||(w=null);break e}x=A.next}}else if(y.tag===18){if(w=y.return,w===null)throw Error(r(341));w.lanes|=u,x=w.alternate,x!==null&&(x.lanes|=u),pg(w,u,o),w=null}else w=y.child;if(w!==null)w.return=y;else for(w=y;w!==null;){if(w===o){w=null;break}if(y=w.sibling,y!==null){y.return=w.return,w=y;break}w=w.return}y=w}}function Ul(o,a,u,h){o=null;for(var y=a,x=!1;y!==null;){if(!x){if((y.flags&524288)!==0)x=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var w=y.alternate;if(w===null)throw Error(r(387));if(w=w.memoizedProps,w!==null){var A=y.type;mr(y.pendingProps.value,w.value)||(o!==null?o.push(A):o=[A])}}else if(y===Ne.current){if(w=y.alternate,w===null)throw Error(r(387));w.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(o!==null?o.push(Yc):o=[Yc])}y=y.return}o!==null&&mg(a,o,u,h),a.flags|=262144}function qf(o){for(o=o.firstContext;o!==null;){if(!mr(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function Ro(o){Do=o,Pi=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function Tn(o){return fw(Do,o)}function Yf(o,a){return Do===null&&Ro(o),fw(o,a)}function fw(o,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},Pi===null){if(o===null)throw Error(r(308));Pi=a,o.dependencies={lanes:0,firstContext:a},o.flags|=524288}else Pi=Pi.next=a;return u}var nN=typeof AbortController<"u"?AbortController:function(){var o=[],a=this.signal={aborted:!1,addEventListener:function(u,h){o.push(h)}};this.abort=function(){a.aborted=!0,o.forEach(function(u){return u()})}},rN=t.unstable_scheduleCallback,iN=t.unstable_NormalPriority,Xt={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function gg(){return{controller:new nN,data:new Map,refCount:0}}function Sc(o){o.refCount--,o.refCount===0&&rN(iN,function(){o.controller.abort()})}var wc=null,yg=0,Hl=0,Vl=null;function sN(o,a){if(wc===null){var u=wc=[];yg=0,Hl=Sy(),Vl={status:"pending",value:void 0,then:function(h){u.push(h)}}}return yg++,a.then(dw,dw),a}function dw(){if(--yg===0&&wc!==null){Vl!==null&&(Vl.status="fulfilled");var o=wc;wc=null,Hl=0,Vl=null;for(var a=0;a<o.length;a++)(0,o[a])()}}function oN(o,a){var u=[],h={status:"pending",value:null,reason:null,then:function(y){u.push(y)}};return o.then(function(){h.status="fulfilled",h.value=a;for(var y=0;y<u.length;y++)(0,u[y])(a)},function(y){for(h.status="rejected",h.reason=y,y=0;y<u.length;y++)(0,u[y])(void 0)}),h}var hw=L.S;L.S=function(o,a){Zv=qt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&sN(o,a),hw!==null&&hw(o,a)};var No=_(null);function bg(){var o=No.current;return o!==null?o:wt.pooledCache}function Kf(o,a){a===null?T(No,No.current):T(No,a.pool)}function pw(){var o=bg();return o===null?null:{parent:Xt._currentValue,pool:o}}var Pl=Error(r(460)),xg=Error(r(474)),Wf=Error(r(542)),Gf={then:function(){}};function mw(o){return o=o.status,o==="fulfilled"||o==="rejected"}function gw(o,a,u){switch(u=o[u],u===void 0?o.push(a):u!==a&&(a.then(Bi,Bi),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,bw(o),o;default:if(typeof a.status=="string")a.then(Bi,Bi);else{if(o=wt,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=a,o.status="pending",o.then(function(h){if(a.status==="pending"){var y=a;y.status="fulfilled",y.value=h}},function(h){if(a.status==="pending"){var y=a;y.status="rejected",y.reason=h}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,bw(o),o}throw Lo=a,Pl}}function zo(o){try{var a=o._init;return a(o._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(Lo=u,Pl):u}}var Lo=null;function yw(){if(Lo===null)throw Error(r(459));var o=Lo;return Lo=null,o}function bw(o){if(o===Pl||o===Wf)throw Error(r(483))}var $l=null,vc=0;function Zf(o){var a=vc;return vc+=1,$l===null&&($l=[]),gw($l,o,a)}function kc(o,a){a=a.props.ref,o.ref=a!==void 0?a:null}function Jf(o,a){throw a.$$typeof===g?Error(r(525)):(o=Object.prototype.toString.call(a),Error(r(31,o==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":o)))}function xw(o){function a(U,z){if(o){var P=U.deletions;P===null?(U.deletions=[z],U.flags|=16):P.push(z)}}function u(U,z){if(!o)return null;for(;z!==null;)a(U,z),z=z.sibling;return null}function h(U){for(var z=new Map;U!==null;)U.key!==null?z.set(U.key,U):z.set(U.index,U),U=U.sibling;return z}function y(U,z){return U=Hi(U,z),U.index=0,U.sibling=null,U}function x(U,z,P){return U.index=P,o?(P=U.alternate,P!==null?(P=P.index,P<z?(U.flags|=67108866,z):P):(U.flags|=67108866,z)):(U.flags|=1048576,z)}function w(U){return o&&U.alternate===null&&(U.flags|=67108866),U}function A(U,z,P,Q){return z===null||z.tag!==6?(z=lg(P,U.mode,Q),z.return=U,z):(z=y(z,P),z.return=U,z)}function D(U,z,P,Q){var Me=P.type;return Me===v?X(U,z,P.props.children,Q,P.key):z!==null&&(z.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===Z&&zo(Me)===z.type)?(z=y(z,P.props),kc(z,P),z.return=U,z):(z=$f(P.type,P.key,P.props,null,U.mode,Q),kc(z,P),z.return=U,z)}function $(U,z,P,Q){return z===null||z.tag!==4||z.stateNode.containerInfo!==P.containerInfo||z.stateNode.implementation!==P.implementation?(z=ag(P,U.mode,Q),z.return=U,z):(z=y(z,P.children||[]),z.return=U,z)}function X(U,z,P,Q,Me){return z===null||z.tag!==7?(z=Oo(P,U.mode,Q,Me),z.return=U,z):(z=y(z,P),z.return=U,z)}function ee(U,z,P){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=lg(""+z,U.mode,P),z.return=U,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case b:return P=$f(z.type,z.key,z.props,null,U.mode,P),kc(P,z),P.return=U,P;case S:return z=ag(z,U.mode,P),z.return=U,z;case Z:return z=zo(z),ee(U,z,P)}if(H(z)||se(z))return z=Oo(z,U.mode,P,null),z.return=U,z;if(typeof z.then=="function")return ee(U,Zf(z),P);if(z.$$typeof===I)return ee(U,Yf(U,z),P);Jf(U,z)}return null}function q(U,z,P,Q){var Me=z!==null?z.key:null;if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return Me!==null?null:A(U,z,""+P,Q);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case b:return P.key===Me?D(U,z,P,Q):null;case S:return P.key===Me?$(U,z,P,Q):null;case Z:return P=zo(P),q(U,z,P,Q)}if(H(P)||se(P))return Me!==null?null:X(U,z,P,Q,null);if(typeof P.then=="function")return q(U,z,Zf(P),Q);if(P.$$typeof===I)return q(U,z,Yf(U,P),Q);Jf(U,P)}return null}function W(U,z,P,Q,Me){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return U=U.get(P)||null,A(z,U,""+Q,Me);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case b:return U=U.get(Q.key===null?P:Q.key)||null,D(z,U,Q,Me);case S:return U=U.get(Q.key===null?P:Q.key)||null,$(z,U,Q,Me);case Z:return Q=zo(Q),W(U,z,P,Q,Me)}if(H(Q)||se(Q))return U=U.get(P)||null,X(z,U,Q,Me,null);if(typeof Q.then=="function")return W(U,z,P,Zf(Q),Me);if(Q.$$typeof===I)return W(U,z,P,Yf(z,Q),Me);Jf(z,Q)}return null}function Se(U,z,P,Q){for(var Me=null,lt=null,ke=z,Ye=z=0,rt=null;ke!==null&&Ye<P.length;Ye++){ke.index>Ye?(rt=ke,ke=null):rt=ke.sibling;var at=q(U,ke,P[Ye],Q);if(at===null){ke===null&&(ke=rt);break}o&&ke&&at.alternate===null&&a(U,ke),z=x(at,z,Ye),lt===null?Me=at:lt.sibling=at,lt=at,ke=rt}if(Ye===P.length)return u(U,ke),st&&Vi(U,Ye),Me;if(ke===null){for(;Ye<P.length;Ye++)ke=ee(U,P[Ye],Q),ke!==null&&(z=x(ke,z,Ye),lt===null?Me=ke:lt.sibling=ke,lt=ke);return st&&Vi(U,Ye),Me}for(ke=h(ke);Ye<P.length;Ye++)rt=W(ke,U,Ye,P[Ye],Q),rt!==null&&(o&&rt.alternate!==null&&ke.delete(rt.key===null?Ye:rt.key),z=x(rt,z,Ye),lt===null?Me=rt:lt.sibling=rt,lt=rt);return o&&ke.forEach(function($s){return a(U,$s)}),st&&Vi(U,Ye),Me}function Le(U,z,P,Q){if(P==null)throw Error(r(151));for(var Me=null,lt=null,ke=z,Ye=z=0,rt=null,at=P.next();ke!==null&&!at.done;Ye++,at=P.next()){ke.index>Ye?(rt=ke,ke=null):rt=ke.sibling;var $s=q(U,ke,at.value,Q);if($s===null){ke===null&&(ke=rt);break}o&&ke&&$s.alternate===null&&a(U,ke),z=x($s,z,Ye),lt===null?Me=$s:lt.sibling=$s,lt=$s,ke=rt}if(at.done)return u(U,ke),st&&Vi(U,Ye),Me;if(ke===null){for(;!at.done;Ye++,at=P.next())at=ee(U,at.value,Q),at!==null&&(z=x(at,z,Ye),lt===null?Me=at:lt.sibling=at,lt=at);return st&&Vi(U,Ye),Me}for(ke=h(ke);!at.done;Ye++,at=P.next())at=W(ke,U,Ye,at.value,Q),at!==null&&(o&&at.alternate!==null&&ke.delete(at.key===null?Ye:at.key),z=x(at,z,Ye),lt===null?Me=at:lt.sibling=at,lt=at);return o&&ke.forEach(function(yz){return a(U,yz)}),st&&Vi(U,Ye),Me}function bt(U,z,P,Q){if(typeof P=="object"&&P!==null&&P.type===v&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case b:e:{for(var Me=P.key;z!==null;){if(z.key===Me){if(Me=P.type,Me===v){if(z.tag===7){u(U,z.sibling),Q=y(z,P.props.children),Q.return=U,U=Q;break e}}else if(z.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===Z&&zo(Me)===z.type){u(U,z.sibling),Q=y(z,P.props),kc(Q,P),Q.return=U,U=Q;break e}u(U,z);break}else a(U,z);z=z.sibling}P.type===v?(Q=Oo(P.props.children,U.mode,Q,P.key),Q.return=U,U=Q):(Q=$f(P.type,P.key,P.props,null,U.mode,Q),kc(Q,P),Q.return=U,U=Q)}return w(U);case S:e:{for(Me=P.key;z!==null;){if(z.key===Me)if(z.tag===4&&z.stateNode.containerInfo===P.containerInfo&&z.stateNode.implementation===P.implementation){u(U,z.sibling),Q=y(z,P.children||[]),Q.return=U,U=Q;break e}else{u(U,z);break}else a(U,z);z=z.sibling}Q=ag(P,U.mode,Q),Q.return=U,U=Q}return w(U);case Z:return P=zo(P),bt(U,z,P,Q)}if(H(P))return Se(U,z,P,Q);if(se(P)){if(Me=se(P),typeof Me!="function")throw Error(r(150));return P=Me.call(P),Le(U,z,P,Q)}if(typeof P.then=="function")return bt(U,z,Zf(P),Q);if(P.$$typeof===I)return bt(U,z,Yf(U,P),Q);Jf(U,P)}return typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint"?(P=""+P,z!==null&&z.tag===6?(u(U,z.sibling),Q=y(z,P),Q.return=U,U=Q):(u(U,z),Q=lg(P,U.mode,Q),Q.return=U,U=Q),w(U)):u(U,z)}return function(U,z,P,Q){try{vc=0;var Me=bt(U,z,P,Q);return $l=null,Me}catch(ke){if(ke===Pl||ke===Wf)throw ke;var lt=gr(29,ke,null,U.mode);return lt.lanes=Q,lt.return=U,lt}finally{}}}var jo=xw(!0),Sw=xw(!1),Ts=!1;function Sg(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wg(o,a){o=o.updateQueue,a.updateQueue===o&&(a.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function As(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Ms(o,a,u){var h=o.updateQueue;if(h===null)return null;if(h=h.shared,(ft&2)!==0){var y=h.pending;return y===null?a.next=a:(a.next=y.next,y.next=a),h.pending=a,a=Pf(o),rw(o,null,u),a}return Vf(o,h,a,u),Pf(o)}function Cc(o,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194048)!==0)){var h=a.lanes;h&=o.pendingLanes,u|=h,a.lanes=u,xs(o,u)}}function vg(o,a){var u=o.updateQueue,h=o.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var y=null,x=null;if(u=u.firstBaseUpdate,u!==null){do{var w={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};x===null?y=x=w:x=x.next=w,u=u.next}while(u!==null);x===null?y=x=a:x=x.next=a}else y=x=a;u={baseState:h.baseState,firstBaseUpdate:y,lastBaseUpdate:x,shared:h.shared,callbacks:h.callbacks},o.updateQueue=u;return}o=u.lastBaseUpdate,o===null?u.firstBaseUpdate=a:o.next=a,u.lastBaseUpdate=a}var kg=!1;function Ec(){if(kg){var o=Vl;if(o!==null)throw o}}function Tc(o,a,u,h){kg=!1;var y=o.updateQueue;Ts=!1;var x=y.firstBaseUpdate,w=y.lastBaseUpdate,A=y.shared.pending;if(A!==null){y.shared.pending=null;var D=A,$=D.next;D.next=null,w===null?x=$:w.next=$,w=D;var X=o.alternate;X!==null&&(X=X.updateQueue,A=X.lastBaseUpdate,A!==w&&(A===null?X.firstBaseUpdate=$:A.next=$,X.lastBaseUpdate=D))}if(x!==null){var ee=y.baseState;w=0,X=$=D=null,A=x;do{var q=A.lane&-536870913,W=q!==A.lane;if(W?(nt&q)===q:(h&q)===q){q!==0&&q===Hl&&(kg=!0),X!==null&&(X=X.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Se=o,Le=A;q=a;var bt=u;switch(Le.tag){case 1:if(Se=Le.payload,typeof Se=="function"){ee=Se.call(bt,ee,q);break e}ee=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Le.payload,q=typeof Se=="function"?Se.call(bt,ee,q):Se,q==null)break e;ee=m({},ee,q);break e;case 2:Ts=!0}}q=A.callback,q!==null&&(o.flags|=64,W&&(o.flags|=8192),W=y.callbacks,W===null?y.callbacks=[q]:W.push(q))}else W={lane:q,tag:A.tag,payload:A.payload,callback:A.callback,next:null},X===null?($=X=W,D=ee):X=X.next=W,w|=q;if(A=A.next,A===null){if(A=y.shared.pending,A===null)break;W=A,A=W.next,W.next=null,y.lastBaseUpdate=W,y.shared.pending=null}}while(!0);X===null&&(D=ee),y.baseState=D,y.firstBaseUpdate=$,y.lastBaseUpdate=X,x===null&&(y.shared.lanes=0),Ns|=w,o.lanes=w,o.memoizedState=ee}}function ww(o,a){if(typeof o!="function")throw Error(r(191,o));o.call(a)}function vw(o,a){var u=o.callbacks;if(u!==null)for(o.callbacks=null,o=0;o<u.length;o++)ww(u[o],a)}var Fl=_(null),Xf=_(0);function kw(o,a){o=Xi,T(Xf,o),T(Fl,a),Xi=o|a.baseLanes}function Cg(){T(Xf,Xi),T(Fl,Fl.current)}function Eg(){Xi=Xf.current,V(Fl),V(Xf)}var yr=_(null),Ir=null;function Os(o){var a=o.alternate;T(Kt,Kt.current&1),T(yr,o),Ir===null&&(a===null||Fl.current!==null||a.memoizedState!==null)&&(Ir=o)}function Tg(o){T(Kt,Kt.current),T(yr,o),Ir===null&&(Ir=o)}function Cw(o){o.tag===22?(T(Kt,Kt.current),T(yr,o),Ir===null&&(Ir=o)):_s()}function _s(){T(Kt,Kt.current),T(yr,yr.current)}function br(o){V(yr),Ir===o&&(Ir=null),V(Kt)}var Kt=_(0);function Qf(o){for(var a=o;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||Ry(u)||Ny(u)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Fi=0,qe=null,gt=null,Qt=null,ed=!1,ql=!1,Io=!1,td=0,Ac=0,Yl=null,lN=0;function Bt(){throw Error(r(321))}function Ag(o,a){if(a===null)return!1;for(var u=0;u<a.length&&u<o.length;u++)if(!mr(o[u],a[u]))return!1;return!0}function Mg(o,a,u,h,y,x){return Fi=x,qe=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,L.H=o===null||o.memoizedState===null?lv:$g,Io=!1,x=u(h,y),Io=!1,ql&&(x=Tw(a,u,h,y)),Ew(o),x}function Ew(o){L.H=_c;var a=gt!==null&>.next!==null;if(Fi=0,Qt=gt=qe=null,ed=!1,Ac=0,Yl=null,a)throw Error(r(300));o===null||en||(o=o.dependencies,o!==null&&qf(o)&&(en=!0))}function Tw(o,a,u,h){qe=o;var y=0;do{if(ql&&(Yl=null),Ac=0,ql=!1,25<=y)throw Error(r(301));if(y+=1,Qt=gt=null,o.updateQueue!=null){var x=o.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}L.H=av,x=a(u,h)}while(ql);return x}function aN(){var o=L.H,a=o.useState()[0];return a=typeof a.then=="function"?Mc(a):a,o=o.useState()[0],(gt!==null?gt.memoizedState:null)!==o&&(qe.flags|=1024),a}function Og(){var o=td!==0;return td=0,o}function _g(o,a,u){a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~u}function Dg(o){if(ed){for(o=o.memoizedState;o!==null;){var a=o.queue;a!==null&&(a.pending=null),o=o.next}ed=!1}Fi=0,Qt=gt=qe=null,ql=!1,Ac=td=0,Yl=null}function Fn(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qt===null?qe.memoizedState=Qt=o:Qt=Qt.next=o,Qt}function Wt(){if(gt===null){var o=qe.alternate;o=o!==null?o.memoizedState:null}else o=gt.next;var a=Qt===null?qe.memoizedState:Qt.next;if(a!==null)Qt=a,gt=o;else{if(o===null)throw qe.alternate===null?Error(r(467)):Error(r(310));gt=o,o={memoizedState:gt.memoizedState,baseState:gt.baseState,baseQueue:gt.baseQueue,queue:gt.queue,next:null},Qt===null?qe.memoizedState=Qt=o:Qt=Qt.next=o}return Qt}function nd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Mc(o){var a=Ac;return Ac+=1,Yl===null&&(Yl=[]),o=gw(Yl,o,a),a=qe,(Qt===null?a.memoizedState:Qt.next)===null&&(a=a.alternate,L.H=a===null||a.memoizedState===null?lv:$g),o}function rd(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return Mc(o);if(o.$$typeof===I)return Tn(o)}throw Error(r(438,String(o)))}function Rg(o){var a=null,u=qe.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var h=qe.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(a={data:h.data.map(function(y){return y.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),u===null&&(u=nd(),qe.updateQueue=u),u.memoCache=a,u=a.data[a.index],u===void 0)for(u=a.data[a.index]=Array(o),h=0;h<o;h++)u[h]=ie;return a.index++,u}function qi(o,a){return typeof a=="function"?a(o):a}function id(o){var a=Wt();return Ng(a,gt,o)}function Ng(o,a,u){var h=o.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=u;var y=o.baseQueue,x=h.pending;if(x!==null){if(y!==null){var w=y.next;y.next=x.next,x.next=w}a.baseQueue=y=x,h.pending=null}if(x=o.baseState,y===null)o.memoizedState=x;else{a=y.next;var A=w=null,D=null,$=a,X=!1;do{var ee=$.lane&-536870913;if(ee!==$.lane?(nt&ee)===ee:(Fi&ee)===ee){var q=$.revertLane;if(q===0)D!==null&&(D=D.next={lane:0,revertLane:0,gesture:null,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null}),ee===Hl&&(X=!0);else if((Fi&q)===q){$=$.next,q===Hl&&(X=!0);continue}else ee={lane:0,revertLane:$.revertLane,gesture:null,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},D===null?(A=D=ee,w=x):D=D.next=ee,qe.lanes|=q,Ns|=q;ee=$.action,Io&&u(x,ee),x=$.hasEagerState?$.eagerState:u(x,ee)}else q={lane:ee,revertLane:$.revertLane,gesture:$.gesture,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},D===null?(A=D=q,w=x):D=D.next=q,qe.lanes|=ee,Ns|=ee;$=$.next}while($!==null&&$!==a);if(D===null?w=x:D.next=A,!mr(x,o.memoizedState)&&(en=!0,X&&(u=Vl,u!==null)))throw u;o.memoizedState=x,o.baseState=w,o.baseQueue=D,h.lastRenderedState=x}return y===null&&(h.lanes=0),[o.memoizedState,h.dispatch]}function zg(o){var a=Wt(),u=a.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=o;var h=u.dispatch,y=u.pending,x=a.memoizedState;if(y!==null){u.pending=null;var w=y=y.next;do x=o(x,w.action),w=w.next;while(w!==y);mr(x,a.memoizedState)||(en=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),u.lastRenderedState=x}return[x,h]}function Aw(o,a,u){var h=qe,y=Wt(),x=st;if(x){if(u===void 0)throw Error(r(407));u=u()}else u=a();var w=!mr((gt||y).memoizedState,u);if(w&&(y.memoizedState=u,en=!0),y=y.queue,Ig(_w.bind(null,h,y,o),[o]),y.getSnapshot!==a||w||Qt!==null&&Qt.memoizedState.tag&1){if(h.flags|=2048,Kl(9,{destroy:void 0},Ow.bind(null,h,y,u,a),null),wt===null)throw Error(r(349));x||(Fi&127)!==0||Mw(h,a,u)}return u}function Mw(o,a,u){o.flags|=16384,o={getSnapshot:a,value:u},a=qe.updateQueue,a===null?(a=nd(),qe.updateQueue=a,a.stores=[o]):(u=a.stores,u===null?a.stores=[o]:u.push(o))}function Ow(o,a,u,h){a.value=u,a.getSnapshot=h,Dw(a)&&Rw(o)}function _w(o,a,u){return u(function(){Dw(a)&&Rw(o)})}function Dw(o){var a=o.getSnapshot;o=o.value;try{var u=a();return!mr(o,u)}catch{return!0}}function Rw(o){var a=Mo(o,2);a!==null&&ir(a,o,2)}function Lg(o){var a=Fn();if(typeof o=="function"){var u=o;if(o=u(),Io){le(!0);try{u()}finally{le(!1)}}}return a.memoizedState=a.baseState=o,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qi,lastRenderedState:o},a}function Nw(o,a,u,h){return o.baseState=u,Ng(o,gt,typeof h=="function"?h:qi)}function cN(o,a,u,h,y){if(ld(o))throw Error(r(485));if(o=a.action,o!==null){var x={payload:y,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};L.T!==null?u(!0):x.isTransition=!1,h(x),u=a.pending,u===null?(x.next=a.pending=x,zw(a,x)):(x.next=u.next,a.pending=u.next=x)}}function zw(o,a){var u=a.action,h=a.payload,y=o.state;if(a.isTransition){var x=L.T,w={};L.T=w;try{var A=u(y,h),D=L.S;D!==null&&D(w,A),Lw(o,a,A)}catch($){jg(o,a,$)}finally{x!==null&&w.types!==null&&(x.types=w.types),L.T=x}}else try{x=u(y,h),Lw(o,a,x)}catch($){jg(o,a,$)}}function Lw(o,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(h){jw(o,a,h)},function(h){return jg(o,a,h)}):jw(o,a,u)}function jw(o,a,u){a.status="fulfilled",a.value=u,Iw(a),o.state=u,a=o.pending,a!==null&&(u=a.next,u===a?o.pending=null:(u=u.next,a.next=u,zw(o,u)))}function jg(o,a,u){var h=o.pending;if(o.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=u,Iw(a),a=a.next;while(a!==h)}o.action=null}function Iw(o){o=o.listeners;for(var a=0;a<o.length;a++)(0,o[a])()}function Bw(o,a){return a}function Uw(o,a){if(st){var u=wt.formState;if(u!==null){e:{var h=qe;if(st){if(Mt){t:{for(var y=Mt,x=jr;y.nodeType!==8;){if(!x){y=null;break t}if(y=Br(y.nextSibling),y===null){y=null;break t}}x=y.data,y=x==="F!"||x==="F"?y:null}if(y){Mt=Br(y.nextSibling),h=y.data==="F!";break e}}Cs(h)}h=!1}h&&(a=u[0])}}return u=Fn(),u.memoizedState=u.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bw,lastRenderedState:a},u.queue=h,u=iv.bind(null,qe,h),h.dispatch=u,h=Lg(!1),x=Pg.bind(null,qe,!1,h.queue),h=Fn(),y={state:a,dispatch:null,action:o,pending:null},h.queue=y,u=cN.bind(null,qe,y,x,u),y.dispatch=u,h.memoizedState=o,[a,u,!1]}function Hw(o){var a=Wt();return Vw(a,gt,o)}function Vw(o,a,u){if(a=Ng(o,a,Bw)[0],o=id(qi)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=Mc(a)}catch(w){throw w===Pl?Wf:w}else h=a;a=Wt();var y=a.queue,x=y.dispatch;return u!==a.memoizedState&&(qe.flags|=2048,Kl(9,{destroy:void 0},uN.bind(null,y,u),null)),[h,x,o]}function uN(o,a){o.action=a}function Pw(o){var a=Wt(),u=gt;if(u!==null)return Vw(a,u,o);Wt(),a=a.memoizedState,u=Wt();var h=u.queue.dispatch;return u.memoizedState=o,[a,h,!1]}function Kl(o,a,u,h){return o={tag:o,create:u,deps:h,inst:a,next:null},a=qe.updateQueue,a===null&&(a=nd(),qe.updateQueue=a),u=a.lastEffect,u===null?a.lastEffect=o.next=o:(h=u.next,u.next=o,o.next=h,a.lastEffect=o),o}function $w(){return Wt().memoizedState}function sd(o,a,u,h){var y=Fn();qe.flags|=o,y.memoizedState=Kl(1|a,{destroy:void 0},u,h===void 0?null:h)}function od(o,a,u,h){var y=Wt();h=h===void 0?null:h;var x=y.memoizedState.inst;gt!==null&&h!==null&&Ag(h,gt.memoizedState.deps)?y.memoizedState=Kl(a,x,u,h):(qe.flags|=o,y.memoizedState=Kl(1|a,x,u,h))}function Fw(o,a){sd(8390656,8,o,a)}function Ig(o,a){od(2048,8,o,a)}function fN(o){qe.flags|=4;var a=qe.updateQueue;if(a===null)a=nd(),qe.updateQueue=a,a.events=[o];else{var u=a.events;u===null?a.events=[o]:u.push(o)}}function qw(o){var a=Wt().memoizedState;return fN({ref:a,nextImpl:o}),function(){if((ft&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function Yw(o,a){return od(4,2,o,a)}function Kw(o,a){return od(4,4,o,a)}function Ww(o,a){if(typeof a=="function"){o=o();var u=a(o);return function(){typeof u=="function"?u():a(null)}}if(a!=null)return o=o(),a.current=o,function(){a.current=null}}function Gw(o,a,u){u=u!=null?u.concat([o]):null,od(4,4,Ww.bind(null,a,o),u)}function Bg(){}function Zw(o,a){var u=Wt();a=a===void 0?null:a;var h=u.memoizedState;return a!==null&&Ag(a,h[1])?h[0]:(u.memoizedState=[o,a],o)}function Jw(o,a){var u=Wt();a=a===void 0?null:a;var h=u.memoizedState;if(a!==null&&Ag(a,h[1]))return h[0];if(h=o(),Io){le(!0);try{o()}finally{le(!1)}}return u.memoizedState=[h,a],h}function Ug(o,a,u){return u===void 0||(Fi&1073741824)!==0&&(nt&261930)===0?o.memoizedState=a:(o.memoizedState=u,o=Xv(),qe.lanes|=o,Ns|=o,u)}function Xw(o,a,u,h){return mr(u,a)?u:Fl.current!==null?(o=Ug(o,u,h),mr(o,a)||(en=!0),o):(Fi&42)===0||(Fi&1073741824)!==0&&(nt&261930)===0?(en=!0,o.memoizedState=u):(o=Xv(),qe.lanes|=o,Ns|=o,a)}function Qw(o,a,u,h,y){var x=G.p;G.p=x!==0&&8>x?x:8;var w=L.T,A={};L.T=A,Pg(o,!1,a,u);try{var D=y(),$=L.S;if($!==null&&$(A,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var X=oN(D,h);Oc(o,a,X,wr(o))}else Oc(o,a,h,wr(o))}catch(ee){Oc(o,a,{then:function(){},status:"rejected",reason:ee},wr())}finally{G.p=x,w!==null&&A.types!==null&&(w.types=A.types),L.T=w}}function dN(){}function Hg(o,a,u,h){if(o.tag!==5)throw Error(r(476));var y=ev(o).queue;Qw(o,y,a,me,u===null?dN:function(){return tv(o),u(h)})}function ev(o){var a=o.memoizedState;if(a!==null)return a;a={memoizedState:me,baseState:me,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qi,lastRenderedState:me},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qi,lastRenderedState:u},next:null},o.memoizedState=a,o=o.alternate,o!==null&&(o.memoizedState=a),a}function tv(o){var a=ev(o);a.next===null&&(a=o.alternate.memoizedState),Oc(o,a.next.queue,{},wr())}function Vg(){return Tn(Yc)}function nv(){return Wt().memoizedState}function rv(){return Wt().memoizedState}function hN(o){for(var a=o.return;a!==null;){switch(a.tag){case 24:case 3:var u=wr();o=As(u);var h=Ms(a,o,u);h!==null&&(ir(h,a,u),Cc(h,a,u)),a={cache:gg()},o.payload=a;return}a=a.return}}function pN(o,a,u){var h=wr();u={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},ld(o)?sv(a,u):(u=sg(o,a,u,h),u!==null&&(ir(u,o,h),ov(u,a,h)))}function iv(o,a,u){var h=wr();Oc(o,a,u,h)}function Oc(o,a,u,h){var y={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(ld(o))sv(a,y);else{var x=o.alternate;if(o.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var w=a.lastRenderedState,A=x(w,u);if(y.hasEagerState=!0,y.eagerState=A,mr(A,w))return Vf(o,a,y,0),wt===null&&Hf(),!1}catch{}finally{}if(u=sg(o,a,y,h),u!==null)return ir(u,o,h),ov(u,a,h),!0}return!1}function Pg(o,a,u,h){if(h={lane:2,revertLane:Sy(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},ld(o)){if(a)throw Error(r(479))}else a=sg(o,u,h,2),a!==null&&ir(a,o,2)}function ld(o){var a=o.alternate;return o===qe||a!==null&&a===qe}function sv(o,a){ql=ed=!0;var u=o.pending;u===null?a.next=a:(a.next=u.next,u.next=a),o.pending=a}function ov(o,a,u){if((u&4194048)!==0){var h=a.lanes;h&=o.pendingLanes,u|=h,a.lanes=u,xs(o,u)}}var _c={readContext:Tn,use:rd,useCallback:Bt,useContext:Bt,useEffect:Bt,useImperativeHandle:Bt,useLayoutEffect:Bt,useInsertionEffect:Bt,useMemo:Bt,useReducer:Bt,useRef:Bt,useState:Bt,useDebugValue:Bt,useDeferredValue:Bt,useTransition:Bt,useSyncExternalStore:Bt,useId:Bt,useHostTransitionStatus:Bt,useFormState:Bt,useActionState:Bt,useOptimistic:Bt,useMemoCache:Bt,useCacheRefresh:Bt};_c.useEffectEvent=Bt;var lv={readContext:Tn,use:rd,useCallback:function(o,a){return Fn().memoizedState=[o,a===void 0?null:a],o},useContext:Tn,useEffect:Fw,useImperativeHandle:function(o,a,u){u=u!=null?u.concat([o]):null,sd(4194308,4,Ww.bind(null,a,o),u)},useLayoutEffect:function(o,a){return sd(4194308,4,o,a)},useInsertionEffect:function(o,a){sd(4,2,o,a)},useMemo:function(o,a){var u=Fn();a=a===void 0?null:a;var h=o();if(Io){le(!0);try{o()}finally{le(!1)}}return u.memoizedState=[h,a],h},useReducer:function(o,a,u){var h=Fn();if(u!==void 0){var y=u(a);if(Io){le(!0);try{u(a)}finally{le(!1)}}}else y=a;return h.memoizedState=h.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},h.queue=o,o=o.dispatch=pN.bind(null,qe,o),[h.memoizedState,o]},useRef:function(o){var a=Fn();return o={current:o},a.memoizedState=o},useState:function(o){o=Lg(o);var a=o.queue,u=iv.bind(null,qe,a);return a.dispatch=u,[o.memoizedState,u]},useDebugValue:Bg,useDeferredValue:function(o,a){var u=Fn();return Ug(u,o,a)},useTransition:function(){var o=Lg(!1);return o=Qw.bind(null,qe,o.queue,!0,!1),Fn().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,a,u){var h=qe,y=Fn();if(st){if(u===void 0)throw Error(r(407));u=u()}else{if(u=a(),wt===null)throw Error(r(349));(nt&127)!==0||Mw(h,a,u)}y.memoizedState=u;var x={value:u,getSnapshot:a};return y.queue=x,Fw(_w.bind(null,h,x,o),[o]),h.flags|=2048,Kl(9,{destroy:void 0},Ow.bind(null,h,x,u,a),null),u},useId:function(){var o=Fn(),a=wt.identifierPrefix;if(st){var u=pi,h=hi;u=(h&~(1<<32-Ze(h)-1)).toString(32)+u,a="_"+a+"R_"+u,u=td++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=lN++,a="_"+a+"r_"+u.toString(32)+"_";return o.memoizedState=a},useHostTransitionStatus:Vg,useFormState:Uw,useActionState:Uw,useOptimistic:function(o){var a=Fn();a.memoizedState=a.baseState=o;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=Pg.bind(null,qe,!0,u),u.dispatch=a,[o,a]},useMemoCache:Rg,useCacheRefresh:function(){return Fn().memoizedState=hN.bind(null,qe)},useEffectEvent:function(o){var a=Fn(),u={impl:o};return a.memoizedState=u,function(){if((ft&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},$g={readContext:Tn,use:rd,useCallback:Zw,useContext:Tn,useEffect:Ig,useImperativeHandle:Gw,useInsertionEffect:Yw,useLayoutEffect:Kw,useMemo:Jw,useReducer:id,useRef:$w,useState:function(){return id(qi)},useDebugValue:Bg,useDeferredValue:function(o,a){var u=Wt();return Xw(u,gt.memoizedState,o,a)},useTransition:function(){var o=id(qi)[0],a=Wt().memoizedState;return[typeof o=="boolean"?o:Mc(o),a]},useSyncExternalStore:Aw,useId:nv,useHostTransitionStatus:Vg,useFormState:Hw,useActionState:Hw,useOptimistic:function(o,a){var u=Wt();return Nw(u,gt,o,a)},useMemoCache:Rg,useCacheRefresh:rv};$g.useEffectEvent=qw;var av={readContext:Tn,use:rd,useCallback:Zw,useContext:Tn,useEffect:Ig,useImperativeHandle:Gw,useInsertionEffect:Yw,useLayoutEffect:Kw,useMemo:Jw,useReducer:zg,useRef:$w,useState:function(){return zg(qi)},useDebugValue:Bg,useDeferredValue:function(o,a){var u=Wt();return gt===null?Ug(u,o,a):Xw(u,gt.memoizedState,o,a)},useTransition:function(){var o=zg(qi)[0],a=Wt().memoizedState;return[typeof o=="boolean"?o:Mc(o),a]},useSyncExternalStore:Aw,useId:nv,useHostTransitionStatus:Vg,useFormState:Pw,useActionState:Pw,useOptimistic:function(o,a){var u=Wt();return gt!==null?Nw(u,gt,o,a):(u.baseState=o,[o,u.queue.dispatch])},useMemoCache:Rg,useCacheRefresh:rv};av.useEffectEvent=qw;function Fg(o,a,u,h){a=o.memoizedState,u=u(h,a),u=u==null?a:m({},a,u),o.memoizedState=u,o.lanes===0&&(o.updateQueue.baseState=u)}var qg={enqueueSetState:function(o,a,u){o=o._reactInternals;var h=wr(),y=As(h);y.payload=a,u!=null&&(y.callback=u),a=Ms(o,y,h),a!==null&&(ir(a,o,h),Cc(a,o,h))},enqueueReplaceState:function(o,a,u){o=o._reactInternals;var h=wr(),y=As(h);y.tag=1,y.payload=a,u!=null&&(y.callback=u),a=Ms(o,y,h),a!==null&&(ir(a,o,h),Cc(a,o,h))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var u=wr(),h=As(u);h.tag=2,a!=null&&(h.callback=a),a=Ms(o,h,u),a!==null&&(ir(a,o,u),Cc(a,o,u))}};function cv(o,a,u,h,y,x,w){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(h,x,w):a.prototype&&a.prototype.isPureReactComponent?!gc(u,h)||!gc(y,x):!0}function uv(o,a,u,h){o=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,h),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,h),a.state!==o&&qg.enqueueReplaceState(a,a.state,null)}function Bo(o,a){var u=a;if("ref"in a){u={};for(var h in a)h!=="ref"&&(u[h]=a[h])}if(o=o.defaultProps){u===a&&(u=m({},u));for(var y in o)u[y]===void 0&&(u[y]=o[y])}return u}function fv(o){Uf(o)}function dv(o){console.error(o)}function hv(o){Uf(o)}function ad(o,a){try{var u=o.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function pv(o,a,u){try{var h=o.onCaughtError;h(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Yg(o,a,u){return u=As(u),u.tag=3,u.payload={element:null},u.callback=function(){ad(o,a)},u}function mv(o){return o=As(o),o.tag=3,o}function gv(o,a,u,h){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var x=h.value;o.payload=function(){return y(x)},o.callback=function(){pv(a,u,h)}}var w=u.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(o.callback=function(){pv(a,u,h),typeof y!="function"&&(zs===null?zs=new Set([this]):zs.add(this));var A=h.stack;this.componentDidCatch(h.value,{componentStack:A!==null?A:""})})}function mN(o,a,u,h,y){if(u.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=u.alternate,a!==null&&Ul(a,u,y,!0),u=yr.current,u!==null){switch(u.tag){case 31:case 13:return Ir===null?Sd():u.alternate===null&&Ut===0&&(Ut=3),u.flags&=-257,u.flags|=65536,u.lanes=y,h===Gf?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([h]):a.add(h),yy(o,h,y)),!1;case 22:return u.flags|=65536,h===Gf?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([h])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([h]):u.add(h)),yy(o,h,y)),!1}throw Error(r(435,u.tag))}return yy(o,h,y),Sd(),!1}if(st)return a=yr.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=y,h!==fg&&(o=Error(r(422),{cause:h}),xc(Nr(o,u)))):(h!==fg&&(a=Error(r(423),{cause:h}),xc(Nr(a,u))),o=o.current.alternate,o.flags|=65536,y&=-y,o.lanes|=y,h=Nr(h,u),y=Yg(o.stateNode,h,y),vg(o,y),Ut!==4&&(Ut=2)),!1;var x=Error(r(520),{cause:h});if(x=Nr(x,u),Bc===null?Bc=[x]:Bc.push(x),Ut!==4&&(Ut=2),a===null)return!0;h=Nr(h,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,o=y&-y,u.lanes|=o,o=Yg(u.stateNode,h,o),vg(u,o),!1;case 1:if(a=u.type,x=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(zs===null||!zs.has(x))))return u.flags|=65536,y&=-y,u.lanes|=y,y=mv(y),gv(y,o,u,h),vg(u,y),!1}u=u.return}while(u!==null);return!1}var Kg=Error(r(461)),en=!1;function An(o,a,u,h){a.child=o===null?Sw(a,null,u,h):jo(a,o.child,u,h)}function yv(o,a,u,h,y){u=u.render;var x=a.ref;if("ref"in h){var w={};for(var A in h)A!=="ref"&&(w[A]=h[A])}else w=h;return Ro(a),h=Mg(o,a,u,w,x,y),A=Og(),o!==null&&!en?(_g(o,a,y),Yi(o,a,y)):(st&&A&&cg(a),a.flags|=1,An(o,a,h,y),a.child)}function bv(o,a,u,h,y){if(o===null){var x=u.type;return typeof x=="function"&&!og(x)&&x.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=x,xv(o,a,x,h,y)):(o=$f(u.type,null,h,a,a.mode,y),o.ref=a.ref,o.return=a,a.child=o)}if(x=o.child,!ty(o,y)){var w=x.memoizedProps;if(u=u.compare,u=u!==null?u:gc,u(w,h)&&o.ref===a.ref)return Yi(o,a,y)}return a.flags|=1,o=Hi(x,h),o.ref=a.ref,o.return=a,a.child=o}function xv(o,a,u,h,y){if(o!==null){var x=o.memoizedProps;if(gc(x,h)&&o.ref===a.ref)if(en=!1,a.pendingProps=h=x,ty(o,y))(o.flags&131072)!==0&&(en=!0);else return a.lanes=o.lanes,Yi(o,a,y)}return Wg(o,a,u,h,y)}function Sv(o,a,u,h){var y=h.children,x=o!==null?o.memoizedState:null;if(o===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|u:u,o!==null){for(h=a.child=o.child,y=0;h!==null;)y=y|h.lanes|h.childLanes,h=h.sibling;h=y&~x}else h=0,a.child=null;return wv(o,a,x,u,h)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},o!==null&&Kf(a,x!==null?x.cachePool:null),x!==null?kw(a,x):Cg(),Cw(a);else return h=a.lanes=536870912,wv(o,a,x!==null?x.baseLanes|u:u,u,h)}else x!==null?(Kf(a,x.cachePool),kw(a,x),_s(),a.memoizedState=null):(o!==null&&Kf(a,null),Cg(),_s());return An(o,a,y,u),a.child}function Dc(o,a){return o!==null&&o.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function wv(o,a,u,h,y){var x=bg();return x=x===null?null:{parent:Xt._currentValue,pool:x},a.memoizedState={baseLanes:u,cachePool:x},o!==null&&Kf(a,null),Cg(),Cw(a),o!==null&&Ul(o,a,h,!0),a.childLanes=y,null}function cd(o,a){return a=fd({mode:a.mode,children:a.children},o.mode),a.ref=o.ref,o.child=a,a.return=o,a}function vv(o,a,u){return jo(a,o.child,null,u),o=cd(a,a.pendingProps),o.flags|=2,br(a),a.memoizedState=null,o}function gN(o,a,u){var h=a.pendingProps,y=(a.flags&128)!==0;if(a.flags&=-129,o===null){if(st){if(h.mode==="hidden")return o=cd(a,h),a.lanes=536870912,Dc(null,o);if(Tg(a),(o=Mt)?(o=zk(o,jr),o=o!==null&&o.data==="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:vs!==null?{id:hi,overflow:pi}:null,retryLane:536870912,hydrationErrors:null},u=sw(o),u.return=a,a.child=u,En=a,Mt=null)):o=null,o===null)throw Cs(a);return a.lanes=536870912,null}return cd(a,h)}var x=o.memoizedState;if(x!==null){var w=x.dehydrated;if(Tg(a),y)if(a.flags&256)a.flags&=-257,a=vv(o,a,u);else if(a.memoizedState!==null)a.child=o.child,a.flags|=128,a=null;else throw Error(r(558));else if(en||Ul(o,a,u,!1),y=(u&o.childLanes)!==0,en||y){if(h=wt,h!==null&&(w=dS(h,u),w!==0&&w!==x.retryLane))throw x.retryLane=w,Mo(o,w),ir(h,o,w),Kg;Sd(),a=vv(o,a,u)}else o=x.treeContext,Mt=Br(w.nextSibling),En=a,st=!0,ks=null,jr=!1,o!==null&&aw(a,o),a=cd(a,h),a.flags|=4096;return a}return o=Hi(o.child,{mode:h.mode,children:h.children}),o.ref=a.ref,a.child=o,o.return=a,o}function ud(o,a){var u=a.ref;if(u===null)o!==null&&o.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(r(284));(o===null||o.ref!==u)&&(a.flags|=4194816)}}function Wg(o,a,u,h,y){return Ro(a),u=Mg(o,a,u,h,void 0,y),h=Og(),o!==null&&!en?(_g(o,a,y),Yi(o,a,y)):(st&&h&&cg(a),a.flags|=1,An(o,a,u,y),a.child)}function kv(o,a,u,h,y,x){return Ro(a),a.updateQueue=null,u=Tw(a,h,u,y),Ew(o),h=Og(),o!==null&&!en?(_g(o,a,x),Yi(o,a,x)):(st&&h&&cg(a),a.flags|=1,An(o,a,u,x),a.child)}function Cv(o,a,u,h,y){if(Ro(a),a.stateNode===null){var x=Ll,w=u.contextType;typeof w=="object"&&w!==null&&(x=Tn(w)),x=new u(h,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=qg,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=h,x.state=a.memoizedState,x.refs={},Sg(a),w=u.contextType,x.context=typeof w=="object"&&w!==null?Tn(w):Ll,x.state=a.memoizedState,w=u.getDerivedStateFromProps,typeof w=="function"&&(Fg(a,u,w,h),x.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&qg.enqueueReplaceState(x,x.state,null),Tc(a,h,x,y),Ec(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(o===null){x=a.stateNode;var A=a.memoizedProps,D=Bo(u,A);x.props=D;var $=x.context,X=u.contextType;w=Ll,typeof X=="object"&&X!==null&&(w=Tn(X));var ee=u.getDerivedStateFromProps;X=typeof ee=="function"||typeof x.getSnapshotBeforeUpdate=="function",A=a.pendingProps!==A,X||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(A||$!==w)&&uv(a,x,h,w),Ts=!1;var q=a.memoizedState;x.state=q,Tc(a,h,x,y),Ec(),$=a.memoizedState,A||q!==$||Ts?(typeof ee=="function"&&(Fg(a,u,ee,h),$=a.memoizedState),(D=Ts||cv(a,u,D,h,q,$,w))?(X||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(a.flags|=4194308)):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=$),x.props=h,x.state=$,x.context=w,h=D):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{x=a.stateNode,wg(o,a),w=a.memoizedProps,X=Bo(u,w),x.props=X,ee=a.pendingProps,q=x.context,$=u.contextType,D=Ll,typeof $=="object"&&$!==null&&(D=Tn($)),A=u.getDerivedStateFromProps,($=typeof A=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==ee||q!==D)&&uv(a,x,h,D),Ts=!1,q=a.memoizedState,x.state=q,Tc(a,h,x,y),Ec();var W=a.memoizedState;w!==ee||q!==W||Ts||o!==null&&o.dependencies!==null&&qf(o.dependencies)?(typeof A=="function"&&(Fg(a,u,A,h),W=a.memoizedState),(X=Ts||cv(a,u,X,h,q,W,D)||o!==null&&o.dependencies!==null&&qf(o.dependencies))?($||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(h,W,D),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(h,W,D)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===o.memoizedProps&&q===o.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===o.memoizedProps&&q===o.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=W),x.props=h,x.state=W,x.context=D,h=X):(typeof x.componentDidUpdate!="function"||w===o.memoizedProps&&q===o.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===o.memoizedProps&&q===o.memoizedState||(a.flags|=1024),h=!1)}return x=h,ud(o,a),h=(a.flags&128)!==0,x||h?(x=a.stateNode,u=h&&typeof u.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,o!==null&&h?(a.child=jo(a,o.child,null,y),a.child=jo(a,null,u,y)):An(o,a,u,y),a.memoizedState=x.state,o=a.child):o=Yi(o,a,y),o}function Ev(o,a,u,h){return _o(),a.flags|=256,An(o,a,u,h),a.child}var Gg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zg(o){return{baseLanes:o,cachePool:pw()}}function Jg(o,a,u){return o=o!==null?o.childLanes&~u:0,a&&(o|=Sr),o}function Tv(o,a,u){var h=a.pendingProps,y=!1,x=(a.flags&128)!==0,w;if((w=x)||(w=o!==null&&o.memoizedState===null?!1:(Kt.current&2)!==0),w&&(y=!0,a.flags&=-129),w=(a.flags&32)!==0,a.flags&=-33,o===null){if(st){if(y?Os(a):_s(),(o=Mt)?(o=zk(o,jr),o=o!==null&&o.data!=="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:vs!==null?{id:hi,overflow:pi}:null,retryLane:536870912,hydrationErrors:null},u=sw(o),u.return=a,a.child=u,En=a,Mt=null)):o=null,o===null)throw Cs(a);return Ny(o)?a.lanes=32:a.lanes=536870912,null}var A=h.children;return h=h.fallback,y?(_s(),y=a.mode,A=fd({mode:"hidden",children:A},y),h=Oo(h,y,u,null),A.return=a,h.return=a,A.sibling=h,a.child=A,h=a.child,h.memoizedState=Zg(u),h.childLanes=Jg(o,w,u),a.memoizedState=Gg,Dc(null,h)):(Os(a),Xg(a,A))}var D=o.memoizedState;if(D!==null&&(A=D.dehydrated,A!==null)){if(x)a.flags&256?(Os(a),a.flags&=-257,a=Qg(o,a,u)):a.memoizedState!==null?(_s(),a.child=o.child,a.flags|=128,a=null):(_s(),A=h.fallback,y=a.mode,h=fd({mode:"visible",children:h.children},y),A=Oo(A,y,u,null),A.flags|=2,h.return=a,A.return=a,h.sibling=A,a.child=h,jo(a,o.child,null,u),h=a.child,h.memoizedState=Zg(u),h.childLanes=Jg(o,w,u),a.memoizedState=Gg,a=Dc(null,h));else if(Os(a),Ny(A)){if(w=A.nextSibling&&A.nextSibling.dataset,w)var $=w.dgst;w=$,h=Error(r(419)),h.stack="",h.digest=w,xc({value:h,source:null,stack:null}),a=Qg(o,a,u)}else if(en||Ul(o,a,u,!1),w=(u&o.childLanes)!==0,en||w){if(w=wt,w!==null&&(h=dS(w,u),h!==0&&h!==D.retryLane))throw D.retryLane=h,Mo(o,h),ir(w,o,h),Kg;Ry(A)||Sd(),a=Qg(o,a,u)}else Ry(A)?(a.flags|=192,a.child=o.child,a=null):(o=D.treeContext,Mt=Br(A.nextSibling),En=a,st=!0,ks=null,jr=!1,o!==null&&aw(a,o),a=Xg(a,h.children),a.flags|=4096);return a}return y?(_s(),A=h.fallback,y=a.mode,D=o.child,$=D.sibling,h=Hi(D,{mode:"hidden",children:h.children}),h.subtreeFlags=D.subtreeFlags&65011712,$!==null?A=Hi($,A):(A=Oo(A,y,u,null),A.flags|=2),A.return=a,h.return=a,h.sibling=A,a.child=h,Dc(null,h),h=a.child,A=o.child.memoizedState,A===null?A=Zg(u):(y=A.cachePool,y!==null?(D=Xt._currentValue,y=y.parent!==D?{parent:D,pool:D}:y):y=pw(),A={baseLanes:A.baseLanes|u,cachePool:y}),h.memoizedState=A,h.childLanes=Jg(o,w,u),a.memoizedState=Gg,Dc(o.child,h)):(Os(a),u=o.child,o=u.sibling,u=Hi(u,{mode:"visible",children:h.children}),u.return=a,u.sibling=null,o!==null&&(w=a.deletions,w===null?(a.deletions=[o],a.flags|=16):w.push(o)),a.child=u,a.memoizedState=null,u)}function Xg(o,a){return a=fd({mode:"visible",children:a},o.mode),a.return=o,o.child=a}function fd(o,a){return o=gr(22,o,null,a),o.lanes=0,o}function Qg(o,a,u){return jo(a,o.child,null,u),o=Xg(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function Av(o,a,u){o.lanes|=a;var h=o.alternate;h!==null&&(h.lanes|=a),pg(o.return,a,u)}function ey(o,a,u,h,y,x){var w=o.memoizedState;w===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:u,tailMode:y,treeForkCount:x}:(w.isBackwards=a,w.rendering=null,w.renderingStartTime=0,w.last=h,w.tail=u,w.tailMode=y,w.treeForkCount=x)}function Mv(o,a,u){var h=a.pendingProps,y=h.revealOrder,x=h.tail;h=h.children;var w=Kt.current,A=(w&2)!==0;if(A?(w=w&1|2,a.flags|=128):w&=1,T(Kt,w),An(o,a,h,u),h=st?bc:0,!A&&o!==null&&(o.flags&128)!==0)e:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Av(o,u,a);else if(o.tag===19)Av(o,u,a);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break e;for(;o.sibling===null;){if(o.return===null||o.return===a)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(y){case"forwards":for(u=a.child,y=null;u!==null;)o=u.alternate,o!==null&&Qf(o)===null&&(y=u),u=u.sibling;u=y,u===null?(y=a.child,a.child=null):(y=u.sibling,u.sibling=null),ey(a,!1,y,u,x,h);break;case"backwards":case"unstable_legacy-backwards":for(u=null,y=a.child,a.child=null;y!==null;){if(o=y.alternate,o!==null&&Qf(o)===null){a.child=y;break}o=y.sibling,y.sibling=u,u=y,y=o}ey(a,!0,u,null,x,h);break;case"together":ey(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function Yi(o,a,u){if(o!==null&&(a.dependencies=o.dependencies),Ns|=a.lanes,(u&a.childLanes)===0)if(o!==null){if(Ul(o,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(o!==null&&a.child!==o.child)throw Error(r(153));if(a.child!==null){for(o=a.child,u=Hi(o,o.pendingProps),a.child=u,u.return=a;o.sibling!==null;)o=o.sibling,u=u.sibling=Hi(o,o.pendingProps),u.return=a;u.sibling=null}return a.child}function ty(o,a){return(o.lanes&a)!==0?!0:(o=o.dependencies,!!(o!==null&&qf(o)))}function yN(o,a,u){switch(a.tag){case 3:Fe(a,a.stateNode.containerInfo),Es(a,Xt,o.memoizedState.cache),_o();break;case 27:case 5:mt(a);break;case 4:Fe(a,a.stateNode.containerInfo);break;case 10:Es(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Tg(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(Os(a),a.flags|=128,null):(u&a.child.childLanes)!==0?Tv(o,a,u):(Os(a),o=Yi(o,a,u),o!==null?o.sibling:null);Os(a);break;case 19:var y=(o.flags&128)!==0;if(h=(u&a.childLanes)!==0,h||(Ul(o,a,u,!1),h=(u&a.childLanes)!==0),y){if(h)return Mv(o,a,u);a.flags|=128}if(y=a.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),T(Kt,Kt.current),h)break;return null;case 22:return a.lanes=0,Sv(o,a,u,a.pendingProps);case 24:Es(a,Xt,o.memoizedState.cache)}return Yi(o,a,u)}function Ov(o,a,u){if(o!==null)if(o.memoizedProps!==a.pendingProps)en=!0;else{if(!ty(o,u)&&(a.flags&128)===0)return en=!1,yN(o,a,u);en=(o.flags&131072)!==0}else en=!1,st&&(a.flags&1048576)!==0&&lw(a,bc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var h=a.pendingProps;if(o=zo(a.elementType),a.type=o,typeof o=="function")og(o)?(h=Bo(o,h),a.tag=1,a=Cv(null,a,o,h,u)):(a.tag=0,a=Wg(null,a,o,h,u));else{if(o!=null){var y=o.$$typeof;if(y===ne){a.tag=11,a=yv(null,a,o,h,u);break e}else if(y===N){a.tag=14,a=bv(null,a,o,h,u);break e}}throw a=ue(o)||o,Error(r(306,a,""))}}return a;case 0:return Wg(o,a,a.type,a.pendingProps,u);case 1:return h=a.type,y=Bo(h,a.pendingProps),Cv(o,a,h,y,u);case 3:e:{if(Fe(a,a.stateNode.containerInfo),o===null)throw Error(r(387));h=a.pendingProps;var x=a.memoizedState;y=x.element,wg(o,a),Tc(a,h,null,u);var w=a.memoizedState;if(h=w.cache,Es(a,Xt,h),h!==x.cache&&mg(a,[Xt],u,!0),Ec(),h=w.element,x.isDehydrated)if(x={element:h,isDehydrated:!1,cache:w.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=Ev(o,a,h,u);break e}else if(h!==y){y=Nr(Error(r(424)),a),xc(y),a=Ev(o,a,h,u);break e}else{switch(o=a.stateNode.containerInfo,o.nodeType){case 9:o=o.body;break;default:o=o.nodeName==="HTML"?o.ownerDocument.body:o}for(Mt=Br(o.firstChild),En=a,st=!0,ks=null,jr=!0,u=Sw(a,null,h,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(_o(),h===y){a=Yi(o,a,u);break e}An(o,a,h,u)}a=a.child}return a;case 26:return ud(o,a),o===null?(u=Hk(a.type,null,a.pendingProps,null))?a.memoizedState=u:st||(u=a.type,o=a.pendingProps,h=Ad(oe.current).createElement(u),h[Cn]=a,h[Xn]=o,Mn(h,u,o),cn(h),a.stateNode=h):a.memoizedState=Hk(a.type,o.memoizedProps,a.pendingProps,o.memoizedState),null;case 27:return mt(a),o===null&&st&&(h=a.stateNode=Ik(a.type,a.pendingProps,oe.current),En=a,jr=!0,y=Mt,Bs(a.type)?(zy=y,Mt=Br(h.firstChild)):Mt=y),An(o,a,a.pendingProps.children,u),ud(o,a),o===null&&(a.flags|=4194304),a.child;case 5:return o===null&&st&&((y=h=Mt)&&(h=KN(h,a.type,a.pendingProps,jr),h!==null?(a.stateNode=h,En=a,Mt=Br(h.firstChild),jr=!1,y=!0):y=!1),y||Cs(a)),mt(a),y=a.type,x=a.pendingProps,w=o!==null?o.memoizedProps:null,h=x.children,Oy(y,x)?h=null:w!==null&&Oy(y,w)&&(a.flags|=32),a.memoizedState!==null&&(y=Mg(o,a,aN,null,null,u),Yc._currentValue=y),ud(o,a),An(o,a,h,u),a.child;case 6:return o===null&&st&&((o=u=Mt)&&(u=WN(u,a.pendingProps,jr),u!==null?(a.stateNode=u,En=a,Mt=null,o=!0):o=!1),o||Cs(a)),null;case 13:return Tv(o,a,u);case 4:return Fe(a,a.stateNode.containerInfo),h=a.pendingProps,o===null?a.child=jo(a,null,h,u):An(o,a,h,u),a.child;case 11:return yv(o,a,a.type,a.pendingProps,u);case 7:return An(o,a,a.pendingProps,u),a.child;case 8:return An(o,a,a.pendingProps.children,u),a.child;case 12:return An(o,a,a.pendingProps.children,u),a.child;case 10:return h=a.pendingProps,Es(a,a.type,h.value),An(o,a,h.children,u),a.child;case 9:return y=a.type._context,h=a.pendingProps.children,Ro(a),y=Tn(y),h=h(y),a.flags|=1,An(o,a,h,u),a.child;case 14:return bv(o,a,a.type,a.pendingProps,u);case 15:return xv(o,a,a.type,a.pendingProps,u);case 19:return Mv(o,a,u);case 31:return gN(o,a,u);case 22:return Sv(o,a,u,a.pendingProps);case 24:return Ro(a),h=Tn(Xt),o===null?(y=bg(),y===null&&(y=wt,x=gg(),y.pooledCache=x,x.refCount++,x!==null&&(y.pooledCacheLanes|=u),y=x),a.memoizedState={parent:h,cache:y},Sg(a),Es(a,Xt,y)):((o.lanes&u)!==0&&(wg(o,a),Tc(a,null,null,u),Ec()),y=o.memoizedState,x=a.memoizedState,y.parent!==h?(y={parent:h,cache:h},a.memoizedState=y,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=y),Es(a,Xt,h)):(h=x.cache,Es(a,Xt,h),h!==y.cache&&mg(a,[Xt],u,!0))),An(o,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Ki(o){o.flags|=4}function ny(o,a,u,h,y){if((a=(o.mode&32)!==0)&&(a=!1),a){if(o.flags|=16777216,(y&335544128)===y)if(o.stateNode.complete)o.flags|=8192;else if(nk())o.flags|=8192;else throw Lo=Gf,xg}else o.flags&=-16777217}function _v(o,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!qk(a))if(nk())o.flags|=8192;else throw Lo=Gf,xg}function dd(o,a){a!==null&&(o.flags|=4),o.flags&16384&&(a=o.tag!==22?wl():536870912,o.lanes|=a,Jl|=a)}function Rc(o,a){if(!st)switch(o.tailMode){case"hidden":a=o.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?o.tail=null:u.sibling=null;break;case"collapsed":u=o.tail;for(var h=null;u!==null;)u.alternate!==null&&(h=u),u=u.sibling;h===null?a||o.tail===null?o.tail=null:o.tail.sibling=null:h.sibling=null}}function Ot(o){var a=o.alternate!==null&&o.alternate.child===o.child,u=0,h=0;if(a)for(var y=o.child;y!==null;)u|=y.lanes|y.childLanes,h|=y.subtreeFlags&65011712,h|=y.flags&65011712,y.return=o,y=y.sibling;else for(y=o.child;y!==null;)u|=y.lanes|y.childLanes,h|=y.subtreeFlags,h|=y.flags,y.return=o,y=y.sibling;return o.subtreeFlags|=h,o.childLanes=u,a}function bN(o,a,u){var h=a.pendingProps;switch(ug(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ot(a),null;case 1:return Ot(a),null;case 3:return u=a.stateNode,h=null,o!==null&&(h=o.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),$i(Xt),Ue(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(o===null||o.child===null)&&(Bl(a)?Ki(a):o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,dg())),Ot(a),null;case 26:var y=a.type,x=a.memoizedState;return o===null?(Ki(a),x!==null?(Ot(a),_v(a,x)):(Ot(a),ny(a,y,null,h,u))):x?x!==o.memoizedState?(Ki(a),Ot(a),_v(a,x)):(Ot(a),a.flags&=-16777217):(o=o.memoizedProps,o!==h&&Ki(a),Ot(a),ny(a,y,o,h,u)),null;case 27:if(_e(a),u=oe.current,y=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==h&&Ki(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return Ot(a),null}o=Y.current,Bl(a)?cw(a):(o=Ik(y,h,u),a.stateNode=o,Ki(a))}return Ot(a),null;case 5:if(_e(a),y=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==h&&Ki(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return Ot(a),null}if(x=Y.current,Bl(a))cw(a);else{var w=Ad(oe.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof h.is=="string"?w.createElement("select",{is:h.is}):w.createElement("select"),h.multiple?x.multiple=!0:h.size&&(x.size=h.size);break;default:x=typeof h.is=="string"?w.createElement(y,{is:h.is}):w.createElement(y)}}x[Cn]=a,x[Xn]=h;e:for(w=a.child;w!==null;){if(w.tag===5||w.tag===6)x.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===a)break e;for(;w.sibling===null;){if(w.return===null||w.return===a)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}a.stateNode=x;e:switch(Mn(x,y,h),y){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Ki(a)}}return Ot(a),ny(a,a.type,o===null?null:o.memoizedProps,a.pendingProps,u),null;case 6:if(o&&a.stateNode!=null)o.memoizedProps!==h&&Ki(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(r(166));if(o=oe.current,Bl(a)){if(o=a.stateNode,u=a.memoizedProps,h=null,y=En,y!==null)switch(y.tag){case 27:case 5:h=y.memoizedProps}o[Cn]=a,o=!!(o.nodeValue===u||h!==null&&h.suppressHydrationWarning===!0||Tk(o.nodeValue,u)),o||Cs(a,!0)}else o=Ad(o).createTextNode(h),o[Cn]=a,a.stateNode=o}return Ot(a),null;case 31:if(u=a.memoizedState,o===null||o.memoizedState!==null){if(h=Bl(a),u!==null){if(o===null){if(!h)throw Error(r(318));if(o=a.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[Cn]=a}else _o(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ot(a),o=!1}else u=dg(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=u),o=!0;if(!o)return a.flags&256?(br(a),a):(br(a),null);if((a.flags&128)!==0)throw Error(r(558))}return Ot(a),null;case 13:if(h=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=Bl(a),h!==null&&h.dehydrated!==null){if(o===null){if(!y)throw Error(r(318));if(y=a.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[Cn]=a}else _o(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ot(a),y=!1}else y=dg(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return a.flags&256?(br(a),a):(br(a),null)}return br(a),(a.flags&128)!==0?(a.lanes=u,a):(u=h!==null,o=o!==null&&o.memoizedState!==null,u&&(h=a.child,y=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(y=h.alternate.memoizedState.cachePool.pool),x=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(x=h.memoizedState.cachePool.pool),x!==y&&(h.flags|=2048)),u!==o&&u&&(a.child.flags|=8192),dd(a,a.updateQueue),Ot(a),null);case 4:return Ue(),o===null&&Cy(a.stateNode.containerInfo),Ot(a),null;case 10:return $i(a.type),Ot(a),null;case 19:if(V(Kt),h=a.memoizedState,h===null)return Ot(a),null;if(y=(a.flags&128)!==0,x=h.rendering,x===null)if(y)Rc(h,!1);else{if(Ut!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(x=Qf(o),x!==null){for(a.flags|=128,Rc(h,!1),o=x.updateQueue,a.updateQueue=o,dd(a,o),a.subtreeFlags=0,o=u,u=a.child;u!==null;)iw(u,o),u=u.sibling;return T(Kt,Kt.current&1|2),st&&Vi(a,h.treeForkCount),a.child}o=o.sibling}h.tail!==null&&qt()>yd&&(a.flags|=128,y=!0,Rc(h,!1),a.lanes=4194304)}else{if(!y)if(o=Qf(x),o!==null){if(a.flags|=128,y=!0,o=o.updateQueue,a.updateQueue=o,dd(a,o),Rc(h,!0),h.tail===null&&h.tailMode==="hidden"&&!x.alternate&&!st)return Ot(a),null}else 2*qt()-h.renderingStartTime>yd&&u!==536870912&&(a.flags|=128,y=!0,Rc(h,!1),a.lanes=4194304);h.isBackwards?(x.sibling=a.child,a.child=x):(o=h.last,o!==null?o.sibling=x:a.child=x,h.last=x)}return h.tail!==null?(o=h.tail,h.rendering=o,h.tail=o.sibling,h.renderingStartTime=qt(),o.sibling=null,u=Kt.current,T(Kt,y?u&1|2:u&1),st&&Vi(a,h.treeForkCount),o):(Ot(a),null);case 22:case 23:return br(a),Eg(),h=a.memoizedState!==null,o!==null?o.memoizedState!==null!==h&&(a.flags|=8192):h&&(a.flags|=8192),h?(u&536870912)!==0&&(a.flags&128)===0&&(Ot(a),a.subtreeFlags&6&&(a.flags|=8192)):Ot(a),u=a.updateQueue,u!==null&&dd(a,u.retryQueue),u=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(u=o.memoizedState.cachePool.pool),h=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),h!==u&&(a.flags|=2048),o!==null&&V(No),null;case 24:return u=null,o!==null&&(u=o.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),$i(Xt),Ot(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function xN(o,a){switch(ug(a),a.tag){case 1:return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return $i(Xt),Ue(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 26:case 27:case 5:return _e(a),null;case 31:if(a.memoizedState!==null){if(br(a),a.alternate===null)throw Error(r(340));_o()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 13:if(br(a),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(r(340));_o()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return V(Kt),null;case 4:return Ue(),null;case 10:return $i(a.type),null;case 22:case 23:return br(a),Eg(),o!==null&&V(No),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 24:return $i(Xt),null;case 25:return null;default:return null}}function Dv(o,a){switch(ug(a),a.tag){case 3:$i(Xt),Ue();break;case 26:case 27:case 5:_e(a);break;case 4:Ue();break;case 31:a.memoizedState!==null&&br(a);break;case 13:br(a);break;case 19:V(Kt);break;case 10:$i(a.type);break;case 22:case 23:br(a),Eg(),o!==null&&V(No);break;case 24:$i(Xt)}}function Nc(o,a){try{var u=a.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var y=h.next;u=y;do{if((u.tag&o)===o){h=void 0;var x=u.create,w=u.inst;h=x(),w.destroy=h}u=u.next}while(u!==y)}}catch(A){pt(a,a.return,A)}}function Ds(o,a,u){try{var h=a.updateQueue,y=h!==null?h.lastEffect:null;if(y!==null){var x=y.next;h=x;do{if((h.tag&o)===o){var w=h.inst,A=w.destroy;if(A!==void 0){w.destroy=void 0,y=a;var D=u,$=A;try{$()}catch(X){pt(y,D,X)}}}h=h.next}while(h!==x)}}catch(X){pt(a,a.return,X)}}function Rv(o){var a=o.updateQueue;if(a!==null){var u=o.stateNode;try{vw(a,u)}catch(h){pt(o,o.return,h)}}}function Nv(o,a,u){u.props=Bo(o.type,o.memoizedProps),u.state=o.memoizedState;try{u.componentWillUnmount()}catch(h){pt(o,a,h)}}function zc(o,a){try{var u=o.ref;if(u!==null){switch(o.tag){case 26:case 27:case 5:var h=o.stateNode;break;case 30:h=o.stateNode;break;default:h=o.stateNode}typeof u=="function"?o.refCleanup=u(h):u.current=h}}catch(y){pt(o,a,y)}}function mi(o,a){var u=o.ref,h=o.refCleanup;if(u!==null)if(typeof h=="function")try{h()}catch(y){pt(o,a,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(y){pt(o,a,y)}else u.current=null}function zv(o){var a=o.type,u=o.memoizedProps,h=o.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":u.autoFocus&&h.focus();break e;case"img":u.src?h.src=u.src:u.srcSet&&(h.srcset=u.srcSet)}}catch(y){pt(o,o.return,y)}}function ry(o,a,u){try{var h=o.stateNode;VN(h,o.type,u,a),h[Xn]=a}catch(y){pt(o,o.return,y)}}function Lv(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Bs(o.type)||o.tag===4}function iy(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Lv(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Bs(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function sy(o,a,u){var h=o.tag;if(h===5||h===6)o=o.stateNode,a?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(o,a):(a=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,a.appendChild(o),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=Bi));else if(h!==4&&(h===27&&Bs(o.type)&&(u=o.stateNode,a=null),o=o.child,o!==null))for(sy(o,a,u),o=o.sibling;o!==null;)sy(o,a,u),o=o.sibling}function hd(o,a,u){var h=o.tag;if(h===5||h===6)o=o.stateNode,a?u.insertBefore(o,a):u.appendChild(o);else if(h!==4&&(h===27&&Bs(o.type)&&(u=o.stateNode),o=o.child,o!==null))for(hd(o,a,u),o=o.sibling;o!==null;)hd(o,a,u),o=o.sibling}function jv(o){var a=o.stateNode,u=o.memoizedProps;try{for(var h=o.type,y=a.attributes;y.length;)a.removeAttributeNode(y[0]);Mn(a,h,u),a[Cn]=o,a[Xn]=u}catch(x){pt(o,o.return,x)}}var Wi=!1,tn=!1,oy=!1,Iv=typeof WeakSet=="function"?WeakSet:Set,un=null;function SN(o,a){if(o=o.containerInfo,Ay=zd,o=GS(o),Qm(o)){if("selectionStart"in o)var u={start:o.selectionStart,end:o.selectionEnd};else e:{u=(u=o.ownerDocument)&&u.defaultView||window;var h=u.getSelection&&u.getSelection();if(h&&h.rangeCount!==0){u=h.anchorNode;var y=h.anchorOffset,x=h.focusNode;h=h.focusOffset;try{u.nodeType,x.nodeType}catch{u=null;break e}var w=0,A=-1,D=-1,$=0,X=0,ee=o,q=null;t:for(;;){for(var W;ee!==u||y!==0&&ee.nodeType!==3||(A=w+y),ee!==x||h!==0&&ee.nodeType!==3||(D=w+h),ee.nodeType===3&&(w+=ee.nodeValue.length),(W=ee.firstChild)!==null;)q=ee,ee=W;for(;;){if(ee===o)break t;if(q===u&&++$===y&&(A=w),q===x&&++X===h&&(D=w),(W=ee.nextSibling)!==null)break;ee=q,q=ee.parentNode}ee=W}u=A===-1||D===-1?null:{start:A,end:D}}else u=null}u=u||{start:0,end:0}}else u=null;for(My={focusedElem:o,selectionRange:u},zd=!1,un=a;un!==null;)if(a=un,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,un=o;else for(;un!==null;){switch(a=un,x=a.alternate,o=a.flags,a.tag){case 0:if((o&4)!==0&&(o=a.updateQueue,o=o!==null?o.events:null,o!==null))for(u=0;u<o.length;u++)y=o[u],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&x!==null){o=void 0,u=a,y=x.memoizedProps,x=x.memoizedState,h=u.stateNode;try{var Se=Bo(u.type,y);o=h.getSnapshotBeforeUpdate(Se,x),h.__reactInternalSnapshotBeforeUpdate=o}catch(Le){pt(u,u.return,Le)}}break;case 3:if((o&1024)!==0){if(o=a.stateNode.containerInfo,u=o.nodeType,u===9)Dy(o);else if(u===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":Dy(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(r(163))}if(o=a.sibling,o!==null){o.return=a.return,un=o;break}un=a.return}}function Bv(o,a,u){var h=u.flags;switch(u.tag){case 0:case 11:case 15:Zi(o,u),h&4&&Nc(5,u);break;case 1:if(Zi(o,u),h&4)if(o=u.stateNode,a===null)try{o.componentDidMount()}catch(w){pt(u,u.return,w)}else{var y=Bo(u.type,a.memoizedProps);a=a.memoizedState;try{o.componentDidUpdate(y,a,o.__reactInternalSnapshotBeforeUpdate)}catch(w){pt(u,u.return,w)}}h&64&&Rv(u),h&512&&zc(u,u.return);break;case 3:if(Zi(o,u),h&64&&(o=u.updateQueue,o!==null)){if(a=null,u.child!==null)switch(u.child.tag){case 27:case 5:a=u.child.stateNode;break;case 1:a=u.child.stateNode}try{vw(o,a)}catch(w){pt(u,u.return,w)}}break;case 27:a===null&&h&4&&jv(u);case 26:case 5:Zi(o,u),a===null&&h&4&&zv(u),h&512&&zc(u,u.return);break;case 12:Zi(o,u);break;case 31:Zi(o,u),h&4&&Vv(o,u);break;case 13:Zi(o,u),h&4&&Pv(o,u),h&64&&(o=u.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(u=ON.bind(null,u),GN(o,u))));break;case 22:if(h=u.memoizedState!==null||Wi,!h){a=a!==null&&a.memoizedState!==null||tn,y=Wi;var x=tn;Wi=h,(tn=a)&&!x?Ji(o,u,(u.subtreeFlags&8772)!==0):Zi(o,u),Wi=y,tn=x}break;case 30:break;default:Zi(o,u)}}function Uv(o){var a=o.alternate;a!==null&&(o.alternate=null,Uv(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&jm(a)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var zt=null,er=!1;function Gi(o,a,u){for(u=u.child;u!==null;)Hv(o,a,u),u=u.sibling}function Hv(o,a,u){if(Ie&&typeof Ie.onCommitFiberUnmount=="function")try{Ie.onCommitFiberUnmount(Re,u)}catch{}switch(u.tag){case 26:tn||mi(u,a),Gi(o,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:tn||mi(u,a);var h=zt,y=er;Bs(u.type)&&(zt=u.stateNode,er=!1),Gi(o,a,u),$c(u.stateNode),zt=h,er=y;break;case 5:tn||mi(u,a);case 6:if(h=zt,y=er,zt=null,Gi(o,a,u),zt=h,er=y,zt!==null)if(er)try{(zt.nodeType===9?zt.body:zt.nodeName==="HTML"?zt.ownerDocument.body:zt).removeChild(u.stateNode)}catch(x){pt(u,a,x)}else try{zt.removeChild(u.stateNode)}catch(x){pt(u,a,x)}break;case 18:zt!==null&&(er?(o=zt,Rk(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,u.stateNode),sa(o)):Rk(zt,u.stateNode));break;case 4:h=zt,y=er,zt=u.stateNode.containerInfo,er=!0,Gi(o,a,u),zt=h,er=y;break;case 0:case 11:case 14:case 15:Ds(2,u,a),tn||Ds(4,u,a),Gi(o,a,u);break;case 1:tn||(mi(u,a),h=u.stateNode,typeof h.componentWillUnmount=="function"&&Nv(u,a,h)),Gi(o,a,u);break;case 21:Gi(o,a,u);break;case 22:tn=(h=tn)||u.memoizedState!==null,Gi(o,a,u),tn=h;break;default:Gi(o,a,u)}}function Vv(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{sa(o)}catch(u){pt(a,a.return,u)}}}function Pv(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{sa(o)}catch(u){pt(a,a.return,u)}}function wN(o){switch(o.tag){case 31:case 13:case 19:var a=o.stateNode;return a===null&&(a=o.stateNode=new Iv),a;case 22:return o=o.stateNode,a=o._retryCache,a===null&&(a=o._retryCache=new Iv),a;default:throw Error(r(435,o.tag))}}function pd(o,a){var u=wN(o);a.forEach(function(h){if(!u.has(h)){u.add(h);var y=_N.bind(null,o,h);h.then(y,y)}})}function tr(o,a){var u=a.deletions;if(u!==null)for(var h=0;h<u.length;h++){var y=u[h],x=o,w=a,A=w;e:for(;A!==null;){switch(A.tag){case 27:if(Bs(A.type)){zt=A.stateNode,er=!1;break e}break;case 5:zt=A.stateNode,er=!1;break e;case 3:case 4:zt=A.stateNode.containerInfo,er=!0;break e}A=A.return}if(zt===null)throw Error(r(160));Hv(x,w,y),zt=null,er=!1,x=y.alternate,x!==null&&(x.return=null),y.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)$v(a,o),a=a.sibling}var ni=null;function $v(o,a){var u=o.alternate,h=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:tr(a,o),nr(o),h&4&&(Ds(3,o,o.return),Nc(3,o),Ds(5,o,o.return));break;case 1:tr(a,o),nr(o),h&512&&(tn||u===null||mi(u,u.return)),h&64&&Wi&&(o=o.updateQueue,o!==null&&(h=o.callbacks,h!==null&&(u=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=u===null?h:u.concat(h))));break;case 26:var y=ni;if(tr(a,o),nr(o),h&512&&(tn||u===null||mi(u,u.return)),h&4){var x=u!==null?u.memoizedState:null;if(h=o.memoizedState,u===null)if(h===null)if(o.stateNode===null){e:{h=o.type,u=o.memoizedProps,y=y.ownerDocument||y;t:switch(h){case"title":x=y.getElementsByTagName("title")[0],(!x||x[lc]||x[Cn]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=y.createElement(h),y.head.insertBefore(x,y.querySelector("head > title"))),Mn(x,h,u),x[Cn]=o,cn(x),h=x;break e;case"link":var w=$k("link","href",y).get(h+(u.href||""));if(w){for(var A=0;A<w.length;A++)if(x=w[A],x.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&x.getAttribute("rel")===(u.rel==null?null:u.rel)&&x.getAttribute("title")===(u.title==null?null:u.title)&&x.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){w.splice(A,1);break t}}x=y.createElement(h),Mn(x,h,u),y.head.appendChild(x);break;case"meta":if(w=$k("meta","content",y).get(h+(u.content||""))){for(A=0;A<w.length;A++)if(x=w[A],x.getAttribute("content")===(u.content==null?null:""+u.content)&&x.getAttribute("name")===(u.name==null?null:u.name)&&x.getAttribute("property")===(u.property==null?null:u.property)&&x.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&x.getAttribute("charset")===(u.charSet==null?null:u.charSet)){w.splice(A,1);break t}}x=y.createElement(h),Mn(x,h,u),y.head.appendChild(x);break;default:throw Error(r(468,h))}x[Cn]=o,cn(x),h=x}o.stateNode=h}else Fk(y,o.type,o.stateNode);else o.stateNode=Pk(y,h,o.memoizedProps);else x!==h?(x===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):x.count--,h===null?Fk(y,o.type,o.stateNode):Pk(y,h,o.memoizedProps)):h===null&&o.stateNode!==null&&ry(o,o.memoizedProps,u.memoizedProps)}break;case 27:tr(a,o),nr(o),h&512&&(tn||u===null||mi(u,u.return)),u!==null&&h&4&&ry(o,o.memoizedProps,u.memoizedProps);break;case 5:if(tr(a,o),nr(o),h&512&&(tn||u===null||mi(u,u.return)),o.flags&32){y=o.stateNode;try{Ml(y,"")}catch(Se){pt(o,o.return,Se)}}h&4&&o.stateNode!=null&&(y=o.memoizedProps,ry(o,y,u!==null?u.memoizedProps:y)),h&1024&&(oy=!0);break;case 6:if(tr(a,o),nr(o),h&4){if(o.stateNode===null)throw Error(r(162));h=o.memoizedProps,u=o.stateNode;try{u.nodeValue=h}catch(Se){pt(o,o.return,Se)}}break;case 3:if(_d=null,y=ni,ni=Md(a.containerInfo),tr(a,o),ni=y,nr(o),h&4&&u!==null&&u.memoizedState.isDehydrated)try{sa(a.containerInfo)}catch(Se){pt(o,o.return,Se)}oy&&(oy=!1,Fv(o));break;case 4:h=ni,ni=Md(o.stateNode.containerInfo),tr(a,o),nr(o),ni=h;break;case 12:tr(a,o),nr(o);break;case 31:tr(a,o),nr(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,pd(o,h)));break;case 13:tr(a,o),nr(o),o.child.flags&8192&&o.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(gd=qt()),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,pd(o,h)));break;case 22:y=o.memoizedState!==null;var D=u!==null&&u.memoizedState!==null,$=Wi,X=tn;if(Wi=$||y,tn=X||D,tr(a,o),tn=X,Wi=$,nr(o),h&8192)e:for(a=o.stateNode,a._visibility=y?a._visibility&-2:a._visibility|1,y&&(u===null||D||Wi||tn||Uo(o)),u=null,a=o;;){if(a.tag===5||a.tag===26){if(u===null){D=u=a;try{if(x=D.stateNode,y)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{A=D.stateNode;var ee=D.memoizedProps.style,q=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;A.style.display=q==null||typeof q=="boolean"?"":(""+q).trim()}}catch(Se){pt(D,D.return,Se)}}}else if(a.tag===6){if(u===null){D=a;try{D.stateNode.nodeValue=y?"":D.memoizedProps}catch(Se){pt(D,D.return,Se)}}}else if(a.tag===18){if(u===null){D=a;try{var W=D.stateNode;y?Nk(W,!0):Nk(D.stateNode,!1)}catch(Se){pt(D,D.return,Se)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===o)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break e;for(;a.sibling===null;){if(a.return===null||a.return===o)break e;u===a&&(u=null),a=a.return}u===a&&(u=null),a.sibling.return=a.return,a=a.sibling}h&4&&(h=o.updateQueue,h!==null&&(u=h.retryQueue,u!==null&&(h.retryQueue=null,pd(o,u))));break;case 19:tr(a,o),nr(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,pd(o,h)));break;case 30:break;case 21:break;default:tr(a,o),nr(o)}}function nr(o){var a=o.flags;if(a&2){try{for(var u,h=o.return;h!==null;){if(Lv(h)){u=h;break}h=h.return}if(u==null)throw Error(r(160));switch(u.tag){case 27:var y=u.stateNode,x=iy(o);hd(o,x,y);break;case 5:var w=u.stateNode;u.flags&32&&(Ml(w,""),u.flags&=-33);var A=iy(o);hd(o,A,w);break;case 3:case 4:var D=u.stateNode.containerInfo,$=iy(o);sy(o,$,D);break;default:throw Error(r(161))}}catch(X){pt(o,o.return,X)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function Fv(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var a=o;Fv(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),o=o.sibling}}function Zi(o,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Bv(o,a.alternate,a),a=a.sibling}function Uo(o){for(o=o.child;o!==null;){var a=o;switch(a.tag){case 0:case 11:case 14:case 15:Ds(4,a,a.return),Uo(a);break;case 1:mi(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&Nv(a,a.return,u),Uo(a);break;case 27:$c(a.stateNode);case 26:case 5:mi(a,a.return),Uo(a);break;case 22:a.memoizedState===null&&Uo(a);break;case 30:Uo(a);break;default:Uo(a)}o=o.sibling}}function Ji(o,a,u){for(u=u&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,y=o,x=a,w=x.flags;switch(x.tag){case 0:case 11:case 15:Ji(y,x,u),Nc(4,x);break;case 1:if(Ji(y,x,u),h=x,y=h.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch($){pt(h,h.return,$)}if(h=x,y=h.updateQueue,y!==null){var A=h.stateNode;try{var D=y.shared.hiddenCallbacks;if(D!==null)for(y.shared.hiddenCallbacks=null,y=0;y<D.length;y++)ww(D[y],A)}catch($){pt(h,h.return,$)}}u&&w&64&&Rv(x),zc(x,x.return);break;case 27:jv(x);case 26:case 5:Ji(y,x,u),u&&h===null&&w&4&&zv(x),zc(x,x.return);break;case 12:Ji(y,x,u);break;case 31:Ji(y,x,u),u&&w&4&&Vv(y,x);break;case 13:Ji(y,x,u),u&&w&4&&Pv(y,x);break;case 22:x.memoizedState===null&&Ji(y,x,u),zc(x,x.return);break;case 30:break;default:Ji(y,x,u)}a=a.sibling}}function ly(o,a){var u=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(u=o.memoizedState.cachePool.pool),o=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(o=a.memoizedState.cachePool.pool),o!==u&&(o!=null&&o.refCount++,u!=null&&Sc(u))}function ay(o,a){o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&Sc(o))}function ri(o,a,u,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)qv(o,a,u,h),a=a.sibling}function qv(o,a,u,h){var y=a.flags;switch(a.tag){case 0:case 11:case 15:ri(o,a,u,h),y&2048&&Nc(9,a);break;case 1:ri(o,a,u,h);break;case 3:ri(o,a,u,h),y&2048&&(o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&Sc(o)));break;case 12:if(y&2048){ri(o,a,u,h),o=a.stateNode;try{var x=a.memoizedProps,w=x.id,A=x.onPostCommit;typeof A=="function"&&A(w,a.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(D){pt(a,a.return,D)}}else ri(o,a,u,h);break;case 31:ri(o,a,u,h);break;case 13:ri(o,a,u,h);break;case 23:break;case 22:x=a.stateNode,w=a.alternate,a.memoizedState!==null?x._visibility&2?ri(o,a,u,h):Lc(o,a):x._visibility&2?ri(o,a,u,h):(x._visibility|=2,Wl(o,a,u,h,(a.subtreeFlags&10256)!==0||!1)),y&2048&&ly(w,a);break;case 24:ri(o,a,u,h),y&2048&&ay(a.alternate,a);break;default:ri(o,a,u,h)}}function Wl(o,a,u,h,y){for(y=y&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=o,w=a,A=u,D=h,$=w.flags;switch(w.tag){case 0:case 11:case 15:Wl(x,w,A,D,y),Nc(8,w);break;case 23:break;case 22:var X=w.stateNode;w.memoizedState!==null?X._visibility&2?Wl(x,w,A,D,y):Lc(x,w):(X._visibility|=2,Wl(x,w,A,D,y)),y&&$&2048&&ly(w.alternate,w);break;case 24:Wl(x,w,A,D,y),y&&$&2048&&ay(w.alternate,w);break;default:Wl(x,w,A,D,y)}a=a.sibling}}function Lc(o,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var u=o,h=a,y=h.flags;switch(h.tag){case 22:Lc(u,h),y&2048&&ly(h.alternate,h);break;case 24:Lc(u,h),y&2048&&ay(h.alternate,h);break;default:Lc(u,h)}a=a.sibling}}var jc=8192;function Gl(o,a,u){if(o.subtreeFlags&jc)for(o=o.child;o!==null;)Yv(o,a,u),o=o.sibling}function Yv(o,a,u){switch(o.tag){case 26:Gl(o,a,u),o.flags&jc&&o.memoizedState!==null&&lz(u,ni,o.memoizedState,o.memoizedProps);break;case 5:Gl(o,a,u);break;case 3:case 4:var h=ni;ni=Md(o.stateNode.containerInfo),Gl(o,a,u),ni=h;break;case 22:o.memoizedState===null&&(h=o.alternate,h!==null&&h.memoizedState!==null?(h=jc,jc=16777216,Gl(o,a,u),jc=h):Gl(o,a,u));break;default:Gl(o,a,u)}}function Kv(o){var a=o.alternate;if(a!==null&&(o=a.child,o!==null)){a.child=null;do a=o.sibling,o.sibling=null,o=a;while(o!==null)}}function Ic(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var h=a[u];un=h,Gv(h,o)}Kv(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)Wv(o),o=o.sibling}function Wv(o){switch(o.tag){case 0:case 11:case 15:Ic(o),o.flags&2048&&Ds(9,o,o.return);break;case 3:Ic(o);break;case 12:Ic(o);break;case 22:var a=o.stateNode;o.memoizedState!==null&&a._visibility&2&&(o.return===null||o.return.tag!==13)?(a._visibility&=-3,md(o)):Ic(o);break;default:Ic(o)}}function md(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var h=a[u];un=h,Gv(h,o)}Kv(o)}for(o=o.child;o!==null;){switch(a=o,a.tag){case 0:case 11:case 15:Ds(8,a,a.return),md(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,md(a));break;default:md(a)}o=o.sibling}}function Gv(o,a){for(;un!==null;){var u=un;switch(u.tag){case 0:case 11:case 15:Ds(8,u,a);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var h=u.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:Sc(u.memoizedState.cache)}if(h=u.child,h!==null)h.return=u,un=h;else e:for(u=o;un!==null;){h=un;var y=h.sibling,x=h.return;if(Uv(h),h===u){un=null;break e}if(y!==null){y.return=x,un=y;break e}un=x}}}var vN={getCacheForType:function(o){var a=Tn(Xt),u=a.data.get(o);return u===void 0&&(u=o(),a.data.set(o,u)),u},cacheSignal:function(){return Tn(Xt).controller.signal}},kN=typeof WeakMap=="function"?WeakMap:Map,ft=0,wt=null,et=null,nt=0,ht=0,xr=null,Rs=!1,Zl=!1,cy=!1,Xi=0,Ut=0,Ns=0,Ho=0,uy=0,Sr=0,Jl=0,Bc=null,rr=null,fy=!1,gd=0,Zv=0,yd=1/0,bd=null,zs=null,ln=0,Ls=null,Xl=null,Qi=0,dy=0,hy=null,Jv=null,Uc=0,py=null;function wr(){return(ft&2)!==0&&nt!==0?nt&-nt:L.T!==null?Sy():hS()}function Xv(){if(Sr===0)if((nt&536870912)===0||st){var o=St;St<<=1,(St&3932160)===0&&(St=262144),Sr=o}else Sr=536870912;return o=yr.current,o!==null&&(o.flags|=32),Sr}function ir(o,a,u){(o===wt&&(ht===2||ht===9)||o.cancelPendingCommit!==null)&&(Ql(o,0),js(o,nt,Sr,!1)),ji(o,u),((ft&2)===0||o!==wt)&&(o===wt&&((ft&2)===0&&(Ho|=u),Ut===4&&js(o,nt,Sr,!1)),gi(o))}function Qv(o,a,u){if((ft&6)!==0)throw Error(r(327));var h=!u&&(a&127)===0&&(a&o.expiredLanes)===0||bs(o,a),y=h?TN(o,a):gy(o,a,!0),x=h;do{if(y===0){Zl&&!h&&js(o,a,0,!1);break}else{if(u=o.current.alternate,x&&!CN(u)){y=gy(o,a,!1),x=!1;continue}if(y===2){if(x=a,o.errorRecoveryDisabledLanes&x)var w=0;else w=o.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){a=w;e:{var A=o;y=Bc;var D=A.current.memoizedState.isDehydrated;if(D&&(Ql(A,w).flags|=256),w=gy(A,w,!1),w!==2){if(cy&&!D){A.errorRecoveryDisabledLanes|=x,Ho|=x,y=4;break e}x=rr,rr=y,x!==null&&(rr===null?rr=x:rr.push.apply(rr,x))}y=w}if(x=!1,y!==2)continue}}if(y===1){Ql(o,0),js(o,a,0,!0);break}e:{switch(h=o,x=y,x){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:js(h,a,Sr,!Rs);break e;case 2:rr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(y=gd+300-qt(),10<y)){if(js(h,a,Sr,!Rs),Or(h,0,!0)!==0)break e;Qi=a,h.timeoutHandle=_k(ek.bind(null,h,u,rr,bd,fy,a,Sr,Ho,Jl,Rs,x,"Throttled",-0,0),y);break e}ek(h,u,rr,bd,fy,a,Sr,Ho,Jl,Rs,x,null,-0,0)}}break}while(!0);gi(o)}function ek(o,a,u,h,y,x,w,A,D,$,X,ee,q,W){if(o.timeoutHandle=-1,ee=a.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Bi},Yv(a,x,ee);var Se=(x&62914560)===x?gd-qt():(x&4194048)===x?Zv-qt():0;if(Se=az(ee,Se),Se!==null){Qi=x,o.cancelPendingCommit=Se(ak.bind(null,o,a,x,u,h,y,w,A,D,X,ee,null,q,W)),js(o,x,w,!$);return}}ak(o,a,x,u,h,y,w,A,D)}function CN(o){for(var a=o;;){var u=a.tag;if((u===0||u===11||u===15)&&a.flags&16384&&(u=a.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var h=0;h<u.length;h++){var y=u[h],x=y.getSnapshot;y=y.value;try{if(!mr(x(),y))return!1}catch{return!1}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function js(o,a,u,h){a&=~uy,a&=~Ho,o.suspendedLanes|=a,o.pingedLanes&=~a,h&&(o.warmLanes|=a),h=o.expirationTimes;for(var y=a;0<y;){var x=31-Ze(y),w=1<<x;h[x]=-1,y&=~w}u!==0&&Mf(o,u,a)}function xd(){return(ft&6)===0?(Hc(0),!1):!0}function my(){if(et!==null){if(ht===0)var o=et.return;else o=et,Pi=Do=null,Dg(o),$l=null,vc=0,o=et;for(;o!==null;)Dv(o.alternate,o),o=o.return;et=null}}function Ql(o,a){var u=o.timeoutHandle;u!==-1&&(o.timeoutHandle=-1,FN(u)),u=o.cancelPendingCommit,u!==null&&(o.cancelPendingCommit=null,u()),Qi=0,my(),wt=o,et=u=Hi(o.current,null),nt=a,ht=0,xr=null,Rs=!1,Zl=bs(o,a),cy=!1,Jl=Sr=uy=Ho=Ns=Ut=0,rr=Bc=null,fy=!1,(a&8)!==0&&(a|=a&32);var h=o.entangledLanes;if(h!==0)for(o=o.entanglements,h&=a;0<h;){var y=31-Ze(h),x=1<<y;a|=o[y],h&=~x}return Xi=a,Hf(),u}function tk(o,a){qe=null,L.H=_c,a===Pl||a===Wf?(a=yw(),ht=3):a===xg?(a=yw(),ht=4):ht=a===Kg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,xr=a,et===null&&(Ut=1,ad(o,Nr(a,o.current)))}function nk(){var o=yr.current;return o===null?!0:(nt&4194048)===nt?Ir===null:(nt&62914560)===nt||(nt&536870912)!==0?o===Ir:!1}function rk(){var o=L.H;return L.H=_c,o===null?_c:o}function ik(){var o=L.A;return L.A=vN,o}function Sd(){Ut=4,Rs||(nt&4194048)!==nt&&yr.current!==null||(Zl=!0),(Ns&134217727)===0&&(Ho&134217727)===0||wt===null||js(wt,nt,Sr,!1)}function gy(o,a,u){var h=ft;ft|=2;var y=rk(),x=ik();(wt!==o||nt!==a)&&(bd=null,Ql(o,a)),a=!1;var w=Ut;e:do try{if(ht!==0&&et!==null){var A=et,D=xr;switch(ht){case 8:my(),w=6;break e;case 3:case 2:case 9:case 6:yr.current===null&&(a=!0);var $=ht;if(ht=0,xr=null,ea(o,A,D,$),u&&Zl){w=0;break e}break;default:$=ht,ht=0,xr=null,ea(o,A,D,$)}}EN(),w=Ut;break}catch(X){tk(o,X)}while(!0);return a&&o.shellSuspendCounter++,Pi=Do=null,ft=h,L.H=y,L.A=x,et===null&&(wt=null,nt=0,Hf()),w}function EN(){for(;et!==null;)sk(et)}function TN(o,a){var u=ft;ft|=2;var h=rk(),y=ik();wt!==o||nt!==a?(bd=null,yd=qt()+500,Ql(o,a)):Zl=bs(o,a);e:do try{if(ht!==0&&et!==null){a=et;var x=xr;t:switch(ht){case 1:ht=0,xr=null,ea(o,a,x,1);break;case 2:case 9:if(mw(x)){ht=0,xr=null,ok(a);break}a=function(){ht!==2&&ht!==9||wt!==o||(ht=7),gi(o)},x.then(a,a);break e;case 3:ht=7;break e;case 4:ht=5;break e;case 7:mw(x)?(ht=0,xr=null,ok(a)):(ht=0,xr=null,ea(o,a,x,7));break;case 5:var w=null;switch(et.tag){case 26:w=et.memoizedState;case 5:case 27:var A=et;if(w?qk(w):A.stateNode.complete){ht=0,xr=null;var D=A.sibling;if(D!==null)et=D;else{var $=A.return;$!==null?(et=$,wd($)):et=null}break t}}ht=0,xr=null,ea(o,a,x,5);break;case 6:ht=0,xr=null,ea(o,a,x,6);break;case 8:my(),Ut=6;break e;default:throw Error(r(462))}}AN();break}catch(X){tk(o,X)}while(!0);return Pi=Do=null,L.H=h,L.A=y,ft=u,et!==null?0:(wt=null,nt=0,Hf(),Ut)}function AN(){for(;et!==null&&!di();)sk(et)}function sk(o){var a=Ov(o.alternate,o,Xi);o.memoizedProps=o.pendingProps,a===null?wd(o):et=a}function ok(o){var a=o,u=a.alternate;switch(a.tag){case 15:case 0:a=kv(u,a,a.pendingProps,a.type,void 0,nt);break;case 11:a=kv(u,a,a.pendingProps,a.type.render,a.ref,nt);break;case 5:Dg(a);default:Dv(u,a),a=et=iw(a,Xi),a=Ov(u,a,Xi)}o.memoizedProps=o.pendingProps,a===null?wd(o):et=a}function ea(o,a,u,h){Pi=Do=null,Dg(a),$l=null,vc=0;var y=a.return;try{if(mN(o,y,a,u,nt)){Ut=1,ad(o,Nr(u,o.current)),et=null;return}}catch(x){if(y!==null)throw et=y,x;Ut=1,ad(o,Nr(u,o.current)),et=null;return}a.flags&32768?(st||h===1?o=!0:Zl||(nt&536870912)!==0?o=!1:(Rs=o=!0,(h===2||h===9||h===3||h===6)&&(h=yr.current,h!==null&&h.tag===13&&(h.flags|=16384))),lk(a,o)):wd(a)}function wd(o){var a=o;do{if((a.flags&32768)!==0){lk(a,Rs);return}o=a.return;var u=bN(a.alternate,a,Xi);if(u!==null){et=u;return}if(a=a.sibling,a!==null){et=a;return}et=a=o}while(a!==null);Ut===0&&(Ut=5)}function lk(o,a){do{var u=xN(o.alternate,o);if(u!==null){u.flags&=32767,et=u;return}if(u=o.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(o=o.sibling,o!==null)){et=o;return}et=o=u}while(o!==null);Ut=6,et=null}function ak(o,a,u,h,y,x,w,A,D){o.cancelPendingCommit=null;do vd();while(ln!==0);if((ft&6)!==0)throw Error(r(327));if(a!==null){if(a===o.current)throw Error(r(177));if(x=a.lanes|a.childLanes,x|=ig,Af(o,u,x,w,A,D),o===wt&&(et=wt=null,nt=0),Xl=a,Ls=o,Qi=u,dy=x,hy=y,Jv=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,DN(Ae,function(){return hk(),null})):(o.callbackNode=null,o.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=L.T,L.T=null,y=G.p,G.p=2,w=ft,ft|=4;try{SN(o,a,u)}finally{ft=w,G.p=y,L.T=h}}ln=1,ck(),uk(),fk()}}function ck(){if(ln===1){ln=0;var o=Ls,a=Xl,u=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||u){u=L.T,L.T=null;var h=G.p;G.p=2;var y=ft;ft|=4;try{$v(a,o);var x=My,w=GS(o.containerInfo),A=x.focusedElem,D=x.selectionRange;if(w!==A&&A&&A.ownerDocument&&WS(A.ownerDocument.documentElement,A)){if(D!==null&&Qm(A)){var $=D.start,X=D.end;if(X===void 0&&(X=$),"selectionStart"in A)A.selectionStart=$,A.selectionEnd=Math.min(X,A.value.length);else{var ee=A.ownerDocument||document,q=ee&&ee.defaultView||window;if(q.getSelection){var W=q.getSelection(),Se=A.textContent.length,Le=Math.min(D.start,Se),bt=D.end===void 0?Le:Math.min(D.end,Se);!W.extend&&Le>bt&&(w=bt,bt=Le,Le=w);var U=KS(A,Le),z=KS(A,bt);if(U&&z&&(W.rangeCount!==1||W.anchorNode!==U.node||W.anchorOffset!==U.offset||W.focusNode!==z.node||W.focusOffset!==z.offset)){var P=ee.createRange();P.setStart(U.node,U.offset),W.removeAllRanges(),Le>bt?(W.addRange(P),W.extend(z.node,z.offset)):(P.setEnd(z.node,z.offset),W.addRange(P))}}}}for(ee=[],W=A;W=W.parentNode;)W.nodeType===1&&ee.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<ee.length;A++){var Q=ee[A];Q.element.scrollLeft=Q.left,Q.element.scrollTop=Q.top}}zd=!!Ay,My=Ay=null}finally{ft=y,G.p=h,L.T=u}}o.current=a,ln=2}}function uk(){if(ln===2){ln=0;var o=Ls,a=Xl,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=L.T,L.T=null;var h=G.p;G.p=2;var y=ft;ft|=4;try{Bv(o,a.alternate,a)}finally{ft=y,G.p=h,L.T=u}}ln=3}}function fk(){if(ln===4||ln===3){ln=0,ys();var o=Ls,a=Xl,u=Qi,h=Jv;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?ln=5:(ln=0,Xl=Ls=null,dk(o,o.pendingLanes));var y=o.pendingLanes;if(y===0&&(zs=null),zm(u),a=a.stateNode,Ie&&typeof Ie.onCommitFiberRoot=="function")try{Ie.onCommitFiberRoot(Re,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=L.T,y=G.p,G.p=2,L.T=null;try{for(var x=o.onRecoverableError,w=0;w<h.length;w++){var A=h[w];x(A.value,{componentStack:A.stack})}}finally{L.T=a,G.p=y}}(Qi&3)!==0&&vd(),gi(o),y=o.pendingLanes,(u&261930)!==0&&(y&42)!==0?o===py?Uc++:(Uc=0,py=o):Uc=0,Hc(0)}}function dk(o,a){(o.pooledCacheLanes&=a)===0&&(a=o.pooledCache,a!=null&&(o.pooledCache=null,Sc(a)))}function vd(){return ck(),uk(),fk(),hk()}function hk(){if(ln!==5)return!1;var o=Ls,a=dy;dy=0;var u=zm(Qi),h=L.T,y=G.p;try{G.p=32>u?32:u,L.T=null,u=hy,hy=null;var x=Ls,w=Qi;if(ln=0,Xl=Ls=null,Qi=0,(ft&6)!==0)throw Error(r(331));var A=ft;if(ft|=4,Wv(x.current),qv(x,x.current,w,u),ft=A,Hc(0,!1),Ie&&typeof Ie.onPostCommitFiberRoot=="function")try{Ie.onPostCommitFiberRoot(Re,x)}catch{}return!0}finally{G.p=y,L.T=h,dk(o,a)}}function pk(o,a,u){a=Nr(u,a),a=Yg(o.stateNode,a,2),o=Ms(o,a,2),o!==null&&(ji(o,2),gi(o))}function pt(o,a,u){if(o.tag===3)pk(o,o,u);else for(;a!==null;){if(a.tag===3){pk(a,o,u);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(zs===null||!zs.has(h))){o=Nr(u,o),u=mv(2),h=Ms(a,u,2),h!==null&&(gv(u,h,a,o),ji(h,2),gi(h));break}}a=a.return}}function yy(o,a,u){var h=o.pingCache;if(h===null){h=o.pingCache=new kN;var y=new Set;h.set(a,y)}else y=h.get(a),y===void 0&&(y=new Set,h.set(a,y));y.has(u)||(cy=!0,y.add(u),o=MN.bind(null,o,a,u),a.then(o,o))}function MN(o,a,u){var h=o.pingCache;h!==null&&h.delete(a),o.pingedLanes|=o.suspendedLanes&u,o.warmLanes&=~u,wt===o&&(nt&u)===u&&(Ut===4||Ut===3&&(nt&62914560)===nt&&300>qt()-gd?(ft&2)===0&&Ql(o,0):uy|=u,Jl===nt&&(Jl=0)),gi(o)}function mk(o,a){a===0&&(a=wl()),o=Mo(o,a),o!==null&&(ji(o,a),gi(o))}function ON(o){var a=o.memoizedState,u=0;a!==null&&(u=a.retryLane),mk(o,u)}function _N(o,a){var u=0;switch(o.tag){case 31:case 13:var h=o.stateNode,y=o.memoizedState;y!==null&&(u=y.retryLane);break;case 19:h=o.stateNode;break;case 22:h=o.stateNode._retryCache;break;default:throw Error(r(314))}h!==null&&h.delete(a),mk(o,u)}function DN(o,a){return Jn(o,a)}var kd=null,ta=null,by=!1,Cd=!1,xy=!1,Is=0;function gi(o){o!==ta&&o.next===null&&(ta===null?kd=ta=o:ta=ta.next=o),Cd=!0,by||(by=!0,NN())}function Hc(o,a){if(!xy&&Cd){xy=!0;do for(var u=!1,h=kd;h!==null;){if(o!==0){var y=h.pendingLanes;if(y===0)var x=0;else{var w=h.suspendedLanes,A=h.pingedLanes;x=(1<<31-Ze(42|o)+1)-1,x&=y&~(w&~A),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(u=!0,xk(h,x))}else x=nt,x=Or(h,h===wt?x:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(x&3)===0||bs(h,x)||(u=!0,xk(h,x));h=h.next}while(u);xy=!1}}function RN(){gk()}function gk(){Cd=by=!1;var o=0;Is!==0&&$N()&&(o=Is);for(var a=qt(),u=null,h=kd;h!==null;){var y=h.next,x=yk(h,a);x===0?(h.next=null,u===null?kd=y:u.next=y,y===null&&(ta=u)):(u=h,(o!==0||(x&3)!==0)&&(Cd=!0)),h=y}ln!==0&&ln!==5||Hc(o),Is!==0&&(Is=0)}function yk(o,a){for(var u=o.suspendedLanes,h=o.pingedLanes,y=o.expirationTimes,x=o.pendingLanes&-62914561;0<x;){var w=31-Ze(x),A=1<<w,D=y[w];D===-1?((A&u)===0||(A&h)!==0)&&(y[w]=vo(A,a)):D<=a&&(o.expiredLanes|=A),x&=~A}if(a=wt,u=nt,u=Or(o,o===a?u:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h=o.callbackNode,u===0||o===a&&(ht===2||ht===9)||o.cancelPendingCommit!==null)return h!==null&&h!==null&&Jt(h),o.callbackNode=null,o.callbackPriority=0;if((u&3)===0||bs(o,u)){if(a=u&-u,a===o.callbackPriority)return a;switch(h!==null&&Jt(h),zm(u)){case 2:case 8:u=de;break;case 32:u=Ae;break;case 268435456:u=pe;break;default:u=Ae}return h=bk.bind(null,o),u=Jn(u,h),o.callbackPriority=a,o.callbackNode=u,a}return h!==null&&h!==null&&Jt(h),o.callbackPriority=2,o.callbackNode=null,2}function bk(o,a){if(ln!==0&&ln!==5)return o.callbackNode=null,o.callbackPriority=0,null;var u=o.callbackNode;if(vd()&&o.callbackNode!==u)return null;var h=nt;return h=Or(o,o===wt?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h===0?null:(Qv(o,h,a),yk(o,qt()),o.callbackNode!=null&&o.callbackNode===u?bk.bind(null,o):null)}function xk(o,a){if(vd())return null;Qv(o,a,!0)}function NN(){qN(function(){(ft&6)!==0?Jn(J,RN):gk()})}function Sy(){if(Is===0){var o=Hl;o===0&&(o=ye,ye<<=1,(ye&261888)===0&&(ye=256)),Is=o}return Is}function Sk(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Rf(""+o)}function wk(o,a){var u=a.ownerDocument.createElement("input");return u.name=a.name,u.value=a.value,o.id&&u.setAttribute("form",o.id),a.parentNode.insertBefore(u,a),o=new FormData(o),u.parentNode.removeChild(u),o}function zN(o,a,u,h,y){if(a==="submit"&&u&&u.stateNode===y){var x=Sk((y[Xn]||null).action),w=h.submitter;w&&(a=(a=w[Xn]||null)?Sk(a.formAction):w.getAttribute("formAction"),a!==null&&(x=a,w=null));var A=new jf("action","action",null,h,y);o.push({event:A,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Is!==0){var D=w?wk(y,w):new FormData(y);Hg(u,{pending:!0,data:D,method:y.method,action:x},null,D)}}else typeof x=="function"&&(A.preventDefault(),D=w?wk(y,w):new FormData(y),Hg(u,{pending:!0,data:D,method:y.method,action:x},x,D))},currentTarget:y}]})}}for(var wy=0;wy<rg.length;wy++){var vy=rg[wy],LN=vy.toLowerCase(),jN=vy[0].toUpperCase()+vy.slice(1);ti(LN,"on"+jN)}ti(XS,"onAnimationEnd"),ti(QS,"onAnimationIteration"),ti(ew,"onAnimationStart"),ti("dblclick","onDoubleClick"),ti("focusin","onFocus"),ti("focusout","onBlur"),ti(XR,"onTransitionRun"),ti(QR,"onTransitionStart"),ti(eN,"onTransitionCancel"),ti(tw,"onTransitionEnd"),Tl("onMouseEnter",["mouseout","mouseover"]),Tl("onMouseLeave",["mouseout","mouseover"]),Tl("onPointerEnter",["pointerout","pointerover"]),Tl("onPointerLeave",["pointerout","pointerover"]),Co("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Co("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Co("onBeforeInput",["compositionend","keypress","textInput","paste"]),Co("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Co("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Co("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vc="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(" "),IN=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Vc));function vk(o,a){a=(a&4)!==0;for(var u=0;u<o.length;u++){var h=o[u],y=h.event;h=h.listeners;e:{var x=void 0;if(a)for(var w=h.length-1;0<=w;w--){var A=h[w],D=A.instance,$=A.currentTarget;if(A=A.listener,D!==x&&y.isPropagationStopped())break e;x=A,y.currentTarget=$;try{x(y)}catch(X){Uf(X)}y.currentTarget=null,x=D}else for(w=0;w<h.length;w++){if(A=h[w],D=A.instance,$=A.currentTarget,A=A.listener,D!==x&&y.isPropagationStopped())break e;x=A,y.currentTarget=$;try{x(y)}catch(X){Uf(X)}y.currentTarget=null,x=D}}}}function tt(o,a){var u=a[Lm];u===void 0&&(u=a[Lm]=new Set);var h=o+"__bubble";u.has(h)||(kk(a,o,2,!1),u.add(h))}function ky(o,a,u){var h=0;a&&(h|=4),kk(u,o,h,a)}var Ed="_reactListening"+Math.random().toString(36).slice(2);function Cy(o){if(!o[Ed]){o[Ed]=!0,gS.forEach(function(u){u!=="selectionchange"&&(IN.has(u)||ky(u,!1,o),ky(u,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[Ed]||(a[Ed]=!0,ky("selectionchange",!1,a))}}function kk(o,a,u,h){switch(Xk(a)){case 2:var y=fz;break;case 8:y=dz;break;default:y=Uy}u=y.bind(null,a,u,o),y=void 0,!Fm||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(y=!0),h?y!==void 0?o.addEventListener(a,u,{capture:!0,passive:y}):o.addEventListener(a,u,!0):y!==void 0?o.addEventListener(a,u,{passive:y}):o.addEventListener(a,u,!1)}function Ey(o,a,u,h,y){var x=h;if((a&1)===0&&(a&2)===0&&h!==null)e:for(;;){if(h===null)return;var w=h.tag;if(w===3||w===4){var A=h.stateNode.containerInfo;if(A===y)break;if(w===4)for(w=h.return;w!==null;){var D=w.tag;if((D===3||D===4)&&w.stateNode.containerInfo===y)return;w=w.return}for(;A!==null;){if(w=kl(A),w===null)return;if(D=w.tag,D===5||D===6||D===26||D===27){h=x=w;continue e}A=A.parentNode}}h=h.return}MS(function(){var $=x,X=Pm(u),ee=[];e:{var q=nw.get(o);if(q!==void 0){var W=jf,Se=o;switch(o){case"keypress":if(zf(u)===0)break e;case"keydown":case"keyup":W=_R;break;case"focusin":Se="focus",W=Wm;break;case"focusout":Se="blur",W=Wm;break;case"beforeblur":case"afterblur":W=Wm;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":W=DS;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=bR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=NR;break;case XS:case QS:case ew:W=wR;break;case tw:W=LR;break;case"scroll":case"scrollend":W=gR;break;case"wheel":W=IR;break;case"copy":case"cut":case"paste":W=kR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=NS;break;case"toggle":case"beforetoggle":W=UR}var Le=(a&4)!==0,bt=!Le&&(o==="scroll"||o==="scrollend"),U=Le?q!==null?q+"Capture":null:q;Le=[];for(var z=$,P;z!==null;){var Q=z;if(P=Q.stateNode,Q=Q.tag,Q!==5&&Q!==26&&Q!==27||P===null||U===null||(Q=cc(z,U),Q!=null&&Le.push(Pc(z,Q,P))),bt)break;z=z.return}0<Le.length&&(q=new W(q,Se,null,u,X),ee.push({event:q,listeners:Le}))}}if((a&7)===0){e:{if(q=o==="mouseover"||o==="pointerover",W=o==="mouseout"||o==="pointerout",q&&u!==Vm&&(Se=u.relatedTarget||u.fromElement)&&(kl(Se)||Se[vl]))break e;if((W||q)&&(q=X.window===X?X:(q=X.ownerDocument)?q.defaultView||q.parentWindow:window,W?(Se=u.relatedTarget||u.toElement,W=$,Se=Se?kl(Se):null,Se!==null&&(bt=s(Se),Le=Se.tag,Se!==bt||Le!==5&&Le!==27&&Le!==6)&&(Se=null)):(W=null,Se=$),W!==Se)){if(Le=DS,Q="onMouseLeave",U="onMouseEnter",z="mouse",(o==="pointerout"||o==="pointerover")&&(Le=NS,Q="onPointerLeave",U="onPointerEnter",z="pointer"),bt=W==null?q:ac(W),P=Se==null?q:ac(Se),q=new Le(Q,z+"leave",W,u,X),q.target=bt,q.relatedTarget=P,Q=null,kl(X)===$&&(Le=new Le(U,z+"enter",Se,u,X),Le.target=P,Le.relatedTarget=bt,Q=Le),bt=Q,W&&Se)t:{for(Le=BN,U=W,z=Se,P=0,Q=U;Q;Q=Le(Q))P++;Q=0;for(var Me=z;Me;Me=Le(Me))Q++;for(;0<P-Q;)U=Le(U),P--;for(;0<Q-P;)z=Le(z),Q--;for(;P--;){if(U===z||z!==null&&U===z.alternate){Le=U;break t}U=Le(U),z=Le(z)}Le=null}else Le=null;W!==null&&Ck(ee,q,W,Le,!1),Se!==null&&bt!==null&&Ck(ee,bt,Se,Le,!0)}}e:{if(q=$?ac($):window,W=q.nodeName&&q.nodeName.toLowerCase(),W==="select"||W==="input"&&q.type==="file")var lt=VS;else if(US(q))if(PS)lt=GR;else{lt=KR;var ke=YR}else W=q.nodeName,!W||W.toLowerCase()!=="input"||q.type!=="checkbox"&&q.type!=="radio"?$&&Hm($.elementType)&&(lt=VS):lt=WR;if(lt&&(lt=lt(o,$))){HS(ee,lt,u,X);break e}ke&&ke(o,q,$),o==="focusout"&&$&&q.type==="number"&&$.memoizedProps.value!=null&&Um(q,"number",q.value)}switch(ke=$?ac($):window,o){case"focusin":(US(ke)||ke.contentEditable==="true")&&(Rl=ke,eg=$,yc=null);break;case"focusout":yc=eg=Rl=null;break;case"mousedown":tg=!0;break;case"contextmenu":case"mouseup":case"dragend":tg=!1,ZS(ee,u,X);break;case"selectionchange":if(JR)break;case"keydown":case"keyup":ZS(ee,u,X)}var Ye;if(Zm)e:{switch(o){case"compositionstart":var rt="onCompositionStart";break e;case"compositionend":rt="onCompositionEnd";break e;case"compositionupdate":rt="onCompositionUpdate";break e}rt=void 0}else Dl?IS(o,u)&&(rt="onCompositionEnd"):o==="keydown"&&u.keyCode===229&&(rt="onCompositionStart");rt&&(zS&&u.locale!=="ko"&&(Dl||rt!=="onCompositionStart"?rt==="onCompositionEnd"&&Dl&&(Ye=OS()):(ws=X,qm="value"in ws?ws.value:ws.textContent,Dl=!0)),ke=Td($,rt),0<ke.length&&(rt=new RS(rt,o,null,u,X),ee.push({event:rt,listeners:ke}),Ye?rt.data=Ye:(Ye=BS(u),Ye!==null&&(rt.data=Ye)))),(Ye=VR?PR(o,u):$R(o,u))&&(rt=Td($,"onBeforeInput"),0<rt.length&&(ke=new RS("onBeforeInput","beforeinput",null,u,X),ee.push({event:ke,listeners:rt}),ke.data=Ye)),zN(ee,o,$,u,X)}vk(ee,a)})}function Pc(o,a,u){return{instance:o,listener:a,currentTarget:u}}function Td(o,a){for(var u=a+"Capture",h=[];o!==null;){var y=o,x=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||x===null||(y=cc(o,u),y!=null&&h.unshift(Pc(o,y,x)),y=cc(o,a),y!=null&&h.push(Pc(o,y,x))),o.tag===3)return h;o=o.return}return[]}function BN(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function Ck(o,a,u,h,y){for(var x=a._reactName,w=[];u!==null&&u!==h;){var A=u,D=A.alternate,$=A.stateNode;if(A=A.tag,D!==null&&D===h)break;A!==5&&A!==26&&A!==27||$===null||(D=$,y?($=cc(u,x),$!=null&&w.unshift(Pc(u,$,D))):y||($=cc(u,x),$!=null&&w.push(Pc(u,$,D)))),u=u.return}w.length!==0&&o.push({event:a,listeners:w})}var UN=/\r\n?/g,HN=/\u0000|\uFFFD/g;function Ek(o){return(typeof o=="string"?o:""+o).replace(UN,`
|
|
49
|
-
`).replace(HN,"")}function Tk(o,a){return a=Ek(a),Ek(o)===a}function yt(o,a,u,h,y,x){switch(u){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||Ml(o,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&Ml(o,""+h);break;case"className":_f(o,"class",h);break;case"tabIndex":_f(o,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":_f(o,u,h);break;case"style":TS(o,h,x);break;case"data":if(a!=="object"){_f(o,"data",h);break}case"src":case"href":if(h===""&&(a!=="a"||u!=="href")){o.removeAttribute(u);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){o.removeAttribute(u);break}h=Rf(""+h),o.setAttribute(u,h);break;case"action":case"formAction":if(typeof h=="function"){o.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(u==="formAction"?(a!=="input"&&yt(o,a,"name",y.name,y,null),yt(o,a,"formEncType",y.formEncType,y,null),yt(o,a,"formMethod",y.formMethod,y,null),yt(o,a,"formTarget",y.formTarget,y,null)):(yt(o,a,"encType",y.encType,y,null),yt(o,a,"method",y.method,y,null),yt(o,a,"target",y.target,y,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){o.removeAttribute(u);break}h=Rf(""+h),o.setAttribute(u,h);break;case"onClick":h!=null&&(o.onclick=Bi);break;case"onScroll":h!=null&&tt("scroll",o);break;case"onScrollEnd":h!=null&&tt("scrollend",o);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(y.children!=null)throw Error(r(60));o.innerHTML=u}}break;case"multiple":o.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":o.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){o.removeAttribute("xlink:href");break}u=Rf(""+h),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,""+h):o.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,""):o.removeAttribute(u);break;case"capture":case"download":h===!0?o.setAttribute(u,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,h):o.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?o.setAttribute(u,h):o.removeAttribute(u);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?o.removeAttribute(u):o.setAttribute(u,h);break;case"popover":tt("beforetoggle",o),tt("toggle",o),Of(o,"popover",h);break;case"xlinkActuate":Ii(o,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":Ii(o,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":Ii(o,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":Ii(o,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":Ii(o,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":Ii(o,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":Ii(o,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":Ii(o,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":Ii(o,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":Of(o,"is",h);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=pR.get(u)||u,Of(o,u,h))}}function Ty(o,a,u,h,y,x){switch(u){case"style":TS(o,h,x);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(y.children!=null)throw Error(r(60));o.innerHTML=u}}break;case"children":typeof h=="string"?Ml(o,h):(typeof h=="number"||typeof h=="bigint")&&Ml(o,""+h);break;case"onScroll":h!=null&&tt("scroll",o);break;case"onScrollEnd":h!=null&&tt("scrollend",o);break;case"onClick":h!=null&&(o.onclick=Bi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!yS.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(y=u.endsWith("Capture"),a=u.slice(2,y?u.length-7:void 0),x=o[Xn]||null,x=x!=null?x[u]:null,typeof x=="function"&&o.removeEventListener(a,x,y),typeof h=="function")){typeof x!="function"&&x!==null&&(u in o?o[u]=null:o.hasAttribute(u)&&o.removeAttribute(u)),o.addEventListener(a,h,y);break e}u in o?o[u]=h:h===!0?o.setAttribute(u,""):Of(o,u,h)}}}function Mn(o,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":tt("error",o),tt("load",o);var h=!1,y=!1,x;for(x in u)if(u.hasOwnProperty(x)){var w=u[x];if(w!=null)switch(x){case"src":h=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:yt(o,a,x,w,u,null)}}y&&yt(o,a,"srcSet",u.srcSet,u,null),h&&yt(o,a,"src",u.src,u,null);return;case"input":tt("invalid",o);var A=x=w=y=null,D=null,$=null;for(h in u)if(u.hasOwnProperty(h)){var X=u[h];if(X!=null)switch(h){case"name":y=X;break;case"type":w=X;break;case"checked":D=X;break;case"defaultChecked":$=X;break;case"value":x=X;break;case"defaultValue":A=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,a));break;default:yt(o,a,h,X,u,null)}}vS(o,x,A,D,$,w,y,!1);return;case"select":tt("invalid",o),h=w=x=null;for(y in u)if(u.hasOwnProperty(y)&&(A=u[y],A!=null))switch(y){case"value":x=A;break;case"defaultValue":w=A;break;case"multiple":h=A;default:yt(o,a,y,A,u,null)}a=x,u=w,o.multiple=!!h,a!=null?Al(o,!!h,a,!1):u!=null&&Al(o,!!h,u,!0);return;case"textarea":tt("invalid",o),x=y=h=null;for(w in u)if(u.hasOwnProperty(w)&&(A=u[w],A!=null))switch(w){case"value":h=A;break;case"defaultValue":y=A;break;case"children":x=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(r(91));break;default:yt(o,a,w,A,u,null)}CS(o,h,y,x);return;case"option":for(D in u)if(u.hasOwnProperty(D)&&(h=u[D],h!=null))switch(D){case"selected":o.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:yt(o,a,D,h,u,null)}return;case"dialog":tt("beforetoggle",o),tt("toggle",o),tt("cancel",o),tt("close",o);break;case"iframe":case"object":tt("load",o);break;case"video":case"audio":for(h=0;h<Vc.length;h++)tt(Vc[h],o);break;case"image":tt("error",o),tt("load",o);break;case"details":tt("toggle",o);break;case"embed":case"source":case"link":tt("error",o),tt("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for($ in u)if(u.hasOwnProperty($)&&(h=u[$],h!=null))switch($){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:yt(o,a,$,h,u,null)}return;default:if(Hm(a)){for(X in u)u.hasOwnProperty(X)&&(h=u[X],h!==void 0&&Ty(o,a,X,h,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(h=u[A],h!=null&&yt(o,a,A,h,u,null))}function VN(o,a,u,h){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,x=null,w=null,A=null,D=null,$=null,X=null;for(W in u){var ee=u[W];if(u.hasOwnProperty(W)&&ee!=null)switch(W){case"checked":break;case"value":break;case"defaultValue":D=ee;default:h.hasOwnProperty(W)||yt(o,a,W,null,h,ee)}}for(var q in h){var W=h[q];if(ee=u[q],h.hasOwnProperty(q)&&(W!=null||ee!=null))switch(q){case"type":x=W;break;case"name":y=W;break;case"checked":$=W;break;case"defaultChecked":X=W;break;case"value":w=W;break;case"defaultValue":A=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(r(137,a));break;default:W!==ee&&yt(o,a,q,W,h,ee)}}Bm(o,w,A,D,$,X,x,y);return;case"select":W=w=A=q=null;for(x in u)if(D=u[x],u.hasOwnProperty(x)&&D!=null)switch(x){case"value":break;case"multiple":W=D;default:h.hasOwnProperty(x)||yt(o,a,x,null,h,D)}for(y in h)if(x=h[y],D=u[y],h.hasOwnProperty(y)&&(x!=null||D!=null))switch(y){case"value":q=x;break;case"defaultValue":A=x;break;case"multiple":w=x;default:x!==D&&yt(o,a,y,x,h,D)}a=A,u=w,h=W,q!=null?Al(o,!!u,q,!1):!!h!=!!u&&(a!=null?Al(o,!!u,a,!0):Al(o,!!u,u?[]:"",!1));return;case"textarea":W=q=null;for(A in u)if(y=u[A],u.hasOwnProperty(A)&&y!=null&&!h.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:yt(o,a,A,null,h,y)}for(w in h)if(y=h[w],x=u[w],h.hasOwnProperty(w)&&(y!=null||x!=null))switch(w){case"value":q=y;break;case"defaultValue":W=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(r(91));break;default:y!==x&&yt(o,a,w,y,h,x)}kS(o,q,W);return;case"option":for(var Se in u)if(q=u[Se],u.hasOwnProperty(Se)&&q!=null&&!h.hasOwnProperty(Se))switch(Se){case"selected":o.selected=!1;break;default:yt(o,a,Se,null,h,q)}for(D in h)if(q=h[D],W=u[D],h.hasOwnProperty(D)&&q!==W&&(q!=null||W!=null))switch(D){case"selected":o.selected=q&&typeof q!="function"&&typeof q!="symbol";break;default:yt(o,a,D,q,h,W)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Le in u)q=u[Le],u.hasOwnProperty(Le)&&q!=null&&!h.hasOwnProperty(Le)&&yt(o,a,Le,null,h,q);for($ in h)if(q=h[$],W=u[$],h.hasOwnProperty($)&&q!==W&&(q!=null||W!=null))switch($){case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(r(137,a));break;default:yt(o,a,$,q,h,W)}return;default:if(Hm(a)){for(var bt in u)q=u[bt],u.hasOwnProperty(bt)&&q!==void 0&&!h.hasOwnProperty(bt)&&Ty(o,a,bt,void 0,h,q);for(X in h)q=h[X],W=u[X],!h.hasOwnProperty(X)||q===W||q===void 0&&W===void 0||Ty(o,a,X,q,h,W);return}}for(var U in u)q=u[U],u.hasOwnProperty(U)&&q!=null&&!h.hasOwnProperty(U)&&yt(o,a,U,null,h,q);for(ee in h)q=h[ee],W=u[ee],!h.hasOwnProperty(ee)||q===W||q==null&&W==null||yt(o,a,ee,q,h,W)}function Ak(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function PN(){if(typeof performance.getEntriesByType=="function"){for(var o=0,a=0,u=performance.getEntriesByType("resource"),h=0;h<u.length;h++){var y=u[h],x=y.transferSize,w=y.initiatorType,A=y.duration;if(x&&A&&Ak(w)){for(w=0,A=y.responseEnd,h+=1;h<u.length;h++){var D=u[h],$=D.startTime;if($>A)break;var X=D.transferSize,ee=D.initiatorType;X&&Ak(ee)&&(D=D.responseEnd,w+=X*(D<A?1:(A-$)/(D-$)))}if(--h,a+=8*(x+w)/(y.duration/1e3),o++,10<o)break}}if(0<o)return a/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var Ay=null,My=null;function Ad(o){return o.nodeType===9?o:o.ownerDocument}function Mk(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Ok(o,a){if(o===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&a==="foreignObject"?0:o}function Oy(o,a){return o==="textarea"||o==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var _y=null;function $N(){var o=window.event;return o&&o.type==="popstate"?o===_y?!1:(_y=o,!0):(_y=null,!1)}var _k=typeof setTimeout=="function"?setTimeout:void 0,FN=typeof clearTimeout=="function"?clearTimeout:void 0,Dk=typeof Promise=="function"?Promise:void 0,qN=typeof queueMicrotask=="function"?queueMicrotask:typeof Dk<"u"?function(o){return Dk.resolve(null).then(o).catch(YN)}:_k;function YN(o){setTimeout(function(){throw o})}function Bs(o){return o==="head"}function Rk(o,a){var u=a,h=0;do{var y=u.nextSibling;if(o.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(h===0){o.removeChild(y),sa(a);return}h--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")h++;else if(u==="html")$c(o.ownerDocument.documentElement);else if(u==="head"){u=o.ownerDocument.head,$c(u);for(var x=u.firstChild;x;){var w=x.nextSibling,A=x.nodeName;x[lc]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&x.rel.toLowerCase()==="stylesheet"||u.removeChild(x),x=w}}else u==="body"&&$c(o.ownerDocument.body);u=y}while(u);sa(a)}function Nk(o,a){var u=o;o=0;do{var h=u.nextSibling;if(u.nodeType===1?a?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(a?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),h&&h.nodeType===8)if(u=h.data,u==="/$"){if(o===0)break;o--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||o++;u=h}while(u)}function Dy(o){var a=o.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var u=a;switch(a=a.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":Dy(u),jm(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}o.removeChild(u)}}function KN(o,a,u,h){for(;o.nodeType===1;){var y=u;if(o.nodeName.toLowerCase()!==a.toLowerCase()){if(!h&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(h){if(!o[lc])switch(a){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(x=o.getAttribute("rel"),x==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(x!==y.rel||o.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||o.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||o.getAttribute("title")!==(y.title==null?null:y.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(x=o.getAttribute("src"),(x!==(y.src==null?null:y.src)||o.getAttribute("type")!==(y.type==null?null:y.type)||o.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&x&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(a==="input"&&o.type==="hidden"){var x=y.name==null?null:""+y.name;if(y.type==="hidden"&&o.getAttribute("name")===x)return o}else return o;if(o=Br(o.nextSibling),o===null)break}return null}function WN(o,a,u){if(a==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!u||(o=Br(o.nextSibling),o===null))return null;return o}function zk(o,a){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!a||(o=Br(o.nextSibling),o===null))return null;return o}function Ry(o){return o.data==="$?"||o.data==="$~"}function Ny(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function GN(o,a){var u=o.ownerDocument;if(o.data==="$~")o._reactRetry=a;else if(o.data!=="$?"||u.readyState!=="loading")a();else{var h=function(){a(),u.removeEventListener("DOMContentLoaded",h)};u.addEventListener("DOMContentLoaded",h),o._reactRetry=h}}function Br(o){for(;o!=null;o=o.nextSibling){var a=o.nodeType;if(a===1||a===3)break;if(a===8){if(a=o.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return o}var zy=null;function Lk(o){o=o.nextSibling;for(var a=0;o;){if(o.nodeType===8){var u=o.data;if(u==="/$"||u==="/&"){if(a===0)return Br(o.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}o=o.nextSibling}return null}function jk(o){o=o.previousSibling;for(var a=0;o;){if(o.nodeType===8){var u=o.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(a===0)return o;a--}else u!=="/$"&&u!=="/&"||a++}o=o.previousSibling}return null}function Ik(o,a,u){switch(a=Ad(u),o){case"html":if(o=a.documentElement,!o)throw Error(r(452));return o;case"head":if(o=a.head,!o)throw Error(r(453));return o;case"body":if(o=a.body,!o)throw Error(r(454));return o;default:throw Error(r(451))}}function $c(o){for(var a=o.attributes;a.length;)o.removeAttributeNode(a[0]);jm(o)}var Ur=new Map,Bk=new Set;function Md(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var es=G.d;G.d={f:ZN,r:JN,D:XN,C:QN,L:ez,m:tz,X:rz,S:nz,M:iz};function ZN(){var o=es.f(),a=xd();return o||a}function JN(o){var a=Cl(o);a!==null&&a.tag===5&&a.type==="form"?tv(a):es.r(o)}var na=typeof document>"u"?null:document;function Uk(o,a,u){var h=na;if(h&&typeof a=="string"&&a){var y=Dr(a);y='link[rel="'+o+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),Bk.has(y)||(Bk.add(y),o={rel:o,crossOrigin:u,href:a},h.querySelector(y)===null&&(a=h.createElement("link"),Mn(a,"link",o),cn(a),h.head.appendChild(a)))}}function XN(o){es.D(o),Uk("dns-prefetch",o,null)}function QN(o,a){es.C(o,a),Uk("preconnect",o,a)}function ez(o,a,u){es.L(o,a,u);var h=na;if(h&&o&&a){var y='link[rel="preload"][as="'+Dr(a)+'"]';a==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+Dr(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+Dr(u.imageSizes)+'"]')):y+='[href="'+Dr(o)+'"]';var x=y;switch(a){case"style":x=ra(o);break;case"script":x=ia(o)}Ur.has(x)||(o=m({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:o,as:a},u),Ur.set(x,o),h.querySelector(y)!==null||a==="style"&&h.querySelector(Fc(x))||a==="script"&&h.querySelector(qc(x))||(a=h.createElement("link"),Mn(a,"link",o),cn(a),h.head.appendChild(a)))}}function tz(o,a){es.m(o,a);var u=na;if(u&&o){var h=a&&typeof a.as=="string"?a.as:"script",y='link[rel="modulepreload"][as="'+Dr(h)+'"][href="'+Dr(o)+'"]',x=y;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=ia(o)}if(!Ur.has(x)&&(o=m({rel:"modulepreload",href:o},a),Ur.set(x,o),u.querySelector(y)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(qc(x)))return}h=u.createElement("link"),Mn(h,"link",o),cn(h),u.head.appendChild(h)}}}function nz(o,a,u){es.S(o,a,u);var h=na;if(h&&o){var y=El(h).hoistableStyles,x=ra(o);a=a||"default";var w=y.get(x);if(!w){var A={loading:0,preload:null};if(w=h.querySelector(Fc(x)))A.loading=5;else{o=m({rel:"stylesheet",href:o,"data-precedence":a},u),(u=Ur.get(x))&&Ly(o,u);var D=w=h.createElement("link");cn(D),Mn(D,"link",o),D._p=new Promise(function($,X){D.onload=$,D.onerror=X}),D.addEventListener("load",function(){A.loading|=1}),D.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Od(w,a,h)}w={type:"stylesheet",instance:w,count:1,state:A},y.set(x,w)}}}function rz(o,a){es.X(o,a);var u=na;if(u&&o){var h=El(u).hoistableScripts,y=ia(o),x=h.get(y);x||(x=u.querySelector(qc(y)),x||(o=m({src:o,async:!0},a),(a=Ur.get(y))&&jy(o,a),x=u.createElement("script"),cn(x),Mn(x,"link",o),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(y,x))}}function iz(o,a){es.M(o,a);var u=na;if(u&&o){var h=El(u).hoistableScripts,y=ia(o),x=h.get(y);x||(x=u.querySelector(qc(y)),x||(o=m({src:o,async:!0,type:"module"},a),(a=Ur.get(y))&&jy(o,a),x=u.createElement("script"),cn(x),Mn(x,"link",o),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(y,x))}}function Hk(o,a,u,h){var y=(y=oe.current)?Md(y):null;if(!y)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(a=ra(u.href),u=El(y).hoistableStyles,h=u.get(a),h||(h={type:"style",instance:null,count:0,state:null},u.set(a,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){o=ra(u.href);var x=El(y).hoistableStyles,w=x.get(o);if(w||(y=y.ownerDocument||y,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(o,w),(x=y.querySelector(Fc(o)))&&!x._p&&(w.instance=x,w.state.loading=5),Ur.has(o)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Ur.set(o,u),x||sz(y,o,u,w.state))),a&&h===null)throw Error(r(528,""));return w}if(a&&h!==null)throw Error(r(529,""));return null;case"script":return a=u.async,u=u.src,typeof u=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=ia(u),u=El(y).hoistableScripts,h=u.get(a),h||(h={type:"script",instance:null,count:0,state:null},u.set(a,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function ra(o){return'href="'+Dr(o)+'"'}function Fc(o){return'link[rel="stylesheet"]['+o+"]"}function Vk(o){return m({},o,{"data-precedence":o.precedence,precedence:null})}function sz(o,a,u,h){o.querySelector('link[rel="preload"][as="style"]['+a+"]")?h.loading=1:(a=o.createElement("link"),h.preload=a,a.addEventListener("load",function(){return h.loading|=1}),a.addEventListener("error",function(){return h.loading|=2}),Mn(a,"link",u),cn(a),o.head.appendChild(a))}function ia(o){return'[src="'+Dr(o)+'"]'}function qc(o){return"script[async]"+o}function Pk(o,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var h=o.querySelector('style[data-href~="'+Dr(u.href)+'"]');if(h)return a.instance=h,cn(h),h;var y=m({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return h=(o.ownerDocument||o).createElement("style"),cn(h),Mn(h,"style",y),Od(h,u.precedence,o),a.instance=h;case"stylesheet":y=ra(u.href);var x=o.querySelector(Fc(y));if(x)return a.state.loading|=4,a.instance=x,cn(x),x;h=Vk(u),(y=Ur.get(y))&&Ly(h,y),x=(o.ownerDocument||o).createElement("link"),cn(x);var w=x;return w._p=new Promise(function(A,D){w.onload=A,w.onerror=D}),Mn(x,"link",h),a.state.loading|=4,Od(x,u.precedence,o),a.instance=x;case"script":return x=ia(u.src),(y=o.querySelector(qc(x)))?(a.instance=y,cn(y),y):(h=u,(y=Ur.get(x))&&(h=m({},u),jy(h,y)),o=o.ownerDocument||o,y=o.createElement("script"),cn(y),Mn(y,"link",h),o.head.appendChild(y),a.instance=y);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(h=a.instance,a.state.loading|=4,Od(h,u.precedence,o));return a.instance}function Od(o,a,u){for(var h=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=h.length?h[h.length-1]:null,x=y,w=0;w<h.length;w++){var A=h[w];if(A.dataset.precedence===a)x=A;else if(x!==y)break}x?x.parentNode.insertBefore(o,x.nextSibling):(a=u.nodeType===9?u.head:u,a.insertBefore(o,a.firstChild))}function Ly(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.title==null&&(o.title=a.title)}function jy(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.integrity==null&&(o.integrity=a.integrity)}var _d=null;function $k(o,a,u){if(_d===null){var h=new Map,y=_d=new Map;y.set(u,h)}else y=_d,h=y.get(u),h||(h=new Map,y.set(u,h));if(h.has(o))return h;for(h.set(o,null),u=u.getElementsByTagName(o),y=0;y<u.length;y++){var x=u[y];if(!(x[lc]||x[Cn]||o==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(a)||"";w=o+w;var A=h.get(w);A?A.push(x):h.set(w,[x])}}return h}function Fk(o,a,u){o=o.ownerDocument||o,o.head.insertBefore(u,a==="title"?o.querySelector("head > title"):null)}function oz(o,a,u){if(u===1||a.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return o=a.disabled,typeof a.precedence=="string"&&o==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function qk(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function lz(o,a,u,h){if(u.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var y=ra(h.href),x=a.querySelector(Fc(y));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(o.count++,o=Dd.bind(o),a.then(o,o)),u.state.loading|=4,u.instance=x,cn(x);return}x=a.ownerDocument||a,h=Vk(h),(y=Ur.get(y))&&Ly(h,y),x=x.createElement("link"),cn(x);var w=x;w._p=new Promise(function(A,D){w.onload=A,w.onerror=D}),Mn(x,"link",h),u.instance=x}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(u,a),(a=u.state.preload)&&(u.state.loading&3)===0&&(o.count++,u=Dd.bind(o),a.addEventListener("load",u),a.addEventListener("error",u))}}var Iy=0;function az(o,a){return o.stylesheets&&o.count===0&&Nd(o,o.stylesheets),0<o.count||0<o.imgCount?function(u){var h=setTimeout(function(){if(o.stylesheets&&Nd(o,o.stylesheets),o.unsuspend){var x=o.unsuspend;o.unsuspend=null,x()}},6e4+a);0<o.imgBytes&&Iy===0&&(Iy=62500*PN());var y=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Nd(o,o.stylesheets),o.unsuspend)){var x=o.unsuspend;o.unsuspend=null,x()}},(o.imgBytes>Iy?50:800)+a);return o.unsuspend=u,function(){o.unsuspend=null,clearTimeout(h),clearTimeout(y)}}:null}function Dd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Nd(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Rd=null;function Nd(o,a){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Rd=new Map,a.forEach(cz,o),Rd=null,Dd.call(o))}function cz(o,a){if(!(a.state.loading&4)){var u=Rd.get(o);if(u)var h=u.get(null);else{u=new Map,Rd.set(o,u);for(var y=o.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<y.length;x++){var w=y[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(u.set(w.dataset.precedence,w),h=w)}h&&u.set(null,h)}y=a.instance,w=y.getAttribute("data-precedence"),x=u.get(w)||h,x===h&&u.set(null,y),u.set(w,y),this.count++,h=Dd.bind(this),y.addEventListener("load",h),y.addEventListener("error",h),x?x.parentNode.insertBefore(y,x.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(y,o.firstChild)),a.state.loading|=4}}var Yc={$$typeof:I,Provider:null,Consumer:null,_currentValue:me,_currentValue2:me,_threadCount:0};function uz(o,a,u,h,y,x,w,A,D){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ko(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ko(0),this.hiddenUpdates=ko(null),this.identifierPrefix=h,this.onUncaughtError=y,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=D,this.incompleteTransitions=new Map}function Yk(o,a,u,h,y,x,w,A,D,$,X,ee){return o=new uz(o,a,u,w,D,$,X,ee,A),a=1,x===!0&&(a|=24),x=gr(3,null,null,a),o.current=x,x.stateNode=o,a=gg(),a.refCount++,o.pooledCache=a,a.refCount++,x.memoizedState={element:h,isDehydrated:u,cache:a},Sg(x),o}function Kk(o){return o?(o=Ll,o):Ll}function Wk(o,a,u,h,y,x){y=Kk(y),h.context===null?h.context=y:h.pendingContext=y,h=As(a),h.payload={element:u},x=x===void 0?null:x,x!==null&&(h.callback=x),u=Ms(o,h,a),u!==null&&(ir(u,o,a),Cc(u,o,a))}function Gk(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var u=o.retryLane;o.retryLane=u!==0&&u<a?u:a}}function By(o,a){Gk(o,a),(o=o.alternate)&&Gk(o,a)}function Zk(o){if(o.tag===13||o.tag===31){var a=Mo(o,67108864);a!==null&&ir(a,o,67108864),By(o,67108864)}}function Jk(o){if(o.tag===13||o.tag===31){var a=wr();a=Nm(a);var u=Mo(o,a);u!==null&&ir(u,o,a),By(o,a)}}var zd=!0;function fz(o,a,u,h){var y=L.T;L.T=null;var x=G.p;try{G.p=2,Uy(o,a,u,h)}finally{G.p=x,L.T=y}}function dz(o,a,u,h){var y=L.T;L.T=null;var x=G.p;try{G.p=8,Uy(o,a,u,h)}finally{G.p=x,L.T=y}}function Uy(o,a,u,h){if(zd){var y=Hy(h);if(y===null)Ey(o,a,h,Ld,u),Qk(o,h);else if(pz(y,o,a,u,h))h.stopPropagation();else if(Qk(o,h),a&4&&-1<hz.indexOf(o)){for(;y!==null;){var x=Cl(y);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=kn(x.pendingLanes);if(w!==0){var A=x;for(A.pendingLanes|=2,A.entangledLanes|=2;w;){var D=1<<31-Ze(w);A.entanglements[1]|=D,w&=~D}gi(x),(ft&6)===0&&(yd=qt()+500,Hc(0))}}break;case 31:case 13:A=Mo(x,2),A!==null&&ir(A,x,2),xd(),By(x,2)}if(x=Hy(h),x===null&&Ey(o,a,h,Ld,u),x===y)break;y=x}y!==null&&h.stopPropagation()}else Ey(o,a,h,null,u)}}function Hy(o){return o=Pm(o),Vy(o)}var Ld=null;function Vy(o){if(Ld=null,o=kl(o),o!==null){var a=s(o);if(a===null)o=null;else{var u=a.tag;if(u===13){if(o=l(a),o!==null)return o;o=null}else if(u===31){if(o=c(a),o!==null)return o;o=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;o=null}else a!==o&&(o=null)}}return Ld=o,null}function Xk(o){switch(o){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(pr()){case J:return 2;case de:return 8;case Ae:case K:return 32;case pe:return 268435456;default:return 32}default:return 32}}var Py=!1,Us=null,Hs=null,Vs=null,Kc=new Map,Wc=new Map,Ps=[],hz="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".split(" ");function Qk(o,a){switch(o){case"focusin":case"focusout":Us=null;break;case"dragenter":case"dragleave":Hs=null;break;case"mouseover":case"mouseout":Vs=null;break;case"pointerover":case"pointerout":Kc.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Wc.delete(a.pointerId)}}function Gc(o,a,u,h,y,x){return o===null||o.nativeEvent!==x?(o={blockedOn:a,domEventName:u,eventSystemFlags:h,nativeEvent:x,targetContainers:[y]},a!==null&&(a=Cl(a),a!==null&&Zk(a)),o):(o.eventSystemFlags|=h,a=o.targetContainers,y!==null&&a.indexOf(y)===-1&&a.push(y),o)}function pz(o,a,u,h,y){switch(a){case"focusin":return Us=Gc(Us,o,a,u,h,y),!0;case"dragenter":return Hs=Gc(Hs,o,a,u,h,y),!0;case"mouseover":return Vs=Gc(Vs,o,a,u,h,y),!0;case"pointerover":var x=y.pointerId;return Kc.set(x,Gc(Kc.get(x)||null,o,a,u,h,y)),!0;case"gotpointercapture":return x=y.pointerId,Wc.set(x,Gc(Wc.get(x)||null,o,a,u,h,y)),!0}return!1}function eC(o){var a=kl(o.target);if(a!==null){var u=s(a);if(u!==null){if(a=u.tag,a===13){if(a=l(u),a!==null){o.blockedOn=a,pS(o.priority,function(){Jk(u)});return}}else if(a===31){if(a=c(u),a!==null){o.blockedOn=a,pS(o.priority,function(){Jk(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){o.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}o.blockedOn=null}function jd(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var u=Hy(o.nativeEvent);if(u===null){u=o.nativeEvent;var h=new u.constructor(u.type,u);Vm=h,u.target.dispatchEvent(h),Vm=null}else return a=Cl(u),a!==null&&Zk(a),o.blockedOn=u,!1;a.shift()}return!0}function tC(o,a,u){jd(o)&&u.delete(a)}function mz(){Py=!1,Us!==null&&jd(Us)&&(Us=null),Hs!==null&&jd(Hs)&&(Hs=null),Vs!==null&&jd(Vs)&&(Vs=null),Kc.forEach(tC),Wc.forEach(tC)}function Id(o,a){o.blockedOn===a&&(o.blockedOn=null,Py||(Py=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,mz)))}var Bd=null;function nC(o){Bd!==o&&(Bd=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bd===o&&(Bd=null);for(var a=0;a<o.length;a+=3){var u=o[a],h=o[a+1],y=o[a+2];if(typeof h!="function"){if(Vy(h||u)===null)continue;break}var x=Cl(u);x!==null&&(o.splice(a,3),a-=3,Hg(x,{pending:!0,data:y,method:u.method,action:h},h,y))}}))}function sa(o){function a(D){return Id(D,o)}Us!==null&&Id(Us,o),Hs!==null&&Id(Hs,o),Vs!==null&&Id(Vs,o),Kc.forEach(a),Wc.forEach(a);for(var u=0;u<Ps.length;u++){var h=Ps[u];h.blockedOn===o&&(h.blockedOn=null)}for(;0<Ps.length&&(u=Ps[0],u.blockedOn===null);)eC(u),u.blockedOn===null&&Ps.shift();if(u=(o.ownerDocument||o).$$reactFormReplay,u!=null)for(h=0;h<u.length;h+=3){var y=u[h],x=u[h+1],w=y[Xn]||null;if(typeof x=="function")w||nC(u);else if(w){var A=null;if(x&&x.hasAttribute("formAction")){if(y=x,w=x[Xn]||null)A=w.formAction;else if(Vy(y)!==null)continue}else A=w.action;typeof A=="function"?u[h+1]=A:(u.splice(h,3),h-=3),nC(u)}}}function rC(){function o(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return y=w})},focusReset:"manual",scroll:"manual"})}function a(){y!==null&&(y(),y=null),h||setTimeout(u,20)}function u(){if(!h&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,y=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(u,100),function(){h=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),y!==null&&(y(),y=null)}}}function $y(o){this._internalRoot=o}Ud.prototype.render=$y.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(r(409));var u=a.current,h=wr();Wk(u,h,o,a,null,null)},Ud.prototype.unmount=$y.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;Wk(o.current,2,null,o,null,null),xd(),a[vl]=null}};function Ud(o){this._internalRoot=o}Ud.prototype.unstable_scheduleHydration=function(o){if(o){var a=hS();o={blockedOn:null,target:o,priority:a};for(var u=0;u<Ps.length&&a!==0&&a<Ps[u].priority;u++);Ps.splice(u,0,o),u===0&&eC(o)}};var iC=e.version;if(iC!=="19.2.4")throw Error(r(527,iC,"19.2.4"));G.findDOMNode=function(o){var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=d(a),o=o!==null?p(o):null,o=o===null?null:o.stateNode,o};var gz={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hd.isDisabled&&Hd.supportsFiber)try{Re=Hd.inject(gz),Ie=Hd}catch{}}return Jc.createRoot=function(o,a){if(!i(o))throw Error(r(299));var u=!1,h="",y=fv,x=dv,w=hv;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError)),a=Yk(o,1,!1,null,null,u,h,null,y,x,w,rC),o[vl]=a.current,Cy(o),new $y(a)},Jc.hydrateRoot=function(o,a,u){if(!i(o))throw Error(r(299));var h=!1,y="",x=fv,w=dv,A=hv,D=null;return u!=null&&(u.unstable_strictMode===!0&&(h=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(x=u.onUncaughtError),u.onCaughtError!==void 0&&(w=u.onCaughtError),u.onRecoverableError!==void 0&&(A=u.onRecoverableError),u.formState!==void 0&&(D=u.formState)),a=Yk(o,1,!0,a,u??null,h,y,D,x,w,A,rC),a.context=Kk(null),u=a.current,h=wr(),h=Nm(h),y=As(h),y.callback=null,Ms(u,y,h),u=h,a.current.lanes=u,ji(a,u),gi(a),o[vl]=a.current,Cy(o),new Ud(a)},Jc.version="19.2.4",Jc}var pC;function Az(){if(pC)return Yy.exports;pC=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Yy.exports=Tz(),Yy.exports}var Mz=Az();const mC=3478,Ga=3479,Oz=3e3,_z=3e3,Dz=3e4,Nu={yellow:"rgba(255, 235, 59, 0.3)",red:"rgba(244, 67, 54, 0.3)",green:"rgba(76, 175, 80, 0.3)",blue:"rgba(33, 150, 243, 0.3)",purple:"rgba(156, 39, 176, 0.3)"},gC="tandem",Pd="tandem:mode",lM="tandem:settings",Rz="tandem-panel-width",Nz="tandem-left-panel-width",aM={left:Nz,right:Rz},cM=1e3,zh=500,Lh=3e3,Ox="#6366f1",zz="__tandem_ctrl__",xa="annotations",uM="awareness",ob="userAwareness",Lz="mode",jz="selectionDwellMs",yC="chat",gh="documentMeta",Iz="annotationReplies",bC="savedAtVersion",xC="authorship",fM="tandem:showAuthorship",_x="tandem:recentFiles",Bz=20,Dx="tandem:userName",dM="You",lb="tandem:user-name-changed",hM=40,SC={error:8e3,warning:6e3,info:4e3},Uz=5,pM="tandem:tutorialCompleted",Hz="tutorial-",wC="tandem:zoomLevel",vC=.5,kC=2,Xc=1,yh=t=>t,Wr=t=>t;var ut;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const s={};for(const l of i)s[l]=l;return s},t.getValidEnumValues=i=>{const s=t.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),l={};for(const c of s)l[c]=i[c];return t.objectValues(l)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const l in i)Object.prototype.hasOwnProperty.call(i,l)&&s.push(l);return s},t.find=(i,s)=>{for(const l of i)if(s(l))return l},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(l=>typeof l=="string"?`'${l}'`:l).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(ut||(ut={}));var CC;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(CC||(CC={}));const ve=ut.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ks=t=>{switch(typeof t){case"undefined":return ve.undefined;case"string":return ve.string;case"number":return Number.isNaN(t)?ve.nan:ve.number;case"boolean":return ve.boolean;case"function":return ve.function;case"bigint":return ve.bigint;case"symbol":return ve.symbol;case"object":return Array.isArray(t)?ve.array:t===null?ve.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ve.promise:typeof Map<"u"&&t instanceof Map?ve.map:typeof Set<"u"&&t instanceof Set?ve.set:typeof Date<"u"&&t instanceof Date?ve.date:ve.object;default:return ve.unknown}},he=ut.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ps extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(s){return s.message},r={_errors:[]},i=s=>{for(const l of s.issues)if(l.code==="invalid_union")l.unionErrors.map(i);else if(l.code==="invalid_return_type")i(l.returnTypeError);else if(l.code==="invalid_arguments")i(l.argumentsError);else if(l.path.length===0)r._errors.push(n(l));else{let c=r,f=0;for(;f<l.path.length;){const d=l.path[f];f===l.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(n(l))):c[d]=c[d]||{_errors:[]},c=c[d],f++}}};return i(this),r}static assert(e){if(!(e instanceof ps))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ut.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ps.create=t=>new ps(t);const ab=(t,e)=>{let n;switch(t.code){case he.invalid_type:t.received===ve.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case he.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,ut.jsonStringifyReplacer)}`;break;case he.unrecognized_keys:n=`Unrecognized key(s) in object: ${ut.joinValues(t.keys,", ")}`;break;case he.invalid_union:n="Invalid input";break;case he.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ut.joinValues(t.options)}`;break;case he.invalid_enum_value:n=`Invalid enum value. Expected ${ut.joinValues(t.options)}, received '${t.received}'`;break;case he.invalid_arguments:n="Invalid function arguments";break;case he.invalid_return_type:n="Invalid function return type";break;case he.invalid_date:n="Invalid date";break;case he.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:ut.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case he.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case he.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case he.custom:n="Invalid input";break;case he.invalid_intersection_types:n="Intersection results could not be merged";break;case he.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case he.not_finite:n="Number must be finite";break;default:n=e.defaultError,ut.assertNever(t)}return{message:n}};let Vz=ab;function Pz(){return Vz}const $z=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,s=[...n,...i.path||[]],l={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let c="";const f=r.filter(d=>!!d).slice().reverse();for(const d of f)c=d(l,{data:e,defaultError:c}).message;return{...i,path:s,message:c}};function xe(t,e){const n=Pz(),r=$z({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ab?void 0:ab].filter(i=>!!i)});t.common.issues.push(r)}class Mr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const i of n){if(i.status==="aborted")return Ve;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const s=await i.key,l=await i.value;r.push({key:s,value:l})}return Mr.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:s,value:l}=i;if(s.status==="aborted"||l.status==="aborted")return Ve;s.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof l.value<"u"||i.alwaysSet)&&(r[s.value]=l.value)}return{status:e.value,value:r}}}const Ve=Object.freeze({status:"aborted"}),lu=t=>({status:"dirty",value:t}),Qr=t=>({status:"valid",value:t}),EC=t=>t.status==="aborted",TC=t=>t.status==="dirty",Ra=t=>t.status==="valid",jh=t=>typeof Promise<"u"&&t instanceof Promise;var Ce;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ce||(Ce={}));class uo{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const AC=(t,e)=>{if(Ra(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ps(t.common.issues);return this._error=n,this._error}}};function Qe(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(l,c)=>{const{message:f}=t;return l.code==="invalid_enum_value"?{message:f??c.defaultError}:typeof c.data>"u"?{message:f??r??c.defaultError}:l.code!=="invalid_type"?{message:c.defaultError}:{message:f??n??c.defaultError}},description:i}}class ot{get description(){return this._def.description}_getType(e){return Ks(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Ks(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Mr,ctx:{common:e.parent.common,data:e.data,parsedType:Ks(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(jh(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ks(e)},i=this._parseSync({data:e,path:r.path,parent:r});return AC(r,i)}"~validate"(e){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ks(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:n});return Ra(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(i=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(s=>Ra(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ks(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(jh(i)?i:Promise.resolve(i));return AC(r,s)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const l=e(i),c=()=>s.addIssue({code:he.custom,...r(i)});return typeof Promise<"u"&&l instanceof Promise?l.then(f=>f?!0:(c(),!1)):l?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new za({schema:this,typeName:Pe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return so.create(this,this._def)}nullable(){return La.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ci.create(this)}promise(){return Hh.create(this,this._def)}or(e){return Bh.create([this,e],this._def)}and(e){return Uh.create(this,e,this._def)}transform(e){return new za({...Qe(this._def),schema:this,typeName:Pe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new ub({...Qe(this._def),innerType:this,defaultValue:n,typeName:Pe.ZodDefault})}brand(){return new d3({typeName:Pe.ZodBranded,type:this,...Qe(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new fb({...Qe(this._def),innerType:this,catchValue:n,typeName:Pe.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Rx.create(this,e)}readonly(){return db.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Fz=/^c[^\s-]{8,}$/i,qz=/^[0-9a-z]+$/,Yz=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Kz=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Wz=/^[a-z0-9_-]{21}$/i,Gz=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Zz=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Jz=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Xz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Zy;const Qz=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,e3=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,t3=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,n3=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,r3=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,i3=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mM="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",s3=new RegExp(`^${mM}$`);function gM(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function o3(t){return new RegExp(`^${gM(t)}$`)}function l3(t){let e=`${mM}T${gM(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function a3(t,e){return!!((e==="v4"||!e)&&Qz.test(t)||(e==="v6"||!e)&&t3.test(t))}function c3(t,e){if(!Gz.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function u3(t,e){return!!((e==="v4"||!e)&&e3.test(t)||(e==="v6"||!e)&&n3.test(t))}class qo extends ot{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ve.string){const s=this._getOrReturnCtx(e);return xe(s,{code:he.invalid_type,expected:ve.string,received:s.parsedType}),Ve}const r=new Mr;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),xe(i,{code:he.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),xe(i,{code:he.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const l=e.data.length>s.value,c=e.data.length<s.value;(l||c)&&(i=this._getOrReturnCtx(e,i),l?xe(i,{code:he.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&xe(i,{code:he.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Jz.test(e.data)||(i=this._getOrReturnCtx(e,i),xe(i,{validation:"email",code:he.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Zy||(Zy=new RegExp(Xz,"u")),Zy.test(e.data)||(i=this._getOrReturnCtx(e,i),xe(i,{validation:"emoji",code:he.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")Kz.test(e.data)||(i=this._getOrReturnCtx(e,i),xe(i,{validation:"uuid",code:he.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")Wz.test(e.data)||(i=this._getOrReturnCtx(e,i),xe(i,{validation:"nanoid",code:he.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")Fz.test(e.data)||(i=this._getOrReturnCtx(e,i),xe(i,{validation:"cuid",code:he.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")qz.test(e.data)||(i=this._getOrReturnCtx(e,i),xe(i,{validation:"cuid2",code:he.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")Yz.test(e.data)||(i=this._getOrReturnCtx(e,i),xe(i,{validation:"ulid",code:he.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),xe(i,{validation:"url",code:he.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),xe(i,{validation:"regex",code:he.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),xe(i,{code:he.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),xe(i,{code:he.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),xe(i,{code:he.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?l3(s).test(e.data)||(i=this._getOrReturnCtx(e,i),xe(i,{code:he.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?s3.test(e.data)||(i=this._getOrReturnCtx(e,i),xe(i,{code:he.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?o3(s).test(e.data)||(i=this._getOrReturnCtx(e,i),xe(i,{code:he.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?Zz.test(e.data)||(i=this._getOrReturnCtx(e,i),xe(i,{validation:"duration",code:he.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?a3(e.data,s.version)||(i=this._getOrReturnCtx(e,i),xe(i,{validation:"ip",code:he.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?c3(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),xe(i,{validation:"jwt",code:he.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?u3(e.data,s.version)||(i=this._getOrReturnCtx(e,i),xe(i,{validation:"cidr",code:he.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?r3.test(e.data)||(i=this._getOrReturnCtx(e,i),xe(i,{validation:"base64",code:he.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?i3.test(e.data)||(i=this._getOrReturnCtx(e,i),xe(i,{validation:"base64url",code:he.invalid_string,message:s.message}),r.dirty()):ut.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:he.invalid_string,...Ce.errToObj(r)})}_addCheck(e){return new qo({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ce.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ce.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ce.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ce.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ce.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ce.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ce.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ce.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ce.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ce.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ce.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ce.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ce.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...Ce.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Ce.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ce.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Ce.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Ce.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Ce.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Ce.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Ce.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Ce.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Ce.errToObj(n)})}nonempty(e){return this.min(1,Ce.errToObj(e))}trim(){return new qo({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new qo({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new qo({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}qo.create=t=>new qo({checks:[],typeName:Pe.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Qe(t)});function f3(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(t.toFixed(i).replace(".","")),l=Number.parseInt(e.toFixed(i).replace(".",""));return s%l/10**i}class zu extends ot{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ve.number){const s=this._getOrReturnCtx(e);return xe(s,{code:he.invalid_type,expected:ve.number,received:s.parsedType}),Ve}let r;const i=new Mr;for(const s of this._def.checks)s.kind==="int"?ut.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),xe(r,{code:he.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),xe(r,{code:he.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),xe(r,{code:he.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?f3(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),xe(r,{code:he.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),xe(r,{code:he.not_finite,message:s.message}),i.dirty()):ut.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Ce.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ce.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ce.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ce.toString(n))}setLimit(e,n,r,i){return new zu({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ce.toString(i)}]})}_addCheck(e){return new zu({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ce.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ce.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ce.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ce.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ce.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ce.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Ce.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ce.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ce.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ut.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}zu.create=t=>new zu({checks:[],typeName:Pe.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Qe(t)});class Lu extends ot{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ve.bigint)return this._getInvalidInput(e);let r;const i=new Mr;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),xe(r,{code:he.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),xe(r,{code:he.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),xe(r,{code:he.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):ut.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return xe(n,{code:he.invalid_type,expected:ve.bigint,received:n.parsedType}),Ve}gte(e,n){return this.setLimit("min",e,!0,Ce.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ce.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ce.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ce.toString(n))}setLimit(e,n,r,i){return new Lu({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ce.toString(i)}]})}_addCheck(e){return new Lu({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ce.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ce.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ce.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ce.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ce.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Lu.create=t=>new Lu({checks:[],typeName:Pe.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Qe(t)});class MC extends ot{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ve.boolean){const r=this._getOrReturnCtx(e);return xe(r,{code:he.invalid_type,expected:ve.boolean,received:r.parsedType}),Ve}return Qr(e.data)}}MC.create=t=>new MC({typeName:Pe.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Qe(t)});class Ih extends ot{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ve.date){const s=this._getOrReturnCtx(e);return xe(s,{code:he.invalid_type,expected:ve.date,received:s.parsedType}),Ve}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return xe(s,{code:he.invalid_date}),Ve}const r=new Mr;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),xe(i,{code:he.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),xe(i,{code:he.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):ut.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ih({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Ce.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Ce.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Ih.create=t=>new Ih({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Pe.ZodDate,...Qe(t)});class OC extends ot{_parse(e){if(this._getType(e)!==ve.symbol){const r=this._getOrReturnCtx(e);return xe(r,{code:he.invalid_type,expected:ve.symbol,received:r.parsedType}),Ve}return Qr(e.data)}}OC.create=t=>new OC({typeName:Pe.ZodSymbol,...Qe(t)});class _C extends ot{_parse(e){if(this._getType(e)!==ve.undefined){const r=this._getOrReturnCtx(e);return xe(r,{code:he.invalid_type,expected:ve.undefined,received:r.parsedType}),Ve}return Qr(e.data)}}_C.create=t=>new _C({typeName:Pe.ZodUndefined,...Qe(t)});class DC extends ot{_parse(e){if(this._getType(e)!==ve.null){const r=this._getOrReturnCtx(e);return xe(r,{code:he.invalid_type,expected:ve.null,received:r.parsedType}),Ve}return Qr(e.data)}}DC.create=t=>new DC({typeName:Pe.ZodNull,...Qe(t)});class RC extends ot{constructor(){super(...arguments),this._any=!0}_parse(e){return Qr(e.data)}}RC.create=t=>new RC({typeName:Pe.ZodAny,...Qe(t)});class NC extends ot{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Qr(e.data)}}NC.create=t=>new NC({typeName:Pe.ZodUnknown,...Qe(t)});class fo extends ot{_parse(e){const n=this._getOrReturnCtx(e);return xe(n,{code:he.invalid_type,expected:ve.never,received:n.parsedType}),Ve}}fo.create=t=>new fo({typeName:Pe.ZodNever,...Qe(t)});class zC extends ot{_parse(e){if(this._getType(e)!==ve.undefined){const r=this._getOrReturnCtx(e);return xe(r,{code:he.invalid_type,expected:ve.void,received:r.parsedType}),Ve}return Qr(e.data)}}zC.create=t=>new zC({typeName:Pe.ZodVoid,...Qe(t)});class Ci extends ot{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==ve.array)return xe(n,{code:he.invalid_type,expected:ve.array,received:n.parsedType}),Ve;if(i.exactLength!==null){const l=n.data.length>i.exactLength.value,c=n.data.length<i.exactLength.value;(l||c)&&(xe(n,{code:l?he.too_big:he.too_small,minimum:c?i.exactLength.value:void 0,maximum:l?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(xe(n,{code:he.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(xe(n,{code:he.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((l,c)=>i.type._parseAsync(new uo(n,l,n.path,c)))).then(l=>Mr.mergeArray(r,l));const s=[...n.data].map((l,c)=>i.type._parseSync(new uo(n,l,n.path,c)));return Mr.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new Ci({...this._def,minLength:{value:e,message:Ce.toString(n)}})}max(e,n){return new Ci({...this._def,maxLength:{value:e,message:Ce.toString(n)}})}length(e,n){return new Ci({...this._def,exactLength:{value:e,message:Ce.toString(n)}})}nonempty(e){return this.min(1,e)}}Ci.create=(t,e)=>new Ci({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Pe.ZodArray,...Qe(e)});function fa(t){if(t instanceof an){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=so.create(fa(r))}return new an({...t._def,shape:()=>e})}else return t instanceof Ci?new Ci({...t._def,type:fa(t.element)}):t instanceof so?so.create(fa(t.unwrap())):t instanceof La?La.create(fa(t.unwrap())):t instanceof il?il.create(t.items.map(e=>fa(e))):t}class an extends ot{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=ut.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==ve.object){const d=this._getOrReturnCtx(e);return xe(d,{code:he.invalid_type,expected:ve.object,received:d.parsedType}),Ve}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:l}=this._getCached(),c=[];if(!(this._def.catchall instanceof fo&&this._def.unknownKeys==="strip"))for(const d in i.data)l.includes(d)||c.push(d);const f=[];for(const d of l){const p=s[d],m=i.data[d];f.push({key:{status:"valid",value:d},value:p._parse(new uo(i,m,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof fo){const d=this._def.unknownKeys;if(d==="passthrough")for(const p of c)f.push({key:{status:"valid",value:p},value:{status:"valid",value:i.data[p]}});else if(d==="strict")c.length>0&&(xe(i,{code:he.unrecognized_keys,keys:c}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const p of c){const m=i.data[p];f.push({key:{status:"valid",value:p},value:d._parse(new uo(i,m,i.path,p)),alwaysSet:p in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const d=[];for(const p of f){const m=await p.key,g=await p.value;d.push({key:m,value:g,alwaysSet:p.alwaysSet})}return d}).then(d=>Mr.mergeObjectSync(r,d)):Mr.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(e){return Ce.errToObj,new an({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var s,l;const i=((l=(s=this._def).errorMap)==null?void 0:l.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:Ce.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new an({...this._def,unknownKeys:"strip"})}passthrough(){return new an({...this._def,unknownKeys:"passthrough"})}extend(e){return new an({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new an({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pe.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new an({...this._def,catchall:e})}pick(e){const n={};for(const r of ut.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new an({...this._def,shape:()=>n})}omit(e){const n={};for(const r of ut.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new an({...this._def,shape:()=>n})}deepPartial(){return fa(this)}partial(e){const n={};for(const r of ut.objectKeys(this.shape)){const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new an({...this._def,shape:()=>n})}required(e){const n={};for(const r of ut.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof so;)s=s._def.innerType;n[r]=s}return new an({...this._def,shape:()=>n})}keyof(){return yM(ut.objectKeys(this.shape))}}an.create=(t,e)=>new an({shape:()=>t,unknownKeys:"strip",catchall:fo.create(),typeName:Pe.ZodObject,...Qe(e)});an.strictCreate=(t,e)=>new an({shape:()=>t,unknownKeys:"strict",catchall:fo.create(),typeName:Pe.ZodObject,...Qe(e)});an.lazycreate=(t,e)=>new an({shape:t,unknownKeys:"strip",catchall:fo.create(),typeName:Pe.ZodObject,...Qe(e)});class Bh extends ot{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(s){for(const c of s)if(c.result.status==="valid")return c.result;for(const c of s)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const l=s.map(c=>new ps(c.ctx.common.issues));return xe(n,{code:he.invalid_union,unionErrors:l}),Ve}if(n.common.async)return Promise.all(r.map(async s=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(i);{let s;const l=[];for(const f of r){const d={...n,common:{...n.common,issues:[]},parent:null},p=f._parseSync({data:n.data,path:n.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:d}),d.common.issues.length&&l.push(d.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const c=l.map(f=>new ps(f));return xe(n,{code:he.invalid_union,unionErrors:c}),Ve}}get options(){return this._def.options}}Bh.create=(t,e)=>new Bh({options:t,typeName:Pe.ZodUnion,...Qe(e)});function cb(t,e){const n=Ks(t),r=Ks(e);if(t===e)return{valid:!0,data:t};if(n===ve.object&&r===ve.object){const i=ut.objectKeys(e),s=ut.objectKeys(t).filter(c=>i.indexOf(c)!==-1),l={...t,...e};for(const c of s){const f=cb(t[c],e[c]);if(!f.valid)return{valid:!1};l[c]=f.data}return{valid:!0,data:l}}else if(n===ve.array&&r===ve.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<t.length;s++){const l=t[s],c=e[s],f=cb(l,c);if(!f.valid)return{valid:!1};i.push(f.data)}return{valid:!0,data:i}}else return n===ve.date&&r===ve.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Uh extends ot{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(s,l)=>{if(EC(s)||EC(l))return Ve;const c=cb(s.value,l.value);return c.valid?((TC(s)||TC(l))&&n.dirty(),{status:n.value,value:c.data}):(xe(r,{code:he.invalid_intersection_types}),Ve)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,l])=>i(s,l)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Uh.create=(t,e,n)=>new Uh({left:t,right:e,typeName:Pe.ZodIntersection,...Qe(n)});class il extends ot{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ve.array)return xe(r,{code:he.invalid_type,expected:ve.array,received:r.parsedType}),Ve;if(r.data.length<this._def.items.length)return xe(r,{code:he.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ve;!this._def.rest&&r.data.length>this._def.items.length&&(xe(r,{code:he.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((l,c)=>{const f=this._def.items[c]||this._def.rest;return f?f._parse(new uo(r,l,r.path,c)):null}).filter(l=>!!l);return r.common.async?Promise.all(s).then(l=>Mr.mergeArray(n,l)):Mr.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new il({...this._def,rest:e})}}il.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new il({items:t,typeName:Pe.ZodTuple,rest:null,...Qe(e)})};class LC extends ot{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ve.map)return xe(r,{code:he.invalid_type,expected:ve.map,received:r.parsedType}),Ve;const i=this._def.keyType,s=this._def.valueType,l=[...r.data.entries()].map(([c,f],d)=>({key:i._parse(new uo(r,c,r.path,[d,"key"])),value:s._parse(new uo(r,f,r.path,[d,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const f of l){const d=await f.key,p=await f.value;if(d.status==="aborted"||p.status==="aborted")return Ve;(d.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(d.value,p.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const f of l){const d=f.key,p=f.value;if(d.status==="aborted"||p.status==="aborted")return Ve;(d.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(d.value,p.value)}return{status:n.value,value:c}}}}LC.create=(t,e,n)=>new LC({valueType:e,keyType:t,typeName:Pe.ZodMap,...Qe(n)});class ju extends ot{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ve.set)return xe(r,{code:he.invalid_type,expected:ve.set,received:r.parsedType}),Ve;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(xe(r,{code:he.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(xe(r,{code:he.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function l(f){const d=new Set;for(const p of f){if(p.status==="aborted")return Ve;p.status==="dirty"&&n.dirty(),d.add(p.value)}return{status:n.value,value:d}}const c=[...r.data.values()].map((f,d)=>s._parse(new uo(r,f,r.path,d)));return r.common.async?Promise.all(c).then(f=>l(f)):l(c)}min(e,n){return new ju({...this._def,minSize:{value:e,message:Ce.toString(n)}})}max(e,n){return new ju({...this._def,maxSize:{value:e,message:Ce.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}ju.create=(t,e)=>new ju({valueType:t,minSize:null,maxSize:null,typeName:Pe.ZodSet,...Qe(e)});class jC extends ot{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}jC.create=(t,e)=>new jC({getter:t,typeName:Pe.ZodLazy,...Qe(e)});class IC extends ot{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return xe(n,{received:n.data,code:he.invalid_literal,expected:this._def.value}),Ve}return{status:"valid",value:e.data}}get value(){return this._def.value}}IC.create=(t,e)=>new IC({value:t,typeName:Pe.ZodLiteral,...Qe(e)});function yM(t,e){return new Na({values:t,typeName:Pe.ZodEnum,...Qe(e)})}class Na extends ot{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return xe(n,{expected:ut.joinValues(r),received:n.parsedType,code:he.invalid_type}),Ve}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return xe(n,{received:n.data,code:he.invalid_enum_value,options:r}),Ve}return Qr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Na.create(e,{...this._def,...n})}exclude(e,n=this._def){return Na.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Na.create=yM;class BC extends ot{_parse(e){const n=ut.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ve.string&&r.parsedType!==ve.number){const i=ut.objectValues(n);return xe(r,{expected:ut.joinValues(i),received:r.parsedType,code:he.invalid_type}),Ve}if(this._cache||(this._cache=new Set(ut.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=ut.objectValues(n);return xe(r,{received:r.data,code:he.invalid_enum_value,options:i}),Ve}return Qr(e.data)}get enum(){return this._def.values}}BC.create=(t,e)=>new BC({values:t,typeName:Pe.ZodNativeEnum,...Qe(e)});class Hh extends ot{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ve.promise&&n.common.async===!1)return xe(n,{code:he.invalid_type,expected:ve.promise,received:n.parsedType}),Ve;const r=n.parsedType===ve.promise?n.data:Promise.resolve(n.data);return Qr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Hh.create=(t,e)=>new Hh({type:t,typeName:Pe.ZodPromise,...Qe(e)});class za extends ot{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:l=>{xe(r,l),l.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const l=i.transform(r.data,s);if(r.common.async)return Promise.resolve(l).then(async c=>{if(n.value==="aborted")return Ve;const f=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return f.status==="aborted"?Ve:f.status==="dirty"||n.value==="dirty"?lu(f.value):f});{if(n.value==="aborted")return Ve;const c=this._def.schema._parseSync({data:l,path:r.path,parent:r});return c.status==="aborted"?Ve:c.status==="dirty"||n.value==="dirty"?lu(c.value):c}}if(i.type==="refinement"){const l=c=>{const f=i.refinement(c,s);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Ve:(c.status==="dirty"&&n.dirty(),l(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Ve:(c.status==="dirty"&&n.dirty(),l(c.value).then(()=>({status:n.value,value:c.value}))))}if(i.type==="transform")if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ra(l))return Ve;const c=i.transform(l.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>Ra(l)?Promise.resolve(i.transform(l.value,s)).then(c=>({status:n.value,value:c})):Ve);ut.assertNever(i)}}za.create=(t,e,n)=>new za({schema:t,typeName:Pe.ZodEffects,effect:e,...Qe(n)});za.createWithPreprocess=(t,e,n)=>new za({schema:e,effect:{type:"preprocess",transform:t},typeName:Pe.ZodEffects,...Qe(n)});class so extends ot{_parse(e){return this._getType(e)===ve.undefined?Qr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}so.create=(t,e)=>new so({innerType:t,typeName:Pe.ZodOptional,...Qe(e)});class La extends ot{_parse(e){return this._getType(e)===ve.null?Qr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}La.create=(t,e)=>new La({innerType:t,typeName:Pe.ZodNullable,...Qe(e)});class ub extends ot{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===ve.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ub.create=(t,e)=>new ub({innerType:t,typeName:Pe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Qe(e)});class fb extends ot{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return jh(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ps(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ps(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}fb.create=(t,e)=>new fb({innerType:t,typeName:Pe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Qe(e)});class UC extends ot{_parse(e){if(this._getType(e)!==ve.nan){const r=this._getOrReturnCtx(e);return xe(r,{code:he.invalid_type,expected:ve.nan,received:r.parsedType}),Ve}return{status:"valid",value:e.data}}}UC.create=t=>new UC({typeName:Pe.ZodNaN,...Qe(t)});class d3 extends ot{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Rx extends ot{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ve:s.status==="dirty"?(n.dirty(),lu(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ve:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new Rx({in:e,out:n,typeName:Pe.ZodPipeline})}}class db extends ot{_parse(e){const n=this._def.innerType._parse(e),r=i=>(Ra(i)&&(i.value=Object.freeze(i.value)),i);return jh(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}db.create=(t,e)=>new db({innerType:t,typeName:Pe.ZodReadonly,...Qe(e)});var Pe;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Pe||(Pe={}));fo.create;Ci.create;Bh.create;Uh.create;il.create;const Ni=Na.create;Hh.create;so.create;La.create;Ni(["highlight","comment","flag"]);Ni(["pending","accepted","dismissed"]);Ni(["yellow","red","green","blue","purple"]);Ni(["info","warning","error","success"]);const h3=Ni(["solo","tandem"]);Ni(["user","claude","import"]);Ni(["accept","dismiss"]);Ni(["markdown","json"]);Ni(["md","txt","html","docx"]);Ni(["RANGE_GONE","RANGE_MOVED","FILE_LOCKED","FILE_NOT_FOUND","NO_DOCUMENT","INVALID_RANGE","FORMAT_ERROR","PERMISSION_DENIED"]);const p3=[{title:"Editor",rows:[{keys:["Ctrl","B"],description:"Bold"},{keys:["Ctrl","I"],description:"Italic"},{keys:["Ctrl","Z"],description:"Undo"},{keys:["Ctrl","Y"],description:"Redo"},{keys:["Ctrl","S"],description:"Save document"}]},{title:"Review Mode",rows:[{keys:["Tab"],description:"Next annotation"},{keys:["Shift","Tab"],description:"Previous annotation"},{keys:["Y"],description:"Accept annotation"},{keys:["N"],description:"Reject annotation"},{keys:["Z"],description:"Undo last accept/reject"},{keys:["E"],description:"Examine (scroll & exit)"},{keys:["Escape"],description:"Exit review mode"}]},{title:"Chat",rows:[{keys:["Enter"],description:"Send message"}]},{title:"Tabs",rows:[{keys:["Ctrl","Tab"],description:"Next tab"},{keys:["Ctrl","Shift","Tab"],description:"Previous tab"},{keys:["Alt","←"],description:"Move tab left"},{keys:["Alt","→"],description:"Move tab right"}]},{title:"General",rows:[{keys:["?"],description:"Show / hide this help"}]}];function m3({open:t,onClose:e}){return O.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e]),t?k.jsx("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.45)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:e,"data-testid":"help-modal",children:k.jsxs("div",{style:{backgroundColor:"#fff",border:"1px solid #e0e0e0",borderRadius:"8px",boxShadow:"0 8px 32px rgba(0,0,0,0.18)",padding:"24px 28px 20px",width:"480px",maxWidth:"90vw",maxHeight:"80vh",overflowY:"auto",position:"relative"},onClick:n=>n.stopPropagation(),children:[k.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"16px"},children:[k.jsx("h2",{style:{margin:0,fontSize:"16px",fontWeight:600,color:"#1a1a1a"},children:"Keyboard Shortcuts"}),k.jsx("button",{type:"button",onClick:e,"aria-label":"Close help","data-testid":"help-modal-close",style:{background:"none",border:"none",cursor:"pointer",fontSize:"18px",color:"#666",lineHeight:1,padding:"2px 6px",borderRadius:"4px"},children:"✕"})]}),p3.map(n=>k.jsxs("div",{style:{marginBottom:"18px"},children:[k.jsx("div",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"#888",marginBottom:"6px"},children:n.title}),k.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:k.jsx("tbody",{children:n.rows.map(r=>k.jsxs("tr",{children:[k.jsx("td",{style:{paddingBottom:"5px",paddingRight:"16px",whiteSpace:"nowrap",verticalAlign:"middle",width:"1%"},children:k.jsx("span",{style:{display:"flex",gap:"4px",alignItems:"center"},children:r.keys.map((i,s)=>k.jsxs("span",{children:[k.jsx("kbd",{style:{display:"inline-block",padding:"1px 6px",fontSize:"12px",fontFamily:"ui-monospace, SFMono-Regular, monospace",background:"#f5f5f5",border:"1px solid #d4d4d4",borderBottom:"2px solid #bbb",borderRadius:"4px",color:"#333",lineHeight:"1.5"},children:i}),s<r.keys.length-1&&k.jsx("span",{style:{color:"#aaa",fontSize:"11px",margin:"0 2px"},children:"+"})]},i))})}),k.jsx("td",{style:{paddingBottom:"5px",fontSize:"13px",color:"#444",verticalAlign:"middle"},children:r.description})]},r.description))})})]},n.title)),k.jsxs("div",{style:{marginTop:"12px",paddingTop:"10px",borderTop:"1px solid #f0f0f0",fontSize:"11px",color:"#aaa",textAlign:"center"},children:["Press"," ",k.jsx("kbd",{style:{fontSize:"11px",padding:"1px 4px",background:"#f5f5f5",border:"1px solid #ddd",borderRadius:"3px"},children:"?"})," ","or"," ",k.jsx("kbd",{style:{fontSize:"11px",padding:"1px 4px",background:"#f5f5f5",border:"1px solid #ddd",borderRadius:"3px"},children:"Esc"})," ","to close"]})]})}):null}const g3=[{title:"Review an annotation",text:"Open the side panel and accept or dismiss one of the highlighted annotations. Try Review Mode (Ctrl+Shift+R) for keyboard shortcuts."},{title:"Ask a question",text:"Select text, click Comment, and check the @Claude toggle to direct it to Claude — or type in the Chat panel."},{title:"Make an edit",text:"Click in the document and type something. All changes sync in real-time."},{title:"You're ready!",text:"You've learned the basics. Press ? anytime to see keyboard shortcuts."}],$d=3;function y3({currentStep:t,onNext:e,onDismiss:n}){const r=g3[t];if(!r)return null;const i=t>=$d;return k.jsxs("div",{"data-testid":"onboarding-tutorial",style:{position:"fixed",bottom:48,left:24,zIndex:900,maxWidth:340,background:"white",borderLeft:"4px solid #6366f1",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08)",padding:"16px 20px",fontFamily:"inherit"},children:[!i&&k.jsx("div",{style:{display:"flex",gap:6,marginBottom:12},children:Array.from({length:$d},(s,l)=>k.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:l<=t?"#6366f1":"#e5e7eb",transition:"background 0.2s"}},l))}),k.jsx("div",{style:{fontSize:14,fontWeight:600,color:"#1f2937",marginBottom:6},children:r.title}),k.jsx("div",{style:{fontSize:13,lineHeight:1.5,color:"#4b5563",marginBottom:i?0:14},children:r.text}),!i&&k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsxs("span",{style:{fontSize:11,color:"#9ca3af"},children:["Step ",t+1," of ",$d]}),k.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[k.jsx("button",{"data-testid":"tutorial-dismiss-btn",onClick:n,style:{background:"none",border:"none",cursor:"pointer",fontSize:12,color:"#9ca3af",padding:0,textDecoration:"underline"},children:"Dismiss tutorial"}),k.jsx("button",{"data-testid":"tutorial-next-btn",onClick:e,style:{padding:"4px 12px",fontSize:12,border:"1px solid #d1d5db",borderRadius:4,background:"white",color:"#374151",cursor:"pointer",fontWeight:500},children:t===$d-1?"Done":"Next"})]})]})]})}const Iu=`http://localhost:${Ga}/api`;function b3(t){const e=new Uint8Array(t);let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}function x3(t){return t.toLowerCase().endsWith(".docx")}async function bM(t){if(x3(t.name)){const e=await t.arrayBuffer();return b3(e)}return t.text()}const HC="tandem:reviewOnlyBannerDismissed";function VC({visible:t,documentId:e}){const[n,r]=O.useState(()=>{try{return localStorage.getItem(HC)==="true"}catch{return!1}}),[i,s]=O.useState(!1),[l,c]=O.useState(null);if(!t||n)return null;async function f(){if(!(!e||i)){s(!0),c(null);try{const d=await fetch(`${Iu}/convert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:e})});if(!d.ok){const p=await d.json().catch(()=>null);c((p==null?void 0:p.message)??`Conversion failed (HTTP ${d.status}).`)}}catch{c("Could not reach the server.")}finally{s(!1)}}}return k.jsxs("div",{"data-testid":"review-only-banner",style:{padding:"8px 16px",backgroundColor:"#eff6ff",borderBottom:"1px solid #bfdbfe",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"13px",color:"#1e40af",gap:"12px"},children:[k.jsx("span",{children:"This document is open in review-only mode. You can add annotations and review, but cannot edit directly."}),k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[l&&k.jsx("span",{style:{color:"#dc2626",fontSize:"12px",maxWidth:"200px"},children:l}),e&&k.jsx("button",{type:"button","data-testid":"convert-to-markdown-btn",onClick:f,disabled:i,style:{background:"#2563eb",border:"none",color:"white",cursor:i?"default":"pointer",fontWeight:500,fontSize:"12px",padding:"4px 10px",borderRadius:"4px",whiteSpace:"nowrap",opacity:i?.6:1},children:i?"Converting…":"Convert to Markdown"}),k.jsx("button",{type:"button","data-testid":"review-only-dismiss",onClick:()=>{try{localStorage.setItem(HC,"true")}catch{}r(!0)},style:{background:"none",border:"none",color:"#1e40af",cursor:"pointer",fontWeight:500,fontSize:"13px",padding:"2px 8px",whiteSpace:"nowrap"},children:"Dismiss"})]})]})}function Qc(t,e,n,r){const i=r?e.filter(f=>!r(f)):e,s=f=>{var C;const{key:d}=f;if(d!=="ArrowLeft"&&d!=="ArrowRight"&&d!=="ArrowUp"&&d!=="ArrowDown"&&d!=="Home"&&d!=="End"||i.length===0)return;f.preventDefault();const p=i.indexOf(t),m=i.length-1;let g;d==="Home"?g=0:d==="End"?g=m:d==="ArrowLeft"||d==="ArrowUp"?g=p<=0?m:p-1:g=p>=m?0:p+1;const b=i[g];n(b);const S=f.currentTarget.querySelectorAll('[role="radio"]'),v=e.indexOf(b);(C=S[v])==null||C.focus()},l=r!=null&&r(t)?i[0]:t;return{handleKeyDown:s,tabIndexFor:f=>r!=null&&r(f)?-1:f===l?0:-1}}function Nx(t){return(t==null?void 0:t.trim())||dM}function zx(){try{return Nx(localStorage.getItem(Dx))}catch{return dM}}function S3(t){const e=Nx(t);try{localStorage.setItem(Dx,e)}catch{}return typeof window<"u"&&window.dispatchEvent(new Event(lb)),e}function xM(t){const e=()=>t(zx()),n=r=>{r.key===Dx&&t(Nx(r.newValue))};return window.addEventListener(lb,e),window.addEventListener("storage",n),()=>{window.removeEventListener(lb,e),window.removeEventListener("storage",n)}}function SM(){const[t,e]=O.useState(zx);O.useEffect(()=>xM(e),[]);const n=O.useCallback(r=>{const i=S3(r);e(i)},[]);return{userName:t,setUserName:n}}const Jy=320,PC="tandem-settings-heading",w3='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function v3({open:t,onClose:e,anchorRect:n,settings:r,onUpdate:i,returnFocusRef:s,anchorRef:l}){const c=O.useRef(null),f=O.useRef(null),[d,p]=O.useState(window.innerWidth),m=d<768,{userName:g,setUserName:b}=SM(),[S,v]=O.useState(g);O.useEffect(()=>{S!==g&&document.activeElement!==f.current&&v(g)},[g,S]);const C=Qc(r.theme,["light","dark","system"],j=>i({theme:j})),E=Qc(r.layout,["tabbed","three-panel"],j=>i({layout:j}),j=>j==="three-panel"&&m),B=Qc(r.primaryTab,["chat","annotations"],j=>i({primaryTab:j})),I=Qc(r.panelOrder,["chat-editor-annotations","annotations-editor-chat"],j=>i({panelOrder:j})),ne=Qc(r.textSize,["s","m","l"],j=>i({textSize:j}));if(O.useEffect(()=>{if(!t)return;p(window.innerWidth);const j=()=>p(window.innerWidth);return window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[t]),O.useEffect(()=>{if(!t)return;const j=c.current;return j==null||j.focus(),()=>{var ie;(ie=s==null?void 0:s.current)==null||ie.focus()}},[t,s]),O.useEffect(()=>{if(!t)return;const j=re=>{var be;const se=re.target;(be=l==null?void 0:l.current)!=null&&be.contains(se)||c.current&&!c.current.contains(se)&&e()},ie=setTimeout(()=>document.addEventListener("pointerdown",j),0);return()=>{clearTimeout(ie),document.removeEventListener("pointerdown",j)}},[t,e,l]),O.useEffect(()=>{if(!t)return;const j=ie=>{if(ie.key==="Escape"){e();return}if(ie.key!=="Tab"||!c.current)return;const re=c.current.querySelectorAll(w3);if(re.length===0)return;const se=re[0],be=re[re.length-1],ue=document.activeElement;if(!c.current.contains(ue)){ie.preventDefault(),se.focus();return}ie.shiftKey&&ue===se?(ie.preventDefault(),be.focus()):!ie.shiftKey&&ue===be&&(ie.preventDefault(),se.focus())};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[t,e]),!t||!n)return null;const F=Math.max(8,Math.min(n.left+n.width/2-Jy/2,window.innerWidth-Jy-8)),R=n.bottom+6,N={fontSize:"11px",fontWeight:600,color:"var(--tandem-fg)",marginBottom:"6px",textTransform:"uppercase",letterSpacing:"0.5px"},Z=(j,ie)=>({flex:1,padding:"8px",minHeight:"24px",border:`2px solid ${j?"var(--tandem-accent)":"var(--tandem-border)"}`,borderRadius:"6px",background:ie?"var(--tandem-surface-muted)":j?"var(--tandem-accent-bg)":"var(--tandem-surface)",cursor:ie?"not-allowed":"pointer",textAlign:"center",fontSize:"11px",color:ie?"var(--tandem-fg-subtle)":j?"var(--tandem-accent-fg-strong)":"var(--tandem-fg-muted)",fontWeight:j?600:400,opacity:ie?.6:1,transition:"border-color 0.15s, background 0.15s"});return k.jsxs("div",{ref:c,"data-testid":"settings-popover",role:"dialog","aria-modal":"true","aria-labelledby":PC,tabIndex:-1,style:{position:"fixed",left:`${F}px`,top:`${R}px`,width:`${Jy}px`,background:"var(--tandem-surface)",color:"var(--tandem-fg)",border:"1px solid var(--tandem-border)",borderRadius:"8px",boxShadow:"0 4px 24px rgba(0,0,0,0.12)",padding:"16px",zIndex:9999,display:"flex",flexDirection:"column",gap:"14px",outline:"none"},children:[k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsx("span",{id:PC,style:{fontSize:"13px",fontWeight:600,color:"var(--tandem-fg)"},children:"Settings"}),k.jsx("button",{onClick:e,style:{background:"none",border:"none",cursor:"pointer",color:"var(--tandem-fg-subtle)",fontSize:"16px",lineHeight:1,padding:"4px 6px",minWidth:"24px",minHeight:"24px"},"aria-label":"Close settings",children:"×"})]}),k.jsxs("div",{children:[k.jsx("label",{htmlFor:"settings-display-name",style:N,children:"Display Name"}),k.jsx("input",{ref:f,id:"settings-display-name","data-testid":"settings-display-name",type:"text",value:S,onChange:j=>v(j.target.value),onBlur:()=>b(S),onKeyDown:j=>{j.key==="Enter"&&j.currentTarget.blur(),j.key==="Escape"&&(v(g),j.currentTarget.blur())},maxLength:hM,style:{width:"100%",padding:"6px 8px",fontSize:"12px",color:"var(--tandem-fg)",background:"var(--tandem-surface)",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",outline:"none"}})]}),k.jsxs("div",{children:[k.jsx("div",{id:"settings-theme-label",style:N,children:"Theme"}),k.jsx("div",{role:"radiogroup","aria-labelledby":"settings-theme-label",onKeyDown:C.handleKeyDown,style:{display:"flex",gap:"8px"},children:["light","dark","system"].map(j=>k.jsx("button",{"data-testid":`theme-${j}-btn`,role:"radio","aria-checked":r.theme===j,tabIndex:C.tabIndexFor(j),onClick:()=>i({theme:j}),style:Z(r.theme===j),children:j==="light"?"Light":j==="dark"?"Dark":"System"},j))})]}),k.jsxs("div",{children:[k.jsx("div",{id:"settings-layout-label",style:N,children:"Layout"}),k.jsxs("div",{role:"radiogroup","aria-labelledby":"settings-layout-label",onKeyDown:E.handleKeyDown,style:{display:"flex",gap:"8px"},children:[k.jsxs("button",{"data-testid":"layout-tabbed-btn",role:"radio","aria-checked":r.layout==="tabbed",tabIndex:E.tabIndexFor("tabbed"),onClick:()=>i({layout:"tabbed"}),style:Z(r.layout==="tabbed"),children:[k.jsx("div",{style:{fontSize:"18px",marginBottom:"2px"},children:"[=|]"}),"Tabbed"]}),k.jsxs("button",{"data-testid":"layout-three-panel-btn",role:"radio","aria-checked":r.layout==="three-panel","aria-disabled":m||void 0,tabIndex:E.tabIndexFor("three-panel"),onClick:()=>{m||i({layout:"three-panel"})},style:Z(r.layout==="three-panel",m),title:m?"Requires viewport wider than 768px":void 0,children:[k.jsx("div",{style:{fontSize:"18px",marginBottom:"2px"},children:"[|||]"}),"Three-Panel"]})]}),m&&k.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:"Three-panel requires a wider viewport"})]}),r.layout==="tabbed"&&k.jsxs("div",{children:[k.jsx("div",{id:"settings-default-tab-label",style:N,children:"Default Tab"}),k.jsxs("div",{role:"radiogroup","aria-labelledby":"settings-default-tab-label",onKeyDown:B.handleKeyDown,style:{display:"flex",gap:"8px"},children:[k.jsx("button",{"data-testid":"default-tab-chat-btn",role:"radio","aria-checked":r.primaryTab==="chat",tabIndex:B.tabIndexFor("chat"),onClick:()=>i({primaryTab:"chat"}),style:Z(r.primaryTab==="chat"),children:"Chat"}),k.jsx("button",{"data-testid":"default-tab-annotations-btn",role:"radio","aria-checked":r.primaryTab==="annotations",tabIndex:B.tabIndexFor("annotations"),onClick:()=>i({primaryTab:"annotations"}),style:Z(r.primaryTab==="annotations"),children:"Annotations"})]})]}),r.layout==="three-panel"&&k.jsxs("div",{children:[k.jsx("div",{id:"settings-panel-order-label",style:N,children:"Panel Order"}),k.jsxs("div",{role:"radiogroup","aria-labelledby":"settings-panel-order-label",onKeyDown:I.handleKeyDown,style:{display:"flex",gap:"8px"},children:[k.jsx("button",{"data-testid":"panel-order-cea-btn",role:"radio","aria-checked":r.panelOrder==="chat-editor-annotations",tabIndex:I.tabIndexFor("chat-editor-annotations"),onClick:()=>i({panelOrder:"chat-editor-annotations"}),style:Z(r.panelOrder==="chat-editor-annotations"),children:"Chat | Editor | Ann."}),k.jsx("button",{"data-testid":"panel-order-aec-btn",role:"radio","aria-checked":r.panelOrder==="annotations-editor-chat",tabIndex:I.tabIndexFor("annotations-editor-chat"),onClick:()=>i({panelOrder:"annotations-editor-chat"}),style:Z(r.panelOrder==="annotations-editor-chat"),children:"Ann. | Editor | Chat"})]})]}),k.jsxs("div",{children:[k.jsxs("div",{style:N,children:["Editor Width:"," ",k.jsxs("span",{style:{fontWeight:400,textTransform:"none"},children:[r.editorWidthPercent,"%"]})]}),k.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginBottom:"6px"},children:"How much of the available space the editor text fills"}),k.jsx("input",{"data-testid":"editor-width-slider",type:"range",min:50,max:100,step:5,value:r.editorWidthPercent,onChange:j=>i({editorWidthPercent:Number(j.target.value)}),style:{width:"100%",accentColor:"var(--tandem-accent)"},"aria-label":"Editor width"}),k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:[k.jsx("span",{children:"50%"}),k.jsx("span",{children:"100%"})]})]}),k.jsxs("div",{children:[k.jsx("div",{style:N,children:"Authorship"}),k.jsxs("label",{"data-testid":"authorship-toggle",style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",fontSize:"12px",color:"var(--tandem-fg)",minHeight:"24px"},children:[k.jsx("input",{type:"checkbox",checked:r.showAuthorship,onChange:j=>i({showAuthorship:j.target.checked}),style:{accentColor:"var(--tandem-accent)"}}),k.jsx("span",{children:"Show who wrote what"})]}),k.jsxs("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:["Highlights text by author: ",k.jsx("span",{style:{color:"var(--tandem-author-user)"},children:"you"})," ","/ ",k.jsx("span",{style:{color:"var(--tandem-author-claude)"},children:"Claude"})]})]}),k.jsxs("div",{children:[k.jsx("div",{id:"settings-text-size-label",style:N,children:"Text Size"}),k.jsx("div",{role:"radiogroup","aria-labelledby":"settings-text-size-label",onKeyDown:ne.handleKeyDown,style:{display:"flex",gap:"8px"},children:["s","m","l"].map(j=>k.jsx("button",{"data-testid":`text-size-${j}-btn`,role:"radio","aria-checked":r.textSize===j,tabIndex:ne.tabIndexFor(j),onClick:()=>i({textSize:j}),style:Z(r.textSize===j),children:j==="s"?"Small":j==="m"?"Medium":"Large"},j))}),k.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:"Reading density only — use browser zoom (Ctrl + =/−) to scale the whole UI."})]}),k.jsxs("div",{children:[k.jsxs("label",{"data-testid":"reduce-motion-toggle",style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",fontSize:"12px",color:"var(--tandem-fg)",minHeight:"24px"},children:[k.jsx("input",{type:"checkbox",checked:r.reduceMotion,onChange:j=>i({reduceMotion:j.target.checked}),style:{accentColor:"var(--tandem-accent)"}}),k.jsx("span",{children:"Reduce motion"})]}),k.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:"Disables smooth autoscroll and the annotation flash animation."})]}),k.jsxs("div",{children:[k.jsxs("div",{style:N,children:["Selection Sensitivity:"," ",k.jsxs("span",{style:{fontWeight:400,textTransform:"none"},children:[(r.selectionDwellMs/1e3).toFixed(1),"s"]})]}),k.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginBottom:"6px"},children:"How long you must hold a selection before Claude notices it"}),k.jsx("input",{"data-testid":"dwell-time-slider",type:"range",min:zh,max:Lh,step:100,value:r.selectionDwellMs,onChange:j=>i({selectionDwellMs:Number(j.target.value)}),style:{width:"100%",accentColor:"var(--tandem-accent)"},"aria-label":"Selection dwell time"}),k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:[k.jsxs("span",{children:[(zh/1e3).toFixed(1),"s"]}),k.jsxs("span",{children:[(Lh/1e3).toFixed(1),"s"]})]})]})]})}const k3={error:"#ef4444",warning:"#f59e0b",info:"#6366f1"};function C3({toasts:t,onDismiss:e}){return t.length===0?null:k.jsxs(k.Fragment,{children:[k.jsx("style",{children:`
|
|
50
|
-
@keyframes tandem-toast-slide-in {
|
|
51
|
-
from {
|
|
52
|
-
opacity: 0;
|
|
53
|
-
transform: translateX(40px);
|
|
54
|
-
}
|
|
55
|
-
to {
|
|
56
|
-
opacity: 1;
|
|
57
|
-
transform: translateX(0);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
`}),k.jsx("div",{"data-testid":"toast-container",style:{position:"fixed",bottom:40,right:16,zIndex:1e3,display:"flex",flexDirection:"column",gap:8,maxWidth:360,pointerEvents:"none"},children:t.map(n=>k.jsx(E3,{toast:n,onDismiss:e},n.id))})]})}function E3({toast:t,onDismiss:e}){const n=k3[t.severity],r=t.severity==="info"?"status":"alert";return k.jsxs("div",{role:r,"data-testid":`toast-${t.id}`,style:{pointerEvents:"auto",background:"white",borderRadius:6,borderLeft:`4px solid ${n}`,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08)",padding:"10px 32px 10px 12px",position:"relative",animation:"tandem-toast-slide-in 0.2s ease-out",fontSize:13,lineHeight:1.4,color:"#1f2937"},children:[k.jsx("span",{children:t.message}),t.count>1&&k.jsxs("span",{"data-testid":`toast-count-${t.id}`,style:{marginLeft:6,fontSize:11,fontWeight:600,color:n,background:`${n}18`,padding:"1px 5px",borderRadius:8},children:["×",t.count]}),k.jsx("button",{"data-testid":`toast-dismiss-${t.id}`,onClick:()=>e(t.id),style:{position:"absolute",top:6,right:6,border:"none",background:"transparent",cursor:"pointer",fontSize:14,color:"#9ca3af",lineHeight:1,padding:"2px 4px"},"aria-label":"Dismiss notification",children:"×"})]})}function On(t){this.content=t}On.prototype={constructor:On,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 On(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 On(n)},addToStart:function(t,e){return new On([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new On(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 On(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=On.from(t),t.size?new On(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=On.from(t),t.size?new On(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=On.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}};On.from=function(t){if(t instanceof On)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new On(e)};function wM(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 l=0;i.text[l]==s.text[l];l++)n++;return n}if(i.content.size||s.content.size){let l=wM(i.content,s.content,n+1);if(l!=null)return l}n+=i.nodeSize}}function vM(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 l=t.child(--i),c=e.child(--s),f=l.nodeSize;if(l==c){n-=f,r-=f;continue}if(!l.sameMarkup(c))return{a:n,b:r};if(l.isText&&l.text!=c.text){let d=0,p=Math.min(l.text.length,c.text.length);for(;d<p&&l.text[l.text.length-d-1]==c.text[c.text.length-d-1];)d++,n--,r--;return{a:n,b:r}}if(l.content.size||c.content.size){let d=vM(l.content,c.content,n-1,r-1);if(d)return d}n-=f,r-=f}}class te{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 l=0,c=0;c<n;l++){let f=this.content[l],d=c+f.nodeSize;if(d>e&&r(f,i+c,s||null,l)!==!1&&f.content.size){let p=c+1;f.nodesBetween(Math.max(0,e-p),Math.min(f.content.size,n-p),r,i+p)}c=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",l=!0;return this.nodesBetween(e,n,(c,f)=>{let d=c.isText?c.text.slice(Math.max(e,f)-f,n-f):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&d||c.isTextblock)&&r&&(l?l=!1:s+=r),s+=d},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 te(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,l=0;l<n;s++){let c=this.content[s],f=l+c.nodeSize;f>e&&((l<e||f>n)&&(c.isText?c=c.cut(Math.max(0,e-l),Math.min(c.text.length,n-l)):c=c.cut(Math.max(0,e-l-1),Math.min(c.content.size,n-l-1))),r.push(c),i+=c.nodeSize),l=f}return new te(r,i)}cutByIndex(e,n){return e==n?te.empty:e==0&&n==this.content.length?this:new te(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 te(i,s)}addToStart(e){return new te([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new te(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 wM(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return vM(this,e,n,r)}findIndex(e){if(e==0)return Fd(0,e);if(e==this.size)return Fd(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?Fd(n+1,s):Fd(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 te.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new te(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return te.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 te(n||e,r)}static from(e){if(!e)return te.empty;if(e instanceof te)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new te([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}te.empty=new te([],0);const Xy={index:0,offset:0};function Fd(t,e){return Xy.index=t,Xy.offset=e,Xy}function Vh(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(!Vh(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Vh(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let kt=class hb{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&&Vh(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 hb.none;if(e instanceof hb)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};kt.none=[];class Ph extends Error{}class ge{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=CM(this.content,e+this.openStart,n);return r&&new ge(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ge(kM(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 ge.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 ge(te.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 ge(e,r,i)}}ge.empty=new ge(te.empty,0,0);function kM(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:l,offset:c}=t.findIndex(n);if(i==e||s.isText){if(c!=n&&!t.child(l).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=l)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(kM(s.content,e-i-1,n-i-1)))}function CM(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),l=t.maybeChild(i);if(s==e||l.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=CM(l.content,e-s-1,n,l);return c&&t.replaceChild(i,l.copy(c))}function T3(t,e,n){if(n.openStart>t.depth)throw new Ph("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Ph("Inconsistent open depths");return EM(t,e,n,0)}function EM(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let l=EM(t,e,n,r+1);return s.copy(s.content.replaceChild(i,l))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let l=t.parent,c=l.content;return Jo(l,c.cut(0,t.parentOffset).append(n.content).append(c.cut(e.parentOffset)))}else{let{start:l,end:c}=A3(n,t);return Jo(s,AM(t,l,c,e,r))}else return Jo(s,$h(t,e,r))}function TM(t,e){if(!e.type.compatibleContent(t.type))throw new Ph("Cannot join "+e.type.name+" onto "+t.type.name)}function pb(t,e,n){let r=t.node(n);return TM(r,e.node(n)),r}function Zo(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 du(t,e,n,r){let i=(e||t).node(n),s=0,l=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Zo(t.nodeAfter,r),s++));for(let c=s;c<l;c++)Zo(i.child(c),r);e&&e.depth==n&&e.textOffset&&Zo(e.nodeBefore,r)}function Jo(t,e){return t.type.checkContent(e),t.copy(e)}function AM(t,e,n,r,i){let s=t.depth>i&&pb(t,e,i+1),l=r.depth>i&&pb(n,r,i+1),c=[];return du(null,t,i,c),s&&l&&e.index(i)==n.index(i)?(TM(s,l),Zo(Jo(s,AM(t,e,n,r,i+1)),c)):(s&&Zo(Jo(s,$h(t,e,i+1)),c),du(e,n,i,c),l&&Zo(Jo(l,$h(n,r,i+1)),c)),du(r,null,i,c),new te(c)}function $h(t,e,n){let r=[];if(du(null,t,n,r),t.depth>n){let i=pb(t,e,n+1);Zo(Jo(i,$h(t,e,n+1)),r)}return du(e,null,n,r),new te(r)}function A3(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(te.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Bu{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 kt.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let c=r;r=i,i=c}let s=r.marks;for(var l=0;l<s.length;l++)s[l].type.spec.inclusive===!1&&(!i||!s[l].isInSet(i.marks))&&(s=s[l--].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 Fh(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 l=e;;){let{index:c,offset:f}=l.content.findIndex(s),d=s-f;if(r.push(l,c,i+f),!d||(l=l.child(c),l.isText))break;s=d-1,i+=f+1}return new Bu(n,r,s)}static resolveCached(e,n){let r=$C.get(e);if(r)for(let s=0;s<r.elts.length;s++){let l=r.elts[s];if(l.pos==n)return l}else $C.set(e,r=new M3);let i=r.elts[r.i]=Bu.resolve(e,n);return r.i=(r.i+1)%O3,i}}class M3{constructor(){this.elts=[],this.i=0}}const O3=12,$C=new WeakMap;class Fh{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 _3=Object.create(null);let oo=class mb{constructor(e,n,r,i=kt.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||te.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&&Vh(this.attrs,n||e.defaultAttrs||_3)&&kt.sameSet(this.marks,r||kt.none)}copy(e=null){return e==this.content?this:new mb(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new mb(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 ge.empty;let i=this.resolve(e),s=this.resolve(n),l=r?0:i.sharedDepth(n),c=i.start(l),d=i.node(l).content.cut(i.pos-c,s.pos-c);return new ge(d,i.depth-l,s.depth-l)}replace(e,n,r){return T3(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 Bu.resolveCached(this,e)}resolveNoCache(e){return Bu.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()+")"),MM(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=te.empty,i=0,s=r.childCount){let l=this.contentMatchAt(e).matchFragment(r,i,s),c=l&&l.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let f=i;f<s;f++)if(!this.type.allowsMarks(r.child(f).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),l=s&&s.matchFragment(this.content,n);return l?l.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=kt.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(!kt.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=te.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};oo.prototype.text=void 0;class qh extends oo{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):MM(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 qh(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new qh(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 MM(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class sl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new D3(e,n);if(r.next==null)return sl.empty;let i=OM(r);r.next&&r.err("Unexpected trailing text");let s=B3(I3(i));return U3(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(l,c){let f=l.matchFragment(e,r);if(f&&(!n||f.validEnd))return te.from(c.map(d=>d.createAndFill()));for(let d=0;d<l.next.length;d++){let{type:p,next:m}=l.next[d];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(m)==-1){i.push(m);let g=s(m,c.concat(p));if(g)return g}}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 l=[];for(let c=i;c.type;c=c.via)l.push(c.type);return l.reverse()}for(let l=0;l<s.next.length;l++){let{type:c,next:f}=s.next[l];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in n)&&(!i.type||f.validEnd)&&(r.push({match:c.contentMatch,type:c,via:i}),n[c.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 l=0;l<r.next.length;l++)s+=(l?", ":"")+r.next[l].type.name+"->"+e.indexOf(r.next[l].next);return s}).join(`
|
|
61
|
-
`)}}sl.empty=new sl(!0);class D3{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 OM(t){let e=[];do e.push(R3(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function R3(t){let e=[];do e.push(N3(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function N3(t){let e=j3(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=z3(t,e);else break;return e}function FC(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function z3(t,e){let n=FC(t),r=n;return t.eat(",")&&(t.next!="}"?r=FC(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function L3(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let l=n[s];l.isInGroup(e)&&i.push(l)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function j3(t){if(t.eat("(")){let e=OM(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=L3(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 I3(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(l,c,f){let d={term:f,to:c};return e[l].push(d),d}function i(l,c){l.forEach(f=>f.to=c)}function s(l,c){if(l.type=="choice")return l.exprs.reduce((f,d)=>f.concat(s(d,c)),[]);if(l.type=="seq")for(let f=0;;f++){let d=s(l.exprs[f],c);if(f==l.exprs.length-1)return d;i(d,c=n())}else if(l.type=="star"){let f=n();return r(c,f),i(s(l.expr,f),f),[r(f)]}else if(l.type=="plus"){let f=n();return i(s(l.expr,c),f),i(s(l.expr,f),f),[r(f)]}else{if(l.type=="opt")return[r(c)].concat(s(l.expr,c));if(l.type=="range"){let f=c;for(let d=0;d<l.min;d++){let p=n();i(s(l.expr,f),p),f=p}if(l.max==-1)i(s(l.expr,f),f);else for(let d=l.min;d<l.max;d++){let p=n();r(f,p),i(s(l.expr,f),p),f=p}return[r(f)]}else{if(l.type=="name")return[r(c,void 0,l.value)];throw new Error("Unknown expr type")}}}}function _M(t,e){return e-t}function qC(t,e){let n=[];return r(e),n.sort(_M);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let l=0;l<s.length;l++){let{term:c,to:f}=s[l];!c&&n.indexOf(f)==-1&&r(f)}}}function B3(t){let e=Object.create(null);return n(qC(t,0));function n(r){let i=[];r.forEach(l=>{t[l].forEach(({term:c,to:f})=>{if(!c)return;let d;for(let p=0;p<i.length;p++)i[p][0]==c&&(d=i[p][1]);qC(t,f).forEach(p=>{d||i.push([c,d=[]]),d.indexOf(p)==-1&&d.push(p)})})});let s=e[r.join(",")]=new sl(r.indexOf(t.length-1)>-1);for(let l=0;l<i.length;l++){let c=i[l][1].sort(_M);s.next.push({type:i[l][0],next:e[c.join(",")]||n(c)})}return s}}function U3(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,l=[];for(let c=0;c<i.next.length;c++){let{type:f,next:d}=i.next[c];l.push(f.name),s&&!(f.isText||f.hasRequiredAttrs())&&(s=!1),r.indexOf(d)==-1&&r.push(d)}s&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function DM(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 RM(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 NM(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 zM(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new V3(t,r,e[r]);return n}let YC=class LM{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=zM(e,r.attrs),this.defaultAttrs=DM(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==sl.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:RM(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new oo(this,this.computeAttrs(e),te.from(n),kt.setFrom(r))}createChecked(e=null,n,r){return n=te.from(n),this.checkContent(n),new oo(this,this.computeAttrs(e),n,kt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=te.from(n),n.size){let l=this.contentMatch.fillBefore(n);if(!l)return null;n=l.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(te.empty,!0);return s?new oo(this,e,n.append(s),kt.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){NM(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:kt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,l)=>r[s]=new LM(s,n,l));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 H3(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 V3{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?H3(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Xp{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=zM(e,i.attrs),this.excluded=null;let s=DM(this.attrs);this.instance=s?new kt(this,s):null}create(e=null){return!e&&this.instance?this.instance:new kt(this,RM(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,l)=>r[s]=new Xp(s,i++,n,l)),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){NM(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let jM=class{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=On.from(e.nodes),n.marks=On.from(e.marks||{}),this.nodes=YC.compile(this.spec.nodes,this),this.marks=Xp.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],l=s.spec.content||"",c=s.spec.marks;if(s.contentMatch=r[l]||(r[l]=sl.parse(l,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=c=="_"?null:c?KC(this,c.split(" ")):c==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],l=s.spec.excludes;s.excluded=l==null?[s]:l==""?[]:KC(this,l.split(" "))}this.nodeFromJSON=i=>oo.fromJSON(this,i),this.markFromJSON=i=>kt.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 YC){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 qh(r,r.defaultAttrs,e,kt.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 KC(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],l=s;if(s)n.push(s);else for(let c in t.marks){let f=t.marks[c];(i=="_"||f.spec.group&&f.spec.group.split(" ").indexOf(i)>-1)&&n.push(l=f)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function P3(t){return t.tag!=null}function $3(t){return t.style!=null}let hu=class gb{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(P3(i))this.tags.push(i);else if($3(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 GC(this,n,!1);return r.addAll(e,kt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new GC(this,n,!0);return r.addAll(e,kt.none,n.from,n.to),ge.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(Y3(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let l=s.getAttrs(e);if(l===!1)continue;s.attrs=l||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 l=this.styles[s],c=l.style;if(!(c.indexOf(e)!=0||l.context&&!r.matchesContext(l.context)||c.length>e.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(l.getAttrs){let f=l.getAttrs(n);if(f===!1)continue;l.attrs=f||void 0}return l}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,l=0;for(;l<n.length;l++){let c=n[l];if((c.priority==null?50:c.priority)<s)break}n.splice(l,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(l=>{r(l=ZC(l)),l.mark||l.ignore||l.clearMark||(l.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(l=>{r(l=ZC(l)),l.node||l.ignore||l.mark||(l.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new gb(e,gb.schemaRules(e)))}};const IM={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},F3={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},BM={ol:!0,ul:!0},Uu=1,yb=2,pu=4;function WC(t,e,n){return e!=null?(e?Uu:0)|(e==="full"?yb:0):t&&t.whitespace=="pre"?Uu|yb:n&~pu}class qd{constructor(e,n,r,i,s,l){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=l,this.content=[],this.activeMarks=kt.none,this.match=s||(l&pu?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(te.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&Uu)){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=te.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(te.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&&!IM.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class GC{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,l=WC(null,n.preserveWhitespace,0)|(r?pu:0);i?s=new qd(i.type,i.attrs,kt.none,!0,n.topMatch||i.type.contentMatch,l):r?s=new qd(null,null,kt.none,!0,null,l):s=new qd(e.schema.topNodeType,null,kt.none,!0,null,l),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&yb?"full":this.localPreserveWS||(i.options&Uu)>0,{schema:l}=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,`
|
|
62
|
-
`);else if(l.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(l.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let f=0;f<c.length;f++)f&&this.insertNode(l.linebreakReplacement.create(),n,!0),c[f]&&this.insertNode(l.text(c[f]),n,!/\S/.test(c[f]));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 c=i.content[i.content.length-1],f=e.previousSibling;(!c||f&&f.nodeName=="BR"||c.isText&&/[ \t\r\n\u000c]$/.test(c.text))&&(r=r.slice(1))}r&&this.insertNode(l.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 l=e.nodeName.toLowerCase(),c;BM.hasOwnProperty(l)&&this.parser.normalizeLists&&q3(e);let f=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(c=this.parser.matchTag(e,this,r));e:if(f?f.ignore:F3.hasOwnProperty(l))this.findInside(e),this.ignoreFallback(e,n);else if(!f||f.skip||f.closeParent){f&&f.closeParent?this.open=Math.max(0,this.open-1):f&&f.skip.nodeType&&(e=f.skip);let d,p=this.needsBlock;if(IM.hasOwnProperty(l))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),d=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let m=f&&f.skip?n:this.readStyles(e,n);m&&this.addAll(e,m),d&&this.sync(s),this.needsBlock=p}else{let d=this.readStyles(e,n);d&&this.addElementByRule(e,f,d,f.consuming===!1?c:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
63
|
-
`),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],l=r.getPropertyValue(s);if(l)for(let c=void 0;;){let f=this.parser.matchStyle(s,l,this,c);if(!f)break;if(f.ignore)return null;if(f.clearMark?n=n.filter(d=>!f.clearMark(d)):n=n.concat(this.parser.schema.marks[f.mark].create(f.attrs)),f.consuming===!1)c=f;else break}}return n}addElementByRule(e,n,r,i){let s,l;if(n.node)if(l=this.parser.schema.nodes[n.node],l.isLeaf)this.insertNode(l.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let f=this.enter(l,n.attrs||null,r,n.preserveWhitespace);f&&(s=!0,r=f)}else{let f=this.parser.schema.marks[n.mark];r=r.concat(f.create(n.attrs))}let c=this.top;if(l&&l.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(f=>this.insertNode(f,r,!1));else{let f=e;typeof n.contentElement=="string"?f=e.querySelector(n.contentElement):typeof n.contentElement=="function"?f=n.contentElement(e):n.contentElement&&(f=n.contentElement),this.findAround(e,f,!0),this.addAll(f,r),this.findAround(e,f,!1)}s&&this.sync(c)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let l=r?e.childNodes[r]:e.firstChild,c=i==null?null:e.childNodes[i];l!=c;l=l.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(l,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let l=this.open,c=0;l>=0;l--){let f=this.nodes[l],d=f.findWrapping(e);if(d&&(!i||i.length>d.length+c)&&(i=d,s=f,!d.length))break;if(f.solid){if(r)break;c+=2}}if(!i)return null;this.sync(s);for(let l=0;l<i.length;l++)n=this.enterInner(i[l],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 l=kt.none;for(let c of i.concat(e.marks))(s.type?s.type.allowsMarkType(c.type):JC(c.type,e.type))&&(l=c.addToSet(l));return s.content.push(e.mark(l)),!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 l=this.top;l.match=l.match&&l.match.matchType(e);let c=WC(e,s,l.options);l.options&pu&&l.content.length==0&&(c|=pu);let f=kt.none;return r=r.filter(d=>(l.type?l.type.allowsMarkType(d.type):JC(d.type,e))?(f=d.addToSet(f),!1):!0),this.nodes.push(new qd(e,n,f,i,null,c)),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|=Uu)}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),l=(c,f)=>{for(;c>=0;c--){let d=n[c];if(d==""){if(c==n.length-1||c==0)continue;for(;f>=s;f--)if(l(c-1,f))return!0;return!1}else{let p=f>0||f==0&&i?this.nodes[f].type:r&&f>=s?r.node(f-s).type:null;if(!p||p.name!=d&&!p.isInGroup(d))return!1;f--}}return!0};return l(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 q3(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&BM.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Y3(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function ZC(t){let e={};for(let n in t)e[n]=t[n];return e}function JC(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],l=c=>{s.push(c);for(let f=0;f<c.edgeCount;f++){let{type:d,next:p}=c.edge(f);if(d==e||s.indexOf(p)<0&&l(p))return!0}};if(l(i.contentMatch))return!0}}class yl{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Qy(n).createDocumentFragment());let i=r,s=[];return e.forEach(l=>{if(s.length||l.marks.length){let c=0,f=0;for(;c<s.length&&f<l.marks.length;){let d=l.marks[f];if(!this.marks[d.type.name]){f++;continue}if(!d.eq(s[c][0])||d.type.spec.spanning===!1)break;c++,f++}for(;c<s.length;)i=s.pop()[1];for(;f<l.marks.length;){let d=l.marks[f++],p=this.serializeMark(d,l.isInline,n);p&&(s.push([d,i]),i.appendChild(p.dom),i=p.contentDOM||p.dom)}}i.appendChild(this.serializeNodeInner(l,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=bh(Qy(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&&bh(Qy(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return bh(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new yl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=XC(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return XC(e.marks)}}function XC(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Qy(t){return t.document||window.document}const QC=new WeakMap;function K3(t){let e=QC.get(t);return e===void 0&&QC.set(t,e=W3(t)),e}function W3(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 bh(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=K3(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 l=i.indexOf(" ");l>0&&(n=i.slice(0,l),i=i.slice(l+1));let c,f=n?t.createElementNS(n,i):t.createElement(i),d=e[1],p=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){p=2;for(let m in d)if(d[m]!=null){let g=m.indexOf(" ");g>0?f.setAttributeNS(m.slice(0,g),m.slice(g+1),d[m]):m=="style"&&f.style?f.style.cssText=d[m]:f.setAttribute(m,d[m])}}for(let m=p;m<e.length;m++){let g=e[m];if(g===0){if(m<e.length-1||m>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:f,contentDOM:f}}else{let{dom:b,contentDOM:S}=bh(t,g,n,r);if(f.appendChild(b),S){if(c)throw new RangeError("Multiple content holes");c=S}}}return{dom:f,contentDOM:c}}const UM=65535,HM=Math.pow(2,16);function G3(t,e){return t+e*HM}function eE(t){return t&UM}function Z3(t){return(t-(t&UM))/HM}const VM=1,PM=2,xh=4,$M=8;class bb{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&$M)>0}get deletedBefore(){return(this.delInfo&(VM|xh))>0}get deletedAfter(){return(this.delInfo&(PM|xh))>0}get deletedAcross(){return(this.delInfo&xh)>0}}class Er{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Er.empty)return Er.empty}recover(e){let n=0,r=eE(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+Z3(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,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let f=this.ranges[c]-(this.inverted?i:0);if(f>e)break;let d=this.ranges[c+s],p=this.ranges[c+l],m=f+d;if(e<=m){let g=d?e==f?-1:e==m?1:n:n,b=f+i+(g<0?0:p);if(r)return b;let S=e==(n<0?f:m)?null:G3(c/3,e-f),v=e==f?PM:e==m?VM:xh;return(n<0?e!=f:e!=m)&&(v|=$M),new bb(b,v,S)}i+=p-d}return r?e+i:new bb(e+i,0,null)}touches(e,n){let r=0,i=eE(n),s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let f=this.ranges[c]-(this.inverted?r:0);if(f>e)break;let d=this.ranges[c+s],p=f+d;if(e<=p&&c==i*3)return!0;r+=this.ranges[c+l]-d}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 l=this.ranges[i],c=l-(this.inverted?s:0),f=l+(this.inverted?0:s),d=this.ranges[i+n],p=this.ranges[i+r];e(c,c+d,f,f+p),s+=p-d}}invert(){return new Er(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Er.empty:new Er(e<0?[0,-e,0]:[0,0,e])}}Er.empty=new Er([]);class Hu{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 Hu(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 Hu;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 l=this._maps[s],c=l.mapResult(e,n);if(c.recover!=null){let f=this.getMirror(s);if(f!=null&&f>s&&f<this.to){s=f,e=this._maps[f].recover(c.recover);continue}}i|=c.delInfo,e=c.pos}return r?e:new bb(e,i,null)}}const e0=Object.create(null);class Pn{getMap(){return Er.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=e0[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 e0)throw new RangeError("Duplicate use of step JSON ID "+e);return e0[e]=n,n.prototype.jsonID=e,n}}class rn{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new rn(e,null)}static fail(e){return new rn(null,e)}static fromReplace(e,n,r,i){try{return rn.ok(e.replace(n,r,i))}catch(s){if(s instanceof Ph)return rn.fail(s.message);throw s}}}function Lx(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(Lx(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return te.fromArray(r)}class to extends Pn{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 ge(Lx(n.content,(l,c)=>!l.isAtom||!c.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),i),n.openStart,n.openEnd);return rn.fromReplace(e,this.from,this.to,s)}invert(){return new ki(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 to(n.pos,r.pos,this.mark)}merge(e){return e instanceof to&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new to(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 to(n.from,n.to,e.markFromJSON(n.mark))}}Pn.jsonID("addMark",to);class ki extends Pn{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 ge(Lx(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return rn.fromReplace(e,this.from,this.to,r)}invert(){return new to(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 ki(n.pos,r.pos,this.mark)}merge(e){return e instanceof ki&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ki(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 ki(n.from,n.to,e.markFromJSON(n.mark))}}Pn.jsonID("removeMark",ki);class no extends Pn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return rn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return rn.fromReplace(e,this.pos,this.pos+1,new ge(te.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 no(this.pos,n.marks[i]);return new no(this.pos,this.mark)}}return new ol(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new no(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 no(n.pos,e.markFromJSON(n.mark))}}Pn.jsonID("addNodeMark",no);class ol extends Pn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return rn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return rn.fromReplace(e,this.pos,this.pos+1,new ge(te.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new no(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ol(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 ol(n.pos,e.markFromJSON(n.mark))}}Pn.jsonID("removeNodeMark",ol);class pn extends Pn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&xb(e,this.from,this.to)?rn.fail("Structure replace would overwrite content"):rn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Er([this.from,this.to-this.from,this.slice.size])}invert(e){return new pn(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new pn(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof pn)||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?ge.empty:new ge(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pn(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?ge.empty:new ge(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pn(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 pn(n.from,n.to,ge.fromJSON(e,n.slice),!!n.structure)}}Pn.jsonID("replace",pn);class mn extends Pn{constructor(e,n,r,i,s,l,c=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=l,this.structure=c}apply(e){if(this.structure&&(xb(e,this.from,this.gapFrom)||xb(e,this.gapTo,this.to)))return rn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return rn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?rn.fromReplace(e,this.from,this.to,r):rn.fail("Content does not fit in gap")}getMap(){return new Er([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 mn(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 mn(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 mn(n.from,n.to,n.gapFrom,n.gapTo,ge.fromJSON(e,n.slice),n.insert,!!n.structure)}}Pn.jsonID("replaceAround",mn);function xb(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 l=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,i--}}return!1}function J3(t,e,n,r){let i=[],s=[],l,c;t.doc.nodesBetween(e,n,(f,d,p)=>{if(!f.isInline)return;let m=f.marks;if(!r.isInSet(m)&&p.type.allowsMarkType(r.type)){let g=Math.max(d,e),b=Math.min(d+f.nodeSize,n),S=r.addToSet(m);for(let v=0;v<m.length;v++)m[v].isInSet(S)||(l&&l.to==g&&l.mark.eq(m[v])?l.to=b:i.push(l=new ki(g,b,m[v])));c&&c.to==g?c.to=b:s.push(c=new to(g,b,r))}}),i.forEach(f=>t.step(f)),s.forEach(f=>t.step(f))}function X3(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(l,c)=>{if(!l.isInline)return;s++;let f=null;if(r instanceof Xp){let d=l.marks,p;for(;p=r.isInSet(d);)(f||(f=[])).push(p),d=p.removeFromSet(d)}else r?r.isInSet(l.marks)&&(f=[r]):f=l.marks;if(f&&f.length){let d=Math.min(c+l.nodeSize,n);for(let p=0;p<f.length;p++){let m=f[p],g;for(let b=0;b<i.length;b++){let S=i[b];S.step==s-1&&m.eq(i[b].style)&&(g=S)}g?(g.to=d,g.step=s):i.push({style:m,from:Math.max(c,e),to:d,step:s})}}}),i.forEach(l=>t.step(new ki(l.from,l.to,l.style)))}function jx(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),l=[],c=e+1;for(let f=0;f<s.childCount;f++){let d=s.child(f),p=c+d.nodeSize,m=r.matchType(d.type);if(!m)l.push(new pn(c,p,ge.empty));else{r=m;for(let g=0;g<d.marks.length;g++)n.allowsMarkType(d.marks[g].type)||t.step(new ki(c,p,d.marks[g]));if(i&&d.isText&&n.whitespace!="pre"){let g,b=/\r?\n|\r/g,S;for(;g=b.exec(d.text);)S||(S=new ge(te.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),l.push(new pn(c+g.index,c+g.index+g[0].length,S))}}c=p}if(!r.validEnd){let f=r.fillBefore(te.empty,!0);t.replace(c,c,new ge(f,0,0))}for(let f=l.length-1;f>=0;f--)t.step(l[f])}function Q3(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Za(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let l=t.$from.node(r),c=t.$from.index(r)+i,f=t.$to.indexAfter(r)-s;if(r<t.depth&&l.canReplace(c,f,n))return r;if(r==0||l.type.spec.isolating||!Q3(l,c,f))break;c&&(i=1),f<l.childCount&&(s=1)}return null}function e4(t,e,n){let{$from:r,$to:i,depth:s}=e,l=r.before(s+1),c=i.after(s+1),f=l,d=c,p=te.empty,m=0;for(let S=s,v=!1;S>n;S--)v||r.index(S)>0?(v=!0,p=te.from(r.node(S).copy(p)),m++):f--;let g=te.empty,b=0;for(let S=s,v=!1;S>n;S--)v||i.after(S+1)<i.end(S)?(v=!0,g=te.from(i.node(S).copy(g)),b++):d++;t.step(new mn(f,d,l,c,new ge(p.append(g),m,b),p.size-m,!0))}function Ix(t,e,n=null,r=t){let i=t4(t,e),s=i&&n4(r,e);return s?i.map(tE).concat({type:e,attrs:n}).concat(s.map(tE)):null}function tE(t){return{type:t,attrs:null}}function t4(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let l=s.length?s[0]:e;return n.canReplaceWith(r,i,l)?s:null}function n4(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),l=e.contentMatch.findWrapping(s.type);if(!l)return null;let f=(l.length?l[l.length-1]:e).contentMatch;for(let d=r;f&&d<i;d++)f=f.matchType(n.child(d).type);return!f||!f.validEnd?null:l}function r4(t,e,n){let r=te.empty;for(let l=n.length-1;l>=0;l--){if(r.size){let c=n[l].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=te.from(n[l].type.create(n[l].attrs,r))}let i=e.start,s=e.end;t.step(new mn(i,s,i,s,new ge(r,0,0),n.length,!0))}function i4(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,(l,c)=>{let f=typeof i=="function"?i(l):i;if(l.isTextblock&&!l.hasMarkup(r,f)&&s4(t.doc,t.mapping.slice(s).map(c),r)){let d=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",S=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!S?d=!1:!b&&S&&(d=!0)}d===!1&&qM(t,l,c,s),jx(t,t.mapping.slice(s).map(c,1),r,void 0,d===null);let p=t.mapping.slice(s),m=p.map(c,1),g=p.map(c+l.nodeSize,1);return t.step(new mn(m,g,m+1,g-1,new ge(te.from(r.create(f,null,l.marks)),0,0),1,!0)),d===!0&&FM(t,l,c,s),!1}})}function FM(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let l,c=/\r?\n|\r/g;for(;l=c.exec(i.text);){let f=t.mapping.slice(r).map(n+1+s+l.index);t.replaceWith(f,f+1,e.type.schema.linebreakReplacement.create())}}})}function qM(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let l=t.mapping.slice(r).map(n+1+s);t.replaceWith(l,l+1,e.type.schema.text(`
|
|
64
|
-
`))}})}function s4(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function o4(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 l=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,l);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new mn(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new ge(te.from(l),0,0),1,!0))}function us(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,l=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!l.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let d=i.depth-1,p=n-2;d>s;d--,p--){let m=i.node(d),g=i.index(d);if(m.type.spec.isolating)return!1;let b=m.content.cutByIndex(g,m.childCount),S=r&&r[p+1];S&&(b=b.replaceChild(0,S.type.create(S.attrs)));let v=r&&r[p]||m;if(!m.canReplace(g+1,m.childCount)||!v.type.validContent(b))return!1}let c=i.indexAfter(s),f=r&&r[0];return i.node(s).canReplaceWith(c,c,f?f.type:i.node(s+1).type)}function l4(t,e,n=1,r){let i=t.doc.resolve(e),s=te.empty,l=te.empty;for(let c=i.depth,f=i.depth-n,d=n-1;c>f;c--,d--){s=te.from(i.node(c).copy(s));let p=r&&r[d];l=te.from(p?p.type.create(p.attrs,l):i.node(c).copy(l))}t.step(new pn(e,e,new ge(s.append(l),n,n),!0))}function bo(t,e){let n=t.resolve(e),r=n.index();return YM(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function a4(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),l=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(l),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function YM(t,e){return!!(t&&e&&!t.isLeaf&&a4(t,e))}function Qp(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,l,c=r.index(i);if(i==r.depth?(s=r.nodeBefore,l=r.nodeAfter):n>0?(s=r.node(i+1),c++,l=r.node(i).maybeChild(c)):(s=r.node(i).maybeChild(c-1),l=r.node(i+1)),s&&!s.isTextblock&&YM(s,l)&&r.node(i).canReplace(c,c+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function c4(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),l=s.node().type;if(i&&l.inlineContent){let p=l.whitespace=="pre",m=!!l.contentMatch.matchType(i);p&&!m?r=!1:!p&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let p=t.doc.resolve(e+n);qM(t,p.node(),p.before(),c)}l.inlineContent&&jx(t,e+n-1,l,s.node().contentMatchAt(s.index()),r==null);let f=t.mapping.slice(c),d=f.map(e-n);if(t.step(new pn(d,f.map(e+n,-1),ge.empty,!0)),r===!0){let p=t.doc.resolve(d);FM(t,p.node(),p.before(),t.steps.length)}return t}function u4(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 KM(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 l=r.depth;l>=0;l--){let c=l==r.depth?0:r.pos<=(r.start(l+1)+r.end(l+1))/2?-1:1,f=r.index(l)+(c>0?1:0),d=r.node(l),p=!1;if(s==1)p=d.canReplace(f,f,i);else{let m=d.contentMatchAt(f).findWrapping(i.firstChild.type);p=m&&d.canReplaceWith(f,f,m[0])}if(p)return c==0?r.pos:c<0?r.before(l+1):r.after(l+1)}return null}function em(t,e,n=e,r=ge.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return WM(i,s,r)?new pn(e,n,r):new f4(i,s,r).fit()}function WM(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class f4{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=te.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=te.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):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,l=r.depth,c=i.depth;for(;l&&c&&s.childCount==1;)s=s.firstChild.content,l--,c--;let f=new ge(s,l,c);return e>-1?new mn(r.pos,e,this.$to.pos,this.$to.end(),f,n):f.size||r.pos!=this.$to.pos?new pn(r.pos,i.pos,f):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=t0(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let l=i.firstChild;for(let c=this.depth;c>=0;c--){let{type:f,match:d}=this.frontier[c],p,m=null;if(n==1&&(l?d.matchType(l.type)||(m=d.fillBefore(te.from(l),!1)):s&&f.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:c,parent:s,inject:m};if(n==2&&l&&(p=d.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:c,parent:s,wrap:p};if(s&&d.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=t0(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new ge(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=t0(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new ge(au(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new ge(au(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 v=0;v<s.length;v++)this.openFrontierNode(s[v]);let l=this.unplaced,c=r?r.content:l.content,f=l.openStart-e,d=0,p=[],{match:m,type:g}=this.frontier[n];if(i){for(let v=0;v<i.childCount;v++)p.push(i.child(v));m=m.matchFragment(i)}let b=c.size+e-(l.content.size-l.openEnd);for(;d<c.childCount;){let v=c.child(d),C=m.matchType(v.type);if(!C)break;d++,(d>1||f==0||v.content.size)&&(m=C,p.push(GM(v.mark(g.allowedMarks(v.marks)),d==1?f:0,d==c.childCount?b:-1)))}let S=d==c.childCount;S||(b=-1),this.placed=cu(this.placed,n,te.from(p)),this.frontier[n].match=m,S&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,C=c;v<b;v++){let E=C.lastChild;this.frontier.push({type:E.type,match:E.contentMatchAt(E.childCount)}),C=E.content}this.unplaced=S?e==0?ge.empty:new ge(au(l.content,e-1,1),e-1,b<0?l.openEnd:e-1):new ge(au(l.content,e,d),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!n0(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)),l=n0(e,n,i,r,s);if(l){for(let c=n-1;c>=0;c--){let{match:f,type:d}=this.frontier[c],p=n0(e,c,d,f,!0);if(!p||p.childCount)continue e}return{depth:n,fit:l,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=cu(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=cu(this.placed,this.depth,te.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(te.empty,!0);n.childCount&&(this.placed=cu(this.placed,this.frontier.length,n))}}function au(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(au(t.firstChild.content,e-1,n)))}function cu(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(cu(t.lastChild.content,e-1,n)))}function t0(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function GM(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,GM(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(te.empty,!0)))),t.copy(r)}function n0(t,e,n,r,i){let s=t.node(e),l=i?t.indexAfter(e):t.index(e);if(l==s.childCount&&!n.compatibleContent(s.type))return null;let c=r.fillBefore(s.content,!0,l);return c&&!d4(n,s.content,l)?c:null}function d4(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function h4(t){return t.spec.defining||t.spec.definingForContent}function p4(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(WM(i,s,r))return t.step(new pn(e,n,r));let l=JM(i,s);l[l.length-1]==0&&l.pop();let c=-(i.depth+1);l.unshift(c);for(let g=i.depth,b=i.pos-1;g>0;g--,b--){let S=i.node(g).type.spec;if(S.defining||S.definingAsContext||S.isolating)break;l.indexOf(g)>-1?c=g:i.before(g)==b&&l.splice(1,0,-g)}let f=l.indexOf(c),d=[],p=r.openStart;for(let g=r.content,b=0;;b++){let S=g.firstChild;if(d.push(S),b==r.openStart)break;g=S.content}for(let g=p-1;g>=0;g--){let b=d[g],S=h4(b.type);if(S&&!b.sameMarkup(i.node(Math.abs(c)-1)))p=g;else if(S||!b.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let b=(g+p+1)%(r.openStart+1),S=d[b];if(S)for(let v=0;v<l.length;v++){let C=l[(v+f)%l.length],E=!0;C<0&&(E=!1,C=-C);let B=i.node(C-1),I=i.index(C-1);if(B.canReplaceWith(I,I,S.type,S.marks))return t.replace(i.before(C),E?s.after(C):n,new ge(ZM(r.content,0,r.openStart,b),b,r.openEnd))}}let m=t.steps.length;for(let g=l.length-1;g>=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let b=l[g];b<0||(e=i.before(b),n=s.after(b))}}function ZM(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(ZM(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),l=s.fillBefore(t).append(t);t=l.append(s.matchFragment(l).fillBefore(te.empty,!0))}return t}function m4(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=u4(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new ge(te.from(r),0,0))}function g4(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=JM(r,i);for(let l=0;l<s.length;l++){let c=s[l],f=l==s.length-1;if(f&&c==0||r.node(c).type.contentMatch.validEnd)return t.delete(r.start(c),i.end(c));if(c>0&&(f||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return t.delete(r.before(c),i.after(c))}for(let l=1;l<=r.depth&&l<=i.depth;l++)if(e-r.start(l)==r.depth-l&&n>r.end(l)&&i.end(l)-n!=i.depth-l&&r.start(l-1)==i.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),i.index(l-1)))return t.delete(r.before(l),n);t.delete(e,n)}function JM(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 Sa extends Pn{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 rn.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 rn.fromReplace(e,this.pos,this.pos+1,new ge(te.from(i),0,n.isLeaf?0:1))}getMap(){return Er.empty}invert(e){return new Sa(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 Sa(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 Sa(n.pos,n.attr,n.value)}}Pn.jsonID("attr",Sa);class Vu extends Pn{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 rn.ok(r)}getMap(){return Er.empty}invert(e){return new Vu(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 Vu(n.attr,n.value)}}Pn.jsonID("docAttr",Vu);let ja=class extends Error{};ja=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ja.prototype=Object.create(Error.prototype);ja.prototype.constructor=ja;ja.prototype.name="TransformError";class Bx{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Hu}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new ja(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,l,c,f)=>{e=Math.min(e,c),n=Math.max(n,f)})}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=ge.empty){let i=em(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new ge(te.from(r),0,0))}delete(e,n){return this.replace(e,n,ge.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return p4(this,e,n,r),this}replaceRangeWith(e,n,r){return m4(this,e,n,r),this}deleteRange(e,n){return g4(this,e,n),this}lift(e,n){return e4(this,e,n),this}join(e,n=1){return c4(this,e,n),this}wrap(e,n){return r4(this,e,n),this}setBlockType(e,n=e,r,i=null){return i4(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return o4(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Sa(e,n,r)),this}setDocAttribute(e,n){return this.step(new Vu(e,n)),this}addNodeMark(e,n){return this.step(new no(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 kt)n.isInSet(r.marks)&&this.step(new ol(e,n));else{let i=r.marks,s,l=[];for(;s=n.isInSet(i);)l.push(new ol(e,s)),i=s.removeFromSet(i);for(let c=l.length-1;c>=0;c--)this.step(l[c])}return this}split(e,n=1,r){return l4(this,e,n,r),this}addMark(e,n,r){return J3(this,e,n,r),this}removeMark(e,n,r){return X3(this,e,n,r),this}clearIncompatible(e,n,r){return jx(this,e,n,r),this}}const r0=Object.create(null);class je{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new XM(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=ge.empty){let r=n.content.lastChild,i=null;for(let c=0;c<n.openEnd;c++)i=r,r=r.lastChild;let s=e.steps.length,l=this.ranges;for(let c=0;c<l.length;c++){let{$from:f,$to:d}=l[c],p=e.mapping.slice(s);e.replaceRange(p.map(f.pos),p.map(d.pos),c?ge.empty:n),c==0&&iE(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:l,$to:c}=i[s],f=e.mapping.slice(r),d=f.map(l.pos),p=f.map(c.pos);s?e.deleteRange(d,p):(e.replaceRangeWith(d,p,n),iE(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new Oe(e):da(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 l=n<0?da(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):da(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(l)return l}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new ar(e.node(0))}static atStart(e){return da(e,e,0,0,1)||new ar(e)}static atEnd(e){return da(e,e,e.content.size,e.childCount,-1)||new ar(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=r0[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 r0)throw new RangeError("Duplicate use of selection JSON ID "+e);return r0[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Oe.between(this.$anchor,this.$head).getBookmark()}}je.prototype.visible=!0;class XM{constructor(e,n){this.$from=e,this.$to=n}}let nE=!1;function rE(t){!nE&&!t.parent.inlineContent&&(nE=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Oe extends je{constructor(e,n=e){rE(e),rE(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 je.near(r);let i=e.resolve(n.map(this.anchor));return new Oe(i.parent.inlineContent?i:r,r)}replace(e,n=ge.empty){if(super.replace(e,n),n==ge.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Oe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new tm(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 Oe(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=je.findFrom(n,r,!0)||je.findFrom(n,-r,!0);if(s)n=s.$head;else return je.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(je.findFrom(e,-r,!0)||je.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new Oe(e,n)}}je.jsonID("text",Oe);class tm{constructor(e,n){this.anchor=e,this.head=n}map(e){return new tm(e.map(this.anchor),e.map(this.head))}resolve(e){return Oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ee extends je{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?je.near(s):new Ee(s)}content(){return new ge(te.from(this.node),0,0)}eq(e){return e instanceof Ee&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ux(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ee(e.resolve(n.anchor))}static create(e,n){return new Ee(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ee.prototype.visible=!1;je.jsonID("node",Ee);class Ux{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new tm(r,r):new Ux(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Ee.isSelectable(r)?new Ee(n):je.near(n)}}class ar extends je{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ge.empty){if(n==ge.empty){e.delete(0,e.doc.content.size);let r=je.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ar(e)}map(e){return new ar(e)}eq(e){return e instanceof ar}getBookmark(){return y4}}je.jsonID("all",ar);const y4={map(){return this},resolve(t){return new ar(t)}};function da(t,e,n,r,i,s=!1){if(e.inlineContent)return Oe.create(t,n);for(let l=r-(i>0?0:1);i>0?l<e.childCount:l>=0;l+=i){let c=e.child(l);if(c.isAtom){if(!s&&Ee.isSelectable(c))return Ee.create(t,n-(i<0?c.nodeSize:0))}else{let f=da(t,c,n+i,i<0?c.childCount:0,i,s);if(f)return f}n+=c.nodeSize*i}return null}function iE(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof pn||i instanceof mn))return;let s=t.mapping.maps[r],l;s.forEach((c,f,d,p)=>{l==null&&(l=p)}),t.setSelection(je.near(t.doc.resolve(l),n))}const sE=1,Yd=2,oE=4;let b4=class extends Bx{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|sE)&~Yd,this.storedMarks=null,this}get selectionSet(){return(this.updated&sE)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Yd,this}ensureMarks(e){return kt.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&Yd)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Yd,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)||kt.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 l=this.doc.resolve(n);s=r==n?l.marks():l.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(je.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|=oE,this}get scrolledIntoView(){return(this.updated&oE)>0}};function lE(t,e){return!e||!t?t:t.bind(e)}class uu{constructor(e,n,r){this.name=e,this.init=lE(n.init,r),this.apply=lE(n.apply,r)}}const x4=[new uu("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new uu("selection",{init(t,e){return t.selection||je.atStart(e.doc)},apply(t){return t.selection}}),new uu("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new uu("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class i0{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=x4.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 uu(r.key,r.spec.state,r))})}}class ga{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 l=0;l<this.config.plugins.length;l++){let c=this.config.plugins[l];if(c.spec.appendTransaction){let f=i?i[l].n:0,d=i?i[l].state:this,p=f<n.length&&c.spec.appendTransaction.call(c,f?n.slice(f):n,d,r);if(p&&r.filterTransaction(p,l)){if(p.setMeta("appendedTransaction",e),!i){i=[];for(let m=0;m<this.config.plugins.length;m++)i.push(m<l?{state:r,n:n.length}:{state:this,n:0})}n.push(p),r=r.applyInner(p),s=!0}i&&(i[l]={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 ga(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 b4(this)}static create(e){let n=new i0(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ga(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 i0(this.schema,e.plugins),r=n.fields,i=new ga(n);for(let s=0;s<r.length;s++){let l=r[s].name;i[l]=this.hasOwnProperty(l)?this[l]: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 i0(e.schema,e.plugins),s=new ga(i);return i.fields.forEach(l=>{if(l.name=="doc")s.doc=oo.fromJSON(e.schema,n.doc);else if(l.name=="selection")s.selection=je.fromJSON(s.doc,n.selection);else if(l.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let f=r[c],d=f.spec.state;if(f.key==l.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){s[l.name]=d.fromJSON.call(f,e,n[c],s);return}}s[l.name]=l.init(e,s)}}),s}}function QM(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=QM(i,e,{})),n[r]=i}return n}class xt{constructor(e){this.spec=e,this.props={},e.props&&QM(e.props,this,this.props),this.key=e.key?e.key.key:eO("plugin")}getState(e){return e[this.key]}}const s0=Object.create(null);function eO(t){return t in s0?t+"$"+ ++s0[t]:(s0[t]=0,t+"$")}class Dt{constructor(e="key"){this.key=eO(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Dn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ia=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Sb=null;const as=function(t,e,n){let r=Sb||(Sb=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},S4=function(){Sb=null},ll=function(t,e,n,r){return n&&(aE(t,e,n,r,-1)||aE(t,e,n,r,1))},w4=/^(img|br|input|textarea|hr)$/i;function aE(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:qr(t))){let l=t.parentNode;if(!l||l.nodeType!=1||mf(t)||w4.test(t.nodeName)||t.contentEditable=="false")return!1;e=Dn(t)+(i<0?0:1),t=l}else if(t.nodeType==1){let l=t.childNodes[e+(i<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((s=l.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=l,e=i<0?qr(t):0}else return!1}}function qr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function v4(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=qr(t)}else if(t.parentNode&&!mf(t))e=Dn(t),t=t.parentNode;else return null}}function k4(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&&!mf(t))e=Dn(t)+1,t=t.parentNode;else return null}}function C4(t,e,n){for(let r=e==0,i=e==qr(t);r||i;){if(t==n)return!0;let s=Dn(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==qr(t)}}function mf(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 nm=function(t){return t.focusNode&&ll(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Po(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function E4(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function T4(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(qr(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(qr(r.startContainer),r.startOffset)}}}const Ai=typeof navigator<"u"?navigator:null,cE=typeof document<"u"?document:null,xo=Ai&&Ai.userAgent||"",wb=/Edge\/(\d+)/.exec(xo),tO=/MSIE \d/.exec(xo),vb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(xo),cr=!!(tO||vb||wb),lo=tO?document.documentMode:vb?+vb[1]:wb?+wb[1]:0,Gr=!cr&&/gecko\/(\d+)/i.test(xo);Gr&&+(/Firefox\/(\d+)/.exec(xo)||[0,0])[1];const kb=!cr&&/Chrome\/(\d+)/.exec(xo),Nn=!!kb,nO=kb?+kb[1]:0,Un=!cr&&!!Ai&&/Apple Computer/.test(Ai.vendor),Ba=Un&&(/Mobile\/\w+/.test(xo)||!!Ai&&Ai.maxTouchPoints>2),$r=Ba||(Ai?/Mac/.test(Ai.platform):!1),rO=Ai?/Win/.test(Ai.platform):!1,cs=/Android \d/.test(xo),gf=!!cE&&"webkitFontSmoothing"in cE.documentElement.style,A4=gf?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function M4(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 ts(t,e){return typeof t=="number"?t:t[e]}function O4(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 uE(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let l=n||t.dom;l;){if(l.nodeType!=1){l=Ia(l);continue}let c=l,f=c==s.body,d=f?M4(s):O4(c),p=0,m=0;if(e.top<d.top+ts(r,"top")?m=-(d.top-e.top+ts(i,"top")):e.bottom>d.bottom-ts(r,"bottom")&&(m=e.bottom-e.top>d.bottom-d.top?e.top+ts(i,"top")-d.top:e.bottom-d.bottom+ts(i,"bottom")),e.left<d.left+ts(r,"left")?p=-(d.left-e.left+ts(i,"left")):e.right>d.right-ts(r,"right")&&(p=e.right-d.right+ts(i,"right")),p||m)if(f)s.defaultView.scrollBy(p,m);else{let b=c.scrollLeft,S=c.scrollTop;m&&(c.scrollTop+=m),p&&(c.scrollLeft+=p);let v=c.scrollLeft-b,C=c.scrollTop-S;e={left:e.left-v,top:e.top-C,right:e.right-v,bottom:e.bottom-C}}let g=f?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(g))break;l=g=="absolute"?l.offsetParent:Ia(l)}}function _4(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,l=n+1;l<Math.min(innerHeight,e.bottom);l+=5){let c=t.root.elementFromPoint(s,l);if(!c||c==t.dom||!t.dom.contains(c))continue;let f=c.getBoundingClientRect();if(f.top>=n-20){r=c,i=f.top;break}}return{refDOM:r,refTop:i,stack:iO(t.dom)}}function iO(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Ia(r));return e}function D4({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;sO(n,r==0?0:r-e)}function sO(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 oa=null;function R4(t){if(t.setActive)return t.setActive();if(oa)return t.focus(oa);let e=iO(t);t.focus(oa==null?{get preventScroll(){return oa={preventScroll:!0},!0}}:void 0),oa||(oa=!1,sO(e,0))}function oO(t,e){let n,r=2e8,i,s=0,l=e.top,c=e.top,f,d;for(let p=t.firstChild,m=0;p;p=p.nextSibling,m++){let g;if(p.nodeType==1)g=p.getClientRects();else if(p.nodeType==3)g=as(p).getClientRects();else continue;for(let b=0;b<g.length;b++){let S=g[b];if(S.top<=l&&S.bottom>=c){l=Math.max(S.bottom,l),c=Math.min(S.top,c);let v=S.left>e.left?S.left-e.left:S.right<e.left?e.left-S.right:0;if(v<r){n=p,r=v,i=v&&n.nodeType==3?{left:S.right<e.left?S.right:S.left,top:e.top}:e,p.nodeType==1&&v&&(s=m+(e.left>=(S.left+S.right)/2?1:0));continue}}else S.top>e.top&&!f&&S.left<=e.left&&S.right>=e.left&&(f=p,d={left:Math.max(S.left,Math.min(S.right,e.left)),top:S.top});!n&&(e.left>=S.right&&e.top>=S.top||e.left>=S.left&&e.top>=S.bottom)&&(s=m+1)}}return!n&&f&&(n=f,i=d,r=0),n&&n.nodeType==3?N4(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:oO(n,i)}function N4(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 l=Ys(r,1);if(l.top!=l.bottom&&Hx(e,l)){i={node:t,offset:s+(e.left>=(l.left+l.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function Hx(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function z4(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function L4(t,e,n){let{node:r,offset:i}=oO(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let l=r.getBoundingClientRect();s=l.left!=l.right&&n.left>(l.left+l.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function j4(t,e,n,r){let i=-1;for(let s=e,l=!1;s!=t.dom;){let c=t.docView.nearestDesc(s,!0),f;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((f=c.dom.getBoundingClientRect()).width||f.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!l&&f.left>r.left||f.top>r.top?i=c.posBefore:(!l&&f.right<r.left||f.bottom<r.top)&&(i=c.posAfter),l=!0),!c.contentDOM&&i<0&&!c.node.isText))return(c.node.isBlock?r.top<(f.top+f.bottom)/2:r.left<(f.left+f.right)/2)?c.posBefore:c.posAfter;s=c.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function lO(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 l=t.childNodes[s];if(l.nodeType==1){let c=l.getClientRects();for(let f=0;f<c.length;f++){let d=c[f];if(Hx(e,d))return lO(l,e,d)}}if((s=(s+1)%r)==i)break}return t}function I4(t,e){let n=t.dom.ownerDocument,r,i=0,s=T4(n,e.left,e.top);s&&({node:r,offset:i}=s);let l=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),c;if(!l||!t.dom.contains(l.nodeType!=1?l.parentNode:l)){let d=t.dom.getBoundingClientRect();if(!Hx(e,d)||(l=lO(t.dom,e,d),!l))return null}if(Un)for(let d=l;r&&d;d=Ia(d))d.draggable&&(r=void 0);if(l=z4(l,e),r){if(Gr&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let p=r.childNodes[i],m;p.nodeName=="IMG"&&(m=p.getBoundingClientRect()).right<=e.left&&m.bottom>e.top&&i++}let d;gf&&i&&r.nodeType==1&&(d=r.childNodes[i-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(c=j4(t,r,i,e))}c==null&&(c=L4(t,l,e));let f=t.docView.nearestDesc(l,!0);return{pos:c,inside:f?f.posAtStart-f.border:-1}}function fE(t){return t.top<t.bottom||t.left<t.right}function Ys(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(fE(r))return r}return Array.prototype.find.call(n,fE)||t.getBoundingClientRect()}const B4=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function aO(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),l=gf||Gr;if(r.nodeType==3)if(l&&(B4.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let f=Ys(as(r,i,i),n);if(Gr&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=Ys(as(r,i-1,i-1),-1);if(d.top==f.top){let p=Ys(as(r,i,i+1),-1);if(p.top!=f.top)return eu(p,p.left<d.left)}}return f}else{let f=i,d=i,p=n<0?1:-1;return n<0&&!i?(d++,p=-1):n>=0&&i==r.nodeValue.length?(f--,p=1):n<0?f--:d++,eu(Ys(as(r,f,d),p),p<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==qr(r))){let f=r.childNodes[i-1];if(f.nodeType==1)return o0(f.getBoundingClientRect(),!1)}if(s==null&&i<qr(r)){let f=r.childNodes[i];if(f.nodeType==1)return o0(f.getBoundingClientRect(),!0)}return o0(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==qr(r))){let f=r.childNodes[i-1],d=f.nodeType==3?as(f,qr(f)-(l?0:1)):f.nodeType==1&&(f.nodeName!="BR"||!f.nextSibling)?f:null;if(d)return eu(Ys(d,1),!1)}if(s==null&&i<qr(r)){let f=r.childNodes[i];for(;f.pmViewDesc&&f.pmViewDesc.ignoreForCoords;)f=f.nextSibling;let d=f?f.nodeType==3?as(f,0,l?0:1):f.nodeType==1?f:null:null;if(d)return eu(Ys(d,-1),!0)}return eu(Ys(r.nodeType==3?as(r):r,-n),n>=0)}function eu(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 o0(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 cO(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 U4(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return cO(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(s,!0);if(!c)break;if(c.node.isBlock){s=c.contentDOM||c.dom;break}s=c.dom.parentNode}let l=aO(t,i.pos,1);for(let c=s.firstChild;c;c=c.nextSibling){let f;if(c.nodeType==1)f=c.getClientRects();else if(c.nodeType==3)f=as(c,0,c.nodeValue.length).getClientRects();else continue;for(let d=0;d<f.length;d++){let p=f[d];if(p.bottom>p.top+1&&(n=="up"?l.top-p.top>(p.bottom-l.top)*2:p.bottom-l.bottom>(l.bottom-p.top)*2))return!1}}return!0})}const H4=/[\u0590-\u08ac]/;function V4(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,l=i==r.parent.content.size,c=t.domSelection();return c?!H4.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?s:l:cO(t,e,()=>{let{focusNode:f,focusOffset:d,anchorNode:p,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:S,focusOffset:v}=t.domSelectionRange(),C=S&&!b.contains(S.nodeType==1?S:S.parentNode)||f==S&&d==v;try{c.collapse(p,m),f&&(f!=p||d!=m)&&c.extend&&c.extend(f,d)}catch{}return g!=null&&(c.caretBidiLevel=g),C}):r.pos==r.start()||r.pos==r.end()}let dE=null,hE=null,pE=!1;function P4(t,e,n){return dE==e&&hE==n?pE:(dE=e,hE=n,pE=n=="up"||n=="down"?U4(t,e,n):V4(t,e,n))}const Zr=0,mE=1,Yo=2,Mi=3;class yf{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Zr,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,l;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(l)+l.size:this.posAtStart}else{let s,l;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(l):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Dn(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),l;if(s&&(!n||s.node))if(r&&(l=s.nodeDOM)&&!(l.nodeType==1?l.contains(e.nodeType==1?e:e.parentNode):l==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 l=0;l<i.children.length;l++){let c=i.children[l];if(c.size){i=c;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 l=this.children[r],c=s+l.size;if(c>e||l instanceof fO){i=e-s;break}s=c}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 uO&&s.side>=0;r--);if(n<=0){let s,l=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,l=!1);return s&&n&&l&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Dn(s.dom)+1:0}}else{let s,l=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,l=!1);return s&&l&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Dn(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 l=r,c=0;;c++){let f=this.children[c],d=l+f.size;if(i==-1&&e<=d){let p=l+f.border;if(e>=p&&n<=d-f.border&&f.node&&f.contentDOM&&this.contentDOM.contains(f.contentDOM))return f.parseRange(e,n,p);e=l;for(let m=c;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){i=Dn(g.dom)+1;break}e-=g.size}i==-1&&(i=0)}if(i>-1&&(d>n||c==this.children.length-1)){n=d;for(let p=c+1;p<this.children.length;p++){let m=this.children[p];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(-1)){s=Dn(m.dom);break}n+=m.size}s==-1&&(s=this.contentDOM.childNodes.length);break}l=d}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),l=Math.max(e,n);for(let b=0,S=0;b<this.children.length;b++){let v=this.children[b],C=S+v.size;if(s>S&&l<C)return v.setSelection(e-S-v.border,n-S-v.border,r,i);S=C}let c=this.domFromPos(e,e?-1:1),f=n==e?c:this.domFromPos(n,n?-1:1),d=r.root.getSelection(),p=r.domSelectionRange(),m=!1;if((Gr||Un)&&e==n){let{node:b,offset:S}=c;if(b.nodeType==3){if(m=!!(S&&b.nodeValue[S-1]==`
|
|
65
|
-
`),m&&S==b.nodeValue.length)for(let v=b,C;v;v=v.parentNode){if(C=v.nextSibling){C.nodeName=="BR"&&(c=f={node:C.parentNode,offset:Dn(C)+1});break}let E=v.pmViewDesc;if(E&&E.node&&E.node.isBlock)break}}else{let v=b.childNodes[S-1];m=v&&(v.nodeName=="BR"||v.contentEditable=="false")}}if(Gr&&p.focusNode&&p.focusNode!=f.node&&p.focusNode.nodeType==1){let b=p.focusNode.childNodes[p.focusOffset];b&&b.contentEditable=="false"&&(i=!0)}if(!(i||m&&Un)&&ll(c.node,c.offset,p.anchorNode,p.anchorOffset)&&ll(f.node,f.offset,p.focusNode,p.focusOffset))return;let g=!1;if((d.extend||e==n)&&!(m&&Gr)){d.collapse(c.node,c.offset);try{e!=n&&d.extend(f.node,f.offset),g=!0}catch{}}if(!g){if(e>n){let S=c;c=f,f=S}let b=document.createRange();b.setEnd(f.node,f.offset),b.setStart(c.node,c.offset),d.removeAllRanges(),d.addRange(b)}}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],l=r+s.size;if(r==l?e<=l&&n>=r:e<l&&n>r){let c=r+s.border,f=l-s.border;if(e>=c&&n<=f){this.dirty=e==r||n==l?Yo:mE,e==c&&n==f&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Mi:s.markDirty(e-c,n-c);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Yo:Mi}r=l}this.dirty=Yo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Yo:mE;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class uO extends yf{constructor(e,n,r,i){let s,l=n.type.toDOM;if(typeof l=="function"&&(l=l(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(l.nodeType!=1){let c=document.createElement("span");c.appendChild(l),l=c}l.contentEditable="false",l.classList.add("ProseMirror-widget")}super(e,[],l,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Zr&&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 $4 extends yf{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 al extends yf{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],l=s&&s(n,i,r);return(!l||!l.dom)&&(l=yl.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new al(e,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Mi||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Mi&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Zr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Zr}}slice(e,n,r){let i=al.create(this.parent,this.mark,!0,r),s=this.children,l=this.size;n<l&&(s=Eb(s,n,l,r)),e>0&&(s=Eb(s,0,e,r));for(let c=0;c<s.length;c++)s[c].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 ao extends yf{constructor(e,n,r,i,s,l,c,f,d){super(e,[],s,l),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=c}static create(e,n,r,i,s,l){let c=s.nodeViews[n.type.name],f,d=c&&c(n,s,()=>{if(!f)return l;if(f.parent)return f.parent.posBeforeChild(f)},r,i),p=d&&d.dom,m=d&&d.contentDOM;if(n.isText){if(!p)p=document.createTextNode(n.text);else if(p.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else p||({dom:p,contentDOM:m}=yl.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&p.nodeName!="BR"&&(p.hasAttribute("contenteditable")||(p.contentEditable="false"),n.type.spec.draggable&&(p.draggable=!0));let g=p;return p=pO(p,r,n),d?f=new F4(e,n,r,i,p,m||null,g,d,s,l+1):n.isText?new rm(e,n,r,i,p,g,s):new ao(e,n,r,i,p,m||null,g,s,l+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=()=>te.empty)}return e}matchesNode(e,n,r){return this.dirty==Zr&&e.eq(this.node)&&Yh(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,l=s&&s.pos>-1?s:null,c=s&&s.pos<0,f=new Y4(this,l&&l.node,e);G4(this.node,this.innerDeco,(d,p,m)=>{d.spec.marks?f.syncToMarks(d.spec.marks,r,e,p):d.type.side>=0&&!m&&f.syncToMarks(p==this.node.childCount?kt.none:this.node.child(p).marks,r,e,p),f.placeWidget(d,e,i)},(d,p,m,g)=>{f.syncToMarks(d.marks,r,e,g);let b;f.findNodeMatch(d,p,m,g)||c&&e.state.selection.from>i&&e.state.selection.to<i+d.nodeSize&&(b=f.findIndexWithChild(s.node))>-1&&f.updateNodeAt(d,p,m,b,e)||f.updateNextNode(d,p,m,e,g,i)||f.addNode(d,p,m,e,i),i+=d.nodeSize}),f.syncToMarks([],r,e,0),this.node.isTextblock&&f.addTextblockHacks(),f.destroyRest(),(f.changed||this.dirty==Yo)&&(l&&this.protectLocalComposition(e,l),dO(this.contentDOM,this.children,e),Ba&&Z4(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Oe)||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 l=s.nodeValue,c=J4(this.node.content,l,r-n,i-n);return c<0?null:{node:s,pos:c,text:l}}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 l=new $4(this,s,n,i);e.input.compositionNodes.push(l),this.children=Eb(this.children,r,r+i.length,e,l)}update(e,n,r,i){return this.dirty==Mi||!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=Zr}updateOuterDeco(e){if(Yh(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=hO(this.dom,this.nodeDOM,Cb(this.outerDeco,this.node,n),Cb(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 gE(t,e,n,r,i){pO(r,e,t);let s=new ao(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class rm extends ao{constructor(e,n,r,i,s,l,c){super(e,n,r,i,s,null,l,c,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==Mi||this.dirty!=Zr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Zr||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=Zr,!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 rm(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=Mi)}get domAtom(){return!1}isText(e){return this.node.text==e}}class fO extends yf{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Zr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class F4 extends ao{constructor(e,n,r,i,s,l,c,f,d,p){super(e,n,r,i,s,l,c,d,p),this.spec=f}update(e,n,r,i){if(this.dirty==Mi)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 dO(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let l=e[s],c=l.dom;if(c.parentNode==t){for(;c!=r;)r=yE(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(c,r);if(l instanceof al){let f=r?r.previousSibling:t.lastChild;dO(l.contentDOM,l.children,n),r=f?f.nextSibling:t.firstChild}}for(;r;)r=yE(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const mu=function(t){t&&(this.nodeName=t)};mu.prototype=Object.create(null);const Ko=[new mu];function Cb(t,e,n){if(t.length==0)return Ko;let r=n?Ko[0]:new mu,i=[r];for(let s=0;s<t.length;s++){let l=t[s].type.attrs;if(l){l.nodeName&&i.push(r=new mu(l.nodeName));for(let c in l){let f=l[c];f!=null&&(n&&i.length==1&&i.push(r=new mu(e.isInline?"span":"div")),c=="class"?r.class=(r.class?r.class+" ":"")+f:c=="style"?r.style=(r.style?r.style+";":"")+f:c!="nodeName"&&(r[c]=f))}}}return i}function hO(t,e,n,r){if(n==Ko&&r==Ko)return e;let i=e;for(let s=0;s<r.length;s++){let l=r[s],c=n[s];if(s){let f;c&&c.nodeName==l.nodeName&&i!=t&&(f=i.parentNode)&&f.nodeName.toLowerCase()==l.nodeName||(f=document.createElement(l.nodeName),f.pmIsDeco=!0,f.appendChild(i),c=Ko[0]),i=f}q4(i,c||Ko[0],l)}return i}function q4(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 pO(t,e,n){return hO(t,t,Ko,Cb(e,n,t.nodeType!=1))}function Yh(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 yE(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Y4{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=K4(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,l=this.stack.length>>1,c=Math.min(l,e.length);for(;s<c&&(s==l-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<l;)this.destroyRest(),this.top.dirty=Zr,this.index=this.stack.pop(),this.top=this.stack.pop(),l--;for(;l<e.length;){this.stack.push(this.top,this.index+1);let f=-1,d=this.top.children.length;i<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let p=this.index;p<d;p++){let m=this.top.children[p];if(m.matchesMark(e[l])&&!this.isLocked(m.dom)){f=p;break}}if(f>-1)f>this.index&&(this.changed=!0,this.destroyBetween(this.index,f)),this.top=this.top.children[this.index];else{let p=al.create(this.top,e[l],n,r);this.top.children.splice(this.index,0,p),this.top=p,this.changed=!0}this.index=0,l++}}findNodeMatch(e,n,r,i){let s=-1,l;if(i>=this.preMatch.index&&(l=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&l.matchesNode(e,n,r))s=this.top.children.indexOf(l,this.index);else for(let c=this.index,f=Math.min(this.top.children.length,c+5);c<f;c++){let d=this.top.children[c];if(d.matchesNode(e,n,r)&&!this.preMatch.matched.has(d)){s=c;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let l=this.top.children[i];return l.dirty==Mi&&l.dom==l.contentDOM&&(l.dirty=Yo),l.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,l){for(let c=this.index;c<this.top.children.length;c++){let f=this.top.children[c];if(f instanceof ao){let d=this.preMatch.matched.get(f);if(d!=null&&d!=s)return!1;let p=f.dom,m,g=this.isLocked(p)&&!(e.isText&&f.node&&f.node.isText&&f.nodeDOM.nodeValue==e.text&&f.dirty!=Mi&&Yh(n,f.outerDeco));if(!g&&f.update(e,n,r,i))return this.destroyBetween(this.index,c),f.dom!=p&&(this.changed=!0),this.index++,!0;if(!g&&(m=this.recreateWrapper(f,e,n,r,i,l)))return this.destroyBetween(this.index,c),this.top.children[this.index]=m,m.contentDOM&&(m.dirty=Yo,m.updateChildren(i,l+1),m.dirty=Zr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,l){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Yh(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let c=ao.create(this.top,n,r,i,s,l);if(c.contentDOM){c.children=e.children,e.children=[];for(let f of c.children)f.parent=c}return e.destroy(),c}addNode(e,n,r,i,s){let l=ao.create(this.top,e,n,r,i,s);l.contentDOM&&l.updateChildren(i,s+1),this.top.children.splice(this.index++,0,l),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 uO(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 al;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof rm)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Un||Nn)&&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 fO(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 K4(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,l=[];e:for(;i>0;){let c;for(;;)if(r){let d=n.children[r-1];if(d instanceof al)n=d,r=d.children.length;else{c=d,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let f=c.node;if(f){if(f!=t.child(i-1))break;--i,s.set(c,i),l.push(c)}}return{index:i,matched:s,matches:l.reverse()}}function W4(t,e){return t.type.side-e.type.side}function G4(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let d=0;d<t.childCount;d++){let p=t.child(d);r(p,i,e.forChild(s,p),d),s+=p.nodeSize}return}let l=0,c=[],f=null;for(let d=0;;){let p,m;for(;l<i.length&&i[l].to==s;){let C=i[l++];C.widget&&(p?(m||(m=[p])).push(C):p=C)}if(p)if(m){m.sort(W4);for(let C=0;C<m.length;C++)n(m[C],d,!!f)}else n(p,d,!!f);let g,b;if(f)b=-1,g=f,f=null;else if(d<t.childCount)b=d,g=t.child(d++);else break;for(let C=0;C<c.length;C++)c[C].to<=s&&c.splice(C--,1);for(;l<i.length&&i[l].from<=s&&i[l].to>s;)c.push(i[l++]);let S=s+g.nodeSize;if(g.isText){let C=S;l<i.length&&i[l].from<C&&(C=i[l].from);for(let E=0;E<c.length;E++)c[E].to<C&&(C=c[E].to);C<S&&(f=g.cut(C-s),g=g.cut(0,C-s),S=C,b=-1)}else for(;l<i.length&&i[l].to<S;)l++;let v=g.isInline&&!g.isLeaf?c.filter(C=>!C.inline):c.slice();r(g,v,e.forChild(s,g),b),s=S}}function Z4(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 J4(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let l=t.child(i++),c=s;if(s+=l.nodeSize,!l.isText)continue;let f=l.text;for(;i<t.childCount;){let d=t.child(i++);if(s+=d.nodeSize,!d.isText)break;f+=d.text}if(s>=n){if(s>=r&&f.slice(r-e.length-c,r-c)==e)return r-e.length;let d=c<r?f.lastIndexOf(e,r-c-1):-1;if(d>=0&&d+e.length+c>=n)return c+d;if(n==r&&f.length>=r+e.length-c&&f.slice(r-c,r-c+e.length)==e)return r}}return-1}function Eb(t,e,n,r,i){let s=[];for(let l=0,c=0;l<t.length;l++){let f=t[l],d=c,p=c+=f.size;d>=n||p<=e?s.push(f):(d<e&&s.push(f.slice(0,e-d,r)),i&&(s.push(i),i=void 0),p>n&&s.push(f.slice(n-d,f.size,r)))}return s}function Vx(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,l=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let c=r.resolve(l),f,d;if(nm(n)){for(f=l;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&Ee.isSelectable(m)&&i.parent&&!(m.isInline&&C4(n.focusNode,n.focusOffset,i.dom))){let g=i.posBefore;d=new Ee(l==g?c:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=l,g=l;for(let b=0;b<n.rangeCount;b++){let S=n.getRangeAt(b);m=Math.min(m,t.docView.posFromDOM(S.startContainer,S.startOffset,1)),g=Math.max(g,t.docView.posFromDOM(S.endContainer,S.endOffset,-1))}if(m<0)return null;[f,l]=g==t.state.selection.anchor?[g,m]:[m,g],c=r.resolve(l)}else f=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(f<0)return null}let p=r.resolve(f);if(!d){let m=e=="pointer"||t.state.selection.head<c.pos&&!s?1:-1;d=Px(t,p,c,m)}return d}function mO(t){return t.editable?t.hasFocus():yO(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function fs(t,e=!1){let n=t.state.selection;if(gO(t,n),!!mO(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Nn){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ll(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Q4(t);else{let{anchor:r,head:i}=n,s,l;bE&&!(n instanceof Oe)&&(n.$from.parent.inlineContent||(s=xE(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=xE(t,n.to))),t.docView.setSelection(r,i,t,e),bE&&(s&&SE(s),l&&SE(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&X4(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const bE=Un||Nn&&nO<63;function xE(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(Un&&i&&i.contentEditable=="false")return l0(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return l0(i);if(s)return l0(s)}}function l0(t){return t.contentEditable="true",Un&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function SE(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function X4(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(()=>{(!mO(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Q4(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Dn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&cr&&lo<=11&&(n.disabled=!0,n.disabled=!1)}function gO(t,e){if(e instanceof Ee){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(wE(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else wE(t)}function wE(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Px(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Oe.between(e,n,r)}function vE(t){return t.editable&&!t.hasFocus()?!1:yO(t)}function yO(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 eL(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ll(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Tb(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&&je.findFrom(s,e)}function Ws(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function kE(t,e,n){let r=t.state.selection;if(r instanceof Oe)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 l=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Ws(t,new Oe(r.$anchor,l))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Tb(t.state,e);return i&&i instanceof Ee?Ws(t,i):!1}else if(!($r&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,l;if(!s||s.isText)return!1;let c=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(l=t.docView.descAt(c))&&!l.contentDOM?Ee.isSelectable(s)?Ws(t,new Ee(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):gf?Ws(t,new Oe(t.state.doc.resolve(e<0?c:c+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ee&&r.node.isInline)return Ws(t,new Oe(e>0?r.$to:r.$from));{let i=Tb(t.state,e);return i?Ws(t,i):!1}}}function Kh(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function gu(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function la(t,e){return e<0?tL(t):nL(t)}function tL(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,l=!1;for(Gr&&n.nodeType==1&&r<Kh(n)&&gu(n.childNodes[r],-1)&&(l=!0);;)if(r>0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(gu(c,-1))i=n,s=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(bO(n))break;{let c=n.previousSibling;for(;c&&gu(c,-1);)i=n.parentNode,s=Dn(c),c=c.previousSibling;if(c)n=c,r=Kh(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}l?Ab(t,n,r):i&&Ab(t,i,s)}function nL(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Kh(n),s,l;for(;;)if(r<i){if(n.nodeType!=1)break;let c=n.childNodes[r];if(gu(c,1))s=n,l=++r;else break}else{if(bO(n))break;{let c=n.nextSibling;for(;c&&gu(c,1);)s=c.parentNode,l=Dn(c)+1,c=c.nextSibling;if(c)n=c,r=0,i=Kh(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Ab(t,s,l)}function bO(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function rL(t,e){for(;t&&e==t.childNodes.length&&!mf(t);)e=Dn(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 iL(t,e){for(;t&&!e&&!mf(t);)e=Dn(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 Ab(t,e,n){if(e.nodeType!=3){let s,l;(l=rL(e,n))?(e=l,n=0):(s=iL(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(nm(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&&fs(t)},50)}function CE(t,e){let n=t.state.doc.resolve(e);if(!(Nn||rO)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),l=(s.top+s.bottom)/2;if(l>i.top&&l<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),l=(s.top+s.bottom)/2;if(l>i.top&&l<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 EE(t,e,n){let r=t.state.selection;if(r instanceof Oe&&!r.empty||n.indexOf("s")>-1||$r&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let l=Tb(t.state,e);if(l&&l instanceof Ee)return Ws(t,l)}if(!i.parent.inlineContent){let l=e<0?i:s,c=r instanceof ar?je.near(l,e):je.findFrom(l,e);return c?Ws(t,c):!1}return!1}function TE(t,e){if(!(t.state.selection instanceof Oe))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 l=t.state.tr;return e<0?l.delete(n.pos-s.nodeSize,n.pos):l.delete(n.pos,n.pos+s.nodeSize),t.dispatch(l),!0}return!1}function AE(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function sL(t){if(!Un||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;AE(t,r,"true"),setTimeout(()=>AE(t,r,"false"),20)}return!1}function oL(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function lL(t,e){let n=e.keyCode,r=oL(e);if(n==8||$r&&n==72&&r=="c")return TE(t,-1)||la(t,-1);if(n==46&&!e.shiftKey||$r&&n==68&&r=="c")return TE(t,1)||la(t,1);if(n==13||n==27)return!0;if(n==37||$r&&n==66&&r=="c"){let i=n==37?CE(t,t.state.selection.from)=="ltr"?-1:1:-1;return kE(t,i,r)||la(t,i)}else if(n==39||$r&&n==70&&r=="c"){let i=n==39?CE(t,t.state.selection.from)=="ltr"?1:-1:1;return kE(t,i,r)||la(t,i)}else{if(n==38||$r&&n==80&&r=="c")return EE(t,-1,r)||la(t,-1);if(n==40||$r&&n==78&&r=="c")return sL(t)||EE(t,1,r)||la(t,1);if(r==($r?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function $x(t,e){t.someProp("transformCopied",b=>{e=b(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 b=r.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let l=t.someProp("clipboardSerializer")||yl.fromSchema(t.state.schema),c=CO(),f=c.createElement("div");f.appendChild(l.serializeFragment(r,{document:c}));let d=f.firstChild,p,m=0;for(;d&&d.nodeType==1&&(p=kO[d.nodeName.toLowerCase()]);){for(let b=p.length-1;b>=0;b--){let S=c.createElement(p[b]);for(;f.firstChild;)S.appendChild(f.firstChild);f.appendChild(S),m++}d=f.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${i} ${s}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,`
|
|
66
|
-
|
|
67
|
-
`);return{dom:f,text:g,slice:e}}function xO(t,e,n,r,i){let s=i.parent.type.spec.code,l,c;if(!n&&!e)return null;let f=!!e&&(r||s||!n);if(f){if(t.someProp("transformPastedText",g=>{e=g(e,s||r,t)}),s)return c=new ge(te.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
68
|
-
`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,i,r,t));if(m)c=m;else{let g=i.marks(),{schema:b}=t.state,S=yl.fromSchema(b);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(v=>{let C=l.appendChild(document.createElement("p"));v&&C.appendChild(S.serializeNode(b.text(v,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),l=fL(n),gf&&dL(l);let d=l&&l.querySelector("[data-pm-slice]"),p=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let m=+p[3];m>0;m--){let g=l.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;l=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||hu.fromSchema(t.state.schema)).parseSlice(l,{preserveWhitespace:!!(f||p),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!aL.test(g.parentNode.nodeName)?{ignore:!0}:null}})),p)c=hL(ME(c,+p[1],+p[2]),p[4]);else if(c=ge.maxOpen(cL(c.content,i),!0),c.openStart||c.openEnd){let m=0,g=0;for(let b=c.content.firstChild;m<c.openStart&&!b.type.spec.isolating;m++,b=b.firstChild);for(let b=c.content.lastChild;g<c.openEnd&&!b.type.spec.isolating;g++,b=b.lastChild);c=ME(c,m,g)}return t.someProp("transformPasted",m=>{c=m(c,t,f)}),c}const aL=/^(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 cL(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,l=[];if(t.forEach(c=>{if(!l)return;let f=i.findWrapping(c.type),d;if(!f)return l=null;if(d=l.length&&s.length&&wO(f,s,c,l[l.length-1],0))l[l.length-1]=d;else{l.length&&(l[l.length-1]=vO(l[l.length-1],s.length));let p=SO(c,f);l.push(p),i=i.matchType(p.type),s=f}}),l)return te.from(l)}return t}function SO(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,te.from(t));return t}function wO(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=wO(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(te.from(SO(n,t,i+1))))}}function vO(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,vO(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(te.empty,!0);return t.copy(n.append(r))}function Mb(t,e,n,r,i,s){let l=e<0?t.firstChild:t.lastChild,c=l.content;return t.childCount>1&&(s=0),i<r-1&&(c=Mb(c,e,n,r,i+1,s)),i>=n&&(c=e<0?l.contentMatchAt(0).fillBefore(c,s<=i).append(c):c.append(l.contentMatchAt(l.childCount).fillBefore(te.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,l.copy(c))}function ME(t,e,n){return e<t.openStart&&(t=new ge(Mb(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ge(Mb(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const kO={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 OE=null;function CO(){return OE||(OE=document.implementation.createHTMLDocument("title"))}let a0=null;function uL(t){let e=window.trustedTypes;return e?(a0||(a0=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),a0.createHTML(t)):t}function fL(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=CO().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&kO[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=uL(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function dL(t){let e=t.querySelectorAll(Nn?"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 hL(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:l}=t;for(let c=r.length-2;c>=0;c-=2){let f=n.nodes[r[c]];if(!f||f.hasRequiredAttrs())break;i=te.from(f.create(r[c+1],i)),s++,l++}return new ge(i,s,l)}const Wn={},Gn={},pL={touchstart:!0,touchmove:!0};class mL{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 gL(t){for(let e in Wn){let n=Wn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{bL(t,r)&&!Fx(t,r)&&(t.editable||!(r.type in Gn))&&n(t,r)},pL[e]?{passive:!0}:void 0)}Un&&t.dom.addEventListener("input",()=>null),Ob(t)}function ro(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function yL(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 Ob(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Fx(t,r))})}function Fx(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function bL(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 xL(t,e){!Fx(t,e)&&Wn[e.type]&&(t.editable||!(e.type in Gn))&&Wn[e.type](t,e)}Gn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!TO(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(cs&&Nn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Ba&&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,Po(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||lL(t,n)?n.preventDefault():ro(t,"key")};Gn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Gn.keypress=(t,e)=>{let n=e;if(TO(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||$r&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Oe)||!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",l=>l(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function im(t){return{left:t.clientX,top:t.clientY}}function SL(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function qx(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let l=s.depth+1;l>0;l--)if(t.someProp(e,c=>l>s.depth?c(t,n,s.nodeAfter,s.before(l),i,!0):c(t,n,s.node(l),s.before(l),i,!1)))return!0;return!1}function wa(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 wL(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ee.isSelectable(r)?(wa(t,new Ee(n)),!0):!1}function vL(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Ee&&(r=n.node);let s=t.state.doc.resolve(e);for(let l=s.depth+1;l>0;l--){let c=l>s.depth?s.nodeAfter:s.node(l);if(Ee.isSelectable(c)){r&&n.$from.depth>0&&l>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(l);break}}return i!=null?(wa(t,Ee.create(t.state.doc,i)),!0):!1}function kL(t,e,n,r,i){return qx(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?vL(t,n):wL(t,n))}function CL(t,e,n,r){return qx(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function EL(t,e,n,r){return qx(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||TL(t,n,r)}function TL(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(wa(t,Oe.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s),c=i.before(s);if(l.inlineContent)wa(t,Oe.create(r,c+1,c+1+l.content.size));else if(Ee.isSelectable(l))wa(t,Ee.create(r,c));else continue;return!0}}function Yx(t){return Wh(t)}const EO=$r?"metaKey":"ctrlKey";Wn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Yx(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&SL(n,t.input.lastClick)&&!n[EO]&&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 l=t.posAtCoords(im(n));l&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new AL(t,l,n,!!r)):(s=="doubleClick"?CL:EL)(t,l.pos,l.inside,n)?n.preventDefault():ro(t,"pointer"))};class AL{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[EO],this.allowDefault=r.shiftKey;let s,l;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),l=n.inside;else{let p=e.state.doc.resolve(n.pos);s=p.parent,l=p.depth?p.before():0}const c=i?null:r.target,f=c?e.docView.nearestDesc(c,!0):null;this.target=f&&f.nodeDOM.nodeType==1?f.nodeDOM:null;let{selection:d}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||d instanceof Ee&&d.from<=l&&d.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Gr&&!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)),ro(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(()=>fs(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(im(e))),this.updateAllowDefault(e),this.allowDefault||!n?ro(this.view,"pointer"):kL(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Un&&this.mightDrag&&!this.mightDrag.node.isAtom||Nn&&!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)?(wa(this.view,je.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):ro(this.view,"pointer")}move(e){this.updateAllowDefault(e),ro(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)}}Wn.touchstart=t=>{t.input.lastTouch=Date.now(),Yx(t),ro(t,"pointer")};Wn.touchmove=t=>{t.input.lastTouch=Date.now(),ro(t,"pointer")};Wn.contextmenu=t=>Yx(t);function TO(t,e){return t.composing?!0:Un&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const ML=cs?5e3:-1;Gn.compositionstart=Gn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Nn&&rO&&OL(t)))t.markCursor=t.state.storedMarks||n.marks(),Wh(t,!0),t.markCursor=null;else if(Wh(t,!e.selection.empty),Gr&&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 l=s<0?i.lastChild:i.childNodes[s-1];if(!l)break;if(l.nodeType==3){let c=t.domSelection();c&&c.collapse(l,l.nodeValue.length);break}else i=l,s=-1}}t.input.composing=!0}AO(t,ML)};function OL(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"}Gn.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++,AO(t,20))};function AO(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Wh(t),e))}function MO(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=DL());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function _L(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=v4(e.focusNode,e.focusOffset),r=k4(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 l=n.pmViewDesc;if(!(!l||!l.isText(n.nodeValue)))return r}}return n||r}function DL(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Wh(t,e=!1){if(!(cs&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),MO(t),e||t.docView&&t.docView.dirty){let n=Vx(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 RL(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 Pu=cr&&lo<15||Ba&&A4<604;Wn.copy=Gn.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Pu?null:n.clipboardData,l=r.content(),{dom:c,text:f}=$x(t,l);s?(n.preventDefault(),s.clearData(),s.setData("text/html",c.innerHTML),s.setData("text/plain",f)):RL(t,c),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function NL(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function zL(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?$u(t,r.value,null,i,e):$u(t,r.textContent,r.innerHTML,i,e)},50)}function $u(t,e,n,r,i){let s=xO(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",f=>f(t,i,s||ge.empty)))return!0;if(!s)return!1;let l=NL(s),c=l?t.state.tr.replaceSelectionWith(l,r):t.state.tr.replaceSelection(s);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function OO(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," "):""}Gn.paste=(t,e)=>{let n=e;if(t.composing&&!cs)return;let r=Pu?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&$u(t,OO(r),r.getData("text/html"),i,n)?n.preventDefault():zL(t,n)};class _O{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const LL=$r?"altKey":"ctrlKey";function DO(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[LL]}Wn.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(im(n)),l;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Ee?i.to-1:i.to))){if(r&&r.mightDrag)l=Ee.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(l=Ee.create(t.state.doc,m.posBefore))}}let c=(l||t.state.selection).content(),{dom:f,text:d,slice:p}=$x(t,c);(!n.dataTransfer.files.length||!Nn||nO>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Pu?"Text":"text/html",f.innerHTML),n.dataTransfer.effectAllowed="copyMove",Pu||n.dataTransfer.setData("text/plain",d),t.dragging=new _O(p,DO(t,n),l)};Wn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Gn.dragover=Gn.dragenter=(t,e)=>e.preventDefault();Gn.drop=(t,e)=>{try{jL(t,e,t.dragging)}finally{t.dragging=null}};function jL(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(im(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",b=>{s=b(s,t,!1)}):s=xO(t,OO(e.dataTransfer),Pu?null:e.dataTransfer.getData("text/html"),!1,i);let l=!!(n&&DO(t,e));if(t.someProp("handleDrop",b=>b(t,e,s||ge.empty,l))){e.preventDefault();return}if(!s)return;e.preventDefault();let c=s?KM(t.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let f=t.state.tr;if(l){let{node:b}=n;b?b.replace(f):f.deleteSelection()}let d=f.mapping.map(c),p=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,m=f.doc;if(p?f.replaceRangeWith(d,d,s.content.firstChild):f.replaceRange(d,d,s),f.doc.eq(m))return;let g=f.doc.resolve(d);if(p&&Ee.isSelectable(s.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(s.content.firstChild))f.setSelection(new Ee(g));else{let b=f.mapping.map(c);f.mapping.maps[f.mapping.maps.length-1].forEach((S,v,C,E)=>b=E),f.setSelection(Px(t,g,f.doc.resolve(b)))}t.focus(),t.dispatch(f.setMeta("uiEvent","drop"))}Wn.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())&&fs(t)},20))};Wn.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)};Wn.beforeinput=(t,e)=>{if(Nn&&cs&&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,Po(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 Gn)Wn[t]=Gn[t];function Fu(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 Gh{constructor(e,n){this.toDOM=e,this.spec=n||Xo,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:l}=e.mapResult(n.from+i,this.side<0?-1:1);return l?null:new $t(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Gh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Fu(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class co{constructor(e,n){this.attrs=e,this.spec=n||Xo}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,l=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=l?null:new $t(s,l,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof co&&Fu(this.attrs,e.attrs)&&Fu(this.spec,e.spec)}static is(e){return e.type instanceof co}destroy(){}}class Kx{constructor(e,n){this.attrs=e,this.spec=n||Xo}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let l=e.mapResult(n.to+i,-1);return l.deleted||l.pos<=s.pos?null:new $t(s.pos-r,l.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 Kx&&Fu(this.attrs,e.attrs)&&Fu(this.spec,e.spec)}destroy(){}}class $t{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new $t(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 $t(e,e,new Gh(n,r))}static inline(e,n,r,i){return new $t(e,n,new co(r,i))}static node(e,n,r,i){return new $t(e,n,new Kx(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof co}get widget(){return this.type instanceof Gh}}const ha=[],Xo={};class ct{constructor(e,n){this.local=e.length?e:ha,this.children=n.length?n:ha}static create(e,n){return n.length?Zh(n,e,0,Xo):jn}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 l=0;l<this.local.length;l++){let c=this.local[l];c.from<=n&&c.to>=e&&(!s||s(c.spec))&&r.push(c.copy(c.from+i,c.to+i))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<n&&this.children[l+1]>e){let c=this.children[l]+1;this.children[l+2].findInner(e-c,n-c,r,i+c,s)}}map(e,n,r){return this==jn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Xo)}mapInner(e,n,r,i,s){let l;for(let c=0;c<this.local.length;c++){let f=this.local[c].map(e,r,i);f&&f.type.valid(n,f)?(l||(l=[])).push(f):s.onRemove&&s.onRemove(this.local[c].spec)}return this.children.length?IL(this.children,l||[],e,n,r,i,s):l?new ct(l.sort(Qo),ha):jn}add(e,n){return n.length?this==jn?ct.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((c,f)=>{let d=f+r,p;if(p=NO(n,c,d)){for(i||(i=this.children.slice());s<i.length&&i[s]<f;)s+=3;i[s]==f?i[s+2]=i[s+2].addInner(c,p,d+1):i.splice(s,0,f,f+c.nodeSize,Zh(p,c,d+1,Xo)),s+=3}});let l=RO(s?zO(n):n,-r);for(let c=0;c<l.length;c++)l[c].type.valid(e,l[c])||l.splice(c--,1);return new ct(l.length?this.local.concat(l).sort(Qo):this.local,i||this.children)}remove(e){return e.length==0||this==jn?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 l,c=r[s]+n,f=r[s+1]+n;for(let p=0,m;p<e.length;p++)(m=e[p])&&m.from>c&&m.to<f&&(e[p]=null,(l||(l=[])).push(m));if(!l)continue;r==this.children&&(r=this.children.slice());let d=r[s+2].removeInner(l,c+1);d!=jn?r[s+2]=d:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,l;s<e.length;s++)if(l=e[s])for(let c=0;c<i.length;c++)i[c].eq(l,n)&&(i==this.local&&(i=this.local.slice()),i.splice(c--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ct(i,r):jn}forChild(e,n){if(this==jn)return this;if(n.isLeaf)return ct.empty;let r,i;for(let c=0;c<this.children.length;c+=3)if(this.children[c]>=e){this.children[c]==e&&(r=this.children[c+2]);break}let s=e+1,l=s+n.content.size;for(let c=0;c<this.local.length;c++){let f=this.local[c];if(f.from<l&&f.to>s&&f.type instanceof co){let d=Math.max(s,f.from)-s,p=Math.min(l,f.to)-s;d<p&&(i||(i=[])).push(f.copy(d,p))}}if(i){let c=new ct(i.sort(Qo),ha);return r?new Js([c,r]):c}return r||jn}eq(e){if(this==e)return!0;if(!(e instanceof ct)||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 Wx(this.localsInner(e))}localsInner(e){if(this==jn)return ha;if(e.inlineContent||!this.local.some(co.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof co||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ct.empty=new ct([],[]);ct.removeOverlap=Wx;const jn=ct.empty;class Js{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Xo));return Js.from(r)}forChild(e,n){if(n.isLeaf)return ct.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=jn&&(s instanceof Js?r=r.concat(s.members):r.push(s))}return Js.from(r)}eq(e){if(!(e instanceof Js)||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 l=0;l<s.length;l++)n.push(s[l])}}return n?Wx(r?n:n.sort(Qo)):ha}static from(e){switch(e.length){case 0:return jn;case 1:return e[0];default:return new Js(e.every(n=>n instanceof ct)?e:e.reduce((n,r)=>n.concat(r instanceof ct?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function IL(t,e,n,r,i,s,l){let c=t.slice();for(let d=0,p=s;d<n.maps.length;d++){let m=0;n.maps[d].forEach((g,b,S,v)=>{let C=v-S-(b-g);for(let E=0;E<c.length;E+=3){let B=c[E+1];if(B<0||g>B+p-m)continue;let I=c[E]+p-m;b>=I?c[E+1]=g<=I?-2:-1:g>=p&&C&&(c[E]+=C,c[E+1]+=C)}m+=C}),p=n.maps[d].map(p,-1)}let f=!1;for(let d=0;d<c.length;d+=3)if(c[d+1]<0){if(c[d+1]==-2){f=!0,c[d+1]=-1;continue}let p=n.map(t[d]+s),m=p-i;if(m<0||m>=r.content.size){f=!0;continue}let g=n.map(t[d+1]+s,-1),b=g-i,{index:S,offset:v}=r.content.findIndex(m),C=r.maybeChild(S);if(C&&v==m&&v+C.nodeSize==b){let E=c[d+2].mapInner(n,C,p+1,t[d]+s+1,l);E!=jn?(c[d]=m,c[d+1]=b,c[d+2]=E):(c[d+1]=-2,f=!0)}else f=!0}if(f){let d=BL(c,t,e,n,i,s,l),p=Zh(d,r,0,l);e=p.local;for(let m=0;m<c.length;m+=3)c[m+1]<0&&(c.splice(m,3),m-=3);for(let m=0,g=0;m<p.children.length;m+=3){let b=p.children[m];for(;g<c.length&&c[g]<b;)g+=3;c.splice(g,0,p.children[m],p.children[m+1],p.children[m+2])}}return new ct(e.sort(Qo),c)}function RO(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 $t(i.from+e,i.to+e,i.type))}return n}function BL(t,e,n,r,i,s,l){function c(f,d){for(let p=0;p<f.local.length;p++){let m=f.local[p].map(r,i,d);m?n.push(m):l.onRemove&&l.onRemove(f.local[p].spec)}for(let p=0;p<f.children.length;p+=3)c(f.children[p+2],f.children[p]+d+1)}for(let f=0;f<t.length;f+=3)t[f+1]==-1&&c(t[f+2],e[f]+s+1);return n}function NO(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,l;s<t.length;s++)(l=t[s])&&l.from>n&&l.to<r&&((i||(i=[])).push(l),t[s]=null);return i}function zO(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Zh(t,e,n,r){let i=[],s=!1;e.forEach((c,f)=>{let d=NO(t,c,f+n);if(d){s=!0;let p=Zh(d,c,n+f+1,r);p!=jn&&i.push(f,f+c.nodeSize,p)}});let l=RO(s?zO(t):t,-n).sort(Qo);for(let c=0;c<l.length;c++)l[c].type.valid(e,l[c])||(r.onRemove&&r.onRemove(l[c].spec),l.splice(c--,1));return l.length||i.length?new ct(l,i):jn}function Qo(t,e){return t.from-e.from||t.to-e.to}function Wx(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),_E(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),_E(e,i,r.copy(s.from,r.to)));break}}}return e}function _E(t,e,n){for(;e<t.length&&Qo(n,t[e])>0;)e++;t.splice(e,0,n)}function c0(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=jn&&e.push(r)}),t.cursorWrapper&&e.push(ct.create(t.state.doc,[t.cursorWrapper.deco])),Js.from(e)}const UL={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},HL=cr&&lo<=11;class VL{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 PL{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new VL,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]);cr&&lo<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Un&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),HL&&(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,UL)),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(vE(this.view)){if(this.suppressingSelectionUpdates)return fs(this.view);if(cr&&lo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ll(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=Ia(s))n.add(s);for(let s=e.anchorNode;s;s=Ia(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)&&vE(e)&&!this.ignoreSelectionChange(r),s=-1,l=-1,c=!1,f=[];if(e.editable)for(let p=0;p<n.length;p++){let m=this.registerMutation(n[p],f);m&&(s=s<0?m.from:Math.min(m.from,s),l=l<0?m.to:Math.max(m.to,l),m.typeOver&&(c=!0))}if(f.some(p=>p.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let p of f)if(p.nodeName=="BR"&&p.parentNode){let m=p.nextSibling;for(;m&&m.nodeType==1;){if(m.contentEditable=="false"){p.parentNode.removeChild(p);break}m=m.firstChild}}}else if(Gr&&f.length){let p=f.filter(m=>m.nodeName=="BR");if(p.length==2){let[m,g]=p;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of p){let b=g.parentNode;b&&b.nodeName=="LI"&&(!m||qL(e,m)!=b)&&g.remove()}}}let d=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&nm(r)&&(d=Vx(e))&&d.eq(je.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,fs(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,l),$L(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,YL(e,f)),this.handleDOMChange(s,l,c,f),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||fs(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 p=0;p<e.addedNodes.length;p++){let m=e.addedNodes[p];n.push(m),m.nodeType==3&&(this.lastChangedTextNode=m)}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(cr&&lo<=11&&e.addedNodes.length)for(let p=0;p<e.addedNodes.length;p++){let{previousSibling:m,nextSibling:g}=e.addedNodes[p];(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(i=m),(!g||Array.prototype.indexOf.call(e.addedNodes,g)<0)&&(s=g)}let l=i&&i.parentNode==e.target?Dn(i)+1:0,c=r.localPosFromDOM(e.target,l,-1),f=s&&s.parentNode==e.target?Dn(s):e.target.childNodes.length,d=r.localPosFromDOM(e.target,f,1);return{from:c,to:d}}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 DE=new WeakMap,RE=!1;function $L(t){if(!DE.has(t)&&(DE.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Gr,RE)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."),RE=!0}}function NE(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return ll(l.node,l.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function FL(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return NE(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?NE(t,n):null}function qL(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 YL(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 l=s.nextSibling;for(;l&&l.nodeName!="TD"&&l.nodeName!="TH";)l=l.nextSibling;if(l){let c=l;for(;;){let f=c.firstChild;if(!f||f.nodeType!=1||f.contentEditable=="false"||/^(BR|IMG)$/.test(f.nodeName))break;c=f}c.insertBefore(s,c.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function KL(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:l,to:c}=t.docView.parseRange(e,n),f=t.domSelectionRange(),d,p=f.anchorNode;if(p&&t.dom.contains(p.nodeType==1?p:p.parentNode)&&(d=[{node:p,offset:f.anchorOffset}],nm(f)||d.push({node:f.focusNode,offset:f.focusOffset})),Nn&&t.input.lastKeyCode===8)for(let C=s;C>i;C--){let E=r.childNodes[C-1],B=E.pmViewDesc;if(E.nodeName=="BR"&&!B){s=C;break}if(!B||B.size)break}let m=t.state.doc,g=t.someProp("domParser")||hu.fromSchema(t.state.schema),b=m.resolve(l),S=null,v=g.parse(r,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:i,to:s,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:WL,context:b});if(d&&d[0].pos!=null){let C=d[0].pos,E=d[1]&&d[1].pos;E==null&&(E=C),S={anchor:C+l,head:E+l}}return{doc:v,sel:S,from:l,to:c}}function WL(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Un&&/^(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||Un&&/^(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 GL=/^(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 ZL(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let N=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,Z=Vx(t,N);if(Z&&!t.state.selection.eq(Z)){if(Nn&&cs&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",ie=>ie(t,Po(13,"Enter"))))return;let j=t.state.tr.setSelection(Z);N=="pointer"?j.setMeta("pointer",!0):N=="key"&&j.scrollIntoView(),s&&j.setMeta("composition",s),t.dispatch(j)}return}let l=t.state.doc.resolve(e),c=l.sharedDepth(n);e=l.before(c+1),n=t.state.doc.resolve(n).after(c+1);let f=t.state.selection,d=KL(t,e,n),p=t.state.doc,m=p.slice(d.from,d.to),g,b;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(g=t.state.selection.to,b="end"):(g=t.state.selection.from,b="start"),t.input.lastKeyCode=null;let S=QL(m.content,d.doc.content,d.from,g,b);if(S&&t.input.domChangeCount++,(Ba&&t.input.lastIOSEnter>Date.now()-225||cs)&&i.some(N=>N.nodeType==1&&!GL.test(N.nodeName))&&(!S||S.endA>=S.endB)&&t.someProp("handleKeyDown",N=>N(t,Po(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!S)if(r&&f instanceof Oe&&!f.empty&&f.$head.sameParent(f.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))S={start:f.from,endA:f.to,endB:f.to};else{if(d.sel){let N=zE(t,t.state.doc,d.sel);if(N&&!N.eq(t.state.selection)){let Z=t.state.tr.setSelection(N);s&&Z.setMeta("composition",s),t.dispatch(Z)}}return}t.state.selection.from<t.state.selection.to&&S.start==S.endB&&t.state.selection instanceof Oe&&(S.start>t.state.selection.from&&S.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?S.start=t.state.selection.from:S.endA<t.state.selection.to&&S.endA>=t.state.selection.to-2&&t.state.selection.to<=d.to&&(S.endB+=t.state.selection.to-S.endA,S.endA=t.state.selection.to)),cr&&lo<=11&&S.endB==S.start+1&&S.endA==S.start&&S.start>d.from&&d.doc.textBetween(S.start-d.from-1,S.start-d.from+1)==" "&&(S.start--,S.endA--,S.endB--);let v=d.doc.resolveNoCache(S.start-d.from),C=d.doc.resolveNoCache(S.endB-d.from),E=p.resolve(S.start),B=v.sameParent(C)&&v.parent.inlineContent&&E.end()>=S.endA;if((Ba&&t.input.lastIOSEnter>Date.now()-225&&(!B||i.some(N=>N.nodeName=="DIV"||N.nodeName=="P"))||!B&&v.pos<d.doc.content.size&&(!v.sameParent(C)||!v.parent.inlineContent)&&v.pos<C.pos&&!/\S/.test(d.doc.textBetween(v.pos,C.pos,"","")))&&t.someProp("handleKeyDown",N=>N(t,Po(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>S.start&&XL(p,S.start,S.endA,v,C)&&t.someProp("handleKeyDown",N=>N(t,Po(8,"Backspace")))){cs&&Nn&&t.domObserver.suppressSelectionUpdates();return}Nn&&S.endB==S.start&&(t.input.lastChromeDelete=Date.now()),cs&&!B&&v.start()!=C.start()&&C.parentOffset==0&&v.depth==C.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==S.endA&&(S.endB-=2,C=d.doc.resolveNoCache(S.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(N){return N(t,Po(13,"Enter"))})},20));let I=S.start,ne=S.endA,F=N=>{let Z=N||t.state.tr.replace(I,ne,d.doc.slice(S.start-d.from,S.endB-d.from));if(d.sel){let j=zE(t,Z.doc,d.sel);j&&!(Nn&&t.composing&&j.empty&&(S.start!=S.endB||t.input.lastChromeDelete<Date.now()-100)&&(j.head==I||j.head==Z.mapping.map(ne)-1)||cr&&j.empty&&j.head==I)&&Z.setSelection(j)}return s&&Z.setMeta("composition",s),Z.scrollIntoView()},R;if(B)if(v.pos==C.pos){cr&&lo<=11&&v.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>fs(t),20));let N=F(t.state.tr.delete(I,ne)),Z=p.resolve(S.start).marksAcross(p.resolve(S.endA));Z&&N.ensureMarks(Z),t.dispatch(N)}else if(S.endA==S.endB&&(R=JL(v.parent.content.cut(v.parentOffset,C.parentOffset),E.parent.content.cut(E.parentOffset,S.endA-E.start())))){let N=F(t.state.tr);R.type=="add"?N.addMark(I,ne,R.mark):N.removeMark(I,ne,R.mark),t.dispatch(N)}else if(v.parent.child(v.index()).isText&&v.index()==C.index()-(C.textOffset?0:1)){let N=v.parent.textBetween(v.parentOffset,C.parentOffset),Z=()=>F(t.state.tr.insertText(N,I,ne));t.someProp("handleTextInput",j=>j(t,I,ne,N,Z))||t.dispatch(Z())}else t.dispatch(F());else t.dispatch(F())}function zE(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Px(t,e.resolve(n.anchor),e.resolve(n.head))}function JL(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,l,c,f;for(let p=0;p<r.length;p++)i=r[p].removeFromSet(i);for(let p=0;p<n.length;p++)s=n[p].removeFromSet(s);if(i.length==1&&s.length==0)c=i[0],l="add",f=p=>p.mark(c.addToSet(p.marks));else if(i.length==0&&s.length==1)c=s[0],l="remove",f=p=>p.mark(c.removeFromSet(p.marks));else return null;let d=[];for(let p=0;p<e.childCount;p++)d.push(f(e.child(p)));if(te.from(d).eq(t))return{mark:c,type:l}}function XL(t,e,n,r,i){if(n-e<=i.pos-r.pos||u0(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let c=s.nodeAfter;return c!=null&&n==e+c.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let l=t.resolve(u0(s,!0,!0));return!l.parent.isTextblock||l.pos>n||u0(l,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function u0(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 QL(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:l,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let f=Math.max(0,s-Math.min(l,c));r-=l+f-s}if(l<s&&t.size<e.size){let f=r<=s&&r>=l?s-r:0;s-=f,s&&s<e.size&&LE(e.textBetween(s-1,s+1))&&(s+=f?1:-1),c=s+(c-l),l=s}else if(c<s){let f=r<=s&&r>=c?s-r:0;s-=f,s&&s<t.size&&LE(t.textBetween(s-1,s+1))&&(s+=f?1:-1),l=s+(l-c),c=s}return{start:s,endA:l,endB:c}}function LE(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 LO{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 mL,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(HE),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=BE(this),IE(this),this.nodeViews=UE(this),this.docView=gE(this.state.doc,jE(this),c0(this),this.dom,this),this.domObserver=new PL(this,(r,i,s,l)=>ZL(this,r,i,s,l)),this.domObserver.start(),gL(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&&Ob(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(HE),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,l=!1;e.storedMarks&&this.composing&&(MO(this),l=!0),this.state=e;let c=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let b=UE(this);t6(b,this.nodeViews)&&(this.nodeViews=b,s=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&Ob(this),this.editable=BE(this),IE(this);let f=c0(this),d=jE(this),p=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",m=s||!this.docView.matchesNode(e.doc,d,f);(m||!e.selection.eq(i.selection))&&(l=!0);let g=p=="preserve"&&l&&this.dom.style.overflowAnchor==null&&_4(this);if(l){this.domObserver.stop();let b=m&&(cr||Nn)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&e6(i.selection,e.selection);if(m){let S=Nn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=_L(this)),(s||!this.docView.update(e.doc,d,f,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=gE(e.doc,d,f,this.dom,this)),S&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&eL(this))?fs(this,b):(gO(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),p=="reset"?this.dom.scrollTop=0:p=="to selection"?this.scrollToSelection():g&&D4(g)}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 Ee){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&uE(this,n.getBoundingClientRect(),e)}else uE(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 _O(e.slice,e.move,i<0?void 0:Ee.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 l=0;l<this.directPlugins.length;l++){let c=this.directPlugins[l].props[e];if(c!=null&&(i=n?n(c):c))return i}let s=this.state.plugins;if(s)for(let l=0;l<s.length;l++){let c=s[l].props[e];if(c!=null&&(i=n?n(c):c))return i}}hasFocus(){if(cr){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&&R4(this.dom),fs(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 I4(this,e)}coordsAtPos(e,n=1){return aO(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 P4(this,n||this.state,e)}pasteHTML(e,n){return $u(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return $u(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return $x(this,e)}destroy(){this.docView&&(yL(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],c0(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,S4())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return xL(this,e)}domSelectionRange(){let e=this.domSelection();return e?Un&&this.root.nodeType===11&&E4(this.dom.ownerDocument)==this.dom&&FL(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}LO.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function jE(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"),[$t.node(0,t.state.doc.content.size,e)]}function IE(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:$t.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function BE(t){return!t.someProp("editable",e=>e(t.state)===!1)}function e6(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 UE(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 t6(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 HE(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 ho={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:"'"},Jh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},n6=typeof navigator<"u"&&/Mac/.test(navigator.platform),r6=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Rn=0;Rn<10;Rn++)ho[48+Rn]=ho[96+Rn]=String(Rn);for(var Rn=1;Rn<=24;Rn++)ho[Rn+111]="F"+Rn;for(var Rn=65;Rn<=90;Rn++)ho[Rn]=String.fromCharCode(Rn+32),Jh[Rn]=String.fromCharCode(Rn);for(var f0 in ho)Jh.hasOwnProperty(f0)||(Jh[f0]=ho[f0]);function i6(t){var e=n6&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||r6&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Jh:ho)[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 s6=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),o6=typeof navigator<"u"&&/Win/.test(navigator.platform);function l6(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,l;for(let c=0;c<e.length-1;c++){let f=e[c];if(/^(cmd|meta|m)$/i.test(f))l=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))s=!0;else if(/^mod$/i.test(f))s6?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+f)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),l&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function a6(t){let e=Object.create(null);for(let n in t)e[l6(n)]=t[n];return e}function d0(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 c6(t){return new xt({props:{handleKeyDown:Gx(t)}})}function Gx(t){let e=a6(t);return function(n,r){let i=i6(r),s,l=e[d0(i,r)];if(l&&l(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=e[d0(i,r,!1)];if(c&&c(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(o6&&r.ctrlKey&&r.altKey)&&(s=ho[r.keyCode])&&s!=i){let c=e[d0(s,r)];if(c&&c(n.state,n.dispatch,n))return!0}}return!1}}const Zx=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function jO(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const IO=(t,e,n)=>{let r=jO(t,n);if(!r)return!1;let i=Jx(r);if(!i){let l=r.blockRange(),c=l&&Za(l);return c==null?!1:(e&&e(t.tr.lift(l,c).scrollIntoView()),!0)}let s=i.nodeBefore;if(YO(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Ua(s,"end")||Ee.isSelectable(s)))for(let l=r.depth;;l--){let c=em(t.doc,r.before(l),r.after(l),ge.empty);if(c&&c.slice.size<c.to-c.from){if(e){let f=t.tr.step(c);f.setSelection(Ua(s,"end")?je.findFrom(f.doc.resolve(f.mapping.map(i.pos,-1)),-1):Ee.create(f.doc,i.pos-s.nodeSize)),e(f.scrollIntoView())}return!0}if(l==1||r.node(l-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},u6=(t,e,n)=>{let r=jO(t,n);if(!r)return!1;let i=Jx(r);return i?BO(t,i,e):!1},f6=(t,e,n)=>{let r=HO(t,n);if(!r)return!1;let i=Xx(r);return i?BO(t,i,e):!1};function BO(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 p=i.lastChild;if(!p)return!1;i=p}let l=e.nodeAfter,c=l,f=e.pos+1;for(;!c.isTextblock;f++){if(c.type.spec.isolating)return!1;let p=c.firstChild;if(!p)return!1;c=p}let d=em(t.doc,s,f,ge.empty);if(!d||d.from!=s||d instanceof pn&&d.slice.size>=f-s)return!1;if(n){let p=t.tr.step(d);p.setSelection(Oe.create(p.doc,s)),n(p.scrollIntoView())}return!0}function Ua(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 UO=(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=Jx(r)}let l=s&&s.nodeBefore;return!l||!Ee.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Ee.create(t.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function Jx(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 HO(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const VO=(t,e,n)=>{let r=HO(t,n);if(!r)return!1;let i=Xx(r);if(!i)return!1;let s=i.nodeAfter;if(YO(t,i,e,1))return!0;if(r.parent.content.size==0&&(Ua(s,"start")||Ee.isSelectable(s))){let l=em(t.doc,r.before(),r.after(),ge.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(Ua(s,"start")?je.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):Ee.create(c.doc,c.mapping.map(i.pos))),e(c.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},PO=(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=Xx(r)}let l=s&&s.nodeAfter;return!l||!Ee.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Ee.create(t.doc,s.pos)).scrollIntoView()),!0)};function Xx(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 d6=(t,e)=>{let n=t.selection,r=n instanceof Ee,i;if(r){if(n.node.isTextblock||!bo(t.doc,n.from))return!1;i=n.from}else if(i=Qp(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(Ee.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},h6=(t,e)=>{let n=t.selection,r;if(n instanceof Ee){if(n.node.isTextblock||!bo(t.doc,n.to))return!1;r=n.to}else if(r=Qp(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},p6=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Za(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},$O=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
69
|
-
`).scrollIntoView()),!0)};function Qx(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 m6=(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),l=Qx(i.contentMatchAt(s));if(!l||!i.canReplaceWith(s,s,l))return!1;if(e){let c=n.after(),f=t.tr.replaceWith(c,c,l.createAndFill());f.setSelection(je.near(f.doc.resolve(c),1)),e(f.scrollIntoView())}return!0},FO=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof ar||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Qx(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let l=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,c=t.tr.insert(l,s.createAndFill());c.setSelection(Oe.create(c.doc,l+1)),e(c.scrollIntoView())}return!0},qO=(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(us(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Za(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function g6(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Ee&&e.selection.node.isBlock)return!r.parentOffset||!us(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],l,c,f=!1,d=!1;for(let b=r.depth;;b--)if(r.node(b).isBlock){f=r.end(b)==r.pos+(r.depth-b),d=r.start(b)==r.pos-(r.depth-b),c=Qx(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),s.unshift(f&&c?{type:c}:null),l=b;break}else{if(b==1)return!1;s.unshift(null)}let p=e.tr;(e.selection instanceof Oe||e.selection instanceof ar)&&p.deleteSelection();let m=p.mapping.map(r.pos),g=us(p.doc,m,s.length,s);if(g||(s[0]=c?{type:c}:null,g=us(p.doc,m,s.length,s)),!g)return!1;if(p.split(m,s.length,s),!f&&d&&r.node(l).type!=c){let b=p.mapping.map(r.before(l)),S=p.doc.resolve(b);c&&r.node(l-1).canReplaceWith(S.index(),S.index()+1,c)&&p.setNodeMarkup(p.mapping.map(r.before(l)),c)}return n&&n(p.scrollIntoView()),!0}}const y6=g6(),b6=(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(Ee.create(t.doc,i))),!0)};function x6(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||bo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function YO(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,l,c,f=i.type.spec.isolating||s.type.spec.isolating;if(!f&&x6(t,e,n))return!0;let d=!f&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(l=(c=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&c.matchType(l[0]||s.type).validEnd){if(n){let b=e.pos+s.nodeSize,S=te.empty;for(let E=l.length-1;E>=0;E--)S=te.from(l[E].create(null,S));S=te.from(i.copy(S));let v=t.tr.step(new mn(e.pos-1,b,e.pos,b,new ge(S,1,0),l.length,!0)),C=v.doc.resolve(b+2*l.length);C.nodeAfter&&C.nodeAfter.type==i.type&&bo(v.doc,C.pos)&&v.join(C.pos),n(v.scrollIntoView())}return!0}let p=s.type.spec.isolating||r>0&&f?null:je.findFrom(e,1),m=p&&p.$from.blockRange(p.$to),g=m&&Za(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(d&&Ua(s,"start",!0)&&Ua(i,"end")){let b=i,S=[];for(;S.push(b),!b.isTextblock;)b=b.lastChild;let v=s,C=1;for(;!v.isTextblock;v=v.firstChild)C++;if(b.canReplace(b.childCount,b.childCount,v.content)){if(n){let E=te.empty;for(let I=S.length-1;I>=0;I--)E=te.from(S[I].copy(E));let B=t.tr.step(new mn(e.pos-S.length,e.pos+s.nodeSize,e.pos+C,e.pos+s.nodeSize-C,new ge(E,S.length,0),0,!0));n(B.scrollIntoView())}return!0}}return!1}function KO(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(Oe.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const S6=KO(-1),w6=KO(1);function v6(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,l=i.blockRange(s),c=l&&Ix(l,t,e);return c?(r&&r(n.tr.wrap(l,c).scrollIntoView()),!0):!1}}function VE(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[s];n.doc.nodesBetween(l,c,(f,d)=>{if(i)return!1;if(!(!f.isTextblock||f.hasMarkup(t,e)))if(f.type==t)i=!0;else{let p=n.doc.resolve(d),m=p.index();i=p.parent.canReplaceWith(m,m+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let l=0;l<n.selection.ranges.length;l++){let{$from:{pos:c},$to:{pos:f}}=n.selection.ranges[l];s.setBlockType(c,f,t,e)}r(s.scrollIntoView())}return!0}}function e1(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}e1(Zx,IO,UO);e1(Zx,VO,PO);e1($O,FO,qO,y6);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function k6(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,l=i.blockRange(s);if(!l)return!1;let c=r?n.tr:null;return C6(c,l,t,e)?(r&&r(c.scrollIntoView()),!0):!1}}function C6(t,e,n,r=null){let i=!1,s=e,l=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 f=l.resolve(e.start-2);s=new Fh(f,f,e.depth),e.endIndex<e.parent.childCount&&(e=new Fh(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let c=Ix(s,n,r,e);return c?(t&&E6(t,e,c,i,n),!0):!1}function E6(t,e,n,r,i){let s=te.empty;for(let p=n.length-1;p>=0;p--)s=te.from(n[p].type.create(n[p].attrs,s));t.step(new mn(e.start-(r?2:0),e.end,e.start,e.end,new ge(s,0,0),n.length,!0));let l=0;for(let p=0;p<n.length;p++)n[p].type==i&&(l=p+1);let c=n.length-l,f=e.start+n.length-(r?2:0),d=e.parent;for(let p=e.startIndex,m=e.endIndex,g=!0;p<m;p++,g=!1)!g&&us(t.doc,f,c)&&(t.split(f,c),f+=2*c),f+=d.child(p).nodeSize;return t}function T6(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,l=>l.childCount>0&&l.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?A6(e,n,t,s):M6(e,n,s):!0:!1}}function A6(t,e,n,r){let i=t.tr,s=r.end,l=r.$to.end(r.depth);s<l&&(i.step(new mn(s-1,l,s,l,new ge(te.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Fh(i.doc.resolve(r.$from.pos),i.doc.resolve(l),r.depth));const c=Za(r);if(c==null)return!1;i.lift(r,c);let f=i.doc.resolve(i.mapping.map(s,-1)-1);return bo(i.doc,f.pos)&&f.nodeBefore.type==f.nodeAfter.type&&i.join(f.pos),e(i.scrollIntoView()),!0}function M6(t,e,n){let r=t.tr,i=n.parent;for(let b=n.end,S=n.endIndex-1,v=n.startIndex;S>v;S--)b-=i.child(S).nodeSize,r.delete(b-1,b+1);let s=r.doc.resolve(n.start),l=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,f=n.endIndex==i.childCount,d=s.node(-1),p=s.index(-1);if(!d.canReplace(p+(c?0:1),p+1,l.content.append(f?te.empty:te.from(i))))return!1;let m=s.pos,g=m+l.nodeSize;return r.step(new mn(m-(c?1:0),g+(f?1:0),m+1,g-1,new ge((c?te.empty:te.from(i.copy(te.empty))).append(f?te.empty:te.from(i.copy(te.empty))),c?0:1,f?0:1),c?0:1)),e(r.scrollIntoView()),!0}function O6(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==t);if(!s)return!1;let l=s.startIndex;if(l==0)return!1;let c=s.parent,f=c.child(l-1);if(f.type!=t)return!1;if(n){let d=f.lastChild&&f.lastChild.type==c.type,p=te.from(d?t.create():null),m=new ge(te.from(t.create(null,te.from(c.type.create(null,p)))),d?3:1,0),g=s.start,b=s.end;n(e.tr.step(new mn(g-(d?3:1),b,g,b,m,1,!0)).scrollIntoView())}return!0}}function sm(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 om{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,l=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([c,f])=>[c,(...p)=>{const m=f(...p)(l);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),m}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:l}=i,c=[],f=!!e,d=e||s.tr,p=()=>(!f&&n&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(d),c.every(g=>g===!0)),m={...Object.fromEntries(Object.entries(r).map(([g,b])=>[g,(...v)=>{const C=this.buildProps(d,n),E=b(...v)(C);return c.push(E),m}])),run:p};return m}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,l=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([f,d])=>[f,(...p)=>d(...p)({...l,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:l}=i,c={tr:e,editor:i,view:l,state:sm({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(([f,d])=>[f,(...p)=>d(...p)(c)]))}};return c}}let _6=class{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 we(t,e,n){return t.config[e]===void 0&&t.parent?we(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?we(t.parent,e,n):null}):t.config[e]}function lm(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 WO(t){const e=[],{nodeExtensions:n,markExtensions:r}=lm(t),i=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(l=>{const c={name:l.name,options:l.options,storage:l.storage,extensions:i},f=we(l,"addGlobalAttributes",c);if(!f)return;f().forEach(p=>{p.types.forEach(m=>{Object.entries(p.attributes).forEach(([g,b])=>{e.push({type:m,name:g,attribute:{...s,...b}})})})})}),i.forEach(l=>{const c={name:l.name,options:l.options,storage:l.storage},f=we(l,"addAttributes",c);if(!f)return;const d=f();Object.entries(d).forEach(([p,m])=>{const g={...s,...m};typeof(g==null?void 0:g.default)=="function"&&(g.default=g.default()),g!=null&&g.isRequired&&(g==null?void 0:g.default)===void 0&&delete g.default,e.push({type:l.name,name:p,attribute:g})})}),e}function bn(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 Ft(...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 c=s?String(s).split(" "):[],f=r[i]?r[i].split(" "):[],d=c.filter(p=>!f.includes(p));r[i]=[...f,...d].join(" ")}else if(i==="style"){const c=s?s.split(";").map(p=>p.trim()).filter(Boolean):[],f=r[i]?r[i].split(";").map(p=>p.trim()).filter(Boolean):[],d=new Map;f.forEach(p=>{const[m,g]=p.split(":").map(b=>b.trim());d.set(m,g)}),c.forEach(p=>{const[m,g]=p.split(":").map(b=>b.trim());d.set(m,g)}),r[i]=Array.from(d.entries()).map(([p,m])=>`${p}: ${m}`).join("; ")}else r[i]=s}),r},{})}function _b(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)=>Ft(n,r),{})}function GO(t){return typeof t=="function"}function Ge(t,e=void 0,...n){return GO(t)?e?t.bind(e)(...n):t(...n):t}function D6(t={}){return Object.keys(t).length===0&&t.constructor===Object}function R6(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function PE(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,l)=>{const c=l.attribute.parseHTML?l.attribute.parseHTML(n):R6(n.getAttribute(l.name));return c==null?s:{...s,[l.name]:c}},{});return{...r,...i}}}}function $E(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&D6(n)?!1:n!=null))}function N6(t,e){var n;const r=WO(t),{nodeExtensions:i,markExtensions:s}=lm(t),l=(n=i.find(d=>we(d,"topNode")))===null||n===void 0?void 0:n.name,c=Object.fromEntries(i.map(d=>{const p=r.filter(E=>E.type===d.name),m={name:d.name,options:d.options,storage:d.storage,editor:e},g=t.reduce((E,B)=>{const I=we(B,"extendNodeSchema",m);return{...E,...I?I(d):{}}},{}),b=$E({...g,content:Ge(we(d,"content",m)),marks:Ge(we(d,"marks",m)),group:Ge(we(d,"group",m)),inline:Ge(we(d,"inline",m)),atom:Ge(we(d,"atom",m)),selectable:Ge(we(d,"selectable",m)),draggable:Ge(we(d,"draggable",m)),code:Ge(we(d,"code",m)),whitespace:Ge(we(d,"whitespace",m)),linebreakReplacement:Ge(we(d,"linebreakReplacement",m)),defining:Ge(we(d,"defining",m)),isolating:Ge(we(d,"isolating",m)),attrs:Object.fromEntries(p.map(E=>{var B;return[E.name,{default:(B=E==null?void 0:E.attribute)===null||B===void 0?void 0:B.default}]}))}),S=Ge(we(d,"parseHTML",m));S&&(b.parseDOM=S.map(E=>PE(E,p)));const v=we(d,"renderHTML",m);v&&(b.toDOM=E=>v({node:E,HTMLAttributes:_b(E,p)}));const C=we(d,"renderText",m);return C&&(b.toText=C),[d.name,b]})),f=Object.fromEntries(s.map(d=>{const p=r.filter(C=>C.type===d.name),m={name:d.name,options:d.options,storage:d.storage,editor:e},g=t.reduce((C,E)=>{const B=we(E,"extendMarkSchema",m);return{...C,...B?B(d):{}}},{}),b=$E({...g,inclusive:Ge(we(d,"inclusive",m)),excludes:Ge(we(d,"excludes",m)),group:Ge(we(d,"group",m)),spanning:Ge(we(d,"spanning",m)),code:Ge(we(d,"code",m)),attrs:Object.fromEntries(p.map(C=>{var E;return[C.name,{default:(E=C==null?void 0:C.attribute)===null||E===void 0?void 0:E.default}]}))}),S=Ge(we(d,"parseHTML",m));S&&(b.parseDOM=S.map(C=>PE(C,p)));const v=we(d,"renderHTML",m);return v&&(b.toDOM=C=>v({mark:C,HTMLAttributes:_b(C,p)})),[d.name,b]}));return new jM({topNode:l,nodes:c,marks:f})}function h0(t,e){return e.nodes[t]||e.marks[t]||null}function FE(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function t1(t,e){const n=yl.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const z6=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,l,c)=>{var f,d;const p=((d=(f=i.type.spec).toText)===null||d===void 0?void 0:d.call(f,{node:i,pos:s,parent:l,index:c}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?p:p.slice(0,Math.max(0,r-s))}),n};function n1(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class am{constructor(e){this.find=e.find,this.handler=e.handler}}const L6=(t,e)=>{if(n1(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 Kd(t){var e;const{editor:n,from:r,to:i,text:s,rules:l,plugin:c}=t,{view:f}=n;if(f.composing)return!1;const d=f.state.doc.resolve(r);if(d.parent.type.spec.code||!((e=d.nodeBefore||d.nodeAfter)===null||e===void 0)&&e.marks.find(g=>g.type.spec.code))return!1;let p=!1;const m=z6(d)+s;return l.forEach(g=>{if(p)return;const b=L6(m,g.find);if(!b)return;const S=f.state.tr,v=sm({state:f.state,transaction:S}),C={from:r-(b[0].length-s.length),to:i},{commands:E,chain:B,can:I}=new om({editor:n,state:v});g.handler({state:v,range:C,match:b,commands:E,chain:B,can:I})===null||!S.steps.length||(S.setMeta(c,{transform:S,from:r,to:i,text:s}),f.dispatch(S),p=!0)}),p}function j6(t){const{editor:e,rules:n}=t,r=new xt({state:{init(){return null},apply(i,s,l){const c=i.getMeta(r);if(c)return c;const f=i.getMeta("applyInputRules");return!!f&&setTimeout(()=>{let{text:p}=f;typeof p=="string"?p=p:p=t1(te.from(p),l.schema);const{from:m}=f,g=m+p.length;Kd({editor:e,from:m,to:g,text:p,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,l,c){return Kd({editor:e,from:s,to:l,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Kd({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:l}=i.state.selection;return l?Kd({editor:e,from:l.pos,to:l.pos,text:`
|
|
70
|
-
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function I6(t){return Object.prototype.toString.call(t).slice(8,-1)}function Wd(t){return I6(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function cm(t,e){const n={...t};return Wd(t)&&Wd(e)&&Object.keys(e).forEach(r=>{Wd(e[r])&&Wd(t[r])?n[r]=cm(t[r],e[r]):n[r]=e[r]}),n}class Oi{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=Ge(we(this,"addOptions",{name:this.name}))),this.storage=Ge(we(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Oi(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>cm(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Oi(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=Ge(we(n,"addOptions",{name:n.name})),n.storage=Ge(we(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 l=i.marks();if(!!!l.find(d=>(d==null?void 0:d.type.name)===n.name))return!1;const f=l.find(d=>(d==null?void 0:d.type.name)===n.name);return f&&r.removeStoredMark(f),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function B6(t){return typeof t=="number"}class U6{constructor(e){this.find=e.find,this.handler=e.handler}}const H6=(t,e,n)=>{if(n1(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 V6(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:l,dropEvent:c}=t,{commands:f,chain:d,can:p}=new om({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,i,(b,S)=>{if(!b.isTextblock||b.type.spec.code)return;const v=Math.max(r,S),C=Math.min(i,S+b.content.size),E=b.textBetween(v-S,C-S,void 0,"");H6(E,s.find,l).forEach(I=>{if(I.index===void 0)return;const ne=v+I.index+1,F=ne+I[0].length,R={from:n.tr.mapping.map(ne),to:n.tr.mapping.map(F)},N=s.handler({state:n,range:R,match:I,commands:f,chain:d,can:p,pasteEvent:l,dropEvent:c});m.push(N)})}),m.every(b=>b!==null)}let Gd=null;const P6=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 $6(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const f=({state:p,from:m,to:g,rule:b,pasteEvt:S})=>{const v=p.tr,C=sm({state:p,transaction:v});if(!(!V6({editor:e,state:C,from:Math.max(m-1,0),to:g.b-1,rule:b,pasteEvent:S,dropEvent:c})||!v.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,v}};return n.map(p=>new xt({view(m){const g=S=>{var v;r=!((v=m.dom.parentElement)===null||v===void 0)&&v.contains(S.target)?m.dom.parentElement:null,r&&(Gd=e)},b=()=>{Gd&&(Gd=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(s=r===m.dom.parentElement,c=g,!s){const b=Gd;b!=null&&b.isEditable&&setTimeout(()=>{const S=b.state.selection;S&&b.commands.deleteRange({from:S.from,to:S.to})},10)}return!1},paste:(m,g)=>{var b;const S=(b=g.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return l=g,i=!!(S!=null&&S.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,b)=>{const S=m[0],v=S.getMeta("uiEvent")==="paste"&&!i,C=S.getMeta("uiEvent")==="drop"&&!s,E=S.getMeta("applyPasteRules"),B=!!E;if(!v&&!C&&!B)return;if(B){let{text:F}=E;typeof F=="string"?F=F:F=t1(te.from(F),b.schema);const{from:R}=E,N=R+F.length,Z=P6(F);return f({rule:p,state:b,from:R,to:{b:N},pasteEvt:Z})}const I=g.doc.content.findDiffStart(b.doc.content),ne=g.doc.content.findDiffEnd(b.doc.content);if(!(!B6(I)||!ne||I===ne.b))return f({rule:p,state:b,from:I,to:ne,pasteEvt:l})}}))}function F6(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class ya{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=ya.resolve(e),this.schema=N6(this.extensions,n),this.setupExtensions()}static resolve(e){const n=ya.sort(ya.flatten(e)),r=F6(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=we(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=we(r,"priority")||100,l=we(i,"priority")||100;return s>l?-1:s<l?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:h0(n.name,this.schema)},i=we(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=ya.sort([...this.extensions].reverse()),r=[],i=[],s=n.map(l=>{const c={name:l.name,options:l.options,storage:l.storage,editor:e,type:h0(l.name,this.schema)},f=[],d=we(l,"addKeyboardShortcuts",c);let p={};if(l.type==="mark"&&we(l,"exitable",c)&&(p.ArrowRight=()=>Oi.handleExit({editor:e,mark:l})),d){const v=Object.fromEntries(Object.entries(d()).map(([C,E])=>[C,()=>E({editor:e})]));p={...p,...v}}const m=c6(p);f.push(m);const g=we(l,"addInputRules",c);FE(l,e.options.enableInputRules)&&g&&r.push(...g());const b=we(l,"addPasteRules",c);FE(l,e.options.enablePasteRules)&&b&&i.push(...b());const S=we(l,"addProseMirrorPlugins",c);if(S){const v=S();f.push(...v)}return f}).flat();return[j6({editor:e,rules:r}),...$6({editor:e,rules:i}),...s]}get attributes(){return WO(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=lm(this.extensions);return Object.fromEntries(n.filter(r=>!!we(r,"addNodeView")).map(r=>{const i=this.attributes.filter(f=>f.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:bn(r.name,this.schema)},l=we(r,"addNodeView",s);if(!l)return[];const c=(f,d,p,m,g)=>{const b=_b(f,i);return l()({node:f,view:d,getPos:p,decorations:m,innerDecorations:g,editor:e,extension:r,HTMLAttributes:b})};return[r.name,c]}))}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:h0(e.name,this.schema)};e.type==="mark"&&(!((n=Ge(we(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=we(e,"onBeforeCreate",r),s=we(e,"onCreate",r),l=we(e,"onUpdate",r),c=we(e,"onSelectionUpdate",r),f=we(e,"onTransaction",r),d=we(e,"onFocus",r),p=we(e,"onBlur",r),m=we(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),l&&this.editor.on("update",l),c&&this.editor.on("selectionUpdate",c),f&&this.editor.on("transaction",f),d&&this.editor.on("focus",d),p&&this.editor.on("blur",p),m&&this.editor.on("destroy",m)})}}class Zt{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=Ge(we(this,"addOptions",{name:this.name}))),this.storage=Ge(we(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Zt(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>cm(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Zt({...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=Ge(we(n,"addOptions",{name:n.name})),n.storage=Ge(we(n,"addStorage",{name:n.name,options:n.options})),n}}function ZO(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
|
|
71
|
-
|
|
72
|
-
`,textSerializers:l={}}=n||{};let c="";return t.nodesBetween(r,i,(f,d,p,m)=>{var g;f.isBlock&&d>r&&(c+=s);const b=l==null?void 0:l[f.type.name];if(b)return p&&(c+=b({node:f,pos:d,parent:p,index:m,range:e})),!1;f.isText&&(c+=(g=f==null?void 0:f.text)===null||g===void 0?void 0:g.slice(Math.max(r,d)-d,i-d))}),c}function JO(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const q6=Zt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new xt({key:new Dt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,l=Math.min(...s.map(p=>p.$from.pos)),c=Math.max(...s.map(p=>p.$to.pos)),f=JO(n);return ZO(r,{from:l,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:f})}}})]}}),Y6=()=>({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),K6=(t=!1)=>({commands:e})=>e.setContent("",t),W6=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:l})=>{t.doc.nodesBetween(s.pos,l.pos,(c,f)=>{if(c.type.isText)return;const{doc:d,mapping:p}=e,m=d.resolve(p.map(f)),g=d.resolve(p.map(f+c.nodeSize)),b=m.blockRange(g);if(!b)return;const S=Za(b);if(c.type.isTextblock){const{defaultType:v}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(b.start,v)}(S||S===0)&&e.lift(b,S)})}),!0},G6=t=>e=>t(e),Z6=()=>({state:t,dispatch:e})=>FO(t,e),J6=(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 l=r.mapping.map(e);return r.insert(l,s.content),r.setSelection(new Oe(r.doc.resolve(Math.max(l-1,0)))),!0},X6=()=>({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 c=i.before(s),f=i.after(s);t.delete(c,f).scrollIntoView()}return!0}return!1},Q6=t=>({tr:e,state:n,dispatch:r})=>{const i=bn(t,n.schema),s=e.selection.$anchor;for(let l=s.depth;l>0;l-=1)if(s.node(l).type===i){if(r){const f=s.before(l),d=s.after(l);e.delete(f,d).scrollIntoView()}return!0}return!1},ej=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},tj=()=>({state:t,dispatch:e})=>Zx(t,e),nj=()=>({commands:t})=>t.keyboardShortcut("Enter"),rj=()=>({state:t,dispatch:e})=>m6(t,e);function Xh(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:n1(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function XO(t,e,n={}){return t.find(r=>r.type===e&&Xh(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function qE(t,e,n={}){return!!XO(t,e,n)}function r1(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(p=>p.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(p=>p.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!XO([...i.node.marks],e,n)))return;let l=i.index,c=t.start()+i.offset,f=l+1,d=c+i.node.nodeSize;for(;l>0&&qE([...t.parent.child(l-1).marks],e,n);)l-=1,c-=t.parent.child(l).nodeSize;for(;f<t.parent.childCount&&qE([...t.parent.child(f).marks],e,n);)d+=t.parent.child(f).nodeSize,f+=1;return{from:c,to:d}}function So(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 ij=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=So(t,r.schema),{doc:l,selection:c}=n,{$from:f,from:d,to:p}=c;if(i){const m=r1(f,s,e);if(m&&m.from<=d&&m.to>=p){const g=Oe.create(l,m.from,m.to);n.setSelection(g)}}return!0},sj=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 QO(t){return t instanceof Oe}function Wo(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function e_(t,e=null){if(!e)return null;const n=je.atStart(t),r=je.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?Oe.create(t,Wo(0,i,s),Wo(t.content.size,i,s)):Oe.create(t,Wo(e,i,s),Wo(e,i,s))}function YE(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Qh(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function oj(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const lj=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const l=()=>{(Qh()||YE())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),oj()&&!Qh()&&!YE()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!QO(n.state.selection))return l(),!0;const c=e_(i.doc,t)||n.state.selection,f=n.state.selection.eq(c);return s&&(f||i.setSelection(c),f&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},aj=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),cj=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),t_=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&&t_(r)}return t};function Zd(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return t_(n)}function qu(t,e,n){if(t instanceof oo||t instanceof te)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 te.fromArray(t.map(c=>e.nodeFromJSON(c)));const l=e.nodeFromJSON(t);return n.errorOnInvalidContent&&l.check(),l}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),qu("",e,n)}if(i){if(n.errorOnInvalidContent){let l=!1,c="";const f=new jM({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:d=>(l=!0,c=typeof d=="string"?d:d.outerHTML,null)}]}})});if(n.slice?hu.fromSchema(f).parseSlice(Zd(t),n.parseOptions):hu.fromSchema(f).parse(Zd(t),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=hu.fromSchema(e);return n.slice?s.parseSlice(Zd(t),n.parseOptions).content:s.parse(Zd(t),n.parseOptions)}return qu("",e,n)}function uj(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof pn||i instanceof mn))return;const s=t.mapping.maps[r];let l=0;s.forEach((c,f,d,p)=>{l===0&&(l=p)}),t.setSelection(je.near(t.doc.resolve(l),n))}const fj=t=>!("type"in t),dj=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var l;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const f=C=>{s.emit("contentError",{editor:s,error:C,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{qu(e,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(C){f(C)}try{c=qu(e,s.schema,{parseOptions:d,errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:s.options.enableContentCheck})}catch(C){return f(C),!1}let{from:p,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,b=!0;if((fj(c)?c:[c]).forEach(C=>{C.check(),g=g?C.isText&&C.marks.length===0:!1,b=b?C.isBlock:!1}),p===m&&b){const{parent:C}=r.doc.resolve(p);C.isTextblock&&!C.type.spec.code&&!C.childCount&&(p-=1,m+=1)}let v;if(g){if(Array.isArray(e))v=e.map(C=>C.text||"").join("");else if(e instanceof te){let C="";e.forEach(E=>{E.text&&(C+=E.text)}),v=C}else typeof e=="object"&&e&&e.text?v=e.text:v=e;r.insertText(v,p,m)}else v=c,r.replaceWith(p,m,v);n.updateSelection&&uj(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:p,text:v}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:p,text:v})}return!0},hj=()=>({state:t,dispatch:e})=>d6(t,e),pj=()=>({state:t,dispatch:e})=>h6(t,e),mj=()=>({state:t,dispatch:e})=>IO(t,e),gj=()=>({state:t,dispatch:e})=>VO(t,e),yj=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Qp(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},bj=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Qp(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},xj=()=>({state:t,dispatch:e})=>u6(t,e),Sj=()=>({state:t,dispatch:e})=>f6(t,e);function n_(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function wj(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,l;for(let c=0;c<e.length-1;c+=1){const f=e[c];if(/^(cmd|meta|m)$/i.test(f))l=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))s=!0;else if(/^mod$/i.test(f))Qh()||n_()?l=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${f}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),l&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const vj=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=wj(t).split(/-(?!$)/),l=s.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),c=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),f=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,c))});return f==null||f.steps.forEach(d=>{const p=d.map(r.mapping);p&&i&&r.maybeStep(p)}),!0};function Yu(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,l=e?bn(e,t.schema):null,c=[];t.doc.nodesBetween(r,i,(m,g)=>{if(m.isText)return;const b=Math.max(r,g),S=Math.min(i,g+m.nodeSize);c.push({node:m,from:b,to:S})});const f=i-r,d=c.filter(m=>l?l.name===m.node.type.name:!0).filter(m=>Xh(m.node.attrs,n,{strict:!1}));return s?!!d.length:d.reduce((m,g)=>m+g.to-g.from,0)>=f}const kj=(t,e={})=>({state:n,dispatch:r})=>{const i=bn(t,n.schema);return Yu(n,i,e)?p6(n,r):!1},Cj=()=>({state:t,dispatch:e})=>qO(t,e),Ej=t=>({state:e,dispatch:n})=>{const r=bn(t,e.schema);return T6(r)(e,n)},Tj=()=>({state:t,dispatch:e})=>$O(t,e);function um(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function KE(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 Aj=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=um(typeof t=="string"?t:t.name,r.schema);return c?(c==="node"&&(s=bn(t,r.schema)),c==="mark"&&(l=So(t,r.schema)),i&&n.selection.ranges.forEach(f=>{r.doc.nodesBetween(f.$from.pos,f.$to.pos,(d,p)=>{s&&s===d.type&&n.setNodeMarkup(p,void 0,KE(d.attrs,e)),l&&d.marks.length&&d.marks.forEach(m=>{l===m.type&&n.addMark(p,p+d.nodeSize,l.create(KE(m.attrs,e)))})})}),!0):!1},Mj=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Oj=()=>({tr:t,dispatch:e})=>{if(e){const n=new ar(t.doc);t.setSelection(n)}return!0},_j=()=>({state:t,dispatch:e})=>UO(t,e),Dj=()=>({state:t,dispatch:e})=>PO(t,e),Rj=()=>({state:t,dispatch:e})=>b6(t,e),Nj=()=>({state:t,dispatch:e})=>w6(t,e),zj=()=>({state:t,dispatch:e})=>S6(t,e);function Db(t,e,n={},r={}){return qu(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const Lj=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:l,commands:c})=>{var f,d;const{doc:p}=s;if(n.preserveWhitespace!=="full"){const m=Db(t,i.schema,n,{errorOnInvalidContent:(f=r.errorOnInvalidContent)!==null&&f!==void 0?f:i.options.enableContentCheck});return l&&s.replaceWith(0,p.content.size,m).setMeta("preventUpdate",!e),!0}return l&&s.setMeta("preventUpdate",!e),c.insertContentAt({from:0,to:p.content.size},t,{parseOptions:n,errorOnInvalidContent:(d=r.errorOnInvalidContent)!==null&&d!==void 0?d:i.options.enableContentCheck})};function r_(t,e){const n=So(e,t.schema),{from:r,to:i,empty:s}=t.selection,l=[];s?(t.storedMarks&&l.push(...t.storedMarks),l.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,f=>{l.push(...f.marks)});const c=l.find(f=>f.type.name===n.name);return c?{...c.attrs}:{}}function jj(t,e){const n=new Bx(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function Ij(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 Bj(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function i_(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 i1(t){return e=>i_(e.$from,t)}function Uj(t,e){const n={from:0,to:t.content.size};return ZO(t,n,e)}function Hj(t,e){const n=bn(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,c=>{s.push(c)});const l=s.reverse().find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function s_(t,e){const n=um(typeof e=="string"?e:e.name,t.schema);return n==="node"?Hj(t,e):n==="mark"?r_(t,e):{}}function Vj(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function Pj(t){const e=Vj(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,l)=>l!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function $j(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const l=[];if(i.ranges.length)i.forEach((c,f)=>{l.push({from:c,to:f})});else{const{from:c,to:f}=n[s];if(c===void 0||f===void 0)return;l.push({from:c,to:f})}l.forEach(({from:c,to:f})=>{const d=e.slice(s).map(c,-1),p=e.slice(s).map(f),m=e.invert().map(d,-1),g=e.invert().map(p);r.push({oldRange:{from:m,to:g},newRange:{from:d,to:p}})})}),Pj(r)}function s1(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),l=r1(s,i.type);l&&r.push({mark:i,...l})}):n.nodesBetween(t,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(l=>({from:s,to:s+i.nodeSize,mark:l})))}),r}function Sh(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 Rb(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?So(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>s?s.name===m.type.name:!0).find(m=>Xh(m.attrs,n,{strict:!1}));let l=0;const c=[];if(i.forEach(({$from:m,$to:g})=>{const b=m.pos,S=g.pos;t.doc.nodesBetween(b,S,(v,C)=>{if(!v.isText&&!v.marks.length)return;const E=Math.max(b,C),B=Math.min(S,C+v.nodeSize),I=B-E;l+=I,c.push(...v.marks.map(ne=>({mark:ne,from:E,to:B})))})}),l===0)return!1;const f=c.filter(m=>s?s.name===m.mark.type.name:!0).filter(m=>Xh(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),d=c.filter(m=>s?m.mark.type!==s&&m.mark.type.excludes(s):!0).reduce((m,g)=>m+g.to-g.from,0);return(f>0?f+d:f)>=l}function Fj(t,e,n={}){if(!e)return Yu(t,null,n)||Rb(t,null,n);const r=um(e,t.schema);return r==="node"?Yu(t,e,n):r==="mark"?Rb(t,e,n):!1}function WE(t,e){const{nodeExtensions:n}=lm(e),r=n.find(l=>l.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=Ge(we(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function fm(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&&(fm(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function qj(t){return t instanceof Ee}function Yj(t,e,n){var r;const{selection:i}=e;let s=null;if(QO(i)&&(s=i.$cursor),s){const c=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(c)||!c.some(f=>f.type.excludes(n))}const{ranges:l}=i;return l.some(({$from:c,$to:f})=>{let d=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,f.pos,(p,m,g)=>{if(d)return!1;if(p.isInline){const b=!g||g.type.allowsMarkType(n),S=!!n.isInSet(p.marks)||!p.marks.some(v=>v.type.excludes(n));d=b&&S}return!d}),d})}const Kj=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:l,ranges:c}=s,f=So(t,r.schema);if(i)if(l){const d=r_(r,f);n.addStoredMark(f.create({...d,...e}))}else c.forEach(d=>{const p=d.$from.pos,m=d.$to.pos;r.doc.nodesBetween(p,m,(g,b)=>{const S=Math.max(b,p),v=Math.min(b+g.nodeSize,m);g.marks.find(E=>E.type===f)?g.marks.forEach(E=>{f===E.type&&n.addMark(S,v,f.create({...E.attrs,...e}))}):n.addMark(S,v,f.create(e))})});return Yj(r,n,f)},Wj=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Gj=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=bn(t,n.schema);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:c})=>VE(s,{...l,...e})(n)?!0:c.clearNodes()).command(({state:c})=>VE(s,{...l,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Zj=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Wo(t,0,r.content.size),s=Ee.create(r,i);e.setSelection(s)}return!0},Jj=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,l=Oe.atStart(r).from,c=Oe.atEnd(r).to,f=Wo(i,l,c),d=Wo(s,l,c),p=Oe.create(r,f,d);e.setSelection(p)}return!0},Xj=t=>({state:e,dispatch:n})=>{const r=bn(t,e.schema);return O6(r)(e,n)};function GE(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 Qj=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:l}=e,{$from:c,$to:f}=s,d=i.extensionManager.attributes,p=Sh(d,c.node().type.name,c.node().attrs);if(s instanceof Ee&&s.node.isBlock)return!c.parentOffset||!us(l,c.pos)?!1:(r&&(t&&GE(n,i.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=f.parentOffset===f.parent.content.size,g=c.depth===0?void 0:Ij(c.node(-1).contentMatchAt(c.indexAfter(-1)));let b=m&&g?[{type:g,attrs:p}]:void 0,S=us(e.doc,e.mapping.map(c.pos),1,b);if(!b&&!S&&us(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(S=!0,b=g?[{type:g,attrs:p}]:void 0),r){if(S&&(s instanceof Oe&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,b),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const v=e.mapping.map(c.before()),C=e.doc.resolve(v);c.node(-1).canReplaceWith(C.index(),C.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&GE(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return S},eI=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var l;const c=bn(t,r.schema),{$from:f,$to:d}=r.selection,p=r.selection.node;if(p&&p.isBlock||f.depth<2||!f.sameParent(d))return!1;const m=f.node(-1);if(m.type!==c)return!1;const g=s.extensionManager.attributes;if(f.parent.content.size===0&&f.node(-1).childCount===f.indexAfter(-1)){if(f.depth===2||f.node(-3).type!==c||f.index(-2)!==f.node(-2).childCount-1)return!1;if(i){let E=te.empty;const B=f.index(-1)?1:f.index(-2)?2:3;for(let Z=f.depth-B;Z>=f.depth-3;Z-=1)E=te.from(f.node(Z).copy(E));const I=f.indexAfter(-1)<f.node(-2).childCount?1:f.indexAfter(-2)<f.node(-3).childCount?2:3,ne={...Sh(g,f.node().type.name,f.node().attrs),...e},F=((l=c.contentMatch.defaultType)===null||l===void 0?void 0:l.createAndFill(ne))||void 0;E=E.append(te.from(c.createAndFill(null,F)||void 0));const R=f.before(f.depth-(B-1));n.replace(R,f.after(-I),new ge(E,4-B,0));let N=-1;n.doc.nodesBetween(R,n.doc.content.size,(Z,j)=>{if(N>-1)return!1;Z.isTextblock&&Z.content.size===0&&(N=j+1)}),N>-1&&n.setSelection(Oe.near(n.doc.resolve(N))),n.scrollIntoView()}return!0}const b=d.pos===f.end()?m.contentMatchAt(0).defaultType:null,S={...Sh(g,m.type.name,m.attrs),...e},v={...Sh(g,f.node().type.name,f.node().attrs),...e};n.delete(f.pos,d.pos);const C=b?[{type:c,attrs:S},{type:b,attrs:v}]:[{type:c,attrs:S}];if(!us(n.doc,f.pos,2))return!1;if(i){const{selection:E,storedMarks:B}=r,{splittableMarks:I}=s.extensionManager,ne=B||E.$to.parentOffset&&E.$from.marks();if(n.split(f.pos,2,C).scrollIntoView(),!ne||!i)return!0;const F=ne.filter(R=>I.includes(R.type.name));n.ensureMarks(F)}return!0},p0=(t,e)=>{const n=i1(l=>l.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)&&bo(t.doc,n.pos)&&t.join(n.pos),!0},m0=(t,e)=>{const n=i1(l=>l.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)&&bo(t.doc,r)&&t.join(r),!0},tI=(t,e,n,r={})=>({editor:i,tr:s,state:l,dispatch:c,chain:f,commands:d,can:p})=>{const{extensions:m,splittableMarks:g}=i.extensionManager,b=bn(t,l.schema),S=bn(e,l.schema),{selection:v,storedMarks:C}=l,{$from:E,$to:B}=v,I=E.blockRange(B),ne=C||v.$to.parentOffset&&v.$from.marks();if(!I)return!1;const F=i1(R=>WE(R.type.name,m))(v);if(I.depth>=1&&F&&I.depth-F.depth<=1){if(F.node.type===b)return d.liftListItem(S);if(WE(F.node.type.name,m)&&b.validContent(F.node.content)&&c)return f().command(()=>(s.setNodeMarkup(F.pos,b),!0)).command(()=>p0(s,b)).command(()=>m0(s,b)).run()}return!n||!ne||!c?f().command(()=>p().wrapInList(b,r)?!0:d.clearNodes()).wrapInList(b,r).command(()=>p0(s,b)).command(()=>m0(s,b)).run():f().command(()=>{const R=p().wrapInList(b,r),N=ne.filter(Z=>g.includes(Z.type.name));return s.ensureMarks(N),R?!0:d.clearNodes()}).wrapInList(b,r).command(()=>p0(s,b)).command(()=>m0(s,b)).run()},nI=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,l=So(t,r.schema);return Rb(r,l,e)?i.unsetMark(l,{extendEmptyMarkRange:s}):i.setMark(l,e)},rI=(t,e,n={})=>({state:r,commands:i})=>{const s=bn(t,r.schema),l=bn(e,r.schema),c=Yu(r,s,n);let f;return r.selection.$anchor.sameParent(r.selection.$head)&&(f=r.selection.$anchor.parent.attrs),c?i.setNode(l,f):i.setNode(s,{...f,...n})},iI=(t,e={})=>({state:n,commands:r})=>{const i=bn(t,n.schema);return Yu(n,i,e)?r.lift(i):r.wrapIn(i,e)},sI=()=>({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 l=t.tr,c=s.transform;for(let f=c.steps.length-1;f>=0;f-=1)l.step(c.steps[f].invert(c.docs[f]));if(s.text){const f=l.doc.resolve(s.from).marks();l.replaceWith(s.from,s.to,t.schema.text(s.text,f))}else l.delete(s.from,s.to)}return!0}}return!1},oI=()=>({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},lI=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:l=!1}=e,{selection:c}=n,f=So(t,r.schema),{$from:d,empty:p,ranges:m}=c;if(!i)return!0;if(p&&l){let{from:g,to:b}=c;const S=(s=d.marks().find(C=>C.type===f))===null||s===void 0?void 0:s.attrs,v=r1(d,f,S);v&&(g=v.from,b=v.to),n.removeMark(g,b,f)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,f)});return n.removeStoredMark(f),!0},aI=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=um(typeof t=="string"?t:t.name,r.schema);return c?(c==="node"&&(s=bn(t,r.schema)),c==="mark"&&(l=So(t,r.schema)),i&&n.selection.ranges.forEach(f=>{const d=f.$from.pos,p=f.$to.pos;let m,g,b,S;n.selection.empty?r.doc.nodesBetween(d,p,(v,C)=>{s&&s===v.type&&(b=Math.max(C,d),S=Math.min(C+v.nodeSize,p),m=C,g=v)}):r.doc.nodesBetween(d,p,(v,C)=>{C<d&&s&&s===v.type&&(b=Math.max(C,d),S=Math.min(C+v.nodeSize,p),m=C,g=v),C>=d&&C<=p&&(s&&s===v.type&&n.setNodeMarkup(C,void 0,{...v.attrs,...e}),l&&v.marks.length&&v.marks.forEach(E=>{if(l===E.type){const B=Math.max(C,d),I=Math.min(C+v.nodeSize,p);n.addMark(B,I,l.create({...E.attrs,...e}))}}))}),g&&(m!==void 0&&n.setNodeMarkup(m,void 0,{...g.attrs,...e}),l&&g.marks.length&&g.marks.forEach(v=>{l===v.type&&n.addMark(b,S,l.create({...v.attrs,...e}))}))}),!0):!1},cI=(t,e={})=>({state:n,dispatch:r})=>{const i=bn(t,n.schema);return v6(i,e)(n,r)},uI=(t,e={})=>({state:n,dispatch:r})=>{const i=bn(t,n.schema);return k6(i,e)(n,r)};var fI=Object.freeze({__proto__:null,blur:Y6,clearContent:K6,clearNodes:W6,command:G6,createParagraphNear:Z6,cut:J6,deleteCurrentNode:X6,deleteNode:Q6,deleteRange:ej,deleteSelection:tj,enter:nj,exitCode:rj,extendMarkRange:ij,first:sj,focus:lj,forEach:aj,insertContent:cj,insertContentAt:dj,joinBackward:mj,joinDown:pj,joinForward:gj,joinItemBackward:yj,joinItemForward:bj,joinTextblockBackward:xj,joinTextblockForward:Sj,joinUp:hj,keyboardShortcut:vj,lift:kj,liftEmptyBlock:Cj,liftListItem:Ej,newlineInCode:Tj,resetAttributes:Aj,scrollIntoView:Mj,selectAll:Oj,selectNodeBackward:_j,selectNodeForward:Dj,selectParentNode:Rj,selectTextblockEnd:Nj,selectTextblockStart:zj,setContent:Lj,setMark:Kj,setMeta:Wj,setNode:Gj,setNodeSelection:Zj,setTextSelection:Jj,sinkListItem:Xj,splitBlock:Qj,splitListItem:eI,toggleList:tI,toggleMark:nI,toggleNode:rI,toggleWrap:iI,undoInputRule:sI,unsetAllMarks:oI,unsetMark:lI,updateAttributes:aI,wrapIn:cI,wrapInList:uI});const dI=Zt.create({name:"commands",addCommands(){return{...fI}}}),hI=Zt.create({name:"drop",addProseMirrorPlugins(){return[new xt({key:new Dt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),pI=Zt.create({name:"editable",addProseMirrorPlugins(){return[new xt({key:new Dt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),mI=new Dt("focusEvents"),gI=Zt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new xt({key:mI,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}}}})]}}),yI=Zt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:c})=>{const{selection:f,doc:d}=c,{empty:p,$anchor:m}=f,{pos:g,parent:b}=m,S=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,v=S.parent.type.spec.isolating,C=m.pos-m.parentOffset,E=v&&S.parent.childCount===1?C===m.pos:je.atStart(d).from===g;return!p||!b.type.isTextblock||b.textContent.length||!E||E&&m.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.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 Qh()||n_()?s:i},addProseMirrorPlugins(){return[new xt({key:new Dt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(v=>v.getMeta("composition")))return;const r=t.some(v=>v.docChanged)&&!e.doc.eq(n.doc),i=t.some(v=>v.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:l,to:c}=e.selection,f=je.atStart(e.doc).from,d=je.atEnd(e.doc).to;if(s||!(l===f&&c===d)||!fm(n.doc))return;const g=n.tr,b=sm({state:n,transaction:g}),{commands:S}=new om({editor:this.editor,state:b});if(S.clearNodes(),!!g.steps.length)return g}})]}}),bI=Zt.create({name:"paste",addProseMirrorPlugins(){return[new xt({key:new Dt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),xI=Zt.create({name:"tabindex",addProseMirrorPlugins(){return[new xt({key:new Dt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class $o{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 can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},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 $o(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 $o(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 $o(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,l=this.pos+r+(s?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const c=this.resolvedPos.doc.resolve(l);if(!i&&c.depth<=this.depth)return;const f=new $o(c,this.editor,i,i?n:null);i&&(f.actualDepth=this.depth+1),e.push(new $o(c,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,l=Object.keys(n);for(let c=0;c<l.length;c+=1){const f=l[c];if(s[f]!==n[f])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(l=>{r&&i.length>0||(l.node.type.name===e&&s.every(f=>n[f]===l.node.attrs[f])&&i.push(l),!(r&&i.length>0)&&(i=i.concat(l.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 SI=`.ProseMirror {
|
|
73
|
-
position: relative;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.ProseMirror {
|
|
77
|
-
word-wrap: break-word;
|
|
78
|
-
white-space: pre-wrap;
|
|
79
|
-
white-space: break-spaces;
|
|
80
|
-
-webkit-font-variant-ligatures: none;
|
|
81
|
-
font-variant-ligatures: none;
|
|
82
|
-
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.ProseMirror [contenteditable="false"] {
|
|
86
|
-
white-space: normal;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
90
|
-
white-space: pre-wrap;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.ProseMirror pre {
|
|
94
|
-
white-space: pre-wrap;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
img.ProseMirror-separator {
|
|
98
|
-
display: inline !important;
|
|
99
|
-
border: none !important;
|
|
100
|
-
margin: 0 !important;
|
|
101
|
-
width: 0 !important;
|
|
102
|
-
height: 0 !important;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.ProseMirror-gapcursor {
|
|
106
|
-
display: none;
|
|
107
|
-
pointer-events: none;
|
|
108
|
-
position: absolute;
|
|
109
|
-
margin: 0;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.ProseMirror-gapcursor:after {
|
|
113
|
-
content: "";
|
|
114
|
-
display: block;
|
|
115
|
-
position: absolute;
|
|
116
|
-
top: -2px;
|
|
117
|
-
width: 20px;
|
|
118
|
-
border-top: 1px solid black;
|
|
119
|
-
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
@keyframes ProseMirror-cursor-blink {
|
|
123
|
-
to {
|
|
124
|
-
visibility: hidden;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.ProseMirror-hideselection *::selection {
|
|
129
|
-
background: transparent;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.ProseMirror-hideselection *::-moz-selection {
|
|
133
|
-
background: transparent;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.ProseMirror-hideselection * {
|
|
137
|
-
caret-color: transparent;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
141
|
-
display: block;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
145
|
-
opacity: 0
|
|
146
|
-
}`;function wI(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 vI=class extends _6{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=wI(SI,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=GO(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 l=typeof s=="string"?`${s}$`:s.key;r=r.filter(c=>!c.key.startsWith(l))}),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?[pI,q6.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),dI,gI,yI,xI,hI,bI].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 ya(i,this)}createCommandManager(){this.commandManager=new om({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=Db(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(l){if(!(l instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(l.message))throw l;this.emit("contentError",{editor:this,error:l,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(c=>c.name!=="collaboration"),this.createExtensionManager()}}),n=Db(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=e_(n,this.options.autofocus);this.view=new LO(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:ga.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(l=>{var c;return(c=this.capturedTransaction)===null||c===void 0?void 0:c.step(l)});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 s_(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return Fj(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return t1(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
|
|
147
|
-
|
|
148
|
-
`,textSerializers:r={}}=e||{};return Uj(this.state.doc,{blockSeparator:n,textSerializers:{...JO(this.schema),...r}})}get isEmpty(){return fm(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 $o(n,this)}get $doc(){return this.$pos(0)}};function cl(t){return new am({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Ge(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,l=r[r.length-1],c=r[0];if(l){const f=c.search(/\S/),d=n.from+c.indexOf(l),p=d+l.length;if(s1(n.from,n.to,e.doc).filter(b=>b.mark.type.excluded.find(v=>v===t.type&&v!==b.mark.type)).filter(b=>b.to>d).length)return null;p<n.to&&s.delete(p,n.to),d>n.from&&s.delete(n.from+f,d);const g=n.from+f+l.length;s.addMark(n.from+f,g,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function kI(t){return new am({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Ge(t.getAttributes,void 0,r)||{},{tr:s}=e,l=n.from;let c=n.to;const f=t.type.create(i);if(r[1]){const d=r[0].lastIndexOf(r[1]);let p=l+d;p>c?p=c:c=p+r[1].length;const m=r[0][r[0].length-1];s.insertText(m,l+r[0].length-1),s.replaceWith(p,c,f)}else if(r[0]){const d=t.type.isInline?l:l-1;s.insert(d,t.type.create(i)).delete(s.mapping.map(l),s.mapping.map(c))}s.scrollIntoView()}})}function Nb(t){return new am({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=Ge(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 Ku(t){return new am({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=Ge(t.getAttributes,void 0,r)||{},l=e.tr.delete(n.from,n.to),f=l.doc.resolve(n.from).blockRange(),d=f&&Ix(f,t.type,s);if(!d)return null;if(l.wrap(f,d),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:b}=t.editor.extensionManager,S=g||m.$to.parentOffset&&m.$from.marks();if(S){const v=S.filter(C=>b.includes(C.type.name));l.ensureMarks(v)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(m,s).run()}const p=l.doc.resolve(n.from-1).nodeBefore;p&&p.type===t.type&&bo(l.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,p))&&l.join(n.from-1)}})}class xn{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=Ge(we(this,"addOptions",{name:this.name}))),this.storage=Ge(we(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new xn(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>cm(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new xn(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=Ge(we(n,"addOptions",{name:n.name})),n.storage=Ge(we(n,"addStorage",{name:n.name,options:n.options})),n}}function po(t){return new U6({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=Ge(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:l}=e,c=r[r.length-1],f=r[0];let d=n.to;if(c){const p=f.search(/\S/),m=n.from+f.indexOf(c),g=m+c.length;if(s1(n.from,n.to,e.doc).filter(S=>S.mark.type.excluded.find(C=>C===t.type&&C!==S.mark.type)).filter(S=>S.to>m).length)return null;g<n.to&&l.delete(g,n.to),m>n.from&&l.delete(n.from+p,m),d=n.from+p+c.length,l.addMark(n.from+p,d,t.type.create(s||{})),l.removeStoredMark(t.type)}}})}function CI(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Ee){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 Jr=()=>new Map,zb=t=>{const e=Jr();return t.forEach((n,r)=>{e.set(r,n)}),e},zi=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},EI=(t,e)=>{const n=[];for(const[r,i]of t)n.push(e(i,r));return n},TI=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},ul=()=>new Set,g0=t=>t[t.length-1],AI=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},mo=Array.from,o1=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},l1=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},MI=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},Ha=Array.isArray;class o_{constructor(){this._observers=Jr()}on(e,n){return zi(this._observers,e,ul).add(n),n}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return mo((this._observers.get(e)||Jr()).values()).forEach(r=>r(...n))}destroy(){this._observers=Jr()}}const oi=Math.floor,wh=Math.abs,ds=(t,e)=>t<e?t:e,li=(t,e)=>t>e?t:e,l_=t=>t!==0?t<0:1/t<0,ZE=1,JE=2,y0=4,b0=8,Wu=32,hs=64,Yn=128,OI=1<<29,dm=31,Lb=63,el=127,_I=2147483647,ep=Number.MAX_SAFE_INTEGER,XE=Number.MIN_SAFE_INTEGER,DI=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&oi(t)===t),a_=String.fromCharCode,RI=t=>t.toLowerCase(),NI=/^\s*/g,zI=t=>t.replace(NI,""),LI=/([A-Z])/g,QE=(t,e)=>zI(t.replace(LI,n=>`${e}${RI(n)}`)),jI=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.codePointAt(i);return r},Gu=typeof TextEncoder<"u"?new TextEncoder:null,II=t=>Gu.encode(t),BI=Gu?II:jI;let yu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});yu&&yu.decode(new Uint8Array).length===1&&(yu=null);const UI=(t,e)=>MI(e,()=>t).join("");let bf=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}};const xf=()=>new bf,HI=t=>{const e=xf();return t(e),si(e)},VI=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},si=t=>{const e=new Uint8Array(VI(t));let n=0;for(let r=0;r<t.bufs.length;r++){const i=t.bufs[r];e.set(i,n),n+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},PI=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(li(n,e)*2),t.cpos=0)},dn=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},jb=dn,it=(t,e)=>{for(;e>el;)dn(t,Yn|el&e),e=oi(e/128);dn(t,el&e)},a1=(t,e)=>{const n=l_(e);for(n&&(e=-e),dn(t,(e>Lb?Yn:0)|(n?hs:0)|Lb&e),e=oi(e/64);e>0;)dn(t,(e>el?Yn:0)|el&e),e=oi(e/128)},Ib=new Uint8Array(3e4),$I=Ib.length/3,FI=(t,e)=>{if(e.length<$I){const n=Gu.encodeInto(e,Ib).written||0;it(t,n);for(let r=0;r<n;r++)dn(t,Ib[r])}else kr(t,BI(e))},qI=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;it(t,r);for(let i=0;i<r;i++)dn(t,n.codePointAt(i))},va=Gu&&Gu.encodeInto?FI:qI,hm=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=ds(n-r,e.length),s=e.length-i;t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,s>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(li(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},kr=(t,e)=>{it(t,e.byteLength),hm(t,e)},c1=(t,e)=>{PI(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},YI=(t,e)=>c1(t,4).setFloat32(0,e,!1),KI=(t,e)=>c1(t,8).setFloat64(0,e,!1),WI=(t,e)=>c1(t,8).setBigInt64(0,e,!1),eT=new DataView(new ArrayBuffer(4)),GI=t=>(eT.setFloat32(0,t),eT.getFloat32(0)===t),Va=(t,e)=>{switch(typeof e){case"string":dn(t,119),va(t,e);break;case"number":DI(e)&&wh(e)<=_I?(dn(t,125),a1(t,e)):GI(e)?(dn(t,124),YI(t,e)):(dn(t,123),KI(t,e));break;case"bigint":dn(t,122),WI(t,e);break;case"object":if(e===null)dn(t,126);else if(Ha(e)){dn(t,117),it(t,e.length);for(let n=0;n<e.length;n++)Va(t,e[n])}else if(e instanceof Uint8Array)dn(t,116),kr(t,e);else{dn(t,118);const n=Object.keys(e);it(t,n.length);for(let r=0;r<n.length;r++){const i=n[r];va(t,i),Va(t,e[i])}}break;case"boolean":dn(t,e?120:121);break;default:dn(t,127)}};class tT extends bf{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&it(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const nT=t=>{t.count>0&&(a1(t.encoder,t.count===1?t.s:-t.s),t.count>1&&it(t.encoder,t.count-2))};class vh{constructor(){this.encoder=new bf,this.s=0,this.count=0}write(e){this.s===e?this.count++:(nT(this),this.count=1,this.s=e)}toUint8Array(){return nT(this),si(this.encoder)}}const rT=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);a1(t.encoder,e),t.count>1&&it(t.encoder,t.count-2)}};class x0{constructor(){this.encoder=new bf,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(rT(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return rT(this),si(this.encoder)}}class ZI{constructor(){this.sarr=[],this.s="",this.lensE=new vh}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new bf;return this.sarr.push(this.s),this.s="",va(e,this.sarr.join("")),hm(e,this.lensE.toUint8Array()),si(e)}}const _i=t=>new Error(t),Xr=()=>{throw _i("Method unimplemented")},Hn=()=>{throw _i("Unexpected case")},c_=_i("Unexpected end of array"),u_=_i("Integer out of Range");let pm=class{constructor(e){this.arr=e,this.pos=0}};const Ja=t=>new pm(t),JI=t=>t.pos!==t.arr.length,XI=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},Cr=t=>XI(t,Xe(t)),Pa=t=>t.arr[t.pos++],Xe=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const i=t.arr[t.pos++];if(e=e+(i&el)*n,n*=128,i<Yn)return e;if(e>ep)throw u_}throw c_},u1=t=>{let e=t.arr[t.pos++],n=e&Lb,r=64;const i=(e&hs)>0?-1:1;if((e&Yn)===0)return i*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&el)*r,r*=128,e<Yn)return i*n;if(n>ep)throw u_}throw c_},QI=t=>{let e=Xe(t);if(e===0)return"";{let n=String.fromCodePoint(Pa(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(Pa(t));else for(;e>0;){const r=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(n))}},e5=t=>yu.decode(Cr(t)),ka=yu?e5:QI,f1=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},t5=t=>f1(t,4).getFloat32(0,!1),n5=t=>f1(t,8).getFloat64(0,!1),r5=t=>f1(t,8).getBigInt64(0,!1),i5=[t=>{},t=>null,u1,t5,n5,r5,t=>!1,t=>!0,ka,t=>{const e=Xe(t),n={};for(let r=0;r<e;r++){const i=ka(t);n[i]=Zu(t)}return n},t=>{const e=Xe(t),n=[];for(let r=0;r<e;r++)n.push(Zu(t));return n},Cr],Zu=t=>i5[127-Pa(t)](t);class iT extends pm{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),JI(this)?this.count=Xe(this)+1:this.count=-1),this.count--,this.s}}class kh extends pm{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=u1(this);const e=l_(this.s);this.count=1,e&&(this.s=-this.s,this.count=Xe(this)+2)}return this.count--,this.s}}class S0 extends pm{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=u1(this),n=e&1;this.diff=oi(e/2),this.count=1,n&&(this.count=Xe(this)+2)}return this.s+=this.diff,this.count--,this.s}}class s5{constructor(e){this.decoder=new kh(e),this.str=ka(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}}const o5=crypto.getRandomValues.bind(crypto),l5=Math.random,f_=()=>o5(new Uint32Array(1))[0],a5=t=>t[oi(l5()*t.length)],c5="10000000-1000-4000-8000"+-1e11,u5=()=>c5.replace(/[018]/g,t=>(t^f_()&15>>t/4).toString(16)),f5=Date.now,sT=t=>new Promise(t);Promise.all.bind(Promise);const oT=t=>t===void 0?null:t;class d5{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let d_=new d5,h5=!0;try{typeof localStorage<"u"&&localStorage&&(d_=localStorage,h5=!1)}catch{}const p5=d_,Ju=Symbol("Equality"),h_=(t,e)=>{var n;return t===e||!!((n=t==null?void 0:t[Ju])!=null&&n.call(t,e))||!1},m5=t=>typeof t=="object",g5=Object.assign,p_=Object.keys,y5=(t,e)=>{for(const n in t)e(t[n],n)},tp=t=>p_(t).length,b5=t=>{for(const e in t)return!1;return!0},Xa=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},d1=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),x5=(t,e)=>t===e||tp(t)===tp(e)&&Xa(t,(n,r)=>(n!==void 0||d1(e,r))&&h_(e[r],n)),S5=Object.freeze,m_=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&m_(t[e])}return S5(t)},h1=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&h1(t,e,n+1)}},w5=t=>t,Ch=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(t[Ju]!=null)return t[Ju](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!Ch(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(tp(t)!==tp(e))return!1;for(const n in t)if(!d1(t,n)||!Ch(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Ch(t[n],e[n]))return!1;break;default:return!1}return!0},v5=(t,e)=>e.includes(t);var g_={};const $a=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",y_=typeof window<"u"&&typeof document<"u"&&!$a;let yi;const k5=()=>{if(yi===void 0)if($a){yi=Jr();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&yi.set(e,""),e=r):e!==null&&(yi.set(e,r),e=null)}e!==null&&yi.set(e,"")}else typeof location=="object"?(yi=Jr(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");yi.set(`--${QE(e,"-")}`,n),yi.set(`-${QE(e,"-")}`,n)}})):yi=Jr();return yi},Bb=t=>k5().has(t),np=t=>oT($a?g_[t.toUpperCase().replaceAll("-","_")]:p5.getItem(t)),b_=t=>Bb("--"+t)||np(t)!==null,C5=b_("production"),E5=$a&&v5(g_.FORCE_COLOR,["true","1","2"]),T5=E5||!Bb("--no-colors")&&!b_("no-color")&&(!$a||process.stdout.isTTY)&&(!$a||Bb("--color")||np("COLORTERM")!==null||(np("TERM")||"").includes("color")),A5=t=>new Uint8Array(t),M5=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=a_(t[n]);return btoa(e)},O5=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),_5=y_?M5:O5,D5=t=>{const e=A5(t.byteLength);return e.set(t),e},R5=t=>HI(e=>Va(e,t));class N5{constructor(e,n){this.left=e,this.right=n}}const ns=(t,e)=>new N5(t,e),lT=t=>t.next()>=.5,w0=(t,e,n)=>oi(t.next()*(n+1-e)+e),x_=(t,e,n)=>oi(t.next()*(n+1-e)+e),p1=(t,e,n)=>x_(t,e,n),z5=t=>a_(p1(t,97,122)),L5=(t,e=0,n=20)=>{const r=p1(t,e,n);let i="";for(let s=0;s<r;s++)i+=z5(t);return i},v0=(t,e)=>e[p1(t,0,e.length-1)],j5=Symbol("0schema");class I5{constructor(){this._rerrs=[]}extend(e,n,r,i=null){this._rerrs.push({path:e,expected:n,has:r,message:i})}toString(){const e=[];for(let n=this._rerrs.length-1;n>0;n--){const r=this._rerrs[n];e.push(UI(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
|
|
149
|
-
`)}}const Ub=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[Ju]?h_(t,e):Ha(t)?o1(t,n=>l1(e,r=>Ub(n,r))):m5(t)?Xa(t,(n,r)=>Ub(n,e[r])):!1;var sb;let Zn=(sb=class{extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),Ub(n,r)}equals(e){return this.constructor===e.constructor&&Ch(this.shape,e.shape)}[j5](){return!0}[Ju](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){Xr()}get nullable(){return Qa(this,xm)}get optional(){return new v_(this)}cast(e){return aT(e,this),e}expect(e){return aT(e,this),e}},Vd(sb,"_dilutes",!1),sb);class m1 extends Zn{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n=void 0){const r=(e==null?void 0:e.constructor)===this.shape&&(this._c==null||this._c(e));return!r&&(n==null||n.extend(null,this.shape.name,e==null?void 0:e.constructor.name,(e==null?void 0:e.constructor)!==this.shape?"Constructor match failed":"Check failed")),r}}const on=(t,e=null)=>new m1(t,e);on(m1);class g1 extends Zn{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape(e);return!r&&(n==null||n.extend(null,"custom prop",e==null?void 0:e.constructor.name,"failed to check custom prop")),r}}const Sn=t=>new g1(t);on(g1);class mm extends Zn{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape.some(i=>i===e);return!r&&(n==null||n.extend(null,this.shape.join(" | "),e.toString())),r}}const gm=(...t)=>new mm(t),S_=on(mm),B5=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),w_=t=>{if(Fa.check(t))return[B5(t)];if(S_.check(t))return t.shape.map(e=>e+"");if(D_.check(t))return["[+-]?\\d+.?\\d*"];if(R_.check(t))return[".*"];if(ip.check(t))return t.shape.map(w_).flat(1);Hn()};class U5 extends Zn{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(w_).map(n=>`(${n.join("|")})`).join("")+"$")}check(e,n){const r=this._r.exec(e)!=null;return!r&&(n==null||n.extend(null,this._r.toString(),e.toString(),"String doesn't match string template.")),r}}on(U5);const H5=Symbol("optional");class v_ extends Zn{constructor(e){super(),this.shape=e}check(e,n){const r=e===void 0||this.shape.check(e);return!r&&(n==null||n.extend(null,"undefined (optional)","()")),r}get[H5](){return!0}}const V5=on(v_);class P5 extends Zn{check(e,n){return n==null||n.extend(null,"never",typeof e),!1}}on(P5);const Zp=class Zp extends Zn{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}get partial(){return new Zp(this.shape,!0)}check(e,n){return e==null?(n==null||n.extend(null,"object","null"),!1):Xa(this.shape,(r,i)=>{const s=this._isPartial&&!d1(e,i)||r.check(e[i],n);return!s&&(n==null||n.extend(i.toString(),r.toString(),typeof e[i],"Object property does not match")),s})}};Vd(Zp,"_dilutes",!0);let rp=Zp;const $5=t=>new rp(t),F5=on(rp),q5=Sn(t=>t!=null&&(t.constructor===Object||t.constructor==null));class k_ extends Zn{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&Xa(e,(r,i)=>{const s=this.shape.keys.check(i,n);return!s&&(n==null||n.extend(i+"","Record",typeof e,s?"Key doesn't match schema":"Value doesn't match value")),s&&this.shape.values.check(r,n)})}}const C_=(t,e)=>new k_(t,e),Y5=on(k_);class E_ extends Zn{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&Xa(this.shape,(r,i)=>{const s=r.check(e[i],n);return!s&&(n==null||n.extend(i.toString(),"Tuple",typeof r)),s})}}const K5=(...t)=>new E_(t);on(E_);class T_ extends Zn{constructor(e){super(),this.shape=e.length===1?e[0]:new ym(e)}check(e,n){const r=Ha(e)&&o1(e,i=>this.shape.check(i));return!r&&(n==null||n.extend(null,"Array","")),r}}const A_=(...t)=>new T_(t),W5=on(T_),G5=Sn(t=>Ha(t));class M_ extends Zn{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n){const r=e instanceof this.shape&&(this._c==null||this._c(e));return!r&&(n==null||n.extend(null,this.shape.name,e==null?void 0:e.constructor.name)),r}}const Z5=(t,e=null)=>new M_(t,e);on(M_);const J5=Z5(Zn);class X5 extends Zn{constructor(e){super(),this.len=e.length-1,this.args=K5(...e.slice(-1)),this.res=e[this.len]}check(e,n){const r=e.constructor===Function&&e.length<=this.len;return!r&&(n==null||n.extend(null,"function",typeof e)),r}}const Q5=on(X5),eB=Sn(t=>typeof t=="function");class tB extends Zn{constructor(e){super(),this.shape=e}check(e,n){const r=o1(this.shape,i=>i.check(e,n));return!r&&(n==null||n.extend(null,"Intersectinon",typeof e)),r}}on(tB,t=>t.shape.length>0);class ym extends Zn{constructor(e){super(),this.shape=e}check(e,n){const r=l1(this.shape,i=>i.check(e,n));return n==null||n.extend(null,"Union",typeof e),r}}Vd(ym,"_dilutes",!0);const Qa=(...t)=>t.findIndex(e=>ip.check(e))>=0?Qa(...t.map(e=>Xu(e)).map(e=>ip.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new ym(t),ip=on(ym),O_=()=>!0,sp=Sn(O_),nB=on(g1,t=>t.shape===O_),y1=Sn(t=>typeof t=="bigint"),rB=Sn(t=>t===y1),__=Sn(t=>typeof t=="symbol");Sn(t=>t===__);const Ca=Sn(t=>typeof t=="number"),D_=Sn(t=>t===Ca),Fa=Sn(t=>typeof t=="string"),R_=Sn(t=>t===Fa),bm=Sn(t=>typeof t=="boolean"),iB=Sn(t=>t===bm),N_=gm(void 0);on(mm,t=>t.shape.length===1&&t.shape[0]===void 0);gm(void 0);const xm=gm(null),sB=on(mm,t=>t.shape.length===1&&t.shape[0]===null);on(Uint8Array);on(m1,t=>t.shape===Uint8Array);const oB=Qa(Ca,Fa,xm,N_,y1,bm,__);(()=>{const t=A_(sp),e=C_(Fa,sp),n=Qa(Ca,Fa,xm,bm,t,e);return t.shape=n,e.shape.values=n,n})();const Xu=t=>{if(J5.check(t))return t;if(q5.check(t)){const e={};for(const n in t)e[n]=Xu(t[n]);return $5(e)}else{if(G5.check(t))return Qa(...t.map(Xu));if(oB.check(t))return gm(t);if(eB.check(t))return on(t)}Hn()},aT=C5?()=>{}:(t,e)=>{const n=new I5;if(!e.check(t,n))throw _i(`Expected value to be of type ${e.constructor.name}.
|
|
150
|
-
${n.toString()}`)};class lB{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:Xu(e),h:n}),this}else(e){return this.if(sp,e)}done(){return(e,n)=>{for(let r=0;r<this.patterns.length;r++){const i=this.patterns[r];if(i.if.check(e))return i.h(e,n)}throw _i("Unhandled pattern")}}}const aB=t=>new lB(t),z_=aB(sp).if(D_,(t,e)=>w0(e,XE,ep)).if(R_,(t,e)=>L5(e)).if(iB,(t,e)=>lT(e)).if(rB,(t,e)=>BigInt(w0(e,XE,ep))).if(ip,(t,e)=>aa(e,v0(e,t.shape))).if(F5,(t,e)=>{const n={};for(const r in t.shape){let i=t.shape[r];if(V5.check(i)){if(lT(e))continue;i=i.shape}n[r]=z_(i,e)}return n}).if(W5,(t,e)=>{const n=[],r=x_(e,0,42);for(let i=0;i<r;i++)n.push(aa(e,t.shape));return n}).if(S_,(t,e)=>v0(e,t.shape)).if(sB,(t,e)=>null).if(Q5,(t,e)=>{const n=aa(e,t.res);return()=>n}).if(nB,(t,e)=>aa(e,v0(e,[Ca,Fa,xm,N_,y1,bm,A_(Ca),C_(Qa("a","b","c"),Ca)]))).if(Y5,(t,e)=>{const n={},r=w0(e,0,3);for(let i=0;i<r;i++){const s=aa(e,t.shape.keys),l=aa(e,t.shape.values);n[s]=l}return n}).done(),aa=(t,e)=>z_(Xu(e),t),Sf=typeof document<"u"?document:{};Sn(t=>t.nodeType===hB);typeof DOMParser<"u"&&new DOMParser;Sn(t=>t.nodeType===uB);Sn(t=>t.nodeType===fB);const cB=t=>EI(t,(e,n)=>`${n}:${e};`).join(""),uB=Sf.ELEMENT_NODE,fB=Sf.TEXT_NODE,dB=Sf.DOCUMENT_NODE,hB=Sf.DOCUMENT_FRAGMENT_NODE;Sn(t=>t.nodeType===dB);const pB=t=>class{constructor(n){this._=n}destroy(){t(this._)}},mB=pB(clearTimeout),b1=(t,e)=>new mB(setTimeout(e,t)),gs=Symbol,L_=gs(),j_=gs(),gB=gs(),yB=gs(),bB=gs(),I_=gs(),xB=gs(),x1=gs(),SB=gs(),wB=t=>{var i;t.length===1&&((i=t[0])==null?void 0:i.constructor)===Function&&(t=t[0]());const e=[],n=[];let r=0;for(;r<t.length;r++){const s=t[r];if(s===void 0)break;if(s.constructor===String||s.constructor===Number)e.push(s);else if(s.constructor===Object)break}for(r>0&&n.push(e.join(""));r<t.length;r++){const s=t[r];s instanceof Symbol||n.push(s)}return n},vB={[L_]:ns("font-weight","bold"),[j_]:ns("font-weight","normal"),[gB]:ns("color","blue"),[bB]:ns("color","green"),[yB]:ns("color","grey"),[I_]:ns("color","red"),[xB]:ns("color","purple"),[x1]:ns("color","orange"),[SB]:ns("color","black")},kB=t=>{var l;t.length===1&&((l=t[0])==null?void 0:l.constructor)===Function&&(t=t[0]());const e=[],n=[],r=Jr();let i=[],s=0;for(;s<t.length;s++){const c=t[s],f=vB[c];if(f!==void 0)r.set(f.left,f.right);else{if(c===void 0)break;if(c.constructor===String||c.constructor===Number){const d=cB(r);s>0||d.length>0?(e.push("%c"+c),n.push(d)):e.push(c)}else break}}for(s>0&&(i=n,i.unshift(e.join("")));s<t.length;s++){const c=t[s];c instanceof Symbol||i.push(c)}return i},B_=T5?kB:wB,CB=(...t)=>{console.log(...B_(t)),H_.forEach(e=>e.print(t))},U_=(...t)=>{console.warn(...B_(t)),t.unshift(x1),H_.forEach(e=>e.print(t))},H_=ul(),V_=t=>({[Symbol.iterator](){return this},next:t}),EB=(t,e)=>V_(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),k0=(t,e)=>V_(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class Sm{constructor(e,n){this.clock=e,this.len=n}}class ec{constructor(){this.clients=new Map}}const go=(t,e,n)=>e.clients.forEach((r,i)=>{const s=t.doc.store.clients.get(i);if(s!=null){const l=s[s.length-1],c=l.id.clock+l.length;for(let f=0,d=r[f];f<r.length&&d.clock<c;d=r[++f])tD(t,s,d.clock,d.len,n)}}),TB=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const i=oi((n+r)/2),s=t[i],l=s.clock;if(l<=e){if(e<l+s.len)return i;n=i+1}else r=i-1}return null},tc=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&TB(n,e.clock)!==null},S1=t=>{t.clients.forEach(e=>{e.sort((i,s)=>i.clock-s.clock);let n,r;for(n=1,r=1;n<e.length;n++){const i=e[r-1],s=e[n];i.clock+i.len>=s.clock?e[r-1]=new Sm(i.clock,li(i.len,s.clock+s.len-i.clock)):(r<n&&(e[r]=s),r++)}e.length=r})},Hb=t=>{const e=new ec;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,i)=>{if(!e.clients.has(i)){const s=r.slice();for(let l=n+1;l<t.length;l++)AI(s,t[l].clients.get(i)||[]);e.clients.set(i,s)}});return S1(e),e},Qu=(t,e,n,r)=>{zi(t.clients,e,()=>[]).push(new Sm(n,r))},P_=()=>new ec,$_=t=>{const e=P_();return t.clients.forEach((n,r)=>{const i=[];for(let s=0;s<n.length;s++){const l=n[s];if(l.deleted){const c=l.id.clock;let f=l.length;if(s+1<n.length)for(let d=n[s+1];s+1<n.length&&d.deleted;d=n[++s+1])f+=d.length;i.push(new Sm(c,f))}}i.length>0&&e.clients.set(r,i)}),e},nc=(t,e)=>{it(t.restEncoder,e.clients.size),mo(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),it(t.restEncoder,n);const i=r.length;it(t.restEncoder,i);for(let s=0;s<i;s++){const l=r[s];t.writeDsClock(l.clock),t.writeDsLen(l.len)}})},w1=t=>{const e=new ec,n=Xe(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const i=Xe(t.restDecoder),s=Xe(t.restDecoder);if(s>0){const l=zi(e.clients,i,()=>[]);for(let c=0;c<s;c++)l.push(new Sm(t.readDsClock(),t.readDsLen()))}}return e},cT=(t,e,n)=>{const r=new ec,i=Xe(t.restDecoder);for(let s=0;s<i;s++){t.resetDsCurVal();const l=Xe(t.restDecoder),c=Xe(t.restDecoder),f=n.clients.get(l)||[],d=Gt(n,l);for(let p=0;p<c;p++){const m=t.readDsClock(),g=m+t.readDsLen();if(m<d){d<g&&Qu(r,l,d,g-d);let b=ai(f,m),S=f[b];for(!S.deleted&&S.id.clock<m&&(f.splice(b+1,0,dp(e,S,m-S.id.clock)),b++);b<f.length&&(S=f[b++],S.id.clock<g);)S.deleted||(g<S.id.clock+S.length&&f.splice(b,0,dp(e,S,g-S.id.clock)),S.delete(e))}else Qu(r,l,m,g-m)}}if(r.clients.size>0){const s=new fl;return it(s.restEncoder,0),nc(s,r),s.toUint8Array()}return null},F_=f_;class Di extends o_{constructor({guid:e=u5(),collectionid:n=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:l=!1,shouldLoad:c=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=F_(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new Q_,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=c,this.autoLoad=l,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=sT(d=>{this.on("load",()=>{this.isLoaded=!0,d(this)})});const f=()=>sT(d=>{const p=m=>{(m===void 0||m===!0)&&(this.off("sync",p),d())};this.on("sync",p)});this.on("sync",d=>{d===!1&&this.isSynced&&(this.whenSynced=f()),this.isSynced=d===void 0||d===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=f()}load(){const e=this._item;e!==null&&!this.shouldLoad&&vt(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(mo(this.subdocs).map(e=>e.guid))}transact(e,n=null){return vt(this,e,n)}get(e,n=gn){const r=zi(this.share,e,()=>{const s=new n;return s._integrate(this,null),s}),i=r.constructor;if(n!==gn&&i!==n)if(i===gn){const s=new n;s._map=r._map,r._map.forEach(l=>{for(;l!==null;l=l.left)l.parent=s}),s._start=r._start;for(let l=s._start;l!==null;l=l.right)l.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,Aa)}getText(e=""){return this.get(e,yo)}getMap(e=""){return this.get(e,Ya)}getXmlElement(e=""){return this.get(e,zn)}getXmlFragment(e=""){return this.get(e,dl)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,mo(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new Di({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,vt(e.parent.doc,r=>{const i=n.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class q_{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Xe(this.restDecoder)}readDsLen(){return Xe(this.restDecoder)}}class Y_ extends q_{readLeftID(){return $e(Xe(this.restDecoder),Xe(this.restDecoder))}readRightID(){return $e(Xe(this.restDecoder),Xe(this.restDecoder))}readClient(){return Xe(this.restDecoder)}readInfo(){return Pa(this.restDecoder)}readString(){return ka(this.restDecoder)}readParentInfo(){return Xe(this.restDecoder)===1}readTypeRef(){return Xe(this.restDecoder)}readLen(){return Xe(this.restDecoder)}readAny(){return Zu(this.restDecoder)}readBuf(){return D5(Cr(this.restDecoder))}readJSON(){return JSON.parse(ka(this.restDecoder))}readKey(){return ka(this.restDecoder)}}class AB{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Xe(this.restDecoder),this.dsCurrVal}readDsLen(){const e=Xe(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class qa extends AB{constructor(e){super(e),this.keys=[],Xe(e),this.keyClockDecoder=new S0(Cr(e)),this.clientDecoder=new kh(Cr(e)),this.leftClockDecoder=new S0(Cr(e)),this.rightClockDecoder=new S0(Cr(e)),this.infoDecoder=new iT(Cr(e),Pa),this.stringDecoder=new s5(Cr(e)),this.parentInfoDecoder=new iT(Cr(e),Pa),this.typeRefDecoder=new kh(Cr(e)),this.lenDecoder=new kh(Cr(e))}readLeftID(){return new Ea(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Ea(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Zu(this.restDecoder)}readBuf(){return Cr(this.restDecoder)}readJSON(){return Zu(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class K_{constructor(){this.restEncoder=xf()}toUint8Array(){return si(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){it(this.restEncoder,e)}writeDsLen(e){it(this.restEncoder,e)}}class wf extends K_{writeLeftID(e){it(this.restEncoder,e.client),it(this.restEncoder,e.clock)}writeRightID(e){it(this.restEncoder,e.client),it(this.restEncoder,e.clock)}writeClient(e){it(this.restEncoder,e)}writeInfo(e){jb(this.restEncoder,e)}writeString(e){va(this.restEncoder,e)}writeParentInfo(e){it(this.restEncoder,e?1:0)}writeTypeRef(e){it(this.restEncoder,e)}writeLen(e){it(this.restEncoder,e)}writeAny(e){Va(this.restEncoder,e)}writeBuf(e){kr(this.restEncoder,e)}writeJSON(e){va(this.restEncoder,JSON.stringify(e))}writeKey(e){va(this.restEncoder,e)}}class W_{constructor(){this.restEncoder=xf(),this.dsCurrVal=0}toUint8Array(){return si(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,it(this.restEncoder,n)}writeDsLen(e){e===0&&Hn(),it(this.restEncoder,e-1),this.dsCurrVal+=e}}class fl extends W_{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new x0,this.clientEncoder=new vh,this.leftClockEncoder=new x0,this.rightClockEncoder=new x0,this.infoEncoder=new tT(jb),this.stringEncoder=new ZI,this.parentInfoEncoder=new tT(jb),this.typeRefEncoder=new vh,this.lenEncoder=new vh}toUint8Array(){const e=xf();return it(e,0),kr(e,this.keyClockEncoder.toUint8Array()),kr(e,this.clientEncoder.toUint8Array()),kr(e,this.leftClockEncoder.toUint8Array()),kr(e,this.rightClockEncoder.toUint8Array()),kr(e,si(this.infoEncoder)),kr(e,this.stringEncoder.toUint8Array()),kr(e,si(this.parentInfoEncoder)),kr(e,this.typeRefEncoder.toUint8Array()),kr(e,this.lenEncoder.toUint8Array()),hm(e,si(this.restEncoder)),si(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Va(this.restEncoder,e)}writeBuf(e){kr(this.restEncoder,e)}writeJSON(e){Va(this.restEncoder,e)}writeKey(e){const n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}}const MB=(t,e,n,r)=>{r=li(r,e[0].id.clock);const i=ai(e,r);it(t.restEncoder,e.length-i),t.writeClient(n),it(t.restEncoder,r);const s=e[i];s.write(t,r-s.id.clock);for(let l=i+1;l<e.length;l++)e[l].write(t,0)},v1=(t,e,n)=>{const r=new Map;n.forEach((i,s)=>{Gt(e,s)>i&&r.set(s,i)}),vf(e).forEach((i,s)=>{n.has(s)||r.set(s,0)}),it(t.restEncoder,r.size),mo(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{MB(t,e.clients.get(i),i,s)})},OB=(t,e)=>{const n=Jr(),r=Xe(t.restDecoder);for(let i=0;i<r;i++){const s=Xe(t.restDecoder),l=new Array(s),c=t.readClient();let f=Xe(t.restDecoder);n.set(c,{i:0,refs:l});for(let d=0;d<s;d++){const p=t.readInfo();switch(dm&p){case 0:{const m=t.readLen();l[d]=new Yr($e(c,f),m),f+=m;break}case 10:{const m=Xe(t.restDecoder);l[d]=new Kr($e(c,f),m),f+=m;break}default:{const m=(p&(hs|Yn))===0,g=new Tt($e(c,f),null,(p&Yn)===Yn?t.readLeftID():null,null,(p&hs)===hs?t.readRightID():null,m?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,m&&(p&Wu)===Wu?t.readString():null,kD(t,p));l[d]=g,f+=g.length}}}}return n},_B=(t,e,n)=>{const r=[];let i=mo(n.keys()).sort((b,S)=>b-S);if(i.length===0)return null;const s=()=>{if(i.length===0)return null;let b=n.get(i[i.length-1]);for(;b.refs.length===b.i;)if(i.pop(),i.length>0)b=n.get(i[i.length-1]);else return null;return b};let l=s();if(l===null)return null;const c=new Q_,f=new Map,d=(b,S)=>{const v=f.get(b);(v==null||v>S)&&f.set(b,S)};let p=l.refs[l.i++];const m=new Map,g=()=>{for(const b of r){const S=b.id.client,v=n.get(S);v?(v.i--,c.clients.set(S,v.refs.slice(v.i)),n.delete(S),v.i=0,v.refs=[]):c.clients.set(S,[b]),i=i.filter(C=>C!==S)}r.length=0};for(;;){if(p.constructor!==Kr){const S=zi(m,p.id.client,()=>Gt(e,p.id.client))-p.id.clock;if(S<0)r.push(p),d(p.id.client,p.id.clock-1),g();else{const v=p.getMissing(t,e);if(v!==null){r.push(p);const C=n.get(v)||{refs:[],i:0};if(C.refs.length===C.i)d(v,Gt(e,v)),g();else{p=C.refs[C.i++];continue}}else(S===0||S<p.length)&&(p.integrate(t,S),m.set(p.id.client,p.id.clock+p.length))}}if(r.length>0)p=r.pop();else if(l!==null&&l.i<l.refs.length)p=l.refs[l.i++];else{if(l=s(),l===null)break;p=l.refs[l.i++]}}if(c.clients.size>0){const b=new fl;return v1(b,c,new Map),it(b.restEncoder,0),{missing:f,update:b.toUint8Array()}}return null},DB=(t,e)=>v1(t,e.doc.store,e.beforeState),RB=(t,e,n,r=new qa(t))=>vt(e,i=>{i.local=!1;let s=!1;const l=i.doc,c=l.store,f=OB(r,l),d=_B(i,c,f),p=c.pendingStructs;if(p){for(const[g,b]of p.missing)if(b<Gt(c,g)){s=!0;break}if(d){for(const[g,b]of d.missing){const S=p.missing.get(g);(S==null||S>b)&&p.missing.set(g,b)}p.update=lp([p.update,d.update])}}else c.pendingStructs=d;const m=cT(r,i,c);if(c.pendingDs){const g=new qa(Ja(c.pendingDs));Xe(g.restDecoder);const b=cT(g,i,c);m&&b?c.pendingDs=lp([m,b]):c.pendingDs=m||b}else c.pendingDs=m;if(s){const g=c.pendingStructs.update;c.pendingStructs=null,op(i.doc,g)}},n,!1),op=(t,e,n,r=qa)=>{const i=Ja(e);RB(i,t,n,new r(i))},NB=(t,e,n)=>op(t,e,n,Y_),zB=(t,e,n=new Map)=>{v1(t,e.store,n),nc(t,$_(e.store))},LB=(t,e=new Uint8Array([0]),n=new fl)=>{const r=G_(e);zB(n,t,r);const i=[n.toUint8Array()];if(t.store.pendingDs&&i.push(t.store.pendingDs),t.store.pendingStructs&&i.push(e8(t.store.pendingStructs.update,e)),i.length>1){if(n.constructor===wf)return XB(i.map((s,l)=>l===0?s:n8(s)));if(n.constructor===fl)return lp(i)}return i[0]},jB=(t,e)=>LB(t,e,new wf),IB=t=>{const e=new Map,n=Xe(t.restDecoder);for(let r=0;r<n;r++){const i=Xe(t.restDecoder),s=Xe(t.restDecoder);e.set(i,s)}return e},G_=t=>IB(new q_(Ja(t))),Z_=(t,e)=>(it(t.restEncoder,e.size),mo(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{it(t.restEncoder,n),it(t.restEncoder,r)}),t),BB=(t,e)=>Z_(t,vf(e.store)),UB=(t,e=new W_)=>(t instanceof Map?Z_(e,t):BB(e,t),e.toUint8Array()),HB=t=>UB(t,new K_);class VB{constructor(){this.l=[]}}const uT=()=>new VB,fT=(t,e)=>t.l.push(e),dT=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter(i=>e!==i),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},J_=(t,e,n)=>h1(t.l,[e,n]);class Ea{constructor(e,n){this.client=e,this.clock=n}}const ba=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,$e=(t,e)=>new Ea(t,e),ef=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw Hn()},tf=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class nf{constructor(e,n,r,i=0){this.type=e,this.tname=n,this.item=r,this.assoc=i}}const tl=t=>new nf(t.type==null?null:$e(t.type.client,t.type.clock),t.tname??null,t.item==null?null:$e(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class PB{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const $B=(t,e,n=0)=>new PB(t,e,n),Jd=(t,e,n)=>{let r=null,i=null;return t._item===null?i=ef(t):r=$e(t._item.id.client,t._item.id.clock),new nf(r,i,e,n)},C0=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return Jd(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Jd(t,$e(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return Jd(t,r.lastId,n);r=r.right}return Jd(t,null,n)},FB=(t,e)=>{const n=Ta(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},Vb=(t,e,n=!0)=>{const r=e.store,i=t.item,s=t.type,l=t.tname,c=t.assoc;let f=null,d=0;if(i!==null){if(Gt(r,i.client)<=i.clock)return null;const p=n?qb(r,i):FB(r,i),m=p.item;if(!(m instanceof Tt))return null;if(f=m.parent,f._item===null||!f._item.deleted){d=m.deleted||!m.countable?0:p.diff+(c>=0?0:1);let g=m.left;for(;g!==null;)!g.deleted&&g.countable&&(d+=g.length),g=g.left}}else{if(l!==null)f=e.get(l);else if(s!==null){if(Gt(r,s.client)<=s.clock)return null;const{item:p}=n?qb(r,s):{item:Ta(r,s)};if(p instanceof Tt&&p.content instanceof ui)f=p.content.type;else return null}else throw Hn();c>=0?d=f._length:d=0}return $B(f,d,t.assoc)},hT=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&ba(t.item,e.item)&&ba(t.type,e.type)&&t.assoc===e.assoc;class k1{constructor(e,n){this.ds=e,this.sv=n}}const X_=(t,e)=>new k1(t,e),E0=t=>X_($_(t.store),vf(t.store)),Fo=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!tc(e.ds,t.id),Pb=(t,e)=>{const n=zi(t.meta,Pb,ul),r=t.doc.store;n.has(e)||(e.sv.forEach((i,s)=>{i<Gt(r,s)&&lr(t,$e(s,i))}),go(t,e.ds,i=>{}),n.add(e))};class Q_{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const vf=t=>{const e=new Map;return t.clients.forEach((n,r)=>{const i=n[n.length-1];e.set(r,i.id.clock+i.length)}),e},Gt=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},eD=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw Hn()}n.push(e)},ai=(t,e)=>{let n=0,r=t.length-1,i=t[r],s=i.id.clock;if(s===e)return r;let l=oi(e/(s+i.length-1)*r);for(;n<=r;){if(i=t[l],s=i.id.clock,s<=e){if(e<s+i.length)return l;n=l+1}else r=l-1;l=oi((n+r)/2)}throw Hn()},qB=(t,e)=>{const n=t.clients.get(e.client);return n[ai(n,e.clock)]},Ta=qB,$b=(t,e,n)=>{const r=ai(e,n),i=e[r];return i.id.clock<n&&i instanceof Tt?(e.splice(r+1,0,dp(t,i,n-i.id.clock)),r+1):r},lr=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[$b(t,n,e.clock)]},pT=(t,e,n)=>{const r=e.clients.get(n.client),i=ai(r,n.clock),s=r[i];return n.clock!==s.id.clock+s.length-1&&s.constructor!==Yr&&r.splice(i+1,0,dp(t,s,n.clock-s.id.clock+1)),s},YB=(t,e,n)=>{const r=t.clients.get(e.id.client);r[ai(r,e.id.clock)]=n},tD=(t,e,n,r,i)=>{if(r===0)return;const s=n+r;let l=$b(t,e,n),c;do c=e[l++],s<c.id.clock+c.length&&$b(t,e,s),i(c);while(l<e.length&&e[l].id.clock<s)};class KB{constructor(e,n,r){this.doc=e,this.deleteSet=new ec,this.beforeState=vf(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const mT=(t,e)=>e.deleteSet.clients.size===0&&!TI(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(S1(e.deleteSet),DB(t,e),nc(t,e.deleteSet),!0),gT=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&zi(t.changed,e,ul).add(n)},Eh=(t,e)=>{let n=t[e],r=t[e-1],i=e;for(;i>0;n=r,r=t[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof Tt&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const s=e-i;return s&&t.splice(e+1-s,s),s},WB=(t,e,n)=>{for(const[r,i]of t.clients.entries()){const s=e.clients.get(r);for(let l=i.length-1;l>=0;l--){const c=i[l],f=c.clock+c.len;for(let d=ai(s,c.clock),p=s[d];d<s.length&&p.id.clock<f;p=s[++d]){const m=s[d];if(c.clock+c.len<=m.id.clock)break;m instanceof Tt&&m.deleted&&!m.keep&&n(m)&&m.gc(e,!1)}}}},GB=(t,e)=>{t.clients.forEach((n,r)=>{const i=e.clients.get(r);for(let s=n.length-1;s>=0;s--){const l=n[s],c=ds(i.length-1,1+ai(i,l.clock+l.len-1));for(let f=c,d=i[f];f>0&&d.id.clock>=l.clock;d=i[f])f-=1+Eh(i,f)}})},nD=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,i=r.store,s=n.deleteSet,l=n._mergeStructs;try{S1(s),n.afterState=vf(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const c=[];n.changed.forEach((f,d)=>c.push(()=>{(d._item===null||!d._item.deleted)&&d._callObserver(n,f)})),c.push(()=>{n.changedParentTypes.forEach((f,d)=>{d._dEH.l.length>0&&(d._item===null||!d._item.deleted)&&(f=f.filter(p=>p.target._item===null||!p.target._item.deleted),f.forEach(p=>{p.currentTarget=d,p._path=null}),f.sort((p,m)=>p.path.length-m.path.length),c.push(()=>{J_(d._dEH,f,n)}))}),c.push(()=>r.emit("afterTransaction",[n,r])),c.push(()=>{n._needFormattingCleanup&&g8(n)})}),h1(c,[])}finally{r.gc&&WB(s,i,r.gcFilter),GB(s,i),n.afterState.forEach((p,m)=>{const g=n.beforeState.get(m)||0;if(g!==p){const b=i.clients.get(m),S=li(ai(b,g),1);for(let v=b.length-1;v>=S;)v-=1+Eh(b,v)}});for(let p=l.length-1;p>=0;p--){const{client:m,clock:g}=l[p].id,b=i.clients.get(m),S=ai(b,g);S+1<b.length&&Eh(b,S+1)>1||S>0&&Eh(b,S)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(CB(x1,L_,"[yjs] ",j_,I_,"Changed the client-id because another client seems to be using it."),r.clientID=F_()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const p=new wf;mT(p,n)&&r.emit("update",[p.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const p=new fl;mT(p,n)&&r.emit("updateV2",[p.toUint8Array(),n.origin,r,n])}const{subdocsAdded:c,subdocsLoaded:f,subdocsRemoved:d}=n;(c.size>0||d.size>0||f.size>0)&&(c.forEach(p=>{p.clientID=r.clientID,p.collectionid==null&&(p.collectionid=r.collectionid),r.subdocs.add(p)}),d.forEach(p=>r.subdocs.delete(p)),r.emit("subdocs",[{loaded:f,added:c,removed:d},r,n]),d.forEach(p=>p.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):nD(t,e+1)}}},vt=(t,e,n=null,r=!0)=>{const i=t._transactionCleanups;let s=!1,l=null;t._transaction===null&&(s=!0,t._transaction=new KB(t,n,r),i.push(t._transaction),i.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{l=e(t._transaction)}finally{if(s){const c=t._transaction===i[0];t._transaction=null,c&&nD(i,0)}}return l};class ZB{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const yT=(t,e,n)=>{go(t,n.deletions,r=>{r instanceof Tt&&e.scope.some(i=>i===t.doc||tf(i,r))&&D1(r,!1)})},bT=(t,e,n)=>{let r=null;const i=t.doc,s=t.scope;vt(i,c=>{for(;e.length>0&&t.currStackItem===null;){const f=i.store,d=e.pop(),p=new Set,m=[];let g=!1;go(c,d.insertions,b=>{if(b instanceof Tt){if(b.redone!==null){let{item:S,diff:v}=qb(f,b.id);v>0&&(S=lr(c,$e(S.id.client,S.id.clock+v))),b=S}!b.deleted&&s.some(S=>S===c.doc||tf(S,b))&&m.push(b)}}),go(c,d.deletions,b=>{b instanceof Tt&&s.some(S=>S===c.doc||tf(S,b))&&!tc(d.insertions,b.id)&&p.add(b)}),p.forEach(b=>{g=vD(c,b,p,d.insertions,t.ignoreRemoteMapChanges,t)!==null||g});for(let b=m.length-1;b>=0;b--){const S=m[b];t.deleteFilter(S)&&(S.delete(c),g=!0)}t.currStackItem=g?d:null}c.changed.forEach((f,d)=>{f.has(null)&&d._searchMarker&&(d._searchMarker.length=0)}),r=c},t);const l=t.currStackItem;if(l!=null){const c=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:l,type:n,changedParentTypes:c,origin:t},t]),t.currStackItem=null}return l};class rD extends o_{constructor(e,{captureTimeout:n=500,captureTransaction:r=f=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:l=!1,doc:c=Ha(e)?e[0].doc:e instanceof Di?e:e.doc}={}){super(),this.scope=[],this.doc=c,this.addToScope(e),this.deleteFilter=i,s.add(this),this.trackedOrigins=s,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=l,this.captureTimeout=n,this.afterTransactionHandler=f=>{if(!this.captureTransaction(f)||!this.scope.some(C=>f.changedParentTypes.has(C)||C===this.doc)||!this.trackedOrigins.has(f.origin)&&(!f.origin||!this.trackedOrigins.has(f.origin.constructor)))return;const d=this.undoing,p=this.redoing,m=d?this.redoStack:this.undoStack;d?this.stopCapturing():p||this.clear(!1,!0);const g=new ec;f.afterState.forEach((C,E)=>{const B=f.beforeState.get(E)||0,I=C-B;I>0&&Qu(g,E,B,I)});const b=f5();let S=!1;if(this.lastChange>0&&b-this.lastChange<this.captureTimeout&&m.length>0&&!d&&!p){const C=m[m.length-1];C.deletions=Hb([C.deletions,f.deleteSet]),C.insertions=Hb([C.insertions,g])}else m.push(new ZB(f.deleteSet,g)),S=!0;!d&&!p&&(this.lastChange=b),go(f,f.deleteSet,C=>{C instanceof Tt&&this.scope.some(E=>E===f.doc||tf(E,C))&&D1(C,!0)});const v=[{stackItem:m[m.length-1],origin:f.origin,type:d?"redo":"undo",changedParentTypes:f.changedParentTypes},this];S?this.emit("stack-item-added",v):this.emit("stack-item-updated",v)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){const n=new Set(this.scope);e=Ha(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof gn?r.doc!==this.doc:r!==this.doc)&&U_("[yjs#509] Not same Y.Doc"),this.scope.push(r))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,n=!0){(e&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(i=>yT(r,this,i)),this.undoStack=[]),n&&(this.redoStack.forEach(i=>yT(r,this,i)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=bT(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=bT(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*JB(t){const e=Xe(t.restDecoder);for(let n=0;n<e;n++){const r=Xe(t.restDecoder),i=t.readClient();let s=Xe(t.restDecoder);for(let l=0;l<r;l++){const c=t.readInfo();if(c===10){const f=Xe(t.restDecoder);yield new Kr($e(i,s),f),s+=f}else if((dm&c)!==0){const f=(c&(hs|Yn))===0,d=new Tt($e(i,s),null,(c&Yn)===Yn?t.readLeftID():null,null,(c&hs)===hs?t.readRightID():null,f?t.readParentInfo()?t.readString():t.readLeftID():null,f&&(c&Wu)===Wu?t.readString():null,kD(t,c));yield d,s+=d.length}else{const f=t.readLen();yield new Yr($e(i,s),f),s+=f}}}}class C1{constructor(e,n){this.gen=JB(e),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===Kr);return this.curr}}class E1{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const XB=t=>lp(t,Y_,wf),QB=(t,e)=>{if(t.constructor===Yr){const{client:n,clock:r}=t.id;return new Yr($e(n,r+e),t.length-e)}else if(t.constructor===Kr){const{client:n,clock:r}=t.id;return new Kr($e(n,r+e),t.length-e)}else{const n=t,{client:r,clock:i}=n.id;return new Tt($e(r,i+e),null,$e(r,i+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},lp=(t,e=qa,n=fl)=>{if(t.length===1)return t[0];const r=t.map(p=>new e(Ja(p)));let i=r.map(p=>new C1(p,!0)),s=null;const l=new n,c=new E1(l);for(;i=i.filter(g=>g.curr!==null),i.sort((g,b)=>{if(g.curr.id.client===b.curr.id.client){const S=g.curr.id.clock-b.curr.id.clock;return S===0?g.curr.constructor===b.curr.constructor?0:g.curr.constructor===Kr?1:-1:S}else return b.curr.id.client-g.curr.id.client}),i.length!==0;){const p=i[0],m=p.curr.id.client;if(s!==null){let g=p.curr,b=!1;for(;g!==null&&g.id.clock+g.length<=s.struct.id.clock+s.struct.length&&g.id.client>=s.struct.id.client;)g=p.next(),b=!0;if(g===null||g.id.client!==m||b&&g.id.clock>s.struct.id.clock+s.struct.length)continue;if(m!==s.struct.id.client)Xs(c,s.struct,s.offset),s={struct:g,offset:0},p.next();else if(s.struct.id.clock+s.struct.length<g.id.clock)if(s.struct.constructor===Kr)s.struct.length=g.id.clock+g.length-s.struct.id.clock;else{Xs(c,s.struct,s.offset);const S=g.id.clock-s.struct.id.clock-s.struct.length;s={struct:new Kr($e(m,s.struct.id.clock+s.struct.length),S),offset:0}}else{const S=s.struct.id.clock+s.struct.length-g.id.clock;S>0&&(s.struct.constructor===Kr?s.struct.length-=S:g=QB(g,S)),s.struct.mergeWith(g)||(Xs(c,s.struct,s.offset),s={struct:g,offset:0},p.next())}}else s={struct:p.curr,offset:0},p.next();for(let g=p.curr;g!==null&&g.id.client===m&&g.id.clock===s.struct.id.clock+s.struct.length&&g.constructor!==Kr;g=p.next())Xs(c,s.struct,s.offset),s={struct:g,offset:0}}s!==null&&(Xs(c,s.struct,s.offset),s=null),T1(c);const f=r.map(p=>w1(p)),d=Hb(f);return nc(l,d),l.toUint8Array()},e8=(t,e,n=qa,r=fl)=>{const i=G_(e),s=new r,l=new E1(s),c=new n(Ja(t)),f=new C1(c,!1);for(;f.curr;){const p=f.curr,m=p.id.client,g=i.get(m)||0;if(f.curr.constructor===Kr){f.next();continue}if(p.id.clock+p.length>g)for(Xs(l,p,li(g-p.id.clock,0)),f.next();f.curr&&f.curr.id.client===m;)Xs(l,f.curr,0),f.next();else for(;f.curr&&f.curr.id.client===m&&f.curr.id.clock+f.curr.length<=g;)f.next()}T1(l);const d=w1(c);return nc(s,d),s.toUint8Array()},iD=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:si(t.encoder.restEncoder)}),t.encoder.restEncoder=xf(),t.written=0)},Xs=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&iD(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),it(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},T1=t=>{iD(t);const e=t.encoder.restEncoder;it(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];it(e,r.written),hm(e,r.restEncoder)}},t8=(t,e,n,r)=>{const i=new n(Ja(t)),s=new C1(i,!1),l=new r,c=new E1(l);for(let d=s.curr;d!==null;d=s.next())Xs(c,e(d),0);T1(c);const f=w1(i);return nc(l,f),l.toUint8Array()},n8=t=>t8(t,w5,qa,wf),xT="You must not compute changes after the event-handler fired.";class wm{constructor(e,n){this.target=e,this.currentTarget=e,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=r8(this.currentTarget,this.target))}deletes(e){return tc(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw _i(xT);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(i=>{if(i!==null){const s=n._map.get(i);let l,c;if(this.adds(s)){let f=s.left;for(;f!==null&&this.adds(f);)f=f.left;if(this.deletes(s))if(f!==null&&this.deletes(f))l="delete",c=g0(f.content.getContent());else return;else f!==null&&this.deletes(f)?(l="update",c=g0(f.content.getContent())):(l="add",c=void 0)}else if(this.deletes(s))l="delete",c=g0(s.content.getContent());else return;e.set(i,{action:l,oldValue:c})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw _i(xT);const n=this.target,r=ul(),i=ul(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(n).has(null)){let c=null;const f=()=>{c&&s.push(c)};for(let d=n._start;d!==null;d=d.right)d.deleted?this.deletes(d)&&!this.adds(d)&&((c===null||c.delete===void 0)&&(f(),c={delete:0}),c.delete+=d.length,i.add(d)):this.adds(d)?((c===null||c.insert===void 0)&&(f(),c={insert:[]}),c.insert=c.insert.concat(d.content.getContent()),r.add(d)):((c===null||c.retain===void 0)&&(f(),c={retain:0}),c.retain+=d.length);c!==null&&c.retain===void 0&&f()}this._changes=e}return e}}const r8=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;n.unshift(r)}e=e._item.parent}return n},In=()=>{U_("Invalid access: Add Yjs type to a document before reading data.")},sD=80;let A1=0;class i8{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=A1++}}const s8=t=>{t.timestamp=A1++},oD=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=A1++},o8=(t,e,n)=>{if(t.length>=sD){const r=t.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return oD(r,e,n),r}else{const r=new i8(e,n);return t.push(r),r}},vm=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((s,l)=>wh(e-s.index)<wh(e-l.index)?s:l);let r=t._start,i=0;for(n!==null&&(r=n.p,i=n.index,s8(n));r.right!==null&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&wh(n.index-i)<r.parent.length/sD?(oD(n,r,i),n):o8(t._searchMarker,r,i)},rf=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const i=t[r];if(n>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){t.splice(r,1);continue}i.p=s,s.marker=!0}(e<i.index||n>0&&e===i.index)&&(i.index=li(e,i.index+n))}},km=(t,e,n)=>{const r=t,i=e.changedParentTypes;for(;zi(i,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;J_(r._eH,n,e)};class gn{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=uT(),this._dEH=uT(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw Xr()}clone(){throw Xr()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,n){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){fT(this._eH,e)}observeDeep(e){fT(this._dEH,e)}unobserve(e){dT(this._eH,e)}unobserveDeep(e){dT(this._dEH,e)}toJSON(){}}const lD=(t,e,n)=>{t.doc??In(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const i=[];let s=t._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const l=s.content.getContent();if(l.length<=e)e-=l.length;else{for(let c=e;c<l.length&&r>0;c++)i.push(l[c]),r--;e=0}}s=s.right}return i},aD=t=>{t.doc??In();const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}n=n.right}return e},cD=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&Fo(r,e)){const i=r.content.getContent();for(let s=0;s<i.length;s++)n.push(i[s])}r=r.right}return n},sf=(t,e)=>{let n=0,r=t._start;for(t.doc??In();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s<i.length;s++)e(i[s],n++,t)}r=r.right}},uD=(t,e)=>{const n=[];return sf(t,(r,i)=>{n.push(e(r,i,t))}),n},l8=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const i=n[r++];return n.length<=r&&(n=null),{done:!1,value:i}}}},fD=(t,e)=>{t.doc??In();const n=vm(t,e);let r=t._start;for(n!==null&&(r=n.p,e-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},ap=(t,e,n,r)=>{let i=n;const s=t.doc,l=s.clientID,c=s.store,f=n===null?e._start:n.right;let d=[];const p=()=>{d.length>0&&(i=new Tt($e(l,Gt(c,l)),i,i&&i.lastId,f,f&&f.id,e,null,new hl(d)),i.integrate(t,0),d=[])};r.forEach(m=>{if(m===null)d.push(m);else switch(m.constructor){case Number:case Object:case Boolean:case Array:case String:d.push(m);break;default:switch(p(),m.constructor){case Uint8Array:case ArrayBuffer:i=new Tt($e(l,Gt(c,l)),i,i&&i.lastId,f,f&&f.id,e,null,new kf(new Uint8Array(m))),i.integrate(t,0);break;case Di:i=new Tt($e(l,Gt(c,l)),i,i&&i.lastId,f,f&&f.id,e,null,new Cf(m)),i.integrate(t,0);break;default:if(m instanceof gn)i=new Tt($e(l,Gt(c,l)),i,i&&i.lastId,f,f&&f.id,e,null,new ui(m)),i.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),p()},dD=()=>_i("Length exceeded!"),hD=(t,e,n,r)=>{if(n>e._length)throw dD();if(n===0)return e._searchMarker&&rf(e._searchMarker,n,r.length),ap(t,e,null,r);const i=n,s=vm(e,n);let l=e._start;for(s!==null&&(l=s.p,n-=s.index,n===0&&(l=l.prev,n+=l&&l.countable&&!l.deleted?l.length:0));l!==null;l=l.right)if(!l.deleted&&l.countable){if(n<=l.length){n<l.length&&lr(t,$e(l.id.client,l.id.clock+n));break}n-=l.length}return e._searchMarker&&rf(e._searchMarker,i,r.length),ap(t,e,l,r)},a8=(t,e,n)=>{let i=(e._searchMarker||[]).reduce((s,l)=>l.index>s.index?l:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return ap(t,e,i,n)},pD=(t,e,n,r)=>{if(r===0)return;const i=n,s=r,l=vm(e,n);let c=e._start;for(l!==null&&(c=l.p,n-=l.index);c!==null&&n>0;c=c.right)!c.deleted&&c.countable&&(n<c.length&&lr(t,$e(c.id.client,c.id.clock+n)),n-=c.length);for(;r>0&&c!==null;)c.deleted||(r<c.length&&lr(t,$e(c.id.client,c.id.clock+r)),c.delete(t),r-=c.length),c=c.right;if(r>0)throw dD();e._searchMarker&&rf(e._searchMarker,i,-s+r)},cp=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},M1=(t,e,n,r)=>{const i=e._map.get(n)||null,s=t.doc,l=s.clientID;let c;if(r==null)c=new hl([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:c=new hl([r]);break;case Uint8Array:c=new kf(r);break;case Di:c=new Cf(r);break;default:if(r instanceof gn)c=new ui(r);else throw new Error("Unexpected content type")}new Tt($e(l,Gt(s.store,l)),i,i&&i.lastId,null,null,e,n,c).integrate(t,0)},O1=(t,e)=>{t.doc??In();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},mD=t=>{const e={};return t.doc??In(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},gD=(t,e)=>{t.doc??In();const n=t._map.get(e);return n!==void 0&&!n.deleted},c8=(t,e)=>{const n={};return t._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&Fo(s,e)&&(n[i]=s.content.getContent()[s.length-1])}),n},Xd=t=>(t.doc??In(),EB(t._map.entries(),e=>!e[1].deleted));class u8 extends wm{}class Aa extends gn{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new Aa;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Aa}clone(){const e=new Aa;return e.insert(0,this.toArray().map(n=>n instanceof gn?n.clone():n)),e}get length(){return this.doc??In(),this._length}_callObserver(e,n){super._callObserver(e,n),km(this,e,new u8(this,e))}insert(e,n){this.doc!==null?vt(this.doc,r=>{hD(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?vt(this.doc,n=>{a8(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?vt(this.doc,r=>{pD(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return fD(this,e)}toArray(){return aD(this)}slice(e=0,n=this.length){return lD(this,e,n)}toJSON(){return this.map(e=>e instanceof gn?e.toJSON():e)}map(e){return uD(this,e)}forEach(e){sf(this,e)}[Symbol.iterator](){return l8(this)}_write(e){e.writeTypeRef(L8)}}const f8=t=>new Aa;class d8 extends wm{constructor(e,n,r){super(e,n),this.keysChanged=r}}class Ya extends gn{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new Ya}clone(){const e=new Ya;return this.forEach((n,r)=>{e.set(r,n instanceof gn?n.clone():n)}),e}_callObserver(e,n){km(this,e,new d8(this,e,n))}toJSON(){this.doc??In();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];e[r]=i instanceof gn?i.toJSON():i}}),e}get size(){return[...Xd(this)].length}keys(){return k0(Xd(this),e=>e[0])}values(){return k0(Xd(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return k0(Xd(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??In(),this._map.forEach((n,r)=>{n.deleted||e(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?vt(this.doc,n=>{cp(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?vt(this.doc,r=>{M1(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return O1(this,e)}has(e){return gD(this,e)}clear(){this.doc!==null?vt(this.doc,e=>{this.forEach(function(n,r,i){cp(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(j8)}}const h8=t=>new Ya,io=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&x5(t,e);class Fb{constructor(e,n,r,i){this.left=e,this.right=n,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&Hn(),this.right.content.constructor){case sn:this.right.deleted||rc(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const ST=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case sn:e.right.deleted||rc(e.currentAttributes,e.right.content);break;default:e.right.deleted||(n<e.right.length&&lr(t,$e(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},Qd=(t,e,n,r)=>{const i=new Map,s=r?vm(e,n):null;if(s){const l=new Fb(s.p.left,s.p,s.index,i);return ST(t,l,n-s.index)}else{const l=new Fb(null,e._start,0,i);return ST(t,l,n)}},yD=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===sn&&io(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const i=t.doc,s=i.clientID;r.forEach((l,c)=>{const f=n.left,d=n.right,p=new Tt($e(s,Gt(i.store,s)),f,f&&f.lastId,d,d&&d.id,e,null,new sn(c,l));p.integrate(t,0),n.right=p,n.forward()})},rc=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},bD=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===sn&&io(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},xD=(t,e,n,r)=>{const i=t.doc,s=i.clientID,l=new Map;for(const c in r){const f=r[c],d=n.currentAttributes.get(c)??null;if(!io(d,f)){l.set(c,d);const{left:p,right:m}=n;n.right=new Tt($e(s,Gt(i.store,s)),p,p&&p.lastId,m,m&&m.id,e,null,new sn(c,f)),n.right.integrate(t,0),n.forward()}}return l},T0=(t,e,n,r,i)=>{n.currentAttributes.forEach((g,b)=>{i[b]===void 0&&(i[b]=null)});const s=t.doc,l=s.clientID;bD(n,i);const c=xD(t,e,n,i),f=r.constructor===String?new ci(r):r instanceof gn?new ui(r):new bl(r);let{left:d,right:p,index:m}=n;e._searchMarker&&rf(e._searchMarker,n.index,f.getLength()),p=new Tt($e(l,Gt(s.store,l)),d,d&&d.lastId,p,p&&p.id,e,null,f),p.integrate(t,0),n.right=p,n.index=m,n.forward(),yD(t,e,n,c)},wT=(t,e,n,r,i)=>{const s=t.doc,l=s.clientID;bD(n,i);const c=xD(t,e,n,i);e:for(;n.right!==null&&(r>0||c.size>0&&(n.right.deleted||n.right.content.constructor===sn));){if(!n.right.deleted)switch(n.right.content.constructor){case sn:{const{key:f,value:d}=n.right.content,p=i[f];if(p!==void 0){if(io(p,d))c.delete(f);else{if(r===0)break e;c.set(f,d)}n.right.delete(t)}else n.currentAttributes.set(f,d);break}default:r<n.right.length&&lr(t,$e(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let f="";for(;r>0;r--)f+=`
|
|
151
|
-
`;n.right=new Tt($e(l,Gt(s.store,l)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new ci(f)),n.right.integrate(t,0),n.forward()}yD(t,e,n,c)},SD=(t,e,n,r,i)=>{let s=e;const l=Jr();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===sn){const d=s.content;l.set(d.key,d)}s=s.right}let c=0,f=!1;for(;e!==s;){if(n===e&&(f=!0),!e.deleted){const d=e.content;switch(d.constructor){case sn:{const{key:p,value:m}=d,g=r.get(p)??null;(l.get(p)!==d||g===m)&&(e.delete(t),c++,!f&&(i.get(p)??null)===m&&g!==m&&(g===null?i.delete(p):i.set(p,g))),!f&&!e.deleted&&rc(i,d);break}}}e=e.right}return c},p8=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===sn){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},m8=t=>{let e=0;return vt(t.doc,n=>{let r=t._start,i=t._start,s=Jr();const l=zb(s);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case sn:rc(l,i.content);break;default:e+=SD(n,r,i,s,l),s=zb(l),r=i;break}i=i.right}}),e},g8=t=>{const e=new Set,n=t.doc;for(const[r,i]of t.afterState.entries()){const s=t.beforeState.get(r)||0;i!==s&&tD(t,n.store.clients.get(r),s,i,l=>{!l.deleted&&l.content.constructor===sn&&l.constructor!==Yr&&e.add(l.parent)})}vt(n,r=>{go(t,t.deleteSet,i=>{if(i instanceof Yr||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===sn?e.add(s):p8(r,i)});for(const i of e)m8(i)})},vT=(t,e,n)=>{const r=n,i=zb(e.currentAttributes),s=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case ui:case bl:case ci:n<e.right.length&&lr(t,$e(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}s&&SD(t,s,e.right,i,e.currentAttributes);const l=(e.left||e.right).parent;return l._searchMarker&&rf(l._searchMarker,e.index,-r+n),e};class y8 extends wm{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,n=[];vt(e,r=>{const i=new Map,s=new Map;let l=this.target._start,c=null;const f={};let d="",p=0,m=0;const g=()=>{if(c!==null){let b=null;switch(c){case"delete":m>0&&(b={delete:m}),m=0;break;case"insert":(typeof d=="object"||d.length>0)&&(b={insert:d},i.size>0&&(b.attributes={},i.forEach((S,v)=>{S!==null&&(b.attributes[v]=S)}))),d="";break;case"retain":p>0&&(b={retain:p},b5(f)||(b.attributes=g5({},f))),p=0;break}b&&n.push(b),c=null}};for(;l!==null;){switch(l.content.constructor){case ui:case bl:this.adds(l)?this.deletes(l)||(g(),c="insert",d=l.content.getContent()[0],g()):this.deletes(l)?(c!=="delete"&&(g(),c="delete"),m+=1):l.deleted||(c!=="retain"&&(g(),c="retain"),p+=1);break;case ci:this.adds(l)?this.deletes(l)||(c!=="insert"&&(g(),c="insert"),d+=l.content.str):this.deletes(l)?(c!=="delete"&&(g(),c="delete"),m+=l.length):l.deleted||(c!=="retain"&&(g(),c="retain"),p+=l.length);break;case sn:{const{key:b,value:S}=l.content;if(this.adds(l)){if(!this.deletes(l)){const v=i.get(b)??null;io(v,S)?S!==null&&l.delete(r):(c==="retain"&&g(),io(S,s.get(b)??null)?delete f[b]:f[b]=S)}}else if(this.deletes(l)){s.set(b,S);const v=i.get(b)??null;io(v,S)||(c==="retain"&&g(),f[b]=v)}else if(!l.deleted){s.set(b,S);const v=f[b];v!==void 0&&(io(v,S)?v!==null&&l.delete(r):(c==="retain"&&g(),S===null?delete f[b]:f[b]=S))}l.deleted||(c==="insert"&&g(),rc(i,l.content));break}}l=l.right}for(g();n.length>0;){const b=n[n.length-1];if(b.retain!==void 0&&b.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class yo extends gn{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??In(),this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new yo}clone(){const e=new yo;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new y8(this,e,n);km(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??In();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===ci&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?vt(this.doc,r=>{const i=new Fb(null,this._start,0,new Map);for(let s=0;s<e.length;s++){const l=e[s];if(l.insert!==void 0){const c=!n&&typeof l.insert=="string"&&s===e.length-1&&i.right===null&&l.insert.slice(-1)===`
|
|
152
|
-
`?l.insert.slice(0,-1):l.insert;(typeof c!="string"||c.length>0)&&T0(r,this,i,c,l.attributes||{})}else l.retain!==void 0?wT(r,this,i,l.retain,l.attributes||{}):l.delete!==void 0&&vT(r,i,l.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??In();const i=[],s=new Map,l=this.doc;let c="",f=this._start;function d(){if(c.length>0){const m={};let g=!1;s.forEach((S,v)=>{g=!0,m[v]=S});const b={insert:c};g&&(b.attributes=m),i.push(b),c=""}}const p=()=>{for(;f!==null;){if(Fo(f,e)||n!==void 0&&Fo(f,n))switch(f.content.constructor){case ci:{const m=s.get("ychange");e!==void 0&&!Fo(f,e)?(m===void 0||m.user!==f.id.client||m.type!=="removed")&&(d(),s.set("ychange",r?r("removed",f.id):{type:"removed"})):n!==void 0&&!Fo(f,n)?(m===void 0||m.user!==f.id.client||m.type!=="added")&&(d(),s.set("ychange",r?r("added",f.id):{type:"added"})):m!==void 0&&(d(),s.delete("ychange")),c+=f.content.str;break}case ui:case bl:{d();const m={insert:f.content.getContent()[0]};if(s.size>0){const g={};m.attributes=g,s.forEach((b,S)=>{g[S]=b})}i.push(m);break}case sn:Fo(f,e)&&(d(),rc(s,f.content));break}f=f.right}d()};return e||n?vt(l,m=>{e&&Pb(m,e),n&&Pb(m,n),p()},"cleanup"):p(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?vt(i,s=>{const l=Qd(s,this,e,!r);r||(r={},l.currentAttributes.forEach((c,f)=>{r[f]=c})),T0(s,this,l,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?vt(i,s=>{const l=Qd(s,this,e,!r);T0(s,this,l,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?vt(r,i=>{vT(i,Qd(i,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const i=this.doc;i!==null?vt(i,s=>{const l=Qd(s,this,e,!1);l.right!==null&&wT(s,this,l,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?vt(this.doc,n=>{cp(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?vt(this.doc,r=>{M1(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return O1(this,e)}getAttributes(){return mD(this)}_write(e){e.writeTypeRef(I8)}}const b8=t=>new yo;class A0{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??In()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===zn||n.constructor===dl)&&n._start!==null)e=n._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class dl extends gn{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new dl}clone(){const e=new dl;return e.insert(0,this.toArray().map(n=>n instanceof gn?n.clone():n)),e}get length(){return this.doc??In(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new A0(this,e)}querySelector(e){e=e.toUpperCase();const r=new A0(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),mo(new A0(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){km(this,e,new w8(this,n,e))}toString(){return uD(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),sf(this,s=>{i.insertBefore(s.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?vt(this.doc,r=>{hD(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)vt(this.doc,r=>{const i=e&&e instanceof gn?e._item:e;ap(r,this,i,n)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw _i("Reference item not found");r.splice(i,0,...n)}}delete(e,n=1){this.doc!==null?vt(this.doc,r=>{pD(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return aD(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return fD(this,e)}slice(e=0,n=this.length){return lD(this,e,n)}forEach(e){sf(this,e)}_write(e){e.writeTypeRef(U8)}}const x8=t=>new dl;class zn extends dl{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new zn(this.nodeName)}clone(){const e=new zn(this.nodeName),n=this.getAttributes();return y5(n,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof gn?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const c in e)r.push(c);r.sort();const i=r.length;for(let c=0;c<i;c++){const f=r[c];n.push(f+'="'+e[f]+'"')}const s=this.nodeName.toLocaleLowerCase(),l=n.length>0?" "+n.join(" "):"";return`<${s}${l}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?vt(this.doc,n=>{cp(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?vt(this.doc,r=>{M1(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return O1(this,e)}hasAttribute(e){return gD(this,e)}getAttributes(e){return e?c8(this,e):mD(this)}toDOM(e=document,n={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const l in s){const c=s[l];typeof c=="string"&&i.setAttribute(l,c)}return sf(this,l=>{i.appendChild(l.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(B8),e.writeKey(this.nodeName)}}const S8=t=>new zn(t.readKey());class w8 extends wm{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class up extends Ya{constructor(e){super(),this.hookName=e}_copy(){return new up(this.hookName)}clone(){const e=new up(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const i=n[this.hookName];let s;return i!==void 0?s=i.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(H8),e.writeKey(this.hookName)}}const v8=t=>new up(t.readKey());class Kn extends yo{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Kn}clone(){const e=new Kn;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const n=[];for(const i in e.attributes){const s=[];for(const l in e.attributes[i])s.push({key:l,value:e.attributes[i][l]});s.sort((l,c)=>l.key<c.key?-1:1),n.push({nodeName:i,attrs:s})}n.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<n.length;i++){const s=n[i];r+=`<${s.nodeName}`;for(let l=0;l<s.attrs.length;l++){const c=s.attrs[l];r+=` ${c.key}="${c.value}"`}r+=">"}r+=e.insert;for(let i=n.length-1;i>=0;i--)r+=`</${n[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(V8)}}const k8=t=>new Kn;class _1{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Xr()}mergeWith(e){return!1}write(e,n,r){throw Xr()}integrate(e,n){throw Xr()}}const C8=0;class Yr extends _1{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),eD(e.doc.store,this)}write(e,n){e.writeInfo(C8),e.writeLen(this.length-n)}getMissing(e,n){return null}}class kf{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new kf(this.content)}splice(e){throw Xr()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const E8=t=>new kf(t.readBuf());class of{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new of(this.len)}splice(e){const n=new of(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){Qu(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const T8=t=>new of(t.readLen()),wD=(t,e)=>new Di({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Cf{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Cf(wD(this.doc.guid,this.opts))}splice(e){throw Xr()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const A8=t=>new Cf(wD(t.readString(),t.readAny()));class bl{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new bl(this.embed)}splice(e){throw Xr()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const M8=t=>new bl(t.readJSON());class sn{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new sn(this.key,this.value)}splice(e){throw Xr()}mergeWith(e){return!1}integrate(e,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const O8=t=>new sn(t.readKey(),t.readJSON());class fp{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new fp(this.arr)}splice(e){const n=new fp(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeString(s===void 0?"undefined":JSON.stringify(s))}}getRef(){return 2}}const _8=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const i=t.readString();i==="undefined"?n.push(void 0):n.push(JSON.parse(i))}return new fp(n)},D8=np("node_env")==="development";class hl{constructor(e){this.arr=e,D8&&m_(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new hl(this.arr)}splice(e){const n=new hl(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}const R8=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new hl(n)};class ci{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new ci(this.str)}splice(e){const n=new ci(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const N8=t=>new ci(t.readString()),z8=[f8,h8,b8,S8,x8,v8,k8],L8=0,j8=1,I8=2,B8=3,U8=4,H8=5,V8=6;class ui{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new ui(this.type._copy())}splice(e){throw Xr()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const P8=t=>new ui(z8[t.readTypeRef()](t)),qb=(t,e)=>{let n=e,r=0,i;do r>0&&(n=$e(n.client,n.clock+r)),i=Ta(t,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof Tt);return{item:i,diff:r}},D1=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},dp=(t,e,n)=>{const{client:r,clock:i}=e.id,s=new Tt($e(r,i+n),e,$e(r,i+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=$e(e.redone.client,e.redone.clock+n)),e.right=s,s.right!==null&&(s.right.left=s),t._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=n,s},kT=(t,e)=>l1(t,n=>tc(n.deletions,e)),vD=(t,e,n,r,i,s)=>{const l=t.doc,c=l.store,f=l.clientID,d=e.redone;if(d!==null)return lr(t,d);let p=e.parent._item,m=null,g;if(p!==null&&p.deleted===!0){if(p.redone===null&&(!n.has(p)||vD(t,p,n,r,i,s)===null))return null;for(;p.redone!==null;)p=lr(t,p.redone)}const b=p===null?e.parent:p.content.type;if(e.parentSub===null){for(m=e.left,g=e;m!==null;){let E=m;for(;E!==null&&E.parent._item!==p;)E=E.redone===null?null:lr(t,E.redone);if(E!==null&&E.parent._item===p){m=E;break}m=m.left}for(;g!==null;){let E=g;for(;E!==null&&E.parent._item!==p;)E=E.redone===null?null:lr(t,E.redone);if(E!==null&&E.parent._item===p){g=E;break}g=g.right}}else if(g=null,e.right&&!i){for(m=e;m!==null&&m.right!==null&&(m.right.redone||tc(r,m.right.id)||kT(s.undoStack,m.right.id)||kT(s.redoStack,m.right.id));)for(m=m.right;m.redone;)m=lr(t,m.redone);if(m&&m.right!==null)return null}else m=b._map.get(e.parentSub)||null;const S=Gt(c,f),v=$e(f,S),C=new Tt(v,m,m&&m.lastId,g,g&&g.id,b,e.parentSub,e.content.copy());return e.redone=v,D1(C,!0),C.integrate(t,0),C};let Tt=class Yb extends _1{constructor(e,n,r,i,s,l,c,f){super(e,f.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=s,this.parent=l,this.parentSub=c,this.redone=null,this.content=f,this.info=this.content.isCountable()?JE:0}set marker(e){(this.info&b0)>0!==e&&(this.info^=b0)}get marker(){return(this.info&b0)>0}get keep(){return(this.info&ZE)>0}set keep(e){this.keep!==e&&(this.info^=ZE)}get countable(){return(this.info&JE)>0}get deleted(){return(this.info&y0)>0}set deleted(e){this.deleted!==e&&(this.info^=y0)}markDeleted(){this.info|=y0}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Gt(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Gt(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Ea&&this.id.client!==this.parent.client&&this.parent.clock>=Gt(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=pT(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=lr(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Yr||this.right&&this.right.constructor===Yr)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Yb?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===Yb&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Ea){const r=Ta(n,this.parent);r.constructor===Yr?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=pT(e,e.doc.store,$e(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,l=new Set;for(;i!==null&&i!==this.right;){if(l.add(i),s.add(i),ba(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(ba(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&l.has(Ta(e.doc.store,i.origin)))s.has(Ta(e.doc.store,i.origin))||(r=i,s.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),eD(e.doc.store,this),this.content.integrate(e,this),gT(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Yr(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:$e(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&ba(e.origin,this.lastId)&&this.right===e&&ba(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),Qu(e.deleteSet,this.id.client,this.id.clock,this.length),gT(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw Hn();this.content.gc(e),n?YB(e,this,new Yr(this.id,this.length)):this.content=new of(this.length)}write(e,n){const r=n>0?$e(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,s=this.parentSub,l=this.content.getRef()&dm|(r===null?0:Yn)|(i===null?0:hs)|(s===null?0:Wu);if(e.writeInfo(l),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const c=this.parent;if(c._item!==void 0){const f=c._item;if(f===null){const d=ef(c);e.writeParentInfo(!0),e.writeString(d)}else e.writeParentInfo(!1),e.writeLeftID(f.id)}else c.constructor===String?(e.writeParentInfo(!0),e.writeString(c)):c.constructor===Ea?(e.writeParentInfo(!1),e.writeLeftID(c)):Hn();s!==null&&e.writeString(s)}this.content.write(e,n)}};const kD=(t,e)=>$8[e&dm](t),$8=[()=>{Hn()},T8,_8,E8,N8,M8,O8,P8,R8,A8,()=>{Hn()}],F8=10;class Kr extends _1{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){Hn()}write(e,n){e.writeInfo(F8),it(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const CD=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},ED="__ $YJS$ __";CD[ED]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");CD[ED]=!0;const q8=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},Y8=/[\uD800-\uDBFF]/,K8=/[\uDC00-\uDFFF]/,W8=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&Y8.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&K8.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},G8=W8,jt=new Dt("y-sync"),Ei=new Dt("y-undo"),eh=new Dt("yjs-cursor"),Ti=(t,e)=>t>>>e|t<<32-e,Z8=t=>Ti(t,2)^Ti(t,13)^Ti(t,22),J8=t=>Ti(t,6)^Ti(t,11)^Ti(t,25),X8=t=>Ti(t,7)^Ti(t,18)^t>>>3,Q8=t=>Ti(t,17)^Ti(t,19)^t>>>10,eU=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),tU=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class nU{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(tU),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let m=16;m<64;m++)n[m]=Q8(n[m-2])+n[m-7]+X8(n[m-15])+n[m-16];let r=e[0],i=e[1],s=e[2],l=e[3],c=e[4],f=e[5],d=e[6],p=e[7];for(let m=0,g,b;m<64;m++)g=p+J8(c)+(c&f^~c&d)+eU[m]+n[m]>>>0,b=Z8(r)+(r&i^r&s^i&s)>>>0,p=d,d=f,f=c,c=l+g>>>0,l=s,s=i,i=r,r=g+b>>>0;e[0]+=r,e[1]+=i,e[2]+=s,e[3]+=l,e[4]+=c,e[5]+=f,e[6]+=d,e[7]+=p}digest(e){let n=0;for(;n+56<=e.length;){let l=0;for(;l<16&&n+3<e.length;l++)this._W[l]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,l,16);n<e.length;)this._W[l]|=e[n]<<(3-n%4)*8,n++;this._W[l]|=Yn<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let i=0;for(;n<e.length;i++)for(let l=3;l>=0&&n<e.length;l--)this._W[i]|=e[n++]<<l*8;r||(this._W[i-(n%4===0?0:1)]|=Yn<<(3-n%4)*8),this._W[14]=e.byteLength/OI,this._W[15]=e.byteLength*8,this._updateHash();const s=new Uint8Array(32);for(let l=0;l<this._H.length;l++)for(let c=0;c<4;c++)s[l*4+c]=this._H[l]>>>(3-c)*8;return s}}const rU=t=>new nU().digest(t),iU=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},sU=t=>_5(iU(rU(R5(t)))),hp=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!tc(e.ds,t.id),oU=[{light:"#ecd44433",dark:"#ecd444"}],lU=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=ul();t.forEach(i=>r.add(i)),e=e.filter(i=>!r.has(i))}t.set(n,a5(e))}return t.get(n)},aU=(t,{colors:e=oU,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:s}={})=>{let l=!1;const c=new uU(t,s),f=new xt({props:{editable:d=>{const p=jt.getState(d);return p.snapshot==null&&p.prevSnapshot==null}},key:jt,state:{init:(d,p)=>({type:t,doc:t.doc,binding:c,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(d,p)=>{const m=d.getMeta(jt);if(m!==void 0){p=Object.assign({},p);for(const g in m)p[g]=m[g]}return p.addToHistory=d.getMeta("addToHistory")!==!1,p.isChangeOrigin=m!==void 0&&!!m.isChangeOrigin,p.isUndoRedoOperation=m!==void 0&&!!m.isChangeOrigin&&!!m.isUndoRedoOperation,c.prosemirrorView!==null&&m!==void 0&&(m.snapshot!=null||m.prevSnapshot!=null)&&b1(0,()=>{c.prosemirrorView!=null&&(m.restore==null?c._renderSnapshot(m.snapshot,m.prevSnapshot,p):(c._renderSnapshot(m.snapshot,m.snapshot,p),delete p.restore,delete p.snapshot,delete p.prevSnapshot,c.mux(()=>{c._prosemirrorChanged(c.prosemirrorView.state.doc)})))}),p}},view:d=>(c.initView(d),s==null&&c._forceRerender(),i(),{update:()=>{const p=f.getState(d.state);if(p.snapshot==null&&p.prevSnapshot==null&&(l||d.state.doc.content.findDiffStart(d.state.doc.type.createAndFill().content)!==null)){if(l=!0,p.addToHistory===!1&&!p.isChangeOrigin){const m=Ei.getState(d.state),g=m&&m.undoManager;g&&g.stopCapturing()}c.mux(()=>{p.doc.transact(m=>{m.meta.set("addToHistory",p.addToHistory),c._prosemirrorChanged(d.state.doc)},jt)})}},destroy:()=>{c.destroy()}})});return f},cU=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new ar(t.doc));else if(e.type==="node"){const r=Ma(n.doc,n.type,e.anchor,n.mapping);t.setSelection(Ee.create(t.doc,r))}else{const r=Ma(n.doc,n.type,e.anchor,n.mapping),i=Ma(n.doc,n.type,e.head,n.mapping);if(r!==null&&i!==null){const s=Oe.between(t.doc.resolve(r),t.doc.resolve(i));t.setSelection(s)}}},Kb=(t,e)=>({type:e.selection.jsonID,anchor:mp(e.selection.anchor,t.type,t.mapping),head:mp(e.selection.head,t.type,t.mapping)});class uU{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=q8(),this.mapping=n,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=Kb(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(y_&&this._domSelectionInView===null&&(b1(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const n=this.prosemirrorView._root.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const i=n.getBoundingClientRect(),s=Sf.documentElement;return i.bottom>=0&&i.right>=0&&i.left<=(window.innerWidth||s.clientWidth||0)&&i.top<=(window.innerHeight||s.clientHeight||0)}renderSnapshot(e,n){n||(n=X_(P_(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(jt,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>Th(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ge(te.from(e),0,0));n.setMeta(jt,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(i=>Th(i,this.prosemirrorView.state.schema,this)).filter(i=>i!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ge(te.from(n),0,0));if(e){const i=ds(li(e.anchor,0),r.doc.content.size),s=ds(li(e.head,0),r.doc.content.size);r.setSelection(Oe.create(r.doc,i,s))}this.prosemirrorView.dispatch(r.setMeta(jt,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let i=this.doc,s=this.type;if(e||(e=E0(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&Hn(),i=new Di({gc:!1}),op(i,n),n=E0(i),op(i,e),e=E0(i),s._item===null){const l=Array.from(this.doc.share.keys()).find(c=>this.doc.share.get(c)===this.type);s=i.getXmlFragment(l)}else{const l=i.store.clients.get(s._item.id.client)??[],c=ai(l,s._item.id.clock);s=l[c].content.type}this.mapping.clear(),this.mux(()=>{i.transact(l=>{const c=r.permanentUserData;c&&c.dss.forEach(m=>{go(l,m,g=>{})});const f=(m,g)=>{const b=m==="added"?c.getUserByClientId(g.client):c.getUserByDeletedId(g);return{user:b,type:m,color:lU(r.colorMapping,r.colors,b)}},d=cD(s,new k1(n.ds,e.sv)).map(m=>!m._item.deleted||hp(m._item,e)||hp(m._item,n)?Th(m,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,f):null).filter(m=>m!==null),p=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ge(te.from(d),0,0));this.prosemirrorView.dispatch(p.setMeta(jt,{isChangeOrigin:!0}))},jt)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=jt.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const i=(c,f)=>this.mapping.delete(f);go(n,n.deleteSet,c=>{if(c.constructor===Tt){const f=c.content.type;f&&this.mapping.delete(f)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const s=this.type.toArray().map(c=>TD(c,this.prosemirrorView.state.schema,this)).filter(c=>c!==null);let l=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ge(te.from(s),0,0));cU(l,this.beforeTransactionSelection,this),l=l.setMeta(jt,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof rD}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&l.scrollIntoView(),this.prosemirrorView.dispatch(l)})}_prosemirrorChanged(e){this.doc.transact(()=>{Gb(this.doc,this.type,e,this),this.beforeTransactionSelection=Kb(this,this.prosemirrorView.state)},jt)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const TD=(t,e,n,r,i,s)=>{const l=n.mapping.get(t);if(l===void 0){if(t instanceof zn)return Th(t,e,n,r,i,s);throw Xr()}return l},Th=(t,e,n,r,i,s)=>{const l=[],c=f=>{var d,p;if(f instanceof zn){const m=TD(f,e,n,r,i,s);m!==null&&l.push(m)}else{const m=(p=(d=f._item.right)==null?void 0:d.content)==null?void 0:p.type;m instanceof yo&&!m._item.deleted&&m._item.id.client===m.doc.clientID&&(f.applyDelta([{retain:f.length},...m.toDelta()]),m.doc.transact(b=>{m._item.delete(b)}));const g=fU(f,e,n,r,i,s);g!==null&&g.forEach(b=>{b!==null&&l.push(b)})}};r===void 0||i===void 0?t.toArray().forEach(c):cD(t,new k1(i.ds,r.sv)).forEach(c);try{const f=t.getAttributes(r);r!==void 0&&(hp(t._item,r)?hp(t._item,i)||(f.ychange=s?s("added",t._item.id):{type:"added"}):f.ychange=s?s("removed",t._item.id):{type:"removed"});const d=e.node(t.nodeName,f,l);return n.mapping.set(t,d),d}catch{return t.doc.transact(d=>{t._item.delete(d)},jt),n.mapping.delete(t),null}},fU=(t,e,n,r,i,s)=>{const l=[],c=t.toDelta(r,i,s);try{for(let f=0;f<c.length;f++){const d=c[f];l.push(e.text(d.insert,yU(d.attributes,e)))}}catch{return t.doc.transact(d=>{t._item.delete(d)},jt),null}return l},dU=(t,e)=>{const n=new Kn,r=t.map(i=>({insert:i.text,attributes:MD(i.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},hU=(t,e)=>{const n=new zn(t.type.name);for(const r in t.attrs){const i=t.attrs[r];i!==null&&r!=="ychange"&&n.setAttribute(r,i)}return n.insert(0,Cm(t).map(r=>Wb(r,e))),e.mapping.set(n,t),n},Wb=(t,e)=>t instanceof Array?dU(t,e):hU(t,e),CT=t=>typeof t=="object"&&t!==null,R1=(t,e)=>{const n=Object.keys(t).filter(i=>t[i]!==null);let r=n.length===(e==null?0:Object.keys(e).filter(i=>e[i]!==null).length);for(let i=0;i<n.length&&r;i++){const s=n[i],l=t[s],c=e[s];r=s==="ychange"||l===c||CT(l)&&CT(c)&&R1(l,c)}return r},Cm=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const i=e[r];if(i.isText){const s=[];for(let l=e[r];r<e.length&&l.isText;l=e[++r])s.push(l);r--,n.push(s)}else n.push(i)}return n},AD=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,i)=>r.insert===e[i].text&&p_(r.attributes||{}).length===e[i].marks.length&&Xa(r.attributes,(s,l)=>{var d;const c=N1(l),f=e[i].marks;return R1(s,(d=f.find(p=>p.type.name===c))==null?void 0:d.attrs)}))},lf=(t,e)=>{if(t instanceof zn&&!(e instanceof Array)&&Zb(t,e)){const n=Cm(e);return t._length===n.length&&R1(t.getAttributes(),e.attrs)&&t.toArray().every((r,i)=>lf(r,n[i]))}return t instanceof Kn&&e instanceof Array&&AD(t,e)},pp=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),ET=(t,e,n)=>{const r=t.toArray(),i=Cm(e),s=i.length,l=r.length,c=ds(l,s);let f=0,d=0,p=!1;for(;f<c;f++){const m=r[f],g=i[f];if(pp(n.mapping.get(m),g))p=!0;else if(!lf(m,g))break}for(;f+d<c;d++){const m=r[l-d-1],g=i[s-d-1];if(pp(n.mapping.get(m),g))p=!0;else if(!lf(m,g))break}return{equalityFactor:f+d,foundMappedChild:p}},pU=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof ci?e+=n.content.str:n.content instanceof sn&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},mU=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:i}=pU(t),s=e.map(d=>({insert:d.text,attributes:Object.assign({},r,MD(d.marks,n))})),{insert:l,remove:c,index:f}=G8(i,s.map(d=>d.insert).join(""));t.delete(f,c),t.insert(f,l),t.applyDelta(s.map(d=>({retain:d.insert.length,attributes:d.attributes})))},gU=/(.*)(--[a-zA-Z0-9+/=]{8})$/,N1=t=>{var e;return((e=gU.exec(t))==null?void 0:e[1])??t},yU=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(N1(r),t[r]));return n},MD=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const i=zi(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[i?`${r.type.name}--${sU(r.toJSON())}`:r.type.name]=r.attrs}}),n},Gb=(t,e,n,r)=>{if(e instanceof zn&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof zn){const m=e.getAttributes(),g=n.attrs;for(const b in g)g[b]!==null?m[b]!==g[b]&&b!=="ychange"&&e.setAttribute(b,g[b]):e.removeAttribute(b);for(const b in m)g[b]===void 0&&e.removeAttribute(b)}const i=Cm(n),s=i.length,l=e.toArray(),c=l.length,f=ds(s,c);let d=0,p=0;for(;d<f;d++){const m=l[d],g=i[d];if(!pp(r.mapping.get(m),g))if(lf(m,g))r.mapping.set(m,g);else break}for(;p+d<f;p++){const m=l[c-p-1],g=i[s-p-1];if(!pp(r.mapping.get(m),g))if(lf(m,g))r.mapping.set(m,g);else break}t.transact(()=>{for(;c-d-p>0&&s-d-p>0;){const g=l[d],b=i[d],S=l[c-p-1],v=i[s-p-1];if(g instanceof Kn&&b instanceof Array)AD(g,b)||mU(g,b,r),d+=1;else{let C=g instanceof zn&&Zb(g,b),E=S instanceof zn&&Zb(S,v);if(C&&E){const B=ET(g,b,r),I=ET(S,v,r);B.foundMappedChild&&!I.foundMappedChild?E=!1:!B.foundMappedChild&&I.foundMappedChild||B.equalityFactor<I.equalityFactor?C=!1:E=!1}C?(Gb(t,g,b,r),d+=1):E?(Gb(t,S,v,r),p+=1):(r.mapping.delete(e.get(d)),e.delete(d,1),e.insert(d,[Wb(b,r)]),d+=1)}}const m=c-d-p;if(c===1&&s===0&&l[0]instanceof Kn?(r.mapping.delete(l[0]),l[0].delete(0,l[0].length)):m>0&&(e.slice(d,d+m).forEach(g=>r.mapping.delete(g)),e.delete(d,m)),d+p<s){const g=[];for(let b=d;b<s-p;b++)g.push(Wb(i[b],r));e.insert(d,g)}},jt)},Zb=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let bu=null;const bU=()=>{const t=bu;bu=null,t.forEach((e,n)=>{const r=n.state.tr,i=jt.getState(n.state);i&&i.binding&&!i.binding.isDestroyed&&(e.forEach((s,l)=>{r.setMeta(l,s)}),n.dispatch(r))})},xU=(t,e,n)=>{bu||(bu=new Map,b1(0,bU)),zi(bu,t,Jr).set(e,n)},mp=(t,e,n)=>{if(t===0)return C0(e,0,e.length===0?-1:0);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof Kn){if(r._length>=t)return C0(r,t,e.length===0?-1:0);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<i)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&i>1)return new nf(r._item===null?null:r._item.id,r._item===null?ef(r):null,null);if(t-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new nf(r._item===null?null:r._item.id,r._item===null?ef(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw Hn();if(t===0&&r.constructor!==Kn&&r!==e)return SU(r._item.parent,r._item)}return C0(e,e._length,e.length===0?-1:0)},SU=(t,e)=>{let n=null,r=null;return t._item===null?r=ef(t):n=$e(t._item.id.client,t._item.id.clock),new nf(n,r,e.id)},Ma=(t,e,n,r)=>{const i=Vb(n,t);if(i===null||i.type!==e&&!tf(e,i.type._item))return null;let s=i.type,l=0;if(s.constructor===Kn)l=i.index;else if(s._item===null||!s._item.deleted){let c=s._first,f=0;for(;f<s._length&&f<i.index&&c!==null;){if(!c.deleted){const d=c.content.type;f++,d instanceof Kn?l+=d._length:l+=r.get(d).nodeSize}c=c.right}l+=1}for(;s!==e&&s._item!==null;){const c=s._item.parent;if(c._item===null||!c._item.deleted){l+=1;let f=c._first;for(;f!==null;){const d=f.content.type;if(d===s)break;f.deleted||(d instanceof Kn?l+=d._length:l+=r.get(d).nodeSize),f=f.right}}s=c}return l-1};function wU(t){const e=t.toArray(),n=r=>{let i;if(r instanceof Kn)i=r.toDelta().map(l=>{const c={type:"text",text:l.insert};return l.attributes&&(c.marks=Object.keys(l.attributes).map(f=>{const d=l.attributes[f],m={type:N1(f)};return Object.keys(d)&&(m.attrs=d),m})),c});else if(r instanceof zn){i={type:r.nodeName};const s=r.getAttributes();Object.keys(s).length&&(i.attrs=s);const l=r.toArray();l.length&&(i.content=l.map(n).flat())}else Hn();return i};return{type:"doc",content:e.map(n)}}const vU=(t,e,n)=>t!==e,kU=t=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null);const r=document.createTextNode(""),i=document.createTextNode("");return e.insertBefore(r,null),e.insertBefore(n,null),e.insertBefore(i,null),e},OD=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),CU=/^#[0-9a-fA-F]{6}$/,TT=(t,e,n,r,i)=>{const s=jt.getState(t),l=s.doc,c=[];return s.snapshot!=null||s.prevSnapshot!=null||s.binding.mapping.size===0?ct.create(t.doc,[]):(e.getStates().forEach((f,d)=>{if(n(l.clientID,d,f)&&f.cursor!=null){const p=f.user||{};p.color==null?p.color="#ffa500":CU.test(p.color)||console.warn("A user uses an unsupported color format",p),p.name==null&&(p.name=`User: ${d}`);let m=Ma(l,s.type,tl(f.cursor.anchor),s.binding.mapping),g=Ma(l,s.type,tl(f.cursor.head),s.binding.mapping);if(m!==null&&g!==null){const b=li(t.doc.content.size-1,0);m=ds(m,b),g=ds(g,b),c.push($t.widget(g,()=>r(p,d),{key:d+"",side:10}));const S=ds(m,g),v=li(m,g);c.push($t.inline(S,v,i(p,d),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),ct.create(t.doc,c))},EU=(t,{awarenessStateFilter:e=vU,cursorBuilder:n=kU,selectionBuilder:r=OD,getSelection:i=l=>l.selection}={},s="cursor")=>new xt({key:eh,state:{init(l,c){return TT(c,t,e,n,r)},apply(l,c,f,d){const p=jt.getState(d),m=l.getMeta(eh);return p&&p.isChangeOrigin||m&&m.awarenessUpdated?TT(d,t,e,n,r):c.map(l.mapping,l.doc)}},props:{decorations:l=>eh.getState(l)},view:l=>{const c=()=>{l.docView&&xU(l,eh,{awarenessUpdated:!0})},f=()=>{const d=jt.getState(l.state),p=t.getLocalState()||{};if(l.hasFocus()){const m=i(l.state),g=mp(m.anchor,d.type,d.binding.mapping),b=mp(m.head,d.type,d.binding.mapping);(p.cursor==null||!hT(tl(p.cursor.anchor),g)||!hT(tl(p.cursor.head),b))&&t.setLocalStateField(s,{anchor:g,head:b})}else p.cursor!=null&&Ma(d.doc,d.type,tl(p.cursor.anchor),d.binding.mapping)!==null&&t.setLocalStateField(s,null)};return t.on("change",c),l.dom.addEventListener("focusin",f),l.dom.addEventListener("focusout",f),{update:f,destroy:()=>{l.dom.removeEventListener("focusin",f),l.dom.removeEventListener("focusout",f),t.off("change",c),t.setLocalStateField(s,null)}}}}),TU=t=>{var e,n;return((n=(e=Ei.getState(t))==null?void 0:e.undoManager)==null?void 0:n.undo())!=null},AU=t=>{var e,n;return((n=(e=Ei.getState(t))==null?void 0:e.undoManager)==null?void 0:n.redo())!=null},MU=new Set(["paragraph"]),OU=(t,e)=>!(t instanceof Tt)||!(t.content instanceof ui)||!(t.content.type instanceof yo||t.content.type instanceof zn&&e.has(t.content.type.nodeName))||t.content.type._length===0,_U=({protectedNodes:t=MU,trackedOrigins:e=[],undoManager:n=null}={})=>new xt({key:Ei,state:{init:(r,i)=>{const s=jt.getState(i),l=n||new rD(s.type,{trackedOrigins:new Set([jt].concat(e)),deleteFilter:c=>OU(c,t),captureTransaction:c=>c.meta.get("addToHistory")!==!1});return{undoManager:l,prevSel:null,hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0}},apply:(r,i,s,l)=>{const c=jt.getState(l).binding,f=i.undoManager,d=f.undoStack.length>0,p=f.redoStack.length>0;return c?{undoManager:f,prevSel:Kb(c,s),hasUndoOps:d,hasRedoOps:p}:d!==i.hasUndoOps||p!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:f.undoStack.length>0,hasRedoOps:f.redoStack.length>0}):i}},view:r=>{const i=jt.getState(r.state),s=Ei.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:l})=>{const c=i.binding;c&&l.meta.set(c,Ei.getState(r.state).prevSel)}),s.on("stack-item-popped",({stackItem:l})=>{const c=i.binding;c&&(c.beforeTransactionSelection=l.meta.get(c)||c.beforeTransactionSelection)}),{destroy:()=>{s.destroy()}}}}),DU=Zt.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(t=>t.name==="history")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-history".')},addCommands(){return{undo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),Ei.getState(e).undoManager.undoStack.length===0?!1:n?TU(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),Ei.getState(e).undoManager.redoStack.length===0?!1:n?AU(e):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){var t;const e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),n=_U(this.options.yUndoOptions),r=n.spec.view;n.spec.view=l=>{const{undoManager:c}=Ei.getState(l.state);c.restore&&(c.restore(),c.restore=()=>{});const f=r?r(l):void 0;return{destroy:()=>{const d=c.trackedOrigins.has(c),p=c._observers;c.restore=()=>{d&&c.trackedOrigins.add(c),c.doc.on("afterTransaction",c.afterTransactionHandler),c._observers=p},f!=null&&f.destroy&&f.destroy()}}};const i={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},s=aU(e,i);return this.editor.options.enableContentCheck&&((t=e.doc)===null||t===void 0||t.on("beforeTransaction",()=>{try{const l=wU(e);if(l.content.length===0)return;this.editor.schema.nodeFromJSON(l).check()}catch(l){return this.editor.emit("contentError",{error:l,editor:this.editor,disableCollaboration:()=>{var c;(c=e.doc)===null||c===void 0||c.destroy(),this.storage.isDisabled=!0}}),!1}})),[s,n,this.editor.options.enableContentCheck&&new xt({key:new Dt("filterInvalidContent"),filterTransaction:()=>{var l;return this.storage.isDisabled&&((l=e.doc)===null||l===void 0||l.destroy()),!0}})].filter(Boolean)}}),AT=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n.user})),MT=()=>null,RU=Zt.create({name:"collaborationCursor",priority:999,addOptions(){return{provider:null,user:{name:null,color:null},render:t=>{const e=document.createElement("span");e.classList.add("collaboration-cursor__caret"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");return n.classList.add("collaboration-cursor__label"),n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null),e.insertBefore(n,null),e},selectionRender:OD,onUpdate:MT}},onCreate(){if(this.options.onUpdate!==MT&&console.warn('[tiptap warn]: DEPRECATED: The "onUpdate" option is deprecated. Please use `editor.storage.collaborationCursor.users` instead. Read more: https://tiptap.dev/api/extensions/collaboration-cursor'),!this.options.provider)throw new Error('The "provider" option is required for the CollaborationCursor extension')},addStorage(){return{users:[]}},addCommands(){return{updateUser:t=>()=>(this.options.user=t,this.options.provider.awareness.setLocalStateField("user",this.options.user),!0),user:t=>({editor:e})=>(console.warn('[tiptap warn]: DEPRECATED: The "user" command is deprecated. Please use "updateUser" instead. Read more: https://tiptap.dev/api/extensions/collaboration-cursor'),e.commands.updateUser(t))}},addProseMirrorPlugins(){return[EU((this.options.provider.awareness.setLocalStateField("user",this.options.user),this.storage.users=AT(this.options.provider.awareness.states),this.options.provider.awareness.on("update",()=>{this.storage.users=AT(this.options.provider.awareness.states)}),this.options.provider.awareness),{cursorBuilder:this.options.render,selectionBuilder:this.options.selectionRender})]}}),NU=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,zU=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,LU=Oi.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",Ft(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[cl({find:NU,type:this.type})]},addPasteRules(){return[po({find:zU,type:this.type})]}}),jU="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",IU="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Jb="numeric",Xb="ascii",Qb="alpha",xu="asciinumeric",fu="alphanumeric",ex="domain",_D="emoji",BU="scheme",UU="slashscheme",M0="whitespace";function HU(t,e){return t in e||(e[t]=[]),e[t]}function Go(t,e,n){e[Jb]&&(e[xu]=!0,e[fu]=!0),e[Xb]&&(e[xu]=!0,e[Qb]=!0),e[xu]&&(e[fu]=!0),e[Qb]&&(e[fu]=!0),e[fu]&&(e[ex]=!0),e[_D]&&(e[ex]=!0);for(const r in e){const i=HU(r,n);i.indexOf(t)<0&&i.push(t)}}function VU(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function or(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}or.groups={};or.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||or.groups;let i;return e&&e.j?i=e:(i=new or(e),n&&r&&Go(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let l=0;l<s-1;l++)i=i.tt(t[l]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||or.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let l,c=i.go(t);if(c?(l=new or,Object.assign(l.j,c.j),l.jr.push.apply(l.jr,c.jr),l.jd=c.jd,l.t=c.t):l=new or,s){if(r)if(l.t&&typeof l.t=="string"){const f=Object.assign(VU(l.t,r),n);Go(s,f,r)}else n&&Go(s,n,r);l.t=s}return i.j[t]=l,l}};const We=(t,e,n,r,i)=>t.ta(e,n,r,i),Ht=(t,e,n,r,i)=>t.tr(e,n,r,i),OT=(t,e,n,r,i)=>t.ts(e,n,r,i),ae=(t,e,n,r,i)=>t.tt(e,n,r,i),ss="WORD",tx="UWORD",DD="ASCIINUMERICAL",RD="ALPHANUMERICAL",af="LOCALHOST",nx="TLD",rx="UTLD",Ah="SCHEME",pa="SLASH_SCHEME",z1="NUM",ix="WS",L1="NL",Su="OPENBRACE",wu="CLOSEBRACE",gp="OPENBRACKET",yp="CLOSEBRACKET",bp="OPENPAREN",xp="CLOSEPAREN",Sp="OPENANGLEBRACKET",wp="CLOSEANGLEBRACKET",vp="FULLWIDTHLEFTPAREN",kp="FULLWIDTHRIGHTPAREN",Cp="LEFTCORNERBRACKET",Ep="RIGHTCORNERBRACKET",Tp="LEFTWHITECORNERBRACKET",Ap="RIGHTWHITECORNERBRACKET",Mp="FULLWIDTHLESSTHAN",Op="FULLWIDTHGREATERTHAN",_p="AMPERSAND",Dp="APOSTROPHE",Rp="ASTERISK",Gs="AT",Np="BACKSLASH",zp="BACKTICK",Lp="CARET",Qs="COLON",j1="COMMA",jp="DOLLAR",bi="DOT",Ip="EQUALS",I1="EXCLAMATION",Pr="HYPHEN",vu="PERCENT",Bp="PIPE",Up="PLUS",Hp="POUND",ku="QUERY",B1="QUOTE",ND="FULLWIDTHMIDDLEDOT",U1="SEMI",xi="SLASH",Cu="TILDE",Vp="UNDERSCORE",zD="EMOJI",Pp="SYM";var LD=Object.freeze({__proto__:null,ALPHANUMERICAL:RD,AMPERSAND:_p,APOSTROPHE:Dp,ASCIINUMERICAL:DD,ASTERISK:Rp,AT:Gs,BACKSLASH:Np,BACKTICK:zp,CARET:Lp,CLOSEANGLEBRACKET:wp,CLOSEBRACE:wu,CLOSEBRACKET:yp,CLOSEPAREN:xp,COLON:Qs,COMMA:j1,DOLLAR:jp,DOT:bi,EMOJI:zD,EQUALS:Ip,EXCLAMATION:I1,FULLWIDTHGREATERTHAN:Op,FULLWIDTHLEFTPAREN:vp,FULLWIDTHLESSTHAN:Mp,FULLWIDTHMIDDLEDOT:ND,FULLWIDTHRIGHTPAREN:kp,HYPHEN:Pr,LEFTCORNERBRACKET:Cp,LEFTWHITECORNERBRACKET:Tp,LOCALHOST:af,NL:L1,NUM:z1,OPENANGLEBRACKET:Sp,OPENBRACE:Su,OPENBRACKET:gp,OPENPAREN:bp,PERCENT:vu,PIPE:Bp,PLUS:Up,POUND:Hp,QUERY:ku,QUOTE:B1,RIGHTCORNERBRACKET:Ep,RIGHTWHITECORNERBRACKET:Ap,SCHEME:Ah,SEMI:U1,SLASH:xi,SLASH_SCHEME:pa,SYM:Pp,TILDE:Cu,TLD:nx,UNDERSCORE:Vp,UTLD:rx,UWORD:tx,WORD:ss,WS:ix});const rs=/[a-z]/,tu=new RegExp("\\p{L}","u"),O0=new RegExp("\\p{Emoji}","u"),is=/\d/,_0=/\s/,_T="\r",D0=`
|
|
153
|
-
`,PU="️",$U="",R0="";let th=null,nh=null;function FU(t=[]){const e={};or.groups=e;const n=new or;th==null&&(th=DT(jU)),nh==null&&(nh=DT(IU)),ae(n,"'",Dp),ae(n,"{",Su),ae(n,"}",wu),ae(n,"[",gp),ae(n,"]",yp),ae(n,"(",bp),ae(n,")",xp),ae(n,"<",Sp),ae(n,">",wp),ae(n,"(",vp),ae(n,")",kp),ae(n,"「",Cp),ae(n,"」",Ep),ae(n,"『",Tp),ae(n,"』",Ap),ae(n,"<",Mp),ae(n,">",Op),ae(n,"&",_p),ae(n,"*",Rp),ae(n,"@",Gs),ae(n,"`",zp),ae(n,"^",Lp),ae(n,":",Qs),ae(n,",",j1),ae(n,"$",jp),ae(n,".",bi),ae(n,"=",Ip),ae(n,"!",I1),ae(n,"-",Pr),ae(n,"%",vu),ae(n,"|",Bp),ae(n,"+",Up),ae(n,"#",Hp),ae(n,"?",ku),ae(n,'"',B1),ae(n,"/",xi),ae(n,";",U1),ae(n,"~",Cu),ae(n,"_",Vp),ae(n,"\\",Np),ae(n,"・",ND);const r=Ht(n,is,z1,{[Jb]:!0});Ht(r,is,r);const i=Ht(r,rs,DD,{[xu]:!0}),s=Ht(r,tu,RD,{[fu]:!0}),l=Ht(n,rs,ss,{[Xb]:!0});Ht(l,is,i),Ht(l,rs,l),Ht(i,is,i),Ht(i,rs,i);const c=Ht(n,tu,tx,{[Qb]:!0});Ht(c,rs),Ht(c,is,s),Ht(c,tu,c),Ht(s,is,s),Ht(s,rs),Ht(s,tu,s);const f=ae(n,D0,L1,{[M0]:!0}),d=ae(n,_T,ix,{[M0]:!0}),p=Ht(n,_0,ix,{[M0]:!0});ae(n,R0,p),ae(d,D0,f),ae(d,R0,p),Ht(d,_0,p),ae(p,_T),ae(p,D0),Ht(p,_0,p),ae(p,R0,p);const m=Ht(n,O0,zD,{[_D]:!0});ae(m,"#"),Ht(m,O0,m),ae(m,PU,m);const g=ae(m,$U);ae(g,"#"),Ht(g,O0,m);const b=[[rs,l],[is,i]],S=[[rs,null],[tu,c],[is,s]];for(let v=0;v<th.length;v++)Fs(n,th[v],nx,ss,b);for(let v=0;v<nh.length;v++)Fs(n,nh[v],rx,tx,S);Go(nx,{tld:!0,ascii:!0},e),Go(rx,{utld:!0,alpha:!0},e),Fs(n,"file",Ah,ss,b),Fs(n,"mailto",Ah,ss,b),Fs(n,"http",pa,ss,b),Fs(n,"https",pa,ss,b),Fs(n,"ftp",pa,ss,b),Fs(n,"ftps",pa,ss,b),Go(Ah,{scheme:!0,ascii:!0},e),Go(pa,{slashscheme:!0,ascii:!0},e),t=t.sort((v,C)=>v[0]>C[0]?1:-1);for(let v=0;v<t.length;v++){const C=t[v][0],B=t[v][1]?{[BU]:!0}:{[UU]:!0};C.indexOf("-")>=0?B[ex]=!0:rs.test(C)?is.test(C)?B[xu]=!0:B[Xb]=!0:B[Jb]=!0,OT(n,C,C,B)}return OT(n,"localhost",af,{ascii:!0}),n.jd=new or(Pp),{start:n,tokens:Object.assign({groups:e},LD)}}function jD(t,e){const n=qU(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,i=[];let s=0,l=0;for(;l<r;){let c=t,f=null,d=0,p=null,m=-1,g=-1;for(;l<r&&(f=c.go(n[l]));)c=f,c.accepts()?(m=0,g=0,p=c):m>=0&&(m+=n[l].length,g++),d+=n[l].length,s+=n[l].length,l++;s-=m,l-=g,d-=m,i.push({t:p.t,v:e.slice(s-d,s),s:s-d,e:s})}return i}function qU(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,l=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(l),r+=l.length}return e}function Fs(t,e,n,r,i){let s;const l=e.length;for(let c=0;c<l-1;c++){const f=e[c];t.j[f]?s=t.j[f]:(s=new or(r),s.jr=i.slice(),t.j[f]=s),t=s}return s=new or(n),s.jr=i.slice(),t.j[e[l-1]]=s,s}function DT(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let l=parseInt(t.substring(r,r+s),10);l>0;l--)n.pop();r+=s}else n.push(t[r]),r++}return e}const cf={defaultProtocol:"http",events:null,format:RT,formatHref:RT,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function H1(t,e=null){let n=Object.assign({},cf);t&&(n=Object.assign(n,t instanceof H1?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}H1.prototype={o:cf,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:cf[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function RT(t){return t}function ID(t,e){this.t="token",this.v=t,this.tk=e}ID.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=cf.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),l={},c=t.get("className",n,e),f=t.get("target",n,e),d=t.get("rel",n,e),p=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return l.href=r,c&&(l.class=c),f&&(l.target=f),d&&(l.rel=d),p&&Object.assign(l,p),{tagName:i,attributes:l,content:s,eventListeners:m}}};function Em(t,e){class n extends ID{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const NT=Em("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),zT=Em("text"),YU=Em("nl"),rh=Em("url",{isLink:!0,toHref(t=cf.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==af&&t[1].t===Qs}}),Hr=t=>new or(t);function KU({groups:t}){const e=t.domain.concat([_p,Rp,Gs,Np,zp,Lp,jp,Ip,Pr,z1,vu,Bp,Up,Hp,xi,Pp,Cu,Vp]),n=[Dp,Qs,j1,bi,I1,vu,ku,B1,U1,Sp,wp,Su,wu,yp,gp,bp,xp,vp,kp,Cp,Ep,Tp,Ap,Mp,Op],r=[_p,Dp,Rp,Np,zp,Lp,jp,Ip,Pr,Su,wu,vu,Bp,Up,Hp,ku,xi,Pp,Cu,Vp],i=Hr(),s=ae(i,Cu);We(s,r,s),We(s,t.domain,s);const l=Hr(),c=Hr(),f=Hr();We(i,t.domain,l),We(i,t.scheme,c),We(i,t.slashscheme,f),We(l,r,s),We(l,t.domain,l);const d=ae(l,Gs);ae(s,Gs,d),ae(c,Gs,d),ae(f,Gs,d);const p=ae(s,bi);We(p,r,s),We(p,t.domain,s);const m=Hr();We(d,t.domain,m),We(m,t.domain,m);const g=ae(m,bi);We(g,t.domain,m);const b=Hr(NT);We(g,t.tld,b),We(g,t.utld,b),ae(d,af,b);const S=ae(m,Pr);ae(S,Pr,S),We(S,t.domain,m),We(b,t.domain,m),ae(b,bi,g),ae(b,Pr,S);const v=ae(b,Qs);We(v,t.numeric,NT);const C=ae(l,Pr),E=ae(l,bi);ae(C,Pr,C),We(C,t.domain,l),We(E,r,s),We(E,t.domain,l);const B=Hr(rh);We(E,t.tld,B),We(E,t.utld,B),We(B,t.domain,l),We(B,r,s),ae(B,bi,E),ae(B,Pr,C),ae(B,Gs,d);const I=ae(B,Qs),ne=Hr(rh);We(I,t.numeric,ne);const F=Hr(rh),R=Hr();We(F,e,F),We(F,n,R),We(R,e,F),We(R,n,R),ae(B,xi,F),ae(ne,xi,F);const N=ae(c,Qs),Z=ae(f,Qs),j=ae(Z,xi),ie=ae(j,xi);We(c,t.domain,l),ae(c,bi,E),ae(c,Pr,C),We(f,t.domain,l),ae(f,bi,E),ae(f,Pr,C),We(N,t.domain,F),ae(N,xi,F),ae(N,ku,F),We(ie,t.domain,F),We(ie,e,F),ae(ie,xi,F);const re=[[Su,wu],[gp,yp],[bp,xp],[Sp,wp],[vp,kp],[Cp,Ep],[Tp,Ap],[Mp,Op]];for(let se=0;se<re.length;se++){const[be,ue]=re[se],H=ae(F,be);ae(R,be,H),ae(H,ue,F);const L=Hr(rh);We(H,e,L);const G=Hr();We(H,n),We(L,e,L),We(L,n,G),We(G,e,L),We(G,n,G),ae(L,ue,F),ae(G,ue,F)}return ae(i,af,B),ae(i,L1,YU),{start:i,tokens:LD}}function WU(t,e,n){let r=n.length,i=0,s=[],l=[];for(;i<r;){let c=t,f=null,d=null,p=0,m=null,g=-1;for(;i<r&&!(f=c.go(n[i].t));)l.push(n[i++]);for(;i<r&&(d=f||c.go(n[i].t));)f=null,c=d,c.accepts()?(g=0,m=c):g>=0&&g++,i++,p++;if(g<0)i-=p,i<r&&(l.push(n[i]),i++);else{l.length>0&&(s.push(N0(zT,e,l)),l=[]),i-=g,p-=g;const b=m.t,S=n.slice(i-p,i);s.push(N0(b,e,S))}}return l.length>0&&s.push(N0(zT,e,l)),s}function N0(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const GU=typeof console<"u"&&console&&console.warn||(()=>{}),ZU="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",_t={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function JU(){return or.groups={},_t.scanner=null,_t.parser=null,_t.tokenQueue=[],_t.pluginQueue=[],_t.customSchemes=[],_t.initialized=!1,_t}function LT(t,e=!1){if(_t.initialized&&GU(`linkifyjs: already initialized - will not register custom scheme "${t}" ${ZU}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
154
|
-
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
155
|
-
2. Cannot start or end with "-"
|
|
156
|
-
3. "-" cannot repeat`);_t.customSchemes.push([t,e])}function XU(){_t.scanner=FU(_t.customSchemes);for(let t=0;t<_t.tokenQueue.length;t++)_t.tokenQueue[t][1]({scanner:_t.scanner});_t.parser=KU(_t.scanner.tokens);for(let t=0;t<_t.pluginQueue.length;t++)_t.pluginQueue[t][1]({scanner:_t.scanner,parser:_t.parser});return _t.initialized=!0,_t}function V1(t){return _t.initialized||XU(),WU(_t.parser.start,t,jD(_t.scanner.start,t))}V1.scan=jD;function BD(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new H1(n),i=V1(t),s=[];for(let l=0;l<i.length;l++){const c=i[l];c.isLink&&(!e||c.t===e)&&r.check(c)&&s.push(c.toFormattedObject(r))}return s}const P1="[\0- -\u2029 ]",QU=new RegExp(P1),eH=new RegExp(`${P1}$`),tH=new RegExp(P1,"g");function nH(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function rH(t){return new xt({key:new Dt("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(d=>d.docChanged)&&!n.doc.eq(r.doc),s=e.some(d=>d.getMeta("preventAutolink"));if(!i||s)return;const{tr:l}=r,c=jj(n.doc,[...e]);if($j(c).forEach(({newRange:d})=>{const p=Bj(r.doc,d,b=>b.isTextblock);let m,g;if(p.length>1)m=p[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(p.length){const b=r.doc.textBetween(d.from,d.to," "," ");if(!eH.test(b))return;m=p[0],g=r.doc.textBetween(m.pos,d.to,void 0," ")}if(m&&g){const b=g.split(QU).filter(Boolean);if(b.length<=0)return!1;const S=b[b.length-1],v=m.pos+g.lastIndexOf(S);if(!S)return!1;const C=V1(S).map(E=>E.toObject(t.defaultProtocol));if(!nH(C))return!1;C.filter(E=>E.isLink).map(E=>({...E,from:v+E.start+1,to:v+E.end+1})).filter(E=>r.schema.marks.code?!r.doc.rangeHasMark(E.from,E.to,r.schema.marks.code):!0).filter(E=>t.validate(E.value)).filter(E=>t.shouldAutoLink(E.value)).forEach(E=>{s1(E.from,E.to,r.doc).some(B=>B.mark.type===t.type)||l.addMark(E.from,E.to,t.type.create({href:E.href}))})}}),!!l.steps.length)return l}})}function iH(t){return new xt({key:new Dt("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let l=r.target;const c=[];for(;l.nodeName!=="DIV";)c.push(l),l=l.parentNode;if(!c.find(g=>g.nodeName==="A"))return!1;const f=s_(e.state,t.type.name),d=r.target,p=(i=d==null?void 0:d.href)!==null&&i!==void 0?i:f.href,m=(s=d==null?void 0:d.target)!==null&&s!==void 0?s:f.target;return d&&p?(window.open(p,m),!0):!1}}})}function sH(t){return new xt({key:new Dt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let c="";r.content.forEach(d=>{c+=d.textContent});const f=BD(c,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===c);return!c||!f?!1:t.editor.commands.setMark(t.type,{href:f.href})}}})}function Vo(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(tH,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const oH=Oi.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){LT(t);return}LT(t.scheme,t.optionalSlashes)})},onDestroy(){JU()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Vo(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Vo(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Vo(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ft(this.options.HTMLAttributes,t),0]:["a",Ft(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Vo(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Vo(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[po({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=BD(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!Vo(l,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(rH({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Vo(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(iH({type:this.type})),this.options.linkOnPaste&&t.push(sH({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),lH=Zt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new xt({key:new Dt("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((l,c)=>{const f=r>=c&&r<=c+l.nodeSize,d=!l.isLeaf&&fm(l);if((f||!this.options.showOnlyCurrent)&&d){const p=[this.options.emptyNodeClass];s&&p.push(this.options.emptyEditorClass);const m=$t.node(c,c+l.nodeSize,{class:p.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:c,hasAnchor:f}):this.options.placeholder});i.push(m)}return this.options.includeChildren}),ct.create(t,i)}}})]}});let sx,ox;if(typeof WeakMap<"u"){let t=new WeakMap;sx=e=>t.get(e),ox=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;sx=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},ox=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Pt=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,l=i+1;for(let c=1;s<this.width&&this.map[e+c]==n;c++)s++;for(let c=1;l<this.height&&this.map[e+this.width*c]==n;c++)l++;return{left:r,top:i,right:s,bottom:l}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:l}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:l==this.height)?null:this.map[r+this.width*(n<0?s-1:l)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:l,right:c,top:f,bottom:d}=this.findCell(e);return{left:Math.min(n,l),top:Math.min(i,f),right:Math.max(r,c),bottom:Math.max(s,d)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,l=this.map[s];n[l]||(n[l]=!0,!(i==t.left&&i&&this.map[s-1]==l||r==t.top&&r&&this.map[s-this.width]==l)&&e.push(l))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let l=e+t*this.width;const c=(t+1)*this.width;for(;l<c&&this.map[l]<i;)l++;return l==c?s-1:this.map[l]}i=s}}static get(t){return sx(t)||ox(t,aH(t))}};function aH(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=cH(t),n=t.childCount,r=[];let i=0,s=null;const l=[];for(let d=0,p=e*n;d<p;d++)r[d]=0;for(let d=0,p=0;d<n;d++){const m=t.child(d);p++;for(let S=0;;S++){for(;i<r.length&&r[i]!=0;)i++;if(S==m.childCount)break;const v=m.child(S),{colspan:C,rowspan:E,colwidth:B}=v.attrs;for(let I=0;I<E;I++){if(I+d>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:p,n:E-I});break}const ne=i+I*e;for(let F=0;F<C;F++){r[ne+F]==0?r[ne+F]=p:(s||(s=[])).push({type:"collision",row:d,pos:p,n:C-F});const R=B&&B[F];if(R){const N=(ne+F)%e*2,Z=l[N];Z==null||Z!=R&&l[N+1]==1?(l[N]=R,l[N+1]=1):Z==R&&l[N+1]++}}}i+=C,p+=v.nodeSize}const g=(d+1)*e;let b=0;for(;i<g;)r[i++]==0&&b++;b&&(s||(s=[])).push({type:"missing",row:d,n:b}),p++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const c=new Pt(e,n,r,s);let f=!1;for(let d=0;!f&&d<l.length;d+=2)l[d]!=null&&l[d+1]<n&&(f=!0);return f&&uH(c,l,t),c}function cH(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let l=0;l<r;l++){const c=t.child(l);for(let f=0;f<c.childCount;f++){const d=c.child(f);l+d.attrs.rowspan>r&&(s+=d.attrs.colspan)}}for(let l=0;l<i.childCount;l++){const c=i.child(l);s+=c.attrs.colspan,c.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function uH(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const l=n.nodeAt(s);if(!l)throw new RangeError(`No cell with offset ${s} found`);let c=null;const f=l.attrs;for(let d=0;d<f.colspan;d++){const p=e[(i+d)%t.width*2];p!=null&&(!f.colwidth||f.colwidth[d]!=p)&&((c||(c=fH(f)))[d]=p)}c&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:c})}}function fH(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Vn(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const eo=new Dt("selectingCells");function pl(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function dH(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function fi(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Tm(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=pl(e.$head)||hH(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function hH(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function lx(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function pH(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function $1(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function UD(t,e,n){const r=t.node(-1),i=Pt.get(r),s=t.start(-1),l=i.nextCell(t.pos-s,e,n);return l==null?null:t.node(0).resolve(s+l)}function ml(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function HD(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function mH(t,e,n){const r=Vn(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var At=class ls extends je{constructor(e,n=e){const r=e.node(-1),i=Pt.get(r),s=e.start(-1),l=i.rectBetween(e.pos-s,n.pos-s),c=e.node(0),f=i.cellsInRect(l).filter(p=>p!=n.pos-s);f.unshift(n.pos-s);const d=f.map(p=>{const m=r.nodeAt(p);if(!m)throw new RangeError(`No cell with offset ${p} found`);const g=s+p+1;return new XM(c.resolve(g),c.resolve(g+m.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(lx(r)&&lx(i)&&$1(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?ls.rowSelection(r,i):s&&this.isColSelection()?ls.colSelection(r,i):new ls(r,i)}return Oe.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Pt.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},l=[];for(let f=i.top;f<i.bottom;f++){const d=[];for(let p=f*n.width+i.left,m=i.left;m<i.right;m++,p++){const g=n.map[p];if(s[g])continue;s[g]=!0;const b=n.findCell(g);let S=e.nodeAt(g);if(!S)throw new RangeError(`No cell with offset ${g} found`);const v=i.left-b.left,C=b.right-i.right;if(v>0||C>0){let E=S.attrs;if(v>0&&(E=ml(E,0,v)),C>0&&(E=ml(E,E.colspan-C,C)),b.left<i.left){if(S=S.type.createAndFill(E),!S)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(E)}`)}else S=S.type.create(E,S.content)}if(b.top<i.top||b.bottom>i.bottom){const E={...S.attrs,rowspan:Math.min(b.bottom,i.bottom)-Math.max(b.top,i.top)};b.top<i.top?S=S.type.createAndFill(E):S=S.type.create(E,S.content)}d.push(S)}l.push(e.child(f).copy(te.from(d)))}const c=this.isColSelection()&&this.isRowSelection()?e:l;return new ge(te.from(c),1,1)}replace(e,n=ge.empty){const r=e.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){const{$from:c,$to:f}=i[l],d=e.mapping.slice(r);e.replace(d.map(c.pos),d.map(f.pos),l?ge.empty:n)}const s=je.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new ge(te.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Pt.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let l=0;l<s.length;l++)e(n.nodeAt(s[l]),i+s[l])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=Pt.get(r),s=e.start(-1),l=i.findCell(e.pos-s),c=i.findCell(n.pos-s),f=e.node(0);return l.top<=c.top?(l.top>0&&(e=f.resolve(s+i.map[l.left])),c.bottom<i.height&&(n=f.resolve(s+i.map[i.width*(i.height-1)+c.right-1]))):(c.top>0&&(n=f.resolve(s+i.map[c.left])),l.bottom<i.height&&(e=f.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))),new ls(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Pt.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const l=i+this.$anchorCell.nodeAfter.attrs.colspan,c=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,c)==n.width}eq(e){return e instanceof ls&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Pt.get(r),s=e.start(-1),l=i.findCell(e.pos-s),c=i.findCell(n.pos-s),f=e.node(0);return l.left<=c.left?(l.left>0&&(e=f.resolve(s+i.map[l.top*i.width])),c.right<i.width&&(n=f.resolve(s+i.map[i.width*(c.top+1)-1]))):(c.left>0&&(n=f.resolve(s+i.map[c.top*i.width])),l.right<i.width&&(e=f.resolve(s+i.map[i.width*(l.top+1)-1]))),new ls(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new ls(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new ls(e.resolve(n),e.resolve(r))}getBookmark(){return new gH(this.$anchorCell.pos,this.$headCell.pos)}};At.prototype.visible=!1;je.jsonID("cell",At);var gH=class VD{constructor(e,n){this.anchor=e,this.head=n}map(e){return new VD(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&$1(n,r)?new At(n,r):je.near(r,1)}};function yH(t){if(!(t.selection instanceof At))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push($t.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ct.create(t.doc,e)}function bH({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function xH({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function SH(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,l;if(r instanceof Ee&&(l=r.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")s=At.create(i,r.from);else if(l=="row"){const c=i.resolve(r.from+1);s=At.rowSelection(c,c)}else if(!n){const c=Pt.get(r.node),f=r.from+1,d=f+c.map[c.width*c.height-1];s=At.create(i,f+1,d)}}else r instanceof Oe&&bH(r)?s=Oe.create(i,r.from):r instanceof Oe&&xH(r)&&(s=Oe.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const wH=new Dt("fix-tables");function PD(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let l=0,c=0;l<s;l++){const f=e.child(l);for(let d=c,p=Math.min(i,l+3);d<p;d++)if(t.child(d)==f){c=d+1,n+=f.nodeSize;continue e}r(f,n),c<i&&t.child(c).sameMarkup(f)?PD(t.child(c),f,n+1,r):f.nodesBetween(0,f.content.size,r,n+1),n+=f.nodeSize}}function $D(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=vH(t,i,s,n))};return e?e.doc!=t.doc&&PD(e.doc,t.doc,0,r):t.doc.descendants(r),n}function vH(t,e,n,r){const i=Pt.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let f=0;f<i.height;f++)s.push(0);for(let f=0;f<i.problems.length;f++){const d=i.problems[f];if(d.type=="collision"){const p=e.nodeAt(d.pos);if(!p)continue;const m=p.attrs;for(let g=0;g<m.rowspan;g++)s[d.row+g]+=d.n;r.setNodeMarkup(r.mapping.map(n+1+d.pos),null,ml(m,m.colspan-d.n,d.n))}else if(d.type=="missing")s[d.row]+=d.n;else if(d.type=="overlong_rowspan"){const p=e.nodeAt(d.pos);if(!p)continue;r.setNodeMarkup(r.mapping.map(n+1+d.pos),null,{...p.attrs,rowspan:p.attrs.rowspan-d.n})}else if(d.type=="colwidth mismatch"){const p=e.nodeAt(d.pos);if(!p)continue;r.setNodeMarkup(r.mapping.map(n+1+d.pos),null,{...p.attrs,colwidth:d.colwidth})}else if(d.type=="zero_sized"){const p=r.mapping.map(n);r.delete(p,p+e.nodeSize)}}let l,c;for(let f=0;f<s.length;f++)s[f]&&(l==null&&(l=f),c=f);for(let f=0,d=n+1;f<i.height;f++){const p=e.child(f),m=d+p.nodeSize,g=s[f];if(g>0){let b="cell";p.firstChild&&(b=p.firstChild.type.spec.tableRole);const S=[];for(let C=0;C<g;C++){const E=Vn(t.schema)[b].createAndFill();E&&S.push(E)}const v=(f==0||l==f-1)&&c==f?d+1:m-1;r.insert(r.mapping.map(v),S)}d=m}return r.setMeta(wH,{fixTables:!0})}function Li(t){const e=t.selection,n=Tm(t),r=n.node(-1),i=n.start(-1),s=Pt.get(r);return{...e instanceof At?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function FD(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;mH(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let l=0;l<e.height;l++){const c=l*e.width+i;if(i>0&&i<e.width&&e.map[c-1]==e.map[c]){const f=e.map[c],d=r.nodeAt(f);t.setNodeMarkup(t.mapping.map(n+f),null,HD(d.attrs,i-e.colCount(f))),l+=d.attrs.rowspan-1}else{const f=s==null?Vn(r.type.schema).cell:r.nodeAt(e.map[c+s]).type,d=e.positionAt(l,i,r);t.insert(t.mapping.map(n+d),f.createAndFill())}}return t}function kH(t,e){if(!fi(t))return!1;if(e){const n=Li(t);e(FD(t.tr,n,n.left))}return!0}function CH(t,e){if(!fi(t))return!1;if(e){const n=Li(t);e(FD(t.tr,n,n.right))}return!0}function EH(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let l=0;l<e.height;){const c=l*e.width+i,f=e.map[c],d=n.nodeAt(f),p=d.attrs;if(i>0&&e.map[c-1]==f||i<e.width-1&&e.map[c+1]==f)t.setNodeMarkup(t.mapping.slice(s).map(r+f),null,ml(p,i-e.colCount(f)));else{const m=t.mapping.slice(s).map(r+f);t.delete(m,m+d.nodeSize)}l+=p.rowspan}}function TH(t,e){if(!fi(t))return!1;if(e){const n=Li(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;EH(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Pt.get(s)}e(r)}return!0}function AH(t,e,n){var r;const i=Vn(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function qD(t,{map:e,tableStart:n,table:r},i){let s=n;for(let d=0;d<i;d++)s+=r.child(d).nodeSize;const l=[];let c=i>0?-1:0;AH(e,r,i+c)&&(c=i==0||i==e.height?null:0);for(let d=0,p=e.width*i;d<e.width;d++,p++)if(i>0&&i<e.height&&e.map[p]==e.map[p-e.width]){const m=e.map[p],g=r.nodeAt(m).attrs;t.setNodeMarkup(n+m,null,{...g,rowspan:g.rowspan+1}),d+=g.colspan-1}else{var f;const m=c==null?Vn(r.type.schema).cell:(f=r.nodeAt(e.map[p+c*e.width]))===null||f===void 0?void 0:f.type,g=m==null?void 0:m.createAndFill();g&&l.push(g)}return t.insert(s,Vn(r.type.schema).row.create(null,l)),t}function MH(t,e){if(!fi(t))return!1;if(e){const n=Li(t);e(qD(t.tr,n,n.top))}return!0}function OH(t,e){if(!fi(t))return!1;if(e){const n=Li(t);e(qD(t.tr,n,n.bottom))}return!0}function _H(t,{map:e,table:n,tableStart:r},i){let s=0;for(let d=0;d<i;d++)s+=n.child(d).nodeSize;const l=s+n.child(i).nodeSize,c=t.mapping.maps.length;t.delete(s+r,l+r);const f=new Set;for(let d=0,p=i*e.width;d<e.width;d++,p++){const m=e.map[p];if(!f.has(m)){if(f.add(m),i>0&&m==e.map[p-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),d+=g.colspan-1}else if(i<e.height&&m==e.map[p+e.width]){const g=n.nodeAt(m),b=g.attrs,S=g.type.create({...b,rowspan:g.attrs.rowspan-1},g.content),v=e.positionAt(i+1,d,n);t.insert(t.mapping.slice(c).map(r+v),S),d+=b.colspan-1}}}}function DH(t,e){if(!fi(t))return!1;if(e){const n=Li(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;_H(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Pt.get(n.table)}e(r)}return!0}function jT(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function RH({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,l=(r.bottom-1)*t+r.left,c=i+(r.right-r.left-1);for(let f=r.top;f<r.bottom;f++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[c]==n[c+1])return!0;s+=t,c+=t}for(let f=r.left;f<r.right;f++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[l]==n[l+t])return!0;i++,l++}return!1}function IT(t,e){const n=t.selection;if(!(n instanceof At)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Li(t),{map:i}=r;if(RH(i,r))return!1;if(e){const s=t.tr,l={};let c=te.empty,f,d;for(let p=r.top;p<r.bottom;p++)for(let m=r.left;m<r.right;m++){const g=i.map[p*i.width+m],b=r.table.nodeAt(g);if(!(l[g]||!b))if(l[g]=!0,f==null)f=g,d=b;else{jT(b)||(c=c.append(b.content));const S=s.mapping.map(g+r.tableStart);s.delete(S,S+b.nodeSize)}}if(f==null||d==null)return!0;if(s.setNodeMarkup(f+r.tableStart,null,{...HD(d.attrs,d.attrs.colspan,r.right-r.left-d.attrs.colspan),rowspan:r.bottom-r.top}),c.size>0){const p=f+1+d.content.size,m=jT(d)?f+1:p;s.replaceWith(m+r.tableStart,p+r.tableStart,c)}s.setSelection(new At(s.doc.resolve(f+r.tableStart))),e(s)}return!0}function BT(t,e){const n=Vn(t.schema);return NH(({node:r})=>n[r.type.spec.tableRole])(t,e)}function NH(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof At){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var l;if(i=dH(r.$from),!i)return!1;s=(l=pl(r.$from))===null||l===void 0?void 0:l.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let c=i.attrs;const f=[],d=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const p=Li(e),m=e.tr;for(let b=0;b<p.right-p.left;b++)f.push(d?{...c,colwidth:d&&d[b]?[d[b]]:null}:c);let g;for(let b=p.top;b<p.bottom;b++){let S=p.map.positionAt(b,p.left,p.table);b==p.top&&(S+=i.nodeSize);for(let v=p.left,C=0;v<p.right;v++,C++)v==p.left&&b==p.top||m.insert(g=m.mapping.map(S+p.tableStart,1),t({node:i,row:b,col:v}).createAndFill(f[C]))}m.setNodeMarkup(s,t({node:i,row:p.top,col:p.left}),f[0]),r instanceof At&&m.setSelection(new At(m.doc.resolve(r.$anchorCell.pos),g?m.doc.resolve(g):void 0)),n(m)}return!0}}function zH(t,e){return function(n,r){if(!fi(n))return!1;const i=Tm(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof At?n.selection.forEachCell((l,c)=>{l.attrs[t]!==e&&s.setNodeMarkup(c,null,{...l.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function LH(t){return function(e,n){if(!fi(e))return!1;if(n){const r=Vn(e.schema),i=Li(e),s=e.tr,l=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),c=l.map(f=>i.table.nodeAt(f));for(let f=0;f<l.length;f++)c[f].type==r.header_cell&&s.setNodeMarkup(i.tableStart+l[f],r.cell,c[f].attrs);if(s.steps.length===0)for(let f=0;f<l.length;f++)s.setNodeMarkup(i.tableStart+l[f],r.header_cell,c[f].attrs);n(s)}return!0}}function UT(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function uf(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?LH(t):function(n,r){if(!fi(n))return!1;if(r){const i=Vn(n.schema),s=Li(n),l=n.tr,c=UT("row",s,i),f=UT("column",s,i),d=(t==="column"?c:t==="row"&&f)?1:0,p=t=="column"?{left:0,top:d,right:1,bottom:s.map.height}:t=="row"?{left:d,top:0,right:s.map.width,bottom:1}:s,m=t=="column"?f?i.cell:i.header_cell:t=="row"?c?i.cell:i.header_cell:i.cell;s.map.cellsInRect(p).forEach(g=>{const b=g+s.tableStart,S=l.doc.nodeAt(b);S&&l.setNodeMarkup(b,m,S.attrs)}),r(l)}return!0}}uf("row",{useDeprecatedLogic:!0});uf("column",{useDeprecatedLogic:!0});const jH=uf("cell",{useDeprecatedLogic:!0});function IH(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),l=s.lastChild;if(l)return i-1-l.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function HT(t){return function(e,n){if(!fi(e))return!1;const r=IH(Tm(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Oe.between(i,pH(i))).scrollIntoView())}return!0}}function BH(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function ih(t,e){const n=t.selection;if(!(n instanceof At))return!1;if(e){const r=t.tr,i=Vn(t.schema).cell.createAndFill().content;n.forEachCell((s,l)=>{s.content.eq(i)||r.replace(r.mapping.map(l+1),r.mapping.map(l+s.nodeSize-1),new ge(i,0,0))}),r.docChanged&&e(r)}return!0}function UH(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,l=i.type.schema,c=[];if(s=="row")for(let f=0;f<e.childCount;f++){let d=e.child(f).content;const p=f?0:Math.max(0,n-1),m=f<e.childCount-1?0:Math.max(0,r-1);(p||m)&&(d=ax(Vn(l).row,new ge(d,p,m)).content),c.push(d)}else if(s=="cell"||s=="header_cell")c.push(n||r?ax(Vn(l).row,new ge(e,n,r)).content:e);else return null;return HH(l,c)}function HH(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let l=s.childCount-1;l>=0;l--){const{rowspan:c,colspan:f}=s.child(l).attrs;for(let d=i;d<i+c;d++)n[d]=(n[d]||0)+f}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(te.empty),n[i]<r){const s=Vn(t).cell.createAndFill(),l=[];for(let c=n[i];c<r;c++)l.push(s);e[i]=e[i].append(te.from(l))}return{height:e.length,width:r,rows:e}}function ax(t,e){const n=t.createAndFill();return new Bx(n).replace(0,n.content.size,e).doc}function VH({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],l=[];for(let c=0;c<n.length;c++){const f=n[c],d=[];for(let p=s[c]||0,m=0;p<r;m++){let g=f.child(m%f.childCount);p+g.attrs.colspan>r&&(g=g.type.createChecked(ml(g.attrs,g.attrs.colspan,p+g.attrs.colspan-r),g.content)),d.push(g),p+=g.attrs.colspan;for(let b=1;b<g.attrs.rowspan;b++)s[c+b]=(s[c+b]||0)+g.attrs.colspan}l.push(te.from(d))}n=l,t=r}if(e!=i){const s=[];for(let l=0,c=0;l<i;l++,c++){const f=[],d=n[c%e];for(let p=0;p<d.childCount;p++){let m=d.child(p);l+m.attrs.rowspan>i&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,i-m.attrs.rowspan)},m.content)),f.push(m)}s.push(te.from(f))}n=s,e=i}return{width:t,height:e,rows:n}}function PH(t,e,n,r,i,s,l){const c=t.doc.type.schema,f=Vn(c);let d,p;if(i>e.width)for(let m=0,g=0;m<e.height;m++){const b=n.child(m);g+=b.nodeSize;const S=[];let v;b.lastChild==null||b.lastChild.type==f.cell?v=d||(d=f.cell.createAndFill()):v=p||(p=f.header_cell.createAndFill());for(let C=e.width;C<i;C++)S.push(v);t.insert(t.mapping.slice(l).map(g-1+r),S)}if(s>e.height){const m=[];for(let S=0,v=(e.height-1)*e.width;S<Math.max(e.width,i);S++){const C=S>=e.width?!1:n.nodeAt(e.map[v+S]).type==f.header_cell;m.push(C?p||(p=f.header_cell.createAndFill()):d||(d=f.cell.createAndFill()))}const g=f.row.create(null,te.from(m)),b=[];for(let S=e.height;S<s;S++)b.push(g);t.insert(t.mapping.slice(l).map(r+n.nodeSize-2),b)}return!!(d||p)}function VT(t,e,n,r,i,s,l,c){if(l==0||l==e.height)return!1;let f=!1;for(let d=i;d<s;d++){const p=l*e.width+d,m=e.map[p];if(e.map[p-e.width]==m){f=!0;const g=n.nodeAt(m),{top:b,left:S}=e.findCell(m);t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g.attrs,rowspan:l-b}),t.insert(t.mapping.slice(c).map(e.positionAt(l,S,n)),g.type.createAndFill({...g.attrs,rowspan:b+g.attrs.rowspan-l})),d+=g.attrs.colspan-1}}return f}function PT(t,e,n,r,i,s,l,c){if(l==0||l==e.width)return!1;let f=!1;for(let d=i;d<s;d++){const p=d*e.width+l,m=e.map[p];if(e.map[p-1]==m){f=!0;const g=n.nodeAt(m),b=e.colCount(m),S=t.mapping.slice(c).map(m+r);t.setNodeMarkup(S,null,ml(g.attrs,l-b,g.attrs.colspan-(l-b))),t.insert(S+g.nodeSize,g.type.createAndFill(ml(g.attrs,0,l-b))),d+=g.attrs.rowspan-1}}return f}function $T(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let l=Pt.get(s);const{top:c,left:f}=r,d=f+i.width,p=c+i.height,m=t.tr;let g=0;function b(){if(s=n?m.doc.nodeAt(n-1):m.doc,!s)throw new Error("No table found");l=Pt.get(s),g=m.mapping.maps.length}PH(m,l,s,n,d,p,g)&&b(),VT(m,l,s,n,f,d,c,g)&&b(),VT(m,l,s,n,f,d,p,g)&&b(),PT(m,l,s,n,c,p,f,g)&&b(),PT(m,l,s,n,c,p,d,g)&&b();for(let S=c;S<p;S++){const v=l.positionAt(S,f,s),C=l.positionAt(S,d,s);m.replace(m.mapping.slice(g).map(v+n),m.mapping.slice(g).map(C+n),new ge(i.rows[S-c],0,0))}b(),m.setSelection(new At(m.doc.resolve(n+l.positionAt(c,f,s)),m.doc.resolve(n+l.positionAt(p-1,d-1,s)))),e(m)}const $H=Gx({ArrowLeft:sh("horiz",-1),ArrowRight:sh("horiz",1),ArrowUp:sh("vert",-1),ArrowDown:sh("vert",1),"Shift-ArrowLeft":oh("horiz",-1),"Shift-ArrowRight":oh("horiz",1),"Shift-ArrowUp":oh("vert",-1),"Shift-ArrowDown":oh("vert",1),Backspace:ih,"Mod-Backspace":ih,Delete:ih,"Mod-Delete":ih});function Mh(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function sh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof At)return Mh(n,r,je.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const l=YD(i,t,e);if(l==null)return!1;if(t=="horiz")return Mh(n,r,je.near(n.doc.resolve(s.head+e),e));{const c=n.doc.resolve(l),f=UD(c,t,e);let d;return f?d=je.near(f,1):e<0?d=je.near(n.doc.resolve(c.before(-1)),-1):d=je.near(n.doc.resolve(c.after(-1)),1),Mh(n,r,d)}}}function oh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let l;if(s instanceof At)l=s;else{const f=YD(i,t,e);if(f==null)return!1;l=new At(n.doc.resolve(f))}const c=UD(l.$headCell,t,e);return c?Mh(n,r,new At(l.$anchorCell,c)):!1}}function FH(t,e){const n=t.state.doc,r=pl(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new At(r))),!0):!1}function qH(t,e,n){if(!fi(t.state))return!1;let r=UH(n);const i=t.state.selection;if(i instanceof At){r||(r={width:1,height:1,rows:[te.from(ax(Vn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),l=i.$anchorCell.start(-1),c=Pt.get(s).rectBetween(i.$anchorCell.pos-l,i.$headCell.pos-l);return r=VH(r,c.right-c.left,c.bottom-c.top),$T(t.state,t.dispatch,l,c,r),!0}else if(r){const s=Tm(t.state),l=s.start(-1);return $T(t.state,t.dispatch,l,Pt.get(s.node(-1)).findCell(s.pos-l),r),!0}else return!1}function YH(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=FT(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof At)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=pl(t.state.selection.$anchor))!=null&&((n=z0(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(f,d){let p=z0(t,d);const m=eo.getState(t.state)==null;if(!p||!$1(f,p))if(m)p=f;else return;const g=new At(f,p);if(m||!t.state.selection.eq(g)){const b=t.state.tr.setSelection(g);m&&b.setMeta(eo,f.pos),t.dispatch(b)}}function l(){t.root.removeEventListener("mouseup",l),t.root.removeEventListener("dragstart",l),t.root.removeEventListener("mousemove",c),eo.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(eo,-1))}function c(f){const d=f,p=eo.getState(t.state);let m;if(p!=null)m=t.state.doc.resolve(p);else if(FT(t,d.target)!=r&&(m=z0(t,e),!m))return l();m&&s(m,d)}t.root.addEventListener("mouseup",l),t.root.addEventListener("dragstart",l),t.root.addEventListener("mousemove",c)}function YD(t,e,n){if(!(t.state.selection instanceof Oe))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(i),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?l:null}}return null}function FT(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function z0(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&pl(t.state.doc.resolve(r))||pl(t.state.doc.resolve(i))}var KH=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),cx(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,cx(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function cx(t,e,n,r,i,s){let l=0,c=!0,f=e.firstChild;const d=t.firstChild;if(d){for(let m=0,g=0;m<d.childCount;m++){const{colspan:b,colwidth:S}=d.child(m).attrs;for(let v=0;v<b;v++,g++){const C=i==g?s:S&&S[v],E=C?C+"px":"";if(l+=C||r,C||(c=!1),f)f.style.width!=E&&(f.style.width=E),f=f.nextSibling;else{const B=document.createElement("col");B.style.width=E,e.appendChild(B)}}}for(;f;){var p;const m=f.nextSibling;(p=f.parentNode)===null||p===void 0||p.removeChild(f),f=m}c?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}const Tr=new Dt("tableColumnResizing");function WH({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=KH,lastColumnResizable:i=!0}={}){const s=new xt({key:Tr,state:{init(l,c){var f;const d=(f=s.spec)===null||f===void 0||(f=f.props)===null||f===void 0?void 0:f.nodeViews,p=Vn(c.schema).table.name;return r&&d&&(d[p]=(m,g)=>new r(m,n,g)),new GH(-1,!1)},apply(l,c){return c.apply(l)}},props:{attributes:l=>{const c=Tr.getState(l);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,c)=>{ZH(l,c,t,i)},mouseleave:l=>{JH(l)},mousedown:(l,c)=>{XH(l,c,e,n)}},decorations:l=>{const c=Tr.getState(l);if(c&&c.activeHandle>-1)return r9(l,c.activeHandle)},nodeViews:{}}});return s}var GH=class Oh{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Tr);if(r&&r.setHandle!=null)return new Oh(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Oh(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return lx(e.doc.resolve(i))||(i=-1),new Oh(i,n.dragging)}return n}};function ZH(t,e,n,r){if(!t.editable)return;const i=Tr.getState(t.state);if(i&&!i.dragging){const s=e9(e.target);let l=-1;if(s){const{left:c,right:f}=s.getBoundingClientRect();e.clientX-c<=n?l=qT(t,e,"left",n):f-e.clientX<=n&&(l=qT(t,e,"right",n))}if(l!=i.activeHandle){if(!r&&l!==-1){const c=t.state.doc.resolve(l),f=c.node(-1),d=Pt.get(f),p=c.start(-1);if(d.colCount(c.pos-p)+c.nodeAfter.attrs.colspan-1==d.width-1)return}KD(t,l)}}}function JH(t){if(!t.editable)return;const e=Tr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&KD(t,-1)}function XH(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,l=Tr.getState(t.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const c=t.state.doc.nodeAt(l.activeHandle),f=QH(t,l.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(Tr,{setDragging:{startX:e.clientX,startWidth:f}}));function d(m){s.removeEventListener("mouseup",d),s.removeEventListener("mousemove",p);const g=Tr.getState(t.state);g!=null&&g.dragging&&(t9(t,g.activeHandle,YT(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(Tr,{setDragging:null})))}function p(m){if(!m.which)return d(m);const g=Tr.getState(t.state);if(g&&g.dragging){const b=YT(g.dragging,m,n);KT(t,g.activeHandle,b,r)}}return KT(t,l.activeHandle,f,r),s.addEventListener("mouseup",d),s.addEventListener("mousemove",p),e.preventDefault(),!0}function QH(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let l=s.node.childNodes[s.offset].offsetWidth,c=n;if(r)for(let f=0;f<n;f++)r[f]&&(l-=r[f],c--);return l/c}function e9(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function qT(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:l}=s,c=pl(t.state.doc.resolve(l));if(!c)return-1;if(n=="right")return c.pos;const f=Pt.get(c.node(-1)),d=c.start(-1),p=f.map.indexOf(c.pos-d);return p%f.width==0?-1:d+f.map[p-1]}function YT(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function KD(t,e){t.dispatch(t.state.tr.setMeta(Tr,{setHandle:e}))}function t9(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Pt.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1,f=t.state.tr;for(let d=0;d<s.height;d++){const p=d*s.width+c;if(d&&s.map[p]==s.map[p-s.width])continue;const m=s.map[p],g=i.nodeAt(m).attrs,b=g.colspan==1?0:c-s.colCount(m);if(g.colwidth&&g.colwidth[b]==n)continue;const S=g.colwidth?g.colwidth.slice():n9(g.colspan);S[b]=n,f.setNodeMarkup(l+m,null,{...g,colwidth:S})}f.docChanged&&t.dispatch(f)}function KT(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),l=i.start(-1),c=Pt.get(s).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;let f=t.domAtPos(i.start(-1)).node;for(;f&&f.nodeName!="TABLE";)f=f.parentNode;f&&cx(s,f.firstChild,f,r,c,n)}function n9(t){return Array(t).fill(0)}function r9(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return ct.empty;const s=Pt.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1;for(let d=0;d<s.height;d++){const p=c+d*s.width;if((c==s.width-1||s.map[p]!=s.map[p+1])&&(d==0||s.map[p]!=s.map[p-s.width])){var f;const m=s.map[p],g=l+m+i.nodeAt(m).nodeSize-1,b=document.createElement("div");b.className="column-resize-handle",!((f=Tr.getState(t))===null||f===void 0)&&f.dragging&&n.push($t.node(l+m,l+m+i.nodeAt(m).nodeSize,{class:"column-resize-dragging"})),n.push($t.widget(g,b))}}return ct.create(t.doc,n)}function i9({allowTableNodeSelection:t=!1}={}){return new xt({key:eo,state:{init(){return null},apply(e,n){const r=e.getMeta(eo);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:yH,handleDOMEvents:{mousedown:YH},createSelectionBetween(e){return eo.getState(e.state)!=null?e.state.selection:null},handleTripleClick:FH,handleKeyDown:$H,handlePaste:qH},appendTransaction(e,n,r){return SH(r,$D(r,n),t)}})}function ux(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function WT(t,e,n,r,i,s){var l;let c=0,f=!0,d=e.firstChild;const p=t.firstChild;if(p!==null)for(let m=0,g=0;m<p.childCount;m+=1){const{colspan:b,colwidth:S}=p.child(m).attrs;for(let v=0;v<b;v+=1,g+=1){const C=i===g?s:S&&S[v],E=C?`${C}px`:"";if(c+=C||r,C||(f=!1),d){if(d.style.width!==E){const[B,I]=ux(r,C);d.style.setProperty(B,I)}d=d.nextSibling}else{const B=document.createElement("col"),[I,ne]=ux(r,C);B.style.setProperty(I,ne),e.appendChild(B)}}}for(;d;){const m=d.nextSibling;(l=d.parentNode)===null||l===void 0||l.removeChild(d),d=m}f?(n.style.width=`${c}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${c}px`)}class s9{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),WT(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,WT(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function o9(t,e,n,r){let i=0,s=!0;const l=[],c=t.firstChild;if(!c)return{};for(let m=0,g=0;m<c.childCount;m+=1){const{colspan:b,colwidth:S}=c.child(m).attrs;for(let v=0;v<b;v+=1,g+=1){const C=n===g?r:S&&S[v];i+=C||e,C||(s=!1);const[E,B]=ux(e,C);l.push(["col",{style:`${E}: ${B}`}])}}const f=s?`${i}px`:"",d=s?"":`${i}px`;return{colgroup:["colgroup",{},...l],tableWidth:f,tableMinWidth:d}}function GT(t,e){return t.createAndFill()}function l9(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function a9(t,e,n,r,i){const s=l9(t),l=[],c=[];for(let d=0;d<n;d+=1){const p=GT(s.cell);if(p&&c.push(p),r){const m=GT(s.header_cell);m&&l.push(m)}}const f=[];for(let d=0;d<e;d+=1)f.push(s.row.createChecked(null,r&&d===0?l:c));return s.table.createChecked(null,f)}function c9(t){return t instanceof At}const lh=({editor:t})=>{const{selection:e}=t.state;if(!c9(e))return!1;let n=0;const r=i_(e.ranges[0].$from,s=>s.type.name==="table");return r==null||r.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},u9=xn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:s9,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=o9(t,this.options.cellMinWidth),s=["table",Ft(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},s]:s},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const l=a9(s.schema,t,e,n);if(i){const c=r.selection.from+1;r.replaceSelectionWith(l).scrollIntoView().setSelection(Oe.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>kH(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>CH(t,e),deleteColumn:()=>({state:t,dispatch:e})=>TH(t,e),addRowBefore:()=>({state:t,dispatch:e})=>MH(t,e),addRowAfter:()=>({state:t,dispatch:e})=>OH(t,e),deleteRow:()=>({state:t,dispatch:e})=>DH(t,e),deleteTable:()=>({state:t,dispatch:e})=>BH(t,e),mergeCells:()=>({state:t,dispatch:e})=>IT(t,e),splitCell:()=>({state:t,dispatch:e})=>BT(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>uf("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>uf("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>jH(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>IT(t,e)?!0:BT(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>zH(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>HT(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>HT(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&$D(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=At.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:lh,"Mod-Backspace":lh,Delete:lh,"Mod-Delete":lh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[WH({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],i9({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Ge(we(t,"tableRole",e))}}}),f9=xn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Ft(this.options.HTMLAttributes,t),0]}}),d9=xn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Ft(this.options.HTMLAttributes,t),0]}}),h9=xn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Ft(this.options.HTMLAttributes,t),0]}});var p9=oM();const m9=Jp(p9);function g9(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var WD={exports:{}},L0={};/**
|
|
157
|
-
* @license React
|
|
158
|
-
* use-sync-external-store-shim.production.min.js
|
|
159
|
-
*
|
|
160
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
161
|
-
*
|
|
162
|
-
* This source code is licensed under the MIT license found in the
|
|
163
|
-
* LICENSE file in the root directory of this source tree.
|
|
164
|
-
*/var ZT;function y9(){if(ZT)return L0;ZT=1;var t=hn;function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,l=t.useDebugValue;function c(m,g){var b=g(),S=r({inst:{value:b,getSnapshot:g}}),v=S[0].inst,C=S[1];return s(function(){v.value=b,v.getSnapshot=g,f(v)&&C({inst:v})},[m,b,g]),i(function(){return f(v)&&C({inst:v}),m(function(){f(v)&&C({inst:v})})},[m]),l(b),b}function f(m){var g=m.getSnapshot;m=m.value;try{var b=g();return!n(m,b)}catch{return!0}}function d(m,g){return g()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return L0.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,L0}WD.exports=y9();var F1=WD.exports;const b9=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},x9=({contentComponent:t})=>{const e=F1.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return hn.createElement(hn.Fragment,null,Object.values(e))};function S9(){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]:m9.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 w9 extends hn.Component{constructor(e){var n;super(e),this.editorContentRef=hn.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=S9(),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 hn.createElement(hn.Fragment,null,hn.createElement("div",{ref:b9(n,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&hn.createElement(x9,{contentComponent:e.contentComponent}))}}const v9=O.forwardRef((t,e)=>{const n=hn.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return hn.createElement(w9,{key:n,innerRef:e,...t})}),k9=hn.memo(v9);var C9=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 l=s[i];if(!(l==="_owner"&&e.$$typeof)&&!t(e[l],n[l]))return!1}return!0}return e!==e&&n!==n},E9=g9(C9),GD={exports:{}},j0={};/**
|
|
165
|
-
* @license React
|
|
166
|
-
* use-sync-external-store-shim/with-selector.production.min.js
|
|
167
|
-
*
|
|
168
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
169
|
-
*
|
|
170
|
-
* This source code is licensed under the MIT license found in the
|
|
171
|
-
* LICENSE file in the root directory of this source tree.
|
|
172
|
-
*/var JT;function T9(){if(JT)return j0;JT=1;var t=hn,e=F1;function n(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,l=t.useEffect,c=t.useMemo,f=t.useDebugValue;return j0.useSyncExternalStoreWithSelector=function(d,p,m,g,b){var S=s(null);if(S.current===null){var v={hasValue:!1,value:null};S.current=v}else v=S.current;S=c(function(){function E(R){if(!B){if(B=!0,I=R,R=g(R),b!==void 0&&v.hasValue){var N=v.value;if(b(N,R))return ne=N}return ne=R}if(N=ne,r(I,R))return N;var Z=g(R);return b!==void 0&&b(N,Z)?N:(I=R,ne=Z)}var B=!1,I,ne,F=m===void 0?null:m;return[function(){return E(p())},F===null?void 0:function(){return E(F())}]},[p,m,g,b]);var C=i(d,S[0],S[1]);return l(function(){v.hasValue=!0,v.value=C},[C]),f(C),C},j0}GD.exports=T9();var A9=GD.exports;const M9=typeof window<"u"?O.useLayoutEffect:O.useEffect;class O9{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 _9(t){var e;const[n]=O.useState(()=>new O9(t.editor)),r=A9.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:E9);return M9(()=>n.watch(t.editor),[t.editor,n]),O.useDebugValue(r),r}const D9=!1,fx=typeof window>"u",R9=fx||!!(typeof window<"u"&&window.next);class q1{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?fx||R9?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 vI(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 l;return i===((l=n.extensions)===null||l===void 0?void 0:l[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?q1.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 N9(t={},e=[]){const n=O.useRef(t);n.current=t;const[r]=O.useState(()=>new q1(n)),i=F1.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return O.useDebugValue(i),O.useEffect(r.onRender(e)),_9({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&s===0?0:s+1}),i}const z9=O.createContext({editor:null});z9.Consumer;const L9=O.createContext({onDragStart:void 0}),j9=()=>O.useContext(L9);hn.forwardRef((t,e)=>{const{onDragStart:n}=j9(),r=t.as||"div";return hn.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});const I9=/^\s*>\s$/,B9=xn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Ft(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[Ku({find:I9,type:this.type})]}}),U9=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,H9=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,V9=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,P9=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,$9=Oi.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",Ft(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[cl({find:U9,type:this.type}),cl({find:V9,type:this.type})]},addPasteRules(){return[po({find:H9,type:this.type}),po({find:P9,type:this.type})]}}),F9="listItem",XT="textStyle",QT=/^\s*([-+*])\s$/,q9=xn.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",Ft(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(F9,this.editor.getAttributes(XT)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ku({find:QT,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ku({find:QT,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(XT),editor:this.editor})),[t]}}),Y9=/(^|[^`])`([^`]+)`(?!`)/,K9=/(^|[^`])`([^`]+)`(?!`)/g,W9=Oi.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ft(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[cl({find:Y9,type:this.type})]},addPasteRules(){return[po({find:K9,type:this.type})]}}),G9=/^```([a-z]+)?[\s\n]$/,Z9=/^~~~([a-z]+)?[\s\n]$/,J9=xn.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(l=>l.startsWith(n)).map(l=>l.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Ft(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,l=r.parent.textContent.endsWith(`
|
|
173
|
-
|
|
174
|
-
`);return!s||!l?!1:t.chain().command(({tr:c})=>(c.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 c=i.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:d})=>(d.setSelection(je.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[Nb({find:G9,type:this.type,getAttributes:t=>({language:t[1]})}),Nb({find:Z9,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new xt({key:new Dt("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:l,schema:c}=t.state,f=c.text(n.replace(/\r\n?/g,`
|
|
175
|
-
`));return l.replaceSelectionWith(this.type.create({language:s},f)),l.selection.$from.parent.type!==this.type&&l.setSelection(Oe.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),t.dispatch(l),!0}}})]}}),X9=xn.create({name:"doc",topNode:!0,content:"block+"});function Q9(t={}){return new xt({view(e){return new eV(e,t)}})}class eV{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=l=>{this[i](l)};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(),l=s.width/i.offsetWidth,c=s.height/i.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let b=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(b){let S=b.getBoundingClientRect(),v=m?S.bottom:S.top;m&&g&&(v=(v+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let C=this.width/2*c;r={left:S.left,right:S.right,top:v-C,bottom:v+C}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*l;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let f=this.editorView.dom.offsetParent;this.element||(this.element=f.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 d,p;if(!f||f==document.body&&getComputedStyle(f).position=="static")d=-pageXOffset,p=-pageYOffset;else{let m=f.getBoundingClientRect(),g=m.width/f.offsetWidth,b=m.height/f.offsetHeight;d=m.left-f.scrollLeft*g,p=m.top-f.scrollTop*b}this.element.style.left=(r.left-d)/l+"px",this.element.style.top=(r.top-p)/c+"px",this.element.style.width=(r.right-r.left)/l+"px",this.element.style.height=(r.bottom-r.top)/c+"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 l=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=KM(this.editorView.state.doc,l,this.editorView.dragging.slice);c!=null&&(l=c)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const tV=Zt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Q9(this.options)]}});class Vt extends je{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Vt.valid(r)?new Vt(r):je.near(r)}content(){return ge.empty}eq(e){return e instanceof Vt&&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 Vt(e.resolve(n.pos))}getBookmark(){return new Y1(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!nV(e)||!rV(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&&Vt.valid(e))return e;let i=e.pos,s=null;for(let l=e.depth;;l--){let c=e.node(l);if(n>0?e.indexAfter(l)<c.childCount:e.index(l)>0){s=c.child(n>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;i+=n;let f=e.doc.resolve(i);if(Vt.valid(f))return f}for(;;){let l=n>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!Ee.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=l,i+=n;let c=e.doc.resolve(i);if(Vt.valid(c))return c}return null}}}Vt.prototype.visible=!1;Vt.findFrom=Vt.findGapCursorFrom;je.jsonID("gapcursor",Vt);class Y1{constructor(e){this.pos=e}map(e){return new Y1(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Vt.valid(n)?new Vt(n):je.near(n)}}function ZD(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function nV(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||ZD(i.type))return!0;if(i.inlineContent)return!1}}return!0}function rV(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||ZD(i.type))return!0;if(i.inlineContent)return!1}}return!0}function iV(){return new xt({props:{decorations:aV,createSelectionBetween(t,e,n){return e.pos==n.pos&&Vt.valid(n)?new Vt(n):null},handleClick:oV,handleKeyDown:sV,handleDOMEvents:{beforeinput:lV}}})}const sV=Gx({ArrowLeft:ah("horiz",-1),ArrowRight:ah("horiz",1),ArrowUp:ah("vert",-1),ArrowDown:ah("vert",1)});function ah(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let l=r.selection,c=e>0?l.$to:l.$from,f=l.empty;if(l instanceof Oe){if(!s.endOfTextblock(n)||c.depth==0)return!1;f=!1,c=r.doc.resolve(e>0?c.after():c.before())}let d=Vt.findGapCursorFrom(c,e,f);return d?(i&&i(r.tr.setSelection(new Vt(d))),!0):!1}}function oV(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Vt.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Ee.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Vt(r))),!0)}function lV(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Vt))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=te.empty;for(let l=r.length-1;l>=0;l--)i=te.from(r[l].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new ge(i,0,0));return s.setSelection(Oe.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function aV(t){if(!(t.selection instanceof Vt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ct.create(t.doc,[$t.widget(t.selection.head,e,{key:"gapcursor"})])}const cV=Zt.create({name:"gapCursor",addProseMirrorPlugins(){return[iV()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Ge(we(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),uV=xn.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",Ft(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
176
|
-
`},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:l}=this.options,{splittableMarks:c}=r.extensionManager,f=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:p})=>{if(p&&f&&l){const m=f.filter(g=>c.includes(g.type.name));d.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),fV=xn.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]}`,Ft(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=>Nb({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var $p=200,yn=function(){};yn.prototype.append=function(e){return e.length?(e=yn.from(e),!this.length&&e||e.length<$p&&this.leafAppend(e)||this.length<$p&&e.leafPrepend(this)||this.appendInner(e)):this};yn.prototype.prepend=function(e){return e.length?yn.from(e).append(this):this};yn.prototype.appendInner=function(e){return new dV(this,e)};yn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?yn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};yn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};yn.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)};yn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,l){return i.push(e(s,l))},n,r),i};yn.from=function(e){return e instanceof yn?e:e&&e.length?new JD(e):yn.empty};var JD=(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,l,c){for(var f=s;f<l;f++)if(i(this.values[f],c+f)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,l,c){for(var f=s-1;f>=l;f--)if(i(this.values[f],c+f)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=$p)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=$p)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})(yn);yn.empty=new JD([]);var dV=(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,l){var c=this.left.length;if(i<c&&this.left.forEachInner(r,i,Math.min(s,c),l)===!1||s>c&&this.right.forEachInner(r,Math.max(i-c,0),Math.min(this.length,s)-c,l+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,l){var c=this.left.length;if(i>c&&this.right.forEachInvertedInner(r,i-c,Math.max(s,c)-c,l+c)===!1||s<c&&this.left.forEachInvertedInner(r,Math.min(i,c),s,l)===!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})(yn);const hV=500;class ii{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 l=e.tr,c,f,d=[],p=[];return this.items.forEach((m,g)=>{if(!m.step){i||(i=this.remapping(r,g+1),s=i.maps.length),s--,p.push(m);return}if(i){p.push(new Si(m.map));let b=m.step.map(i.slice(s)),S;b&&l.maybeStep(b).doc&&(S=l.mapping.maps[l.mapping.maps.length-1],d.push(new Si(S,void 0,void 0,d.length+p.length))),s--,S&&i.appendMap(S,s)}else l.maybeStep(m.step);if(m.selection)return c=i?m.selection.map(i.slice(s)):m.selection,f=new ii(this.items.slice(0,r).append(p.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:f,transform:l,selection:c}}addTransform(e,n,r,i){let s=[],l=this.eventCount,c=this.items,f=!i&&c.length?c.get(c.length-1):null;for(let p=0;p<e.steps.length;p++){let m=e.steps[p].invert(e.docs[p]),g=new Si(e.mapping.maps[p],m,n),b;(b=f&&f.merge(g))&&(g=b,p?s.pop():c=c.slice(0,c.length-1)),s.push(g),n&&(l++,n=void 0),i||(f=g)}let d=l-r.depth;return d>mV&&(c=pV(c,d),l-=d),new ii(c.append(s),l)}remapping(e,n){let r=new Hu;return this.items.forEach((i,s)=>{let l=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,l)},e,n),r}addMaps(e){return this.eventCount==0?this:new ii(this.items.append(e.map(n=>new Si(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,l=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},i);let f=n;this.items.forEach(g=>{let b=s.getMirror(--f);if(b==null)return;l=Math.min(l,b);let S=s.maps[b];if(g.step){let v=e.steps[b].invert(e.docs[b]),C=g.selection&&g.selection.map(s.slice(f+1,b));C&&c++,r.push(new Si(S,v,C))}else r.push(new Si(S))},i);let d=[];for(let g=n;g<l;g++)d.push(new Si(s.maps[g]));let p=this.items.slice(0,i).append(d).append(r),m=new ii(p,c);return m.emptyItemCount()>hV&&(m=m.compress(this.items.length-r.length)),m}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((l,c)=>{if(c>=e)i.push(l),l.selection&&s++;else if(l.step){let f=l.step.map(n.slice(r)),d=f&&f.getMap();if(r--,d&&n.appendMap(d,r),f){let p=l.selection&&l.selection.map(n.slice(r));p&&s++;let m=new Si(d.invert(),f,p),g,b=i.length-1;(g=i.length&&i[b].merge(m))?i[b]=g:i.push(m)}}else l.map&&r--},this.items.length,0),new ii(yn.from(i.reverse()),s)}}ii.empty=new ii(yn.empty,0);function pV(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Si{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 Si(n.getMap().invert(),n,this.selection)}}}class Zs{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const mV=20;function gV(t,e,n,r){let i=n.getMeta(nl),s;if(i)return i.historyState;n.getMeta(xV)&&(t=new Zs(t.done,t.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(l&&l.getMeta(nl))return l.getMeta(nl).redo?new Zs(t.done.addTransform(n,void 0,r,_h(e)),t.undone,eA(n.mapping.maps),t.prevTime,t.prevComposition):new Zs(t.done,t.undone.addTransform(n,void 0,r,_h(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),f=t.prevTime==0||!l&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!yV(n,t.prevRanges)),d=l?I0(t.prevRanges,n.mapping):eA(n.mapping.maps);return new Zs(t.done.addTransform(n,f?e.selection.getBookmark():void 0,r,_h(e)),ii.empty,d,n.time,c??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Zs(t.done.rebased(n,s),t.undone.rebased(n,s),I0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Zs(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),I0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function yV(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 eA(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,l)=>e.push(s,l));return e}function I0(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 bV(t,e,n){let r=_h(e),i=nl.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let l=s.selection.resolve(s.transform.doc),c=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),f=new Zs(n?c:s.remaining,n?s.remaining:c,null,0,-1);return s.transform.setSelection(l).setMeta(nl,{redo:n,historyState:f})}let B0=!1,tA=null;function _h(t){let e=t.plugins;if(tA!=e){B0=!1,tA=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){B0=!0;break}}return B0}const nl=new Dt("history"),xV=new Dt("closeHistory");function SV(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new xt({key:nl,state:{init(){return new Zs(ii.empty,ii.empty,null,0,-1)},apply(e,n,r){return gV(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?QD:r=="historyRedo"?e2:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function XD(t,e){return(n,r)=>{let i=nl.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=bV(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const QD=XD(!1,!0),e2=XD(!0,!0),wV=Zt.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>QD(t,e),redo:()=>({state:t,dispatch:e})=>e2(t,e)}},addProseMirrorPlugins(){return[SV(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()}}}),vV=xn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ft(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!CI(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}):qj(n)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:l,dispatch:c})=>{var f;if(c){const{$to:d}=l.selection,p=d.end();if(d.nodeAfter)d.nodeAfter.isTextblock?l.setSelection(Oe.create(l.doc,d.pos+1)):d.nodeAfter.isBlock?l.setSelection(Ee.create(l.doc,d.pos)):l.setSelection(Oe.create(l.doc,d.pos));else{const m=(f=d.parent.type.contentMatch.defaultType)===null||f===void 0?void 0:f.create();m&&(l.insert(p,m),l.setSelection(Oe.create(l.doc,p+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[kI({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),kV=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,CV=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,EV=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,TV=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,AV=Oi.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",Ft(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[cl({find:kV,type:this.type}),cl({find:EV,type:this.type})]},addPasteRules(){return[po({find:CV,type:this.type}),po({find:TV,type:this.type})]}}),MV=xn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ft(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)}}}),OV="listItem",nA="textStyle",rA=/^(\d+)\.\s$/,_V=xn.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",Ft(this.options.HTMLAttributes,n),0]:["ol",Ft(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(OV,this.editor.getAttributes(nA)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ku({find:rA,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=Ku({find:rA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(nA)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),DV=xn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ft(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),RV=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,NV=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,zV=Oi.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",Ft(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[cl({find:RV,type:this.type})]},addPasteRules(){return[po({find:NV,type:this.type})]}}),LV=xn.create({name:"text",group:"inline"}),jV=Zt.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push($9.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(B9.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(q9.configure(this.options.bulletList)),this.options.code!==!1&&t.push(W9.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(J9.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(X9.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(tV.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(cV.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(uV.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(fV.configure(this.options.heading)),this.options.history!==!1&&t.push(wV.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(vV.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(AV.configure(this.options.italic)),this.options.listItem!==!1&&t.push(MV.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(_V.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(DV.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(zV.configure(this.options.strike)),this.options.text!==!1&&t.push(LV.configure(this.options.text)),t}});function Eu(t){const e=t,n={id:e.id,author:e.author,range:e.range,content:e.content,status:e.status,timestamp:e.timestamp,...e.relRange!==void 0?{relRange:e.relRange}:{},...e.textSnapshot!==void 0?{textSnapshot:e.textSnapshot}:{},...e.editedAt!==void 0?{editedAt:e.editedAt}:{}};if(e.type==="suggestion"){let r,i;try{const s=JSON.parse(e.content);r=s.newText,i=s.reason??""}catch{console.warn(`[sanitizeAnnotation] Malformed JSON in legacy suggestion ${e.id}, treating as plain comment`),i=e.content}return{...n,type:"comment",content:i,suggestedText:r}}return e.type==="question"?{...n,type:"comment",directedAt:"claude"}:e.type==="highlight"?{...n,type:"highlight",color:e.color}:e.type==="flag"?{...n,type:"flag"}:e.type==="comment"?{...n,type:"comment",...e.suggestedText!==void 0?{suggestedText:e.suggestedText}:{},...e.directedAt!==void 0?{directedAt:e.directedAt}:{}}:(console.warn(`[sanitizeAnnotation] Unknown type "${e.type}" for ${e.id}, coercing to "comment"`),{...n,type:"comment"})}function t2(t){return t?t+1:0}function gl(t,e){let n=0,r=0;const i=t.childCount;for(let s=0;s<i;s++){const l=t.child(s),c=r+1,f=l.type.name==="heading"?t2(l.attrs.level||1):0,d=l.textContent.length,p=f+d;if(n+p>e){const m=e-n,g=Math.max(0,m-f);return Wr(c+Math.min(g,d))}if(n+=p,r+=l.nodeSize,s<i-1&&(n+=1,n>e))return Wr(c+d)}return Wr(t.content.size)}function Ka(t,e){let n=0,r=0;const i=t.childCount;for(let s=0;s<i;s++){const l=t.child(s),c=r+1,f=l.type.name==="heading"?t2(l.attrs.level||1):0,d=l.textContent.length,p=c+d;if(e<=p){if(e<=c)return yh(n+f);const m=e-c;return yh(n+f+Math.min(m,d))}n+=f+d,r+=l.nodeSize,s<i-1&&(n+=1)}return yh(n)}function iA(t,e,n){let r=0;const i=Math.min(t.childCount,e.length);for(let s=0;s<i;s++){const l=e.get(s),c=t.child(s),f=r+1;if(l instanceof zn){let d=0;for(let p=0;p<l.length;p++){const m=l.get(p);if(m instanceof Kn){if(m===n.type)return Wr(f+Math.min(d+n.index,c.textContent.length));d+=m.length}}}r+=c.nodeSize}return null}function n2(t,e,n){let r,i;try{const f=tl(n.fromRel),d=tl(n.toRel);r=Vb(f,t),i=Vb(d,t)}catch(f){return console.warn("[positions] relRangeToPmPositions: failed to resolve relRange:",f),null}if(!r||!i)return null;const s=t.getXmlFragment("default"),l=iA(e,s,r),c=iA(e,s,i);return l===null||c===null?null:{from:l,to:c}}function Fp(t,e,n){if(t.relRange&&n){const r=n2(n,e,t.relRange);if(r&&r.from<=r.to)return{...r,method:"rel"};r&&console.warn(`[positions] annotationToPmRange: inverted rel range for ${t.id}, falling back to flat`)}return t.range?{from:gl(e,t.range.from),to:gl(e,t.range.to),method:"flat"}:null}function r2(t,e){return{from:Ka(t,e.from),to:Ka(t,e.to)}}const ch=new Dt("tandemAnnotations");function sA(t,e,n){const r=[],i=t.content.size;return e.forEach(s=>{const l=Eu(s);if(l.status!=="pending"||!l.range&&!l.relRange)return;const c=Fp(l,t,n);if(!c)return;l.relRange&&c.method==="flat"&&console.warn("[annotation] relRange-equipped annotation %s fell back to flat offsets",l.id);const{from:f,to:d}=c;if(f>=d||f<0||d>i)return;let p={};switch(l.type){case"highlight":{const m=l.color||"yellow",g=Nu[m]||Nu.yellow;p={class:`tandem-highlight tandem-highlight--${m}`,style:`background: ${g}; border-radius: 2px; padding: 1px 0;`,"data-annotation-id":l.id,"aria-label":`Highlight annotation (${m})`};break}case"comment":l.suggestedText!==void 0?p={class:"tandem-suggestion",style:"background: rgba(139, 92, 246, 0.15); text-decoration: underline wavy #8b5cf6; text-underline-offset: 3px;","data-annotation-id":l.id,"aria-label":"Replacement annotation"}:l.directedAt==="claude"?p={class:"tandem-question",style:"background: rgba(99, 102, 241, 0.12); border-bottom: 2px solid #6366f1; padding-bottom: 1px;","data-annotation-id":l.id,"aria-label":"Question annotation"}:p={class:"tandem-comment",style:"border-bottom: 2px dashed #3b82f6; padding-bottom: 1px;","data-annotation-id":l.id,"aria-label":"Comment annotation"};break;case"flag":p={class:"tandem-flag",style:"background: rgba(239, 68, 68, 0.12); border-bottom: 2px solid #ef4444; padding-bottom: 1px;","data-annotation-id":l.id,"aria-label":"Flag annotation"};break;default:{console.warn("[annotation] Unhandled annotation type in buildDecorations, skipping");return}}try{r.push($t.inline(f,d,p))}catch(m){if(!(m instanceof RangeError))throw m;console.debug("[annotation] RangeError for %s (from=%d, to=%d), skipping",l.id,f,d)}}),ct.create(t,r)}const IV=Zt.create({name:"tandemAnnotations",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(xa);return[new xt({key:ch,state:{init(n,r){return sA(r.doc,e,t)},apply(n,r,i,s){return n.getMeta(ch)?sA(s.doc,e,t):n.docChanged?r.map(n.mapping,n.doc):r}},props:{decorations(n){return ch.getState(n)}},view(n){const r=()=>{const i=n.state.tr.setMeta(ch,!0);n.dispatch(i)};return e.observe(r),{destroy(){e.unobserve(r)}}}})]}});function K1(t){return`${t}_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function BV(){return K1("ann")}function UV(){return K1("msg")}function HV(t){return K1(t)}const ma=new Dt("tandemAuthorship");function VV(t,e,n){if(t.relRange){const r=n2(n,e,t.relRange);if(r&&r.from<r.to)return r}if(t.range){console.warn("[authorship] Falling back to flat offsets for range",t.id);const r=gl(e,t.range.from),i=gl(e,t.range.to);if(r<i)return{from:r,to:i}}return null}function U0(t,e,n,r){if(!r)return ct.empty;const i=[],s=t.content.size;return e.forEach(l=>{const c=l;if(!c.author||!c.range)return;const f=VV(c,t,n);if(!f)return;const{from:d,to:p}=f;if(d>=p||d<0||p>s)return;const m={class:`tandem-authorship tandem-authorship--${c.author}`};try{i.push($t.inline(d,p,m))}catch(g){if(!(g instanceof RangeError))throw g;console.warn("[authorship] Decoration RangeError for entry",c.id,g)}}),ct.create(t,i)}const PV=Zt.create({name:"tandemAuthorship",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(xC);let n=!1;try{n=localStorage.getItem(fM)==="true"}catch(r){console.warn("[authorship] localStorage unavailable",r)}return[new xt({key:ma,state:{init(r,i){return{visible:n,decorations:U0(i.doc,e,t,n)}},apply(r,i,s,l){const c=r.getMeta(ma);if((c==null?void 0:c.type)==="toggle"){const f=c.visible;return{visible:f,decorations:U0(l.doc,e,t,f)}}return(c==null?void 0:c.type)==="rebuild"?{visible:i.visible,decorations:U0(l.doc,e,t,i.visible)}:r.docChanged&&i.visible?{visible:i.visible,decorations:i.decorations.map(r.mapping,r.doc)}:i}},props:{decorations(r){var i;return((i=ma.getState(r))==null?void 0:i.decorations)??ct.empty}},view(r){const i=()=>{const l=r.state.tr.setMeta(ma,{type:"rebuild"});r.dispatch(l)};e.observe(i);const s=setTimeout(()=>{e.size>0&&i()},500);return{destroy(){clearTimeout(s),e.unobserve(i)}}}})]},onTransaction({transaction:t}){const e=this.options.ydoc;if(!e||t.getMeta("y-sync$")||t.getMeta(ma)||!t.docChanged)return;const n=e.getMap(xC),r=t.doc;t.steps.forEach(i=>{i.getMap().forEach((l,c,f,d)=>{if(d-f-(c-l)>0)try{const m=Ka(r,Wr(f)),g=Ka(r,Wr(d));if(g<=m)return;const b=HV("user"),S={id:b,author:"user",range:{from:m,to:g},timestamp:Date.now()};n.set(b,S)}catch(m){console.warn("[authorship] Position conversion failed during user attribution",m)}})})}}),uh=new Dt("tandemAwareness");function oA(t,e){if(!e)return ct.empty;const n=[],{focusParagraph:r,focusOffset:i,active:s}=e;if(r!==null&&r>=0){let l=0;t.forEach((c,f)=>{l===r&&n.push($t.node(f,f+c.nodeSize,{class:"tandem-claude-focus",style:"background: rgba(99, 102, 241, 0.1); border-left: 3px solid rgba(99, 102, 241, 0.4); padding-left: 8px; transition: background 0.3s ease, border-color 0.3s ease;"})),l++})}if(i!==null&&i>=0)try{const l=gl(t,yh(i)),c=s===!1?" tandem-claude-cursor-idle":"";n.push($t.widget(l,()=>{const f=document.createElement("span");f.className=`tandem-claude-cursor${c}`,f.setAttribute("aria-hidden","true");const d=document.createElement("span");return d.className="tandem-claude-cursor-label",d.textContent="Claude",f.appendChild(d),f}))}catch(l){console.warn("[awareness] cursor decoration failed, falling back to gutter-only:",l)}return n.length===0?ct.empty:ct.create(t,n)}const $V=Zt.create({name:"tandemAwareness",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(uM),n=t.getMap(ob);return[new xt({key:uh,state:{init(r,i){const s=e.get("claude");return oA(i.doc,s??null)},apply(r,i,s,l){if(r.getMeta(uh)){const c=e.get("claude");return oA(l.doc,c??null)}return r.docChanged?i.map(r.mapping,r.doc):i}},props:{decorations(r){return uh.getState(r)}},view(r){const i=()=>{const s=r.state.tr.setMeta(uh,!0);r.dispatch(s)};return e.observe(i),{destroy(){e.unobserve(i)}}}}),new xt({key:new Dt("tandemUserAwareness"),view(){let r=null,i=null,s=null,l=!1,c=-1;return{update(f,d){const{state:p}=f;if(!p.selection.eq(d.selection)){const m=r2(p.doc,{from:Wr(p.selection.from),to:Wr(p.selection.to)});if(p.selection.from===p.selection.to)s&&(clearTimeout(s),s=null),n.set("selection",{...m,timestamp:Date.now()});else{const g=p.doc.textBetween(p.selection.from,p.selection.to,`
|
|
177
|
-
`),b=g.length>200?g.slice(0,197)+"...":g;s&&clearTimeout(s),s=setTimeout(()=>{s=null,n.set("selection",{...m,selectedText:b,timestamp:Date.now()})},150)}}p.doc!==d.doc&&(c=p.selection.from,l=!0,i||(i=setTimeout(()=>{i=null,l&&n.set("activity",{isTyping:!0,cursor:c,lastEdit:Date.now()})},200)),r&&clearTimeout(r),r=setTimeout(()=>{l=!1,n.set("activity",{isTyping:!1,cursor:f.state.selection.from,lastEdit:Date.now()})},Oz))},destroy(){r&&clearTimeout(r),i&&clearTimeout(i),s&&clearTimeout(s)}}}})]}});function lA({ydoc:t,provider:e,readOnly:n,reviewMode:r,activeAnnotationId:i,onEditorReady:s,onAnnotationClick:l}){const c=N9({extensions:[jV.configure({history:!1}),LU.configure({multicolor:!0}),oH.configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}}),lH.configure({placeholder:"Open a document with Claude to get started..."}),u9.configure({resizable:!0}),h9,f9,d9,DU.configure({document:t}),RU.configure({provider:e,user:{name:zx(),color:"#f59e0b"}}),IV.configure({ydoc:t}),PV.configure({ydoc:t}),$V.configure({ydoc:t})],editorProps:{attributes:{class:"tandem-editor",style:"outline: none; min-height: 500px; font-size: var(--tandem-editor-font-size, 16px); line-height: 1.6;"}}},[t,e]);O.useEffect(()=>{c&&c.setEditable(!n)},[c,n]),O.useEffect(()=>{if(c)return xM(p=>c.commands.updateUser({name:p}))},[c]),O.useEffect(()=>(s==null||s(c),()=>s==null?void 0:s(null)),[c,s]),O.useEffect(()=>{if(!c)return;const p=c.view.dom;p.querySelectorAll(".tandem-annotation-active").forEach(m=>{m.classList.remove("tandem-annotation-active")}),i&&r&&p.querySelectorAll(`[data-annotation-id="${CSS.escape(i)}"]`).forEach(m=>{m.classList.add("tandem-annotation-active")})},[c,i,r]);const f=O.useCallback(p=>{const m=p.target.closest("[data-annotation-id]");if(!m)return;const g=m.getAttribute("data-annotation-id");g&&l&&l(g)},[l]),d=r?"tandem-review-dimmed":"";return k.jsxs("div",{className:d,onClick:f,children:[k.jsx(k9,{editor:c}),k.jsx("style",{children:`
|
|
178
|
-
.tandem-editor h1 { font-size: 2em; font-weight: 700; margin: 0.67em 0; }
|
|
179
|
-
.tandem-editor h2 { font-size: 1.5em; font-weight: 600; margin: 0.75em 0; }
|
|
180
|
-
.tandem-editor h3 { font-size: 1.17em; font-weight: 600; margin: 0.83em 0; }
|
|
181
|
-
.tandem-editor p { margin: 0.5em 0; }
|
|
182
|
-
.tandem-editor ul, .tandem-editor ol { padding-left: 1.5em; }
|
|
183
|
-
.tandem-editor table { border-collapse: collapse; width: 100%; margin: 1em 0; }
|
|
184
|
-
.tandem-editor td, .tandem-editor th { border: 1px solid #ddd; padding: 8px; }
|
|
185
|
-
.tandem-editor th { background: #f5f5f5; font-weight: 600; }
|
|
186
|
-
.tandem-editor blockquote {
|
|
187
|
-
border-left: 3px solid #e5e7eb;
|
|
188
|
-
margin: 0.5em 0;
|
|
189
|
-
padding-left: 1em;
|
|
190
|
-
color: #6b7280;
|
|
191
|
-
}
|
|
192
|
-
.collaboration-cursor__caret {
|
|
193
|
-
position: relative;
|
|
194
|
-
border-left: 2px solid;
|
|
195
|
-
border-right: none;
|
|
196
|
-
margin-left: -1px;
|
|
197
|
-
}
|
|
198
|
-
.collaboration-cursor__label {
|
|
199
|
-
position: absolute;
|
|
200
|
-
top: -1.4em;
|
|
201
|
-
left: -1px;
|
|
202
|
-
font-size: 12px;
|
|
203
|
-
white-space: nowrap;
|
|
204
|
-
padding: 0 4px;
|
|
205
|
-
border-radius: 3px 3px 3px 0;
|
|
206
|
-
color: white;
|
|
207
|
-
}
|
|
208
|
-
.ProseMirror-focused { outline: none; }
|
|
209
|
-
.ProseMirror p.is-empty::before {
|
|
210
|
-
content: attr(data-placeholder);
|
|
211
|
-
color: #adb5bd;
|
|
212
|
-
pointer-events: none;
|
|
213
|
-
float: left;
|
|
214
|
-
height: 0;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/* Annotation decorations */
|
|
218
|
-
.tandem-highlight { cursor: pointer; }
|
|
219
|
-
.tandem-highlight:hover { filter: brightness(0.95); }
|
|
220
|
-
.tandem-comment { cursor: pointer; }
|
|
221
|
-
.tandem-comment:hover { border-bottom-style: solid; }
|
|
222
|
-
.tandem-suggestion { cursor: pointer; }
|
|
223
|
-
|
|
224
|
-
/* Review mode dimming — grays out text, keeps annotated spans readable */
|
|
225
|
-
.tandem-review-dimmed .ProseMirror {
|
|
226
|
-
color: #9ca3af;
|
|
227
|
-
transition: color 0.2s;
|
|
228
|
-
}
|
|
229
|
-
.tandem-review-dimmed .tandem-highlight,
|
|
230
|
-
.tandem-review-dimmed .tandem-comment,
|
|
231
|
-
.tandem-review-dimmed .tandem-suggestion {
|
|
232
|
-
color: #1f2937;
|
|
233
|
-
}
|
|
234
|
-
.tandem-review-dimmed .tandem-annotation-active {
|
|
235
|
-
outline: 2px solid #6366f1;
|
|
236
|
-
outline-offset: 1px;
|
|
237
|
-
border-radius: 2px;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/* Authorship decorations — user=blue, claude=orange */
|
|
241
|
-
.tandem-authorship { transition: color 0.2s; }
|
|
242
|
-
.tandem-authorship--user { color: var(--tandem-author-user); }
|
|
243
|
-
.tandem-authorship--claude { color: var(--tandem-author-claude); }
|
|
244
|
-
|
|
245
|
-
/* Claude focus paragraph */
|
|
246
|
-
.tandem-claude-focus {
|
|
247
|
-
position: relative;
|
|
248
|
-
}
|
|
249
|
-
.tandem-claude-focus::before {
|
|
250
|
-
content: '';
|
|
251
|
-
position: absolute;
|
|
252
|
-
left: -24px;
|
|
253
|
-
top: 0;
|
|
254
|
-
bottom: 0;
|
|
255
|
-
width: 3px;
|
|
256
|
-
background: rgba(99, 102, 241, 0.6);
|
|
257
|
-
border-radius: 2px;
|
|
258
|
-
animation: tandem-gutter-pulse 2s ease-in-out infinite;
|
|
259
|
-
}
|
|
260
|
-
@keyframes tandem-gutter-pulse {
|
|
261
|
-
0%, 100% { opacity: 0.4; }
|
|
262
|
-
50% { opacity: 1; }
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/* Claude character-level cursor */
|
|
266
|
-
.tandem-claude-cursor {
|
|
267
|
-
position: relative;
|
|
268
|
-
display: inline;
|
|
269
|
-
border-left: 2px solid #8b5cf6;
|
|
270
|
-
margin-left: -1px;
|
|
271
|
-
z-index: 10;
|
|
272
|
-
animation: tandem-claude-blink 1.2s step-end infinite;
|
|
273
|
-
}
|
|
274
|
-
.tandem-claude-cursor-idle {
|
|
275
|
-
opacity: 0.3;
|
|
276
|
-
animation: none;
|
|
277
|
-
}
|
|
278
|
-
.tandem-claude-cursor-label {
|
|
279
|
-
position: absolute;
|
|
280
|
-
top: -1.4em;
|
|
281
|
-
left: -1px;
|
|
282
|
-
font-size: 11px;
|
|
283
|
-
font-weight: 500;
|
|
284
|
-
white-space: nowrap;
|
|
285
|
-
padding: 0 4px;
|
|
286
|
-
border-radius: 3px 3px 3px 0;
|
|
287
|
-
background: #8b5cf6;
|
|
288
|
-
color: white;
|
|
289
|
-
pointer-events: none;
|
|
290
|
-
z-index: 11;
|
|
291
|
-
}
|
|
292
|
-
@keyframes tandem-claude-blink {
|
|
293
|
-
0%, 100% { opacity: 1; }
|
|
294
|
-
50% { opacity: 0; }
|
|
295
|
-
}
|
|
296
|
-
`})]})}function fn({label:t,ariaLabel:e,shortcut:n,disabled:r,disabledTitle:i,active:s,onMouseDown:l,onClick:c,style:f}){let d="1px solid #e5e7eb",p="#fff",m="#374151";r?(p="#f9fafb",m="#9ca3af"):s&&(d="1px solid #818cf8",p="#eef2ff",m="#4338ca");const g=e??(typeof t=="string"?t:void 0),b=g??"";return k.jsx("button",{type:"button",disabled:r,title:r&&i?i:n?`${b} (${n})`:b,"aria-label":g,onMouseDown:l,onClick:c,style:{padding:"4px 10px",fontSize:"13px",borderRadius:"4px",cursor:r?"not-allowed":"pointer",...f,border:d,background:p,color:m},children:t})}const FV=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("circle",{cx:"2",cy:"4",r:"1.5",fill:"currentColor"}),k.jsx("circle",{cx:"2",cy:"8",r:"1.5",fill:"currentColor"}),k.jsx("circle",{cx:"2",cy:"12",r:"1.5",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"3",width:"9",height:"2",rx:"1",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"7",width:"9",height:"2",rx:"1",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"11",width:"9",height:"2",rx:"1",fill:"currentColor"})]}),qV=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("rect",{x:"5",y:"3",width:"9",height:"2",rx:"1",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"7",width:"9",height:"2",rx:"1",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"11",width:"9",height:"2",rx:"1",fill:"currentColor"}),k.jsx("text",{x:"0",y:"5.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"1."}),k.jsx("text",{x:"0",y:"9.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"2."}),k.jsx("text",{x:"0",y:"13.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"3."})]}),YV=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M6.5 8.5a3.5 3.5 0 0 0 5 0l2-2a3.5 3.5 0 0 0-5-5l-1 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),k.jsx("path",{d:"M9.5 7.5a3.5 3.5 0 0 0-5 0l-2 2a3.5 3.5 0 0 0 5 5l1-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),KV=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M5 4L1 8l4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),k.jsx("path",{d:"M11 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),k.jsx("path",{d:"M9 2l-2 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),WV=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("rect",{x:"0",y:"2",width:"3",height:"12",rx:"1.5",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"4",width:"9",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"}),k.jsx("rect",{x:"5",y:"8",width:"7",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"}),k.jsx("rect",{x:"5",y:"12",width:"8",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"})]}),GV=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M4 7L1 4l3-3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),k.jsx("path",{d:"M1 4h9a5 5 0 0 1 0 10H7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),ZV=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M12 7l3-3-3-3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),k.jsx("path",{d:"M15 4H6a5 5 0 0 0 0 10h3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),i2=[1,2,3],JV={1:700,2:600,3:500};function XV(t){for(const e of i2)if(t.isActive("heading",{level:e}))return e;return null}function Vr(t){return e=>{e.preventDefault(),t()}}function QV({editor:t,disabled:e}){var S,v;const[,n]=O.useState(0),[r,i]=O.useState(!1),s=O.useRef(null);if(O.useEffect(()=>{if(!t)return;const C=()=>{t.isDestroyed||n(E=>E+1)};return t.on("transaction",C),()=>{t.off("transaction",C)}},[t]),O.useEffect(()=>{if(!r)return;function C(E){s.current&&!s.current.contains(E.target)&&i(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[r]),!t)return null;const c=!t.isEditable||!!e,f=Ei.getState(t.state),d=!c&&(((S=f==null?void 0:f.undoManager)==null?void 0:S.undoStack.length)??0)>0,p=!c&&(((v=f==null?void 0:f.undoManager)==null?void 0:v.redoStack.length)??0)>0,m=XV(t);function g(C){return E=>{E.preventDefault(),!(!t||t.isDestroyed)&&(t.chain().focus().toggleHeading({level:C}).run(),i(!1))}}const b=m?`H${m}`:"H";return k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px"},children:[k.jsx(fn,{label:GV,ariaLabel:"Undo",shortcut:"Ctrl+Z",disabled:!d,onMouseDown:Vr(()=>t.commands.undo()),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx(fn,{label:ZV,ariaLabel:"Redo",shortcut:"Ctrl+Shift+Z",disabled:!p,onMouseDown:Vr(()=>t.commands.redo()),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx("div",{style:{width:"1px",height:"16px",background:"#e5e7eb",margin:"0 2px"}}),k.jsx(fn,{label:"B",shortcut:"Ctrl+B",disabled:c,active:t.isActive("bold"),onMouseDown:Vr(()=>t.chain().focus().toggleBold().run()),style:{fontWeight:700,minWidth:"30px"}}),k.jsx(fn,{label:"I",shortcut:"Ctrl+I",disabled:c,active:t.isActive("italic"),onMouseDown:Vr(()=>t.chain().focus().toggleItalic().run()),style:{fontStyle:"italic",minWidth:"30px"}}),k.jsx(fn,{label:"S",shortcut:"Ctrl+Shift+X",disabled:c,active:t.isActive("strike"),onMouseDown:Vr(()=>t.chain().focus().toggleStrike().run()),style:{textDecoration:"line-through",minWidth:"30px"}}),k.jsx(fn,{label:"<>",shortcut:"Ctrl+E",disabled:c,active:t.isActive("code"),onMouseDown:Vr(()=>t.chain().focus().toggleCode().run()),style:{fontFamily:"monospace",minWidth:"30px"}}),k.jsxs("div",{style:{position:"relative"},ref:s,onKeyDown:C=>{C.key==="Escape"&&i(!1)},children:[k.jsx(fn,{label:b,disabled:c,active:m!==null,onMouseDown:C=>{C.preventDefault(),i(E=>!E)},style:{minWidth:"30px"}}),r&&k.jsx("div",{role:"menu","aria-label":"Heading level",style:{position:"absolute",top:"100%",left:0,marginTop:"4px",background:"#fff",border:"1px solid #e5e7eb",borderRadius:"6px",padding:"4px",display:"flex",flexDirection:"column",gap:"2px",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:i2.map(C=>k.jsxs("button",{type:"button",role:"menuitem",onMouseDown:g(C),style:{padding:"4px 12px",fontSize:"13px",border:"none",borderRadius:"4px",background:m===C?"#eef2ff":"transparent",color:m===C?"#4338ca":"#374151",cursor:"pointer",textAlign:"left",fontWeight:JV[C],whiteSpace:"nowrap"},children:["Heading ",C]},C))})]}),k.jsx("div",{style:{width:"1px",height:"16px",background:"#e5e7eb",margin:"0 2px"}}),k.jsx(fn,{label:FV,ariaLabel:"Bullet list",shortcut:"Ctrl+Shift+8",disabled:c,active:t.isActive("bulletList"),onMouseDown:Vr(()=>t.chain().focus().toggleBulletList().run()),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx(fn,{label:qV,ariaLabel:"Ordered list",shortcut:"Ctrl+Shift+7",disabled:c,active:t.isActive("orderedList"),onMouseDown:Vr(()=>t.chain().focus().toggleOrderedList().run()),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx(fn,{label:WV,ariaLabel:"Blockquote",shortcut:"Ctrl+Shift+B",disabled:c,active:t.isActive("blockquote"),onMouseDown:Vr(()=>t.chain().focus().toggleBlockquote().run()),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx("div",{style:{width:"1px",height:"16px",background:"#e5e7eb",margin:"0 2px"}}),k.jsx(fn,{label:YV,ariaLabel:"Link",shortcut:"Ctrl+K",disabled:c||!t.isActive("link")&&t.state.selection.from===t.state.selection.to,active:t.isActive("link"),onMouseDown:Vr(()=>{if(t.isActive("link"))t.chain().focus().unsetLink().run();else{const C=window.prompt("Enter URL:");C&&t.chain().focus().setLink({href:C}).run()}}),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx(fn,{label:"—",ariaLabel:"Horizontal rule",disabled:c,onMouseDown:Vr(()=>t.chain().focus().setHorizontalRule().run()),style:{minWidth:"30px"}}),k.jsx(fn,{label:KV,ariaLabel:"Code block",disabled:c,active:t.isActive("codeBlock"),onMouseDown:Vr(()=>t.chain().focus().toggleCodeBlock().run()),style:{minWidth:"30px",padding:"4px 6px"}})]})}function eP({inputRef:t,value:e,onChange:n,onKeyDown:r,onSubmit:i,onCancel:s,placeholder:l,submitLabel:c,borderColor:f,canSubmit:d,secondaryInput:p}){return k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[k.jsx("input",{ref:t,type:"text",value:e,onChange:m=>n(m.target.value),onKeyDown:r,placeholder:l,style:{padding:"3px 8px",fontSize:"13px",border:`1px solid ${f}`,borderRadius:"4px",outline:"none",minWidth:"120px",flex:"1 1 200px"}}),p,k.jsx(fn,{label:c,disabled:!d,onClick:i}),k.jsx(fn,{label:"Cancel",disabled:!1,onClick:s})]})}const tP=[{value:"yellow",label:"Yellow"},{value:"red",label:"Red"},{value:"green",label:"Green"},{value:"blue",label:"Blue"},{value:"purple",label:"Purple"}];function nP({editor:t,ydoc:e,onSettingsOpen:n,settingsBtnRef:r,tandemMode:i,onModeChange:s,heldCount:l}){const[c,f]=O.useState(!1),[d,p]=O.useState("yellow"),[m,g]=O.useState(!1),[b,S]=O.useState("idle"),[v,C]=O.useState(""),[E,B]=O.useState(!1),[I,ne]=O.useState(""),[F,R]=O.useState(!1),N=O.useRef(null),Z=O.useRef(null),j=O.useRef(null);O.useEffect(()=>{if(!t)return;const Y=t;function fe(){const{from:oe,to:Ne}=Y.state.selection,Fe=oe!==Ne;f(Ue=>Ue===Fe?Ue:Fe)}return t.on("selectionUpdate",fe),()=>{t.off("selectionUpdate",fe)}},[t]),O.useEffect(()=>{b==="comment"&&Z.current&&Z.current.focus()},[b]),O.useEffect(()=>{if(!m)return;function Y(fe){j.current&&!j.current.contains(fe.target)&&g(!1)}return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[m]);function ie(Y,fe,oe){if(!t||!e)return;const Ne=N.current??t.state.selection,{from:Fe,to:Ue}=Ne;if(Fe===Ue)return;const mt=Ka(t.state.doc,Wr(Fe)),_e=Ka(t.state.doc,Wr(Ue)),ze=BV(),Lt={id:ze,author:"user",type:Y,range:{from:mt,to:_e},content:fe,status:"pending",timestamp:Date.now(),...oe!=null&&oe.color?{color:oe.color}:{},...(oe==null?void 0:oe.suggestedText)!==void 0?{suggestedText:oe.suggestedText}:{},...(oe==null?void 0:oe.directedAt)!==void 0?{directedAt:oe.directedAt}:{}};e.getMap(xa).set(ze,Lt),N.current=null}function re(){if(!t)return;const{from:Y,to:fe}=t.state.selection;N.current={from:Y,to:fe}}function se(){N.current=null,t==null||t.chain().focus().run()}const be=b!=="idle";function ue(Y){Y.preventDefault(),ie("highlight","",{color:d})}function H(Y){Y.preventDefault(),g(fe=>!fe)}function L(Y){p(Y),g(!1)}const G=O.useCallback(Y=>fe=>{fe.preventDefault(),re(),S(Y),C(""),ne(""),B(!1),R(!1)},[t]),me=O.useMemo(()=>G("comment"),[G]);function Te(){S("idle"),C(""),ne(""),B(!1),R(!1),se()}function M(){if(!v.trim()&&!I.trim()){Te();return}const Y={};E&&I.trim()&&(Y.suggestedText=I.trim()),F&&(Y.directedAt="claude"),ie("comment",v.trim(),Y),S("idle"),C(""),ne(""),B(!1),R(!1),t==null||t.chain().focus().run()}function _(Y){Y.key==="Enter"?(Y.preventDefault(),M()):Y.key==="Escape"&&Te()}function V(Y){Y.preventDefault(),ie("flag","")}const T=t&&e&&c;return k.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px",minHeight:"42px",padding:"8px 16px",borderBottom:"1px solid #e5e7eb",background:"#fafafa",userSelect:"none"},children:[k.jsx("span",{style:{fontWeight:700,fontSize:"15px",color:"#6366f1",letterSpacing:"-0.02em"},children:"Tandem"}),k.jsx("div",{style:{width:"1px",height:"20px",background:"#e5e7eb",margin:"0 8px"}}),k.jsx(QV,{editor:t,disabled:be}),k.jsx("div",{style:{width:"1px",height:"20px",background:"#e5e7eb",margin:"0 8px"}}),k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",position:"relative"},children:[k.jsx(fn,{label:"Highlight",disabled:!T||be,disabledTitle:"Select text first",onMouseDown:ue,style:{borderRadius:"4px 0 0 4px",borderRight:"none"}}),k.jsx("button",{disabled:!T||be,onMouseDown:H,title:"Choose highlight color",style:{padding:"4px 6px",fontSize:"13px",border:"1px solid #e5e7eb",borderRadius:"0 4px 4px 0",background:!T||be?"#f9fafb":"#fff",cursor:!T||be?"not-allowed":"pointer",display:"flex",alignItems:"center"},children:k.jsx("span",{style:{display:"inline-block",width:"12px",height:"12px",borderRadius:"2px",background:Nu[d],border:"1px solid rgba(0,0,0,0.15)"}})}),m&&k.jsxs("div",{ref:j,style:{position:"absolute",top:"100%",left:0,marginTop:"4px",background:"#fff",border:"1px solid #e5e7eb",borderRadius:"6px",padding:"6px",display:"flex",gap:"4px",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[tP.map(({value:Y,label:fe})=>k.jsx("button",{title:fe,onClick:()=>L(Y),style:{width:"24px",height:"24px",borderRadius:"4px",border:Y===d?"2px solid #374151":"1px solid rgba(0,0,0,0.15)",background:Nu[Y],cursor:"pointer",padding:0}},Y)),k.jsx("button",{"data-testid":"color-picker-close",title:"Close",onClick:()=>g(!1),style:{width:"24px",height:"24px",borderRadius:"4px",border:"1px solid rgba(0,0,0,0.15)",background:"#f3f4f6",cursor:"pointer",padding:0,fontSize:"13px",color:"#6b7280",display:"flex",alignItems:"center",justifyContent:"center"},children:"✕"})]})]}),k.jsx(fn,{label:"Comment",disabled:!T||be,disabledTitle:"Select text first",onMouseDown:me}),b==="comment"&&k.jsx(eP,{inputRef:Z,value:v,onChange:C,onKeyDown:_,onSubmit:M,onCancel:Te,placeholder:F?"Ask about this text...":"Add a comment...",submitLabel:E?"Suggest":F?"Ask":"Add",borderColor:E?"#8b5cf6":F?"#6366f1":"#3b82f6",canSubmit:!!v.trim()||E&&!!I.trim(),secondaryInput:k.jsxs(k.Fragment,{children:[E&&k.jsx("input",{type:"text",value:I,onChange:Y=>ne(Y.target.value),onKeyDown:_,placeholder:"Replacement text...",style:{padding:"3px 8px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"4px",outline:"none",minWidth:"100px",flex:"1 1 140px"}}),k.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[k.jsxs("label",{style:{fontSize:"11px",color:E?"#8b5cf6":"#9ca3af",cursor:"pointer",display:"flex",alignItems:"center",gap:"3px",userSelect:"none"},children:[k.jsx("input",{type:"checkbox",checked:E,onChange:Y=>{B(Y.target.checked),Y.target.checked||ne("")},style:{margin:0}}),"Replace"]}),k.jsxs("label",{style:{fontSize:"11px",color:F?"#6366f1":"#9ca3af",cursor:"pointer",display:"flex",alignItems:"center",gap:"3px",userSelect:"none"},children:[k.jsx("input",{type:"checkbox",checked:F,onChange:Y=>R(Y.target.checked),style:{margin:0}}),"@Claude"]})]})]})}),k.jsx(fn,{label:"Flag",disabled:!T||be,onMouseDown:V}),k.jsx("div",{style:{flex:1}}),k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[(l??0)>0&&k.jsxs("span",{"data-testid":"held-badge",style:{padding:"1px 6px",fontSize:"10px",fontWeight:600,color:"#92400e",background:"#fef3c7",borderRadius:"9999px"},children:[l," held"]}),i&&s&&k.jsxs("div",{"data-testid":"mode-toggle",role:"group","aria-label":"Claude collaboration mode",style:{display:"flex",border:"1px solid #d1d5db",borderRadius:"4px",overflow:"hidden"},children:[k.jsxs("button",{"data-testid":"mode-solo-btn",title:"Write undisturbed — Claude only responds when you message","aria-pressed":i==="solo",onClick:()=>s("solo"),style:{padding:"3px 10px",fontSize:"12px",border:"none",cursor:"pointer",background:i==="solo"?"#6366f1":"transparent",color:i==="solo"?"#fff":"#6b7280",fontWeight:i==="solo"?600:400,borderRight:"1px solid #d1d5db",display:"flex",alignItems:"center",gap:"5px"},children:[i==="solo"&&k.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"#9ca3af",display:"inline-block"}}),"Solo"]}),k.jsxs("button",{"data-testid":"mode-tandem-btn",title:"Full collaboration — Claude reacts to selections and document changes","aria-pressed":i==="tandem",onClick:()=>s("tandem"),style:{padding:"3px 10px",fontSize:"12px",border:"none",cursor:"pointer",background:i==="tandem"?"#6366f1":"transparent",color:i==="tandem"?"#fff":"#6b7280",fontWeight:i==="tandem"?600:400,display:"flex",alignItems:"center",gap:"5px"},children:[i==="tandem"&&k.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"#22c55e",display:"inline-block"}}),"Tandem"]})]}),n&&k.jsx("button",{ref:r,"data-testid":"settings-btn",onClick:n,title:"Settings (Ctrl+,)","aria-label":"Settings","aria-keyshortcuts":"Control+Comma",style:{background:"none",border:"1px solid #d1d5db",borderRadius:"4px",cursor:"pointer",color:"#6b7280",fontSize:"13px",padding:"4px 12px",minHeight:"24px"},children:"Settings"})]})]})}function rP(){const[t,e]=O.useState(!1),n=O.useCallback(s=>{s.dataTransfer.types.includes("Files")&&(s.preventDefault(),e(!0))},[]),r=O.useCallback(s=>{(s.currentTarget===s.target||!s.currentTarget.contains(s.relatedTarget))&&e(!1)},[]),i=O.useCallback(async s=>{if(e(!1),!s.dataTransfer.files.length)return;s.preventDefault();const l=s.dataTransfer.files[0],c=await bM(l);try{const f=await fetch(`${Iu}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:l.name,content:c})});if(!f.ok){const d=await f.json().catch(()=>({message:"Upload failed"}));console.error("[useFileDrop] Upload failed:",f.status,d.message??d.error)}}catch{console.error("[useFileDrop] Server unreachable — file drop ignored")}},[]);return{fileDragOver:t,handleEditorDragOver:n,handleEditorDragLeave:r,handleEditorDrop:i}}function iP(t,e){return t.status!=="pending"||e==="tandem"?!0:t.author!=="claude"}function sP(t,e){return O.useMemo(()=>{const n=[];let r=0;for(const i of t)iP(i,e)?n.push(i):i.status==="pending"&&r++;return{visibleAnnotations:n,heldCount:r}},[t,e])}function oP(){const[t,e]=O.useState([]),n=O.useRef(new Map),r=O.useCallback((l,c)=>{const f=n.current.get(l);f&&clearTimeout(f);const d=SC[c]??SC.info,p=setTimeout(()=>{e(m=>m.filter(g=>g.id!==l)),n.current.delete(l)},d);n.current.set(l,p)},[]),i=O.useCallback(l=>{const c=n.current.get(l);c&&(clearTimeout(c),n.current.delete(l))},[]),s=O.useCallback(l=>{e(c=>c.filter(f=>f.id!==l)),i(l)},[i]);return O.useEffect(()=>{const l=`http://localhost:${Ga}/api/notify-stream`,c=new EventSource(l);return c.onmessage=f=>{let d;try{d=JSON.parse(f.data)}catch{console.warn("[useNotifications] Malformed SSE data:",f.data);return}e(p=>{if(d.dedupKey){const b=p.findIndex(S=>S.dedupKey===d.dedupKey);if(b!==-1){const S=p[b];i(S.id);const v={...d,count:S.count+1},C=[...p];return C[b]=v,r(v.id,v.severity),C}}const m={...d,count:1},g=[...p,m];for(;g.length>Uz;){const b=g.shift();i(b.id)}return r(m.id,m.severity),g})},c.onerror=()=>{c.readyState===EventSource.CLOSED&&console.warn("[useNotifications] EventSource permanently closed. Notifications will not be delivered. Is the server running?")},()=>{c.close();for(const f of n.current.values())clearTimeout(f);n.current.clear()}},[r,i]),{toasts:t,dismiss:s}}function lP(t){const[e,n]=O.useState(!1),[r,i]=O.useState(null),s=O.useRef(0),{pendingCount:l,acceptedCount:c,dismissedCount:f}=O.useMemo(()=>{let p=0,m=0,g=0;for(const b of t)b.status==="pending"?p++:b.status==="accepted"?m++:b.status==="dismissed"&&g++;return{pendingCount:p,acceptedCount:m,dismissedCount:g}},[t]);O.useEffect(()=>{const p=c+f;s.current>0&&l===0&&p>0&&(i({accepted:c,dismissed:f,total:p}),n(!0)),s.current=l},[l,c,f]);const d=O.useCallback(()=>{n(!1)},[]);return{pendingCount:l,showReviewSummary:e,reviewSummaryData:r,dismissReviewSummary:d}}function aP(t){const[e,n]=O.useState(!1),r=O.useRef(!1),i=O.useCallback(async()=>{if(!(!t||r.current)){r.current=!0,n(!0);try{const s=await fetch(`http://localhost:${Ga}/api/save`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:t})});if(!s.ok){const l=await s.json().catch(()=>({}));console.warn("[Tandem] Save failed:",l.message??s.statusText)}}catch(s){console.warn("[Tandem] Save request failed:",s)}finally{r.current=!1,n(!1)}}},[t]);return O.useEffect(()=>{const s=l=>{l.key==="s"&&(l.ctrlKey||l.metaKey)&&(l.preventDefault(),i())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[i]),{saving:e,triggerSave:i}}function cP(t){return t.isComposing||t.code!=="Comma"?!1:t.ctrlKey||t.metaKey}function uP(t){O.useEffect(()=>{const e=n=>{cP(n)&&(n.preventDefault(),t())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t])}function fP(t,e,n){if(t.length<2)return null;const s=(t.findIndex(l=>l.id===e)+(n?-1:1)+t.length)%t.length;return t[s].id}function dP(t,e,n){const r=O.useRef(t);r.current=t;const i=O.useRef(e);i.current=e,O.useEffect(()=>{const s=l=>{if(!l.ctrlKey&&!l.metaKey||l.key!=="Tab")return;const c=fP(r.current,i.current,l.shiftKey);c&&(l.preventDefault(),n(c))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n])}function aA(t,e){const n=new Set(e),r=t.filter(l=>n.has(l)),i=new Set(r),s=e.filter(l=>!i.has(l));return[...r,...s]}function hP(t,e,n,r,i="left"){const s=t.filter(m=>r.has(m)),l=s.indexOf(e),c=s.indexOf(n);if(l===-1||c===-1)return s;const f=[...s];f.splice(l,1);const d=f.indexOf(n),p=i==="right"?d+1:d;return f.splice(p,0,e),f}function pP(t){const[e,n]=O.useState([]),r=O.useMemo(()=>{const l=new Map(t.map(d=>[d.id,d])),c=t.map(d=>d.id);return aA(e,c).map(d=>l.get(d)).filter(Boolean)},[t,e]),i=O.useMemo(()=>t.map(l=>l.id),[t]);O.useEffect(()=>{n(l=>{const c=aA(l,i);return l.length===c.length&&l.every((f,d)=>f===c[d])?l:c})},[i]);const s=O.useCallback(function(c,f,d="left"){if(c===f)return;const p=new Set(i);n(m=>hP(m,c,f,p,d))},[i]);return{orderedTabs:r,reorder:s}}const mP={s:14,m:16,l:18};function cA(){try{return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}const nu={layout:"three-panel",primaryTab:"chat",panelOrder:"chat-editor-annotations",editorWidthPercent:50,selectionDwellMs:cM,showAuthorship:!1,reduceMotion:!1,textSize:"m",theme:"system"};function gP(){let t;try{t=localStorage.getItem(lM)}catch{t=null}if(t)try{const e=JSON.parse(t);return{layout:e.layout==="three-panel"||e.layout==="tabbed"?e.layout:nu.layout,primaryTab:e.primaryTab==="annotations"?"annotations":"chat",panelOrder:e.panelOrder==="annotations-editor-chat"?"annotations-editor-chat":"chat-editor-annotations",editorWidthPercent:Math.max(50,Math.min(100,Number(e.editorWidthPercent)||nu.editorWidthPercent)),selectionDwellMs:Math.max(zh,Math.min(Lh,Number(e.selectionDwellMs)||cM)),showAuthorship:e.showAuthorship===!0,reduceMotion:typeof e.reduceMotion=="boolean"?e.reduceMotion:cA(),textSize:e.textSize==="s"||e.textSize==="m"||e.textSize==="l"?e.textSize:nu.textSize,theme:e.theme==="light"||e.theme==="dark"||e.theme==="system"?e.theme:nu.theme}}catch(e){console.warn("[tandem] settings JSON is corrupt, resetting to defaults:",e)}return{...nu,reduceMotion:cA()}}function yP(t,e){const n={...t,...e};return{...n,editorWidthPercent:Math.max(50,Math.min(100,n.editorWidthPercent)),selectionDwellMs:Math.max(zh,Math.min(Lh,n.selectionDwellMs))}}function bP(){const[t,e]=O.useState(gP),n=O.useCallback(r=>{e(i=>{const s=yP(i,r);try{localStorage.setItem(lM,JSON.stringify(s)),localStorage.setItem(fM,String(s.showAuthorship))}catch{}return s})},[]);return{settings:t,updateSettings:n}}function s2(){try{return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}function xP(t){return t==="system"?s2():t}function SP(t){const e=document.documentElement;if(e.setAttribute("data-theme",xP(t)),t!=="system")return()=>e.removeAttribute("data-theme");const n=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>e.setAttribute("data-theme",s2());return n.addEventListener("change",r),()=>{n.removeEventListener("change",r),e.removeAttribute("data-theme")}}function wP(t){O.useEffect(()=>SP(t),[t])}function vP(){try{return localStorage.getItem(pM)==="true"}catch{return!1}}function uA(){try{localStorage.setItem(pM,"true")}catch{}}function kP(t,e,n){const[r,i]=O.useState(vP),[s,l]=O.useState(0),c=O.useRef(0),d=!r&&n==="welcome.md";O.useEffect(()=>{if(!d||s!==0)return;const b=t.filter(v=>v.id.startsWith(Hz));if(b.length===0)return;b.some(v=>v.status!=="pending")&&(c.current=Date.now(),l(1))},[d,s,t]),O.useEffect(()=>{if(!d||s!==1)return;t.some(S=>S.author==="user")&&(c.current=Date.now(),l(2))},[d,s,t]);const p=e.current;O.useEffect(()=>{if(!d||s!==2||!p)return;const b=()=>{Date.now()-c.current<2e3||p.isFocused&&(c.current=Date.now(),l(3))};return p.on("update",b),()=>{p.off("update",b)}},[d,s,p]),O.useEffect(()=>{if(!d||s!==3)return;const b=setTimeout(()=>{uA(),i(!0)},3e3);return()=>clearTimeout(b)},[d,s]);const m=O.useCallback(()=>{uA(),i(!0)},[]),g=O.useCallback(()=>{c.current=Date.now(),l(b=>Math.min(b+1,3))},[]);return{tutorialActive:d,currentStep:s,dismissTutorial:m,nextStep:g}}const CP="modulepreload",EP=function(t){return"/"+t},fA={},TP=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let l=function(d){return Promise.all(d.map(p=>Promise.resolve(p).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),f=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));i=l(n.map(d=>{if(d=EP(d),d in fA)return;fA[d]=!0;const p=d.endsWith(".css"),m=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const g=document.createElement("link");if(g.rel=p?"stylesheet":CP,p||(g.as="script"),g.crossOrigin="",g.href=d,f&&g.setAttribute("nonce",f),document.head.appendChild(g),p)return new Promise((b,S)=>{g.addEventListener("load",b),g.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return i.then(l=>{for(const c of l||[])c.status==="rejected"&&s(c.reason);return e().catch(s)})};function AP(){O.useEffect(()=>{let t=!1,e;return TP(async()=>{const{getCurrentWebview:n}=await import("./webview-0tvvWtyc.js");return{getCurrentWebview:n}},[]).then(({getCurrentWebview:n})=>{if(t)return;const r=n();let i=Xc;try{const d=localStorage.getItem(wC);if(d!==null){const p=Number(d);Number.isFinite(p)?i=Math.max(vC,Math.min(kC,p)):console.warn(`[tandem] ignoring invalid stored zoom: ${d}`)}}catch{}i!==Xc&&r.setZoom(i).catch(d=>{console.warn("[tandem] failed to restore zoom level:",d)});function s(d){try{localStorage.setItem(wC,String(d))}catch{}}const l=d=>{!(d.metaKey||d.ctrlKey)||d.key!=="0"||(d.preventDefault(),d.stopPropagation(),i=Xc,r.setZoom(Xc).catch(m=>{console.warn("[tandem] failed to reset zoom:",m)}),s(Xc))},c=.1,f=d=>{if(!(d.metaKey||d.ctrlKey))return;const m=d.key==="+"||d.key==="=",g=d.key==="-"||d.key==="_";if(!m&&!g)return;const b=m?i+c:i-c;i=Math.max(vC,Math.min(kC,Math.round(b*100)/100)),s(i)};window.addEventListener("keydown",l,{capture:!0}),window.addEventListener("keydown",f,{capture:!0}),e=()=>{window.removeEventListener("keydown",l,{capture:!0}),window.removeEventListener("keydown",f,{capture:!0})}}).catch(()=>{}),()=>{t=!0,e==null||e()}},[])}const MP=Math.floor,OP=(t,e)=>t<e?t:e,_P=(t,e)=>t>e?t:e,o2=128,Dh=127,DP=Number.MAX_SAFE_INTEGER,RP=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.codePointAt(i);return r},ff=typeof TextEncoder<"u"?new TextEncoder:null,NP=t=>ff.encode(t),zP=ff?NP:RP;let Tu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Tu&&Tu.decode(new Uint8Array).length===1&&(Tu=null);const qp=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},Am=(t,e)=>{for(;e>Dh;)qp(t,o2|Dh&e),e=MP(e/128);qp(t,Dh&e)},dx=new Uint8Array(3e4),LP=dx.length/3,jP=(t,e)=>{if(e.length<LP){const n=ff.encodeInto(e,dx).written||0;Am(t,n);for(let r=0;r<n;r++)qp(t,dx[r])}else HP(t,zP(e))},IP=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;Am(t,r);for(let i=0;i<r;i++)qp(t,n.codePointAt(i))},BP=ff&&ff.encodeInto?jP:IP,UP=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=OP(n-r,e.length),s=e.length-i;t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,s>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(_P(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},HP=(t,e)=>{Am(t,e.byteLength),UP(t,e)},l2=t=>new Error(t),VP=l2("Unexpected end of array"),PP=l2("Integer out of Range"),$P=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},FP=t=>$P(t,W1(t)),dA=t=>t.arr[t.pos++],W1=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const i=t.arr[t.pos++];if(e=e+(i&Dh)*n,n*=128,i<o2)return e;if(e>DP)throw PP}throw VP},qP=t=>{let e=W1(t);if(e===0)return"";{let n=String.fromCodePoint(dA(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(dA(t));else for(;e>0;){const r=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(n))}},YP=t=>Tu.decode(FP(t)),hA=Tu?YP:qP;var Oa;(function(t){t[t.Token=0]="Token",t[t.PermissionDenied=1]="PermissionDenied",t[t.Authenticated=2]="Authenticated"})(Oa||(Oa={}));const KP=(t,e)=>{Am(t,Oa.Token),BP(t,e)},WP=(t,e,n,r)=>{switch(W1(t)){case Oa.Token:{e();break}case Oa.PermissionDenied:{n(hA(t));break}case Oa.Authenticated:{r(hA(t));break}}},pA=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n}));var hx;(function(t){t[t.Connecting=0]="Connecting",t[t.Open=1]="Open",t[t.Closing=2]="Closing",t[t.Closed=3]="Closed"})(hx||(hx={}));function GP(t){return t||(t={}),{delay:t.delay===void 0?200:t.delay,initialDelay:t.initialDelay===void 0?0:t.initialDelay,minDelay:t.minDelay===void 0?0:t.minDelay,maxDelay:t.maxDelay===void 0?0:t.maxDelay,factor:t.factor===void 0?0:t.factor,maxAttempts:t.maxAttempts===void 0?3:t.maxAttempts,timeout:t.timeout===void 0?0:t.timeout,jitter:t.jitter===!0,initialJitter:t.initialJitter===!0,handleError:t.handleError===void 0?null:t.handleError,handleTimeout:t.handleTimeout===void 0?null:t.handleTimeout,beforeAttempt:t.beforeAttempt===void 0?null:t.beforeAttempt,calculateDelay:t.calculateDelay===void 0?null:t.calculateDelay}}async function H0(t){return new Promise(e=>setTimeout(e,t))}function ZP(t,e){let n=e.delay;if(n===0)return 0;if(e.factor&&(n*=Math.pow(e.factor,t.attemptNum-1),e.maxDelay!==0&&(n=Math.min(n,e.maxDelay))),e.jitter){const r=Math.ceil(e.minDelay),i=Math.floor(n);n=Math.floor(Math.random()*(i-r+1))+r}return Math.round(n)}async function JP(t,e){const n=GP(e);for(const c of["delay","initialDelay","minDelay","maxDelay","maxAttempts","timeout"]){const f=n[c];if(!Number.isInteger(f)||f<0)throw new Error(`Value for ${c} must be an integer greater than or equal to 0`)}if(n.factor.constructor!==Number||n.factor<0)throw new Error("Value for factor must be a number greater than or equal to 0");if(n.delay<n.minDelay)throw new Error(`delay cannot be less than minDelay (delay: ${n.delay}, minDelay: ${n.minDelay}`);const r={attemptNum:0,attemptsRemaining:n.maxAttempts?n.maxAttempts:-1,aborted:!1,abort(){r.aborted=!0}},i=n.calculateDelay||ZP;async function s(){if(n.beforeAttempt&&n.beforeAttempt(r,n),r.aborted){const f=new Error("Attempt aborted");throw f.code="ATTEMPT_ABORTED",f}const c=async f=>{if(n.handleError&&await n.handleError(f,r,n),r.aborted||r.attemptsRemaining===0)throw f;r.attemptNum++;const d=i(r,n);return d&&await H0(d),s()};return r.attemptsRemaining>0&&r.attemptsRemaining--,n.timeout?new Promise((f,d)=>{const p=setTimeout(()=>{if(n.handleTimeout)try{f(n.handleTimeout(r,n))}catch(m){d(m)}else{const m=new Error(`Retry timeout (attemptNum: ${r.attemptNum}, timeout: ${n.timeout})`);m.code="ATTEMPT_TIMEOUT",d(m)}},n.timeout);t(r,n).then(m=>{clearTimeout(p),f(m)}).catch(m=>{clearTimeout(p),c(m).then(f).catch(d)})}):t(r,n).catch(c)}const l=n.calculateDelay?n.calculateDelay(r,n):n.initialDelay;if(l&&await H0(l),r.attemptNum<1&&n.initialJitter){const c=i(r,n);c&&await H0(c)}return s()}const a2=Math.floor,XP=(t,e)=>t<e?t:e,QP=(t,e)=>t>e?t:e,e7=64,Yp=128,t7=63,Au=127,c2=Number.MAX_SAFE_INTEGER,n7=()=>new Set,r7=Array.from,i7=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.codePointAt(i);return r},df=typeof TextEncoder<"u"?new TextEncoder:null,s7=t=>df.encode(t),o7=df?s7:i7;let Mu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Mu&&Mu.decode(new Uint8Array).length===1&&(Mu=null);class l7{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const G1=()=>new l7,u2=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},Z1=t=>{const e=new Uint8Array(u2(t));let n=0;for(let r=0;r<t.bufs.length;r++){const i=t.bufs[r];e.set(i,n),n+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},Kp=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},Bn=(t,e)=>{for(;e>Au;)Kp(t,Yp|Au&e),e=a2(e/128);Kp(t,Au&e)},px=new Uint8Array(3e4),a7=px.length/3,c7=(t,e)=>{if(e.length<a7){const n=df.encodeInto(e,px).written||0;Bn(t,n);for(let r=0;r<n;r++)Kp(t,px[r])}else ic(t,o7(e))},u7=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;Bn(t,r);for(let i=0;i<r;i++)Kp(t,n.codePointAt(i))},ms=df&&df.encodeInto?c7:u7,f7=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=XP(n-r,e.length),s=e.length-i;t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,s>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(QP(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},ic=(t,e)=>{Bn(t,e.byteLength),f7(t,e)},f2=t=>new Error(t),d2=f2("Unexpected end of array"),h2=f2("Integer out of Range");class d7{constructor(e){this.arr=e,this.pos=0}}const p2=t=>new d7(t),h7=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},Mm=t=>h7(t,rl(t)),mA=t=>t.arr[t.pos++],rl=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const i=t.arr[t.pos++];if(e=e+(i&Au)*n,n*=128,i<Yp)return e;if(e>c2)throw h2}throw d2},p7=t=>{let e=t.arr[t.pos++],n=e&t7,r=64;const i=(e&e7)>0?-1:1;if((e&Yp)===0)return i*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&Au)*r,r*=128,e<Yp)return i*n;if(n>c2)throw h2}throw d2},m7=t=>{let e=rl(t);if(e===0)return"";{let n=String.fromCodePoint(mA(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(mA(t));else for(;e>0;){const r=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(n))}},g7=t=>Mu.decode(Mm(t)),hf=Mu?g7:m7,y7=t=>{const e=t.pos,n=hf(t);return t.pos=e,n},Wa=Date.now,V0=()=>new Map,b7=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r};class x7{constructor(){this._observers=V0()}on(e,n){b7(this._observers,e,n7).add(n)}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return r7((this._observers.get(e)||V0()).values()).forEach(r=>r(...n))}destroy(){this._observers=V0()}}const S7=Object.keys,gA=t=>S7(t).length,w7=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),v7=(t,e)=>t===e,Ou=(t,e)=>{if(t==null||e==null)return v7(t,e);if(t.constructor!==e.constructor)return!1;if(t===e)return!0;switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!Ou(t.get(n),e.get(n)))return!1;break}case Object:if(gA(t)!==gA(e))return!1;for(const n in t)if(!w7(t,n)||!Ou(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Ou(t[n],e[n]))return!1;break;default:return!1}return!0},P0=3e4;class k7 extends x7{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=Wa();this.getLocalState()!==null&&P0/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((i,s)=>{s!==this.clientID&&P0<=n-i.lastUpdated&&this.states.has(s)&&r.push(s)}),r.length>0&&Rh(this,r,"timeout")},a2(P0/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const n=this.clientID,r=this.meta.get(n),i=r===void 0?0:r.clock+1,s=this.states.get(n);e===null?this.states.delete(n):this.states.set(n,e),this.meta.set(n,{clock:i,lastUpdated:Wa()});const l=[],c=[],f=[],d=[];e===null?d.push(n):s==null?e!=null&&l.push(n):(c.push(n),Ou(s,e)||f.push(n)),(l.length>0||f.length>0||d.length>0)&&this.emit("change",[{added:l,updated:f,removed:d},"local"]),this.emit("update",[{added:l,updated:c,removed:d},"local"])}setLocalStateField(e,n){const r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:n})}getStates(){return this.states}}const Rh=(t,e,n)=>{const r=[];for(let i=0;i<e.length;i++){const s=e[i];if(t.states.has(s)){if(t.states.delete(s),s===t.clientID){const l=t.meta.get(s);t.meta.set(s,{clock:l.clock+1,lastUpdated:Wa()})}r.push(s)}}r.length>0&&(t.emit("change",[{added:[],updated:[],removed:r},n]),t.emit("update",[{added:[],updated:[],removed:r},n]))},mx=(t,e,n=t.states)=>{const r=e.length,i=G1();Bn(i,r);for(let s=0;s<r;s++){const l=e[s],c=n.get(l)||null,f=t.meta.get(l).clock;Bn(i,l),Bn(i,f),ms(i,JSON.stringify(c))}return Z1(i)},C7=(t,e,n)=>{const r=p2(e),i=Wa(),s=[],l=[],c=[],f=[],d=rl(r);for(let p=0;p<d;p++){const m=rl(r);let g=rl(r);const b=JSON.parse(hf(r)),S=t.meta.get(m),v=t.states.get(m),C=S===void 0?0:S.clock;(C<g||C===g&&b===null&&t.states.has(m))&&(b===null?m===t.clientID&&t.getLocalState()!=null?g++:t.states.delete(m):t.states.set(m,b),t.meta.set(m,{clock:g,lastUpdated:i}),S===void 0&&b!==null?s.push(m):S!==void 0&&b===null?f.push(m):b!==null&&(Ou(b,v)||c.push(m),l.push(m)))}(s.length>0||c.length>0||f.length>0)&&t.emit("change",[{added:s,updated:c,removed:f},n]),(s.length>0||l.length>0||f.length>0)&&t.emit("update",[{added:s,updated:l,removed:f},n])};class m2{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}removeAllListeners(){this.callbacks={}}}class gx{constructor(e){this.data=e,this.encoder=G1(),this.decoder=p2(new Uint8Array(this.data))}peekVarString(){return y7(this.decoder)}readVarUint(){return rl(this.decoder)}readVarString(){return hf(this.decoder)}readVarUint8Array(){return Mm(this.decoder)}writeVarUint(e){return Bn(this.encoder,e)}writeVarString(e){return ms(this.encoder,e)}writeVarUint8Array(e){return ic(this.encoder,e)}length(){return u2(this.encoder)}}var _n;(function(t){t[t.Sync=0]="Sync",t[t.Awareness=1]="Awareness",t[t.Auth=2]="Auth",t[t.QueryAwareness=3]="QueryAwareness",t[t.Stateless=5]="Stateless",t[t.CLOSE=7]="CLOSE",t[t.SyncStatus=8]="SyncStatus"})(_n||(_n={}));var qn;(function(t){t.Connecting="connecting",t.Connected="connected",t.Disconnected="disconnected"})(qn||(qn={}));class xl{constructor(){this.encoder=G1()}get(e){return e.encoder}toUint8Array(){return Z1(this.encoder)}}class E7 extends xl{constructor(){super(...arguments),this.type=_n.CLOSE,this.description="Ask the server to close the connection"}get(e){return ms(this.encoder,e.documentName),Bn(this.encoder,this.type),this.encoder}}class T7 extends m2{constructor(e){super(),this.messageQueue=[],this.configuration={url:"",autoConnect:!0,preserveTrailingSlash:!1,document:void 0,WebSocketPolyfill:void 0,messageReconnectTimeout:3e4,delay:1e3,initialDelay:0,factor:2,maxAttempts:0,minDelay:1e3,maxDelay:3e4,jitter:!0,timeout:0,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,handleTimeout:null,providerMap:new Map},this.webSocket=null,this.webSocketHandlers={},this.shouldConnect=!0,this.status=qn.Disconnected,this.lastMessageReceived=0,this.identifier=0,this.intervals={connectionChecker:null},this.connectionAttempt=null,this.receivedOnOpenPayload=void 0,this.closeTries=0,this.setConfiguration(e),this.configuration.WebSocketPolyfill=e.WebSocketPolyfill?e.WebSocketPolyfill:WebSocket,this.on("open",this.configuration.onOpen),this.on("open",this.onOpen.bind(this)),this.on("connect",this.configuration.onConnect),this.on("message",this.configuration.onMessage),this.on("outgoingMessage",this.configuration.onOutgoingMessage),this.on("status",this.configuration.onStatus),this.on("disconnect",this.configuration.onDisconnect),this.on("close",this.configuration.onClose),this.on("destroy",this.configuration.onDestroy),this.on("awarenessUpdate",this.configuration.onAwarenessUpdate),this.on("awarenessChange",this.configuration.onAwarenessChange),this.on("close",this.onClose.bind(this)),this.on("message",this.onMessage.bind(this)),this.intervals.connectionChecker=setInterval(this.checkConnection.bind(this),this.configuration.messageReconnectTimeout/10),this.shouldConnect&&this.connect()}async onOpen(e){this.status=qn.Connected,this.emit("status",{status:qn.Connected}),this.cancelWebsocketRetry=void 0,this.receivedOnOpenPayload=e}attach(e){this.configuration.providerMap.set(e.configuration.name,e),this.status===qn.Disconnected&&this.shouldConnect&&this.connect(),this.receivedOnOpenPayload&&this.status===qn.Connected&&e.onOpen(this.receivedOnOpenPayload)}detach(e){this.configuration.providerMap.has(e.configuration.name)&&(e.send(E7,{documentName:e.configuration.name}),this.configuration.providerMap.delete(e.configuration.name))}setConfiguration(e={}){this.configuration={...this.configuration,...e},this.configuration.autoConnect||(this.shouldConnect=!1)}async connect(){if(this.status===qn.Connected)return;this.cancelWebsocketRetry&&(this.cancelWebsocketRetry(),this.cancelWebsocketRetry=void 0),this.receivedOnOpenPayload=void 0,this.shouldConnect=!0;const e=()=>{let i=!1;return{retryPromise:JP(this.createWebSocketConnection.bind(this),{delay:this.configuration.delay,initialDelay:this.configuration.initialDelay,factor:this.configuration.factor,maxAttempts:this.configuration.maxAttempts,minDelay:this.configuration.minDelay,maxDelay:this.configuration.maxDelay,jitter:this.configuration.jitter,timeout:this.configuration.timeout,handleTimeout:this.configuration.handleTimeout,beforeAttempt:l=>{(!this.shouldConnect||i)&&l.abort()}}).catch(l=>{if(l&&l.code!=="ATTEMPT_ABORTED")throw l}),cancelFunc:()=>{i=!0}}},{retryPromise:n,cancelFunc:r}=e();return this.cancelWebsocketRetry=r,n}attachWebSocketListeners(e,n){const{identifier:r}=e,i=d=>this.emit("message",d),s=d=>this.emit("close",{event:d}),l=d=>this.emit("open",d),c=d=>{n(d)};this.webSocketHandlers[r]={message:i,close:s,open:l,error:c};const f=this.webSocketHandlers[e.identifier];Object.keys(f).forEach(d=>{e.addEventListener(d,f[d])})}cleanupWebSocket(){if(!this.webSocket)return;const{identifier:e}=this.webSocket,n=this.webSocketHandlers[e];Object.keys(n).forEach(r=>{var i;(i=this.webSocket)===null||i===void 0||i.removeEventListener(r,n[r]),delete this.webSocketHandlers[e]}),this.webSocket.close(),this.webSocket=null}createWebSocketConnection(){return new Promise((e,n)=>{this.webSocket&&(this.messageQueue=[],this.cleanupWebSocket()),this.lastMessageReceived=0,this.identifier+=1;const r=new this.configuration.WebSocketPolyfill(this.url);r.binaryType="arraybuffer",r.identifier=this.identifier,this.attachWebSocketListeners(r,n),this.webSocket=r,this.status=qn.Connecting,this.emit("status",{status:qn.Connecting}),this.connectionAttempt={resolve:e,reject:n}})}onMessage(e){var n;this.resolveConnectionAttempt(),this.lastMessageReceived=Wa();const i=new gx(e.data).peekVarString();(n=this.configuration.providerMap.get(i))===null||n===void 0||n.onMessage(e)}resolveConnectionAttempt(){this.connectionAttempt&&(this.connectionAttempt.resolve(),this.connectionAttempt=null,this.status=qn.Connected,this.emit("status",{status:qn.Connected}),this.emit("connect"),this.messageQueue.forEach(e=>this.send(e)),this.messageQueue=[])}stopConnectionAttempt(){this.connectionAttempt=null}rejectConnectionAttempt(){var e;(e=this.connectionAttempt)===null||e===void 0||e.reject(),this.connectionAttempt=null}checkConnection(){var e;this.status===qn.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=Wa()-this.lastMessageReceived||(this.closeTries+=1,this.closeTries>2?(this.onClose({event:{code:4408,reason:"forced"}}),this.closeTries=0):((e=this.webSocket)===null||e===void 0||e.close(),this.messageQueue=[])))}get serverUrl(){if(this.configuration.preserveTrailingSlash)return this.configuration.url;let e=this.configuration.url;for(;e[e.length-1]==="/";)e=e.slice(0,e.length-1);return e}get url(){return this.serverUrl}disconnect(){if(this.shouldConnect=!1,this.webSocket!==null)try{this.webSocket.close(),this.messageQueue=[]}catch(e){console.error(e)}}send(e){var n;((n=this.webSocket)===null||n===void 0?void 0:n.readyState)===hx.Open?this.webSocket.send(e):this.messageQueue.push(e)}onClose({event:e}){this.closeTries=0,this.cleanupWebSocket(),this.connectionAttempt&&this.rejectConnectionAttempt(),this.status=qn.Disconnected,this.emit("status",{status:qn.Disconnected}),this.emit("disconnect",{event:e}),!this.cancelWebsocketRetry&&this.shouldConnect&&setTimeout(()=>{this.connect()},this.configuration.delay)}destroy(){this.emit("destroy"),clearInterval(this.intervals.connectionChecker),this.stopConnectionAttempt(),this.disconnect(),this.removeAllListeners(),this.cleanupWebSocket()}}const g2=0,J1=1,y2=2,A7=(t,e)=>{Bn(t,g2);const n=HB(e);ic(t,n)},M7=(t,e,n)=>{Bn(t,J1),ic(t,jB(e,n))},O7=(t,e,n)=>M7(e,n,Mm(t)),b2=(t,e,n)=>{try{NB(e,Mm(t),n)}catch(r){console.error("Caught error while handling a Yjs update",r)}},_7=(t,e)=>{Bn(t,y2),ic(t,e)},D7=b2,R7=(t,e,n,r)=>{const i=rl(t);switch(i){case g2:O7(t,e,n);break;case J1:b2(t,n,r);break;case y2:D7(t,n,r);break;default:throw new Error("Unknown message type")}return i};class N7{constructor(e){this.message=e}apply(e,n){const{message:r}=this,i=r.readVarUint(),s=r.length();switch(i){case _n.Sync:this.applySyncMessage(e,n);break;case _n.Awareness:this.applyAwarenessMessage(e);break;case _n.Auth:this.applyAuthMessage(e);break;case _n.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case _n.Stateless:e.receiveStateless(hf(r.decoder));break;case _n.SyncStatus:this.applySyncStatusMessage(e,p7(r.decoder)===1);break;case _n.CLOSE:const l={code:1e3,reason:hf(r.decoder),target:e.configuration.websocketProvider.webSocket,type:"close"};e.onClose(),e.configuration.onClose({event:l}),e.forwardClose({event:l});break;default:throw new Error(`Can’t apply message of unknown type: ${i}`)}r.length()>s+1&&e.send(xl,{encoder:r.encoder})}applySyncMessage(e,n){const{message:r}=this;r.writeVarUint(_n.Sync);const i=R7(r.decoder,r.encoder,e.document,e);n&&i===J1&&(e.synced=!0)}applySyncStatusMessage(e,n){n&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;const{message:n}=this;C7(e.awareness,n.readVarUint8Array(),e)}applyAuthMessage(e){const{message:n}=this;WP(n.decoder,e.sendToken.bind(e),e.permissionDeniedHandler.bind(e),e.authenticatedHandler.bind(e))}applyQueryAwarenessMessage(e){if(!e.awareness)return;const{message:n}=this;n.writeVarUint(_n.Awareness),n.writeVarUint8Array(mx(e.awareness,Array.from(e.awareness.getStates().keys())))}}class z7{constructor(e,n={}){this.message=new e,this.encoder=this.message.get(n)}create(){return Z1(this.encoder)}send(e){e==null||e.send(this.create())}}class L7 extends xl{constructor(){super(...arguments),this.type=_n.Auth,this.description="Authentication"}get(e){if(typeof e.token>"u")throw new Error("The authentication message requires `token` as an argument.");return ms(this.encoder,e.documentName),Bn(this.encoder,this.type),KP(this.encoder,e.token),this.encoder}}class yA extends xl{constructor(){super(...arguments),this.type=_n.Awareness,this.description="Awareness states update"}get(e){if(typeof e.awareness>"u")throw new Error("The awareness message requires awareness as an argument");if(typeof e.clients>"u")throw new Error("The awareness message requires clients as an argument");ms(this.encoder,e.documentName),Bn(this.encoder,this.type);let n;return e.states===void 0?n=mx(e.awareness,e.clients):n=mx(e.awareness,e.clients,e.states),ic(this.encoder,n),this.encoder}}class j7 extends xl{constructor(){super(...arguments),this.type=_n.Stateless,this.description="A stateless message"}get(e){var n;return ms(this.encoder,e.documentName),Bn(this.encoder,this.type),ms(this.encoder,(n=e.payload)!==null&&n!==void 0?n:""),this.encoder}}class bA extends xl{constructor(){super(...arguments),this.type=_n.Sync,this.description="First sync step"}get(e){if(typeof e.document>"u")throw new Error("The sync step one message requires document as an argument");return ms(this.encoder,e.documentName),Bn(this.encoder,this.type),A7(this.encoder,e.document),this.encoder}}class I7 extends xl{constructor(){super(...arguments),this.type=_n.Sync,this.description="A document update"}get(e){return ms(this.encoder,e.documentName),Bn(this.encoder,this.type),_7(this.encoder,e.update),this.encoder}}class B7 extends Error{constructor(){super(...arguments),this.code=1001}}class xA extends m2{constructor(e){var n,r,i;super(),this.configuration={name:"",document:void 0,awareness:void 0,token:null,forceSyncInterval:!1,onAuthenticated:()=>null,onAuthenticationFailed:()=>null,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onSynced:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,onStateless:()=>null,onUnsyncedChanges:()=>null},this.isSynced=!1,this.unsyncedChanges=0,this.isAuthenticated=!1,this.authorizedScope=void 0,this.manageSocket=!1,this._isAttached=!1,this.intervals={forceSync:null},this.boundDocumentUpdateHandler=this.documentUpdateHandler.bind(this),this.boundAwarenessUpdateHandler=this.awarenessUpdateHandler.bind(this),this.boundPageHide=this.pageHide.bind(this),this.boundOnOpen=this.onOpen.bind(this),this.boundOnClose=this.onClose.bind(this),this.forwardConnect=()=>this.emit("connect"),this.forwardStatus=s=>this.emit("status",s),this.forwardClose=s=>this.emit("close",s),this.forwardDisconnect=s=>this.emit("disconnect",s),this.forwardDestroy=()=>this.emit("destroy"),this.setConfiguration(e),this.configuration.document=e.document?e.document:new Di,this.configuration.awareness=e.awareness!==void 0?e.awareness:new k7(this.document),this.on("open",this.configuration.onOpen),this.on("message",this.configuration.onMessage),this.on("outgoingMessage",this.configuration.onOutgoingMessage),this.on("synced",this.configuration.onSynced),this.on("destroy",this.configuration.onDestroy),this.on("awarenessUpdate",this.configuration.onAwarenessUpdate),this.on("awarenessChange",this.configuration.onAwarenessChange),this.on("stateless",this.configuration.onStateless),this.on("unsyncedChanges",this.configuration.onUnsyncedChanges),this.on("authenticated",this.configuration.onAuthenticated),this.on("authenticationFailed",this.configuration.onAuthenticationFailed),(n=this.awareness)===null||n===void 0||n.on("update",()=>{this.emit("awarenessUpdate",{states:pA(this.awareness.getStates())})}),(r=this.awareness)===null||r===void 0||r.on("change",()=>{this.emit("awarenessChange",{states:pA(this.awareness.getStates())})}),this.document.on("update",this.boundDocumentUpdateHandler),(i=this.awareness)===null||i===void 0||i.on("update",this.boundAwarenessUpdateHandler),this.registerEventListeners(),this.configuration.forceSyncInterval&&typeof this.configuration.forceSyncInterval=="number"&&(this.intervals.forceSync=setInterval(this.forceSync.bind(this),this.configuration.forceSyncInterval)),this.manageSocket&&this.attach()}setConfiguration(e={}){e.websocketProvider||(this.manageSocket=!0,this.configuration.websocketProvider=new T7(e)),this.configuration={...this.configuration,...e}}get document(){return this.configuration.document}get isAttached(){return this._isAttached}get awareness(){return this.configuration.awareness}get hasUnsyncedChanges(){return this.unsyncedChanges>0}resetUnsyncedChanges(){this.unsyncedChanges=1,this.emit("unsyncedChanges",{number:this.unsyncedChanges})}incrementUnsyncedChanges(){this.unsyncedChanges+=1,this.emit("unsyncedChanges",{number:this.unsyncedChanges})}decrementUnsyncedChanges(){this.unsyncedChanges>0&&(this.unsyncedChanges-=1),this.unsyncedChanges===0&&(this.synced=!0),this.emit("unsyncedChanges",{number:this.unsyncedChanges})}forceSync(){this.resetUnsyncedChanges(),this.send(bA,{document:this.document,documentName:this.configuration.name})}pageHide(){this.awareness&&Rh(this.awareness,[this.document.clientID],"page hide")}registerEventListeners(){typeof window>"u"||!("addEventListener"in window)||window.addEventListener("pagehide",this.boundPageHide)}sendStateless(e){this.send(j7,{documentName:this.configuration.name,payload:e})}async sendToken(){let e;try{e=await this.getToken()}catch(n){this.permissionDeniedHandler(`Failed to get token during sendToken(): ${n}`);return}this.send(L7,{token:e??"",documentName:this.configuration.name})}documentUpdateHandler(e,n){n!==this&&(this.incrementUnsyncedChanges(),this.send(I7,{update:e,documentName:this.configuration.name}))}awarenessUpdateHandler({added:e,updated:n,removed:r},i){const s=e.concat(n).concat(r);this.send(yA,{awareness:this.awareness,clients:s,documentName:this.configuration.name})}get synced(){return this.isSynced}set synced(e){this.isSynced!==e&&(this.isSynced=e,e&&this.emit("synced",{state:e}))}receiveStateless(e){this.emit("stateless",{payload:e})}async connect(){if(this.manageSocket)return this.configuration.websocketProvider.connect();console.warn("HocuspocusProvider::connect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.")}disconnect(){if(this.manageSocket)return this.configuration.websocketProvider.disconnect();console.warn("HocuspocusProvider::disconnect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.")}async onOpen(e){this.isAuthenticated=!1,this.emit("open",{event:e}),await this.sendToken(),this.startSync()}async getToken(){return typeof this.configuration.token=="function"?await this.configuration.token():this.configuration.token}startSync(){this.resetUnsyncedChanges(),this.send(bA,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(yA,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.configuration.name})}send(e,n){if(!this._isAttached)return;const r=new z7(e,n);this.emit("outgoingMessage",{message:r.message}),r.send(this.configuration.websocketProvider)}onMessage(e){const n=new gx(e.data),r=n.readVarString();n.writeVarString(r),this.emit("message",{event:e,message:new gx(e.data)}),new N7(n).apply(this,!0)}onClose(){this.isAuthenticated=!1,this.synced=!1,this.awareness&&Rh(this.awareness,Array.from(this.awareness.getStates().keys()).filter(e=>e!==this.document.clientID),this)}destroy(){this.emit("destroy"),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),this.awareness&&(Rh(this.awareness,[this.document.clientID],"provider destroy"),this.awareness.off("update",this.boundAwarenessUpdateHandler),this.awareness.destroy()),this.document.off("update",this.boundDocumentUpdateHandler),this.removeAllListeners(),this.detach(),this.manageSocket&&this.configuration.websocketProvider.destroy(),!(typeof window>"u"||!("removeEventListener"in window))&&window.removeEventListener("pagehide",this.boundPageHide)}detach(){this.configuration.websocketProvider.off("connect",this.configuration.onConnect),this.configuration.websocketProvider.off("connect",this.forwardConnect),this.configuration.websocketProvider.off("status",this.forwardStatus),this.configuration.websocketProvider.off("status",this.configuration.onStatus),this.configuration.websocketProvider.off("open",this.boundOnOpen),this.configuration.websocketProvider.off("close",this.boundOnClose),this.configuration.websocketProvider.off("close",this.configuration.onClose),this.configuration.websocketProvider.off("close",this.forwardClose),this.configuration.websocketProvider.off("disconnect",this.configuration.onDisconnect),this.configuration.websocketProvider.off("disconnect",this.forwardDisconnect),this.configuration.websocketProvider.off("destroy",this.configuration.onDestroy),this.configuration.websocketProvider.off("destroy",this.forwardDestroy),this.configuration.websocketProvider.detach(this),this._isAttached=!1}attach(){this._isAttached||(this.configuration.websocketProvider.on("connect",this.configuration.onConnect),this.configuration.websocketProvider.on("connect",this.forwardConnect),this.configuration.websocketProvider.on("status",this.configuration.onStatus),this.configuration.websocketProvider.on("status",this.forwardStatus),this.configuration.websocketProvider.on("open",this.boundOnOpen),this.configuration.websocketProvider.on("close",this.boundOnClose),this.configuration.websocketProvider.on("close",this.configuration.onClose),this.configuration.websocketProvider.on("close",this.forwardClose),this.configuration.websocketProvider.on("disconnect",this.configuration.onDisconnect),this.configuration.websocketProvider.on("disconnect",this.forwardDisconnect),this.configuration.websocketProvider.on("destroy",this.configuration.onDestroy),this.configuration.websocketProvider.on("destroy",this.forwardDestroy),this.configuration.websocketProvider.attach(this),this._isAttached=!0)}permissionDeniedHandler(e){this.emit("authenticationFailed",{reason:e}),this.isAuthenticated=!1}authenticatedHandler(e){this.isAuthenticated=!0,this.authorizedScope=e,this.emit("authenticated",{scope:e})}setAwarenessField(e,n){if(!this.awareness)throw new B7(`Cannot set awareness field "${e}" to ${JSON.stringify(n)}. You have disabled Awareness for this provider by explicitly passing awareness: null in the provider configuration.`);this.awareness.setLocalStateField(e,n)}}function U7(t,e,n){return t.filter(r=>!e.has(r.id)&&!n.has(r.id))}function H7(){var M;const[t,e]=O.useState([]),[n,r]=O.useState(null),[i,s]=O.useState(!1),[l,c]=O.useState("connecting"),[f,d]=O.useState(0),[p,m]=O.useState(null),[g,b]=O.useState([]),[S,v]=O.useState(null),[C,E]=O.useState(!1),[B,I]=O.useState(!1),[ne,F]=O.useState(!1),[R,N]=O.useState(!1),Z=O.useRef(null),j=O.useRef(!1),ie=O.useRef(null),re=O.useRef(null),se=O.useRef([]);se.current=t;const be=O.useRef(new Set),ue=O.useRef(new Map);for(const _ of t)be.current.delete(_.id),ue.current.delete(_.id);const H=O.useRef(new Map),L=O.useRef(new Map),G=O.useRef(void 0),me=O.useCallback(_=>{const{ydoc:V}=_,T=V.getMap(xa),Y=()=>{const ze=[];T.forEach(Lt=>{ze.push(Eu(Lt))}),b(ze)};T.observe(Y),Y();const fe=V.getMap(uM);let oe=null,Ne=!1;const Fe=()=>{const ze=fe.get("claude"),Lt=(ze==null?void 0:ze.status)??null,Rt=(ze==null?void 0:ze.active)??!1;Lt!==oe&&(oe=Lt,v(Lt)),Rt!==Ne&&(Ne=Rt,E(Rt))};fe.observe(Fe),Fe();const Ue=V.getMap(gh);let mt=!1;const _e=()=>{const ze=Ue.get("readOnly")===!0;ze!==mt&&(mt=ze,I(ze))};return Ue.observe(_e),_e(),()=>{T.unobserve(Y),fe.unobserve(Fe),Ue.unobserve(_e)}},[]);G.current=(_,V)=>{var Ue,mt;const T=se.current,Y=new Set(T.map(_e=>_e.id)),fe=new Set(_.map(_e=>_e.id));for(const[_e,ze]of ue.current)fe.has(_e)||((Ue=L.current.get(_e))==null||Ue(),L.current.delete(_e),ze.provider.destroy(),ze.ydoc.destroy(),ue.current.delete(_e),be.current.delete(_e));const oe=U7(_,Y,be.current),Ne=[];for(const _e of oe){be.current.add(_e.id);const ze=new Di,Lt=new xA({url:`ws://localhost:${mC}`,name:_e.id,document:ze});ue.current.set(_e.id,{ydoc:ze,provider:Lt});const Rt=ze.getMap(gh),Nt=()=>{var dr;const wn=Rt.get("openDocuments"),ei=Rt.get("activeDocumentId");wn&&((dr=G.current)==null||dr.call(G,wn,ei??null))};Rt.observe(Nt),L.current.set(_e.id,()=>Rt.unobserve(Nt)),Ne.push({..._e,ydoc:ze,provider:Lt})}const Fe=T.filter(_e=>!fe.has(_e.id));for(const _e of Fe){const ze=H.current.get(_e.id);ze&&(ze.cleanup(),H.current.delete(_e.id)),(mt=L.current.get(_e.id))==null||mt(),L.current.delete(_e.id),be.current.delete(_e.id),ue.current.delete(_e.id),_e.provider.destroy(),_e.ydoc.destroy()}e(_e=>[..._e.filter(Lt=>fe.has(Lt.id)),...Ne]),V!==null&&r(_e=>_e===null||!fe.has(_e)?V:Fe.length>0&&V===_e?_e:V)},O.useEffect(()=>{const _=new Di,V=new xA({url:`ws://localhost:${mC}`,name:zz,document:_});return ie.current={ydoc:_,provider:V},V.on("status",({status:T})=>{s(T==="connected"),c(T),T==="connected"?(j.current=!0,d(0),m(null)):T==="disconnected"?m(Y=>Y??Date.now()):T==="connecting"&&(j.current&&d(Y=>Y+1),m(Y=>Y??Date.now()))}),F(!0),()=>{V.destroy(),_.destroy(),ie.current=null}},[]),O.useEffect(()=>{if(!ie.current)return;const _=ie.current.ydoc.getMap(gh),V=()=>{var oe;const T=_.get("generationId");T&&re.current&&T!==re.current&&(console.warn("[Tandem] Server restarted — refreshing documents"),N(!0),Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>N(!1),5e3)),T&&(re.current=T);const Y=_.get("openDocuments"),fe=_.get("activeDocumentId");Y&&((oe=G.current)==null||oe.call(G,Y,fe??null))};return _.observe(V),V(),()=>{_.unobserve(V),Z.current&&clearTimeout(Z.current)}},[]),O.useEffect(()=>{for(const V of H.current.values())V.cleanup();H.current.clear();const _=se.current.find(V=>V.id===n);if(_){const V=me(_);H.current.set(_.id,{cleanup:V})}else b([]),v(null),E(!1),I(!1)},[n,me]);const Te=O.useCallback(_=>{r(V=>{if(V!==_)return V;const T=se.current,Y=T.findIndex(oe=>oe.id===_),fe=T.filter(oe=>oe.id!==_);return fe.length===0?null:fe[Math.min(Y,fe.length-1)].id}),fetch(`http://localhost:${Ga}/api/close`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:_})}).then(V=>{V.ok||console.warn("[Tandem] Server rejected close:",V.status)}).catch(V=>{console.warn("[Tandem] Failed to close document on server:",V)})},[]);return{tabs:t,activeTabId:n,setActiveTabId:r,handleTabClose:Te,connected:i,connectionStatus:l,reconnectAttempts:f,disconnectedSince:p,annotations:g,claudeStatus:S,claudeActive:C,readOnly:B,bootstrapYdoc:((M=ie.current)==null?void 0:M.ydoc)??null,ready:ne,serverRestarted:R}}function V7(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const P7=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$7=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,F7={};function SA(t,e){return(F7.jsx?$7:P7).test(t)}const q7=/[ \t\n\f\r]/g;function Y7(t){return typeof t=="object"?t.type==="text"?wA(t.value):!1:wA(t)}function wA(t){return t.replace(q7,"")===""}class Ef{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Ef.prototype.normal={};Ef.prototype.property={};Ef.prototype.space=void 0;function x2(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new Ef(n,r,e)}function yx(t){return t.toLowerCase()}class fr{constructor(e,n){this.attribute=n,this.property=e}}fr.prototype.attribute="";fr.prototype.booleanish=!1;fr.prototype.boolean=!1;fr.prototype.commaOrSpaceSeparated=!1;fr.prototype.commaSeparated=!1;fr.prototype.defined=!1;fr.prototype.mustUseProperty=!1;fr.prototype.number=!1;fr.prototype.overloadedBoolean=!1;fr.prototype.property="";fr.prototype.spaceSeparated=!1;fr.prototype.space=void 0;let K7=0;const Ke=Sl(),nn=Sl(),bx=Sl(),ce=Sl(),Ct=Sl(),_a=Sl(),vr=Sl();function Sl(){return 2**++K7}const xx=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ke,booleanish:nn,commaOrSpaceSeparated:vr,commaSeparated:_a,number:ce,overloadedBoolean:bx,spaceSeparated:Ct},Symbol.toStringTag,{value:"Module"})),$0=Object.keys(xx);class X1 extends fr{constructor(e,n,r,i){let s=-1;if(super(e,n),vA(this,"space",i),typeof r=="number")for(;++s<$0.length;){const l=$0[s];vA(this,$0[s],(r&xx[l])===xx[l])}}}X1.prototype.defined=!0;function vA(t,e,n){n&&(t[e]=n)}function sc(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new X1(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[yx(r)]=r,n[yx(s.attribute)]=r}return new Ef(e,n,t.space)}const S2=sc({properties:{ariaActiveDescendant:null,ariaAtomic:nn,ariaAutoComplete:null,ariaBusy:nn,ariaChecked:nn,ariaColCount:ce,ariaColIndex:ce,ariaColSpan:ce,ariaControls:Ct,ariaCurrent:null,ariaDescribedBy:Ct,ariaDetails:null,ariaDisabled:nn,ariaDropEffect:Ct,ariaErrorMessage:null,ariaExpanded:nn,ariaFlowTo:Ct,ariaGrabbed:nn,ariaHasPopup:null,ariaHidden:nn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ct,ariaLevel:ce,ariaLive:null,ariaModal:nn,ariaMultiLine:nn,ariaMultiSelectable:nn,ariaOrientation:null,ariaOwns:Ct,ariaPlaceholder:null,ariaPosInSet:ce,ariaPressed:nn,ariaReadOnly:nn,ariaRelevant:null,ariaRequired:nn,ariaRoleDescription:Ct,ariaRowCount:ce,ariaRowIndex:ce,ariaRowSpan:ce,ariaSelected:nn,ariaSetSize:ce,ariaSort:null,ariaValueMax:ce,ariaValueMin:ce,ariaValueNow:ce,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function w2(t,e){return e in t?t[e]:e}function v2(t,e){return w2(t,e.toLowerCase())}const W7=sc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_a,acceptCharset:Ct,accessKey:Ct,action:null,allow:null,allowFullScreen:Ke,allowPaymentRequest:Ke,allowUserMedia:Ke,alt:null,as:null,async:Ke,autoCapitalize:null,autoComplete:Ct,autoFocus:Ke,autoPlay:Ke,blocking:Ct,capture:null,charSet:null,checked:Ke,cite:null,className:Ct,cols:ce,colSpan:null,content:null,contentEditable:nn,controls:Ke,controlsList:Ct,coords:ce|_a,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ke,defer:Ke,dir:null,dirName:null,disabled:Ke,download:bx,draggable:nn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ke,formTarget:null,headers:Ct,height:ce,hidden:bx,high:ce,href:null,hrefLang:null,htmlFor:Ct,httpEquiv:Ct,id:null,imageSizes:null,imageSrcSet:null,inert:Ke,inputMode:null,integrity:null,is:null,isMap:Ke,itemId:null,itemProp:Ct,itemRef:Ct,itemScope:Ke,itemType:Ct,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ke,low:ce,manifest:null,max:null,maxLength:ce,media:null,method:null,min:null,minLength:ce,multiple:Ke,muted:Ke,name:null,nonce:null,noModule:Ke,noValidate:Ke,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ke,optimum:ce,pattern:null,ping:Ct,placeholder:null,playsInline:Ke,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ke,referrerPolicy:null,rel:Ct,required:Ke,reversed:Ke,rows:ce,rowSpan:ce,sandbox:Ct,scope:null,scoped:Ke,seamless:Ke,selected:Ke,shadowRootClonable:Ke,shadowRootDelegatesFocus:Ke,shadowRootMode:null,shape:null,size:ce,sizes:null,slot:null,span:ce,spellCheck:nn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ce,step:null,style:null,tabIndex:ce,target:null,title:null,translate:null,type:null,typeMustMatch:Ke,useMap:null,value:nn,width:ce,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ct,axis:null,background:null,bgColor:null,border:ce,borderColor:null,bottomMargin:ce,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ke,declare:Ke,event:null,face:null,frame:null,frameBorder:null,hSpace:ce,leftMargin:ce,link:null,longDesc:null,lowSrc:null,marginHeight:ce,marginWidth:ce,noResize:Ke,noHref:Ke,noShade:Ke,noWrap:Ke,object:null,profile:null,prompt:null,rev:null,rightMargin:ce,rules:null,scheme:null,scrolling:nn,standby:null,summary:null,text:null,topMargin:ce,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ce,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ke,disableRemotePlayback:Ke,prefix:null,property:null,results:ce,security:null,unselectable:null},space:"html",transform:v2}),G7=sc({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:vr,accentHeight:ce,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ce,amplitude:ce,arabicForm:null,ascent:ce,attributeName:null,attributeType:null,azimuth:ce,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ce,by:null,calcMode:null,capHeight:ce,className:Ct,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ce,diffuseConstant:ce,direction:null,display:null,dur:null,divisor:ce,dominantBaseline:null,download:Ke,dx:null,dy:null,edgeMode:null,editable:null,elevation:ce,enableBackground:null,end:null,event:null,exponent:ce,externalResourcesRequired:null,fill:null,fillOpacity:ce,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:_a,g2:_a,glyphName:_a,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ce,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ce,horizOriginX:ce,horizOriginY:ce,id:null,ideographic:ce,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ce,k:ce,k1:ce,k2:ce,k3:ce,k4:ce,kernelMatrix:vr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ce,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ce,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ce,overlineThickness:ce,paintOrder:null,panose1:null,path:null,pathLength:ce,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ct,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ce,pointsAtY:ce,pointsAtZ:ce,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vr,rev:vr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vr,requiredFeatures:vr,requiredFonts:vr,requiredFormats:vr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ce,specularExponent:ce,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ce,strikethroughThickness:ce,string:null,stroke:null,strokeDashArray:vr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ce,strokeOpacity:ce,strokeWidth:null,style:null,surfaceScale:ce,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vr,tabIndex:ce,tableValues:null,target:null,targetX:ce,targetY:ce,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ce,underlineThickness:ce,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ce,values:null,vAlphabetic:ce,vMathematical:ce,vectorEffect:null,vHanging:ce,vIdeographic:ce,version:null,vertAdvY:ce,vertOriginX:ce,vertOriginY:ce,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ce,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:w2}),k2=sc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),C2=sc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:v2}),E2=sc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),Z7={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},J7=/[A-Z]/g,kA=/-[a-z]/g,X7=/^data[-\w.:]+$/i;function Q7(t,e){const n=yx(e);let r=e,i=fr;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&X7.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(kA,t$);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!kA.test(s)){let l=s.replace(J7,e$);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}i=X1}return new i(r,e)}function e$(t){return"-"+t.toLowerCase()}function t$(t){return t.charAt(1).toUpperCase()}const n$=x2([S2,W7,k2,C2,E2],"html"),Q1=x2([S2,G7,k2,C2,E2],"svg");function r$(t){return t.join(" ").trim()}var ca={},F0,CA;function i$(){if(CA)return F0;CA=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,f=`
|
|
297
|
-
`,d="/",p="*",m="",g="comment",b="declaration";function S(C,E){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];E=E||{};var B=1,I=1;function ne(ue){var H=ue.match(e);H&&(B+=H.length);var L=ue.lastIndexOf(f);I=~L?ue.length-L:I+ue.length}function F(){var ue={line:B,column:I};return function(H){return H.position=new R(ue),j(),H}}function R(ue){this.start=ue,this.end={line:B,column:I},this.source=E.source}R.prototype.content=C;function N(ue){var H=new Error(E.source+":"+B+":"+I+": "+ue);if(H.reason=ue,H.filename=E.source,H.line=B,H.column=I,H.source=C,!E.silent)throw H}function Z(ue){var H=ue.exec(C);if(H){var L=H[0];return ne(L),C=C.slice(L.length),H}}function j(){Z(n)}function ie(ue){var H;for(ue=ue||[];H=re();)H!==!1&&ue.push(H);return ue}function re(){var ue=F();if(!(d!=C.charAt(0)||p!=C.charAt(1))){for(var H=2;m!=C.charAt(H)&&(p!=C.charAt(H)||d!=C.charAt(H+1));)++H;if(H+=2,m===C.charAt(H-1))return N("End of comment missing");var L=C.slice(2,H-2);return I+=2,ne(L),C=C.slice(H),I+=2,ue({type:g,comment:L})}}function se(){var ue=F(),H=Z(r);if(H){if(re(),!Z(i))return N("property missing ':'");var L=Z(s),G=ue({type:b,property:v(H[0].replace(t,m)),value:L?v(L[0].replace(t,m)):m});return Z(l),G}}function be(){var ue=[];ie(ue);for(var H;H=se();)H!==!1&&(ue.push(H),ie(ue));return ue}return j(),be()}function v(C){return C?C.replace(c,m):m}return F0=S,F0}var EA;function s$(){if(EA)return ca;EA=1;var t=ca&&ca.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ca,"__esModule",{value:!0}),ca.default=n;const e=t(i$());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const l=(0,e.default)(r),c=typeof i=="function";return l.forEach(f=>{if(f.type!=="declaration")return;const{property:d,value:p}=f;c?i(d,p,f):p&&(s=s||{},s[d]=p)}),s}return ca}var ru={},TA;function o$(){if(TA)return ru;TA=1,Object.defineProperty(ru,"__esModule",{value:!0}),ru.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(d){return!d||n.test(d)||t.test(d)},l=function(d,p){return p.toUpperCase()},c=function(d,p){return"".concat(p,"-")},f=function(d,p){return p===void 0&&(p={}),s(d)?d:(d=d.toLowerCase(),p.reactCompat?d=d.replace(i,c):d=d.replace(r,c),d.replace(e,l))};return ru.camelCase=f,ru}var iu,AA;function l$(){if(AA)return iu;AA=1;var t=iu&&iu.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(s$()),n=o$();function r(i,s){var l={};return!i||typeof i!="string"||(0,e.default)(i,function(c,f){c&&f&&(l[(0,n.camelCase)(c,s)]=f)}),l}return r.default=r,iu=r,iu}var a$=l$();const c$=Jp(a$),T2=A2("end"),eS=A2("start");function A2(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function u$(t){const e=eS(t),n=T2(t);if(e&&n)return{start:e,end:n}}function _u(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?MA(t.position):"start"in t||"end"in t?MA(t):"line"in t||"column"in t?Sx(t):""}function Sx(t){return OA(t&&t.line)+":"+OA(t&&t.column)}function MA(t){return Sx(t&&t.start)+"-"+Sx(t&&t.end)}function OA(t){return t&&typeof t=="number"?t:1}class $n extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},l=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(l=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const f=r.indexOf(":");f===-1?s.ruleId=r:(s.source=r.slice(0,f),s.ruleId=r.slice(f+1))}if(!s.place&&s.ancestors&&s.ancestors){const f=s.ancestors[s.ancestors.length-1];f&&(s.place=f.position)}const c=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=c?c.line:void 0,this.name=_u(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=l&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}$n.prototype.file="";$n.prototype.name="";$n.prototype.reason="";$n.prototype.message="";$n.prototype.stack="";$n.prototype.column=void 0;$n.prototype.line=void 0;$n.prototype.ancestors=void 0;$n.prototype.cause=void 0;$n.prototype.fatal=void 0;$n.prototype.place=void 0;$n.prototype.ruleId=void 0;$n.prototype.source=void 0;const tS={}.hasOwnProperty,f$=new Map,d$=/[A-Z]/g,h$=new Set(["table","tbody","thead","tfoot","tr"]),p$=new Set(["td","th"]),M2="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function m$(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=k$(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=v$(n,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?Q1:n$,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=O2(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function O2(t,e,n){if(e.type==="element")return g$(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return y$(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return x$(t,e,n);if(e.type==="mdxjsEsm")return b$(t,e);if(e.type==="root")return S$(t,e,n);if(e.type==="text")return w$(t,e)}function g$(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Q1,t.schema=i),t.ancestors.push(e);const s=D2(t,e.tagName,!1),l=C$(t,e);let c=rS(t,e);return h$.has(e.tagName)&&(c=c.filter(function(f){return typeof f=="string"?!Y7(f):!0})),_2(t,l,s,e),nS(l,c),t.ancestors.pop(),t.schema=r,t.create(e,s,l,n)}function y$(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}pf(t,e.position)}function b$(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);pf(t,e.position)}function x$(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=Q1,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:D2(t,e.name,!0),l=E$(t,e),c=rS(t,e);return _2(t,l,s,e),nS(l,c),t.ancestors.pop(),t.schema=r,t.create(e,s,l,n)}function S$(t,e,n){const r={};return nS(r,rS(t,e)),t.create(e,t.Fragment,r,n)}function w$(t,e){return e.value}function _2(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function nS(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function v$(t,e,n){return r;function r(i,s,l,c){const d=Array.isArray(l.children)?n:e;return c?d(s,l,c):d(s,l)}}function k$(t,e){return n;function n(r,i,s,l){const c=Array.isArray(s.children),f=eS(r);return e(i,s,l,c,{columnNumber:f?f.column-1:void 0,fileName:t,lineNumber:f?f.line:void 0},void 0)}}function C$(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&tS.call(e.properties,i)){const s=T$(t,i,e.properties[i]);if(s){const[l,c]=s;t.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&p$.has(e.tagName)?r=c:n[l]=c}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function E$(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const s=r.data.estree.body[0];s.type;const l=s.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,t.evaluater.evaluateExpression(c.argument))}else pf(t,e.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const c=r.value.data.estree.body[0];c.type,s=t.evaluater.evaluateExpression(c.expression)}else pf(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function rS(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:f$;for(;++r<e.children.length;){const s=e.children[r];let l;if(t.passKeys){const f=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(f){const d=i.get(f)||0;l=f+"-"+d,i.set(f,d+1)}}const c=O2(t,s,l);c!==void 0&&n.push(c)}return n}function T$(t,e,n){const r=Q7(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?V7(n):r$(n)),r.property==="style"){let i=typeof n=="object"?n:A$(t,String(n));return t.stylePropertyNameCase==="css"&&(i=M$(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?Z7[r.property]||r.property:r.attribute,n]}}function A$(t,e){try{return c$(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new $n("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=M2+"#cannot-parse-style-attribute",i}}function D2(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,l;for(;++s<i.length;){const c=SA(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};l=l?{type:"MemberExpression",object:l,property:c,computed:!!(s&&c.type==="Literal"),optional:!1}:c}r=l}else r=SA(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return tS.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);pf(t)}function pf(t,e){const n=new $n("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=M2+"#cannot-handle-mdx-estrees-without-createevaluater",n}function M$(t){const e={};let n;for(n in t)tS.call(t,n)&&(e[O$(n)]=t[n]);return e}function O$(t){let e=t.replace(d$,_$);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function _$(t){return"-"+t.toLowerCase()}const q0={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},D$={};function R$(t,e){const n=D$,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return R2(t,r,i)}function R2(t,e,n){if(N$(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return _A(t.children,e,n)}return Array.isArray(t)?_A(t,e,n):""}function _A(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=R2(t[i],e,n);return r.join("")}function N$(t){return!!(t&&typeof t=="object")}const DA=document.createElement("i");function iS(t){const e="&"+t+";";DA.innerHTML=e;const n=DA.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Ri(t,e,n,r){const i=t.length;let s=0,l;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(e,n),t.splice(...l);else for(n&&t.splice(e,n);s<r.length;)l=r.slice(s,s+1e4),l.unshift(e,0),t.splice(...l),s+=1e4,e+=1e4}function Fr(t,e){return t.length>0?(Ri(t,t.length,0,e),t):e}const RA={}.hasOwnProperty;function z$(t){const e={};let n=-1;for(;++n<t.length;)L$(e,t[n]);return e}function L$(t,e){let n;for(n in e){const i=(RA.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let l;if(s)for(l in s){RA.call(i,l)||(i[l]=[]);const c=s[l];j$(i[l],Array.isArray(c)?c:c?[c]:[])}}}function j$(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Ri(t,0,0,r)}function N2(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Da(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const vi=wo(/[A-Za-z]/),Ar=wo(/[\dA-Za-z]/),I$=wo(/[#-'*+\--9=?A-Z^-~]/);function wx(t){return t!==null&&(t<32||t===127)}const vx=wo(/\d/),B$=wo(/[\dA-Fa-f]/),U$=wo(/[!-/:-@[-`{-~]/);function Be(t){return t!==null&&t<-2}function ur(t){return t!==null&&(t<0||t===32)}function dt(t){return t===-2||t===-1||t===32}const H$=wo(new RegExp("\\p{P}|\\p{S}","u")),V$=wo(/\s/);function wo(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function oc(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let l="";if(s===37&&Ar(t.charCodeAt(n+1))&&Ar(t.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(l=String.fromCharCode(s));else if(s>55295&&s<57344){const c=t.charCodeAt(n+1);s<56320&&c>56319&&c<57344?(l=String.fromCharCode(s,c),i=1):l="�"}else l=String.fromCharCode(s);l&&(e.push(t.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Et(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return l;function l(f){return dt(f)?(t.enter(n),c(f)):e(f)}function c(f){return dt(f)&&s++<i?(t.consume(f),c):(t.exit(n),e(f))}}const P$={tokenize:$$};function $$(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(c){if(c===null){t.consume(c);return}return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),Et(t,e,"linePrefix")}function i(c){return t.enter("paragraph"),s(c)}function s(c){const f=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,l(c)}function l(c){if(c===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(c);return}return Be(c)?(t.consume(c),t.exit("chunkText"),s):(t.consume(c),l)}}const F$={tokenize:q$},NA={tokenize:Y$};function q$(t){const e=this,n=[];let r=0,i,s,l;return c;function c(I){if(r<n.length){const ne=n[r];return e.containerState=ne[1],t.attempt(ne[0].continuation,f,d)(I)}return d(I)}function f(I){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&B();const ne=e.events.length;let F=ne,R;for(;F--;)if(e.events[F][0]==="exit"&&e.events[F][1].type==="chunkFlow"){R=e.events[F][1].end;break}E(r);let N=ne;for(;N<e.events.length;)e.events[N][1].end={...R},N++;return Ri(e.events,F+1,0,e.events.slice(ne)),e.events.length=N,d(I)}return c(I)}function d(I){if(r===n.length){if(!i)return g(I);if(i.currentConstruct&&i.currentConstruct.concrete)return S(I);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(NA,p,m)(I)}function p(I){return i&&B(),E(r),g(I)}function m(I){return e.parser.lazy[e.now().line]=r!==n.length,l=e.now().offset,S(I)}function g(I){return e.containerState={},t.attempt(NA,b,S)(I)}function b(I){return r++,n.push([e.currentConstruct,e.containerState]),g(I)}function S(I){if(I===null){i&&B(),E(0),t.consume(I);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),v(I)}function v(I){if(I===null){C(t.exit("chunkFlow"),!0),E(0),t.consume(I);return}return Be(I)?(t.consume(I),C(t.exit("chunkFlow")),r=0,e.interrupt=void 0,c):(t.consume(I),v)}function C(I,ne){const F=e.sliceStream(I);if(ne&&F.push(null),I.previous=s,s&&(s.next=I),s=I,i.defineSkip(I.start),i.write(F),e.parser.lazy[I.start.line]){let R=i.events.length;for(;R--;)if(i.events[R][1].start.offset<l&&(!i.events[R][1].end||i.events[R][1].end.offset>l))return;const N=e.events.length;let Z=N,j,ie;for(;Z--;)if(e.events[Z][0]==="exit"&&e.events[Z][1].type==="chunkFlow"){if(j){ie=e.events[Z][1].end;break}j=!0}for(E(r),R=N;R<e.events.length;)e.events[R][1].end={...ie},R++;Ri(e.events,Z+1,0,e.events.slice(N)),e.events.length=R}}function E(I){let ne=n.length;for(;ne-- >I;){const F=n[ne];e.containerState=F[1],F[0].exit.call(e,t)}n.length=I}function B(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function Y$(t,e,n){return Et(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function zA(t){if(t===null||ur(t)||V$(t))return 1;if(H$(t))return 2}function sS(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}const kx={name:"attention",resolveAll:K$,tokenize:W$};function K$(t,e){let n=-1,r,i,s,l,c,f,d,p;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;f=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[r][1].end},g={...t[n][1].start};LA(m,-f),LA(g,f),l={type:f>1?"strongSequence":"emphasisSequence",start:m,end:{...t[r][1].end}},c={type:f>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},s={type:f>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:f>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},t[r][1].end={...l.start},t[n][1].start={...c.end},d=[],t[r][1].end.offset-t[r][1].start.offset&&(d=Fr(d,[["enter",t[r][1],e],["exit",t[r][1],e]])),d=Fr(d,[["enter",i,e],["enter",l,e],["exit",l,e],["enter",s,e]]),d=Fr(d,sS(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),d=Fr(d,[["exit",s,e],["enter",c,e],["exit",c,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(p=2,d=Fr(d,[["enter",t[n][1],e],["exit",t[n][1],e]])):p=0,Ri(t,r-1,n-r+3,d),n=r+d.length-p-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function W$(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=zA(r);let s;return l;function l(f){return s=f,t.enter("attentionSequence"),c(f)}function c(f){if(f===s)return t.consume(f),c;const d=t.exit("attentionSequence"),p=zA(f),m=!p||p===2&&i||n.includes(f),g=!i||i===2&&p||n.includes(r);return d._open=!!(s===42?m:m&&(i||!g)),d._close=!!(s===42?g:g&&(p||!m)),e(f)}}function LA(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const G$={name:"autolink",tokenize:Z$};function Z$(t,e,n){let r=0;return i;function i(b){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(b){return vi(b)?(t.consume(b),l):b===64?n(b):d(b)}function l(b){return b===43||b===45||b===46||Ar(b)?(r=1,c(b)):d(b)}function c(b){return b===58?(t.consume(b),r=0,f):(b===43||b===45||b===46||Ar(b))&&r++<32?(t.consume(b),c):(r=0,d(b))}function f(b){return b===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.exit("autolink"),e):b===null||b===32||b===60||wx(b)?n(b):(t.consume(b),f)}function d(b){return b===64?(t.consume(b),p):I$(b)?(t.consume(b),d):n(b)}function p(b){return Ar(b)?m(b):n(b)}function m(b){return b===46?(t.consume(b),r=0,p):b===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.exit("autolink"),e):g(b)}function g(b){if((b===45||Ar(b))&&r++<63){const S=b===45?g:m;return t.consume(b),S}return n(b)}}const Om={partial:!0,tokenize:J$};function J$(t,e,n){return r;function r(s){return dt(s)?Et(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Be(s)?e(s):n(s)}}const z2={continuation:{tokenize:Q$},exit:eF,name:"blockQuote",tokenize:X$};function X$(t,e,n){const r=this;return i;function i(l){if(l===62){const c=r.containerState;return c.open||(t.enter("blockQuote",{_container:!0}),c.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(l),t.exit("blockQuoteMarker"),s}return n(l)}function s(l){return dt(l)?(t.enter("blockQuotePrefixWhitespace"),t.consume(l),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(l))}}function Q$(t,e,n){const r=this;return i;function i(l){return dt(l)?Et(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):s(l)}function s(l){return t.attempt(z2,e,n)(l)}}function eF(t){t.exit("blockQuote")}const L2={name:"characterEscape",tokenize:tF};function tF(t,e,n){return r;function r(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return U$(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const j2={name:"characterReference",tokenize:nF};function nF(t,e,n){const r=this;let i=0,s,l;return c;function c(m){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),f}function f(m){return m===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(m),t.exit("characterReferenceMarkerNumeric"),d):(t.enter("characterReferenceValue"),s=31,l=Ar,p(m))}function d(m){return m===88||m===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(m),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,l=B$,p):(t.enter("characterReferenceValue"),s=7,l=vx,p(m))}function p(m){if(m===59&&i){const g=t.exit("characterReferenceValue");return l===Ar&&!iS(r.sliceSerialize(g))?n(m):(t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return l(m)&&i++<s?(t.consume(m),p):n(m)}}const jA={partial:!0,tokenize:iF},IA={concrete:!0,name:"codeFenced",tokenize:rF};function rF(t,e,n){const r=this,i={partial:!0,tokenize:F};let s=0,l=0,c;return f;function f(R){return d(R)}function d(R){const N=r.events[r.events.length-1];return s=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,c=R,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),p(R)}function p(R){return R===c?(l++,t.consume(R),p):l<3?n(R):(t.exit("codeFencedFenceSequence"),dt(R)?Et(t,m,"whitespace")(R):m(R))}function m(R){return R===null||Be(R)?(t.exit("codeFencedFence"),r.interrupt?e(R):t.check(jA,v,ne)(R)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),g(R))}function g(R){return R===null||Be(R)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),m(R)):dt(R)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Et(t,b,"whitespace")(R)):R===96&&R===c?n(R):(t.consume(R),g)}function b(R){return R===null||Be(R)?m(R):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),S(R))}function S(R){return R===null||Be(R)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),m(R)):R===96&&R===c?n(R):(t.consume(R),S)}function v(R){return t.attempt(i,ne,C)(R)}function C(R){return t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),E}function E(R){return s>0&&dt(R)?Et(t,B,"linePrefix",s+1)(R):B(R)}function B(R){return R===null||Be(R)?t.check(jA,v,ne)(R):(t.enter("codeFlowValue"),I(R))}function I(R){return R===null||Be(R)?(t.exit("codeFlowValue"),B(R)):(t.consume(R),I)}function ne(R){return t.exit("codeFenced"),e(R)}function F(R,N,Z){let j=0;return ie;function ie(H){return R.enter("lineEnding"),R.consume(H),R.exit("lineEnding"),re}function re(H){return R.enter("codeFencedFence"),dt(H)?Et(R,se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):se(H)}function se(H){return H===c?(R.enter("codeFencedFenceSequence"),be(H)):Z(H)}function be(H){return H===c?(j++,R.consume(H),be):j>=l?(R.exit("codeFencedFenceSequence"),dt(H)?Et(R,ue,"whitespace")(H):ue(H)):Z(H)}function ue(H){return H===null||Be(H)?(R.exit("codeFencedFence"),N(H)):Z(H)}}}function iF(t,e,n){const r=this;return i;function i(l){return l===null?n(l):(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s)}function s(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}const Y0={name:"codeIndented",tokenize:oF},sF={partial:!0,tokenize:lF};function oF(t,e,n){const r=this;return i;function i(d){return t.enter("codeIndented"),Et(t,s,"linePrefix",5)(d)}function s(d){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?l(d):n(d)}function l(d){return d===null?f(d):Be(d)?t.attempt(sF,l,f)(d):(t.enter("codeFlowValue"),c(d))}function c(d){return d===null||Be(d)?(t.exit("codeFlowValue"),l(d)):(t.consume(d),c)}function f(d){return t.exit("codeIndented"),e(d)}}function lF(t,e,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):Be(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i):Et(t,s,"linePrefix",5)(l)}function s(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(l):Be(l)?i(l):n(l)}}const aF={name:"codeText",previous:uF,resolve:cF,tokenize:fF};function cF(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function uF(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function fF(t,e,n){let r=0,i,s;return l;function l(m){return t.enter("codeText"),t.enter("codeTextSequence"),c(m)}function c(m){return m===96?(t.consume(m),r++,c):(t.exit("codeTextSequence"),f(m))}function f(m){return m===null?n(m):m===32?(t.enter("space"),t.consume(m),t.exit("space"),f):m===96?(s=t.enter("codeTextSequence"),i=0,p(m)):Be(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),f):(t.enter("codeTextData"),d(m))}function d(m){return m===null||m===32||m===96||Be(m)?(t.exit("codeTextData"),f(m)):(t.consume(m),d)}function p(m){return m===96?(t.consume(m),i++,p):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(m)):(s.type="codeTextData",d(m))}}class dF{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&su(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),su(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),su(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);su(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);su(this.left,n.reverse())}}}function su(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function I2(t){const e={};let n=-1,r,i,s,l,c,f,d;const p=new dF(t);for(;++n<p.length;){for(;n in e;)n=e[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(f=r[1]._tokenizer.events,s=0,s<f.length&&f[s][1].type==="lineEndingBlank"&&(s+=2),s<f.length&&f[s][1].type==="content"))for(;++s<f.length&&f[s][1].type!=="content";)f[s][1].type==="chunkText"&&(f[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,hF(p,n)),n=e[n],d=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(l=p.get(s),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(p.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=s);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...p.get(i)[1].start},c=p.slice(i,n),c.unshift(r),p.splice(i,n-i+1,c))}}return Ri(t,0,Number.POSITIVE_INFINITY,p.slice(0)),!d}function hF(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const c=l.events,f=[],d={};let p,m,g=-1,b=n,S=0,v=0;const C=[v];for(;b;){for(;t.get(++i)[1]!==b;);s.push(i),b._tokenizer||(p=r.sliceStream(b),b.next||p.push(null),m&&l.defineSkip(b.start),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(p),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),m=b,b=b.next}for(b=n;++g<c.length;)c[g][0]==="exit"&&c[g-1][0]==="enter"&&c[g][1].type===c[g-1][1].type&&c[g][1].start.line!==c[g][1].end.line&&(v=g+1,C.push(v),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(l.events=[],b?(b._tokenizer=void 0,b.previous=void 0):C.pop(),g=C.length;g--;){const E=c.slice(C[g],C[g+1]),B=s.pop();f.push([B,B+E.length-1]),t.splice(B,2,E)}for(f.reverse(),g=-1;++g<f.length;)d[S+f[g][0]]=S+f[g][1],S+=f[g][1]-f[g][0]-1;return d}const pF={resolve:gF,tokenize:yF},mF={partial:!0,tokenize:bF};function gF(t){return I2(t),t}function yF(t,e){let n;return r;function r(c){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(c)}function i(c){return c===null?s(c):Be(c)?t.check(mF,l,s)(c):(t.consume(c),i)}function s(c){return t.exit("chunkContent"),t.exit("content"),e(c)}function l(c){return t.consume(c),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function bF(t,e,n){const r=this;return i;function i(l){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),Et(t,s,"linePrefix")}function s(l){if(l===null||Be(l))return n(l);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(l):t.interrupt(r.parser.constructs.flow,n,e)(l)}}function B2(t,e,n,r,i,s,l,c,f){const d=f||Number.POSITIVE_INFINITY;let p=0;return m;function m(E){return E===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(E),t.exit(s),g):E===null||E===32||E===41||wx(E)?n(E):(t.enter(r),t.enter(l),t.enter(c),t.enter("chunkString",{contentType:"string"}),v(E))}function g(E){return E===62?(t.enter(s),t.consume(E),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(c),t.enter("chunkString",{contentType:"string"}),b(E))}function b(E){return E===62?(t.exit("chunkString"),t.exit(c),g(E)):E===null||E===60||Be(E)?n(E):(t.consume(E),E===92?S:b)}function S(E){return E===60||E===62||E===92?(t.consume(E),b):b(E)}function v(E){return!p&&(E===null||E===41||ur(E))?(t.exit("chunkString"),t.exit(c),t.exit(l),t.exit(r),e(E)):p<d&&E===40?(t.consume(E),p++,v):E===41?(t.consume(E),p--,v):E===null||E===32||E===40||wx(E)?n(E):(t.consume(E),E===92?C:v)}function C(E){return E===40||E===41||E===92?(t.consume(E),v):v(E)}}function U2(t,e,n,r,i,s){const l=this;let c=0,f;return d;function d(b){return t.enter(r),t.enter(i),t.consume(b),t.exit(i),t.enter(s),p}function p(b){return c>999||b===null||b===91||b===93&&!f||b===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(b):b===93?(t.exit(s),t.enter(i),t.consume(b),t.exit(i),t.exit(r),e):Be(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),p):(t.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||b===91||b===93||Be(b)||c++>999?(t.exit("chunkString"),p(b)):(t.consume(b),f||(f=!dt(b)),b===92?g:m)}function g(b){return b===91||b===92||b===93?(t.consume(b),c++,m):m(b)}}function H2(t,e,n,r,i,s){let l;return c;function c(g){return g===34||g===39||g===40?(t.enter(r),t.enter(i),t.consume(g),t.exit(i),l=g===40?41:g,f):n(g)}function f(g){return g===l?(t.enter(i),t.consume(g),t.exit(i),t.exit(r),e):(t.enter(s),d(g))}function d(g){return g===l?(t.exit(s),f(l)):g===null?n(g):Be(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),Et(t,d,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===l||g===null||Be(g)?(t.exit("chunkString"),d(g)):(t.consume(g),g===92?m:p)}function m(g){return g===l||g===92?(t.consume(g),p):p(g)}}function Du(t,e){let n;return r;function r(i){return Be(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):dt(i)?Et(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const xF={name:"definition",tokenize:wF},SF={partial:!0,tokenize:vF};function wF(t,e,n){const r=this;let i;return s;function s(b){return t.enter("definition"),l(b)}function l(b){return U2.call(r,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function c(b){return i=Da(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),f):n(b)}function f(b){return ur(b)?Du(t,d)(b):d(b)}function d(b){return B2(t,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function p(b){return t.attempt(SF,m,m)(b)}function m(b){return dt(b)?Et(t,g,"whitespace")(b):g(b)}function g(b){return b===null||Be(b)?(t.exit("definition"),r.parser.defined.push(i),e(b)):n(b)}}function vF(t,e,n){return r;function r(c){return ur(c)?Du(t,i)(c):n(c)}function i(c){return H2(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function s(c){return dt(c)?Et(t,l,"whitespace")(c):l(c)}function l(c){return c===null||Be(c)?e(c):n(c)}}const kF={name:"hardBreakEscape",tokenize:CF};function CF(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Be(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const EF={name:"headingAtx",resolve:TF,tokenize:AF};function TF(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Ri(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function AF(t,e,n){let r=0;return i;function i(p){return t.enter("atxHeading"),s(p)}function s(p){return t.enter("atxHeadingSequence"),l(p)}function l(p){return p===35&&r++<6?(t.consume(p),l):p===null||ur(p)?(t.exit("atxHeadingSequence"),c(p)):n(p)}function c(p){return p===35?(t.enter("atxHeadingSequence"),f(p)):p===null||Be(p)?(t.exit("atxHeading"),e(p)):dt(p)?Et(t,c,"whitespace")(p):(t.enter("atxHeadingText"),d(p))}function f(p){return p===35?(t.consume(p),f):(t.exit("atxHeadingSequence"),c(p))}function d(p){return p===null||p===35||ur(p)?(t.exit("atxHeadingText"),c(p)):(t.consume(p),d)}}const MF=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],BA=["pre","script","style","textarea"],OF={concrete:!0,name:"htmlFlow",resolveTo:RF,tokenize:NF},_F={partial:!0,tokenize:LF},DF={partial:!0,tokenize:zF};function RF(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function NF(t,e,n){const r=this;let i,s,l,c,f;return d;function d(T){return p(T)}function p(T){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(T),m}function m(T){return T===33?(t.consume(T),g):T===47?(t.consume(T),s=!0,v):T===63?(t.consume(T),i=3,r.interrupt?e:M):vi(T)?(t.consume(T),l=String.fromCharCode(T),C):n(T)}function g(T){return T===45?(t.consume(T),i=2,b):T===91?(t.consume(T),i=5,c=0,S):vi(T)?(t.consume(T),i=4,r.interrupt?e:M):n(T)}function b(T){return T===45?(t.consume(T),r.interrupt?e:M):n(T)}function S(T){const Y="CDATA[";return T===Y.charCodeAt(c++)?(t.consume(T),c===Y.length?r.interrupt?e:se:S):n(T)}function v(T){return vi(T)?(t.consume(T),l=String.fromCharCode(T),C):n(T)}function C(T){if(T===null||T===47||T===62||ur(T)){const Y=T===47,fe=l.toLowerCase();return!Y&&!s&&BA.includes(fe)?(i=1,r.interrupt?e(T):se(T)):MF.includes(l.toLowerCase())?(i=6,Y?(t.consume(T),E):r.interrupt?e(T):se(T)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(T):s?B(T):I(T))}return T===45||Ar(T)?(t.consume(T),l+=String.fromCharCode(T),C):n(T)}function E(T){return T===62?(t.consume(T),r.interrupt?e:se):n(T)}function B(T){return dt(T)?(t.consume(T),B):ie(T)}function I(T){return T===47?(t.consume(T),ie):T===58||T===95||vi(T)?(t.consume(T),ne):dt(T)?(t.consume(T),I):ie(T)}function ne(T){return T===45||T===46||T===58||T===95||Ar(T)?(t.consume(T),ne):F(T)}function F(T){return T===61?(t.consume(T),R):dt(T)?(t.consume(T),F):I(T)}function R(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(t.consume(T),f=T,N):dt(T)?(t.consume(T),R):Z(T)}function N(T){return T===f?(t.consume(T),f=null,j):T===null||Be(T)?n(T):(t.consume(T),N)}function Z(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||ur(T)?F(T):(t.consume(T),Z)}function j(T){return T===47||T===62||dt(T)?I(T):n(T)}function ie(T){return T===62?(t.consume(T),re):n(T)}function re(T){return T===null||Be(T)?se(T):dt(T)?(t.consume(T),re):n(T)}function se(T){return T===45&&i===2?(t.consume(T),L):T===60&&i===1?(t.consume(T),G):T===62&&i===4?(t.consume(T),_):T===63&&i===3?(t.consume(T),M):T===93&&i===5?(t.consume(T),Te):Be(T)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(_F,V,be)(T)):T===null||Be(T)?(t.exit("htmlFlowData"),be(T)):(t.consume(T),se)}function be(T){return t.check(DF,ue,V)(T)}function ue(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),H}function H(T){return T===null||Be(T)?be(T):(t.enter("htmlFlowData"),se(T))}function L(T){return T===45?(t.consume(T),M):se(T)}function G(T){return T===47?(t.consume(T),l="",me):se(T)}function me(T){if(T===62){const Y=l.toLowerCase();return BA.includes(Y)?(t.consume(T),_):se(T)}return vi(T)&&l.length<8?(t.consume(T),l+=String.fromCharCode(T),me):se(T)}function Te(T){return T===93?(t.consume(T),M):se(T)}function M(T){return T===62?(t.consume(T),_):T===45&&i===2?(t.consume(T),M):se(T)}function _(T){return T===null||Be(T)?(t.exit("htmlFlowData"),V(T)):(t.consume(T),_)}function V(T){return t.exit("htmlFlow"),e(T)}}function zF(t,e,n){const r=this;return i;function i(l){return Be(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s):n(l)}function s(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}function LF(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Om,e,n)}}const jF={name:"htmlText",tokenize:IF};function IF(t,e,n){const r=this;let i,s,l;return c;function c(M){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(M),f}function f(M){return M===33?(t.consume(M),d):M===47?(t.consume(M),F):M===63?(t.consume(M),I):vi(M)?(t.consume(M),Z):n(M)}function d(M){return M===45?(t.consume(M),p):M===91?(t.consume(M),s=0,S):vi(M)?(t.consume(M),B):n(M)}function p(M){return M===45?(t.consume(M),b):n(M)}function m(M){return M===null?n(M):M===45?(t.consume(M),g):Be(M)?(l=m,G(M)):(t.consume(M),m)}function g(M){return M===45?(t.consume(M),b):m(M)}function b(M){return M===62?L(M):M===45?g(M):m(M)}function S(M){const _="CDATA[";return M===_.charCodeAt(s++)?(t.consume(M),s===_.length?v:S):n(M)}function v(M){return M===null?n(M):M===93?(t.consume(M),C):Be(M)?(l=v,G(M)):(t.consume(M),v)}function C(M){return M===93?(t.consume(M),E):v(M)}function E(M){return M===62?L(M):M===93?(t.consume(M),E):v(M)}function B(M){return M===null||M===62?L(M):Be(M)?(l=B,G(M)):(t.consume(M),B)}function I(M){return M===null?n(M):M===63?(t.consume(M),ne):Be(M)?(l=I,G(M)):(t.consume(M),I)}function ne(M){return M===62?L(M):I(M)}function F(M){return vi(M)?(t.consume(M),R):n(M)}function R(M){return M===45||Ar(M)?(t.consume(M),R):N(M)}function N(M){return Be(M)?(l=N,G(M)):dt(M)?(t.consume(M),N):L(M)}function Z(M){return M===45||Ar(M)?(t.consume(M),Z):M===47||M===62||ur(M)?j(M):n(M)}function j(M){return M===47?(t.consume(M),L):M===58||M===95||vi(M)?(t.consume(M),ie):Be(M)?(l=j,G(M)):dt(M)?(t.consume(M),j):L(M)}function ie(M){return M===45||M===46||M===58||M===95||Ar(M)?(t.consume(M),ie):re(M)}function re(M){return M===61?(t.consume(M),se):Be(M)?(l=re,G(M)):dt(M)?(t.consume(M),re):j(M)}function se(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(t.consume(M),i=M,be):Be(M)?(l=se,G(M)):dt(M)?(t.consume(M),se):(t.consume(M),ue)}function be(M){return M===i?(t.consume(M),i=void 0,H):M===null?n(M):Be(M)?(l=be,G(M)):(t.consume(M),be)}function ue(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||ur(M)?j(M):(t.consume(M),ue)}function H(M){return M===47||M===62||ur(M)?j(M):n(M)}function L(M){return M===62?(t.consume(M),t.exit("htmlTextData"),t.exit("htmlText"),e):n(M)}function G(M){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),me}function me(M){return dt(M)?Et(t,Te,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):Te(M)}function Te(M){return t.enter("htmlTextData"),l(M)}}const oS={name:"labelEnd",resolveAll:VF,resolveTo:PF,tokenize:$F},BF={tokenize:FF},UF={tokenize:qF},HF={tokenize:YF};function VF(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&Ri(t,0,t.length,n),t}function PF(t,e){let n=t.length,r=0,i,s,l,c;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=n);const f={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},d={type:"label",start:{...t[s][1].start},end:{...t[l][1].end}},p={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[l-2][1].start}};return c=[["enter",f,e],["enter",d,e]],c=Fr(c,t.slice(s+1,s+r+3)),c=Fr(c,[["enter",p,e]]),c=Fr(c,sS(e.parser.constructs.insideSpan.null,t.slice(s+r+4,l-3),e)),c=Fr(c,[["exit",p,e],t[l-2],t[l-1],["exit",d,e]]),c=Fr(c,t.slice(l+1)),c=Fr(c,[["exit",f,e]]),Ri(t,s,t.length,c),t}function $F(t,e,n){const r=this;let i=r.events.length,s,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return c;function c(g){return s?s._inactive?m(g):(l=r.parser.defined.includes(Da(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(g),t.exit("labelMarker"),t.exit("labelEnd"),f):n(g)}function f(g){return g===40?t.attempt(BF,p,l?p:m)(g):g===91?t.attempt(UF,p,l?d:m)(g):l?p(g):m(g)}function d(g){return t.attempt(HF,p,m)(g)}function p(g){return e(g)}function m(g){return s._balanced=!0,n(g)}}function FF(t,e,n){return r;function r(m){return t.enter("resource"),t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),i}function i(m){return ur(m)?Du(t,s)(m):s(m)}function s(m){return m===41?p(m):B2(t,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function l(m){return ur(m)?Du(t,f)(m):p(m)}function c(m){return n(m)}function f(m){return m===34||m===39||m===40?H2(t,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):p(m)}function d(m){return ur(m)?Du(t,p)(m):p(m)}function p(m){return m===41?(t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),t.exit("resource"),e):n(m)}}function qF(t,e,n){const r=this;return i;function i(c){return U2.call(r,t,s,l,"reference","referenceMarker","referenceString")(c)}function s(c){return r.parser.defined.includes(Da(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(c):n(c)}function l(c){return n(c)}}function YF(t,e,n){return r;function r(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}const KF={name:"labelStartImage",resolveAll:oS.resolveAll,tokenize:WF};function WF(t,e,n){const r=this;return i;function i(c){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(c),t.exit("labelImageMarker"),s}function s(c){return c===91?(t.enter("labelMarker"),t.consume(c),t.exit("labelMarker"),t.exit("labelImage"),l):n(c)}function l(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):e(c)}}const GF={name:"labelStartLink",resolveAll:oS.resolveAll,tokenize:ZF};function ZF(t,e,n){const r=this;return i;function i(l){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelLink"),s}function s(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):e(l)}}const K0={name:"lineEnding",tokenize:JF};function JF(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Et(t,e,"linePrefix")}}const Nh={name:"thematicBreak",tokenize:XF};function XF(t,e,n){let r=0,i;return s;function s(d){return t.enter("thematicBreak"),l(d)}function l(d){return i=d,c(d)}function c(d){return d===i?(t.enter("thematicBreakSequence"),f(d)):r>=3&&(d===null||Be(d))?(t.exit("thematicBreak"),e(d)):n(d)}function f(d){return d===i?(t.consume(d),r++,f):(t.exit("thematicBreakSequence"),dt(d)?Et(t,c,"whitespace")(d):c(d))}}const sr={continuation:{tokenize:nq},exit:iq,name:"list",tokenize:tq},QF={partial:!0,tokenize:sq},eq={partial:!0,tokenize:rq};function tq(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return c;function c(b){const S=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:vx(b)){if(r.containerState.type||(r.containerState.type=S,t.enter(S,{_container:!0})),S==="listUnordered")return t.enter("listItemPrefix"),b===42||b===45?t.check(Nh,n,d)(b):d(b);if(!r.interrupt||b===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),f(b)}return n(b)}function f(b){return vx(b)&&++l<10?(t.consume(b),f):(!r.interrupt||l<2)&&(r.containerState.marker?b===r.containerState.marker:b===41||b===46)?(t.exit("listItemValue"),d(b)):n(b)}function d(b){return t.enter("listItemMarker"),t.consume(b),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||b,t.check(Om,r.interrupt?n:p,t.attempt(QF,g,m))}function p(b){return r.containerState.initialBlankLine=!0,s++,g(b)}function m(b){return dt(b)?(t.enter("listItemPrefixWhitespace"),t.consume(b),t.exit("listItemPrefixWhitespace"),g):n(b)}function g(b){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(b)}}function nq(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Om,i,s);function i(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Et(t,e,"listItemIndent",r.containerState.size+1)(c)}function s(c){return r.containerState.furtherBlankLines||!dt(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(eq,e,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,Et(t,t.attempt(sr,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function rq(t,e,n){const r=this;return Et(t,i,"listItemIndent",r.containerState.size+1);function i(s){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?e(s):n(s)}}function iq(t){t.exit(this.containerState.type)}function sq(t,e,n){const r=this;return Et(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const l=r.events[r.events.length-1];return!dt(s)&&l&&l[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const UA={name:"setextUnderline",resolveTo:oq,tokenize:lq};function oq(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const l={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",l,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=l,t.push(["exit",l,e]),t}function lq(t,e,n){const r=this;let i;return s;function s(d){let p=r.events.length,m;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){m=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(t.enter("setextHeadingLine"),i=d,l(d)):n(d)}function l(d){return t.enter("setextHeadingLineSequence"),c(d)}function c(d){return d===i?(t.consume(d),c):(t.exit("setextHeadingLineSequence"),dt(d)?Et(t,f,"lineSuffix")(d):f(d))}function f(d){return d===null||Be(d)?(t.exit("setextHeadingLine"),e(d)):n(d)}}const aq={tokenize:cq};function cq(t){const e=this,n=t.attempt(Om,r,t.attempt(this.parser.constructs.flowInitial,i,Et(t,t.attempt(this.parser.constructs.flow,i,t.attempt(pF,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const uq={resolveAll:P2()},fq=V2("string"),dq=V2("text");function V2(t){return{resolveAll:P2(t==="text"?hq:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,l,c);return l;function l(p){return d(p)?s(p):c(p)}function c(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),f}function f(p){return d(p)?(n.exit("data"),s(p)):(n.consume(p),f)}function d(p){if(p===null)return!0;const m=i[p];let g=-1;if(m)for(;++g<m.length;){const b=m[g];if(!b.previous||b.previous.call(r,r.previous))return!0}return!1}}}function P2(t){return e;function e(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(n,r):n}}function hq(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let s=i.length,l=-1,c=0,f;for(;s--;){const d=i[s];if(typeof d=="string"){for(l=d.length;d.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(d===-2)f=!0,c++;else if(d!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(c=0),c){const d={type:n===t.length||f||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?l:r.start._bufferIndex+l,_index:r.start._index+s,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(t.splice(n,0,["enter",d,e],["exit",d,e]),n+=2)}n++}return t}const pq={42:sr,43:sr,45:sr,48:sr,49:sr,50:sr,51:sr,52:sr,53:sr,54:sr,55:sr,56:sr,57:sr,62:z2},mq={91:xF},gq={[-2]:Y0,[-1]:Y0,32:Y0},yq={35:EF,42:Nh,45:[UA,Nh],60:OF,61:UA,95:Nh,96:IA,126:IA},bq={38:j2,92:L2},xq={[-5]:K0,[-4]:K0,[-3]:K0,33:KF,38:j2,42:kx,60:[G$,jF],91:GF,92:[kF,L2],93:oS,95:kx,96:aF},Sq={null:[kx,uq]},wq={null:[42,95]},vq={null:[]},kq=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:wq,contentInitial:mq,disable:vq,document:pq,flow:yq,flowInitial:gq,insideSpan:Sq,string:bq,text:xq},Symbol.toStringTag,{value:"Module"}));function Cq(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let l=[],c=[];const f={attempt:N(F),check:N(R),consume:B,enter:I,exit:ne,interrupt:N(R,{interrupt:!0})},d={code:null,containerState:{},defineSkip:v,events:[],now:S,parser:t,previous:null,sliceSerialize:g,sliceStream:b,write:m};let p=e.tokenize.call(d,f);return e.resolveAll&&s.push(e),d;function m(re){return l=Fr(l,re),C(),l[l.length-1]!==null?[]:(Z(e,0),d.events=sS(s,d.events,d),d.events)}function g(re,se){return Tq(b(re),se)}function b(re){return Eq(l,re)}function S(){const{_bufferIndex:re,_index:se,line:be,column:ue,offset:H}=r;return{_bufferIndex:re,_index:se,line:be,column:ue,offset:H}}function v(re){i[re.line]=re.column,ie()}function C(){let re;for(;r._index<l.length;){const se=l[r._index];if(typeof se=="string")for(re=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===re&&r._bufferIndex<se.length;)E(se.charCodeAt(r._bufferIndex));else E(se)}}function E(re){p=p(re)}function B(re){Be(re)?(r.line++,r.column=1,r.offset+=re===-3?2:1,ie()):re!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=re}function I(re,se){const be=se||{};return be.type=re,be.start=S(),d.events.push(["enter",be,d]),c.push(be),be}function ne(re){const se=c.pop();return se.end=S(),d.events.push(["exit",se,d]),se}function F(re,se){Z(re,se.from)}function R(re,se){se.restore()}function N(re,se){return be;function be(ue,H,L){let G,me,Te,M;return Array.isArray(ue)?V(ue):"tokenize"in ue?V([ue]):_(ue);function _(oe){return Ne;function Ne(Fe){const Ue=Fe!==null&&oe[Fe],mt=Fe!==null&&oe.null,_e=[...Array.isArray(Ue)?Ue:Ue?[Ue]:[],...Array.isArray(mt)?mt:mt?[mt]:[]];return V(_e)(Fe)}}function V(oe){return G=oe,me=0,oe.length===0?L:T(oe[me])}function T(oe){return Ne;function Ne(Fe){return M=j(),Te=oe,oe.partial||(d.currentConstruct=oe),oe.name&&d.parser.constructs.disable.null.includes(oe.name)?fe():oe.tokenize.call(se?Object.assign(Object.create(d),se):d,f,Y,fe)(Fe)}}function Y(oe){return re(Te,M),H}function fe(oe){return M.restore(),++me<G.length?T(G[me]):L}}}function Z(re,se){re.resolveAll&&!s.includes(re)&&s.push(re),re.resolve&&Ri(d.events,se,d.events.length-se,re.resolve(d.events.slice(se),d)),re.resolveTo&&(d.events=re.resolveTo(d.events,d))}function j(){const re=S(),se=d.previous,be=d.currentConstruct,ue=d.events.length,H=Array.from(c);return{from:ue,restore:L};function L(){r=re,d.previous=se,d.currentConstruct=be,d.events.length=ue,c=H,ie()}}function ie(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Eq(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let l;if(n===i)l=[t[n].slice(r,s)];else{if(l=t.slice(n,i),r>-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}s>0&&l.push(t[i].slice(0,s))}return l}function Tq(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let l;if(typeof s=="string")l=s;else switch(s){case-5:{l="\r";break}case-4:{l=`
|
|
298
|
-
`;break}case-3:{l=`\r
|
|
299
|
-
`;break}case-2:{l=e?" ":" ";break}case-1:{if(!e&&i)continue;l=" ";break}default:l=String.fromCharCode(s)}i=s===-2,r.push(l)}return r.join("")}function Aq(t){const r={constructs:z$([kq,...(t||{}).extensions||[]]),content:i(P$),defined:[],document:i(F$),flow:i(aq),lazy:{},string:i(fq),text:i(dq)};return r;function i(s){return l;function l(c){return Cq(r,s,c)}}}function Mq(t){for(;!I2(t););return t}const HA=/[\0\t\n\r]/g;function Oq(){let t=1,e="",n=!0,r;return i;function i(s,l,c){const f=[];let d,p,m,g,b;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(l||void 0).decode(s)),m=0,e="",n&&(s.charCodeAt(0)===65279&&m++,n=void 0);m<s.length;){if(HA.lastIndex=m,d=HA.exec(s),g=d&&d.index!==void 0?d.index:s.length,b=s.charCodeAt(g),!d){e=s.slice(m);break}if(b===10&&m===g&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),m<g&&(f.push(s.slice(m,g)),t+=g-m),b){case 0:{f.push(65533),t++;break}case 9:{for(p=Math.ceil(t/4)*4,f.push(-2);t++<p;)f.push(-1);break}case 10:{f.push(-4),t=1;break}default:r=!0,t=1}m=g+1}return c&&(r&&f.push(-5),e&&f.push(e),f.push(null)),f}}const _q=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Dq(t){return t.replace(_q,Rq)}function Rq(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return N2(n.slice(s?2:1),s?16:10)}return iS(n)||t}const $2={}.hasOwnProperty;function Nq(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),zq(n)(Mq(Aq(n).document().write(Oq()(t,e,!0))))}function zq(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(hr),autolinkProtocol:j,autolinkEmail:j,atxHeading:s(Nt),blockQuote:s(mt),characterEscape:j,characterReference:j,codeFenced:s(_e),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:s(_e,l),codeText:s(ze,l),codeTextData:j,data:j,codeFlowValue:j,definition:s(Lt),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:s(Rt),hardBreakEscape:s(wn),hardBreakTrailing:s(wn),htmlFlow:s(ei,l),htmlFlowData:j,htmlText:s(ei,l),htmlTextData:j,image:s(dr),label:l,link:s(hr),listItem:s(Jt),listItemValue:g,listOrdered:s(Jn,m),listUnordered:s(Jn),paragraph:s(di),reference:T,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:s(Nt),strong:s(ys),thematicBreak:s(pr)},exit:{atxHeading:f(),atxHeadingSequence:F,autolink:f(),autolinkEmail:Ue,autolinkProtocol:Fe,blockQuote:f(),characterEscapeValue:ie,characterReferenceMarkerHexadecimal:fe,characterReferenceMarkerNumeric:fe,characterReferenceValue:oe,characterReference:Ne,codeFenced:f(C),codeFencedFence:v,codeFencedFenceInfo:b,codeFencedFenceMeta:S,codeFlowValue:ie,codeIndented:f(E),codeText:f(H),codeTextData:ie,data:ie,definition:f(),definitionDestinationString:ne,definitionLabelString:B,definitionTitleString:I,emphasis:f(),hardBreakEscape:f(se),hardBreakTrailing:f(se),htmlFlow:f(be),htmlFlowData:ie,htmlText:f(ue),htmlTextData:ie,image:f(G),label:Te,labelText:me,lineEnding:re,link:f(L),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:Y,resourceDestinationString:M,resourceTitleString:_,resource:V,setextHeading:f(Z),setextHeadingLineSequence:N,setextHeadingText:R,strong:f(),thematicBreak:f()}};F2(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(J){let de={type:"root",children:[]};const Ae={stack:[de],tokenStack:[],config:e,enter:c,exit:d,buffer:l,resume:p,data:n},K=[];let pe=-1;for(;++pe<J.length;)if(J[pe][1].type==="listOrdered"||J[pe][1].type==="listUnordered")if(J[pe][0]==="enter")K.push(pe);else{const De=K.pop();pe=i(J,De,pe)}for(pe=-1;++pe<J.length;){const De=e[J[pe][0]];$2.call(De,J[pe][1].type)&&De[J[pe][1].type].call(Object.assign({sliceSerialize:J[pe][2].sliceSerialize},Ae),J[pe][1])}if(Ae.tokenStack.length>0){const De=Ae.tokenStack[Ae.tokenStack.length-1];(De[1]||VA).call(Ae,void 0,De[0])}for(de.position={start:qs(J.length>0?J[0][1].start:{line:1,column:1,offset:0}),end:qs(J.length>0?J[J.length-2][1].end:{line:1,column:1,offset:0})},pe=-1;++pe<e.transforms.length;)de=e.transforms[pe](de)||de;return de}function i(J,de,Ae){let K=de-1,pe=-1,De=!1,Je,Re,Ie,le;for(;++K<=Ae;){const Ze=J[K];switch(Ze[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ze[0]==="enter"?pe++:pe--,le=void 0;break}case"lineEndingBlank":{Ze[0]==="enter"&&(Je&&!le&&!pe&&!Ie&&(Ie=K),le=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:le=void 0}if(!pe&&Ze[0]==="enter"&&Ze[1].type==="listItemPrefix"||pe===-1&&Ze[0]==="exit"&&(Ze[1].type==="listUnordered"||Ze[1].type==="listOrdered")){if(Je){let It=K;for(Re=void 0;It--;){const vn=J[It];if(vn[1].type==="lineEnding"||vn[1].type==="lineEndingBlank"){if(vn[0]==="exit")continue;Re&&(J[Re][1].type="lineEndingBlank",De=!0),vn[1].type="lineEnding",Re=It}else if(!(vn[1].type==="linePrefix"||vn[1].type==="blockQuotePrefix"||vn[1].type==="blockQuotePrefixWhitespace"||vn[1].type==="blockQuoteMarker"||vn[1].type==="listItemIndent"))break}Ie&&(!Re||Ie<Re)&&(Je._spread=!0),Je.end=Object.assign({},Re?J[Re][1].start:Ze[1].end),J.splice(Re||K,0,["exit",Je,Ze[2]]),K++,Ae++}if(Ze[1].type==="listItemPrefix"){const It={type:"listItem",_spread:!1,start:Object.assign({},Ze[1].start),end:void 0};Je=It,J.splice(K,0,["enter",It,Ze[2]]),K++,Ae++,Ie=void 0,le=!0}}}return J[de][1]._spread=De,Ae}function s(J,de){return Ae;function Ae(K){c.call(this,J(K),K),de&&de.call(this,K)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(J,de,Ae){this.stack[this.stack.length-1].children.push(J),this.stack.push(J),this.tokenStack.push([de,Ae||void 0]),J.position={start:qs(de.start),end:void 0}}function f(J){return de;function de(Ae){J&&J.call(this,Ae),d.call(this,Ae)}}function d(J,de){const Ae=this.stack.pop(),K=this.tokenStack.pop();if(K)K[0].type!==J.type&&(de?de.call(this,J,K[0]):(K[1]||VA).call(this,J,K[0]));else throw new Error("Cannot close `"+J.type+"` ("+_u({start:J.start,end:J.end})+"): it’s not open");Ae.position.end=qs(J.end)}function p(){return R$(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function g(J){if(this.data.expectingFirstListItemValue){const de=this.stack[this.stack.length-2];de.start=Number.parseInt(this.sliceSerialize(J),10),this.data.expectingFirstListItemValue=void 0}}function b(){const J=this.resume(),de=this.stack[this.stack.length-1];de.lang=J}function S(){const J=this.resume(),de=this.stack[this.stack.length-1];de.meta=J}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const J=this.resume(),de=this.stack[this.stack.length-1];de.value=J.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const J=this.resume(),de=this.stack[this.stack.length-1];de.value=J.replace(/(\r?\n|\r)$/g,"")}function B(J){const de=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=de,Ae.identifier=Da(this.sliceSerialize(J)).toLowerCase()}function I(){const J=this.resume(),de=this.stack[this.stack.length-1];de.title=J}function ne(){const J=this.resume(),de=this.stack[this.stack.length-1];de.url=J}function F(J){const de=this.stack[this.stack.length-1];if(!de.depth){const Ae=this.sliceSerialize(J).length;de.depth=Ae}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function N(J){const de=this.stack[this.stack.length-1];de.depth=this.sliceSerialize(J).codePointAt(0)===61?1:2}function Z(){this.data.setextHeadingSlurpLineEnding=void 0}function j(J){const Ae=this.stack[this.stack.length-1].children;let K=Ae[Ae.length-1];(!K||K.type!=="text")&&(K=qt(),K.position={start:qs(J.start),end:void 0},Ae.push(K)),this.stack.push(K)}function ie(J){const de=this.stack.pop();de.value+=this.sliceSerialize(J),de.position.end=qs(J.end)}function re(J){const de=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ae=de.children[de.children.length-1];Ae.position.end=qs(J.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(de.type)&&(j.call(this,J),ie.call(this,J))}function se(){this.data.atHardBreak=!0}function be(){const J=this.resume(),de=this.stack[this.stack.length-1];de.value=J}function ue(){const J=this.resume(),de=this.stack[this.stack.length-1];de.value=J}function H(){const J=this.resume(),de=this.stack[this.stack.length-1];de.value=J}function L(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=de,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function G(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=de,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function me(J){const de=this.sliceSerialize(J),Ae=this.stack[this.stack.length-2];Ae.label=Dq(de),Ae.identifier=Da(de).toLowerCase()}function Te(){const J=this.stack[this.stack.length-1],de=this.resume(),Ae=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ae.type==="link"){const K=J.children;Ae.children=K}else Ae.alt=de}function M(){const J=this.resume(),de=this.stack[this.stack.length-1];de.url=J}function _(){const J=this.resume(),de=this.stack[this.stack.length-1];de.title=J}function V(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function Y(J){const de=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=de,Ae.identifier=Da(this.sliceSerialize(J)).toLowerCase(),this.data.referenceType="full"}function fe(J){this.data.characterReferenceType=J.type}function oe(J){const de=this.sliceSerialize(J),Ae=this.data.characterReferenceType;let K;Ae?(K=N2(de,Ae==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):K=iS(de);const pe=this.stack[this.stack.length-1];pe.value+=K}function Ne(J){const de=this.stack.pop();de.position.end=qs(J.end)}function Fe(J){ie.call(this,J);const de=this.stack[this.stack.length-1];de.url=this.sliceSerialize(J)}function Ue(J){ie.call(this,J);const de=this.stack[this.stack.length-1];de.url="mailto:"+this.sliceSerialize(J)}function mt(){return{type:"blockquote",children:[]}}function _e(){return{type:"code",lang:null,meta:null,value:""}}function ze(){return{type:"inlineCode",value:""}}function Lt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Rt(){return{type:"emphasis",children:[]}}function Nt(){return{type:"heading",depth:0,children:[]}}function wn(){return{type:"break"}}function ei(){return{type:"html",value:""}}function dr(){return{type:"image",title:null,url:"",alt:null}}function hr(){return{type:"link",title:null,url:"",children:[]}}function Jn(J){return{type:"list",ordered:J.type==="listOrdered",start:null,spread:J._spread,children:[]}}function Jt(J){return{type:"listItem",spread:J._spread,checked:null,children:[]}}function di(){return{type:"paragraph",children:[]}}function ys(){return{type:"strong",children:[]}}function qt(){return{type:"text",value:""}}function pr(){return{type:"thematicBreak"}}}function qs(t){return{line:t.line,column:t.column,offset:t.offset}}function F2(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?F2(t,r):Lq(t,r)}}function Lq(t,e){let n;for(n in e)if($2.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function VA(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+_u({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+_u({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+_u({start:e.start,end:e.end})+") is still open")}function jq(t){const e=this;e.parser=n;function n(r){return Nq(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Iq(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function Bq(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
300
|
-
`}]}function Uq(t,e){const n=e.value?e.value+`
|
|
301
|
-
`:"",r={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function Hq(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Vq(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Pq(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=oc(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let l,c=t.footnoteCounts.get(r);c===void 0?(c=0,t.footnoteOrder.push(r),l=t.footnoteOrder.length):l=s+1,c+=1,t.footnoteCounts.set(r,c);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};t.patch(e,f);const d={type:"element",tagName:"sup",properties:{},children:[f]};return t.patch(e,d),t.applyData(e,d)}function $q(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Fq(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function q2(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=r:i.push({type:"text",value:r}),i}function qq(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return q2(t,e);const i={src:oc(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function Yq(t,e){const n={src:oc(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function Kq(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function Wq(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return q2(t,e);const i={href:oc(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function Gq(t,e){const n={href:oc(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Zq(t,e,n){const r=t.all(e),i=n?Jq(n):Y2(e),s={},l=[];if(typeof e.checked=="boolean"){const p=r[0];let m;p&&p.type==="element"&&p.tagName==="p"?m=p:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let c=-1;for(;++c<r.length;){const p=r[c];(i||c!==0||p.type!=="element"||p.tagName!=="p")&&l.push({type:"text",value:`
|
|
302
|
-
`}),p.type==="element"&&p.tagName==="p"&&!i?l.push(...p.children):l.push(p)}const f=r[r.length-1];f&&(i||f.type!=="element"||f.tagName!=="p")&&l.push({type:"text",value:`
|
|
303
|
-
`});const d={type:"element",tagName:"li",properties:s,children:l};return t.patch(e,d),t.applyData(e,d)}function Jq(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r<n.length;)e=Y2(n[r])}return e}function Y2(t){const e=t.spread;return e??t.children.length>1}function Xq(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i<r.length;){const l=r[i];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,s),t.applyData(e,s)}function Qq(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function eY(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function tY(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function nY(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],l),i.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},c=eS(e.children[1]),f=T2(e.children[e.children.length-1]);c&&f&&(l.position={start:c,end:f}),i.push(l)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function rY(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,c=l?l.length:e.children.length;let f=-1;const d=[];for(;++f<c;){const m=e.children[f],g={},b=l?l[f]:void 0;b&&(g.align=b);let S={type:"element",tagName:s,properties:g,children:[]};m&&(S.children=t.all(m),t.patch(m,S),S=t.applyData(m,S)),d.push(S)}const p={type:"element",tagName:"tr",properties:{},children:t.wrap(d,!0)};return t.patch(e,p),t.applyData(e,p)}function iY(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const PA=9,$A=32;function sY(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push(FA(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(FA(e.slice(i),i>0,!1)),s.join("")}function FA(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===PA||s===$A;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===PA||s===$A;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function oY(t,e){const n={type:"text",value:sY(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function lY(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const aY={blockquote:Iq,break:Bq,code:Uq,delete:Hq,emphasis:Vq,footnoteReference:Pq,heading:$q,html:Fq,imageReference:qq,image:Yq,inlineCode:Kq,linkReference:Wq,link:Gq,listItem:Zq,list:Xq,paragraph:Qq,root:eY,strong:tY,table:nY,tableCell:iY,tableRow:rY,text:oY,thematicBreak:lY,toml:fh,yaml:fh,definition:fh,footnoteDefinition:fh};function fh(){}const K2=-1,_m=0,Ru=1,Wp=2,lS=3,aS=4,cS=5,uS=6,W2=7,G2=8,qA=typeof self=="object"?self:globalThis,cY=(t,e)=>{const n=(i,s)=>(t.set(s,i),i),r=i=>{if(t.has(i))return t.get(i);const[s,l]=e[i];switch(s){case _m:case K2:return n(l,i);case Ru:{const c=n([],i);for(const f of l)c.push(r(f));return c}case Wp:{const c=n({},i);for(const[f,d]of l)c[r(f)]=r(d);return c}case lS:return n(new Date(l),i);case aS:{const{source:c,flags:f}=l;return n(new RegExp(c,f),i)}case cS:{const c=n(new Map,i);for(const[f,d]of l)c.set(r(f),r(d));return c}case uS:{const c=n(new Set,i);for(const f of l)c.add(r(f));return c}case W2:{const{name:c,message:f}=l;return n(new qA[c](f),i)}case G2:return n(BigInt(l),i);case"BigInt":return n(Object(BigInt(l)),i);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:c}=new Uint8Array(l);return n(new DataView(c),l)}}return n(new qA[s](l),i)};return r},YA=t=>cY(new Map,t)(0),ua="",{toString:uY}={},{keys:fY}=Object,ou=t=>{const e=typeof t;if(e!=="object"||!t)return[_m,e];const n=uY.call(t).slice(8,-1);switch(n){case"Array":return[Ru,ua];case"Object":return[Wp,ua];case"Date":return[lS,ua];case"RegExp":return[aS,ua];case"Map":return[cS,ua];case"Set":return[uS,ua];case"DataView":return[Ru,n]}return n.includes("Array")?[Ru,n]:n.includes("Error")?[W2,n]:[Wp,n]},dh=([t,e])=>t===_m&&(e==="function"||e==="symbol"),dY=(t,e,n,r)=>{const i=(l,c)=>{const f=r.push(l)-1;return n.set(c,f),f},s=l=>{if(n.has(l))return n.get(l);let[c,f]=ou(l);switch(c){case _m:{let p=l;switch(f){case"bigint":c=G2,p=l.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+f);p=null;break;case"undefined":return i([K2],l)}return i([c,p],l)}case Ru:{if(f){let g=l;return f==="DataView"?g=new Uint8Array(l.buffer):f==="ArrayBuffer"&&(g=new Uint8Array(l)),i([f,[...g]],l)}const p=[],m=i([c,p],l);for(const g of l)p.push(s(g));return m}case Wp:{if(f)switch(f){case"BigInt":return i([f,l.toString()],l);case"Boolean":case"Number":case"String":return i([f,l.valueOf()],l)}if(e&&"toJSON"in l)return s(l.toJSON());const p=[],m=i([c,p],l);for(const g of fY(l))(t||!dh(ou(l[g])))&&p.push([s(g),s(l[g])]);return m}case lS:return i([c,l.toISOString()],l);case aS:{const{source:p,flags:m}=l;return i([c,{source:p,flags:m}],l)}case cS:{const p=[],m=i([c,p],l);for(const[g,b]of l)(t||!(dh(ou(g))||dh(ou(b))))&&p.push([s(g),s(b)]);return m}case uS:{const p=[],m=i([c,p],l);for(const g of l)(t||!dh(ou(g)))&&p.push(s(g));return m}}const{message:d}=l;return i([c,{name:f,message:d}],l)};return s},KA=(t,{json:e,lossy:n}={})=>{const r=[];return dY(!(e||n),!!e,new Map,r)(t),r},Gp=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?YA(KA(t,e)):structuredClone(t):(t,e)=>YA(KA(t,e));function hY(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function pY(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function mY(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||hY,r=t.options.footnoteBackLabel||pY,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",l=t.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let f=-1;for(;++f<t.footnoteOrder.length;){const d=t.footnoteById.get(t.footnoteOrder[f]);if(!d)continue;const p=t.all(d),m=String(d.identifier).toUpperCase(),g=oc(m.toLowerCase());let b=0;const S=[],v=t.footnoteCounts.get(m);for(;v!==void 0&&++b<=v;){S.length>0&&S.push({type:"text",value:" "});let B=typeof n=="string"?n:n(f,b);typeof B=="string"&&(B={type:"text",value:B}),S.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(f,b),className:["data-footnote-backref"]},children:Array.isArray(B)?B:[B]})}const C=p[p.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const B=C.children[C.children.length-1];B&&B.type==="text"?B.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...S)}else p.push(...S);const E={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(p,!0)};t.patch(d,E),c.push(E)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Gp(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
304
|
-
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(c,!0)},{type:"text",value:`
|
|
305
|
-
`}]}}const Z2=(function(t){if(t==null)return xY;if(typeof t=="function")return Dm(t);if(typeof t=="object")return Array.isArray(t)?gY(t):yY(t);if(typeof t=="string")return bY(t);throw new Error("Expected function, string, or object as test")});function gY(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=Z2(t[n]);return Dm(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function yY(t){const e=t;return Dm(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function bY(t){return Dm(e);function e(n){return n&&n.type===t}}function Dm(t){return e;function e(n,r,i){return!!(SY(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function xY(){return!0}function SY(t){return t!==null&&typeof t=="object"&&"type"in t}const J2=[],wY=!0,WA=!1,vY="skip";function kY(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=Z2(i),l=r?-1:1;c(t,void 0,[])();function c(f,d,p){const m=f&&typeof f=="object"?f:{};if(typeof m.type=="string"){const b=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(f.type+(b?"<"+b+">":""))+")"})}return g;function g(){let b=J2,S,v,C;if((!e||s(f,d,p[p.length-1]||void 0))&&(b=CY(n(f,p)),b[0]===WA))return b;if("children"in f&&f.children){const E=f;if(E.children&&b[0]!==vY)for(v=(r?E.children.length:-1)+l,C=p.concat(E);v>-1&&v<E.children.length;){const B=E.children[v];if(S=c(B,v,C)(),S[0]===WA)return S;v=typeof S[1]=="number"?S[1]:v+l}}return b}}}function CY(t){return Array.isArray(t)?t:typeof t=="number"?[wY,t]:t==null?J2:[t]}function X2(t,e,n,r){let i,s,l;typeof e=="function"&&typeof n!="function"?(s=void 0,l=e,i=n):(s=e,l=n,i=r),kY(t,s,c,i);function c(f,d){const p=d[d.length-1],m=p?p.children.indexOf(f):void 0;return l(f,m,p)}}const Cx={}.hasOwnProperty,EY={};function TY(t,e){const n=e||EY,r=new Map,i=new Map,s=new Map,l={...aY,...n.handlers},c={all:d,applyData:MY,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:l,one:f,options:n,patch:AY,wrap:_Y};return X2(t,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const m=p.type==="definition"?r:i,g=String(p.identifier).toUpperCase();m.has(g)||m.set(g,p)}}),c;function f(p,m){const g=p.type,b=c.handlers[g];if(Cx.call(c.handlers,g)&&b)return b(c,p,m);if(c.options.passThrough&&c.options.passThrough.includes(g)){if("children"in p){const{children:v,...C}=p,E=Gp(C);return E.children=c.all(p),E}return Gp(p)}return(c.options.unknownHandler||OY)(c,p,m)}function d(p){const m=[];if("children"in p){const g=p.children;let b=-1;for(;++b<g.length;){const S=c.one(g[b],p);if(S){if(b&&g[b-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=GA(S.value)),!Array.isArray(S)&&S.type==="element")){const v=S.children[0];v&&v.type==="text"&&(v.value=GA(v.value))}Array.isArray(S)?m.push(...S):m.push(S)}}}return m}}function AY(t,e){t.position&&(e.position=u$(t))}function MY(t,e){let n=e;if(t&&t.data){const r=t.data.hName,i=t.data.hChildren,s=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&s&&Object.assign(n.properties,Gp(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function OY(t,e){const n=e.data||{},r="value"in e&&!(Cx.call(n,"hProperties")||Cx.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function _Y(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
|
|
306
|
-
`});++r<t.length;)r&&n.push({type:"text",value:`
|
|
307
|
-
`}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
|
|
308
|
-
`}),n}function GA(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function ZA(t,e){const n=TY(t,e),r=n.one(t,void 0),i=mY(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
309
|
-
`},i),s}function DY(t,e){return t&&"run"in t?async function(n,r){const i=ZA(n,{file:r,...e});await t.run(i,r)}:function(n,r){return ZA(n,{file:r,...t||e})}}function JA(t){if(t)throw t}var W0,XA;function RY(){if(XA)return W0;XA=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(d){return typeof Array.isArray=="function"?Array.isArray(d):e.call(d)==="[object Array]"},s=function(d){if(!d||e.call(d)!=="[object Object]")return!1;var p=t.call(d,"constructor"),m=d.constructor&&d.constructor.prototype&&t.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!p&&!m)return!1;var g;for(g in d);return typeof g>"u"||t.call(d,g)},l=function(d,p){n&&p.name==="__proto__"?n(d,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):d[p.name]=p.newValue},c=function(d,p){if(p==="__proto__")if(t.call(d,p)){if(r)return r(d,p).value}else return;return d[p]};return W0=function f(){var d,p,m,g,b,S,v=arguments[0],C=1,E=arguments.length,B=!1;for(typeof v=="boolean"&&(B=v,v=arguments[1]||{},C=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});C<E;++C)if(d=arguments[C],d!=null)for(p in d)m=c(v,p),g=c(d,p),v!==g&&(B&&g&&(s(g)||(b=i(g)))?(b?(b=!1,S=m&&i(m)?m:[]):S=m&&s(m)?m:{},l(v,{name:p,newValue:f(B,S,g)})):typeof g<"u"&&l(v,{name:p,newValue:g}));return v},W0}var NY=RY();const G0=Jp(NY);function Ex(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function zY(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);c(null,...i);function c(f,...d){const p=t[++s];let m=-1;if(f){l(f);return}for(;++m<i.length;)(d[m]===null||d[m]===void 0)&&(d[m]=i[m]);i=d,p?LY(p,c)(...d):l(null,...d)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function LY(t,e){let n;return r;function r(...l){const c=t.length>l.length;let f;c&&l.push(i);try{f=t.apply(this,l)}catch(d){const p=d;if(c&&n)throw p;return i(p)}c||(f&&f.then&&typeof f.then=="function"?f.then(s,i):f instanceof Error?i(f):s(f))}function i(l,...c){n||(n=!0,e(l,...c))}function s(l){i(null,l)}}const wi={basename:jY,dirname:IY,extname:BY,join:UY,sep:"/"};function jY(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Tf(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let l=-1,c=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else l<0&&(s=!0,l=i+1),c>-1&&(t.codePointAt(i)===e.codePointAt(c--)?c<0&&(r=i):(c=-1,r=l));return n===r?r=l:r<0&&(r=t.length),t.slice(n,r)}function IY(t){if(Tf(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function BY(t){Tf(t);let e=t.length,n=-1,r=0,i=-1,s=0,l;for(;e--;){const c=t.codePointAt(e);if(c===47){if(l){r=e+1;break}continue}n<0&&(l=!0,n=e+1),c===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function UY(...t){let e=-1,n;for(;++e<t.length;)Tf(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":HY(n)}function HY(t){Tf(t);const e=t.codePointAt(0)===47;let n=VY(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function VY(t,e){let n="",r=0,i=-1,s=0,l=-1,c,f;for(;++l<=t.length;){if(l<t.length)c=t.codePointAt(l);else{if(c===47)break;c=47}if(c===47){if(!(i===l-1||s===1))if(i!==l-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",r=0):(n=n.slice(0,f),r=n.length-1-n.lastIndexOf("/")),i=l,s=0;continue}}else if(n.length>0){n="",r=0,i=l,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,l):n=t.slice(i+1,l),r=l-i-1;i=l,s=0}else c===46&&s>-1?s++:s=-1}return n}function Tf(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const PY={cwd:$Y};function $Y(){return"/"}function Tx(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function FY(t){if(typeof t=="string")t=new URL(t);else if(!Tx(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return qY(t)}function qY(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const Z0=["history","path","basename","stem","extname","dirname"];class Q2{constructor(e){let n;e?Tx(e)?n={path:e}:typeof e=="string"||YY(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":PY.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Z0.length;){const s=Z0[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)Z0.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?wi.basename(this.path):void 0}set basename(e){X0(e,"basename"),J0(e,"basename"),this.path=wi.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?wi.dirname(this.path):void 0}set dirname(e){QA(this.basename,"dirname"),this.path=wi.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?wi.extname(this.path):void 0}set extname(e){if(J0(e,"extname"),QA(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=wi.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Tx(e)&&(e=FY(e)),X0(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?wi.basename(this.path,this.extname):void 0}set stem(e){X0(e,"stem"),J0(e,"stem"),this.path=wi.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){const i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){const i=new $n(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function J0(t,e){if(t&&t.includes(wi.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+wi.sep+"`")}function X0(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function QA(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function YY(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const KY=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),WY={}.hasOwnProperty;class fS extends KY{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=zY()}copy(){const e=new fS;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(G0(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(tb("data",this.frozen),this.namespace[e]=n,this):WY.call(this.namespace,e)&&this.namespace[e]||void 0:e?(tb("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=hh(e),r=this.parser||this.Parser;return Q0("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),Q0("process",this.parser||this.Parser),eb("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,l){const c=hh(e),f=r.parse(c);r.run(f,c,function(p,m,g){if(p||!m||!g)return d(p);const b=m,S=r.stringify(b,g);JY(S)?g.value=S:g.result=S,d(p,g)});function d(p,m){p||!m?l(p):s?s(m):n(void 0,m)}}}processSync(e){let n=!1,r;return this.freeze(),Q0("processSync",this.parser||this.Parser),eb("processSync",this.compiler||this.Compiler),this.process(e,i),tM("processSync","process",n),r;function i(s,l){n=!0,JA(s),r=l}}run(e,n,r){eM(e),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(l,c){const f=hh(n);i.run(e,f,d);function d(p,m,g){const b=m||e;p?c(p):l?l(b):r(void 0,b,g)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),tM("runSync","run",r),i;function s(l,c){JA(l),i=c,r=!0}}stringify(e,n){this.freeze();const r=hh(n),i=this.compiler||this.Compiler;return eb("stringify",i),eM(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(tb("use",this.frozen),e!=null)if(typeof e=="function")f(e,n);else if(typeof e=="object")Array.isArray(e)?c(e):l(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(d){if(typeof d=="function")f(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[p,...m]=d;f(p,m)}else l(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function l(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(d.plugins),d.settings&&(i.settings=G0(!0,i.settings,d.settings))}function c(d){let p=-1;if(d!=null)if(Array.isArray(d))for(;++p<d.length;){const m=d[p];s(m)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function f(d,p){let m=-1,g=-1;for(;++m<r.length;)if(r[m][0]===d){g=m;break}if(g===-1)r.push([d,...p]);else if(p.length>0){let[b,...S]=p;const v=r[g][1];Ex(v)&&Ex(b)&&(b=G0(!0,v,b)),r[g]=[d,b,...S]}}}}const GY=new fS().freeze();function Q0(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function eb(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function tb(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function eM(t){if(!Ex(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function tM(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function hh(t){return ZY(t)?t:new Q2(t)}function ZY(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function JY(t){return typeof t=="string"||XY(t)}function XY(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const QY="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",nM=[],rM={allowDangerousHtml:!0},eK=/^(https?|ircs?|mailto|xmpp)$/i,tK=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function nK(t){const e=rK(t),n=iK(t);return sK(e.runSync(e.parse(n),n),t)}function rK(t){const e=t.rehypePlugins||nM,n=t.remarkPlugins||nM,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...rM}:rM;return GY().use(jq).use(n).use(DY,r).use(e)}function iK(t){const e=t.children||"",n=new Q2;return typeof e=="string"&&(n.value=e),n}function sK(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,l=e.skipHtml,c=e.unwrapDisallowed,f=e.urlTransform||oK;for(const p of tK)Object.hasOwn(e,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+QY+p.id,void 0);return X2(t,d),m$(t,{Fragment:k.Fragment,components:i,ignoreInvalidStyle:!0,jsx:k.jsx,jsxs:k.jsxs,passKeys:!0,passNode:!0});function d(p,m,g){if(p.type==="raw"&&g&&typeof m=="number")return l?g.children.splice(m,1):g.children[m]={type:"text",value:p.value},m;if(p.type==="element"){let b;for(b in q0)if(Object.hasOwn(q0,b)&&Object.hasOwn(p.properties,b)){const S=p.properties[b],v=q0[b];(v===null||v.includes(p.tagName))&&(p.properties[b]=f(String(S||""),b,p))}}if(p.type==="element"){let b=n?!n.includes(p.tagName):s?s.includes(p.tagName):!1;if(!b&&r&&typeof m=="number"&&(b=!r(p,m,g)),b&&g&&typeof m=="number")return c&&p.children?g.children.splice(m,1,...p.children):g.children.splice(m,1),m}}}function oK(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),i=t.indexOf("/");return e===-1||i!==-1&&e>i||n!==-1&&e>n||r!==-1&&e>r||eK.test(t.slice(0,e))?t:""}const lK={width:"5px",height:"5px",borderRadius:"50%",background:Ox},aK=[0,.2,.4];function nb({ctrlYdoc:t,editor:e,activeDocId:n,openDocs:r,claudeActive:i,claudeStatus:s,visible:l,capturedAnchor:c,onCapturedAnchorChange:f,inputRef:d,reduceMotion:p}){const m=p?"auto":"smooth",[g,b]=O.useState([]),[S,v]=O.useState(""),C=O.useRef(null),E=O.useRef(null);O.useEffect(()=>{d&&(d.current=E.current)},[d]),O.useEffect(()=>{if(!t)return;const j=t.getMap(yC),ie=()=>{const re=[];j.forEach(se=>{re.push(se)}),re.sort((se,be)=>se.timestamp-be.timestamp||se.id.localeCompare(be.id)),b(re)};return j.observe(ie),ie(),()=>j.unobserve(ie)},[t]);const B=O.useRef(!1);O.useEffect(()=>{var j;if(!i&&B.current){B.current=!1;return}B.current=!!i,(j=C.current)==null||j.scrollIntoView({behavior:m})},[g,i,m]),O.useEffect(()=>{var j;l&&((j=C.current)==null||j.scrollIntoView({behavior:m}))},[l,m]);const I=O.useCallback(()=>{if(!t||!S.trim())return;const j=t.getMap(yC),ie={id:UV(),author:"user",text:S.trim(),timestamp:Date.now(),...n?{documentId:n}:{},...c?{anchor:c}:{},read:!1};j.set(ie.id,ie),v(""),f(null)},[t,S,n,c,f]),ne=O.useCallback(j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),I())},[I]),F=O.useCallback((j,ie)=>{if(!(!e||ie&&ie!==n))try{const re=gl(e.state.doc,j.from),se=gl(e.state.doc,j.to);e.chain().focus().setTextSelection({from:re,to:se}).scrollIntoView().run()}catch(re){console.warn("[ChatPanel] Could not scroll to anchor:",re instanceof Error?re.message:re)}},[e,n]),R=j=>{if(!j)return null;const ie=r.find(re=>re.id===j);return(ie==null?void 0:ie.fileName)??null},N=g.filter(j=>j.author==="claude"&&!j.read).length,Z=O.useCallback(async()=>{try{await fetch(`http://localhost:${Ga}/api/chat`,{method:"DELETE"})}catch(j){console.warn("[ChatPanel] Failed to clear chat:",j)}},[]);return k.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",background:"#fafafa",flex:1,minHeight:0},children:[k.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid #e5e7eb",fontWeight:600,fontSize:"14px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Chat",k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[N>0&&k.jsx("span",{style:{background:"#6366f1",color:"white",borderRadius:"10px",padding:"2px 8px",fontSize:"11px"},children:N}),g.length>0&&k.jsx("button",{onClick:Z,title:"Clear chat history","data-testid":"clear-chat-btn",style:{background:"none",border:"none",cursor:"pointer",color:"#9ca3af",fontSize:"13px",padding:"2px 4px",lineHeight:1},children:"Clear"})]})]}),k.jsxs("div",{style:{flex:1,overflow:"auto",padding:"12px",minHeight:0},children:[g.length===0&&k.jsx("div",{style:{color:"#9ca3af",fontSize:"13px",textAlign:"center",marginTop:"24px"},children:"No messages yet. Select text and send a message to Claude."}),g.map(j=>k.jsxs("div",{style:{marginBottom:"12px",padding:"8px 12px",borderRadius:"8px",background:j.author==="user"?"#eef2ff":"#ffffff",border:"1px solid "+(j.author==="user"?"#c7d2fe":"#e5e7eb"),fontSize:"13px"},children:[k.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center",marginBottom:"4px"},children:[k.jsx("span",{style:{fontWeight:600,fontSize:"11px",color:j.author==="claude"?"#6366f1":"#374151",textTransform:"uppercase"},children:j.author}),j.documentId&&k.jsx("span",{style:{fontSize:"10px",color:"#6b7280",background:"#f3f4f6",padding:"1px 6px",borderRadius:"4px"},children:R(j.documentId)??j.documentId}),k.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",marginLeft:"auto"},children:new Date(j.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),j.anchor&&k.jsx("div",{onClick:()=>F(j.anchor,j.documentId),className:"chat-anchor-quote",style:{padding:"4px 8px",marginBottom:"6px",borderLeft:"3px solid #c7d2fe",background:"#f5f3ff",fontSize:"12px",color:"#4338ca",cursor:"pointer",borderRadius:"0 4px 4px 0",maxHeight:"60px",overflow:"hidden",transition:"max-height 0.3s ease"},title:"Click to scroll to this text",onMouseEnter:ie=>{ie.currentTarget.style.maxHeight="500px"},onMouseLeave:ie=>{ie.currentTarget.style.maxHeight="60px"},children:j.anchor.textSnapshot}),j.author==="claude"?k.jsx("div",{className:"chat-markdown",children:k.jsx(nK,{children:j.text})}):k.jsx("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:j.text})]},j.id)),i&&k.jsxs("div",{style:{padding:"8px 12px",marginBottom:"8px",fontSize:"12px",color:Ox,display:"flex",alignItems:"center",gap:"8px"},children:[k.jsx("span",{style:{display:"inline-flex",gap:"3px"},children:aK.map(j=>k.jsx("span",{style:{...lK,animation:`tandem-typing-bounce 1.2s ease-in-out ${j}s infinite`}},j))}),k.jsx("span",{children:s??"Claude is thinking..."})]}),k.jsx("div",{ref:C})]}),c&&k.jsxs("div",{style:{padding:"4px 12px",background:"#eef2ff",borderTop:"1px solid #c7d2fe",fontSize:"11px",color:"#4338ca",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsxs("span",{children:["with selection: “",c.textSnapshot.slice(0,40),c.textSnapshot.length>40?"...":"","”"]}),k.jsx("button",{onClick:()=>f(null),style:{background:"none",border:"none",cursor:"pointer",color:"#6b7280",fontSize:"14px"},children:"x"})]}),k.jsxs("div",{style:{padding:"8px 12px",borderTop:"1px solid #e5e7eb",display:"flex",gap:"8px"},children:[k.jsx("textarea",{ref:E,value:S,onChange:j=>v(j.target.value),onKeyDown:ne,placeholder:"Message Claude...",rows:2,style:{flex:1,padding:"8px",border:"1px solid #d1d5db",borderRadius:"6px",fontSize:"13px",resize:"none",outline:"none",fontFamily:"inherit"}}),k.jsx("button",{onClick:I,disabled:!S.trim(),style:{padding:"8px 12px",background:S.trim()?"#6366f1":"#d1d5db",color:"white",border:"none",borderRadius:"6px",cursor:S.trim()?"pointer":"default",fontSize:"13px",fontWeight:500,alignSelf:"flex-end"},children:"Send"})]}),k.jsx("style",{children:`
|
|
310
|
-
@keyframes tandem-typing-bounce {
|
|
311
|
-
0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
|
|
312
|
-
30% { transform: translateY(-4px); opacity: 1; }
|
|
313
|
-
}
|
|
314
|
-
`})]})}function cK({accepted:t,dismissed:e,total:n,onDismiss:r}){const i=n>0?Math.round(t/n*100):0;return k.jsx("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.4)",zIndex:1e3},onClick:r,children:k.jsxs("div",{style:{background:"white",borderRadius:"12px",padding:"32px 40px",maxWidth:"400px",boxShadow:"0 20px 60px rgba(0,0,0,0.2)",textAlign:"center"},onClick:s=>s.stopPropagation(),children:[k.jsx("div",{style:{fontSize:"48px",marginBottom:"8px"},children:i>=80?"✅":i>=50?"📋":"🔍"}),k.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",fontWeight:600,color:"#111827"},children:"Review Complete"}),k.jsx("p",{style:{margin:"0 0 20px",color:"#6b7280",fontSize:"14px"},children:"All annotations have been resolved."}),k.jsxs("div",{style:{display:"flex",justifyContent:"center",gap:"24px",marginBottom:"20px"},children:[k.jsxs("div",{children:[k.jsx("div",{style:{fontSize:"28px",fontWeight:700,color:"#16a34a"},children:t}),k.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Accepted"})]}),k.jsx("div",{style:{width:"1px",background:"#e5e7eb"}}),k.jsxs("div",{children:[k.jsx("div",{style:{fontSize:"28px",fontWeight:700,color:"#dc2626"},children:e}),k.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Dismissed"})]}),k.jsx("div",{style:{width:"1px",background:"#e5e7eb"}}),k.jsxs("div",{children:[k.jsxs("div",{style:{fontSize:"28px",fontWeight:700,color:"#6366f1"},children:[i,"%"]}),k.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Accept rate"})]})]}),k.jsx("button",{onClick:r,style:{padding:"8px 24px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",background:"#6366f1",color:"white",cursor:"pointer"},children:"Done"})]})})}function uK({annotations:t,activeDocFormat:e,documentId:n}){const[r,i]=O.useState(!1);if(e!=="docx")return null;const s=t.filter(d=>d.status==="accepted"),l=t.filter(d=>d.status==="pending"),c=s.length===0||r;async function f(){if(c||!n)return;let d=`Apply ${s.length} change(s) as tracked revisions?
|
|
315
|
-
|
|
316
|
-
The changes will appear as tracked revisions in Word — you can Accept or Reject each one individually.
|
|
317
|
-
|
|
318
|
-
Your original file will be backed up.`;if(l.length>0&&(d+=`
|
|
319
|
-
|
|
320
|
-
⚠ ${l.length} annotation(s) are still pending review and will not be applied.`),!!confirm(d)){i(!0);try{const p=await fetch(`${Iu}/apply-changes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:n})}),m=await p.json().catch(b=>(console.error("[ApplyChanges] Failed to parse response JSON:",b),null));if(!p.ok){alert((m==null?void 0:m.message)??`Apply failed (HTTP ${p.status}).`);return}const g=m==null?void 0:m.data;if(g){const b=[`Applied ${g.applied??0} tracked change(s).`];g.rejected>0&&b.push(`${g.rejected} could not be applied.`),g.backupPath&&b.push(`
|
|
321
|
-
Backup saved to:
|
|
322
|
-
${g.backupPath}`),alert(b.join(" "))}else alert("Changes applied successfully.")}catch(p){console.error("[ApplyChanges] Request failed:",p),alert(p instanceof TypeError?"Could not reach the server.":`Apply failed: ${p instanceof Error?p.message:String(p)}`)}finally{i(!1)}}}return k.jsx("button",{type:"button","data-testid":"apply-changes-btn",onClick:f,disabled:c,title:s.length===0?"No accepted suggestions to apply":void 0,style:{width:"100%",padding:"6px 12px",fontSize:"12px",fontWeight:500,border:"1px solid #bfdbfe",borderRadius:"4px",background:c?"#f3f4f6":"#2563eb",color:c?"#9ca3af":"white",cursor:c?"default":"pointer",opacity:r?.6:1,whiteSpace:"nowrap"},children:r?"Applying…":`Apply as Tracked Changes (${s.length})`})}function fK(t,e){O.useEffect(()=>{function n(r){if(r.ctrlKey&&r.shiftKey&&r.key==="R"){r.preventDefault(),e.onToggleReviewMode();return}if(t)if(r.key==="Tab"&&!r.ctrlKey&&!r.altKey)r.preventDefault(),e.navigateReview(r.shiftKey?"prev":"next");else if(r.key==="y"||r.key==="Y"){if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement)return;r.preventDefault(),e.acceptCurrent()}else if(r.key==="n"||r.key==="N"){if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement)return;r.preventDefault(),e.dismissCurrent()}else if(r.key==="z"||r.key==="Z"){if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement)return;r.preventDefault(),e.undoLast()}else if(r.key==="e"||r.key==="E"){if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement)return;r.preventDefault(),e.scrollToCurrentAndExit()}else r.key==="Escape"&&e.cancelBulkOrExit()}return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e])}function dK(t){const e=new Date(t),r=new Date().getTime()-e.getTime(),i=Math.floor(r/6e4);if(i<1)return"just now";if(i<60)return`${i}m ago`;const s=Math.floor(i/60);return s<24?`${s}h ago`:e.toLocaleDateString()}function hK({replies:t}){return t.length===0?null:k.jsx("div",{"data-testid":"comment-thread",style:{marginTop:"6px",paddingLeft:"8px",borderLeft:"2px solid #e5e7eb"},children:t.map(e=>k.jsxs("div",{"data-testid":`reply-${e.id}`,style:{padding:"4px 0",fontSize:"12px",lineHeight:"1.4"},children:[k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[k.jsx("span",{style:{fontWeight:600,fontSize:"11px",color:e.author==="claude"?"#6366f1":"#374151"},children:e.author==="claude"?"Claude":"You"}),k.jsxs("span",{style:{fontSize:"10px",color:"#9ca3af"},children:[e.editedAt&&k.jsx("span",{style:{fontStyle:"italic",marginRight:"4px"},children:"(edited)"}),dK(e.timestamp)]})]}),k.jsx("p",{style:{margin:0,color:"#4b5563"},children:e.text})]},e.id))})}function pK(t){return t.color?Nu[t.color]||"#e5e7eb":t.suggestedText!==void 0?"#8b5cf6":t.directedAt==="claude"?"#6366f1":t.type==="flag"?"#ef4444":"#3b82f6"}const iM=hn.memo(function({annotation:e,replies:n=[],isReviewTarget:r,onAccept:i,onDismiss:s,onUndo:l,onEdit:c,onReply:f,undoable:d,onClick:p}){const m=pK(e),g=e.status==="pending",[b,S]=O.useState(!1),[v,C]=O.useState(""),[E,B]=O.useState(""),[I,ne]=O.useState(""),[F,R]=O.useState(!1),[N,Z]=O.useState(""),[j,ie]=O.useState(!1),re=e.suggestedText!==void 0;function se(){re?(B(e.suggestedText??""),ne(e.content)):C(e.content),S(!0)}function be(){const T=re?JSON.stringify({suggestedText:E,content:I}):v;c==null||c(e.id,T),S(!1)}function ue(){S(!1)}function H(T){T.key==="Escape"&&(T.stopPropagation(),ue())}function L(T){T.key==="Escape"&&(T.stopPropagation(),R(!1),Z(""))}async function G(){const T=N.trim();if(!(!T||j)){ie(!0);try{await(f==null?void 0:f(e.id,T))!==!1&&(Z(""),R(!1))}finally{ie(!1)}}}const me={width:"100%",padding:"4px 6px",fontSize:"12px",border:"1px solid #d1d5db",borderRadius:"3px",resize:"vertical",fontFamily:"inherit",minHeight:"40px",boxSizing:"border-box"},Te={padding:"1px 4px",fontSize:"11px",border:"none",background:"none",color:"#9ca3af",cursor:"pointer",lineHeight:1},M=e.content?e.content.length>60?e.content.slice(0,57)+"...":e.content:"",_=re?"replacement":e.directedAt==="claude"?"question":e.type,V=`${_} annotation${M?": "+M:""}, ${e.status}`;return k.jsxs("div",{onClick:p,"data-testid":`annotation-card-${e.id}`,role:"listitem","aria-label":V,"aria-current":r?"true":void 0,style:{padding:"8px 10px",marginBottom:"6px",borderLeft:`3px solid ${m}`,background:r?"#eef2ff":"white",borderRadius:"0 4px 4px 0",fontSize:"13px",opacity:g?1:.6,cursor:p?"pointer":"default",outline:r?"2px solid #6366f1":"none",transition:"background 0.15s, outline 0.15s"},children:[k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[k.jsxs("span",{style:{fontWeight:500,textTransform:"capitalize",display:"flex",alignItems:"center",gap:"4px"},children:[_,!g&&k.jsx("span",{style:{marginLeft:"6px",fontSize:"10px",color:e.status==="accepted"?"#16a34a":"#dc2626",fontWeight:600},children:e.status}),g&&c&&!r&&!b&&k.jsx("button",{"data-testid":`edit-btn-${e.id}`,onClick:T=>{T.stopPropagation(),se()},style:Te,title:"Edit this annotation's content",children:"✎ Edit"})]}),k.jsxs("span",{style:{fontSize:"11px",color:"#9ca3af",display:"flex",alignItems:"center",gap:"4px"},children:[e.editedAt&&k.jsx("span",{style:{fontStyle:"italic",fontSize:"10px",color:"#b0b0b0"},children:"(edited)"}),e.author==="claude"?"Claude":e.author==="import"?"Imported":"You"]})]}),e.textSnapshot&&k.jsx("div",{"data-testid":`annotation-snippet-${e.id}`,style:{padding:"4px 8px",marginBottom:"6px",borderLeft:"3px solid #d1d5db",color:"#6b7280",fontSize:"12px",fontStyle:"italic",backgroundColor:"#f9fafb",borderRadius:"2px"},children:e.textSnapshot.length>80?e.textSnapshot.slice(0,77)+"...":e.textSnapshot}),b?k.jsxs("div",{style:{marginTop:"4px"},onClick:T=>T.stopPropagation(),children:[re?k.jsxs(k.Fragment,{children:[k.jsx("label",{style:{fontSize:"11px",color:"#6b7280",display:"block",marginBottom:"2px"},children:"Replacement text"}),k.jsx("textarea",{"data-testid":`edit-newtext-${e.id}`,value:E,onChange:T=>B(T.target.value),onKeyDown:H,style:me,autoFocus:!0}),k.jsx("label",{style:{fontSize:"11px",color:"#6b7280",display:"block",marginTop:"4px",marginBottom:"2px"},children:"Reason"}),k.jsx("textarea",{"data-testid":`edit-reason-${e.id}`,value:I,onChange:T=>ne(T.target.value),onKeyDown:H,style:me})]}):k.jsx("textarea",{"data-testid":`edit-text-${e.id}`,value:v,onChange:T=>C(T.target.value),onKeyDown:H,style:me,autoFocus:!0}),k.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"4px"},children:[k.jsx("button",{"data-testid":`edit-save-btn-${e.id}`,onClick:T=>{T.stopPropagation(),be()},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",background:"#f0fdf4",color:"#166534",cursor:"pointer"},children:"Save"}),k.jsx("button",{"data-testid":`edit-cancel-btn-${e.id}`,onClick:T=>{T.stopPropagation(),ue()},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",background:"#fff",color:"#6b7280",cursor:"pointer"},children:"Cancel"})]})]}):k.jsx("div",{style:{margin:0,color:"#4b5563",lineHeight:"1.4"},children:re?k.jsxs(k.Fragment,{children:[k.jsxs("div",{"data-testid":`suggestion-diff-${e.id}`,style:{padding:"4px 8px",marginBottom:e.content?"4px":0,backgroundColor:"#f9fafb",borderRadius:"3px",fontSize:"12px",lineHeight:"1.5"},children:[e.textSnapshot&&k.jsx("span",{style:{textDecoration:"line-through",color:"#dc2626",backgroundColor:"#fef2f2",padding:"0 2px",borderRadius:"2px"},children:e.textSnapshot}),e.textSnapshot&&" → ",k.jsx("span",{style:{color:"#166534",backgroundColor:"#f0fdf4",padding:"0 2px",borderRadius:"2px"},children:e.suggestedText})]}),e.content&&k.jsx("p",{style:{margin:0,fontSize:"12px",color:"#6b7280"},children:e.content})]}):k.jsx("p",{style:{margin:0},children:e.content||"(no note)"})}),g&&!b&&(i||s)&&k.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"6px"},children:[i&&k.jsx("button",{"data-testid":`accept-btn-${e.id}`,onClick:T=>{T.stopPropagation(),i(e.id)},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",background:"#f0fdf4",color:"#166534",cursor:"pointer"},children:"Accept"}),s&&k.jsx("button",{"data-testid":`dismiss-btn-${e.id}`,onClick:T=>{T.stopPropagation(),s(e.id)},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",background:"#fef2f2",color:"#991b1b",cursor:"pointer"},children:"Reject"})]}),!g&&d&&l&&k.jsxs("div",{style:{marginTop:"4px",position:"relative"},children:[k.jsx("button",{"data-testid":"undo-btn",onClick:T=>{T.stopPropagation(),l(e.id)},style:{padding:"1px 6px",fontSize:"11px",border:"none",background:"none",color:"#6366f1",cursor:"pointer",textDecoration:"underline"},children:"Undo"}),k.jsx("div",{"data-testid":"undo-countdown",style:{height:"2px",marginTop:"2px",borderRadius:"1px",backgroundColor:"#6366f1",animation:"undo-countdown-shrink 10s linear forwards"}}),k.jsx("style",{children:`@keyframes undo-countdown-shrink {
|
|
323
|
-
from { width: 100%; }
|
|
324
|
-
to { width: 0%; }
|
|
325
|
-
}`})]}),k.jsx(hK,{replies:n}),g&&f&&!b&&k.jsx("div",{style:{marginTop:"6px"},onClick:T=>T.stopPropagation(),children:F?k.jsxs("div",{children:[k.jsx("textarea",{"data-testid":`reply-input-${e.id}`,value:N,onChange:T=>Z(T.target.value),onKeyDown:L,placeholder:"Write a reply...",style:me,autoFocus:!0}),k.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"4px"},children:[k.jsx("button",{"data-testid":`reply-send-btn-${e.id}`,onClick:G,disabled:!N.trim()||j,style:{padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",background:N.trim()?"#eef2ff":"#f3f4f6",color:N.trim()?"#4338ca":"#9ca3af",cursor:N.trim()?"pointer":"default"},children:"Send"}),k.jsx("button",{"data-testid":`reply-cancel-btn-${e.id}`,onClick:()=>{R(!1),Z("")},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",background:"#fff",color:"#6b7280",cursor:"pointer"},children:"Cancel"})]})]}):k.jsxs("button",{"data-testid":`reply-btn-${e.id}`,onClick:()=>R(!0),style:{padding:"1px 4px",fontSize:"11px",border:"none",background:"none",color:"#9ca3af",cursor:"pointer"},children:["Reply",n.length>0?` (${n.length})`:""]})}),!g&&n.length>0&&!f&&k.jsxs("div",{style:{marginTop:"4px",fontSize:"11px",color:"#9ca3af"},children:[n.length," ",n.length===1?"reply":"replies"]})]})});function rb({value:t,onChange:e,options:n,testId:r}){return k.jsx("select",{"data-testid":r,value:t,onChange:i=>e(i.target.value),style:{padding:"2px 4px",fontSize:"11px",border:"1px solid #e5e7eb",borderRadius:"3px",background:"#fff",color:"#374151",cursor:"pointer"},children:n.map(i=>k.jsx("option",{value:i.value,children:i.label},i.value))})}const ph={padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",cursor:"pointer"};function mK(t,e,n){if(t.suggestedText===void 0)return!1;const r=t.suggestedText,i=Fp(t,e.state.doc,n);if(!i)return console.warn("[SidePanel] Could not resolve range for suggestion",t.id),!1;try{e.chain().focus().deleteRange({from:i.from,to:i.to}).insertContentAt(i.from,r).run()}catch(s){return console.error("[SidePanel] Editor mutation failed for suggestion",t.id,s),!1}return!0}function ib({annotations:t,editor:e,ydoc:n,heldCount:r=0,tandemMode:i,onModeChange:s,activeDocFormat:l,documentId:c,reviewMode:f,onToggleReviewMode:d,onExitReviewMode:p,activeAnnotationId:m,onActiveAnnotationChange:g,reduceMotion:b}){const S=b?"auto":"smooth",[v,C]=O.useState("all"),[E,B]=O.useState("all"),[I,ne]=O.useState("all"),[F,R]=O.useState(0),N=O.useRef(0),[Z,j]=O.useState(null),ie=O.useRef(Z);ie.current=Z;const re=O.useRef(null),[se,be]=O.useState(new Set),ue=O.useRef(null),H=O.useRef(new Map);O.useEffect(()=>{const K=H.current;return()=>{for(const pe of K.values())clearTimeout(pe)}},[]);const L=O.useRef(n),G=O.useRef(e);L.current=n,G.current=e;const[me,Te]=O.useState(new Map);O.useEffect(()=>{if(!n){Te(new Map);return}const K=n.getMap(Iz);function pe(){const Je=new Map;K.forEach(Re=>{const Ie=Re;if(Ie&&typeof Ie=="object"&&Ie.annotationId){const le=Je.get(Ie.annotationId)??[];le.push(Ie),Je.set(Ie.annotationId,le)}});for(const Re of Je.values())Re.sort((Ie,le)=>Ie.timestamp-le.timestamp);Te(Je)}pe();const De=()=>pe();return K.observe(De),()=>K.unobserve(De)},[n]);const{filtered:M,pending:_,resolved:V,allPending:T}=O.useMemo(()=>{const K=[],pe=[];for(const Re of t){Re.status==="pending"&&pe.push(Re);let Ie;v==="all"?Ie=!0:v==="with-replacement"?Ie=Re.suggestedText!==void 0:v==="for-claude"?Ie=Re.directedAt==="claude":Ie=Re.type===v;const le=E==="all"||Re.author===E,Ze=I==="all"||Re.status===I;Ie&&le&&Ze&&K.push(Re)}const De=K.filter(Re=>Re.status==="pending"),Je=K.filter(Re=>Re.status!=="pending");return{filtered:K,pending:De,resolved:Je,allPending:pe}},[t,v,E,I]),Y=T,fe=O.useRef(Y);fe.current=Y;function oe(K,pe){const De=L.current;if(!De)return;const Je=De.getMap(xa),Re=Je.get(K);if(!Re)return;const Ie=Eu(Re);if(Je.set(K,{...Ie,status:pe}),pe==="accepted"&&Ie.suggestedText!==void 0&&G.current&&!mK(Ie,G.current,L.current)){Je.set(K,{...Ie,status:"pending"});return}ue.current=K,be(It=>new Set(It).add(K));const le=H.current.get(K);le&&clearTimeout(le);const Ze=setTimeout(()=>{H.current.delete(K),be(It=>{const vn=new Set(It);return vn.delete(K),vn}),ue.current===K&&(ue.current=null)},1e4);H.current.set(K,Ze)}function Ne(K){const pe=L.current;if(!pe)return;const De=pe.getMap(xa),Je=De.get(K);if(!Je||Je.status==="pending")return;const Re=Eu(Je);if(Re.status==="accepted"&&Re.suggestedText!==void 0&&G.current)try{const le=Re.suggestedText,Ze=Re.textSnapshot;if(typeof le=="string"&&typeof Ze=="string"){const It=Fp(Re,G.current.state.doc,pe);if(!It){console.warn(`[undo] Cannot resolve range for annotation ${K}, skipping`);return}if(G.current.state.doc.textBetween(It.from,It.to)!==le){console.warn(`[undo] Text changed since accept for annotation ${K}, skipping`);return}G.current.chain().focus().deleteRange({from:It.from,to:It.to}).insertContentAt(It.from,Ze).run()}}catch(le){console.warn(`[undo] Failed to revert text for annotation ${K}:`,le);return}De.set(K,{...Re,status:"pending"});const Ie=H.current.get(K);Ie&&(clearTimeout(Ie),H.current.delete(K)),be(le=>{const Ze=new Set(le);return Ze.delete(K),Ze}),ue.current===K&&(ue.current=null)}function Fe(K){oe(K,"accepted")}function Ue(K){oe(K,"dismissed")}function mt(K){Ne(K)}function _e(K,pe){const De=L.current;if(!De)return;const Je=De.getMap(xa),Re=Je.get(K);if(!Re)return;const Ie=Eu(Re);if(Ie.suggestedText!==void 0){try{const le=JSON.parse(pe);Je.set(K,{...Ie,suggestedText:le.suggestedText,content:le.content,editedAt:Date.now()})}catch{console.warn(`[SidePanel] Failed to parse edit payload for annotation ${K}`)}return}Je.set(K,{...Ie,content:pe,editedAt:Date.now()})}async function ze(K,pe){try{const De=await fetch(`http://localhost:${Ga}/api/annotation-reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({annotationId:K,text:pe,documentId:c})});if(!De.ok){const Je=await De.json().catch(()=>({}));return console.warn(`[SidePanel] Reply failed (${De.status}): ${Je.message??"unknown error"}`),!1}return!0}catch(De){return console.error("[SidePanel] Reply request failed:",De),!1}}function Lt(){for(const K of _)oe(K.id,"accepted");j(null)}function Rt(){for(const K of _)oe(K.id,"dismissed");j(null)}const Nt=O.useCallback(K=>{const pe=G.current;if(!pe)return;const De=Fp(K,pe.state.doc,L.current);if(!De)return;pe.chain().focus().setTextSelection({from:De.from,to:De.to}).run();const Je=pe.view.domAtPos(De.from),Re=Je.node instanceof HTMLElement?Je.node:Je.node.parentElement;Re==null||Re.scrollIntoView({behavior:S,block:"center"})},[S]),wn=O.useCallback(K=>{const pe=fe.current;if(pe.length===0)return;let De=N.current;De=K==="next"?(De+1)%pe.length:(De-1+pe.length)%pe.length,N.current=De,R(De),Nt(pe[De])},[Nt]),ei=O.useCallback(()=>{const K=fe.current;if(K.length===0)return;const pe=K[N.current];pe&&oe(pe.id,"accepted")},[]),dr=O.useCallback(()=>{const K=fe.current;if(K.length===0)return;const pe=K[N.current];pe&&oe(pe.id,"dismissed")},[]),hr=O.useRef(!1);O.useEffect(()=>{f&&!hr.current&&Y.length>0&&(N.current=0,R(0),Nt(Y[0])),hr.current=f},[f,Y,Nt]),O.useEffect(()=>{var K;f&&Y.length>0?g(((K=Y[F])==null?void 0:K.id)??null):g(null)},[f,F,Y,g]);const Jn=O.useCallback(()=>{const pe=fe.current[N.current];pe&&Nt(pe),p()},[Nt,p]),Jt=O.useCallback(()=>{const K=ue.current;K&&Ne(K)},[]),di=O.useCallback(()=>{ie.current?j(null):p()},[p]),ys=O.useMemo(()=>({onToggleReviewMode:d,onExitReviewMode:p,navigateReview:wn,acceptCurrent:ei,dismissCurrent:dr,scrollToCurrentAndExit:Jn,cancelBulkOrExit:di,undoLast:Jt}),[d,p,wn,ei,dr,Jn,di,Jt]);fK(f,ys),O.useEffect(()=>{var K;Z&&((K=re.current)==null||K.focus())},[Z]),O.useEffect(()=>{j(null)},[v,E,I]);const qt=O.useRef(null),pr=O.useRef(!1),J=O.useRef(m);J.current=m,O.useEffect(()=>{var pe;if(!pr.current){pr.current=!0;return}const K=J.current;if(K){const De=document.querySelector(`[data-testid="annotation-card-${K}"]`);if(De){De.scrollIntoView({block:"center"});return}console.warn(`[tandem] SidePanel: active annotation ${K} not found on filter change; scrolling to top`)}(pe=qt.current)==null||pe.scrollTo({top:0})},[v,E,I]),O.useEffect(()=>{if(f&&N.current>=Y.length){const K=Math.max(0,Y.length-1);N.current=K,R(K)}},[f,Y.length]),O.useEffect(()=>{f&&Y.length===0&&p()},[f,Y.length,p]),O.useEffect(()=>{if(!m)return;const K=setTimeout(()=>{const pe=document.querySelector(`[data-testid="annotation-card-${m}"]`);if(pe){pe.scrollIntoView({behavior:S,block:"nearest"}),pe.classList.add("tandem-annotation-flash");const De=()=>pe.classList.remove("tandem-annotation-flash");pe.addEventListener("animationend",De,{once:!0})}else console.warn(`[tandem] SidePanel: active annotation ${m} not found after 50ms delay; scroll-to-card skipped`)},50);return()=>clearTimeout(K)},[m,S]);const de=v!=="all"||E!=="all"||I!=="all",Ae=f&&Y.length>0?Y[F]:null;return k.jsxs("div",{ref:qt,"data-testid":"annotation-list-scroll-container",style:{width:"100%",background:"#fafafa",display:"flex",flexDirection:"column",overflowY:"auto"},children:[r>0&&k.jsxs("div",{style:{padding:"6px 16px",background:"#fef3c7",borderBottom:"1px solid #fde68a",fontSize:"12px",color:"#92400e",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsxs("span",{"data-testid":"held-banner",children:[r," annotation",r!==1?"s":""," held"]}),k.jsx("button",{onClick:()=>s==null?void 0:s("tandem"),style:{fontSize:"11px",padding:"1px 8px",border:"1px solid #fbbf24",borderRadius:"4px",background:"#fff",color:"#92400e",cursor:"pointer",fontWeight:500},children:"Show all"})]}),k.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid #e5e7eb"},children:k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsxs("h3",{style:{fontSize:"14px",fontWeight:600,margin:0},children:["Annotations",T.length>0&&k.jsx("span",{style:{marginLeft:"8px",padding:"1px 6px",fontSize:"11px",background:"#6366f1",color:"white",borderRadius:"10px"},children:T.length})]}),k.jsxs("span",{"aria-live":"polite",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)"},children:[T.length," pending annotation",T.length!==1?"s":""]}),T.length>0&&k.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end"},children:[k.jsx("button",{"data-testid":"review-mode-btn",onClick:d,title:"Keyboard review mode (Ctrl+Shift+R)","aria-pressed":f,style:{padding:"2px 8px",fontSize:"11px",border:`1px solid ${f?"#6366f1":"#d1d5db"}`,borderRadius:"3px",background:f?"#eef2ff":"#fff",color:f?"#6366f1":"#6b7280",cursor:"pointer",fontWeight:f?600:400},children:f?"Exit Review":"Review"}),k.jsx("div",{"data-testid":"review-shortcut-hints",style:{fontSize:"10px",color:"#9ca3af",marginTop:"2px"},children:"Y / N / ↑↓ / Z"})]})]})}),f&&Y.length>0&&k.jsxs("div",{style:{padding:"8px 16px",background:"#eef2ff",borderBottom:"1px solid #e5e7eb",fontSize:"12px",color:"#4338ca"},children:[k.jsxs("div",{"aria-live":"polite",style:{fontWeight:600,marginBottom:"2px"},children:["Reviewing ",F+1," / ",Y.length]}),k.jsx("div",{style:{color:"#6366f1"},children:"Tab: next · Shift+Tab: prev · Y: accept · N: dismiss · Z: undo · E: examine · Esc: exit"})]}),k.jsxs("div",{style:{padding:"8px 16px",borderBottom:"1px solid #e5e7eb",display:"flex",gap:"4px",flexWrap:"wrap",alignItems:"center"},children:[k.jsx(rb,{testId:"filter-type",value:v,onChange:K=>C(K),options:[{value:"all",label:"All types"},{value:"highlight",label:"Highlights"},{value:"comment",label:"Comments"},{value:"with-replacement",label:"With replacement"},{value:"for-claude",label:"For Claude"},{value:"flag",label:"Flags"}]}),k.jsx(rb,{testId:"filter-author",value:E,onChange:K=>B(K),options:[{value:"all",label:"Anyone"},{value:"claude",label:"Claude"},{value:"user",label:"You"},{value:"import",label:"Imported"}]}),k.jsx(rb,{testId:"filter-status",value:I,onChange:K=>ne(K),options:[{value:"all",label:"Any status"},{value:"pending",label:"Pending"},{value:"accepted",label:"Accepted"},{value:"dismissed",label:"Dismissed"}]}),de&&k.jsx("button",{"data-testid":"clear-filters-btn",onClick:()=>{C("all"),B("all"),ne("all")},style:{background:"none",border:"none",color:"#6366f1",fontSize:"11px",cursor:"pointer",padding:"2px 4px"},children:"Clear"})]}),k.jsx("div",{style:{padding:"4px 16px 0"},children:k.jsx(uK,{annotations:t,activeDocFormat:l,documentId:c})}),_.length>1&&k.jsx("div",{style:{padding:"6px 16px",borderBottom:"1px solid #e5e7eb",display:"flex",gap:"6px",alignItems:"center"},children:Z?(()=>{const K=Z==="accept";return k.jsxs(k.Fragment,{children:[k.jsxs("span",{style:{fontSize:"11px",color:"#374151"},children:[K?"Accept":"Reject"," ",_.length===T.length?`${_.length} annotations?`:`${_.length} of ${T.length} pending?`]}),k.jsx("button",{ref:re,"data-testid":"bulk-confirm-btn",onClick:K?Lt:Rt,style:{...ph,background:K?"#f0fdf4":"#fef2f2",color:K?"#166534":"#991b1b",fontWeight:600},children:"Confirm"}),k.jsx("button",{"data-testid":"bulk-cancel-btn",onClick:()=>j(null),style:{...ph,background:"#fff",color:"#6b7280"},children:"Cancel"})]})})():k.jsxs(k.Fragment,{children:[k.jsxs("button",{"data-testid":"bulk-accept-btn",onClick:()=>j("accept"),style:{...ph,background:"#f0fdf4",color:"#166534"},children:["Accept All (",_.length,")"]}),k.jsx("button",{"data-testid":"bulk-dismiss-btn",onClick:()=>j("dismiss"),style:{...ph,background:"#fef2f2",color:"#991b1b"},children:"Reject All"})]})}),k.jsx("div",{style:{padding:"8px 16px",flex:1},role:"list","aria-label":"Annotations",children:M.length===0?k.jsx("p",{role:"status",style:{fontSize:"13px",color:"#9ca3af",marginTop:"8px"},children:de?"No annotations match filters.":"No annotations yet. Open a document to get started."}):k.jsxs(k.Fragment,{children:[_.map(K=>{const pe=(Ae==null?void 0:Ae.id)===K.id;return k.jsx(iM,{annotation:K,replies:me.get(K.id)??[],isReviewTarget:pe,onAccept:Fe,onDismiss:Ue,onEdit:_e,onReply:ze,onClick:()=>Nt(K)},K.id)}),V.length>0&&k.jsxs("details",{style:{marginTop:"12px"},children:[k.jsxs("summary",{style:{fontSize:"12px",color:"#9ca3af",cursor:"pointer"},children:[V.length," resolved"]}),k.jsx("div",{role:"list","aria-label":"Resolved annotations",children:V.map(K=>k.jsx(iM,{annotation:K,replies:me.get(K.id)??[],onUndo:mt,undoable:se.has(K.id),onClick:()=>Nt(K)},K.id))})]})]})}),k.jsx("style",{children:`
|
|
326
|
-
@keyframes tandem-annotation-flash {
|
|
327
|
-
0% { background-color: rgba(99, 102, 241, 0.2); }
|
|
328
|
-
100% { background-color: transparent; }
|
|
329
|
-
}
|
|
330
|
-
.tandem-annotation-flash {
|
|
331
|
-
animation: tandem-annotation-flash 0.8s ease-out;
|
|
332
|
-
}
|
|
333
|
-
@media (prefers-reduced-motion: reduce) {
|
|
334
|
-
.tandem-annotation-flash { animation: none; }
|
|
335
|
-
}
|
|
336
|
-
body.tandem-reduce-motion .tandem-annotation-flash { animation: none; }
|
|
337
|
-
`})]})}const gK=2e3;function yK({connected:t,connectionStatus:e,reconnectAttempts:n,disconnectedSince:r,claudeStatus:i,claudeActive:s,readOnly:l,documentCount:c=0,saving:f=!1}){const{userName:d,setUserName:p}=SM(),[m,g]=O.useState(d),b=O.useRef(null),S=()=>{p(m)};O.useEffect(()=>{m!==d&&document.activeElement!==b.current&&g(d)},[d,m]);const[v,C]=O.useState(!1),[E,B]=O.useState(0),I=O.useRef(t);O.useEffect(()=>{const N=I.current;if(I.current=t,t&&!N){C(!0);const Z=setTimeout(()=>C(!1),gK);return()=>clearTimeout(Z)}},[t]),O.useEffect(()=>{if(r==null){B(0);return}B(Math.floor((Date.now()-r)/1e3));const N=setInterval(()=>{B(Math.floor((Date.now()-r)/1e3))},1e3);return()=>clearInterval(N)},[r]);const ne=e==="connecting",F=t?"#22c55e":ne?"#eab308":"#ef4444";let R;if(v)R="Reconnected";else if(e==="connected")R="Connected";else if(e==="connecting"){const N=["Reconnecting…"];if(n>0||E>0){const Z=[];n>0&&Z.push(`attempt ${n}`),E>0&&Z.push(`${E}s`),N.push(`(${Z.join(", ")})`)}R=N.join(" ")}else R="Disconnected — check that the server is running";return k.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"4px 16px",height:"28px",borderTop:"1px solid #e5e7eb",background:"#fafafa",fontSize:"12px",color:"#6b7280",userSelect:"none"},children:[k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[k.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:F,display:"inline-block",animation:ne?"tandem-reconnect-pulse 1.2s ease-in-out infinite":"none"}}),k.jsx("span",{children:R}),c>0&&k.jsxs("span",{style:{color:"#9ca3af"},children:[c," doc",c!==1?"s":""," open"]}),f&&k.jsx("span",{"data-testid":"save-indicator",style:{color:"#6366f1",fontStyle:"italic"},children:"Saving..."})]}),k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"11px",color:"#9ca3af"},children:[k.jsx("span",{children:"You:"}),k.jsx("input",{ref:b,"data-testid":"user-name-input",type:"text",value:m,onChange:N=>g(N.target.value),onBlur:S,onKeyDown:N=>{N.key==="Enter"&&N.currentTarget.blur(),N.key==="Escape"&&(g(d),N.currentTarget.blur())},"aria-label":"Display name",title:"Your display name",maxLength:hM,style:{background:"transparent",border:"none",borderBottom:"1px solid #e5e7eb",color:"#6b7280",fontSize:"11px",width:"80px",outline:"none",padding:"0 2px"}})]}),l&&k.jsx("span",{style:{padding:"1px 8px",fontSize:"11px",fontWeight:600,color:"#92400e",background:"#fef3c7",borderRadius:"9999px",border:"1px solid #fde68a"},children:"Review Only"}),k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[k.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:Ox,opacity:s?1:.4,display:"inline-block",transition:"opacity 0.3s ease",animation:s?"tandem-status-pulse 1.5s ease-in-out infinite":"none"}}),k.jsx("span",{style:{transition:"color 0.3s ease",color:s?"#4b5563":"#9ca3af"},children:i?`Claude -- ${i}`:"Claude -- idle"})]}),k.jsx("style",{children:`
|
|
338
|
-
@keyframes tandem-status-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
|
|
339
|
-
@keyframes tandem-reconnect-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
|
|
340
|
-
`})]})}function eR(t,e,n=Bz){const r=t.filter(i=>i!==e);return[e,...r].slice(0,n)}function tR(){try{const t=localStorage.getItem(_x);if(!t)return[];const e=JSON.parse(t);return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}catch(t){return console.warn("[tandem] failed to load recent files:",t),[]}}function nR(t){try{localStorage.setItem(_x,JSON.stringify(t))}catch(e){console.warn("[tandem] failed to save recent files:",e)}}function bK(){try{localStorage.removeItem(_x)}catch(t){console.warn("[tandem] failed to clear recent files:",t)}}function xK({onClose:t}){const[e,n]=O.useState("path"),[r,i]=O.useState(""),[s,l]=O.useState(null),[c,f]=O.useState(!1),[d,p]=O.useState(!1),m=O.useRef(null),[g,b]=O.useState(tR),S=O.useCallback(F=>{b(R=>{const N=eR(R,F);return nR(N),N})},[]),v=O.useCallback(()=>{bK(),b([])},[]),C=O.useCallback(async F=>{if(!c){l(null),f(!0);try{const R=await fetch(`${Iu}/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:F})}),N=await R.json();if(!R.ok){l(N.message??"Failed to open file");return}S(F),t()}catch(R){console.error("FileOpenDialog: path open failed",R),R instanceof SyntaxError?l("Server returned an unexpected response"):R instanceof TypeError?l("Unexpected response format"):l("Cannot reach server. Is it running?")}finally{f(!1)}}},[c,t,S]),E=O.useCallback(()=>{r.trim()&&C(r.trim())},[r,C]),B=O.useCallback(async F=>{if(!c){l(null),f(!0);try{const R=await bM(F),N=await fetch(`${Iu}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:F.name,content:R})}),Z=await N.json();if(!N.ok){l(Z.message??"Failed to upload file");return}t()}catch(R){console.error("FileOpenDialog: upload failed",R),R instanceof SyntaxError?l("Server returned an unexpected response"):R instanceof TypeError?l("Unexpected response format"):l("Cannot reach server. Is it running?")}finally{f(!1)}}},[c,t]),I=O.useCallback(F=>{F.preventDefault(),p(!1);const R=F.dataTransfer.files[0];R&&B(R)},[B]),ne=O.useCallback(F=>{var N;const R=(N=F.target.files)==null?void 0:N[0];R&&B(R)},[B]);return k.jsx("div",{style:{position:"fixed",inset:0,zIndex:1e3,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"80px",background:"rgba(0,0,0,0.3)"},onClick:F=>{F.target===F.currentTarget&&t()},onKeyDown:F=>{F.key==="Escape"&&t()},children:k.jsxs("div",{style:{background:"#fff",borderRadius:"8px",boxShadow:"0 8px 30px rgba(0,0,0,0.15)",width:"440px",padding:"20px"},"data-testid":"file-open-dialog",children:[k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"16px"},children:[k.jsx("h3",{style:{margin:0,fontSize:"15px",fontWeight:600,color:"#111827"},children:"Open File"}),k.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",fontSize:"16px",color:"#9ca3af"},children:"×"})]}),k.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"16px"},children:[k.jsx("button",{onClick:()=>n("path"),style:{flex:1,padding:"6px",fontSize:"13px",border:"1px solid #e5e7eb",borderRadius:"4px",cursor:"pointer",background:e==="path"?"#6366f1":"#fff",color:e==="path"?"#fff":"#374151"},children:"File Path"}),k.jsx("button",{onClick:()=>n("upload"),style:{flex:1,padding:"6px",fontSize:"13px",border:"1px solid #e5e7eb",borderRadius:"4px",cursor:"pointer",background:e==="upload"?"#6366f1":"#fff",color:e==="upload"?"#fff":"#374151"},children:"Upload"})]}),e==="path"?k.jsxs("div",{children:[k.jsx("input",{autoFocus:!0,type:"text",placeholder:"Paste absolute file path...",value:r,onChange:F=>i(F.target.value),onKeyDown:F=>{F.key==="Enter"&&E()},style:{width:"100%",padding:"8px 10px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"4px",boxSizing:"border-box"},"data-testid":"file-path-input"}),k.jsx("button",{onClick:E,disabled:c||!r.trim(),style:{marginTop:"10px",width:"100%",padding:"8px",fontSize:"13px",fontWeight:500,border:"none",borderRadius:"4px",cursor:c?"wait":"pointer",background:c?"#9ca3af":"#6366f1",color:"#fff",opacity:r.trim()?1:.5},"data-testid":"file-open-submit",children:c?"Opening...":"Open"}),g.length>0&&k.jsxs("div",{"data-testid":"recent-files-list",style:{marginTop:"14px"},children:[k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[k.jsx("span",{style:{fontSize:"11px",color:"#9ca3af",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Recent"}),k.jsx("button",{"data-testid":"clear-recent-files",onClick:v,type:"button",style:{background:"none",border:"none",color:"#9ca3af",fontSize:"11px",cursor:"pointer",padding:0,textDecoration:"underline"},children:"Clear all"})]}),k.jsx("div",{style:{maxHeight:"150px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"2px"},children:g.map((F,R)=>{const N=F.split(/[/\\]/),Z=N.pop()??F,j=N.join("/")||"/";return k.jsxs("button",{type:"button","data-testid":`recent-file-${R}`,onClick:()=>{i(F),C(F)},style:{background:"none",border:"none",padding:"6px 8px",borderRadius:"4px",cursor:"pointer",textAlign:"left",display:"flex",flexDirection:"column",gap:"1px"},onMouseEnter:ie=>{ie.currentTarget.style.background="#f3f4f6"},onMouseLeave:ie=>{ie.currentTarget.style.background="transparent"},children:[k.jsx("span",{style:{fontSize:"13px",color:"#111827"},children:Z}),k.jsx("span",{style:{fontSize:"11px",color:"#9ca3af",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"380px"},children:j})]},F)})})]})]}):k.jsxs("div",{onDragOver:F=>{F.preventDefault(),p(!0)},onDragLeave:()=>p(!1),onDrop:I,onClick:()=>{var F;return(F=m.current)==null?void 0:F.click()},style:{border:`2px dashed ${d?"#6366f1":"#d1d5db"}`,borderRadius:"6px",padding:"32px 16px",textAlign:"center",cursor:c?"wait":"pointer",background:d?"#eef2ff":"#f9fafb",transition:"border-color 0.15s, background 0.15s"},"data-testid":"file-upload-zone",children:[k.jsx("input",{ref:m,type:"file",accept:".md,.txt,.html,.htm,.docx",onChange:ne,style:{display:"none"}}),k.jsx("div",{style:{fontSize:"13px",color:"#6b7280"},children:c?"Uploading...":"Drop a file here or click to browse"}),k.jsx("div",{style:{fontSize:"11px",color:"#9ca3af",marginTop:"6px"},children:".md, .txt, .html, .docx"})]}),s&&k.jsx("div",{style:{marginTop:"10px",padding:"8px 10px",fontSize:"12px",color:"#991b1b",background:"#fef2f2",borderRadius:"4px",border:"1px solid #fecaca"},"data-testid":"file-open-error",children:s})]})})}function SK(t){const[e,n]=O.useState(!1),r=O.useRef(0),i=O.useRef(null);return O.useEffect(()=>{if(t.readOnly){n(!1);return}const{ydoc:s}=t,l=s.getXmlFragment("default"),c=s.getMap(gh);let f=!1;const d=setTimeout(()=>{f=!0,i.current=c.get(bC)??0,r.current=0,n(!1)},500),p=()=>{f&&(r.current++,n(!0))};l.observeDeep(p);const m=()=>{if(!f)return;const g=c.get(bC);g!==void 0&&g!==i.current&&(i.current=g,r.current=0,n(!1))};return c.observe(m),()=>{clearTimeout(d),l.unobserveDeep(p),c.unobserve(m)}},[t.ydoc,t.readOnly]),e}const wK={md:"M",txt:"T",html:"H",docx:"W"};function vK({tab:t,isActive:e,onSwitch:n,onClose:r,draggable:i,onDragStart:s,onDragOver:l,onDrop:c,onDragEnd:f,onDragLeave:d,dropIndicator:p,onKeyDown:m}){const g=SK(t);return k.jsxs("div",{"data-testid":`tab-${t.id}`,"data-active":e,onClick:()=>n(t.id),draggable:i,tabIndex:0,onDragStart:b=>s(b,t.id),onDragOver:b=>l(b,t.id),onDrop:b=>c(b,t.id),onDragEnd:f,onDragLeave:d,onKeyDown:b=>m(b,t.id),style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 12px",fontSize:"13px",cursor:"pointer",background:e?"#fff":"transparent",color:e?"#111827":"#6b7280",borderTop:e?"2px solid #6366f1":"2px solid transparent",borderBottom:e?"1px solid #fff":"1px solid transparent",borderLeft:p==="left"?"2px solid #6366f1":"2px solid transparent",borderRight:p==="right"?"2px solid #6366f1":"2px solid transparent",marginBottom:"-1px",userSelect:"none",whiteSpace:"nowrap",transition:"background 0.15s, color 0.15s",flexShrink:0},children:[g&&k.jsx("span",{"data-testid":`unsaved-indicator-${t.id}`,style:{color:"#f59e0b",fontSize:"10px"},children:"●"}),k.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:e?"#6366f1":"#9ca3af",width:"14px",textAlign:"center"},children:wK[t.format]||"?"}),k.jsx("span",{"data-testid":`tab-name-${t.id}`,title:t.filePath,style:{fontWeight:e?500:400,maxWidth:"160px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.fileName}),t.readOnly&&k.jsx("span",{style:{fontSize:"9px",color:"#92400e",background:"#fef3c7",padding:"0 3px",borderRadius:"2px"},children:"RO"}),k.jsx("button",{onClick:b=>{b.stopPropagation(),r(t.id)},onDragOver:b=>{b.stopPropagation(),b.preventDefault()},onDrop:b=>{b.stopPropagation(),b.preventDefault()},style:{background:"none",border:"none",cursor:"pointer",fontSize:"14px",lineHeight:1,color:"#9ca3af",padding:"0 2px",borderRadius:"2px"},onMouseEnter:b=>b.currentTarget.style.color="#ef4444",onMouseLeave:b=>b.currentTarget.style.color="#9ca3af",title:"Close document",children:"×"})]})}const Ax="tandem-tab-scroll-hide";function kK(){return k.jsx("style",{children:`
|
|
341
|
-
.${Ax} {
|
|
342
|
-
scrollbar-width: none;
|
|
343
|
-
-ms-overflow-style: none;
|
|
344
|
-
}
|
|
345
|
-
.${Ax}::-webkit-scrollbar {
|
|
346
|
-
display: none;
|
|
347
|
-
}
|
|
348
|
-
`})}const rR={display:"flex",alignItems:"center",justifyContent:"center",width:"28px",minWidth:"28px",background:"linear-gradient(to right, #f3f4f6 70%, transparent)",border:"none",cursor:"pointer",fontSize:"12px",color:"#6b7280",padding:0,zIndex:1},CK={...rR,background:"linear-gradient(to left, #f3f4f6 70%, transparent)"};function EK({tabs:t,activeTabId:e,onTabSwitch:n,onTabClose:r,reorder:i,reduceMotion:s}){const l=s?"auto":"smooth",[c,f]=O.useState(!1),d=O.useRef(new Set);O.useEffect(()=>{const H=new Set(t.map(L=>L.id));for(const L of d.current)H.has(L)||d.current.delete(L)},[t]);const p=O.useCallback(H=>{d.current.has(H)||(d.current.add(H),r(H))},[r]),m=O.useRef(null),[g,b]=O.useState(!1),[S,v]=O.useState(!1),[C,E]=O.useState(null),[B,I]=O.useState(null);function ne(){E(null),I(null)}const F=O.useCallback(()=>{const H=m.current;H&&(b(H.scrollLeft>0),v(H.scrollLeft+H.clientWidth<H.scrollWidth-1))},[]);O.useEffect(()=>{const H=m.current;if(!H)return;F(),H.addEventListener("scroll",F,{passive:!0});const L=new ResizeObserver(F);return L.observe(H),()=>{H.removeEventListener("scroll",F),L.disconnect()}},[F]),O.useEffect(()=>{F()},[t.length,F]),O.useEffect(()=>{if(!e||!m.current)return;const H=m.current.querySelector(`[data-testid="tab-${e}"]`);H&&H.scrollIntoView({inline:"nearest",block:"nearest",behavior:l})},[e,l]),O.useEffect(()=>{ne()},[t.length]);const R=O.useCallback((H,L)=>{E(L),H.dataTransfer.setData("text/plain",L),H.dataTransfer.effectAllowed="move"},[]),N=O.useCallback((H,L)=>{if(H.preventDefault(),!C||C===L){I(null);return}const G=H.currentTarget.getBoundingClientRect(),me=G.left+G.width/2,Te=H.clientX<me?"left":"right";I({id:L,side:Te})},[C]),Z=O.useCallback((H,L)=>{H.preventDefault();const G=H.dataTransfer.getData("text/plain");if(G&&G!==L&&i){const me=H.currentTarget.getBoundingClientRect(),Te=me.left+me.width/2,M=H.clientX<Te?"left":"right";i(G,L,M)}ne()},[i]),j=O.useCallback(()=>{ne()},[]),ie=O.useCallback(()=>{I(null)},[]),re=O.useCallback((H,L)=>{if(!H.altKey||!i||H.key!=="ArrowLeft"&&H.key!=="ArrowRight")return;H.preventDefault();const G=t.findIndex(me=>me.id===L);G!==-1&&(H.key==="ArrowLeft"&&G>0?i(L,t[G-1].id):H.key==="ArrowRight"&&G<t.length-1&&i(t[G+1].id,L))},[t,i]),se=O.useCallback(()=>{var H;(H=m.current)==null||H.scrollBy({left:-150,behavior:l})},[l]),be=O.useCallback(()=>{var H;(H=m.current)==null||H.scrollBy({left:150,behavior:l})},[l]),ue=t.length<=1;return k.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",background:"#f3f4f6",borderBottom:"1px solid #e5e7eb",minHeight:"32px"},children:[k.jsx(kK,{}),g&&k.jsx("button",{"data-testid":"tab-scroll-left",onClick:se,style:rR,title:"Scroll tabs left",children:"◀"}),k.jsx("div",{ref:m,"data-testid":"tab-scroll-container",className:Ax,style:{display:"flex",alignItems:"center",gap:"1px",flex:1,overflowX:"auto",overflowY:"hidden",padding:"0 4px"},children:t.map(H=>k.jsx(vK,{tab:H,isActive:H.id===e,onSwitch:n,onClose:p,draggable:!ue,onDragStart:R,onDragOver:N,onDrop:Z,onDragEnd:j,onDragLeave:ie,dropIndicator:(B==null?void 0:B.id)===H.id?B.side:null,onKeyDown:re},H.id))}),S&&k.jsx("button",{"data-testid":"tab-scroll-right",onClick:be,style:CK,title:"Scroll tabs right",children:"▶"}),k.jsx("button",{onClick:()=>f(!0),"data-testid":"open-file-btn",title:"Open file",style:{background:"none",border:"1px solid #d1d5db",borderRadius:"4px",cursor:"pointer",fontSize:"16px",lineHeight:1,color:"#6b7280",padding:"2px 8px",marginLeft:"4px",marginRight:"8px",flexShrink:0},onMouseEnter:H=>{H.currentTarget.style.color="#6366f1",H.currentTarget.style.borderColor="#6366f1"},onMouseLeave:H=>{H.currentTarget.style.color="#6b7280",H.currentTarget.style.borderColor="#d1d5db"},children:"+"}),c&&k.jsx(xK,{onClose:()=>f(!1)})]})}function sM({connected:t,claudeActive:e}){const[n,r]=O.useState(!1);return O.useEffect(()=>{if(t){r(!1);return}const i=setTimeout(()=>r(!0),_z);return()=>clearTimeout(i)},[t]),k.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"#9ca3af",gap:"8px"},children:n?k.jsx("span",{children:"Cannot reach the Tandem server. Is it running?"}):k.jsxs(k.Fragment,{children:[k.jsx("span",{children:"No document open. Click + in the tab bar or drop a file here."}),t&&!e&&k.jsx("span",{style:{fontSize:"0.85em",color:"#b0b8c4"},children:"Tip: open Claude Code in this directory to start collaborating"})]})})}function TK({onDismiss:t}){return k.jsxs("div",{style:{padding:"8px 16px",background:"#fef2f2",borderBottom:"1px solid #fca5a5",fontSize:"13px",color:"#991b1b",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",gap:"12px"},children:[k.jsx("span",{children:"Connection to the Tandem server has been lost. Ensure the server is running."}),k.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"#991b1b",fontSize:"16px",lineHeight:1,padding:"0 4px"},"aria-label":"Dismiss connection banner",children:"\\u00d7"})]})}const iR=200,sR=600,oR=300;function mh(t){const e=aM[t];try{const n=localStorage.getItem(e);if(n){const r=parseInt(n,10);if(Number.isFinite(r))return Math.max(iR,Math.min(sR,r));console.warn(`[tandem] ignoring non-numeric panel width for ${e}: ${n}`)}}catch(n){console.warn(`[tandem] localStorage unavailable reading ${e}:`,n)}return oR}function AK(){AP();const{tabs:t,activeTabId:e,setActiveTabId:n,handleTabClose:r,connected:i,connectionStatus:s,reconnectAttempts:l,disconnectedSince:c,annotations:f,claudeStatus:d,claudeActive:p,readOnly:m,bootstrapYdoc:g,ready:b,serverRestarted:S}=H7(),{orderedTabs:v,reorder:C}=pP(t);dP(v,e,n),O.useEffect(()=>{if(t.length!==0)try{const ye=tR();let St=ye;for(const Yt of t)Yt.filePath.startsWith("upload://")||(St=eR(St,Yt.filePath));(St.length!==ye.length||St.some((Yt,kn)=>Yt!==ye[kn]))&&nR(St)}catch(ye){console.warn("[tandem] failed to sync recent files:",ye)}},[t.length]);const[E,B]=O.useState(()=>{try{const ye=localStorage.getItem(Pd);return h3.safeParse(ye).success?ye:gC}catch(ye){return console.warn(`[tandem] localStorage unavailable reading ${Pd}:`,ye),gC}});O.useEffect(()=>{try{localStorage.setItem(Pd,E)}catch(ye){console.warn(`[tandem] failed to persist ${Pd}:`,ye)}},[E]),O.useEffect(()=>{if(!g)return;g.getMap(ob).set(Lz,E)},[E,g]);const[I,ne]=O.useState(!1),[F,R]=O.useState(!1);O.useEffect(()=>{if(c==null){ne(!1),R(!1);return}const ye=Date.now()-c,St=Dz-ye;if(St<=0){ne(!0);return}const Yt=setTimeout(()=>ne(!0),St);return()=>clearTimeout(Yt)},[c]);const{visibleAnnotations:N,heldCount:Z}=sP(f,E),j=O.useMemo(()=>t.map(ye=>({id:ye.id,fileName:ye.fileName})),[t]),{saving:ie}=aP(e),{toasts:re,dismiss:se}=oP(),{fileDragOver:be,handleEditorDragOver:ue,handleEditorDragLeave:H,handleEditorDrop:L}=rP(),{showReviewSummary:G,reviewSummaryData:me,dismissReviewSummary:Te}=lP(f),{settings:M,updateSettings:_}=bP(),[V,T]=O.useState(!1),[Y,fe]=O.useState(null),oe=O.useRef(null),Ne=O.useCallback(()=>{var ye;fe(((ye=oe.current)==null?void 0:ye.getBoundingClientRect())??null),T(!0)},[]),Fe=O.useRef(V);Fe.current=V;const Ue=O.useCallback(()=>{if(Fe.current){T(!1);return}Ne()},[Ne]);uP(Ue),O.useEffect(()=>{if(!g)return;g.getMap(ob).set(jz,M.selectionDwellMs)},[M.selectionDwellMs,g]),O.useEffect(()=>{const ye=Jt.current;if(!ye)return;const St=ye.state.tr.setMeta(ma,{type:"toggle",visible:M.showAuthorship});ye.view.dispatch(St)},[M.showAuthorship]),O.useEffect(()=>(document.body.classList.toggle("tandem-reduce-motion",M.reduceMotion),()=>document.body.classList.remove("tandem-reduce-motion")),[M.reduceMotion]),wP(M.theme),O.useEffect(()=>{const ye=mP[M.textSize];return document.documentElement.style.setProperty("--tandem-editor-font-size",`${ye}px`),()=>{document.documentElement.style.removeProperty("--tandem-editor-font-size")}},[M.textSize]);const[mt,_e]=O.useState(!1),[ze,Lt]=O.useState(()=>M.primaryTab==="chat"),Rt=O.useMemo(()=>ze?N.filter(ye=>ye.status==="pending").length:0,[N,ze]),[Nt,wn]=O.useState(null),[ei,dr]=O.useState(!1),[hr,Jn]=O.useState(null),Jt=O.useRef(null),di=O.useRef(null),ys=O.useCallback(ye=>{Jt.current=ye},[]),qt=O.useCallback(ye=>{Lt(!1),wn(ye)},[]),[pr,J]=O.useState(()=>M.layout==="three-panel"?{kind:"three-panel",left:mh("left"),right:mh("right")}:{kind:"tabbed",right:mh("right")});O.useEffect(()=>{J(ye=>M.layout==="three-panel"?ye.kind==="three-panel"?ye:{kind:"three-panel",left:mh("left"),right:ye.right}:ye.kind==="tabbed"?ye:{kind:"tabbed",right:ye.right})},[M.layout]);const de=M.editorWidthPercent<100?`${M.editorWidthPercent}%`:void 0,Ae=M.editorWidthPercent<100?"0 auto":void 0,K=O.useRef(pr);K.current=pr;const pe=O.useRef(null);O.useEffect(()=>()=>{pe.current&&(document.removeEventListener("mousemove",pe.current.move),document.removeEventListener("mouseup",pe.current.up),document.body.style.userSelect="",document.body.style.cursor="")},[]);const De=O.useCallback((ye,St)=>{ye.preventDefault();const Yt=ye.clientX,kn=K.current,Or=St==="left"?kn.kind==="three-panel"?kn.left:oR:kn.right,bs=aM[St];let vo=Or;document.body.style.userSelect="none",document.body.style.cursor="col-resize";const wl=ji=>{const Af=ji.clientX-Yt,Mf=St==="left"?Or+Af:Or-Af;vo=Math.max(iR,Math.min(sR,Mf)),J(xs=>St==="right"?xs.kind==="three-panel"?{...xs,right:vo}:{kind:"tabbed",right:vo}:xs.kind!=="three-panel"?xs:{...xs,left:vo})},ko=()=>{document.removeEventListener("mousemove",wl),document.removeEventListener("mouseup",ko),pe.current=null,document.body.style.userSelect="",document.body.style.cursor="";try{localStorage.setItem(bs,String(vo))}catch(ji){console.warn(`[tandem] failed to persist ${bs}:`,ji)}};pe.current={move:wl,up:ko},document.addEventListener("mousemove",wl),document.addEventListener("mouseup",ko)},[]),Je=O.useCallback(()=>{_e(ye=>!ye)},[]),Re=O.useCallback(()=>{_e(!1)},[]),Ie=O.useCallback(()=>{if(ze)return;const ye=Jt.current;if(!ye)return;const{from:St,to:Yt}=ye.state.selection;if(St===Yt)return;const kn=r2(ye.state.doc,{from:Wr(St),to:Wr(Yt)}),Or=ye.state.doc.textBetween(St,Yt,`
|
|
349
|
-
`);Jn({...kn,textSnapshot:Or.length>200?Or.slice(0,197)+"...":Or})},[ze]);O.useEffect(()=>{const ye=St=>{if(St.key!=="?")return;const Yt=St.target;Yt.tagName==="INPUT"||Yt.tagName==="TEXTAREA"||Yt.isContentEditable||dr(kn=>!kn)};return window.addEventListener("keydown",ye),()=>window.removeEventListener("keydown",ye)},[]);const le=t.find(ye=>ye.id===e),{tutorialActive:Ze,currentStep:It,dismissTutorial:vn,nextStep:Rm}=kP(f,Jt,le==null?void 0:le.fileName);return b?k.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100vh"},children:[S&&k.jsx("div",{style:{padding:"8px 16px",background:"#fef3c7",borderBottom:"1px solid #fbbf24",fontSize:"13px",color:"#92400e",textAlign:"center"},children:"Server restarted — refreshing documents"}),I&&!F&&k.jsx(TK,{onDismiss:()=>R(!0)}),k.jsx(nP,{editor:Jt.current,ydoc:(le==null?void 0:le.ydoc)??null,onSettingsOpen:Ue,settingsBtnRef:oe,tandemMode:E,onModeChange:B,heldCount:Z}),k.jsx(EK,{tabs:v,activeTabId:e,onTabSwitch:n,onTabClose:r,reorder:C,reduceMotion:M.reduceMotion}),pr.kind==="three-panel"?k.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[k.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${pr.left}px`,borderRight:"1px solid #e5e7eb"},children:[k.jsx("div",{style:{padding:"6px 12px",fontSize:"11px",fontWeight:600,color:"#6b7280",borderBottom:"1px solid #e5e7eb",background:"#f9fafb",textTransform:"uppercase",letterSpacing:"0.5px"},children:M.panelOrder==="chat-editor-annotations"?"Chat":"Annotations"}),k.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:M.panelOrder==="chat-editor-annotations"?k.jsx(nb,{ctrlYdoc:g,editor:Jt.current,activeDocId:e,openDocs:j,claudeActive:p,claudeStatus:d,visible:!0,capturedAnchor:hr,onCapturedAnchorChange:Jn,inputRef:di,reduceMotion:M.reduceMotion}):k.jsx(ib,{annotations:N,editor:Jt.current,ydoc:(le==null?void 0:le.ydoc)??null,heldCount:Z,tandemMode:E,onModeChange:B,activeDocFormat:le==null?void 0:le.format,documentId:le==null?void 0:le.id,reviewMode:mt,onToggleReviewMode:Je,onExitReviewMode:Re,activeAnnotationId:Nt,onActiveAnnotationChange:wn,reduceMotion:M.reduceMotion})})]}),k.jsx("div",{"data-testid":"left-panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize left panel",tabIndex:0,onMouseDown:ye=>De(ye,"left"),style:{width:"4px",cursor:"col-resize",background:"transparent",flexShrink:0,transition:"background 0.15s"},onMouseEnter:ye=>{ye.currentTarget.style.background="#d1d5db"},onMouseLeave:ye=>{ye.currentTarget.style.background="transparent"}}),k.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px 48px",border:be?"2px dashed #6366f1":"2px solid transparent",background:be?"#eef2ff":void 0,transition:"border-color 0.15s, background 0.15s"},onDragOver:ue,onDragLeave:H,onDrop:L,children:[k.jsx(VC,{visible:(le==null?void 0:le.readOnly)===!0&&(le==null?void 0:le.format)==="docx",documentId:le==null?void 0:le.id}),k.jsx("div",{style:{maxWidth:de,margin:Ae},children:le?k.jsx(lA,{ydoc:le.ydoc,provider:le.provider,readOnly:m,reviewMode:mt,activeAnnotationId:Nt,onEditorReady:ys,onAnnotationClick:qt},le.id):k.jsx(sM,{connected:i,claudeActive:p})})]}),k.jsx("div",{"data-testid":"right-panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize right panel",tabIndex:0,onMouseDown:ye=>De(ye,"right"),style:{width:"4px",cursor:"col-resize",background:"transparent",flexShrink:0,transition:"background 0.15s"},onMouseEnter:ye=>{ye.currentTarget.style.background="#d1d5db"},onMouseLeave:ye=>{ye.currentTarget.style.background="transparent"}}),k.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${pr.right}px`,borderLeft:"1px solid #e5e7eb"},children:[k.jsx("div",{style:{padding:"6px 12px",fontSize:"11px",fontWeight:600,color:"#6b7280",borderBottom:"1px solid #e5e7eb",background:"#f9fafb",textTransform:"uppercase",letterSpacing:"0.5px"},children:M.panelOrder==="chat-editor-annotations"?"Annotations":"Chat"}),k.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:M.panelOrder==="chat-editor-annotations"?k.jsx(ib,{annotations:N,editor:Jt.current,ydoc:(le==null?void 0:le.ydoc)??null,heldCount:Z,tandemMode:E,onModeChange:B,activeDocFormat:le==null?void 0:le.format,documentId:le==null?void 0:le.id,reviewMode:mt,onToggleReviewMode:Je,onExitReviewMode:Re,activeAnnotationId:Nt,onActiveAnnotationChange:wn,reduceMotion:M.reduceMotion}):k.jsx(nb,{ctrlYdoc:g,editor:Jt.current,activeDocId:e,openDocs:j,claudeActive:p,claudeStatus:d,visible:!0,capturedAnchor:hr,onCapturedAnchorChange:Jn,inputRef:di,reduceMotion:M.reduceMotion})})]})]}):k.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[k.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px 48px",border:be?"2px dashed #6366f1":"2px solid transparent",background:be?"#eef2ff":void 0,transition:"border-color 0.15s, background 0.15s"},onDragOver:ue,onDragLeave:H,onDrop:L,children:[k.jsx(VC,{visible:(le==null?void 0:le.readOnly)===!0&&(le==null?void 0:le.format)==="docx",documentId:le==null?void 0:le.id}),k.jsx("div",{style:{maxWidth:de,margin:Ae},children:le?k.jsx(lA,{ydoc:le.ydoc,provider:le.provider,readOnly:m,reviewMode:mt,activeAnnotationId:Nt,onEditorReady:ys,onAnnotationClick:qt},le.id):k.jsx(sM,{connected:i,claudeActive:p})})]}),k.jsx("div",{"data-testid":"panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",tabIndex:0,onMouseDown:ye=>De(ye,"right"),style:{width:"4px",cursor:"col-resize",background:"transparent",flexShrink:0,transition:"background 0.15s"},onMouseEnter:ye=>{ye.currentTarget.style.background="#d1d5db"},onMouseLeave:ye=>{ye.currentTarget.style.background="transparent"}}),k.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${pr.right}px`,borderLeft:"1px solid #e5e7eb"},children:[k.jsxs("div",{style:{display:"flex",borderBottom:"1px solid #e5e7eb",background:"#f9fafb"},children:[k.jsxs("button",{"data-testid":"annotations-tab",onClick:()=>Lt(!1),style:{flex:1,padding:"8px",fontSize:"12px",fontWeight:ze?400:600,border:"none",borderBottom:ze?"none":"2px solid #6366f1",background:"transparent",cursor:"pointer",color:ze?"#6b7280":"#6366f1",position:"relative"},children:["Annotations",ze&&Rt>0&&k.jsx("span",{style:{position:"absolute",top:"2px",right:"6px",background:"#ef4444",color:"#fff",fontSize:"9px",width:"16px",height:"16px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700},children:Rt>9?"9+":Rt})]}),k.jsx("button",{"data-testid":"chat-tab",onMouseDown:Ie,onClick:()=>Lt(!0),style:{flex:1,padding:"8px",fontSize:"12px",fontWeight:ze?600:400,border:"none",borderBottom:ze?"2px solid #6366f1":"none",background:"transparent",cursor:"pointer",color:ze?"#6366f1":"#6b7280",position:"relative"},children:"Chat"})]}),k.jsx("div",{style:{display:ze?"flex":"none",flexDirection:"column",flex:1,minHeight:0},children:k.jsx(nb,{ctrlYdoc:g,editor:Jt.current,activeDocId:e,openDocs:j,claudeActive:p,claudeStatus:d,visible:ze,capturedAnchor:hr,onCapturedAnchorChange:Jn,inputRef:di,reduceMotion:M.reduceMotion})}),k.jsx("div",{style:{display:ze?"none":"flex",flexDirection:"column",flex:1,minHeight:0},children:k.jsx(ib,{annotations:N,editor:Jt.current,ydoc:(le==null?void 0:le.ydoc)??null,heldCount:Z,tandemMode:E,onModeChange:B,activeDocFormat:le==null?void 0:le.format,documentId:le==null?void 0:le.id,reviewMode:mt,onToggleReviewMode:Je,onExitReviewMode:Re,activeAnnotationId:Nt,onActiveAnnotationChange:wn,reduceMotion:M.reduceMotion})})]})]}),k.jsx(yK,{connected:i,connectionStatus:s,reconnectAttempts:l,disconnectedSince:c,claudeStatus:d,claudeActive:p,readOnly:m,documentCount:t.length,saving:ie}),G&&me&&k.jsx(cK,{accepted:me.accepted,dismissed:me.dismissed,total:me.total,onDismiss:Te}),k.jsx(v3,{open:V,onClose:()=>T(!1),anchorRect:Y,settings:M,onUpdate:_,returnFocusRef:oe,anchorRef:oe}),k.jsx(m3,{open:ei,onClose:()=>dr(!1)}),k.jsx(C3,{toasts:re,onDismiss:se}),Ze&&k.jsx(y3,{currentStep:It,onNext:Rm,onDismiss:vn})]}):k.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100vh",color:"#9ca3af"},children:"Connecting..."})}class MK extends hn.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){console.error("[Tandem] React error boundary caught:",e,n.componentStack)}render(){var e;return this.state.hasError?k.jsxs("div",{style:{padding:"2rem",fontFamily:"system-ui, sans-serif"},children:[k.jsx("h2",{children:"Something went wrong"}),k.jsx("p",{style:{color:"#666"},children:"The editor encountered an unexpected error. Reload the page to continue."}),k.jsx("pre",{style:{background:"#f5f5f5",padding:"1rem",borderRadius:"4px",fontSize:"12px",overflow:"auto",maxHeight:"200px"},children:(e=this.state.error)==null?void 0:e.message}),k.jsx("button",{onClick:()=>window.location.reload(),style:{marginTop:"1rem",padding:"8px 16px",cursor:"pointer",border:"1px solid #d1d5db",borderRadius:"4px",background:"#fff"},children:"Reload"})]}):this.props.children}}const OK=Mz.createRoot(document.getElementById("root"));OK.render(k.jsx(hn.StrictMode,{children:k.jsx(MK,{children:k.jsx(AK,{})})}));
|