tandem-editor 0.7.0 → 0.8.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.
@@ -0,0 +1,228 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/webview-BQBJMQvJ.js","assets/core-DhEqZVGG.js"])))=>i.map(i=>d[i]);
2
+ var Iz=Object.defineProperty;var Bz=(t,e,n)=>e in t?Iz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Hf=(t,e,n)=>Bz(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 Zp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Fy={exports:{}},Yc={};/**
3
+ * @license React
4
+ * react-jsx-runtime.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var uC;function Uz(){if(uC)return Yc;uC=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 Yc.Fragment=e,Yc.jsx=n,Yc.jsxs=n,Yc}var dC;function Hz(){return dC||(dC=1,Fy.exports=Uz()),Fy.exports}var S=Hz(),qy={exports:{}},Le={};/**
11
+ * @license React
12
+ * react.production.js
13
+ *
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var fC;function Vz(){if(fC)return Le;fC=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"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=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 v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,C={};function E(_,I,A){this.props=_,this.context=I,this.refs=C,this.updater=A||v}E.prototype.isReactComponent={},E.prototype.setState=function(_,I){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,_,I,"setState")},E.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function L(){}L.prototype=E.prototype;function j(_,I,A){this.props=_,this.context=I,this.refs=C,this.updater=A||v}var Y=j.prototype=new L;Y.constructor=j,k(Y,E.prototype),Y.isPureReactComponent=!0;var V=Array.isArray;function R(){}var B={H:null,A:null,T:null,S:null},te=Object.prototype.hasOwnProperty;function W(_,I,A){var ne=A.ref;return{$$typeof:t,type:_,key:I,ref:ne!==void 0?ne:null,props:A}}function oe(_,I){return W(_.type,I,_.props)}function re(_){return typeof _=="object"&&_!==null&&_.$$typeof===t}function ie(_){var I={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function(A){return I[A]})}var ye=/\/+/g;function ae(_,I){return typeof _=="object"&&_!==null&&_.key!=null?ie(""+_.key):I.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(I){_.status==="pending"&&(_.status="fulfilled",_.value=I)},function(I){_.status==="pending"&&(_.status="rejected",_.reason=I)})),_.status){case"fulfilled":return _.value;case"rejected":throw _.reason}}throw _}function N(_,I,A,ne,Z){var se=typeof _;(se==="undefined"||se==="boolean")&&(_=null);var me=!1;if(_===null)me=!0;else switch(se){case"bigint":case"string":case"number":me=!0;break;case"object":switch(_.$$typeof){case t:case e:me=!0;break;case h:return me=_._init,N(me(_._payload),I,A,ne,Z)}}if(me)return Z=Z(_),me=ne===""?"."+ae(_,0):ne,V(Z)?(A="",me!=null&&(A=me.replace(ye,"$&/")+"/"),N(Z,I,A,"",function(He){return He})):Z!=null&&(re(Z)&&(Z=oe(Z,A+(Z.key==null||_&&_.key===Z.key?"":(""+Z.key).replace(ye,"$&/")+"/")+me)),I.push(Z)),1;me=0;var Ee=ne===""?".":ne+":";if(V(_))for(var Te=0;Te<_.length;Te++)ne=_[Te],se=Ee+ae(ne,Te),me+=N(ne,I,A,se,Z);else if(Te=b(_),typeof Te=="function")for(_=Te.call(_),Te=0;!(ne=_.next()).done;)ne=ne.value,se=Ee+ae(ne,Te++),me+=N(ne,I,A,se,Z);else if(se==="object"){if(typeof _.then=="function")return N(H(_),I,A,ne,Z);throw I=String(_),Error("Objects are not valid as a React child (found: "+(I==="[object Object]"?"object with keys {"+Object.keys(_).join(", ")+"}":I)+"). If you meant to render a collection of children, use an array instead.")}return me}function K(_,I,A){if(_==null)return _;var ne=[],Z=0;return N(_,ne,"","",function(se){return I.call(A,se,Z++)}),ne}function he(_){if(_._status===-1){var I=_._result;I=I(),I.then(function(A){(_._status===0||_._status===-1)&&(_._status=1,_._result=A)},function(A){(_._status===0||_._status===-1)&&(_._status=2,_._result=A)}),_._status===-1&&(_._status=0,_._result=I)}if(_._status===1)return _._result.default;throw _._result}var _e=typeof reportError=="function"?reportError:function(_){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var I=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof _=="object"&&_!==null&&typeof _.message=="string"?String(_.message):String(_),error:_});if(!window.dispatchEvent(I))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",_);return}console.error(_)},O={map:K,forEach:function(_,I,A){K(_,function(){I.apply(this,arguments)},A)},count:function(_){var I=0;return K(_,function(){I++}),I},toArray:function(_){return K(_,function(I){return I})||[]},only:function(_){if(!re(_))throw Error("React.Children.only expected to receive a single React element child.");return _}};return Le.Activity=m,Le.Children=O,Le.Component=E,Le.Fragment=n,Le.Profiler=i,Le.PureComponent=j,Le.StrictMode=r,Le.Suspense=u,Le.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,Le.__COMPILER_RUNTIME={__proto__:null,c:function(_){return B.H.useMemoCache(_)}},Le.cache=function(_){return function(){return _.apply(null,arguments)}},Le.cacheSignal=function(){return null},Le.cloneElement=function(_,I,A){if(_==null)throw Error("The argument must be a React element, but you passed "+_+".");var ne=k({},_.props),Z=_.key;if(I!=null)for(se in I.key!==void 0&&(Z=""+I.key),I)!te.call(I,se)||se==="key"||se==="__self"||se==="__source"||se==="ref"&&I.ref===void 0||(ne[se]=I[se]);var se=arguments.length-2;if(se===1)ne.children=A;else if(1<se){for(var me=Array(se),Ee=0;Ee<se;Ee++)me[Ee]=arguments[Ee+2];ne.children=me}return W(_.type,Z,ne)},Le.createContext=function(_){return _={$$typeof:l,_currentValue:_,_currentValue2:_,_threadCount:0,Provider:null,Consumer:null},_.Provider=_,_.Consumer={$$typeof:s,_context:_},_},Le.createElement=function(_,I,A){var ne,Z={},se=null;if(I!=null)for(ne in I.key!==void 0&&(se=""+I.key),I)te.call(I,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(Z[ne]=I[ne]);var me=arguments.length-2;if(me===1)Z.children=A;else if(1<me){for(var Ee=Array(me),Te=0;Te<me;Te++)Ee[Te]=arguments[Te+2];Z.children=Ee}if(_&&_.defaultProps)for(ne in me=_.defaultProps,me)Z[ne]===void 0&&(Z[ne]=me[ne]);return W(_,se,Z)},Le.createRef=function(){return{current:null}},Le.forwardRef=function(_){return{$$typeof:c,render:_}},Le.isValidElement=re,Le.lazy=function(_){return{$$typeof:h,_payload:{_status:-1,_result:_},_init:he}},Le.memo=function(_,I){return{$$typeof:f,type:_,compare:I===void 0?null:I}},Le.startTransition=function(_){var I=B.T,A={};B.T=A;try{var ne=_(),Z=B.S;Z!==null&&Z(A,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(R,_e)}catch(se){_e(se)}finally{I!==null&&A.types!==null&&(I.types=A.types),B.T=I}},Le.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},Le.use=function(_){return B.H.use(_)},Le.useActionState=function(_,I,A){return B.H.useActionState(_,I,A)},Le.useCallback=function(_,I){return B.H.useCallback(_,I)},Le.useContext=function(_){return B.H.useContext(_)},Le.useDebugValue=function(){},Le.useDeferredValue=function(_,I){return B.H.useDeferredValue(_,I)},Le.useEffect=function(_,I){return B.H.useEffect(_,I)},Le.useEffectEvent=function(_){return B.H.useEffectEvent(_)},Le.useId=function(){return B.H.useId()},Le.useImperativeHandle=function(_,I,A){return B.H.useImperativeHandle(_,I,A)},Le.useInsertionEffect=function(_,I){return B.H.useInsertionEffect(_,I)},Le.useLayoutEffect=function(_,I){return B.H.useLayoutEffect(_,I)},Le.useMemo=function(_,I){return B.H.useMemo(_,I)},Le.useOptimistic=function(_,I){return B.H.useOptimistic(_,I)},Le.useReducer=function(_,I,A){return B.H.useReducer(_,I,A)},Le.useRef=function(_){return B.H.useRef(_)},Le.useState=function(_){return B.H.useState(_)},Le.useSyncExternalStore=function(_,I,A){return B.H.useSyncExternalStore(_,I,A)},Le.useTransition=function(){return B.H.useTransition()},Le.version="19.2.4",Le}var hC;function Ox(){return hC||(hC=1,qy.exports=Vz()),qy.exports}var M=Ox();const sn=Zp(M);var Ky={exports:{}},Wc={},Yy={exports:{}},Wy={};/**
19
+ * @license React
20
+ * scheduler.production.js
21
+ *
22
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var pC;function Pz(){return pC||(pC=1,(function(t){function e(N,K){var he=N.length;N.push(K);e:for(;0<he;){var _e=he-1>>>1,O=N[_e];if(0<i(O,K))N[_e]=K,N[he]=O,he=_e;else break e}}function n(N){return N.length===0?null:N[0]}function r(N){if(N.length===0)return null;var K=N[0],he=N.pop();if(he!==K){N[0]=he;e:for(var _e=0,O=N.length,_=O>>>1;_e<_;){var I=2*(_e+1)-1,A=N[I],ne=I+1,Z=N[ne];if(0>i(A,he))ne<O&&0>i(Z,A)?(N[_e]=Z,N[ne]=he,_e=ne):(N[_e]=A,N[I]=he,_e=I);else if(ne<O&&0>i(Z,he))N[_e]=Z,N[ne]=he,_e=ne;else break e}}return K}function i(N,K){var he=N.sortIndex-K.sortIndex;return he!==0?he:N.id-K.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 u=[],f=[],h=1,m=null,g=3,b=!1,v=!1,k=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function Y(N){for(var K=n(f);K!==null;){if(K.callback===null)r(f);else if(K.startTime<=N)r(f),K.sortIndex=K.expirationTime,e(u,K);else break;K=n(f)}}function V(N){if(k=!1,Y(N),!v)if(n(u)!==null)v=!0,R||(R=!0,ie());else{var K=n(f);K!==null&&H(V,K.startTime-N)}}var R=!1,B=-1,te=5,W=-1;function oe(){return C?!0:!(t.unstable_now()-W<te)}function re(){if(C=!1,R){var N=t.unstable_now();W=N;var K=!0;try{e:{v=!1,k&&(k=!1,L(B),B=-1),b=!0;var he=g;try{t:{for(Y(N),m=n(u);m!==null&&!(m.expirationTime>N&&oe());){var _e=m.callback;if(typeof _e=="function"){m.callback=null,g=m.priorityLevel;var O=_e(m.expirationTime<=N);if(N=t.unstable_now(),typeof O=="function"){m.callback=O,Y(N),K=!0;break t}m===n(u)&&r(u),Y(N)}else r(u);m=n(u)}if(m!==null)K=!0;else{var _=n(f);_!==null&&H(V,_.startTime-N),K=!1}}break e}finally{m=null,g=he,b=!1}K=void 0}}finally{K?ie():R=!1}}}var ie;if(typeof j=="function")ie=function(){j(re)};else if(typeof MessageChannel<"u"){var ye=new MessageChannel,ae=ye.port2;ye.port1.onmessage=re,ie=function(){ae.postMessage(null)}}else ie=function(){E(re,0)};function H(N,K){B=E(function(){N(t.unstable_now())},K)}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(N){N.callback=null},t.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):te=0<N?Math.floor(1e3/N):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function(N){switch(g){case 1:case 2:case 3:var K=3;break;default:K=g}var he=g;g=K;try{return N()}finally{g=he}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(N,K){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var he=g;g=N;try{return K()}finally{g=he}},t.unstable_scheduleCallback=function(N,K,he){var _e=t.unstable_now();switch(typeof he=="object"&&he!==null?(he=he.delay,he=typeof he=="number"&&0<he?_e+he:_e):he=_e,N){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=he+O,N={id:h++,callback:K,priorityLevel:N,startTime:he,expirationTime:O,sortIndex:-1},he>_e?(N.sortIndex=he,e(f,N),n(u)===null&&N===n(f)&&(k?(L(B),B=-1):k=!0,H(V,he-_e))):(N.sortIndex=O,e(u,N),v||b||(v=!0,R||(R=!0,ie()))),N},t.unstable_shouldYield=oe,t.unstable_wrapCallback=function(N){var K=g;return function(){var he=g;g=K;try{return N.apply(this,arguments)}finally{g=he}}}})(Wy)),Wy}var mC;function $z(){return mC||(mC=1,Yy.exports=Pz()),Yy.exports}var Gy={exports:{}},Tn={};/**
27
+ * @license React
28
+ * react-dom.production.js
29
+ *
30
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var gC;function Fz(){if(gC)return Tn;gC=1;var t=Ox();function e(u){var f="https://react.dev/errors/"+u;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)f+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+u+"; visit "+f+" 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(u,f,h){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:m==null?null:""+m,children:u,containerInfo:f,implementation:h}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(u,f){if(u==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Tn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Tn.createPortal=function(u,f){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(e(299));return s(u,f,null,h)},Tn.flushSync=function(u){var f=l.T,h=r.p;try{if(l.T=null,r.p=2,u)return u()}finally{l.T=f,r.p=h,r.d.f()}},Tn.preconnect=function(u,f){typeof u=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(u,f))},Tn.prefetchDNS=function(u){typeof u=="string"&&r.d.D(u)},Tn.preinit=function(u,f){if(typeof u=="string"&&f&&typeof f.as=="string"){var h=f.as,m=c(h,f.crossOrigin),g=typeof f.integrity=="string"?f.integrity:void 0,b=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;h==="style"?r.d.S(u,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:g,fetchPriority:b}):h==="script"&&r.d.X(u,{crossOrigin:m,integrity:g,fetchPriority:b,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Tn.preinitModule=function(u,f){if(typeof u=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var h=c(f.as,f.crossOrigin);r.d.M(u,{crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(u)},Tn.preload=function(u,f){if(typeof u=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var h=f.as,m=c(h,f.crossOrigin);r.d.L(u,h,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Tn.preloadModule=function(u,f){if(typeof u=="string")if(f){var h=c(f.as,f.crossOrigin);r.d.m(u,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(u)},Tn.requestFormReset=function(u){r.d.r(u)},Tn.unstable_batchedUpdates=function(u,f){return u(f)},Tn.useFormState=function(u,f,h){return l.H.useFormState(u,f,h)},Tn.useFormStatus=function(){return l.H.useHostTransitionStatus()},Tn.version="19.2.4",Tn}var yC;function fM(){if(yC)return Gy.exports;yC=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=Fz(),Gy.exports}/**
35
+ * @license React
36
+ * react-dom-client.production.js
37
+ *
38
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
39
+ *
40
+ * This source code is licensed under the MIT license found in the
41
+ * LICENSE file in the root directory of this source tree.
42
+ */var bC;function qz(){if(bC)return Wc;bC=1;var t=$z(),e=Ox(),n=fM();function r(o){var a="https://react.dev/errors/"+o;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)a+="&args[]="+encodeURIComponent(arguments[d])}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,d=o;if(o.alternate)for(;a.return;)a=a.return;else{o=a;do a=o,(a.flags&4098)!==0&&(d=a.return),o=a.return;while(o)}return a.tag===3?d: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 u(o){if(s(o)!==o)throw Error(r(188))}function f(o){var a=o.alternate;if(!a){if(a=s(o),a===null)throw Error(r(188));return a!==o?null:o}for(var d=o,p=a;;){var y=d.return;if(y===null)break;var x=y.alternate;if(x===null){if(p=y.return,p!==null){d=p;continue}break}if(y.child===x.child){for(x=y.child;x;){if(x===d)return u(y),o;if(x===p)return u(y),a;x=x.sibling}throw Error(r(188))}if(d.return!==p.return)d=y,p=x;else{for(var w=!1,T=y.child;T;){if(T===d){w=!0,d=y,p=x;break}if(T===p){w=!0,p=y,d=x;break}T=T.sibling}if(!w){for(T=x.child;T;){if(T===d){w=!0,d=x,p=y;break}if(T===p){w=!0,p=x,d=y;break}T=T.sibling}if(!w)throw Error(r(189))}}if(d.alternate!==p)throw Error(r(190))}if(d.tag!==3)throw Error(r(188));return d.stateNode.current===d?o:a}function h(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o;for(o=o.child;o!==null;){if(a=h(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"),v=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),j=Symbol.for("react.context"),Y=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),te=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),oe=Symbol.for("react.memo_cache_sentinel"),re=Symbol.iterator;function ie(o){return o===null||typeof o!="object"?null:(o=re&&o[re]||o["@@iterator"],typeof o=="function"?o:null)}var ye=Symbol.for("react.client.reference");function ae(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===ye?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case k:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case V:return"Suspense";case R:return"SuspenseList";case W:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case v:return"Portal";case j:return o.displayName||"Context";case L:return(o._context.displayName||"Context")+".Consumer";case Y:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case B:return a=o.displayName||null,a!==null?a:ae(o.type)||"Memo";case te:a=o._payload,o=o._init;try{return ae(o(a))}catch{}}return null}var H=Array.isArray,N=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},_e=[],O=-1;function _(o){return{current:o}}function I(o){0>O||(o.current=_e[O],_e[O]=null,O--)}function A(o,a){O++,_e[O]=o.current,o.current=a}var ne=_(null),Z=_(null),se=_(null),me=_(null);function Ee(o,a){switch(A(se,a),A(Z,o),A(ne,null),a.nodeType){case 9:case 11:o=(o=a.documentElement)&&(o=o.namespaceURI)?Nk(o):0;break;default:if(o=a.tagName,a=a.namespaceURI)a=Nk(a),o=zk(a,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}I(ne),A(ne,o)}function Te(){I(ne),I(Z),I(se)}function He(o){o.memoizedState!==null&&A(me,o);var a=ne.current,d=zk(a,o.type);a!==d&&(A(Z,o),A(ne,d))}function we(o){Z.current===o&&(I(ne),I(Z)),me.current===o&&(I(me),$c._currentValue=he)}var Ge,pn;function jt(o){if(Ge===void 0)try{throw Error()}catch(d){var a=d.stack.trim().match(/\n( *(at )?)/);Ge=a&&a[1]||"",pn=-1<d.stack.indexOf(`
43
+ at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
44
+ `+Ge+o+pn}var Fr=!1;function vr(o,a){if(!o||Fr)return"";Fr=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(a){var Q=function(){throw Error()};if(Object.defineProperty(Q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Q,[])}catch(q){var F=q}Reflect.construct(o,[],Q)}else{try{Q.call()}catch(q){F=q}o.call(Q.prototype)}}else{try{throw Error()}catch(q){F=q}(Q=o())&&typeof Q.catch=="function"&&Q.catch(function(){})}}catch(q){if(q&&F&&typeof q.stack=="string")return[q.stack,F.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=p.DetermineComponentFrameRoot(),w=x[0],T=x[1];if(w&&T){var D=w.split(`
45
+ `),$=T.split(`
46
+ `);for(y=p=0;p<D.length&&!D[p].includes("DetermineComponentFrameRoot");)p++;for(;y<$.length&&!$[y].includes("DetermineComponentFrameRoot");)y++;if(p===D.length||y===$.length)for(p=D.length-1,y=$.length-1;1<=p&&0<=y&&D[p]!==$[y];)y--;for(;1<=p&&0<=y;p--,y--)if(D[p]!==$[y]){if(p!==1||y!==1)do if(p--,y--,0>y||D[p]!==$[y]){var G=`
47
+ `+D[p].replace(" at new "," at ");return o.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",o.displayName)),G}while(1<=p&&0<=y);break}}}finally{Fr=!1,Error.prepareStackTrace=d}return(d=o?o.displayName||o.name:"")?jt(d):""}function $n(o,a){switch(o.tag){case 26:case 27:case 5:return jt(o.type);case 16:return jt("Lazy");case 13:return o.child!==a&&a!==null?jt("Suspense Fallback"):jt("Suspense");case 19:return jt("SuspenseList");case 0:case 15:return vr(o.type,!1);case 11:return vr(o.type.render,!1);case 1:return vr(o.type,!0);case 31:return jt("Activity");default:return""}}function Mi(o){try{var a="",d=null;do a+=$n(o,d),d=o,o=o.return;while(o);return a}catch(p){return`
48
+ Error generating stack: `+p.message+`
49
+ `+p.stack}}var Oi=Object.prototype.hasOwnProperty,_i=t.unstable_scheduleCallback,qr=t.unstable_cancelCallback,gl=t.unstable_shouldYield,yl=t.unstable_requestPaint,Xt=t.unstable_now,go=t.unstable_getCurrentPriorityLevel,J=t.unstable_ImmediatePriority,de=t.unstable_UserBlockingPriority,Re=t.unstable_NormalPriority,pe=t.unstable_LowPriority,tt=t.unstable_IdlePriority,Ln=t.log,Kr=t.unstable_setDisableYieldValue,mn=null,It=null;function Qt(o){if(typeof Ln=="function"&&Kr(o),It&&typeof It.setStrictMode=="function")try{It.setStrictMode(mn,o)}catch{}}var ot=Math.clz32?Math.clz32:Fn,be=Math.log,bt=Math.LN2;function Fn(o){return o>>>=0,o===0?32:31-(be(o)/bt|0)|0}var si=256,fs=262144,Ed=4194304;function yo(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 Td(o,a,d){var p=o.pendingLanes;if(p===0)return 0;var y=0,x=o.suspendedLanes,w=o.pingedLanes;o=o.warmLanes;var T=p&134217727;return T!==0?(p=T&~x,p!==0?y=yo(p):(w&=T,w!==0?y=yo(w):d||(d=T&~o,d!==0&&(y=yo(d))))):(T=p&~x,T!==0?y=yo(T):w!==0?y=yo(w):d||(d=p&~o,d!==0&&(y=yo(d)))),y===0?0:a!==0&&a!==y&&(a&x)===0&&(x=y&-y,d=a&-a,x>=d||x===32&&(d&4194048)!==0)?a:y}function nc(o,a){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&a)===0}function C2(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 pv(){var o=Ed;return Ed<<=1,(Ed&62914560)===0&&(Ed=4194304),o}function Rm(o){for(var a=[],d=0;31>d;d++)a.push(o);return a}function rc(o,a){o.pendingLanes|=a,a!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function E2(o,a,d,p,y,x){var w=o.pendingLanes;o.pendingLanes=d,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=d,o.entangledLanes&=d,o.errorRecoveryDisabledLanes&=d,o.shellSuspendCounter=0;var T=o.entanglements,D=o.expirationTimes,$=o.hiddenUpdates;for(d=w&~d;0<d;){var G=31-ot(d),Q=1<<G;T[G]=0,D[G]=-1;var F=$[G];if(F!==null)for($[G]=null,G=0;G<F.length;G++){var q=F[G];q!==null&&(q.lane&=-536870913)}d&=~Q}p!==0&&mv(o,p,0),x!==0&&y===0&&o.tag!==0&&(o.suspendedLanes|=x&~(w&~a))}function mv(o,a,d){o.pendingLanes|=a,o.suspendedLanes&=~a;var p=31-ot(a);o.entangledLanes|=a,o.entanglements[p]=o.entanglements[p]|1073741824|d&261930}function gv(o,a){var d=o.entangledLanes|=a;for(o=o.entanglements;d;){var p=31-ot(d),y=1<<p;y&a|o[p]&a&&(o[p]|=a),d&=~y}}function yv(o,a){var d=a&-a;return d=(d&42)!==0?1:Nm(d),(d&(o.suspendedLanes|a))!==0?0:d}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 bv(){var o=K.p;return o!==0?o:(o=window.event,o===void 0?32:rC(o.type))}function xv(o,a){var d=K.p;try{return K.p=o,a()}finally{K.p=d}}var hs=Math.random().toString(36).slice(2),gn="__reactFiber$"+hs,qn="__reactProps$"+hs,bl="__reactContainer$"+hs,Lm="__reactEvents$"+hs,T2="__reactListeners$"+hs,A2="__reactHandles$"+hs,vv="__reactResources$"+hs,ic="__reactMarker$"+hs;function jm(o){delete o[gn],delete o[qn],delete o[Lm],delete o[T2],delete o[A2]}function xl(o){var a=o[gn];if(a)return a;for(var d=o.parentNode;d;){if(a=d[bl]||d[gn]){if(d=a.alternate,a.child!==null||d!==null&&d.child!==null)for(o=Vk(o);o!==null;){if(d=o[gn])return d;o=Vk(o)}return a}o=d,d=o.parentNode}return null}function vl(o){if(o=o[gn]||o[bl]){var a=o.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return o}return null}function sc(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o.stateNode;throw Error(r(33))}function Sl(o){var a=o[vv];return a||(a=o[vv]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function en(o){o[ic]=!0}var Sv=new Set,wv={};function bo(o,a){wl(o,a),wl(o+"Capture",a)}function wl(o,a){for(wv[o]=a,o=0;o<a.length;o++)Sv.add(a[o])}var M2=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]*$"),kv={},Cv={};function O2(o){return Oi.call(Cv,o)?!0:Oi.call(kv,o)?!1:M2.test(o)?Cv[o]=!0:(kv[o]=!0,!1)}function Ad(o,a,d){if(O2(a))if(d===null)o.removeAttribute(a);else{switch(typeof d){case"undefined":case"function":case"symbol":o.removeAttribute(a);return;case"boolean":var p=a.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){o.removeAttribute(a);return}}o.setAttribute(a,""+d)}}function Md(o,a,d){if(d===null)o.removeAttribute(a);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(a);return}o.setAttribute(a,""+d)}}function Di(o,a,d,p){if(p===null)o.removeAttribute(d);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(d);return}o.setAttributeNS(a,d,""+p)}}function Sr(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Ev(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function _2(o,a,d){var p=Object.getOwnPropertyDescriptor(o.constructor.prototype,a);if(!o.hasOwnProperty(a)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var y=p.get,x=p.set;return Object.defineProperty(o,a,{configurable:!0,get:function(){return y.call(this)},set:function(w){d=""+w,x.call(this,w)}}),Object.defineProperty(o,a,{enumerable:p.enumerable}),{getValue:function(){return d},setValue:function(w){d=""+w},stopTracking:function(){o._valueTracker=null,delete o[a]}}}}function Im(o){if(!o._valueTracker){var a=Ev(o)?"checked":"value";o._valueTracker=_2(o,a,""+o[a])}}function Tv(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var d=a.getValue(),p="";return o&&(p=Ev(o)?o.checked?"true":"false":o.value),o=p,o!==d?(a.setValue(o),!0):!1}function Od(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 D2=/[\n"\\]/g;function wr(o){return o.replace(D2,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Bm(o,a,d,p,y,x,w,T){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=""+Sr(a)):o.value!==""+Sr(a)&&(o.value=""+Sr(a)):w!=="submit"&&w!=="reset"||o.removeAttribute("value"),a!=null?Um(o,w,Sr(a)):d!=null?Um(o,w,Sr(d)):p!=null&&o.removeAttribute("value"),y==null&&x!=null&&(o.defaultChecked=!!x),y!=null&&(o.checked=y&&typeof y!="function"&&typeof y!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?o.name=""+Sr(T):o.removeAttribute("name")}function Av(o,a,d,p,y,x,w,T){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(o.type=x),a!=null||d!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){Im(o);return}d=d!=null?""+Sr(d):"",a=a!=null?""+Sr(a):d,T||a===o.value||(o.value=a),o.defaultValue=a}p=p??y,p=typeof p!="function"&&typeof p!="symbol"&&!!p,o.checked=T?o.checked:!!p,o.defaultChecked=!!p,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(o.name=w),Im(o)}function Um(o,a,d){a==="number"&&Od(o.ownerDocument)===o||o.defaultValue===""+d||(o.defaultValue=""+d)}function kl(o,a,d,p){if(o=o.options,a){a={};for(var y=0;y<d.length;y++)a["$"+d[y]]=!0;for(d=0;d<o.length;d++)y=a.hasOwnProperty("$"+o[d].value),o[d].selected!==y&&(o[d].selected=y),y&&p&&(o[d].defaultSelected=!0)}else{for(d=""+Sr(d),a=null,y=0;y<o.length;y++){if(o[y].value===d){o[y].selected=!0,p&&(o[y].defaultSelected=!0);return}a!==null||o[y].disabled||(a=o[y])}a!==null&&(a.selected=!0)}}function Mv(o,a,d){if(a!=null&&(a=""+Sr(a),a!==o.value&&(o.value=a),d==null)){o.defaultValue!==a&&(o.defaultValue=a);return}o.defaultValue=d!=null?""+Sr(d):""}function Ov(o,a,d,p){if(a==null){if(p!=null){if(d!=null)throw Error(r(92));if(H(p)){if(1<p.length)throw Error(r(93));p=p[0]}d=p}d==null&&(d=""),a=d}d=Sr(a),o.defaultValue=d,p=o.textContent,p===d&&p!==""&&p!==null&&(o.value=p),Im(o)}function Cl(o,a){if(a){var d=o.firstChild;if(d&&d===o.lastChild&&d.nodeType===3){d.nodeValue=a;return}}o.textContent=a}var R2=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 _v(o,a,d){var p=a.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?p?o.setProperty(a,""):a==="float"?o.cssFloat="":o[a]="":p?o.setProperty(a,d):typeof d!="number"||d===0||R2.has(a)?a==="float"?o.cssFloat=d:o[a]=(""+d).trim():o[a]=d+"px"}function Dv(o,a,d){if(a!=null&&typeof a!="object")throw Error(r(62));if(o=o.style,d!=null){for(var p in d)!d.hasOwnProperty(p)||a!=null&&a.hasOwnProperty(p)||(p.indexOf("--")===0?o.setProperty(p,""):p==="float"?o.cssFloat="":o[p]="");for(var y in a)p=a[y],a.hasOwnProperty(y)&&d[y]!==p&&_v(o,y,p)}else for(var x in a)a.hasOwnProperty(x)&&_v(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 N2=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"]]),z2=/^[\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 _d(o){return z2.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Ri(){}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 El=null,Tl=null;function Rv(o){var a=vl(o);if(a&&(o=a.stateNode)){var d=o[qn]||null;e:switch(o=a.stateNode,a.type){case"input":if(Bm(o,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),a=d.name,d.type==="radio"&&a!=null){for(d=o;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+wr(""+a)+'"][type="radio"]'),a=0;a<d.length;a++){var p=d[a];if(p!==o&&p.form===o.form){var y=p[qn]||null;if(!y)throw Error(r(90));Bm(p,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(a=0;a<d.length;a++)p=d[a],p.form===o.form&&Tv(p)}break e;case"textarea":Mv(o,d.value,d.defaultValue);break e;case"select":a=d.value,a!=null&&kl(o,!!d.multiple,a,!1)}}}var $m=!1;function Nv(o,a,d){if($m)return o(a,d);$m=!0;try{var p=o(a);return p}finally{if($m=!1,(El!==null||Tl!==null)&&(bf(),El&&(a=El,o=Tl,Tl=El=null,Rv(a),o)))for(a=0;a<o.length;a++)Rv(o[a])}}function oc(o,a){var d=o.stateNode;if(d===null)return null;var p=d[qn]||null;if(p===null)return null;d=p[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":(p=!p.disabled)||(o=o.type,p=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!p;break e;default:o=!1}if(o)return null;if(d&&typeof d!="function")throw Error(r(231,a,typeof d));return d}var Ni=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fm=!1;if(Ni)try{var lc={};Object.defineProperty(lc,"passive",{get:function(){Fm=!0}}),window.addEventListener("test",lc,lc),window.removeEventListener("test",lc,lc)}catch{Fm=!1}var ps=null,qm=null,Dd=null;function zv(){if(Dd)return Dd;var o,a=qm,d=a.length,p,y="value"in ps?ps.value:ps.textContent,x=y.length;for(o=0;o<d&&a[o]===y[o];o++);var w=d-o;for(p=1;p<=w&&a[d-p]===y[x-p];p++);return Dd=y.slice(o,1<p?1-p:void 0)}function Rd(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 Nd(){return!0}function Lv(){return!1}function Kn(o){function a(d,p,y,x,w){this._reactName=d,this._targetInst=y,this.type=p,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var T in o)o.hasOwnProperty(T)&&(d=o[T],this[T]=d?d(x):x[T]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Nd:Lv,this.isPropagationStopped=Lv,this}return m(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Nd)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Nd)},persist:function(){},isPersistent:Nd}),a}var xo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zd=Kn(xo),ac=m({},xo,{view:0,detail:0}),L2=Kn(ac),Km,Ym,cc,Ld=m({},ac,{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!==cc&&(cc&&o.type==="mousemove"?(Km=o.screenX-cc.screenX,Ym=o.screenY-cc.screenY):Ym=Km=0,cc=o),Km)},movementY:function(o){return"movementY"in o?o.movementY:Ym}}),jv=Kn(Ld),j2=m({},Ld,{dataTransfer:0}),I2=Kn(j2),B2=m({},ac,{relatedTarget:0}),Wm=Kn(B2),U2=m({},xo,{animationName:0,elapsedTime:0,pseudoElement:0}),H2=Kn(U2),V2=m({},xo,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),P2=Kn(V2),$2=m({},xo,{data:0}),Iv=Kn($2),F2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},q2={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"},K2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Y2(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=K2[o])?!!a[o]:!1}function Gm(){return Y2}var W2=m({},ac,{key:function(o){if(o.key){var a=F2[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=Rd(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?q2[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"?Rd(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Rd(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),G2=Kn(W2),Z2=m({},Ld,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Bv=Kn(Z2),J2=m({},ac,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gm}),X2=Kn(J2),Q2=m({},xo,{propertyName:0,elapsedTime:0,pseudoElement:0}),eN=Kn(Q2),tN=m({},Ld,{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}),nN=Kn(tN),rN=m({},xo,{newState:0,oldState:0}),iN=Kn(rN),sN=[9,13,27,32],Zm=Ni&&"CompositionEvent"in window,uc=null;Ni&&"documentMode"in document&&(uc=document.documentMode);var oN=Ni&&"TextEvent"in window&&!uc,Uv=Ni&&(!Zm||uc&&8<uc&&11>=uc),Hv=" ",Vv=!1;function Pv(o,a){switch(o){case"keyup":return sN.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $v(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Al=!1;function lN(o,a){switch(o){case"compositionend":return $v(a);case"keypress":return a.which!==32?null:(Vv=!0,Hv);case"textInput":return o=a.data,o===Hv&&Vv?null:o;default:return null}}function aN(o,a){if(Al)return o==="compositionend"||!Zm&&Pv(o,a)?(o=zv(),Dd=qm=ps=null,Al=!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 Uv&&a.locale!=="ko"?null:a.data;default:return null}}var cN={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 Fv(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!cN[o.type]:a==="textarea"}function qv(o,a,d,p){El?Tl?Tl.push(p):Tl=[p]:El=p,a=Ef(a,"onChange"),0<a.length&&(d=new zd("onChange","change",null,d,p),o.push({event:d,listeners:a}))}var dc=null,fc=null;function uN(o){Ak(o,0)}function jd(o){var a=sc(o);if(Tv(a))return o}function Kv(o,a){if(o==="change")return a}var Yv=!1;if(Ni){var Jm;if(Ni){var Xm="oninput"in document;if(!Xm){var Wv=document.createElement("div");Wv.setAttribute("oninput","return;"),Xm=typeof Wv.oninput=="function"}Jm=Xm}else Jm=!1;Yv=Jm&&(!document.documentMode||9<document.documentMode)}function Gv(){dc&&(dc.detachEvent("onpropertychange",Zv),fc=dc=null)}function Zv(o){if(o.propertyName==="value"&&jd(fc)){var a=[];qv(a,fc,o,Pm(o)),Nv(uN,a)}}function dN(o,a,d){o==="focusin"?(Gv(),dc=a,fc=d,dc.attachEvent("onpropertychange",Zv)):o==="focusout"&&Gv()}function fN(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return jd(fc)}function hN(o,a){if(o==="click")return jd(a)}function pN(o,a){if(o==="input"||o==="change")return jd(a)}function mN(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var sr=typeof Object.is=="function"?Object.is:mN;function hc(o,a){if(sr(o,a))return!0;if(typeof o!="object"||o===null||typeof a!="object"||a===null)return!1;var d=Object.keys(o),p=Object.keys(a);if(d.length!==p.length)return!1;for(p=0;p<d.length;p++){var y=d[p];if(!Oi.call(a,y)||!sr(o[y],a[y]))return!1}return!0}function Jv(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function Xv(o,a){var d=Jv(o);o=0;for(var p;d;){if(d.nodeType===3){if(p=o+d.textContent.length,o<=a&&p>=a)return{node:d,offset:a-o};o=p}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Jv(d)}}function Qv(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?Qv(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function eS(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var a=Od(o.document);a instanceof o.HTMLIFrameElement;){try{var d=typeof a.contentWindow.location.href=="string"}catch{d=!1}if(d)o=a.contentWindow;else break;a=Od(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 gN=Ni&&"documentMode"in document&&11>=document.documentMode,Ml=null,eg=null,pc=null,tg=!1;function tS(o,a,d){var p=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;tg||Ml==null||Ml!==Od(p)||(p=Ml,"selectionStart"in p&&Qm(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),pc&&hc(pc,p)||(pc=p,p=Ef(eg,"onSelect"),0<p.length&&(a=new zd("onSelect","select",null,a,d),o.push({event:a,listeners:p}),a.target=Ml)))}function vo(o,a){var d={};return d[o.toLowerCase()]=a.toLowerCase(),d["Webkit"+o]="webkit"+a,d["Moz"+o]="moz"+a,d}var Ol={animationend:vo("Animation","AnimationEnd"),animationiteration:vo("Animation","AnimationIteration"),animationstart:vo("Animation","AnimationStart"),transitionrun:vo("Transition","TransitionRun"),transitionstart:vo("Transition","TransitionStart"),transitioncancel:vo("Transition","TransitionCancel"),transitionend:vo("Transition","TransitionEnd")},ng={},nS={};Ni&&(nS=document.createElement("div").style,"AnimationEvent"in window||(delete Ol.animationend.animation,delete Ol.animationiteration.animation,delete Ol.animationstart.animation),"TransitionEvent"in window||delete Ol.transitionend.transition);function So(o){if(ng[o])return ng[o];if(!Ol[o])return o;var a=Ol[o],d;for(d in a)if(a.hasOwnProperty(d)&&d in nS)return ng[o]=a[d];return o}var rS=So("animationend"),iS=So("animationiteration"),sS=So("animationstart"),yN=So("transitionrun"),bN=So("transitionstart"),xN=So("transitioncancel"),oS=So("transitionend"),lS=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 Yr(o,a){lS.set(o,a),bo(a,[o])}var Id=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)},kr=[],_l=0,ig=0;function Bd(){for(var o=_l,a=ig=_l=0;a<o;){var d=kr[a];kr[a++]=null;var p=kr[a];kr[a++]=null;var y=kr[a];kr[a++]=null;var x=kr[a];if(kr[a++]=null,p!==null&&y!==null){var w=p.pending;w===null?y.next=y:(y.next=w.next,w.next=y),p.pending=y}x!==0&&aS(d,y,x)}}function Ud(o,a,d,p){kr[_l++]=o,kr[_l++]=a,kr[_l++]=d,kr[_l++]=p,ig|=p,o.lanes|=p,o=o.alternate,o!==null&&(o.lanes|=p)}function sg(o,a,d,p){return Ud(o,a,d,p),Hd(o)}function wo(o,a){return Ud(o,null,null,a),Hd(o)}function aS(o,a,d){o.lanes|=d;var p=o.alternate;p!==null&&(p.lanes|=d);for(var y=!1,x=o.return;x!==null;)x.childLanes|=d,p=x.alternate,p!==null&&(p.childLanes|=d),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-ot(d),o=x.hiddenUpdates,p=o[y],p===null?o[y]=[a]:p.push(a),a.lane=d|536870912),x):null}function Hd(o){if(50<jc)throw jc=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 Dl={};function vN(o,a,d,p){this.tag=o,this.key=d,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=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function or(o,a,d,p){return new vN(o,a,d,p)}function og(o){return o=o.prototype,!(!o||!o.isReactComponent)}function zi(o,a){var d=o.alternate;return d===null?(d=or(o.tag,a,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=a,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&65011712,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,a=o.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d.refCleanup=o.refCleanup,d}function cS(o,a){o.flags&=65011714;var d=o.alternate;return d===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=d.childLanes,o.lanes=d.lanes,o.child=d.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=d.memoizedProps,o.memoizedState=d.memoizedState,o.updateQueue=d.updateQueue,o.type=d.type,a=d.dependencies,o.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),o}function Vd(o,a,d,p,y,x){var w=0;if(p=o,typeof o=="function")og(o)&&(w=1);else if(typeof o=="string")w=Ez(o,d,ne.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case W:return o=or(31,d,a,y),o.elementType=W,o.lanes=x,o;case k:return ko(d.children,y,x,a);case C:w=8,y|=24;break;case E:return o=or(12,d,a,y|2),o.elementType=E,o.lanes=x,o;case V:return o=or(13,d,a,y),o.elementType=V,o.lanes=x,o;case R:return o=or(19,d,a,y),o.elementType=R,o.lanes=x,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case j:w=10;break e;case L:w=9;break e;case Y:w=11;break e;case B:w=14;break e;case te:w=16,p=null;break e}w=29,d=Error(r(130,o===null?"null":typeof o,"")),p=null}return a=or(w,d,a,y),a.elementType=o,a.type=p,a.lanes=x,a}function ko(o,a,d,p){return o=or(7,o,p,a),o.lanes=d,o}function lg(o,a,d){return o=or(6,o,null,a),o.lanes=d,o}function uS(o){var a=or(18,null,null,0);return a.stateNode=o,a}function ag(o,a,d){return a=or(4,o.children!==null?o.children:[],o.key,a),a.lanes=d,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}var dS=new WeakMap;function Cr(o,a){if(typeof o=="object"&&o!==null){var d=dS.get(o);return d!==void 0?d:(a={value:o,source:a,stack:Mi(a)},dS.set(o,a),a)}return{value:o,source:a,stack:Mi(a)}}var Rl=[],Nl=0,Pd=null,mc=0,Er=[],Tr=0,ms=null,oi=1,li="";function Li(o,a){Rl[Nl++]=mc,Rl[Nl++]=Pd,Pd=o,mc=a}function fS(o,a,d){Er[Tr++]=oi,Er[Tr++]=li,Er[Tr++]=ms,ms=o;var p=oi;o=li;var y=32-ot(p)-1;p&=~(1<<y),d+=1;var x=32-ot(a)+y;if(30<x){var w=y-y%5;x=(p&(1<<w)-1).toString(32),p>>=w,y-=w,oi=1<<32-ot(a)+y|d<<y|p,li=x+o}else oi=1<<x|d<<y|p,li=o}function cg(o){o.return!==null&&(Li(o,1),fS(o,1,0))}function ug(o){for(;o===Pd;)Pd=Rl[--Nl],Rl[Nl]=null,mc=Rl[--Nl],Rl[Nl]=null;for(;o===ms;)ms=Er[--Tr],Er[Tr]=null,li=Er[--Tr],Er[Tr]=null,oi=Er[--Tr],Er[Tr]=null}function hS(o,a){Er[Tr++]=oi,Er[Tr++]=li,Er[Tr++]=ms,oi=a.id,li=a.overflow,ms=o}var yn=null,kt=null,Qe=!1,gs=null,Ar=!1,dg=Error(r(519));function ys(o){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw gc(Cr(a,o)),dg}function pS(o){var a=o.stateNode,d=o.type,p=o.memoizedProps;switch(a[gn]=o,a[qn]=p,d){case"dialog":We("cancel",a),We("close",a);break;case"iframe":case"object":case"embed":We("load",a);break;case"video":case"audio":for(d=0;d<Bc.length;d++)We(Bc[d],a);break;case"source":We("error",a);break;case"img":case"image":case"link":We("error",a),We("load",a);break;case"details":We("toggle",a);break;case"input":We("invalid",a),Av(a,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":We("invalid",a);break;case"textarea":We("invalid",a),Ov(a,p.value,p.defaultValue,p.children)}d=p.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||a.textContent===""+d||p.suppressHydrationWarning===!0||Dk(a.textContent,d)?(p.popover!=null&&(We("beforetoggle",a),We("toggle",a)),p.onScroll!=null&&We("scroll",a),p.onScrollEnd!=null&&We("scrollend",a),p.onClick!=null&&(a.onclick=Ri),a=!0):a=!1,a||ys(o,!0)}function mS(o){for(yn=o.return;yn;)switch(yn.tag){case 5:case 31:case 13:Ar=!1;return;case 27:case 3:Ar=!0;return;default:yn=yn.return}}function zl(o){if(o!==yn)return!1;if(!Qe)return mS(o),Qe=!0,!1;var a=o.tag,d;if((d=a!==3&&a!==27)&&((d=a===5)&&(d=o.type,d=!(d!=="form"&&d!=="button")||Oy(o.type,o.memoizedProps)),d=!d),d&&kt&&ys(o),mS(o),a===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));kt=Hk(o)}else if(a===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));kt=Hk(o)}else a===27?(a=kt,Ds(o.type)?(o=zy,zy=null,kt=o):kt=a):kt=yn?Or(o.stateNode.nextSibling):null;return!0}function Co(){kt=yn=null,Qe=!1}function fg(){var o=gs;return o!==null&&(Zn===null?Zn=o:Zn.push.apply(Zn,o),gs=null),o}function gc(o){gs===null?gs=[o]:gs.push(o)}var hg=_(null),Eo=null,ji=null;function bs(o,a,d){A(hg,a._currentValue),a._currentValue=d}function Ii(o){o._currentValue=hg.current,I(hg)}function pg(o,a,d){for(;o!==null;){var p=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,p!==null&&(p.childLanes|=a)):p!==null&&(p.childLanes&a)!==a&&(p.childLanes|=a),o===d)break;o=o.return}}function mg(o,a,d,p){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 T=x;x=y;for(var D=0;D<a.length;D++)if(T.context===a[D]){x.lanes|=d,T=x.alternate,T!==null&&(T.lanes|=d),pg(x.return,d,o),p||(w=null);break e}x=T.next}}else if(y.tag===18){if(w=y.return,w===null)throw Error(r(341));w.lanes|=d,x=w.alternate,x!==null&&(x.lanes|=d),pg(w,d,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 Ll(o,a,d,p){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 T=y.type;sr(y.pendingProps.value,w.value)||(o!==null?o.push(T):o=[T])}}else if(y===me.current){if(w=y.alternate,w===null)throw Error(r(387));w.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(o!==null?o.push($c):o=[$c])}y=y.return}o!==null&&mg(a,o,d,p),a.flags|=262144}function $d(o){for(o=o.firstContext;o!==null;){if(!sr(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function To(o){Eo=o,ji=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function bn(o){return gS(Eo,o)}function Fd(o,a){return Eo===null&&To(o),gS(o,a)}function gS(o,a){var d=a._currentValue;if(a={context:a,memoizedValue:d,next:null},ji===null){if(o===null)throw Error(r(308));ji=a,o.dependencies={lanes:0,firstContext:a},o.flags|=524288}else ji=ji.next=a;return d}var SN=typeof AbortController<"u"?AbortController:function(){var o=[],a=this.signal={aborted:!1,addEventListener:function(d,p){o.push(p)}};this.abort=function(){a.aborted=!0,o.forEach(function(d){return d()})}},wN=t.unstable_scheduleCallback,kN=t.unstable_NormalPriority,Pt={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function gg(){return{controller:new SN,data:new Map,refCount:0}}function yc(o){o.refCount--,o.refCount===0&&wN(kN,function(){o.controller.abort()})}var bc=null,yg=0,jl=0,Il=null;function CN(o,a){if(bc===null){var d=bc=[];yg=0,jl=vy(),Il={status:"pending",value:void 0,then:function(p){d.push(p)}}}return yg++,a.then(yS,yS),a}function yS(){if(--yg===0&&bc!==null){Il!==null&&(Il.status="fulfilled");var o=bc;bc=null,jl=0,Il=null;for(var a=0;a<o.length;a++)(0,o[a])()}}function EN(o,a){var d=[],p={status:"pending",value:null,reason:null,then:function(y){d.push(y)}};return o.then(function(){p.status="fulfilled",p.value=a;for(var y=0;y<d.length;y++)(0,d[y])(a)},function(y){for(p.status="rejected",p.reason=y,y=0;y<d.length;y++)(0,d[y])(void 0)}),p}var bS=N.S;N.S=function(o,a){tk=Xt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&CN(o,a),bS!==null&&bS(o,a)};var Ao=_(null);function bg(){var o=Ao.current;return o!==null?o:mt.pooledCache}function qd(o,a){a===null?A(Ao,Ao.current):A(Ao,a.pool)}function xS(){var o=bg();return o===null?null:{parent:Pt._currentValue,pool:o}}var Bl=Error(r(460)),xg=Error(r(474)),Kd=Error(r(542)),Yd={then:function(){}};function vS(o){return o=o.status,o==="fulfilled"||o==="rejected"}function SS(o,a,d){switch(d=o[d],d===void 0?o.push(a):d!==a&&(a.then(Ri,Ri),a=d),a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,kS(o),o;default:if(typeof a.status=="string")a.then(Ri,Ri);else{if(o=mt,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=a,o.status="pending",o.then(function(p){if(a.status==="pending"){var y=a;y.status="fulfilled",y.value=p}},function(p){if(a.status==="pending"){var y=a;y.status="rejected",y.reason=p}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,kS(o),o}throw Oo=a,Bl}}function Mo(o){try{var a=o._init;return a(o._payload)}catch(d){throw d!==null&&typeof d=="object"&&typeof d.then=="function"?(Oo=d,Bl):d}}var Oo=null;function wS(){if(Oo===null)throw Error(r(459));var o=Oo;return Oo=null,o}function kS(o){if(o===Bl||o===Kd)throw Error(r(483))}var Ul=null,xc=0;function Wd(o){var a=xc;return xc+=1,Ul===null&&(Ul=[]),SS(Ul,o,a)}function vc(o,a){a=a.props.ref,o.ref=a!==void 0?a:null}function Gd(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 CS(o){function a(U,z){if(o){var P=U.deletions;P===null?(U.deletions=[z],U.flags|=16):P.push(z)}}function d(U,z){if(!o)return null;for(;z!==null;)a(U,z),z=z.sibling;return null}function p(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=zi(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 T(U,z,P,X){return z===null||z.tag!==6?(z=lg(P,U.mode,X),z.return=U,z):(z=y(z,P),z.return=U,z)}function D(U,z,P,X){var Me=P.type;return Me===k?G(U,z,P.props.children,X,P.key):z!==null&&(z.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===te&&Mo(Me)===z.type)?(z=y(z,P.props),vc(z,P),z.return=U,z):(z=Vd(P.type,P.key,P.props,null,U.mode,X),vc(z,P),z.return=U,z)}function $(U,z,P,X){return z===null||z.tag!==4||z.stateNode.containerInfo!==P.containerInfo||z.stateNode.implementation!==P.implementation?(z=ag(P,U.mode,X),z.return=U,z):(z=y(z,P.children||[]),z.return=U,z)}function G(U,z,P,X,Me){return z===null||z.tag!==7?(z=ko(P,U.mode,X,Me),z.return=U,z):(z=y(z,P),z.return=U,z)}function Q(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=Vd(z.type,z.key,z.props,null,U.mode,P),vc(P,z),P.return=U,P;case v:return z=ag(z,U.mode,P),z.return=U,z;case te:return z=Mo(z),Q(U,z,P)}if(H(z)||ie(z))return z=ko(z,U.mode,P,null),z.return=U,z;if(typeof z.then=="function")return Q(U,Wd(z),P);if(z.$$typeof===j)return Q(U,Fd(U,z),P);Gd(U,z)}return null}function F(U,z,P,X){var Me=z!==null?z.key:null;if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return Me!==null?null:T(U,z,""+P,X);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case b:return P.key===Me?D(U,z,P,X):null;case v:return P.key===Me?$(U,z,P,X):null;case te:return P=Mo(P),F(U,z,P,X)}if(H(P)||ie(P))return Me!==null?null:G(U,z,P,X,null);if(typeof P.then=="function")return F(U,z,Wd(P),X);if(P.$$typeof===j)return F(U,z,Fd(U,P),X);Gd(U,P)}return null}function q(U,z,P,X,Me){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return U=U.get(P)||null,T(z,U,""+X,Me);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case b:return U=U.get(X.key===null?P:X.key)||null,D(z,U,X,Me);case v:return U=U.get(X.key===null?P:X.key)||null,$(z,U,X,Me);case te:return X=Mo(X),q(U,z,P,X,Me)}if(H(X)||ie(X))return U=U.get(P)||null,G(z,U,X,Me,null);if(typeof X.then=="function")return q(U,z,P,Wd(X),Me);if(X.$$typeof===j)return q(U,z,P,Fd(z,X),Me);Gd(z,X)}return null}function xe(U,z,P,X){for(var Me=null,nt=null,ke=z,Ve=z=0,Je=null;ke!==null&&Ve<P.length;Ve++){ke.index>Ve?(Je=ke,ke=null):Je=ke.sibling;var rt=F(U,ke,P[Ve],X);if(rt===null){ke===null&&(ke=Je);break}o&&ke&&rt.alternate===null&&a(U,ke),z=x(rt,z,Ve),nt===null?Me=rt:nt.sibling=rt,nt=rt,ke=Je}if(Ve===P.length)return d(U,ke),Qe&&Li(U,Ve),Me;if(ke===null){for(;Ve<P.length;Ve++)ke=Q(U,P[Ve],X),ke!==null&&(z=x(ke,z,Ve),nt===null?Me=ke:nt.sibling=ke,nt=ke);return Qe&&Li(U,Ve),Me}for(ke=p(ke);Ve<P.length;Ve++)Je=q(ke,U,Ve,P[Ve],X),Je!==null&&(o&&Je.alternate!==null&&ke.delete(Je.key===null?Ve:Je.key),z=x(Je,z,Ve),nt===null?Me=Je:nt.sibling=Je,nt=Je);return o&&ke.forEach(function(js){return a(U,js)}),Qe&&Li(U,Ve),Me}function De(U,z,P,X){if(P==null)throw Error(r(151));for(var Me=null,nt=null,ke=z,Ve=z=0,Je=null,rt=P.next();ke!==null&&!rt.done;Ve++,rt=P.next()){ke.index>Ve?(Je=ke,ke=null):Je=ke.sibling;var js=F(U,ke,rt.value,X);if(js===null){ke===null&&(ke=Je);break}o&&ke&&js.alternate===null&&a(U,ke),z=x(js,z,Ve),nt===null?Me=js:nt.sibling=js,nt=js,ke=Je}if(rt.done)return d(U,ke),Qe&&Li(U,Ve),Me;if(ke===null){for(;!rt.done;Ve++,rt=P.next())rt=Q(U,rt.value,X),rt!==null&&(z=x(rt,z,Ve),nt===null?Me=rt:nt.sibling=rt,nt=rt);return Qe&&Li(U,Ve),Me}for(ke=p(ke);!rt.done;Ve++,rt=P.next())rt=q(ke,U,Ve,rt.value,X),rt!==null&&(o&&rt.alternate!==null&&ke.delete(rt.key===null?Ve:rt.key),z=x(rt,z,Ve),nt===null?Me=rt:nt.sibling=rt,nt=rt);return o&&ke.forEach(function(jz){return a(U,jz)}),Qe&&Li(U,Ve),Me}function ht(U,z,P,X){if(typeof P=="object"&&P!==null&&P.type===k&&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===k){if(z.tag===7){d(U,z.sibling),X=y(z,P.props.children),X.return=U,U=X;break e}}else if(z.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===te&&Mo(Me)===z.type){d(U,z.sibling),X=y(z,P.props),vc(X,P),X.return=U,U=X;break e}d(U,z);break}else a(U,z);z=z.sibling}P.type===k?(X=ko(P.props.children,U.mode,X,P.key),X.return=U,U=X):(X=Vd(P.type,P.key,P.props,null,U.mode,X),vc(X,P),X.return=U,U=X)}return w(U);case v: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){d(U,z.sibling),X=y(z,P.children||[]),X.return=U,U=X;break e}else{d(U,z);break}else a(U,z);z=z.sibling}X=ag(P,U.mode,X),X.return=U,U=X}return w(U);case te:return P=Mo(P),ht(U,z,P,X)}if(H(P))return xe(U,z,P,X);if(ie(P)){if(Me=ie(P),typeof Me!="function")throw Error(r(150));return P=Me.call(P),De(U,z,P,X)}if(typeof P.then=="function")return ht(U,z,Wd(P),X);if(P.$$typeof===j)return ht(U,z,Fd(U,P),X);Gd(U,P)}return typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint"?(P=""+P,z!==null&&z.tag===6?(d(U,z.sibling),X=y(z,P),X.return=U,U=X):(d(U,z),X=lg(P,U.mode,X),X.return=U,U=X),w(U)):d(U,z)}return function(U,z,P,X){try{xc=0;var Me=ht(U,z,P,X);return Ul=null,Me}catch(ke){if(ke===Bl||ke===Kd)throw ke;var nt=or(29,ke,null,U.mode);return nt.lanes=X,nt.return=U,nt}finally{}}}var _o=CS(!0),ES=CS(!1),xs=!1;function vg(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sg(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 vs(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Ss(o,a,d){var p=o.updateQueue;if(p===null)return null;if(p=p.shared,(lt&2)!==0){var y=p.pending;return y===null?a.next=a:(a.next=y.next,y.next=a),p.pending=a,a=Hd(o),aS(o,null,d),a}return Ud(o,p,a,d),Hd(o)}function Sc(o,a,d){if(a=a.updateQueue,a!==null&&(a=a.shared,(d&4194048)!==0)){var p=a.lanes;p&=o.pendingLanes,d|=p,a.lanes=d,gv(o,d)}}function wg(o,a){var d=o.updateQueue,p=o.alternate;if(p!==null&&(p=p.updateQueue,d===p)){var y=null,x=null;if(d=d.firstBaseUpdate,d!==null){do{var w={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};x===null?y=x=w:x=x.next=w,d=d.next}while(d!==null);x===null?y=x=a:x=x.next=a}else y=x=a;d={baseState:p.baseState,firstBaseUpdate:y,lastBaseUpdate:x,shared:p.shared,callbacks:p.callbacks},o.updateQueue=d;return}o=d.lastBaseUpdate,o===null?d.firstBaseUpdate=a:o.next=a,d.lastBaseUpdate=a}var kg=!1;function wc(){if(kg){var o=Il;if(o!==null)throw o}}function kc(o,a,d,p){kg=!1;var y=o.updateQueue;xs=!1;var x=y.firstBaseUpdate,w=y.lastBaseUpdate,T=y.shared.pending;if(T!==null){y.shared.pending=null;var D=T,$=D.next;D.next=null,w===null?x=$:w.next=$,w=D;var G=o.alternate;G!==null&&(G=G.updateQueue,T=G.lastBaseUpdate,T!==w&&(T===null?G.firstBaseUpdate=$:T.next=$,G.lastBaseUpdate=D))}if(x!==null){var Q=y.baseState;w=0,G=$=D=null,T=x;do{var F=T.lane&-536870913,q=F!==T.lane;if(q?(Ze&F)===F:(p&F)===F){F!==0&&F===jl&&(kg=!0),G!==null&&(G=G.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var xe=o,De=T;F=a;var ht=d;switch(De.tag){case 1:if(xe=De.payload,typeof xe=="function"){Q=xe.call(ht,Q,F);break e}Q=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=De.payload,F=typeof xe=="function"?xe.call(ht,Q,F):xe,F==null)break e;Q=m({},Q,F);break e;case 2:xs=!0}}F=T.callback,F!==null&&(o.flags|=64,q&&(o.flags|=8192),q=y.callbacks,q===null?y.callbacks=[F]:q.push(F))}else q={lane:F,tag:T.tag,payload:T.payload,callback:T.callback,next:null},G===null?($=G=q,D=Q):G=G.next=q,w|=F;if(T=T.next,T===null){if(T=y.shared.pending,T===null)break;q=T,T=q.next,q.next=null,y.lastBaseUpdate=q,y.shared.pending=null}}while(!0);G===null&&(D=Q),y.baseState=D,y.firstBaseUpdate=$,y.lastBaseUpdate=G,x===null&&(y.shared.lanes=0),Ts|=w,o.lanes=w,o.memoizedState=Q}}function TS(o,a){if(typeof o!="function")throw Error(r(191,o));o.call(a)}function AS(o,a){var d=o.callbacks;if(d!==null)for(o.callbacks=null,o=0;o<d.length;o++)TS(d[o],a)}var Hl=_(null),Zd=_(0);function MS(o,a){o=Ki,A(Zd,o),A(Hl,a),Ki=o|a.baseLanes}function Cg(){A(Zd,Ki),A(Hl,Hl.current)}function Eg(){Ki=Zd.current,I(Hl),I(Zd)}var lr=_(null),Mr=null;function ws(o){var a=o.alternate;A(Bt,Bt.current&1),A(lr,o),Mr===null&&(a===null||Hl.current!==null||a.memoizedState!==null)&&(Mr=o)}function Tg(o){A(Bt,Bt.current),A(lr,o),Mr===null&&(Mr=o)}function OS(o){o.tag===22?(A(Bt,Bt.current),A(lr,o),Mr===null&&(Mr=o)):ks()}function ks(){A(Bt,Bt.current),A(lr,lr.current)}function ar(o){I(lr),Mr===o&&(Mr=null),I(Bt)}var Bt=_(0);function Jd(o){for(var a=o;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Ry(d)||Ny(d)))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 Bi=0,Ue=null,dt=null,$t=null,Xd=!1,Vl=!1,Do=!1,Qd=0,Cc=0,Pl=null,TN=0;function Ot(){throw Error(r(321))}function Ag(o,a){if(a===null)return!1;for(var d=0;d<a.length&&d<o.length;d++)if(!sr(o[d],a[d]))return!1;return!0}function Mg(o,a,d,p,y,x){return Bi=x,Ue=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,N.H=o===null||o.memoizedState===null?fw:$g,Do=!1,x=d(p,y),Do=!1,Vl&&(x=DS(a,d,p,y)),_S(o),x}function _S(o){N.H=Ac;var a=dt!==null&&dt.next!==null;if(Bi=0,$t=dt=Ue=null,Xd=!1,Cc=0,Pl=null,a)throw Error(r(300));o===null||Ft||(o=o.dependencies,o!==null&&$d(o)&&(Ft=!0))}function DS(o,a,d,p){Ue=o;var y=0;do{if(Vl&&(Pl=null),Cc=0,Vl=!1,25<=y)throw Error(r(301));if(y+=1,$t=dt=null,o.updateQueue!=null){var x=o.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}N.H=hw,x=a(d,p)}while(Vl);return x}function AN(){var o=N.H,a=o.useState()[0];return a=typeof a.then=="function"?Ec(a):a,o=o.useState()[0],(dt!==null?dt.memoizedState:null)!==o&&(Ue.flags|=1024),a}function Og(){var o=Qd!==0;return Qd=0,o}function _g(o,a,d){a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~d}function Dg(o){if(Xd){for(o=o.memoizedState;o!==null;){var a=o.queue;a!==null&&(a.pending=null),o=o.next}Xd=!1}Bi=0,$t=dt=Ue=null,Vl=!1,Cc=Qd=0,Pl=null}function jn(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $t===null?Ue.memoizedState=$t=o:$t=$t.next=o,$t}function Ut(){if(dt===null){var o=Ue.alternate;o=o!==null?o.memoizedState:null}else o=dt.next;var a=$t===null?Ue.memoizedState:$t.next;if(a!==null)$t=a,dt=o;else{if(o===null)throw Ue.alternate===null?Error(r(467)):Error(r(310));dt=o,o={memoizedState:dt.memoizedState,baseState:dt.baseState,baseQueue:dt.baseQueue,queue:dt.queue,next:null},$t===null?Ue.memoizedState=$t=o:$t=$t.next=o}return $t}function ef(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ec(o){var a=Cc;return Cc+=1,Pl===null&&(Pl=[]),o=SS(Pl,o,a),a=Ue,($t===null?a.memoizedState:$t.next)===null&&(a=a.alternate,N.H=a===null||a.memoizedState===null?fw:$g),o}function tf(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return Ec(o);if(o.$$typeof===j)return bn(o)}throw Error(r(438,String(o)))}function Rg(o){var a=null,d=Ue.updateQueue;if(d!==null&&(a=d.memoCache),a==null){var p=Ue.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(a={data:p.data.map(function(y){return y.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),d===null&&(d=ef(),Ue.updateQueue=d),d.memoCache=a,d=a.data[a.index],d===void 0)for(d=a.data[a.index]=Array(o),p=0;p<o;p++)d[p]=oe;return a.index++,d}function Ui(o,a){return typeof a=="function"?a(o):a}function nf(o){var a=Ut();return Ng(a,dt,o)}function Ng(o,a,d){var p=o.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=d;var y=o.baseQueue,x=p.pending;if(x!==null){if(y!==null){var w=y.next;y.next=x.next,x.next=w}a.baseQueue=y=x,p.pending=null}if(x=o.baseState,y===null)o.memoizedState=x;else{a=y.next;var T=w=null,D=null,$=a,G=!1;do{var Q=$.lane&-536870913;if(Q!==$.lane?(Ze&Q)===Q:(Bi&Q)===Q){var F=$.revertLane;if(F===0)D!==null&&(D=D.next={lane:0,revertLane:0,gesture:null,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null}),Q===jl&&(G=!0);else if((Bi&F)===F){$=$.next,F===jl&&(G=!0);continue}else Q={lane:0,revertLane:$.revertLane,gesture:null,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},D===null?(T=D=Q,w=x):D=D.next=Q,Ue.lanes|=F,Ts|=F;Q=$.action,Do&&d(x,Q),x=$.hasEagerState?$.eagerState:d(x,Q)}else F={lane:Q,revertLane:$.revertLane,gesture:$.gesture,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},D===null?(T=D=F,w=x):D=D.next=F,Ue.lanes|=Q,Ts|=Q;$=$.next}while($!==null&&$!==a);if(D===null?w=x:D.next=T,!sr(x,o.memoizedState)&&(Ft=!0,G&&(d=Il,d!==null)))throw d;o.memoizedState=x,o.baseState=w,o.baseQueue=D,p.lastRenderedState=x}return y===null&&(p.lanes=0),[o.memoizedState,p.dispatch]}function zg(o){var a=Ut(),d=a.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=o;var p=d.dispatch,y=d.pending,x=a.memoizedState;if(y!==null){d.pending=null;var w=y=y.next;do x=o(x,w.action),w=w.next;while(w!==y);sr(x,a.memoizedState)||(Ft=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),d.lastRenderedState=x}return[x,p]}function RS(o,a,d){var p=Ue,y=Ut(),x=Qe;if(x){if(d===void 0)throw Error(r(407));d=d()}else d=a();var w=!sr((dt||y).memoizedState,d);if(w&&(y.memoizedState=d,Ft=!0),y=y.queue,Ig(LS.bind(null,p,y,o),[o]),y.getSnapshot!==a||w||$t!==null&&$t.memoizedState.tag&1){if(p.flags|=2048,$l(9,{destroy:void 0},zS.bind(null,p,y,d,a),null),mt===null)throw Error(r(349));x||(Bi&127)!==0||NS(p,a,d)}return d}function NS(o,a,d){o.flags|=16384,o={getSnapshot:a,value:d},a=Ue.updateQueue,a===null?(a=ef(),Ue.updateQueue=a,a.stores=[o]):(d=a.stores,d===null?a.stores=[o]:d.push(o))}function zS(o,a,d,p){a.value=d,a.getSnapshot=p,jS(a)&&IS(o)}function LS(o,a,d){return d(function(){jS(a)&&IS(o)})}function jS(o){var a=o.getSnapshot;o=o.value;try{var d=a();return!sr(o,d)}catch{return!0}}function IS(o){var a=wo(o,2);a!==null&&Jn(a,o,2)}function Lg(o){var a=jn();if(typeof o=="function"){var d=o;if(o=d(),Do){Qt(!0);try{d()}finally{Qt(!1)}}}return a.memoizedState=a.baseState=o,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ui,lastRenderedState:o},a}function BS(o,a,d,p){return o.baseState=d,Ng(o,dt,typeof p=="function"?p:Ui)}function MN(o,a,d,p,y){if(of(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)}};N.T!==null?d(!0):x.isTransition=!1,p(x),d=a.pending,d===null?(x.next=a.pending=x,US(a,x)):(x.next=d.next,a.pending=d.next=x)}}function US(o,a){var d=a.action,p=a.payload,y=o.state;if(a.isTransition){var x=N.T,w={};N.T=w;try{var T=d(y,p),D=N.S;D!==null&&D(w,T),HS(o,a,T)}catch($){jg(o,a,$)}finally{x!==null&&w.types!==null&&(x.types=w.types),N.T=x}}else try{x=d(y,p),HS(o,a,x)}catch($){jg(o,a,$)}}function HS(o,a,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(p){VS(o,a,p)},function(p){return jg(o,a,p)}):VS(o,a,d)}function VS(o,a,d){a.status="fulfilled",a.value=d,PS(a),o.state=d,a=o.pending,a!==null&&(d=a.next,d===a?o.pending=null:(d=d.next,a.next=d,US(o,d)))}function jg(o,a,d){var p=o.pending;if(o.pending=null,p!==null){p=p.next;do a.status="rejected",a.reason=d,PS(a),a=a.next;while(a!==p)}o.action=null}function PS(o){o=o.listeners;for(var a=0;a<o.length;a++)(0,o[a])()}function $S(o,a){return a}function FS(o,a){if(Qe){var d=mt.formState;if(d!==null){e:{var p=Ue;if(Qe){if(kt){t:{for(var y=kt,x=Ar;y.nodeType!==8;){if(!x){y=null;break t}if(y=Or(y.nextSibling),y===null){y=null;break t}}x=y.data,y=x==="F!"||x==="F"?y:null}if(y){kt=Or(y.nextSibling),p=y.data==="F!";break e}}ys(p)}p=!1}p&&(a=d[0])}}return d=jn(),d.memoizedState=d.baseState=a,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$S,lastRenderedState:a},d.queue=p,d=cw.bind(null,Ue,p),p.dispatch=d,p=Lg(!1),x=Pg.bind(null,Ue,!1,p.queue),p=jn(),y={state:a,dispatch:null,action:o,pending:null},p.queue=y,d=MN.bind(null,Ue,y,x,d),y.dispatch=d,p.memoizedState=o,[a,d,!1]}function qS(o){var a=Ut();return KS(a,dt,o)}function KS(o,a,d){if(a=Ng(o,a,$S)[0],o=nf(Ui)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var p=Ec(a)}catch(w){throw w===Bl?Kd:w}else p=a;a=Ut();var y=a.queue,x=y.dispatch;return d!==a.memoizedState&&(Ue.flags|=2048,$l(9,{destroy:void 0},ON.bind(null,y,d),null)),[p,x,o]}function ON(o,a){o.action=a}function YS(o){var a=Ut(),d=dt;if(d!==null)return KS(a,d,o);Ut(),a=a.memoizedState,d=Ut();var p=d.queue.dispatch;return d.memoizedState=o,[a,p,!1]}function $l(o,a,d,p){return o={tag:o,create:d,deps:p,inst:a,next:null},a=Ue.updateQueue,a===null&&(a=ef(),Ue.updateQueue=a),d=a.lastEffect,d===null?a.lastEffect=o.next=o:(p=d.next,d.next=o,o.next=p,a.lastEffect=o),o}function WS(){return Ut().memoizedState}function rf(o,a,d,p){var y=jn();Ue.flags|=o,y.memoizedState=$l(1|a,{destroy:void 0},d,p===void 0?null:p)}function sf(o,a,d,p){var y=Ut();p=p===void 0?null:p;var x=y.memoizedState.inst;dt!==null&&p!==null&&Ag(p,dt.memoizedState.deps)?y.memoizedState=$l(a,x,d,p):(Ue.flags|=o,y.memoizedState=$l(1|a,x,d,p))}function GS(o,a){rf(8390656,8,o,a)}function Ig(o,a){sf(2048,8,o,a)}function _N(o){Ue.flags|=4;var a=Ue.updateQueue;if(a===null)a=ef(),Ue.updateQueue=a,a.events=[o];else{var d=a.events;d===null?a.events=[o]:d.push(o)}}function ZS(o){var a=Ut().memoizedState;return _N({ref:a,nextImpl:o}),function(){if((lt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function JS(o,a){return sf(4,2,o,a)}function XS(o,a){return sf(4,4,o,a)}function QS(o,a){if(typeof a=="function"){o=o();var d=a(o);return function(){typeof d=="function"?d():a(null)}}if(a!=null)return o=o(),a.current=o,function(){a.current=null}}function ew(o,a,d){d=d!=null?d.concat([o]):null,sf(4,4,QS.bind(null,a,o),d)}function Bg(){}function tw(o,a){var d=Ut();a=a===void 0?null:a;var p=d.memoizedState;return a!==null&&Ag(a,p[1])?p[0]:(d.memoizedState=[o,a],o)}function nw(o,a){var d=Ut();a=a===void 0?null:a;var p=d.memoizedState;if(a!==null&&Ag(a,p[1]))return p[0];if(p=o(),Do){Qt(!0);try{o()}finally{Qt(!1)}}return d.memoizedState=[p,a],p}function Ug(o,a,d){return d===void 0||(Bi&1073741824)!==0&&(Ze&261930)===0?o.memoizedState=a:(o.memoizedState=d,o=rk(),Ue.lanes|=o,Ts|=o,d)}function rw(o,a,d,p){return sr(d,a)?d:Hl.current!==null?(o=Ug(o,d,p),sr(o,a)||(Ft=!0),o):(Bi&42)===0||(Bi&1073741824)!==0&&(Ze&261930)===0?(Ft=!0,o.memoizedState=d):(o=rk(),Ue.lanes|=o,Ts|=o,a)}function iw(o,a,d,p,y){var x=K.p;K.p=x!==0&&8>x?x:8;var w=N.T,T={};N.T=T,Pg(o,!1,a,d);try{var D=y(),$=N.S;if($!==null&&$(T,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var G=EN(D,p);Tc(o,a,G,dr(o))}else Tc(o,a,p,dr(o))}catch(Q){Tc(o,a,{then:function(){},status:"rejected",reason:Q},dr())}finally{K.p=x,w!==null&&T.types!==null&&(w.types=T.types),N.T=w}}function DN(){}function Hg(o,a,d,p){if(o.tag!==5)throw Error(r(476));var y=sw(o).queue;iw(o,y,a,he,d===null?DN:function(){return ow(o),d(p)})}function sw(o){var a=o.memoizedState;if(a!==null)return a;a={memoizedState:he,baseState:he,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ui,lastRenderedState:he},next:null};var d={};return a.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ui,lastRenderedState:d},next:null},o.memoizedState=a,o=o.alternate,o!==null&&(o.memoizedState=a),a}function ow(o){var a=sw(o);a.next===null&&(a=o.alternate.memoizedState),Tc(o,a.next.queue,{},dr())}function Vg(){return bn($c)}function lw(){return Ut().memoizedState}function aw(){return Ut().memoizedState}function RN(o){for(var a=o.return;a!==null;){switch(a.tag){case 24:case 3:var d=dr();o=vs(d);var p=Ss(a,o,d);p!==null&&(Jn(p,a,d),Sc(p,a,d)),a={cache:gg()},o.payload=a;return}a=a.return}}function NN(o,a,d){var p=dr();d={lane:p,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},of(o)?uw(a,d):(d=sg(o,a,d,p),d!==null&&(Jn(d,o,p),dw(d,a,p)))}function cw(o,a,d){var p=dr();Tc(o,a,d,p)}function Tc(o,a,d,p){var y={lane:p,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(of(o))uw(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,T=x(w,d);if(y.hasEagerState=!0,y.eagerState=T,sr(T,w))return Ud(o,a,y,0),mt===null&&Bd(),!1}catch{}finally{}if(d=sg(o,a,y,p),d!==null)return Jn(d,o,p),dw(d,a,p),!0}return!1}function Pg(o,a,d,p){if(p={lane:2,revertLane:vy(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},of(o)){if(a)throw Error(r(479))}else a=sg(o,d,p,2),a!==null&&Jn(a,o,2)}function of(o){var a=o.alternate;return o===Ue||a!==null&&a===Ue}function uw(o,a){Vl=Xd=!0;var d=o.pending;d===null?a.next=a:(a.next=d.next,d.next=a),o.pending=a}function dw(o,a,d){if((d&4194048)!==0){var p=a.lanes;p&=o.pendingLanes,d|=p,a.lanes=d,gv(o,d)}}var Ac={readContext:bn,use:tf,useCallback:Ot,useContext:Ot,useEffect:Ot,useImperativeHandle:Ot,useLayoutEffect:Ot,useInsertionEffect:Ot,useMemo:Ot,useReducer:Ot,useRef:Ot,useState:Ot,useDebugValue:Ot,useDeferredValue:Ot,useTransition:Ot,useSyncExternalStore:Ot,useId:Ot,useHostTransitionStatus:Ot,useFormState:Ot,useActionState:Ot,useOptimistic:Ot,useMemoCache:Ot,useCacheRefresh:Ot};Ac.useEffectEvent=Ot;var fw={readContext:bn,use:tf,useCallback:function(o,a){return jn().memoizedState=[o,a===void 0?null:a],o},useContext:bn,useEffect:GS,useImperativeHandle:function(o,a,d){d=d!=null?d.concat([o]):null,rf(4194308,4,QS.bind(null,a,o),d)},useLayoutEffect:function(o,a){return rf(4194308,4,o,a)},useInsertionEffect:function(o,a){rf(4,2,o,a)},useMemo:function(o,a){var d=jn();a=a===void 0?null:a;var p=o();if(Do){Qt(!0);try{o()}finally{Qt(!1)}}return d.memoizedState=[p,a],p},useReducer:function(o,a,d){var p=jn();if(d!==void 0){var y=d(a);if(Do){Qt(!0);try{d(a)}finally{Qt(!1)}}}else y=a;return p.memoizedState=p.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},p.queue=o,o=o.dispatch=NN.bind(null,Ue,o),[p.memoizedState,o]},useRef:function(o){var a=jn();return o={current:o},a.memoizedState=o},useState:function(o){o=Lg(o);var a=o.queue,d=cw.bind(null,Ue,a);return a.dispatch=d,[o.memoizedState,d]},useDebugValue:Bg,useDeferredValue:function(o,a){var d=jn();return Ug(d,o,a)},useTransition:function(){var o=Lg(!1);return o=iw.bind(null,Ue,o.queue,!0,!1),jn().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,a,d){var p=Ue,y=jn();if(Qe){if(d===void 0)throw Error(r(407));d=d()}else{if(d=a(),mt===null)throw Error(r(349));(Ze&127)!==0||NS(p,a,d)}y.memoizedState=d;var x={value:d,getSnapshot:a};return y.queue=x,GS(LS.bind(null,p,x,o),[o]),p.flags|=2048,$l(9,{destroy:void 0},zS.bind(null,p,x,d,a),null),d},useId:function(){var o=jn(),a=mt.identifierPrefix;if(Qe){var d=li,p=oi;d=(p&~(1<<32-ot(p)-1)).toString(32)+d,a="_"+a+"R_"+d,d=Qd++,0<d&&(a+="H"+d.toString(32)),a+="_"}else d=TN++,a="_"+a+"r_"+d.toString(32)+"_";return o.memoizedState=a},useHostTransitionStatus:Vg,useFormState:FS,useActionState:FS,useOptimistic:function(o){var a=jn();a.memoizedState=a.baseState=o;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=d,a=Pg.bind(null,Ue,!0,d),d.dispatch=a,[o,a]},useMemoCache:Rg,useCacheRefresh:function(){return jn().memoizedState=RN.bind(null,Ue)},useEffectEvent:function(o){var a=jn(),d={impl:o};return a.memoizedState=d,function(){if((lt&2)!==0)throw Error(r(440));return d.impl.apply(void 0,arguments)}}},$g={readContext:bn,use:tf,useCallback:tw,useContext:bn,useEffect:Ig,useImperativeHandle:ew,useInsertionEffect:JS,useLayoutEffect:XS,useMemo:nw,useReducer:nf,useRef:WS,useState:function(){return nf(Ui)},useDebugValue:Bg,useDeferredValue:function(o,a){var d=Ut();return rw(d,dt.memoizedState,o,a)},useTransition:function(){var o=nf(Ui)[0],a=Ut().memoizedState;return[typeof o=="boolean"?o:Ec(o),a]},useSyncExternalStore:RS,useId:lw,useHostTransitionStatus:Vg,useFormState:qS,useActionState:qS,useOptimistic:function(o,a){var d=Ut();return BS(d,dt,o,a)},useMemoCache:Rg,useCacheRefresh:aw};$g.useEffectEvent=ZS;var hw={readContext:bn,use:tf,useCallback:tw,useContext:bn,useEffect:Ig,useImperativeHandle:ew,useInsertionEffect:JS,useLayoutEffect:XS,useMemo:nw,useReducer:zg,useRef:WS,useState:function(){return zg(Ui)},useDebugValue:Bg,useDeferredValue:function(o,a){var d=Ut();return dt===null?Ug(d,o,a):rw(d,dt.memoizedState,o,a)},useTransition:function(){var o=zg(Ui)[0],a=Ut().memoizedState;return[typeof o=="boolean"?o:Ec(o),a]},useSyncExternalStore:RS,useId:lw,useHostTransitionStatus:Vg,useFormState:YS,useActionState:YS,useOptimistic:function(o,a){var d=Ut();return dt!==null?BS(d,dt,o,a):(d.baseState=o,[o,d.queue.dispatch])},useMemoCache:Rg,useCacheRefresh:aw};hw.useEffectEvent=ZS;function Fg(o,a,d,p){a=o.memoizedState,d=d(p,a),d=d==null?a:m({},a,d),o.memoizedState=d,o.lanes===0&&(o.updateQueue.baseState=d)}var qg={enqueueSetState:function(o,a,d){o=o._reactInternals;var p=dr(),y=vs(p);y.payload=a,d!=null&&(y.callback=d),a=Ss(o,y,p),a!==null&&(Jn(a,o,p),Sc(a,o,p))},enqueueReplaceState:function(o,a,d){o=o._reactInternals;var p=dr(),y=vs(p);y.tag=1,y.payload=a,d!=null&&(y.callback=d),a=Ss(o,y,p),a!==null&&(Jn(a,o,p),Sc(a,o,p))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var d=dr(),p=vs(d);p.tag=2,a!=null&&(p.callback=a),a=Ss(o,p,d),a!==null&&(Jn(a,o,d),Sc(a,o,d))}};function pw(o,a,d,p,y,x,w){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(p,x,w):a.prototype&&a.prototype.isPureReactComponent?!hc(d,p)||!hc(y,x):!0}function mw(o,a,d,p){o=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(d,p),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(d,p),a.state!==o&&qg.enqueueReplaceState(a,a.state,null)}function Ro(o,a){var d=a;if("ref"in a){d={};for(var p in a)p!=="ref"&&(d[p]=a[p])}if(o=o.defaultProps){d===a&&(d=m({},d));for(var y in o)d[y]===void 0&&(d[y]=o[y])}return d}function gw(o){Id(o)}function yw(o){console.error(o)}function bw(o){Id(o)}function lf(o,a){try{var d=o.onUncaughtError;d(a.value,{componentStack:a.stack})}catch(p){setTimeout(function(){throw p})}}function xw(o,a,d){try{var p=o.onCaughtError;p(d.value,{componentStack:d.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Kg(o,a,d){return d=vs(d),d.tag=3,d.payload={element:null},d.callback=function(){lf(o,a)},d}function vw(o){return o=vs(o),o.tag=3,o}function Sw(o,a,d,p){var y=d.type.getDerivedStateFromError;if(typeof y=="function"){var x=p.value;o.payload=function(){return y(x)},o.callback=function(){xw(a,d,p)}}var w=d.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(o.callback=function(){xw(a,d,p),typeof y!="function"&&(As===null?As=new Set([this]):As.add(this));var T=p.stack;this.componentDidCatch(p.value,{componentStack:T!==null?T:""})})}function zN(o,a,d,p,y){if(d.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(a=d.alternate,a!==null&&Ll(a,d,y,!0),d=lr.current,d!==null){switch(d.tag){case 31:case 13:return Mr===null?xf():d.alternate===null&&_t===0&&(_t=3),d.flags&=-257,d.flags|=65536,d.lanes=y,p===Yd?d.flags|=16384:(a=d.updateQueue,a===null?d.updateQueue=new Set([p]):a.add(p),yy(o,p,y)),!1;case 22:return d.flags|=65536,p===Yd?d.flags|=16384:(a=d.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([p])},d.updateQueue=a):(d=a.retryQueue,d===null?a.retryQueue=new Set([p]):d.add(p)),yy(o,p,y)),!1}throw Error(r(435,d.tag))}return yy(o,p,y),xf(),!1}if(Qe)return a=lr.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=y,p!==dg&&(o=Error(r(422),{cause:p}),gc(Cr(o,d)))):(p!==dg&&(a=Error(r(423),{cause:p}),gc(Cr(a,d))),o=o.current.alternate,o.flags|=65536,y&=-y,o.lanes|=y,p=Cr(p,d),y=Kg(o.stateNode,p,y),wg(o,y),_t!==4&&(_t=2)),!1;var x=Error(r(520),{cause:p});if(x=Cr(x,d),Lc===null?Lc=[x]:Lc.push(x),_t!==4&&(_t=2),a===null)return!0;p=Cr(p,d),d=a;do{switch(d.tag){case 3:return d.flags|=65536,o=y&-y,d.lanes|=o,o=Kg(d.stateNode,p,o),wg(d,o),!1;case 1:if(a=d.type,x=d.stateNode,(d.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(As===null||!As.has(x))))return d.flags|=65536,y&=-y,d.lanes|=y,y=vw(y),Sw(y,o,d,p),wg(d,y),!1}d=d.return}while(d!==null);return!1}var Yg=Error(r(461)),Ft=!1;function xn(o,a,d,p){a.child=o===null?ES(a,null,d,p):_o(a,o.child,d,p)}function ww(o,a,d,p,y){d=d.render;var x=a.ref;if("ref"in p){var w={};for(var T in p)T!=="ref"&&(w[T]=p[T])}else w=p;return To(a),p=Mg(o,a,d,w,x,y),T=Og(),o!==null&&!Ft?(_g(o,a,y),Hi(o,a,y)):(Qe&&T&&cg(a),a.flags|=1,xn(o,a,p,y),a.child)}function kw(o,a,d,p,y){if(o===null){var x=d.type;return typeof x=="function"&&!og(x)&&x.defaultProps===void 0&&d.compare===null?(a.tag=15,a.type=x,Cw(o,a,x,p,y)):(o=Vd(d.type,null,p,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(d=d.compare,d=d!==null?d:hc,d(w,p)&&o.ref===a.ref)return Hi(o,a,y)}return a.flags|=1,o=zi(x,p),o.ref=a.ref,o.return=a,a.child=o}function Cw(o,a,d,p,y){if(o!==null){var x=o.memoizedProps;if(hc(x,p)&&o.ref===a.ref)if(Ft=!1,a.pendingProps=p=x,ty(o,y))(o.flags&131072)!==0&&(Ft=!0);else return a.lanes=o.lanes,Hi(o,a,y)}return Wg(o,a,d,p,y)}function Ew(o,a,d,p){var y=p.children,x=o!==null?o.memoizedState:null;if(o===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|d:d,o!==null){for(p=a.child=o.child,y=0;p!==null;)y=y|p.lanes|p.childLanes,p=p.sibling;p=y&~x}else p=0,a.child=null;return Tw(o,a,x,d,p)}if((d&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},o!==null&&qd(a,x!==null?x.cachePool:null),x!==null?MS(a,x):Cg(),OS(a);else return p=a.lanes=536870912,Tw(o,a,x!==null?x.baseLanes|d:d,d,p)}else x!==null?(qd(a,x.cachePool),MS(a,x),ks(),a.memoizedState=null):(o!==null&&qd(a,null),Cg(),ks());return xn(o,a,y,d),a.child}function Mc(o,a){return o!==null&&o.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Tw(o,a,d,p,y){var x=bg();return x=x===null?null:{parent:Pt._currentValue,pool:x},a.memoizedState={baseLanes:d,cachePool:x},o!==null&&qd(a,null),Cg(),OS(a),o!==null&&Ll(o,a,p,!0),a.childLanes=y,null}function af(o,a){return a=uf({mode:a.mode,children:a.children},o.mode),a.ref=o.ref,o.child=a,a.return=o,a}function Aw(o,a,d){return _o(a,o.child,null,d),o=af(a,a.pendingProps),o.flags|=2,ar(a),a.memoizedState=null,o}function LN(o,a,d){var p=a.pendingProps,y=(a.flags&128)!==0;if(a.flags&=-129,o===null){if(Qe){if(p.mode==="hidden")return o=af(a,p),a.lanes=536870912,Mc(null,o);if(Tg(a),(o=kt)?(o=Uk(o,Ar),o=o!==null&&o.data==="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:ms!==null?{id:oi,overflow:li}:null,retryLane:536870912,hydrationErrors:null},d=uS(o),d.return=a,a.child=d,yn=a,kt=null)):o=null,o===null)throw ys(a);return a.lanes=536870912,null}return af(a,p)}var x=o.memoizedState;if(x!==null){var w=x.dehydrated;if(Tg(a),y)if(a.flags&256)a.flags&=-257,a=Aw(o,a,d);else if(a.memoizedState!==null)a.child=o.child,a.flags|=128,a=null;else throw Error(r(558));else if(Ft||Ll(o,a,d,!1),y=(d&o.childLanes)!==0,Ft||y){if(p=mt,p!==null&&(w=yv(p,d),w!==0&&w!==x.retryLane))throw x.retryLane=w,wo(o,w),Jn(p,o,w),Yg;xf(),a=Aw(o,a,d)}else o=x.treeContext,kt=Or(w.nextSibling),yn=a,Qe=!0,gs=null,Ar=!1,o!==null&&hS(a,o),a=af(a,p),a.flags|=4096;return a}return o=zi(o.child,{mode:p.mode,children:p.children}),o.ref=a.ref,a.child=o,o.return=a,o}function cf(o,a){var d=a.ref;if(d===null)o!==null&&o.ref!==null&&(a.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(r(284));(o===null||o.ref!==d)&&(a.flags|=4194816)}}function Wg(o,a,d,p,y){return To(a),d=Mg(o,a,d,p,void 0,y),p=Og(),o!==null&&!Ft?(_g(o,a,y),Hi(o,a,y)):(Qe&&p&&cg(a),a.flags|=1,xn(o,a,d,y),a.child)}function Mw(o,a,d,p,y,x){return To(a),a.updateQueue=null,d=DS(a,p,d,y),_S(o),p=Og(),o!==null&&!Ft?(_g(o,a,x),Hi(o,a,x)):(Qe&&p&&cg(a),a.flags|=1,xn(o,a,d,x),a.child)}function Ow(o,a,d,p,y){if(To(a),a.stateNode===null){var x=Dl,w=d.contextType;typeof w=="object"&&w!==null&&(x=bn(w)),x=new d(p,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=p,x.state=a.memoizedState,x.refs={},vg(a),w=d.contextType,x.context=typeof w=="object"&&w!==null?bn(w):Dl,x.state=a.memoizedState,w=d.getDerivedStateFromProps,typeof w=="function"&&(Fg(a,d,w,p),x.state=a.memoizedState),typeof d.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),kc(a,p,x,y),wc(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),p=!0}else if(o===null){x=a.stateNode;var T=a.memoizedProps,D=Ro(d,T);x.props=D;var $=x.context,G=d.contextType;w=Dl,typeof G=="object"&&G!==null&&(w=bn(G));var Q=d.getDerivedStateFromProps;G=typeof Q=="function"||typeof x.getSnapshotBeforeUpdate=="function",T=a.pendingProps!==T,G||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T||$!==w)&&mw(a,x,p,w),xs=!1;var F=a.memoizedState;x.state=F,kc(a,p,x,y),wc(),$=a.memoizedState,T||F!==$||xs?(typeof Q=="function"&&(Fg(a,d,Q,p),$=a.memoizedState),(D=xs||pw(a,d,D,p,F,$,w))?(G||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=p,a.memoizedState=$),x.props=p,x.state=$,x.context=w,p=D):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),p=!1)}else{x=a.stateNode,Sg(o,a),w=a.memoizedProps,G=Ro(d,w),x.props=G,Q=a.pendingProps,F=x.context,$=d.contextType,D=Dl,typeof $=="object"&&$!==null&&(D=bn($)),T=d.getDerivedStateFromProps,($=typeof T=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==Q||F!==D)&&mw(a,x,p,D),xs=!1,F=a.memoizedState,x.state=F,kc(a,p,x,y),wc();var q=a.memoizedState;w!==Q||F!==q||xs||o!==null&&o.dependencies!==null&&$d(o.dependencies)?(typeof T=="function"&&(Fg(a,d,T,p),q=a.memoizedState),(G=xs||pw(a,d,G,p,F,q,D)||o!==null&&o.dependencies!==null&&$d(o.dependencies))?($||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(p,q,D),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(p,q,D)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===o.memoizedProps&&F===o.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===o.memoizedProps&&F===o.memoizedState||(a.flags|=1024),a.memoizedProps=p,a.memoizedState=q),x.props=p,x.state=q,x.context=D,p=G):(typeof x.componentDidUpdate!="function"||w===o.memoizedProps&&F===o.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===o.memoizedProps&&F===o.memoizedState||(a.flags|=1024),p=!1)}return x=p,cf(o,a),p=(a.flags&128)!==0,x||p?(x=a.stateNode,d=p&&typeof d.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,o!==null&&p?(a.child=_o(a,o.child,null,y),a.child=_o(a,null,d,y)):xn(o,a,d,y),a.memoizedState=x.state,o=a.child):o=Hi(o,a,y),o}function _w(o,a,d,p){return Co(),a.flags|=256,xn(o,a,d,p),a.child}var Gg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zg(o){return{baseLanes:o,cachePool:xS()}}function Jg(o,a,d){return o=o!==null?o.childLanes&~d:0,a&&(o|=ur),o}function Dw(o,a,d){var p=a.pendingProps,y=!1,x=(a.flags&128)!==0,w;if((w=x)||(w=o!==null&&o.memoizedState===null?!1:(Bt.current&2)!==0),w&&(y=!0,a.flags&=-129),w=(a.flags&32)!==0,a.flags&=-33,o===null){if(Qe){if(y?ws(a):ks(),(o=kt)?(o=Uk(o,Ar),o=o!==null&&o.data!=="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:ms!==null?{id:oi,overflow:li}:null,retryLane:536870912,hydrationErrors:null},d=uS(o),d.return=a,a.child=d,yn=a,kt=null)):o=null,o===null)throw ys(a);return Ny(o)?a.lanes=32:a.lanes=536870912,null}var T=p.children;return p=p.fallback,y?(ks(),y=a.mode,T=uf({mode:"hidden",children:T},y),p=ko(p,y,d,null),T.return=a,p.return=a,T.sibling=p,a.child=T,p=a.child,p.memoizedState=Zg(d),p.childLanes=Jg(o,w,d),a.memoizedState=Gg,Mc(null,p)):(ws(a),Xg(a,T))}var D=o.memoizedState;if(D!==null&&(T=D.dehydrated,T!==null)){if(x)a.flags&256?(ws(a),a.flags&=-257,a=Qg(o,a,d)):a.memoizedState!==null?(ks(),a.child=o.child,a.flags|=128,a=null):(ks(),T=p.fallback,y=a.mode,p=uf({mode:"visible",children:p.children},y),T=ko(T,y,d,null),T.flags|=2,p.return=a,T.return=a,p.sibling=T,a.child=p,_o(a,o.child,null,d),p=a.child,p.memoizedState=Zg(d),p.childLanes=Jg(o,w,d),a.memoizedState=Gg,a=Mc(null,p));else if(ws(a),Ny(T)){if(w=T.nextSibling&&T.nextSibling.dataset,w)var $=w.dgst;w=$,p=Error(r(419)),p.stack="",p.digest=w,gc({value:p,source:null,stack:null}),a=Qg(o,a,d)}else if(Ft||Ll(o,a,d,!1),w=(d&o.childLanes)!==0,Ft||w){if(w=mt,w!==null&&(p=yv(w,d),p!==0&&p!==D.retryLane))throw D.retryLane=p,wo(o,p),Jn(w,o,p),Yg;Ry(T)||xf(),a=Qg(o,a,d)}else Ry(T)?(a.flags|=192,a.child=o.child,a=null):(o=D.treeContext,kt=Or(T.nextSibling),yn=a,Qe=!0,gs=null,Ar=!1,o!==null&&hS(a,o),a=Xg(a,p.children),a.flags|=4096);return a}return y?(ks(),T=p.fallback,y=a.mode,D=o.child,$=D.sibling,p=zi(D,{mode:"hidden",children:p.children}),p.subtreeFlags=D.subtreeFlags&65011712,$!==null?T=zi($,T):(T=ko(T,y,d,null),T.flags|=2),T.return=a,p.return=a,p.sibling=T,a.child=p,Mc(null,p),p=a.child,T=o.child.memoizedState,T===null?T=Zg(d):(y=T.cachePool,y!==null?(D=Pt._currentValue,y=y.parent!==D?{parent:D,pool:D}:y):y=xS(),T={baseLanes:T.baseLanes|d,cachePool:y}),p.memoizedState=T,p.childLanes=Jg(o,w,d),a.memoizedState=Gg,Mc(o.child,p)):(ws(a),d=o.child,o=d.sibling,d=zi(d,{mode:"visible",children:p.children}),d.return=a,d.sibling=null,o!==null&&(w=a.deletions,w===null?(a.deletions=[o],a.flags|=16):w.push(o)),a.child=d,a.memoizedState=null,d)}function Xg(o,a){return a=uf({mode:"visible",children:a},o.mode),a.return=o,o.child=a}function uf(o,a){return o=or(22,o,null,a),o.lanes=0,o}function Qg(o,a,d){return _o(a,o.child,null,d),o=Xg(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function Rw(o,a,d){o.lanes|=a;var p=o.alternate;p!==null&&(p.lanes|=a),pg(o.return,a,d)}function ey(o,a,d,p,y,x){var w=o.memoizedState;w===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:p,tail:d,tailMode:y,treeForkCount:x}:(w.isBackwards=a,w.rendering=null,w.renderingStartTime=0,w.last=p,w.tail=d,w.tailMode=y,w.treeForkCount=x)}function Nw(o,a,d){var p=a.pendingProps,y=p.revealOrder,x=p.tail;p=p.children;var w=Bt.current,T=(w&2)!==0;if(T?(w=w&1|2,a.flags|=128):w&=1,A(Bt,w),xn(o,a,p,d),p=Qe?mc:0,!T&&o!==null&&(o.flags&128)!==0)e:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Rw(o,d,a);else if(o.tag===19)Rw(o,d,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(d=a.child,y=null;d!==null;)o=d.alternate,o!==null&&Jd(o)===null&&(y=d),d=d.sibling;d=y,d===null?(y=a.child,a.child=null):(y=d.sibling,d.sibling=null),ey(a,!1,y,d,x,p);break;case"backwards":case"unstable_legacy-backwards":for(d=null,y=a.child,a.child=null;y!==null;){if(o=y.alternate,o!==null&&Jd(o)===null){a.child=y;break}o=y.sibling,y.sibling=d,d=y,y=o}ey(a,!0,d,null,x,p);break;case"together":ey(a,!1,null,null,void 0,p);break;default:a.memoizedState=null}return a.child}function Hi(o,a,d){if(o!==null&&(a.dependencies=o.dependencies),Ts|=a.lanes,(d&a.childLanes)===0)if(o!==null){if(Ll(o,a,d,!1),(d&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,d=zi(o,o.pendingProps),a.child=d,d.return=a;o.sibling!==null;)o=o.sibling,d=d.sibling=zi(o,o.pendingProps),d.return=a;d.sibling=null}return a.child}function ty(o,a){return(o.lanes&a)!==0?!0:(o=o.dependencies,!!(o!==null&&$d(o)))}function jN(o,a,d){switch(a.tag){case 3:Ee(a,a.stateNode.containerInfo),bs(a,Pt,o.memoizedState.cache),Co();break;case 27:case 5:He(a);break;case 4:Ee(a,a.stateNode.containerInfo);break;case 10:bs(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Tg(a),null;break;case 13:var p=a.memoizedState;if(p!==null)return p.dehydrated!==null?(ws(a),a.flags|=128,null):(d&a.child.childLanes)!==0?Dw(o,a,d):(ws(a),o=Hi(o,a,d),o!==null?o.sibling:null);ws(a);break;case 19:var y=(o.flags&128)!==0;if(p=(d&a.childLanes)!==0,p||(Ll(o,a,d,!1),p=(d&a.childLanes)!==0),y){if(p)return Nw(o,a,d);a.flags|=128}if(y=a.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),A(Bt,Bt.current),p)break;return null;case 22:return a.lanes=0,Ew(o,a,d,a.pendingProps);case 24:bs(a,Pt,o.memoizedState.cache)}return Hi(o,a,d)}function zw(o,a,d){if(o!==null)if(o.memoizedProps!==a.pendingProps)Ft=!0;else{if(!ty(o,d)&&(a.flags&128)===0)return Ft=!1,jN(o,a,d);Ft=(o.flags&131072)!==0}else Ft=!1,Qe&&(a.flags&1048576)!==0&&fS(a,mc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var p=a.pendingProps;if(o=Mo(a.elementType),a.type=o,typeof o=="function")og(o)?(p=Ro(o,p),a.tag=1,a=Ow(null,a,o,p,d)):(a.tag=0,a=Wg(null,a,o,p,d));else{if(o!=null){var y=o.$$typeof;if(y===Y){a.tag=11,a=ww(null,a,o,p,d);break e}else if(y===B){a.tag=14,a=kw(null,a,o,p,d);break e}}throw a=ae(o)||o,Error(r(306,a,""))}}return a;case 0:return Wg(o,a,a.type,a.pendingProps,d);case 1:return p=a.type,y=Ro(p,a.pendingProps),Ow(o,a,p,y,d);case 3:e:{if(Ee(a,a.stateNode.containerInfo),o===null)throw Error(r(387));p=a.pendingProps;var x=a.memoizedState;y=x.element,Sg(o,a),kc(a,p,null,d);var w=a.memoizedState;if(p=w.cache,bs(a,Pt,p),p!==x.cache&&mg(a,[Pt],d,!0),wc(),p=w.element,x.isDehydrated)if(x={element:p,isDehydrated:!1,cache:w.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=_w(o,a,p,d);break e}else if(p!==y){y=Cr(Error(r(424)),a),gc(y),a=_w(o,a,p,d);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(kt=Or(o.firstChild),yn=a,Qe=!0,gs=null,Ar=!0,d=ES(a,null,p,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling}else{if(Co(),p===y){a=Hi(o,a,d);break e}xn(o,a,p,d)}a=a.child}return a;case 26:return cf(o,a),o===null?(d=qk(a.type,null,a.pendingProps,null))?a.memoizedState=d:Qe||(d=a.type,o=a.pendingProps,p=Tf(se.current).createElement(d),p[gn]=a,p[qn]=o,vn(p,d,o),en(p),a.stateNode=p):a.memoizedState=qk(a.type,o.memoizedProps,a.pendingProps,o.memoizedState),null;case 27:return He(a),o===null&&Qe&&(p=a.stateNode=Pk(a.type,a.pendingProps,se.current),yn=a,Ar=!0,y=kt,Ds(a.type)?(zy=y,kt=Or(p.firstChild)):kt=y),xn(o,a,a.pendingProps.children,d),cf(o,a),o===null&&(a.flags|=4194304),a.child;case 5:return o===null&&Qe&&((y=p=kt)&&(p=fz(p,a.type,a.pendingProps,Ar),p!==null?(a.stateNode=p,yn=a,kt=Or(p.firstChild),Ar=!1,y=!0):y=!1),y||ys(a)),He(a),y=a.type,x=a.pendingProps,w=o!==null?o.memoizedProps:null,p=x.children,Oy(y,x)?p=null:w!==null&&Oy(y,w)&&(a.flags|=32),a.memoizedState!==null&&(y=Mg(o,a,AN,null,null,d),$c._currentValue=y),cf(o,a),xn(o,a,p,d),a.child;case 6:return o===null&&Qe&&((o=d=kt)&&(d=hz(d,a.pendingProps,Ar),d!==null?(a.stateNode=d,yn=a,kt=null,o=!0):o=!1),o||ys(a)),null;case 13:return Dw(o,a,d);case 4:return Ee(a,a.stateNode.containerInfo),p=a.pendingProps,o===null?a.child=_o(a,null,p,d):xn(o,a,p,d),a.child;case 11:return ww(o,a,a.type,a.pendingProps,d);case 7:return xn(o,a,a.pendingProps,d),a.child;case 8:return xn(o,a,a.pendingProps.children,d),a.child;case 12:return xn(o,a,a.pendingProps.children,d),a.child;case 10:return p=a.pendingProps,bs(a,a.type,p.value),xn(o,a,p.children,d),a.child;case 9:return y=a.type._context,p=a.pendingProps.children,To(a),y=bn(y),p=p(y),a.flags|=1,xn(o,a,p,d),a.child;case 14:return kw(o,a,a.type,a.pendingProps,d);case 15:return Cw(o,a,a.type,a.pendingProps,d);case 19:return Nw(o,a,d);case 31:return LN(o,a,d);case 22:return Ew(o,a,d,a.pendingProps);case 24:return To(a),p=bn(Pt),o===null?(y=bg(),y===null&&(y=mt,x=gg(),y.pooledCache=x,x.refCount++,x!==null&&(y.pooledCacheLanes|=d),y=x),a.memoizedState={parent:p,cache:y},vg(a),bs(a,Pt,y)):((o.lanes&d)!==0&&(Sg(o,a),kc(a,null,null,d),wc()),y=o.memoizedState,x=a.memoizedState,y.parent!==p?(y={parent:p,cache:p},a.memoizedState=y,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=y),bs(a,Pt,p)):(p=x.cache,bs(a,Pt,p),p!==y.cache&&mg(a,[Pt],d,!0))),xn(o,a,a.pendingProps.children,d),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Vi(o){o.flags|=4}function ny(o,a,d,p,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(lk())o.flags|=8192;else throw Oo=Yd,xg}else o.flags&=-16777217}function Lw(o,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!Zk(a))if(lk())o.flags|=8192;else throw Oo=Yd,xg}function df(o,a){a!==null&&(o.flags|=4),o.flags&16384&&(a=o.tag!==22?pv():536870912,o.lanes|=a,Yl|=a)}function Oc(o,a){if(!Qe)switch(o.tailMode){case"hidden":a=o.tail;for(var d=null;a!==null;)a.alternate!==null&&(d=a),a=a.sibling;d===null?o.tail=null:d.sibling=null;break;case"collapsed":d=o.tail;for(var p=null;d!==null;)d.alternate!==null&&(p=d),d=d.sibling;p===null?a||o.tail===null?o.tail=null:o.tail.sibling=null:p.sibling=null}}function Ct(o){var a=o.alternate!==null&&o.alternate.child===o.child,d=0,p=0;if(a)for(var y=o.child;y!==null;)d|=y.lanes|y.childLanes,p|=y.subtreeFlags&65011712,p|=y.flags&65011712,y.return=o,y=y.sibling;else for(y=o.child;y!==null;)d|=y.lanes|y.childLanes,p|=y.subtreeFlags,p|=y.flags,y.return=o,y=y.sibling;return o.subtreeFlags|=p,o.childLanes=d,a}function IN(o,a,d){var p=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 Ct(a),null;case 1:return Ct(a),null;case 3:return d=a.stateNode,p=null,o!==null&&(p=o.memoizedState.cache),a.memoizedState.cache!==p&&(a.flags|=2048),Ii(Pt),Te(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(o===null||o.child===null)&&(zl(a)?Vi(a):o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,fg())),Ct(a),null;case 26:var y=a.type,x=a.memoizedState;return o===null?(Vi(a),x!==null?(Ct(a),Lw(a,x)):(Ct(a),ny(a,y,null,p,d))):x?x!==o.memoizedState?(Vi(a),Ct(a),Lw(a,x)):(Ct(a),a.flags&=-16777217):(o=o.memoizedProps,o!==p&&Vi(a),Ct(a),ny(a,y,o,p,d)),null;case 27:if(we(a),d=se.current,y=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==p&&Vi(a);else{if(!p){if(a.stateNode===null)throw Error(r(166));return Ct(a),null}o=ne.current,zl(a)?pS(a):(o=Pk(y,p,d),a.stateNode=o,Vi(a))}return Ct(a),null;case 5:if(we(a),y=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==p&&Vi(a);else{if(!p){if(a.stateNode===null)throw Error(r(166));return Ct(a),null}if(x=ne.current,zl(a))pS(a);else{var w=Tf(se.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 p.is=="string"?w.createElement("select",{is:p.is}):w.createElement("select"),p.multiple?x.multiple=!0:p.size&&(x.size=p.size);break;default:x=typeof p.is=="string"?w.createElement(y,{is:p.is}):w.createElement(y)}}x[gn]=a,x[qn]=p;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(vn(x,y,p),y){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&Vi(a)}}return Ct(a),ny(a,a.type,o===null?null:o.memoizedProps,a.pendingProps,d),null;case 6:if(o&&a.stateNode!=null)o.memoizedProps!==p&&Vi(a);else{if(typeof p!="string"&&a.stateNode===null)throw Error(r(166));if(o=se.current,zl(a)){if(o=a.stateNode,d=a.memoizedProps,p=null,y=yn,y!==null)switch(y.tag){case 27:case 5:p=y.memoizedProps}o[gn]=a,o=!!(o.nodeValue===d||p!==null&&p.suppressHydrationWarning===!0||Dk(o.nodeValue,d)),o||ys(a,!0)}else o=Tf(o).createTextNode(p),o[gn]=a,a.stateNode=o}return Ct(a),null;case 31:if(d=a.memoizedState,o===null||o.memoizedState!==null){if(p=zl(a),d!==null){if(o===null){if(!p)throw Error(r(318));if(o=a.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[gn]=a}else Co(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ct(a),o=!1}else d=fg(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=d),o=!0;if(!o)return a.flags&256?(ar(a),a):(ar(a),null);if((a.flags&128)!==0)throw Error(r(558))}return Ct(a),null;case 13:if(p=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=zl(a),p!==null&&p.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[gn]=a}else Co(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ct(a),y=!1}else y=fg(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return a.flags&256?(ar(a),a):(ar(a),null)}return ar(a),(a.flags&128)!==0?(a.lanes=d,a):(d=p!==null,o=o!==null&&o.memoizedState!==null,d&&(p=a.child,y=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(y=p.alternate.memoizedState.cachePool.pool),x=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(x=p.memoizedState.cachePool.pool),x!==y&&(p.flags|=2048)),d!==o&&d&&(a.child.flags|=8192),df(a,a.updateQueue),Ct(a),null);case 4:return Te(),o===null&&Cy(a.stateNode.containerInfo),Ct(a),null;case 10:return Ii(a.type),Ct(a),null;case 19:if(I(Bt),p=a.memoizedState,p===null)return Ct(a),null;if(y=(a.flags&128)!==0,x=p.rendering,x===null)if(y)Oc(p,!1);else{if(_t!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(x=Jd(o),x!==null){for(a.flags|=128,Oc(p,!1),o=x.updateQueue,a.updateQueue=o,df(a,o),a.subtreeFlags=0,o=d,d=a.child;d!==null;)cS(d,o),d=d.sibling;return A(Bt,Bt.current&1|2),Qe&&Li(a,p.treeForkCount),a.child}o=o.sibling}p.tail!==null&&Xt()>gf&&(a.flags|=128,y=!0,Oc(p,!1),a.lanes=4194304)}else{if(!y)if(o=Jd(x),o!==null){if(a.flags|=128,y=!0,o=o.updateQueue,a.updateQueue=o,df(a,o),Oc(p,!0),p.tail===null&&p.tailMode==="hidden"&&!x.alternate&&!Qe)return Ct(a),null}else 2*Xt()-p.renderingStartTime>gf&&d!==536870912&&(a.flags|=128,y=!0,Oc(p,!1),a.lanes=4194304);p.isBackwards?(x.sibling=a.child,a.child=x):(o=p.last,o!==null?o.sibling=x:a.child=x,p.last=x)}return p.tail!==null?(o=p.tail,p.rendering=o,p.tail=o.sibling,p.renderingStartTime=Xt(),o.sibling=null,d=Bt.current,A(Bt,y?d&1|2:d&1),Qe&&Li(a,p.treeForkCount),o):(Ct(a),null);case 22:case 23:return ar(a),Eg(),p=a.memoizedState!==null,o!==null?o.memoizedState!==null!==p&&(a.flags|=8192):p&&(a.flags|=8192),p?(d&536870912)!==0&&(a.flags&128)===0&&(Ct(a),a.subtreeFlags&6&&(a.flags|=8192)):Ct(a),d=a.updateQueue,d!==null&&df(a,d.retryQueue),d=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),p=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(p=a.memoizedState.cachePool.pool),p!==d&&(a.flags|=2048),o!==null&&I(Ao),null;case 24:return d=null,o!==null&&(d=o.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Ii(Pt),Ct(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function BN(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 Ii(Pt),Te(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 26:case 27:case 5:return we(a),null;case 31:if(a.memoizedState!==null){if(ar(a),a.alternate===null)throw Error(r(340));Co()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 13:if(ar(a),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(r(340));Co()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return I(Bt),null;case 4:return Te(),null;case 10:return Ii(a.type),null;case 22:case 23:return ar(a),Eg(),o!==null&&I(Ao),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 24:return Ii(Pt),null;case 25:return null;default:return null}}function jw(o,a){switch(ug(a),a.tag){case 3:Ii(Pt),Te();break;case 26:case 27:case 5:we(a);break;case 4:Te();break;case 31:a.memoizedState!==null&&ar(a);break;case 13:ar(a);break;case 19:I(Bt);break;case 10:Ii(a.type);break;case 22:case 23:ar(a),Eg(),o!==null&&I(Ao);break;case 24:Ii(Pt)}}function _c(o,a){try{var d=a.updateQueue,p=d!==null?d.lastEffect:null;if(p!==null){var y=p.next;d=y;do{if((d.tag&o)===o){p=void 0;var x=d.create,w=d.inst;p=x(),w.destroy=p}d=d.next}while(d!==y)}}catch(T){ut(a,a.return,T)}}function Cs(o,a,d){try{var p=a.updateQueue,y=p!==null?p.lastEffect:null;if(y!==null){var x=y.next;p=x;do{if((p.tag&o)===o){var w=p.inst,T=w.destroy;if(T!==void 0){w.destroy=void 0,y=a;var D=d,$=T;try{$()}catch(G){ut(y,D,G)}}}p=p.next}while(p!==x)}}catch(G){ut(a,a.return,G)}}function Iw(o){var a=o.updateQueue;if(a!==null){var d=o.stateNode;try{AS(a,d)}catch(p){ut(o,o.return,p)}}}function Bw(o,a,d){d.props=Ro(o.type,o.memoizedProps),d.state=o.memoizedState;try{d.componentWillUnmount()}catch(p){ut(o,a,p)}}function Dc(o,a){try{var d=o.ref;if(d!==null){switch(o.tag){case 26:case 27:case 5:var p=o.stateNode;break;case 30:p=o.stateNode;break;default:p=o.stateNode}typeof d=="function"?o.refCleanup=d(p):d.current=p}}catch(y){ut(o,a,y)}}function ai(o,a){var d=o.ref,p=o.refCleanup;if(d!==null)if(typeof p=="function")try{p()}catch(y){ut(o,a,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(y){ut(o,a,y)}else d.current=null}function Uw(o){var a=o.type,d=o.memoizedProps,p=o.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":d.autoFocus&&p.focus();break e;case"img":d.src?p.src=d.src:d.srcSet&&(p.srcset=d.srcSet)}}catch(y){ut(o,o.return,y)}}function ry(o,a,d){try{var p=o.stateNode;oz(p,o.type,d,a),p[qn]=a}catch(y){ut(o,o.return,y)}}function Hw(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Ds(o.type)||o.tag===4}function iy(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Hw(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&&Ds(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,d){var p=o.tag;if(p===5||p===6)o=o.stateNode,a?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(o,a):(a=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,a.appendChild(o),d=d._reactRootContainer,d!=null||a.onclick!==null||(a.onclick=Ri));else if(p!==4&&(p===27&&Ds(o.type)&&(d=o.stateNode,a=null),o=o.child,o!==null))for(sy(o,a,d),o=o.sibling;o!==null;)sy(o,a,d),o=o.sibling}function ff(o,a,d){var p=o.tag;if(p===5||p===6)o=o.stateNode,a?d.insertBefore(o,a):d.appendChild(o);else if(p!==4&&(p===27&&Ds(o.type)&&(d=o.stateNode),o=o.child,o!==null))for(ff(o,a,d),o=o.sibling;o!==null;)ff(o,a,d),o=o.sibling}function Vw(o){var a=o.stateNode,d=o.memoizedProps;try{for(var p=o.type,y=a.attributes;y.length;)a.removeAttributeNode(y[0]);vn(a,p,d),a[gn]=o,a[qn]=d}catch(x){ut(o,o.return,x)}}var Pi=!1,qt=!1,oy=!1,Pw=typeof WeakSet=="function"?WeakSet:Set,tn=null;function UN(o,a){if(o=o.containerInfo,Ay=Nf,o=eS(o),Qm(o)){if("selectionStart"in o)var d={start:o.selectionStart,end:o.selectionEnd};else e:{d=(d=o.ownerDocument)&&d.defaultView||window;var p=d.getSelection&&d.getSelection();if(p&&p.rangeCount!==0){d=p.anchorNode;var y=p.anchorOffset,x=p.focusNode;p=p.focusOffset;try{d.nodeType,x.nodeType}catch{d=null;break e}var w=0,T=-1,D=-1,$=0,G=0,Q=o,F=null;t:for(;;){for(var q;Q!==d||y!==0&&Q.nodeType!==3||(T=w+y),Q!==x||p!==0&&Q.nodeType!==3||(D=w+p),Q.nodeType===3&&(w+=Q.nodeValue.length),(q=Q.firstChild)!==null;)F=Q,Q=q;for(;;){if(Q===o)break t;if(F===d&&++$===y&&(T=w),F===x&&++G===p&&(D=w),(q=Q.nextSibling)!==null)break;Q=F,F=Q.parentNode}Q=q}d=T===-1||D===-1?null:{start:T,end:D}}else d=null}d=d||{start:0,end:0}}else d=null;for(My={focusedElem:o,selectionRange:d},Nf=!1,tn=a;tn!==null;)if(a=tn,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,tn=o;else for(;tn!==null;){switch(a=tn,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(d=0;d<o.length;d++)y=o[d],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&x!==null){o=void 0,d=a,y=x.memoizedProps,x=x.memoizedState,p=d.stateNode;try{var xe=Ro(d.type,y);o=p.getSnapshotBeforeUpdate(xe,x),p.__reactInternalSnapshotBeforeUpdate=o}catch(De){ut(d,d.return,De)}}break;case 3:if((o&1024)!==0){if(o=a.stateNode.containerInfo,d=o.nodeType,d===9)Dy(o);else if(d===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,tn=o;break}tn=a.return}}function $w(o,a,d){var p=d.flags;switch(d.tag){case 0:case 11:case 15:Fi(o,d),p&4&&_c(5,d);break;case 1:if(Fi(o,d),p&4)if(o=d.stateNode,a===null)try{o.componentDidMount()}catch(w){ut(d,d.return,w)}else{var y=Ro(d.type,a.memoizedProps);a=a.memoizedState;try{o.componentDidUpdate(y,a,o.__reactInternalSnapshotBeforeUpdate)}catch(w){ut(d,d.return,w)}}p&64&&Iw(d),p&512&&Dc(d,d.return);break;case 3:if(Fi(o,d),p&64&&(o=d.updateQueue,o!==null)){if(a=null,d.child!==null)switch(d.child.tag){case 27:case 5:a=d.child.stateNode;break;case 1:a=d.child.stateNode}try{AS(o,a)}catch(w){ut(d,d.return,w)}}break;case 27:a===null&&p&4&&Vw(d);case 26:case 5:Fi(o,d),a===null&&p&4&&Uw(d),p&512&&Dc(d,d.return);break;case 12:Fi(o,d);break;case 31:Fi(o,d),p&4&&Kw(o,d);break;case 13:Fi(o,d),p&4&&Yw(o,d),p&64&&(o=d.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(d=WN.bind(null,d),pz(o,d))));break;case 22:if(p=d.memoizedState!==null||Pi,!p){a=a!==null&&a.memoizedState!==null||qt,y=Pi;var x=qt;Pi=p,(qt=a)&&!x?qi(o,d,(d.subtreeFlags&8772)!==0):Fi(o,d),Pi=y,qt=x}break;case 30:break;default:Fi(o,d)}}function Fw(o){var a=o.alternate;a!==null&&(o.alternate=null,Fw(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 At=null,Yn=!1;function $i(o,a,d){for(d=d.child;d!==null;)qw(o,a,d),d=d.sibling}function qw(o,a,d){if(It&&typeof It.onCommitFiberUnmount=="function")try{It.onCommitFiberUnmount(mn,d)}catch{}switch(d.tag){case 26:qt||ai(d,a),$i(o,a,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:qt||ai(d,a);var p=At,y=Yn;Ds(d.type)&&(At=d.stateNode,Yn=!1),$i(o,a,d),Hc(d.stateNode),At=p,Yn=y;break;case 5:qt||ai(d,a);case 6:if(p=At,y=Yn,At=null,$i(o,a,d),At=p,Yn=y,At!==null)if(Yn)try{(At.nodeType===9?At.body:At.nodeName==="HTML"?At.ownerDocument.body:At).removeChild(d.stateNode)}catch(x){ut(d,a,x)}else try{At.removeChild(d.stateNode)}catch(x){ut(d,a,x)}break;case 18:At!==null&&(Yn?(o=At,Ik(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,d.stateNode),ta(o)):Ik(At,d.stateNode));break;case 4:p=At,y=Yn,At=d.stateNode.containerInfo,Yn=!0,$i(o,a,d),At=p,Yn=y;break;case 0:case 11:case 14:case 15:Cs(2,d,a),qt||Cs(4,d,a),$i(o,a,d);break;case 1:qt||(ai(d,a),p=d.stateNode,typeof p.componentWillUnmount=="function"&&Bw(d,a,p)),$i(o,a,d);break;case 21:$i(o,a,d);break;case 22:qt=(p=qt)||d.memoizedState!==null,$i(o,a,d),qt=p;break;default:$i(o,a,d)}}function Kw(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{ta(o)}catch(d){ut(a,a.return,d)}}}function Yw(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{ta(o)}catch(d){ut(a,a.return,d)}}function HN(o){switch(o.tag){case 31:case 13:case 19:var a=o.stateNode;return a===null&&(a=o.stateNode=new Pw),a;case 22:return o=o.stateNode,a=o._retryCache,a===null&&(a=o._retryCache=new Pw),a;default:throw Error(r(435,o.tag))}}function hf(o,a){var d=HN(o);a.forEach(function(p){if(!d.has(p)){d.add(p);var y=GN.bind(null,o,p);p.then(y,y)}})}function Wn(o,a){var d=a.deletions;if(d!==null)for(var p=0;p<d.length;p++){var y=d[p],x=o,w=a,T=w;e:for(;T!==null;){switch(T.tag){case 27:if(Ds(T.type)){At=T.stateNode,Yn=!1;break e}break;case 5:At=T.stateNode,Yn=!1;break e;case 3:case 4:At=T.stateNode.containerInfo,Yn=!0;break e}T=T.return}if(At===null)throw Error(r(160));qw(x,w,y),At=null,Yn=!1,x=y.alternate,x!==null&&(x.return=null),y.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Ww(a,o),a=a.sibling}var Wr=null;function Ww(o,a){var d=o.alternate,p=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:Wn(a,o),Gn(o),p&4&&(Cs(3,o,o.return),_c(3,o),Cs(5,o,o.return));break;case 1:Wn(a,o),Gn(o),p&512&&(qt||d===null||ai(d,d.return)),p&64&&Pi&&(o=o.updateQueue,o!==null&&(p=o.callbacks,p!==null&&(d=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=d===null?p:d.concat(p))));break;case 26:var y=Wr;if(Wn(a,o),Gn(o),p&512&&(qt||d===null||ai(d,d.return)),p&4){var x=d!==null?d.memoizedState:null;if(p=o.memoizedState,d===null)if(p===null)if(o.stateNode===null){e:{p=o.type,d=o.memoizedProps,y=y.ownerDocument||y;t:switch(p){case"title":x=y.getElementsByTagName("title")[0],(!x||x[ic]||x[gn]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=y.createElement(p),y.head.insertBefore(x,y.querySelector("head > title"))),vn(x,p,d),x[gn]=o,en(x),p=x;break e;case"link":var w=Wk("link","href",y).get(p+(d.href||""));if(w){for(var T=0;T<w.length;T++)if(x=w[T],x.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&x.getAttribute("rel")===(d.rel==null?null:d.rel)&&x.getAttribute("title")===(d.title==null?null:d.title)&&x.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){w.splice(T,1);break t}}x=y.createElement(p),vn(x,p,d),y.head.appendChild(x);break;case"meta":if(w=Wk("meta","content",y).get(p+(d.content||""))){for(T=0;T<w.length;T++)if(x=w[T],x.getAttribute("content")===(d.content==null?null:""+d.content)&&x.getAttribute("name")===(d.name==null?null:d.name)&&x.getAttribute("property")===(d.property==null?null:d.property)&&x.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&x.getAttribute("charset")===(d.charSet==null?null:d.charSet)){w.splice(T,1);break t}}x=y.createElement(p),vn(x,p,d),y.head.appendChild(x);break;default:throw Error(r(468,p))}x[gn]=o,en(x),p=x}o.stateNode=p}else Gk(y,o.type,o.stateNode);else o.stateNode=Yk(y,p,o.memoizedProps);else x!==p?(x===null?d.stateNode!==null&&(d=d.stateNode,d.parentNode.removeChild(d)):x.count--,p===null?Gk(y,o.type,o.stateNode):Yk(y,p,o.memoizedProps)):p===null&&o.stateNode!==null&&ry(o,o.memoizedProps,d.memoizedProps)}break;case 27:Wn(a,o),Gn(o),p&512&&(qt||d===null||ai(d,d.return)),d!==null&&p&4&&ry(o,o.memoizedProps,d.memoizedProps);break;case 5:if(Wn(a,o),Gn(o),p&512&&(qt||d===null||ai(d,d.return)),o.flags&32){y=o.stateNode;try{Cl(y,"")}catch(xe){ut(o,o.return,xe)}}p&4&&o.stateNode!=null&&(y=o.memoizedProps,ry(o,y,d!==null?d.memoizedProps:y)),p&1024&&(oy=!0);break;case 6:if(Wn(a,o),Gn(o),p&4){if(o.stateNode===null)throw Error(r(162));p=o.memoizedProps,d=o.stateNode;try{d.nodeValue=p}catch(xe){ut(o,o.return,xe)}}break;case 3:if(Of=null,y=Wr,Wr=Af(a.containerInfo),Wn(a,o),Wr=y,Gn(o),p&4&&d!==null&&d.memoizedState.isDehydrated)try{ta(a.containerInfo)}catch(xe){ut(o,o.return,xe)}oy&&(oy=!1,Gw(o));break;case 4:p=Wr,Wr=Af(o.stateNode.containerInfo),Wn(a,o),Gn(o),Wr=p;break;case 12:Wn(a,o),Gn(o);break;case 31:Wn(a,o),Gn(o),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,hf(o,p)));break;case 13:Wn(a,o),Gn(o),o.child.flags&8192&&o.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(mf=Xt()),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,hf(o,p)));break;case 22:y=o.memoizedState!==null;var D=d!==null&&d.memoizedState!==null,$=Pi,G=qt;if(Pi=$||y,qt=G||D,Wn(a,o),qt=G,Pi=$,Gn(o),p&8192)e:for(a=o.stateNode,a._visibility=y?a._visibility&-2:a._visibility|1,y&&(d===null||D||Pi||qt||No(o)),d=null,a=o;;){if(a.tag===5||a.tag===26){if(d===null){D=d=a;try{if(x=D.stateNode,y)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{T=D.stateNode;var Q=D.memoizedProps.style,F=Q!=null&&Q.hasOwnProperty("display")?Q.display:null;T.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(xe){ut(D,D.return,xe)}}}else if(a.tag===6){if(d===null){D=a;try{D.stateNode.nodeValue=y?"":D.memoizedProps}catch(xe){ut(D,D.return,xe)}}}else if(a.tag===18){if(d===null){D=a;try{var q=D.stateNode;y?Bk(q,!0):Bk(D.stateNode,!1)}catch(xe){ut(D,D.return,xe)}}}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;d===a&&(d=null),a=a.return}d===a&&(d=null),a.sibling.return=a.return,a=a.sibling}p&4&&(p=o.updateQueue,p!==null&&(d=p.retryQueue,d!==null&&(p.retryQueue=null,hf(o,d))));break;case 19:Wn(a,o),Gn(o),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,hf(o,p)));break;case 30:break;case 21:break;default:Wn(a,o),Gn(o)}}function Gn(o){var a=o.flags;if(a&2){try{for(var d,p=o.return;p!==null;){if(Hw(p)){d=p;break}p=p.return}if(d==null)throw Error(r(160));switch(d.tag){case 27:var y=d.stateNode,x=iy(o);ff(o,x,y);break;case 5:var w=d.stateNode;d.flags&32&&(Cl(w,""),d.flags&=-33);var T=iy(o);ff(o,T,w);break;case 3:case 4:var D=d.stateNode.containerInfo,$=iy(o);sy(o,$,D);break;default:throw Error(r(161))}}catch(G){ut(o,o.return,G)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function Gw(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var a=o;Gw(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),o=o.sibling}}function Fi(o,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)$w(o,a.alternate,a),a=a.sibling}function No(o){for(o=o.child;o!==null;){var a=o;switch(a.tag){case 0:case 11:case 14:case 15:Cs(4,a,a.return),No(a);break;case 1:ai(a,a.return);var d=a.stateNode;typeof d.componentWillUnmount=="function"&&Bw(a,a.return,d),No(a);break;case 27:Hc(a.stateNode);case 26:case 5:ai(a,a.return),No(a);break;case 22:a.memoizedState===null&&No(a);break;case 30:No(a);break;default:No(a)}o=o.sibling}}function qi(o,a,d){for(d=d&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var p=a.alternate,y=o,x=a,w=x.flags;switch(x.tag){case 0:case 11:case 15:qi(y,x,d),_c(4,x);break;case 1:if(qi(y,x,d),p=x,y=p.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch($){ut(p,p.return,$)}if(p=x,y=p.updateQueue,y!==null){var T=p.stateNode;try{var D=y.shared.hiddenCallbacks;if(D!==null)for(y.shared.hiddenCallbacks=null,y=0;y<D.length;y++)TS(D[y],T)}catch($){ut(p,p.return,$)}}d&&w&64&&Iw(x),Dc(x,x.return);break;case 27:Vw(x);case 26:case 5:qi(y,x,d),d&&p===null&&w&4&&Uw(x),Dc(x,x.return);break;case 12:qi(y,x,d);break;case 31:qi(y,x,d),d&&w&4&&Kw(y,x);break;case 13:qi(y,x,d),d&&w&4&&Yw(y,x);break;case 22:x.memoizedState===null&&qi(y,x,d),Dc(x,x.return);break;case 30:break;default:qi(y,x,d)}a=a.sibling}}function ly(o,a){var d=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),o=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(o=a.memoizedState.cachePool.pool),o!==d&&(o!=null&&o.refCount++,d!=null&&yc(d))}function ay(o,a){o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&yc(o))}function Gr(o,a,d,p){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Zw(o,a,d,p),a=a.sibling}function Zw(o,a,d,p){var y=a.flags;switch(a.tag){case 0:case 11:case 15:Gr(o,a,d,p),y&2048&&_c(9,a);break;case 1:Gr(o,a,d,p);break;case 3:Gr(o,a,d,p),y&2048&&(o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&yc(o)));break;case 12:if(y&2048){Gr(o,a,d,p),o=a.stateNode;try{var x=a.memoizedProps,w=x.id,T=x.onPostCommit;typeof T=="function"&&T(w,a.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(D){ut(a,a.return,D)}}else Gr(o,a,d,p);break;case 31:Gr(o,a,d,p);break;case 13:Gr(o,a,d,p);break;case 23:break;case 22:x=a.stateNode,w=a.alternate,a.memoizedState!==null?x._visibility&2?Gr(o,a,d,p):Rc(o,a):x._visibility&2?Gr(o,a,d,p):(x._visibility|=2,Fl(o,a,d,p,(a.subtreeFlags&10256)!==0||!1)),y&2048&&ly(w,a);break;case 24:Gr(o,a,d,p),y&2048&&ay(a.alternate,a);break;default:Gr(o,a,d,p)}}function Fl(o,a,d,p,y){for(y=y&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=o,w=a,T=d,D=p,$=w.flags;switch(w.tag){case 0:case 11:case 15:Fl(x,w,T,D,y),_c(8,w);break;case 23:break;case 22:var G=w.stateNode;w.memoizedState!==null?G._visibility&2?Fl(x,w,T,D,y):Rc(x,w):(G._visibility|=2,Fl(x,w,T,D,y)),y&&$&2048&&ly(w.alternate,w);break;case 24:Fl(x,w,T,D,y),y&&$&2048&&ay(w.alternate,w);break;default:Fl(x,w,T,D,y)}a=a.sibling}}function Rc(o,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var d=o,p=a,y=p.flags;switch(p.tag){case 22:Rc(d,p),y&2048&&ly(p.alternate,p);break;case 24:Rc(d,p),y&2048&&ay(p.alternate,p);break;default:Rc(d,p)}a=a.sibling}}var Nc=8192;function ql(o,a,d){if(o.subtreeFlags&Nc)for(o=o.child;o!==null;)Jw(o,a,d),o=o.sibling}function Jw(o,a,d){switch(o.tag){case 26:ql(o,a,d),o.flags&Nc&&o.memoizedState!==null&&Tz(d,Wr,o.memoizedState,o.memoizedProps);break;case 5:ql(o,a,d);break;case 3:case 4:var p=Wr;Wr=Af(o.stateNode.containerInfo),ql(o,a,d),Wr=p;break;case 22:o.memoizedState===null&&(p=o.alternate,p!==null&&p.memoizedState!==null?(p=Nc,Nc=16777216,ql(o,a,d),Nc=p):ql(o,a,d));break;default:ql(o,a,d)}}function Xw(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 zc(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var d=0;d<a.length;d++){var p=a[d];tn=p,ek(p,o)}Xw(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)Qw(o),o=o.sibling}function Qw(o){switch(o.tag){case 0:case 11:case 15:zc(o),o.flags&2048&&Cs(9,o,o.return);break;case 3:zc(o);break;case 12:zc(o);break;case 22:var a=o.stateNode;o.memoizedState!==null&&a._visibility&2&&(o.return===null||o.return.tag!==13)?(a._visibility&=-3,pf(o)):zc(o);break;default:zc(o)}}function pf(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var d=0;d<a.length;d++){var p=a[d];tn=p,ek(p,o)}Xw(o)}for(o=o.child;o!==null;){switch(a=o,a.tag){case 0:case 11:case 15:Cs(8,a,a.return),pf(a);break;case 22:d=a.stateNode,d._visibility&2&&(d._visibility&=-3,pf(a));break;default:pf(a)}o=o.sibling}}function ek(o,a){for(;tn!==null;){var d=tn;switch(d.tag){case 0:case 11:case 15:Cs(8,d,a);break;case 23:case 22:if(d.memoizedState!==null&&d.memoizedState.cachePool!==null){var p=d.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:yc(d.memoizedState.cache)}if(p=d.child,p!==null)p.return=d,tn=p;else e:for(d=o;tn!==null;){p=tn;var y=p.sibling,x=p.return;if(Fw(p),p===d){tn=null;break e}if(y!==null){y.return=x,tn=y;break e}tn=x}}}var VN={getCacheForType:function(o){var a=bn(Pt),d=a.data.get(o);return d===void 0&&(d=o(),a.data.set(o,d)),d},cacheSignal:function(){return bn(Pt).controller.signal}},PN=typeof WeakMap=="function"?WeakMap:Map,lt=0,mt=null,Ye=null,Ze=0,ct=0,cr=null,Es=!1,Kl=!1,cy=!1,Ki=0,_t=0,Ts=0,zo=0,uy=0,ur=0,Yl=0,Lc=null,Zn=null,dy=!1,mf=0,tk=0,gf=1/0,yf=null,As=null,Zt=0,Ms=null,Wl=null,Yi=0,fy=0,hy=null,nk=null,jc=0,py=null;function dr(){return(lt&2)!==0&&Ze!==0?Ze&-Ze:N.T!==null?vy():bv()}function rk(){if(ur===0)if((Ze&536870912)===0||Qe){var o=fs;fs<<=1,(fs&3932160)===0&&(fs=262144),ur=o}else ur=536870912;return o=lr.current,o!==null&&(o.flags|=32),ur}function Jn(o,a,d){(o===mt&&(ct===2||ct===9)||o.cancelPendingCommit!==null)&&(Gl(o,0),Os(o,Ze,ur,!1)),rc(o,d),((lt&2)===0||o!==mt)&&(o===mt&&((lt&2)===0&&(zo|=d),_t===4&&Os(o,Ze,ur,!1)),ci(o))}function ik(o,a,d){if((lt&6)!==0)throw Error(r(327));var p=!d&&(a&127)===0&&(a&o.expiredLanes)===0||nc(o,a),y=p?qN(o,a):gy(o,a,!0),x=p;do{if(y===0){Kl&&!p&&Os(o,a,0,!1);break}else{if(d=o.current.alternate,x&&!$N(d)){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 T=o;y=Lc;var D=T.current.memoizedState.isDehydrated;if(D&&(Gl(T,w).flags|=256),w=gy(T,w,!1),w!==2){if(cy&&!D){T.errorRecoveryDisabledLanes|=x,zo|=x,y=4;break e}x=Zn,Zn=y,x!==null&&(Zn===null?Zn=x:Zn.push.apply(Zn,x))}y=w}if(x=!1,y!==2)continue}}if(y===1){Gl(o,0),Os(o,a,0,!0);break}e:{switch(p=o,x=y,x){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Os(p,a,ur,!Es);break e;case 2:Zn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(y=mf+300-Xt(),10<y)){if(Os(p,a,ur,!Es),Td(p,0,!0)!==0)break e;Yi=a,p.timeoutHandle=Lk(sk.bind(null,p,d,Zn,yf,dy,a,ur,zo,Yl,Es,x,"Throttled",-0,0),y);break e}sk(p,d,Zn,yf,dy,a,ur,zo,Yl,Es,x,null,-0,0)}}break}while(!0);ci(o)}function sk(o,a,d,p,y,x,w,T,D,$,G,Q,F,q){if(o.timeoutHandle=-1,Q=a.subtreeFlags,Q&8192||(Q&16785408)===16785408){Q={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ri},Jw(a,x,Q);var xe=(x&62914560)===x?mf-Xt():(x&4194048)===x?tk-Xt():0;if(xe=Az(Q,xe),xe!==null){Yi=x,o.cancelPendingCommit=xe(hk.bind(null,o,a,x,d,p,y,w,T,D,G,Q,null,F,q)),Os(o,x,w,!$);return}}hk(o,a,x,d,p,y,w,T,D)}function $N(o){for(var a=o;;){var d=a.tag;if((d===0||d===11||d===15)&&a.flags&16384&&(d=a.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var p=0;p<d.length;p++){var y=d[p],x=y.getSnapshot;y=y.value;try{if(!sr(x(),y))return!1}catch{return!1}}if(d=a.child,a.subtreeFlags&16384&&d!==null)d.return=a,a=d;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 Os(o,a,d,p){a&=~uy,a&=~zo,o.suspendedLanes|=a,o.pingedLanes&=~a,p&&(o.warmLanes|=a),p=o.expirationTimes;for(var y=a;0<y;){var x=31-ot(y),w=1<<x;p[x]=-1,y&=~w}d!==0&&mv(o,d,a)}function bf(){return(lt&6)===0?(Ic(0),!1):!0}function my(){if(Ye!==null){if(ct===0)var o=Ye.return;else o=Ye,ji=Eo=null,Dg(o),Ul=null,xc=0,o=Ye;for(;o!==null;)jw(o.alternate,o),o=o.return;Ye=null}}function Gl(o,a){var d=o.timeoutHandle;d!==-1&&(o.timeoutHandle=-1,cz(d)),d=o.cancelPendingCommit,d!==null&&(o.cancelPendingCommit=null,d()),Yi=0,my(),mt=o,Ye=d=zi(o.current,null),Ze=a,ct=0,cr=null,Es=!1,Kl=nc(o,a),cy=!1,Yl=ur=uy=zo=Ts=_t=0,Zn=Lc=null,dy=!1,(a&8)!==0&&(a|=a&32);var p=o.entangledLanes;if(p!==0)for(o=o.entanglements,p&=a;0<p;){var y=31-ot(p),x=1<<y;a|=o[y],p&=~x}return Ki=a,Bd(),d}function ok(o,a){Ue=null,N.H=Ac,a===Bl||a===Kd?(a=wS(),ct=3):a===xg?(a=wS(),ct=4):ct=a===Yg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,cr=a,Ye===null&&(_t=1,lf(o,Cr(a,o.current)))}function lk(){var o=lr.current;return o===null?!0:(Ze&4194048)===Ze?Mr===null:(Ze&62914560)===Ze||(Ze&536870912)!==0?o===Mr:!1}function ak(){var o=N.H;return N.H=Ac,o===null?Ac:o}function ck(){var o=N.A;return N.A=VN,o}function xf(){_t=4,Es||(Ze&4194048)!==Ze&&lr.current!==null||(Kl=!0),(Ts&134217727)===0&&(zo&134217727)===0||mt===null||Os(mt,Ze,ur,!1)}function gy(o,a,d){var p=lt;lt|=2;var y=ak(),x=ck();(mt!==o||Ze!==a)&&(yf=null,Gl(o,a)),a=!1;var w=_t;e:do try{if(ct!==0&&Ye!==null){var T=Ye,D=cr;switch(ct){case 8:my(),w=6;break e;case 3:case 2:case 9:case 6:lr.current===null&&(a=!0);var $=ct;if(ct=0,cr=null,Zl(o,T,D,$),d&&Kl){w=0;break e}break;default:$=ct,ct=0,cr=null,Zl(o,T,D,$)}}FN(),w=_t;break}catch(G){ok(o,G)}while(!0);return a&&o.shellSuspendCounter++,ji=Eo=null,lt=p,N.H=y,N.A=x,Ye===null&&(mt=null,Ze=0,Bd()),w}function FN(){for(;Ye!==null;)uk(Ye)}function qN(o,a){var d=lt;lt|=2;var p=ak(),y=ck();mt!==o||Ze!==a?(yf=null,gf=Xt()+500,Gl(o,a)):Kl=nc(o,a);e:do try{if(ct!==0&&Ye!==null){a=Ye;var x=cr;t:switch(ct){case 1:ct=0,cr=null,Zl(o,a,x,1);break;case 2:case 9:if(vS(x)){ct=0,cr=null,dk(a);break}a=function(){ct!==2&&ct!==9||mt!==o||(ct=7),ci(o)},x.then(a,a);break e;case 3:ct=7;break e;case 4:ct=5;break e;case 7:vS(x)?(ct=0,cr=null,dk(a)):(ct=0,cr=null,Zl(o,a,x,7));break;case 5:var w=null;switch(Ye.tag){case 26:w=Ye.memoizedState;case 5:case 27:var T=Ye;if(w?Zk(w):T.stateNode.complete){ct=0,cr=null;var D=T.sibling;if(D!==null)Ye=D;else{var $=T.return;$!==null?(Ye=$,vf($)):Ye=null}break t}}ct=0,cr=null,Zl(o,a,x,5);break;case 6:ct=0,cr=null,Zl(o,a,x,6);break;case 8:my(),_t=6;break e;default:throw Error(r(462))}}KN();break}catch(G){ok(o,G)}while(!0);return ji=Eo=null,N.H=p,N.A=y,lt=d,Ye!==null?0:(mt=null,Ze=0,Bd(),_t)}function KN(){for(;Ye!==null&&!gl();)uk(Ye)}function uk(o){var a=zw(o.alternate,o,Ki);o.memoizedProps=o.pendingProps,a===null?vf(o):Ye=a}function dk(o){var a=o,d=a.alternate;switch(a.tag){case 15:case 0:a=Mw(d,a,a.pendingProps,a.type,void 0,Ze);break;case 11:a=Mw(d,a,a.pendingProps,a.type.render,a.ref,Ze);break;case 5:Dg(a);default:jw(d,a),a=Ye=cS(a,Ki),a=zw(d,a,Ki)}o.memoizedProps=o.pendingProps,a===null?vf(o):Ye=a}function Zl(o,a,d,p){ji=Eo=null,Dg(a),Ul=null,xc=0;var y=a.return;try{if(zN(o,y,a,d,Ze)){_t=1,lf(o,Cr(d,o.current)),Ye=null;return}}catch(x){if(y!==null)throw Ye=y,x;_t=1,lf(o,Cr(d,o.current)),Ye=null;return}a.flags&32768?(Qe||p===1?o=!0:Kl||(Ze&536870912)!==0?o=!1:(Es=o=!0,(p===2||p===9||p===3||p===6)&&(p=lr.current,p!==null&&p.tag===13&&(p.flags|=16384))),fk(a,o)):vf(a)}function vf(o){var a=o;do{if((a.flags&32768)!==0){fk(a,Es);return}o=a.return;var d=IN(a.alternate,a,Ki);if(d!==null){Ye=d;return}if(a=a.sibling,a!==null){Ye=a;return}Ye=a=o}while(a!==null);_t===0&&(_t=5)}function fk(o,a){do{var d=BN(o.alternate,o);if(d!==null){d.flags&=32767,Ye=d;return}if(d=o.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!a&&(o=o.sibling,o!==null)){Ye=o;return}Ye=o=d}while(o!==null);_t=6,Ye=null}function hk(o,a,d,p,y,x,w,T,D){o.cancelPendingCommit=null;do Sf();while(Zt!==0);if((lt&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,E2(o,d,x,w,T,D),o===mt&&(Ye=mt=null,Ze=0),Wl=a,Ms=o,Yi=d,fy=x,hy=y,nk=p,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,ZN(Re,function(){return bk(),null})):(o.callbackNode=null,o.callbackPriority=0),p=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||p){p=N.T,N.T=null,y=K.p,K.p=2,w=lt,lt|=4;try{UN(o,a,d)}finally{lt=w,K.p=y,N.T=p}}Zt=1,pk(),mk(),gk()}}function pk(){if(Zt===1){Zt=0;var o=Ms,a=Wl,d=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||d){d=N.T,N.T=null;var p=K.p;K.p=2;var y=lt;lt|=4;try{Ww(a,o);var x=My,w=eS(o.containerInfo),T=x.focusedElem,D=x.selectionRange;if(w!==T&&T&&T.ownerDocument&&Qv(T.ownerDocument.documentElement,T)){if(D!==null&&Qm(T)){var $=D.start,G=D.end;if(G===void 0&&(G=$),"selectionStart"in T)T.selectionStart=$,T.selectionEnd=Math.min(G,T.value.length);else{var Q=T.ownerDocument||document,F=Q&&Q.defaultView||window;if(F.getSelection){var q=F.getSelection(),xe=T.textContent.length,De=Math.min(D.start,xe),ht=D.end===void 0?De:Math.min(D.end,xe);!q.extend&&De>ht&&(w=ht,ht=De,De=w);var U=Xv(T,De),z=Xv(T,ht);if(U&&z&&(q.rangeCount!==1||q.anchorNode!==U.node||q.anchorOffset!==U.offset||q.focusNode!==z.node||q.focusOffset!==z.offset)){var P=Q.createRange();P.setStart(U.node,U.offset),q.removeAllRanges(),De>ht?(q.addRange(P),q.extend(z.node,z.offset)):(P.setEnd(z.node,z.offset),q.addRange(P))}}}}for(Q=[],q=T;q=q.parentNode;)q.nodeType===1&&Q.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<Q.length;T++){var X=Q[T];X.element.scrollLeft=X.left,X.element.scrollTop=X.top}}Nf=!!Ay,My=Ay=null}finally{lt=y,K.p=p,N.T=d}}o.current=a,Zt=2}}function mk(){if(Zt===2){Zt=0;var o=Ms,a=Wl,d=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||d){d=N.T,N.T=null;var p=K.p;K.p=2;var y=lt;lt|=4;try{$w(o,a.alternate,a)}finally{lt=y,K.p=p,N.T=d}}Zt=3}}function gk(){if(Zt===4||Zt===3){Zt=0,yl();var o=Ms,a=Wl,d=Yi,p=nk;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Zt=5:(Zt=0,Wl=Ms=null,yk(o,o.pendingLanes));var y=o.pendingLanes;if(y===0&&(As=null),zm(d),a=a.stateNode,It&&typeof It.onCommitFiberRoot=="function")try{It.onCommitFiberRoot(mn,a,void 0,(a.current.flags&128)===128)}catch{}if(p!==null){a=N.T,y=K.p,K.p=2,N.T=null;try{for(var x=o.onRecoverableError,w=0;w<p.length;w++){var T=p[w];x(T.value,{componentStack:T.stack})}}finally{N.T=a,K.p=y}}(Yi&3)!==0&&Sf(),ci(o),y=o.pendingLanes,(d&261930)!==0&&(y&42)!==0?o===py?jc++:(jc=0,py=o):jc=0,Ic(0)}}function yk(o,a){(o.pooledCacheLanes&=a)===0&&(a=o.pooledCache,a!=null&&(o.pooledCache=null,yc(a)))}function Sf(){return pk(),mk(),gk(),bk()}function bk(){if(Zt!==5)return!1;var o=Ms,a=fy;fy=0;var d=zm(Yi),p=N.T,y=K.p;try{K.p=32>d?32:d,N.T=null,d=hy,hy=null;var x=Ms,w=Yi;if(Zt=0,Wl=Ms=null,Yi=0,(lt&6)!==0)throw Error(r(331));var T=lt;if(lt|=4,Qw(x.current),Zw(x,x.current,w,d),lt=T,Ic(0,!1),It&&typeof It.onPostCommitFiberRoot=="function")try{It.onPostCommitFiberRoot(mn,x)}catch{}return!0}finally{K.p=y,N.T=p,yk(o,a)}}function xk(o,a,d){a=Cr(d,a),a=Kg(o.stateNode,a,2),o=Ss(o,a,2),o!==null&&(rc(o,2),ci(o))}function ut(o,a,d){if(o.tag===3)xk(o,o,d);else for(;a!==null;){if(a.tag===3){xk(a,o,d);break}else if(a.tag===1){var p=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(As===null||!As.has(p))){o=Cr(d,o),d=vw(2),p=Ss(a,d,2),p!==null&&(Sw(d,p,a,o),rc(p,2),ci(p));break}}a=a.return}}function yy(o,a,d){var p=o.pingCache;if(p===null){p=o.pingCache=new PN;var y=new Set;p.set(a,y)}else y=p.get(a),y===void 0&&(y=new Set,p.set(a,y));y.has(d)||(cy=!0,y.add(d),o=YN.bind(null,o,a,d),a.then(o,o))}function YN(o,a,d){var p=o.pingCache;p!==null&&p.delete(a),o.pingedLanes|=o.suspendedLanes&d,o.warmLanes&=~d,mt===o&&(Ze&d)===d&&(_t===4||_t===3&&(Ze&62914560)===Ze&&300>Xt()-mf?(lt&2)===0&&Gl(o,0):uy|=d,Yl===Ze&&(Yl=0)),ci(o)}function vk(o,a){a===0&&(a=pv()),o=wo(o,a),o!==null&&(rc(o,a),ci(o))}function WN(o){var a=o.memoizedState,d=0;a!==null&&(d=a.retryLane),vk(o,d)}function GN(o,a){var d=0;switch(o.tag){case 31:case 13:var p=o.stateNode,y=o.memoizedState;y!==null&&(d=y.retryLane);break;case 19:p=o.stateNode;break;case 22:p=o.stateNode._retryCache;break;default:throw Error(r(314))}p!==null&&p.delete(a),vk(o,d)}function ZN(o,a){return _i(o,a)}var wf=null,Jl=null,by=!1,kf=!1,xy=!1,_s=0;function ci(o){o!==Jl&&o.next===null&&(Jl===null?wf=Jl=o:Jl=Jl.next=o),kf=!0,by||(by=!0,XN())}function Ic(o,a){if(!xy&&kf){xy=!0;do for(var d=!1,p=wf;p!==null;){if(o!==0){var y=p.pendingLanes;if(y===0)var x=0;else{var w=p.suspendedLanes,T=p.pingedLanes;x=(1<<31-ot(42|o)+1)-1,x&=y&~(w&~T),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(d=!0,Ck(p,x))}else x=Ze,x=Td(p,p===mt?x:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(x&3)===0||nc(p,x)||(d=!0,Ck(p,x));p=p.next}while(d);xy=!1}}function JN(){Sk()}function Sk(){kf=by=!1;var o=0;_s!==0&&az()&&(o=_s);for(var a=Xt(),d=null,p=wf;p!==null;){var y=p.next,x=wk(p,a);x===0?(p.next=null,d===null?wf=y:d.next=y,y===null&&(Jl=d)):(d=p,(o!==0||(x&3)!==0)&&(kf=!0)),p=y}Zt!==0&&Zt!==5||Ic(o),_s!==0&&(_s=0)}function wk(o,a){for(var d=o.suspendedLanes,p=o.pingedLanes,y=o.expirationTimes,x=o.pendingLanes&-62914561;0<x;){var w=31-ot(x),T=1<<w,D=y[w];D===-1?((T&d)===0||(T&p)!==0)&&(y[w]=C2(T,a)):D<=a&&(o.expiredLanes|=T),x&=~T}if(a=mt,d=Ze,d=Td(o,o===a?d:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),p=o.callbackNode,d===0||o===a&&(ct===2||ct===9)||o.cancelPendingCommit!==null)return p!==null&&p!==null&&qr(p),o.callbackNode=null,o.callbackPriority=0;if((d&3)===0||nc(o,d)){if(a=d&-d,a===o.callbackPriority)return a;switch(p!==null&&qr(p),zm(d)){case 2:case 8:d=de;break;case 32:d=Re;break;case 268435456:d=tt;break;default:d=Re}return p=kk.bind(null,o),d=_i(d,p),o.callbackPriority=a,o.callbackNode=d,a}return p!==null&&p!==null&&qr(p),o.callbackPriority=2,o.callbackNode=null,2}function kk(o,a){if(Zt!==0&&Zt!==5)return o.callbackNode=null,o.callbackPriority=0,null;var d=o.callbackNode;if(Sf()&&o.callbackNode!==d)return null;var p=Ze;return p=Td(o,o===mt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),p===0?null:(ik(o,p,a),wk(o,Xt()),o.callbackNode!=null&&o.callbackNode===d?kk.bind(null,o):null)}function Ck(o,a){if(Sf())return null;ik(o,a,!0)}function XN(){uz(function(){(lt&6)!==0?_i(J,JN):Sk()})}function vy(){if(_s===0){var o=jl;o===0&&(o=si,si<<=1,(si&261888)===0&&(si=256)),_s=o}return _s}function Ek(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:_d(""+o)}function Tk(o,a){var d=a.ownerDocument.createElement("input");return d.name=a.name,d.value=a.value,o.id&&d.setAttribute("form",o.id),a.parentNode.insertBefore(d,a),o=new FormData(o),d.parentNode.removeChild(d),o}function QN(o,a,d,p,y){if(a==="submit"&&d&&d.stateNode===y){var x=Ek((y[qn]||null).action),w=p.submitter;w&&(a=(a=w[qn]||null)?Ek(a.formAction):w.getAttribute("formAction"),a!==null&&(x=a,w=null));var T=new zd("action","action",null,p,y);o.push({event:T,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(_s!==0){var D=w?Tk(y,w):new FormData(y);Hg(d,{pending:!0,data:D,method:y.method,action:x},null,D)}}else typeof x=="function"&&(T.preventDefault(),D=w?Tk(y,w):new FormData(y),Hg(d,{pending:!0,data:D,method:y.method,action:x},x,D))},currentTarget:y}]})}}for(var Sy=0;Sy<rg.length;Sy++){var wy=rg[Sy],ez=wy.toLowerCase(),tz=wy[0].toUpperCase()+wy.slice(1);Yr(ez,"on"+tz)}Yr(rS,"onAnimationEnd"),Yr(iS,"onAnimationIteration"),Yr(sS,"onAnimationStart"),Yr("dblclick","onDoubleClick"),Yr("focusin","onFocus"),Yr("focusout","onBlur"),Yr(yN,"onTransitionRun"),Yr(bN,"onTransitionStart"),Yr(xN,"onTransitionCancel"),Yr(oS,"onTransitionEnd"),wl("onMouseEnter",["mouseout","mouseover"]),wl("onMouseLeave",["mouseout","mouseover"]),wl("onPointerEnter",["pointerout","pointerover"]),wl("onPointerLeave",["pointerout","pointerover"]),bo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),bo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),bo("onBeforeInput",["compositionend","keypress","textInput","paste"]),bo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),bo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),bo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Bc="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(" "),nz=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Bc));function Ak(o,a){a=(a&4)!==0;for(var d=0;d<o.length;d++){var p=o[d],y=p.event;p=p.listeners;e:{var x=void 0;if(a)for(var w=p.length-1;0<=w;w--){var T=p[w],D=T.instance,$=T.currentTarget;if(T=T.listener,D!==x&&y.isPropagationStopped())break e;x=T,y.currentTarget=$;try{x(y)}catch(G){Id(G)}y.currentTarget=null,x=D}else for(w=0;w<p.length;w++){if(T=p[w],D=T.instance,$=T.currentTarget,T=T.listener,D!==x&&y.isPropagationStopped())break e;x=T,y.currentTarget=$;try{x(y)}catch(G){Id(G)}y.currentTarget=null,x=D}}}}function We(o,a){var d=a[Lm];d===void 0&&(d=a[Lm]=new Set);var p=o+"__bubble";d.has(p)||(Mk(a,o,2,!1),d.add(p))}function ky(o,a,d){var p=0;a&&(p|=4),Mk(d,o,p,a)}var Cf="_reactListening"+Math.random().toString(36).slice(2);function Cy(o){if(!o[Cf]){o[Cf]=!0,Sv.forEach(function(d){d!=="selectionchange"&&(nz.has(d)||ky(d,!1,o),ky(d,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[Cf]||(a[Cf]=!0,ky("selectionchange",!1,a))}}function Mk(o,a,d,p){switch(rC(a)){case 2:var y=_z;break;case 8:y=Dz;break;default:y=Uy}d=y.bind(null,a,d,o),y=void 0,!Fm||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(y=!0),p?y!==void 0?o.addEventListener(a,d,{capture:!0,passive:y}):o.addEventListener(a,d,!0):y!==void 0?o.addEventListener(a,d,{passive:y}):o.addEventListener(a,d,!1)}function Ey(o,a,d,p,y){var x=p;if((a&1)===0&&(a&2)===0&&p!==null)e:for(;;){if(p===null)return;var w=p.tag;if(w===3||w===4){var T=p.stateNode.containerInfo;if(T===y)break;if(w===4)for(w=p.return;w!==null;){var D=w.tag;if((D===3||D===4)&&w.stateNode.containerInfo===y)return;w=w.return}for(;T!==null;){if(w=xl(T),w===null)return;if(D=w.tag,D===5||D===6||D===26||D===27){p=x=w;continue e}T=T.parentNode}}p=p.return}Nv(function(){var $=x,G=Pm(d),Q=[];e:{var F=lS.get(o);if(F!==void 0){var q=zd,xe=o;switch(o){case"keypress":if(Rd(d)===0)break e;case"keydown":case"keyup":q=G2;break;case"focusin":xe="focus",q=Wm;break;case"focusout":xe="blur",q=Wm;break;case"beforeblur":case"afterblur":q=Wm;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":q=jv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":q=I2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":q=X2;break;case rS:case iS:case sS:q=H2;break;case oS:q=eN;break;case"scroll":case"scrollend":q=L2;break;case"wheel":q=nN;break;case"copy":case"cut":case"paste":q=P2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":q=Bv;break;case"toggle":case"beforetoggle":q=iN}var De=(a&4)!==0,ht=!De&&(o==="scroll"||o==="scrollend"),U=De?F!==null?F+"Capture":null:F;De=[];for(var z=$,P;z!==null;){var X=z;if(P=X.stateNode,X=X.tag,X!==5&&X!==26&&X!==27||P===null||U===null||(X=oc(z,U),X!=null&&De.push(Uc(z,X,P))),ht)break;z=z.return}0<De.length&&(F=new q(F,xe,null,d,G),Q.push({event:F,listeners:De}))}}if((a&7)===0){e:{if(F=o==="mouseover"||o==="pointerover",q=o==="mouseout"||o==="pointerout",F&&d!==Vm&&(xe=d.relatedTarget||d.fromElement)&&(xl(xe)||xe[bl]))break e;if((q||F)&&(F=G.window===G?G:(F=G.ownerDocument)?F.defaultView||F.parentWindow:window,q?(xe=d.relatedTarget||d.toElement,q=$,xe=xe?xl(xe):null,xe!==null&&(ht=s(xe),De=xe.tag,xe!==ht||De!==5&&De!==27&&De!==6)&&(xe=null)):(q=null,xe=$),q!==xe)){if(De=jv,X="onMouseLeave",U="onMouseEnter",z="mouse",(o==="pointerout"||o==="pointerover")&&(De=Bv,X="onPointerLeave",U="onPointerEnter",z="pointer"),ht=q==null?F:sc(q),P=xe==null?F:sc(xe),F=new De(X,z+"leave",q,d,G),F.target=ht,F.relatedTarget=P,X=null,xl(G)===$&&(De=new De(U,z+"enter",xe,d,G),De.target=P,De.relatedTarget=ht,X=De),ht=X,q&&xe)t:{for(De=rz,U=q,z=xe,P=0,X=U;X;X=De(X))P++;X=0;for(var Me=z;Me;Me=De(Me))X++;for(;0<P-X;)U=De(U),P--;for(;0<X-P;)z=De(z),X--;for(;P--;){if(U===z||z!==null&&U===z.alternate){De=U;break t}U=De(U),z=De(z)}De=null}else De=null;q!==null&&Ok(Q,F,q,De,!1),xe!==null&&ht!==null&&Ok(Q,ht,xe,De,!0)}}e:{if(F=$?sc($):window,q=F.nodeName&&F.nodeName.toLowerCase(),q==="select"||q==="input"&&F.type==="file")var nt=Kv;else if(Fv(F))if(Yv)nt=pN;else{nt=fN;var ke=dN}else q=F.nodeName,!q||q.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?$&&Hm($.elementType)&&(nt=Kv):nt=hN;if(nt&&(nt=nt(o,$))){qv(Q,nt,d,G);break e}ke&&ke(o,F,$),o==="focusout"&&$&&F.type==="number"&&$.memoizedProps.value!=null&&Um(F,"number",F.value)}switch(ke=$?sc($):window,o){case"focusin":(Fv(ke)||ke.contentEditable==="true")&&(Ml=ke,eg=$,pc=null);break;case"focusout":pc=eg=Ml=null;break;case"mousedown":tg=!0;break;case"contextmenu":case"mouseup":case"dragend":tg=!1,tS(Q,d,G);break;case"selectionchange":if(gN)break;case"keydown":case"keyup":tS(Q,d,G)}var Ve;if(Zm)e:{switch(o){case"compositionstart":var Je="onCompositionStart";break e;case"compositionend":Je="onCompositionEnd";break e;case"compositionupdate":Je="onCompositionUpdate";break e}Je=void 0}else Al?Pv(o,d)&&(Je="onCompositionEnd"):o==="keydown"&&d.keyCode===229&&(Je="onCompositionStart");Je&&(Uv&&d.locale!=="ko"&&(Al||Je!=="onCompositionStart"?Je==="onCompositionEnd"&&Al&&(Ve=zv()):(ps=G,qm="value"in ps?ps.value:ps.textContent,Al=!0)),ke=Ef($,Je),0<ke.length&&(Je=new Iv(Je,o,null,d,G),Q.push({event:Je,listeners:ke}),Ve?Je.data=Ve:(Ve=$v(d),Ve!==null&&(Je.data=Ve)))),(Ve=oN?lN(o,d):aN(o,d))&&(Je=Ef($,"onBeforeInput"),0<Je.length&&(ke=new Iv("onBeforeInput","beforeinput",null,d,G),Q.push({event:ke,listeners:Je}),ke.data=Ve)),QN(Q,o,$,d,G)}Ak(Q,a)})}function Uc(o,a,d){return{instance:o,listener:a,currentTarget:d}}function Ef(o,a){for(var d=a+"Capture",p=[];o!==null;){var y=o,x=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||x===null||(y=oc(o,d),y!=null&&p.unshift(Uc(o,y,x)),y=oc(o,a),y!=null&&p.push(Uc(o,y,x))),o.tag===3)return p;o=o.return}return[]}function rz(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function Ok(o,a,d,p,y){for(var x=a._reactName,w=[];d!==null&&d!==p;){var T=d,D=T.alternate,$=T.stateNode;if(T=T.tag,D!==null&&D===p)break;T!==5&&T!==26&&T!==27||$===null||(D=$,y?($=oc(d,x),$!=null&&w.unshift(Uc(d,$,D))):y||($=oc(d,x),$!=null&&w.push(Uc(d,$,D)))),d=d.return}w.length!==0&&o.push({event:a,listeners:w})}var iz=/\r\n?/g,sz=/\u0000|\uFFFD/g;function _k(o){return(typeof o=="string"?o:""+o).replace(iz,`
50
+ `).replace(sz,"")}function Dk(o,a){return a=_k(a),_k(o)===a}function ft(o,a,d,p,y,x){switch(d){case"children":typeof p=="string"?a==="body"||a==="textarea"&&p===""||Cl(o,p):(typeof p=="number"||typeof p=="bigint")&&a!=="body"&&Cl(o,""+p);break;case"className":Md(o,"class",p);break;case"tabIndex":Md(o,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":Md(o,d,p);break;case"style":Dv(o,p,x);break;case"data":if(a!=="object"){Md(o,"data",p);break}case"src":case"href":if(p===""&&(a!=="a"||d!=="href")){o.removeAttribute(d);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){o.removeAttribute(d);break}p=_d(""+p),o.setAttribute(d,p);break;case"action":case"formAction":if(typeof p=="function"){o.setAttribute(d,"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"&&(d==="formAction"?(a!=="input"&&ft(o,a,"name",y.name,y,null),ft(o,a,"formEncType",y.formEncType,y,null),ft(o,a,"formMethod",y.formMethod,y,null),ft(o,a,"formTarget",y.formTarget,y,null)):(ft(o,a,"encType",y.encType,y,null),ft(o,a,"method",y.method,y,null),ft(o,a,"target",y.target,y,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){o.removeAttribute(d);break}p=_d(""+p),o.setAttribute(d,p);break;case"onClick":p!=null&&(o.onclick=Ri);break;case"onScroll":p!=null&&We("scroll",o);break;case"onScrollEnd":p!=null&&We("scrollend",o);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(d=p.__html,d!=null){if(y.children!=null)throw Error(r(60));o.innerHTML=d}}break;case"multiple":o.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":o.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){o.removeAttribute("xlink:href");break}d=_d(""+p),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(d,""+p):o.removeAttribute(d);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":p&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(d,""):o.removeAttribute(d);break;case"capture":case"download":p===!0?o.setAttribute(d,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(d,p):o.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?o.setAttribute(d,p):o.removeAttribute(d);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?o.removeAttribute(d):o.setAttribute(d,p);break;case"popover":We("beforetoggle",o),We("toggle",o),Ad(o,"popover",p);break;case"xlinkActuate":Di(o,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":Di(o,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":Di(o,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":Di(o,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":Di(o,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":Di(o,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":Di(o,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":Di(o,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":Di(o,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":Ad(o,"is",p);break;case"innerText":case"textContent":break;default:(!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(d=N2.get(d)||d,Ad(o,d,p))}}function Ty(o,a,d,p,y,x){switch(d){case"style":Dv(o,p,x);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(d=p.__html,d!=null){if(y.children!=null)throw Error(r(60));o.innerHTML=d}}break;case"children":typeof p=="string"?Cl(o,p):(typeof p=="number"||typeof p=="bigint")&&Cl(o,""+p);break;case"onScroll":p!=null&&We("scroll",o);break;case"onScrollEnd":p!=null&&We("scrollend",o);break;case"onClick":p!=null&&(o.onclick=Ri);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!wv.hasOwnProperty(d))e:{if(d[0]==="o"&&d[1]==="n"&&(y=d.endsWith("Capture"),a=d.slice(2,y?d.length-7:void 0),x=o[qn]||null,x=x!=null?x[d]:null,typeof x=="function"&&o.removeEventListener(a,x,y),typeof p=="function")){typeof x!="function"&&x!==null&&(d in o?o[d]=null:o.hasAttribute(d)&&o.removeAttribute(d)),o.addEventListener(a,p,y);break e}d in o?o[d]=p:p===!0?o.setAttribute(d,""):Ad(o,d,p)}}}function vn(o,a,d){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":We("error",o),We("load",o);var p=!1,y=!1,x;for(x in d)if(d.hasOwnProperty(x)){var w=d[x];if(w!=null)switch(x){case"src":p=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:ft(o,a,x,w,d,null)}}y&&ft(o,a,"srcSet",d.srcSet,d,null),p&&ft(o,a,"src",d.src,d,null);return;case"input":We("invalid",o);var T=x=w=y=null,D=null,$=null;for(p in d)if(d.hasOwnProperty(p)){var G=d[p];if(G!=null)switch(p){case"name":y=G;break;case"type":w=G;break;case"checked":D=G;break;case"defaultChecked":$=G;break;case"value":x=G;break;case"defaultValue":T=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(r(137,a));break;default:ft(o,a,p,G,d,null)}}Av(o,x,T,D,$,w,y,!1);return;case"select":We("invalid",o),p=w=x=null;for(y in d)if(d.hasOwnProperty(y)&&(T=d[y],T!=null))switch(y){case"value":x=T;break;case"defaultValue":w=T;break;case"multiple":p=T;default:ft(o,a,y,T,d,null)}a=x,d=w,o.multiple=!!p,a!=null?kl(o,!!p,a,!1):d!=null&&kl(o,!!p,d,!0);return;case"textarea":We("invalid",o),x=y=p=null;for(w in d)if(d.hasOwnProperty(w)&&(T=d[w],T!=null))switch(w){case"value":p=T;break;case"defaultValue":y=T;break;case"children":x=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(r(91));break;default:ft(o,a,w,T,d,null)}Ov(o,p,y,x);return;case"option":for(D in d)if(d.hasOwnProperty(D)&&(p=d[D],p!=null))switch(D){case"selected":o.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:ft(o,a,D,p,d,null)}return;case"dialog":We("beforetoggle",o),We("toggle",o),We("cancel",o),We("close",o);break;case"iframe":case"object":We("load",o);break;case"video":case"audio":for(p=0;p<Bc.length;p++)We(Bc[p],o);break;case"image":We("error",o),We("load",o);break;case"details":We("toggle",o);break;case"embed":case"source":case"link":We("error",o),We("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 d)if(d.hasOwnProperty($)&&(p=d[$],p!=null))switch($){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:ft(o,a,$,p,d,null)}return;default:if(Hm(a)){for(G in d)d.hasOwnProperty(G)&&(p=d[G],p!==void 0&&Ty(o,a,G,p,d,void 0));return}}for(T in d)d.hasOwnProperty(T)&&(p=d[T],p!=null&&ft(o,a,T,p,d,null))}function oz(o,a,d,p){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,T=null,D=null,$=null,G=null;for(q in d){var Q=d[q];if(d.hasOwnProperty(q)&&Q!=null)switch(q){case"checked":break;case"value":break;case"defaultValue":D=Q;default:p.hasOwnProperty(q)||ft(o,a,q,null,p,Q)}}for(var F in p){var q=p[F];if(Q=d[F],p.hasOwnProperty(F)&&(q!=null||Q!=null))switch(F){case"type":x=q;break;case"name":y=q;break;case"checked":$=q;break;case"defaultChecked":G=q;break;case"value":w=q;break;case"defaultValue":T=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(r(137,a));break;default:q!==Q&&ft(o,a,F,q,p,Q)}}Bm(o,w,T,D,$,G,x,y);return;case"select":q=w=T=F=null;for(x in d)if(D=d[x],d.hasOwnProperty(x)&&D!=null)switch(x){case"value":break;case"multiple":q=D;default:p.hasOwnProperty(x)||ft(o,a,x,null,p,D)}for(y in p)if(x=p[y],D=d[y],p.hasOwnProperty(y)&&(x!=null||D!=null))switch(y){case"value":F=x;break;case"defaultValue":T=x;break;case"multiple":w=x;default:x!==D&&ft(o,a,y,x,p,D)}a=T,d=w,p=q,F!=null?kl(o,!!d,F,!1):!!p!=!!d&&(a!=null?kl(o,!!d,a,!0):kl(o,!!d,d?[]:"",!1));return;case"textarea":q=F=null;for(T in d)if(y=d[T],d.hasOwnProperty(T)&&y!=null&&!p.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:ft(o,a,T,null,p,y)}for(w in p)if(y=p[w],x=d[w],p.hasOwnProperty(w)&&(y!=null||x!=null))switch(w){case"value":F=y;break;case"defaultValue":q=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(r(91));break;default:y!==x&&ft(o,a,w,y,p,x)}Mv(o,F,q);return;case"option":for(var xe in d)if(F=d[xe],d.hasOwnProperty(xe)&&F!=null&&!p.hasOwnProperty(xe))switch(xe){case"selected":o.selected=!1;break;default:ft(o,a,xe,null,p,F)}for(D in p)if(F=p[D],q=d[D],p.hasOwnProperty(D)&&F!==q&&(F!=null||q!=null))switch(D){case"selected":o.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:ft(o,a,D,F,p,q)}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 De in d)F=d[De],d.hasOwnProperty(De)&&F!=null&&!p.hasOwnProperty(De)&&ft(o,a,De,null,p,F);for($ in p)if(F=p[$],q=d[$],p.hasOwnProperty($)&&F!==q&&(F!=null||q!=null))switch($){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(r(137,a));break;default:ft(o,a,$,F,p,q)}return;default:if(Hm(a)){for(var ht in d)F=d[ht],d.hasOwnProperty(ht)&&F!==void 0&&!p.hasOwnProperty(ht)&&Ty(o,a,ht,void 0,p,F);for(G in p)F=p[G],q=d[G],!p.hasOwnProperty(G)||F===q||F===void 0&&q===void 0||Ty(o,a,G,F,p,q);return}}for(var U in d)F=d[U],d.hasOwnProperty(U)&&F!=null&&!p.hasOwnProperty(U)&&ft(o,a,U,null,p,F);for(Q in p)F=p[Q],q=d[Q],!p.hasOwnProperty(Q)||F===q||F==null&&q==null||ft(o,a,Q,F,p,q)}function Rk(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function lz(){if(typeof performance.getEntriesByType=="function"){for(var o=0,a=0,d=performance.getEntriesByType("resource"),p=0;p<d.length;p++){var y=d[p],x=y.transferSize,w=y.initiatorType,T=y.duration;if(x&&T&&Rk(w)){for(w=0,T=y.responseEnd,p+=1;p<d.length;p++){var D=d[p],$=D.startTime;if($>T)break;var G=D.transferSize,Q=D.initiatorType;G&&Rk(Q)&&(D=D.responseEnd,w+=G*(D<T?1:(T-$)/(D-$)))}if(--p,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 Tf(o){return o.nodeType===9?o:o.ownerDocument}function Nk(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 zk(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 az(){var o=window.event;return o&&o.type==="popstate"?o===_y?!1:(_y=o,!0):(_y=null,!1)}var Lk=typeof setTimeout=="function"?setTimeout:void 0,cz=typeof clearTimeout=="function"?clearTimeout:void 0,jk=typeof Promise=="function"?Promise:void 0,uz=typeof queueMicrotask=="function"?queueMicrotask:typeof jk<"u"?function(o){return jk.resolve(null).then(o).catch(dz)}:Lk;function dz(o){setTimeout(function(){throw o})}function Ds(o){return o==="head"}function Ik(o,a){var d=a,p=0;do{var y=d.nextSibling;if(o.removeChild(d),y&&y.nodeType===8)if(d=y.data,d==="/$"||d==="/&"){if(p===0){o.removeChild(y),ta(a);return}p--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")p++;else if(d==="html")Hc(o.ownerDocument.documentElement);else if(d==="head"){d=o.ownerDocument.head,Hc(d);for(var x=d.firstChild;x;){var w=x.nextSibling,T=x.nodeName;x[ic]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&x.rel.toLowerCase()==="stylesheet"||d.removeChild(x),x=w}}else d==="body"&&Hc(o.ownerDocument.body);d=y}while(d);ta(a)}function Bk(o,a){var d=o;o=0;do{var p=d.nextSibling;if(d.nodeType===1?a?(d._stashedDisplay=d.style.display,d.style.display="none"):(d.style.display=d._stashedDisplay||"",d.getAttribute("style")===""&&d.removeAttribute("style")):d.nodeType===3&&(a?(d._stashedText=d.nodeValue,d.nodeValue=""):d.nodeValue=d._stashedText||""),p&&p.nodeType===8)if(d=p.data,d==="/$"){if(o===0)break;o--}else d!=="$"&&d!=="$?"&&d!=="$~"&&d!=="$!"||o++;d=p}while(d)}function Dy(o){var a=o.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var d=a;switch(a=a.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":Dy(d),jm(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}o.removeChild(d)}}function fz(o,a,d,p){for(;o.nodeType===1;){var y=d;if(o.nodeName.toLowerCase()!==a.toLowerCase()){if(!p&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(p){if(!o[ic])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=Or(o.nextSibling),o===null)break}return null}function hz(o,a,d){if(a==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!d||(o=Or(o.nextSibling),o===null))return null;return o}function Uk(o,a){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!a||(o=Or(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 pz(o,a){var d=o.ownerDocument;if(o.data==="$~")o._reactRetry=a;else if(o.data!=="$?"||d.readyState!=="loading")a();else{var p=function(){a(),d.removeEventListener("DOMContentLoaded",p)};d.addEventListener("DOMContentLoaded",p),o._reactRetry=p}}function Or(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 Hk(o){o=o.nextSibling;for(var a=0;o;){if(o.nodeType===8){var d=o.data;if(d==="/$"||d==="/&"){if(a===0)return Or(o.nextSibling);a--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||a++}o=o.nextSibling}return null}function Vk(o){o=o.previousSibling;for(var a=0;o;){if(o.nodeType===8){var d=o.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(a===0)return o;a--}else d!=="/$"&&d!=="/&"||a++}o=o.previousSibling}return null}function Pk(o,a,d){switch(a=Tf(d),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 Hc(o){for(var a=o.attributes;a.length;)o.removeAttributeNode(a[0]);jm(o)}var _r=new Map,$k=new Set;function Af(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var Wi=K.d;K.d={f:mz,r:gz,D:yz,C:bz,L:xz,m:vz,X:wz,S:Sz,M:kz};function mz(){var o=Wi.f(),a=bf();return o||a}function gz(o){var a=vl(o);a!==null&&a.tag===5&&a.type==="form"?ow(a):Wi.r(o)}var Xl=typeof document>"u"?null:document;function Fk(o,a,d){var p=Xl;if(p&&typeof a=="string"&&a){var y=wr(a);y='link[rel="'+o+'"][href="'+y+'"]',typeof d=="string"&&(y+='[crossorigin="'+d+'"]'),$k.has(y)||($k.add(y),o={rel:o,crossOrigin:d,href:a},p.querySelector(y)===null&&(a=p.createElement("link"),vn(a,"link",o),en(a),p.head.appendChild(a)))}}function yz(o){Wi.D(o),Fk("dns-prefetch",o,null)}function bz(o,a){Wi.C(o,a),Fk("preconnect",o,a)}function xz(o,a,d){Wi.L(o,a,d);var p=Xl;if(p&&o&&a){var y='link[rel="preload"][as="'+wr(a)+'"]';a==="image"&&d&&d.imageSrcSet?(y+='[imagesrcset="'+wr(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(y+='[imagesizes="'+wr(d.imageSizes)+'"]')):y+='[href="'+wr(o)+'"]';var x=y;switch(a){case"style":x=Ql(o);break;case"script":x=ea(o)}_r.has(x)||(o=m({rel:"preload",href:a==="image"&&d&&d.imageSrcSet?void 0:o,as:a},d),_r.set(x,o),p.querySelector(y)!==null||a==="style"&&p.querySelector(Vc(x))||a==="script"&&p.querySelector(Pc(x))||(a=p.createElement("link"),vn(a,"link",o),en(a),p.head.appendChild(a)))}}function vz(o,a){Wi.m(o,a);var d=Xl;if(d&&o){var p=a&&typeof a.as=="string"?a.as:"script",y='link[rel="modulepreload"][as="'+wr(p)+'"][href="'+wr(o)+'"]',x=y;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=ea(o)}if(!_r.has(x)&&(o=m({rel:"modulepreload",href:o},a),_r.set(x,o),d.querySelector(y)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(Pc(x)))return}p=d.createElement("link"),vn(p,"link",o),en(p),d.head.appendChild(p)}}}function Sz(o,a,d){Wi.S(o,a,d);var p=Xl;if(p&&o){var y=Sl(p).hoistableStyles,x=Ql(o);a=a||"default";var w=y.get(x);if(!w){var T={loading:0,preload:null};if(w=p.querySelector(Vc(x)))T.loading=5;else{o=m({rel:"stylesheet",href:o,"data-precedence":a},d),(d=_r.get(x))&&Ly(o,d);var D=w=p.createElement("link");en(D),vn(D,"link",o),D._p=new Promise(function($,G){D.onload=$,D.onerror=G}),D.addEventListener("load",function(){T.loading|=1}),D.addEventListener("error",function(){T.loading|=2}),T.loading|=4,Mf(w,a,p)}w={type:"stylesheet",instance:w,count:1,state:T},y.set(x,w)}}}function wz(o,a){Wi.X(o,a);var d=Xl;if(d&&o){var p=Sl(d).hoistableScripts,y=ea(o),x=p.get(y);x||(x=d.querySelector(Pc(y)),x||(o=m({src:o,async:!0},a),(a=_r.get(y))&&jy(o,a),x=d.createElement("script"),en(x),vn(x,"link",o),d.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},p.set(y,x))}}function kz(o,a){Wi.M(o,a);var d=Xl;if(d&&o){var p=Sl(d).hoistableScripts,y=ea(o),x=p.get(y);x||(x=d.querySelector(Pc(y)),x||(o=m({src:o,async:!0,type:"module"},a),(a=_r.get(y))&&jy(o,a),x=d.createElement("script"),en(x),vn(x,"link",o),d.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},p.set(y,x))}}function qk(o,a,d,p){var y=(y=se.current)?Af(y):null;if(!y)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(a=Ql(d.href),d=Sl(y).hoistableStyles,p=d.get(a),p||(p={type:"style",instance:null,count:0,state:null},d.set(a,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){o=Ql(d.href);var x=Sl(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(Vc(o)))&&!x._p&&(w.instance=x,w.state.loading=5),_r.has(o)||(d={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},_r.set(o,d),x||Cz(y,o,d,w.state))),a&&p===null)throw Error(r(528,""));return w}if(a&&p!==null)throw Error(r(529,""));return null;case"script":return a=d.async,d=d.src,typeof d=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=ea(d),d=Sl(y).hoistableScripts,p=d.get(a),p||(p={type:"script",instance:null,count:0,state:null},d.set(a,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function Ql(o){return'href="'+wr(o)+'"'}function Vc(o){return'link[rel="stylesheet"]['+o+"]"}function Kk(o){return m({},o,{"data-precedence":o.precedence,precedence:null})}function Cz(o,a,d,p){o.querySelector('link[rel="preload"][as="style"]['+a+"]")?p.loading=1:(a=o.createElement("link"),p.preload=a,a.addEventListener("load",function(){return p.loading|=1}),a.addEventListener("error",function(){return p.loading|=2}),vn(a,"link",d),en(a),o.head.appendChild(a))}function ea(o){return'[src="'+wr(o)+'"]'}function Pc(o){return"script[async]"+o}function Yk(o,a,d){if(a.count++,a.instance===null)switch(a.type){case"style":var p=o.querySelector('style[data-href~="'+wr(d.href)+'"]');if(p)return a.instance=p,en(p),p;var y=m({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return p=(o.ownerDocument||o).createElement("style"),en(p),vn(p,"style",y),Mf(p,d.precedence,o),a.instance=p;case"stylesheet":y=Ql(d.href);var x=o.querySelector(Vc(y));if(x)return a.state.loading|=4,a.instance=x,en(x),x;p=Kk(d),(y=_r.get(y))&&Ly(p,y),x=(o.ownerDocument||o).createElement("link"),en(x);var w=x;return w._p=new Promise(function(T,D){w.onload=T,w.onerror=D}),vn(x,"link",p),a.state.loading|=4,Mf(x,d.precedence,o),a.instance=x;case"script":return x=ea(d.src),(y=o.querySelector(Pc(x)))?(a.instance=y,en(y),y):(p=d,(y=_r.get(x))&&(p=m({},d),jy(p,y)),o=o.ownerDocument||o,y=o.createElement("script"),en(y),vn(y,"link",p),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&&(p=a.instance,a.state.loading|=4,Mf(p,d.precedence,o));return a.instance}function Mf(o,a,d){for(var p=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=p.length?p[p.length-1]:null,x=y,w=0;w<p.length;w++){var T=p[w];if(T.dataset.precedence===a)x=T;else if(x!==y)break}x?x.parentNode.insertBefore(o,x.nextSibling):(a=d.nodeType===9?d.head:d,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 Of=null;function Wk(o,a,d){if(Of===null){var p=new Map,y=Of=new Map;y.set(d,p)}else y=Of,p=y.get(d),p||(p=new Map,y.set(d,p));if(p.has(o))return p;for(p.set(o,null),d=d.getElementsByTagName(o),y=0;y<d.length;y++){var x=d[y];if(!(x[ic]||x[gn]||o==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(a)||"";w=o+w;var T=p.get(w);T?T.push(x):p.set(w,[x])}}return p}function Gk(o,a,d){o=o.ownerDocument||o,o.head.insertBefore(d,a==="title"?o.querySelector("head > title"):null)}function Ez(o,a,d){if(d===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 Zk(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function Tz(o,a,d,p){if(d.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(d.state.loading&4)===0){if(d.instance===null){var y=Ql(p.href),x=a.querySelector(Vc(y));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(o.count++,o=_f.bind(o),a.then(o,o)),d.state.loading|=4,d.instance=x,en(x);return}x=a.ownerDocument||a,p=Kk(p),(y=_r.get(y))&&Ly(p,y),x=x.createElement("link"),en(x);var w=x;w._p=new Promise(function(T,D){w.onload=T,w.onerror=D}),vn(x,"link",p),d.instance=x}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(d,a),(a=d.state.preload)&&(d.state.loading&3)===0&&(o.count++,d=_f.bind(o),a.addEventListener("load",d),a.addEventListener("error",d))}}var Iy=0;function Az(o,a){return o.stylesheets&&o.count===0&&Rf(o,o.stylesheets),0<o.count||0<o.imgCount?function(d){var p=setTimeout(function(){if(o.stylesheets&&Rf(o,o.stylesheets),o.unsuspend){var x=o.unsuspend;o.unsuspend=null,x()}},6e4+a);0<o.imgBytes&&Iy===0&&(Iy=62500*lz());var y=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Rf(o,o.stylesheets),o.unsuspend)){var x=o.unsuspend;o.unsuspend=null,x()}},(o.imgBytes>Iy?50:800)+a);return o.unsuspend=d,function(){o.unsuspend=null,clearTimeout(p),clearTimeout(y)}}:null}function _f(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Rf(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Df=null;function Rf(o,a){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Df=new Map,a.forEach(Mz,o),Df=null,_f.call(o))}function Mz(o,a){if(!(a.state.loading&4)){var d=Df.get(o);if(d)var p=d.get(null);else{d=new Map,Df.set(o,d);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")&&(d.set(w.dataset.precedence,w),p=w)}p&&d.set(null,p)}y=a.instance,w=y.getAttribute("data-precedence"),x=d.get(w)||p,x===p&&d.set(null,y),d.set(w,y),this.count++,p=_f.bind(this),y.addEventListener("load",p),y.addEventListener("error",p),x?x.parentNode.insertBefore(y,x.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(y,o.firstChild)),a.state.loading|=4}}var $c={$$typeof:j,Provider:null,Consumer:null,_currentValue:he,_currentValue2:he,_threadCount:0};function Oz(o,a,d,p,y,x,w,T,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=Rm(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rm(0),this.hiddenUpdates=Rm(null),this.identifierPrefix=p,this.onUncaughtError=y,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=D,this.incompleteTransitions=new Map}function Jk(o,a,d,p,y,x,w,T,D,$,G,Q){return o=new Oz(o,a,d,w,D,$,G,Q,T),a=1,x===!0&&(a|=24),x=or(3,null,null,a),o.current=x,x.stateNode=o,a=gg(),a.refCount++,o.pooledCache=a,a.refCount++,x.memoizedState={element:p,isDehydrated:d,cache:a},vg(x),o}function Xk(o){return o?(o=Dl,o):Dl}function Qk(o,a,d,p,y,x){y=Xk(y),p.context===null?p.context=y:p.pendingContext=y,p=vs(a),p.payload={element:d},x=x===void 0?null:x,x!==null&&(p.callback=x),d=Ss(o,p,a),d!==null&&(Jn(d,o,a),Sc(d,o,a))}function eC(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d<a?d:a}}function By(o,a){eC(o,a),(o=o.alternate)&&eC(o,a)}function tC(o){if(o.tag===13||o.tag===31){var a=wo(o,67108864);a!==null&&Jn(a,o,67108864),By(o,67108864)}}function nC(o){if(o.tag===13||o.tag===31){var a=dr();a=Nm(a);var d=wo(o,a);d!==null&&Jn(d,o,a),By(o,a)}}var Nf=!0;function _z(o,a,d,p){var y=N.T;N.T=null;var x=K.p;try{K.p=2,Uy(o,a,d,p)}finally{K.p=x,N.T=y}}function Dz(o,a,d,p){var y=N.T;N.T=null;var x=K.p;try{K.p=8,Uy(o,a,d,p)}finally{K.p=x,N.T=y}}function Uy(o,a,d,p){if(Nf){var y=Hy(p);if(y===null)Ey(o,a,p,zf,d),iC(o,p);else if(Nz(y,o,a,d,p))p.stopPropagation();else if(iC(o,p),a&4&&-1<Rz.indexOf(o)){for(;y!==null;){var x=vl(y);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=yo(x.pendingLanes);if(w!==0){var T=x;for(T.pendingLanes|=2,T.entangledLanes|=2;w;){var D=1<<31-ot(w);T.entanglements[1]|=D,w&=~D}ci(x),(lt&6)===0&&(gf=Xt()+500,Ic(0))}}break;case 31:case 13:T=wo(x,2),T!==null&&Jn(T,x,2),bf(),By(x,2)}if(x=Hy(p),x===null&&Ey(o,a,p,zf,d),x===y)break;y=x}y!==null&&p.stopPropagation()}else Ey(o,a,p,null,d)}}function Hy(o){return o=Pm(o),Vy(o)}var zf=null;function Vy(o){if(zf=null,o=xl(o),o!==null){var a=s(o);if(a===null)o=null;else{var d=a.tag;if(d===13){if(o=l(a),o!==null)return o;o=null}else if(d===31){if(o=c(a),o!==null)return o;o=null}else if(d===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;o=null}else a!==o&&(o=null)}}return zf=o,null}function rC(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(go()){case J:return 2;case de:return 8;case Re:case pe:return 32;case tt:return 268435456;default:return 32}default:return 32}}var Py=!1,Rs=null,Ns=null,zs=null,Fc=new Map,qc=new Map,Ls=[],Rz="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 iC(o,a){switch(o){case"focusin":case"focusout":Rs=null;break;case"dragenter":case"dragleave":Ns=null;break;case"mouseover":case"mouseout":zs=null;break;case"pointerover":case"pointerout":Fc.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":qc.delete(a.pointerId)}}function Kc(o,a,d,p,y,x){return o===null||o.nativeEvent!==x?(o={blockedOn:a,domEventName:d,eventSystemFlags:p,nativeEvent:x,targetContainers:[y]},a!==null&&(a=vl(a),a!==null&&tC(a)),o):(o.eventSystemFlags|=p,a=o.targetContainers,y!==null&&a.indexOf(y)===-1&&a.push(y),o)}function Nz(o,a,d,p,y){switch(a){case"focusin":return Rs=Kc(Rs,o,a,d,p,y),!0;case"dragenter":return Ns=Kc(Ns,o,a,d,p,y),!0;case"mouseover":return zs=Kc(zs,o,a,d,p,y),!0;case"pointerover":var x=y.pointerId;return Fc.set(x,Kc(Fc.get(x)||null,o,a,d,p,y)),!0;case"gotpointercapture":return x=y.pointerId,qc.set(x,Kc(qc.get(x)||null,o,a,d,p,y)),!0}return!1}function sC(o){var a=xl(o.target);if(a!==null){var d=s(a);if(d!==null){if(a=d.tag,a===13){if(a=l(d),a!==null){o.blockedOn=a,xv(o.priority,function(){nC(d)});return}}else if(a===31){if(a=c(d),a!==null){o.blockedOn=a,xv(o.priority,function(){nC(d)});return}}else if(a===3&&d.stateNode.current.memoizedState.isDehydrated){o.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}o.blockedOn=null}function Lf(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var d=Hy(o.nativeEvent);if(d===null){d=o.nativeEvent;var p=new d.constructor(d.type,d);Vm=p,d.target.dispatchEvent(p),Vm=null}else return a=vl(d),a!==null&&tC(a),o.blockedOn=d,!1;a.shift()}return!0}function oC(o,a,d){Lf(o)&&d.delete(a)}function zz(){Py=!1,Rs!==null&&Lf(Rs)&&(Rs=null),Ns!==null&&Lf(Ns)&&(Ns=null),zs!==null&&Lf(zs)&&(zs=null),Fc.forEach(oC),qc.forEach(oC)}function jf(o,a){o.blockedOn===a&&(o.blockedOn=null,Py||(Py=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,zz)))}var If=null;function lC(o){If!==o&&(If=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){If===o&&(If=null);for(var a=0;a<o.length;a+=3){var d=o[a],p=o[a+1],y=o[a+2];if(typeof p!="function"){if(Vy(p||d)===null)continue;break}var x=vl(d);x!==null&&(o.splice(a,3),a-=3,Hg(x,{pending:!0,data:y,method:d.method,action:p},p,y))}}))}function ta(o){function a(D){return jf(D,o)}Rs!==null&&jf(Rs,o),Ns!==null&&jf(Ns,o),zs!==null&&jf(zs,o),Fc.forEach(a),qc.forEach(a);for(var d=0;d<Ls.length;d++){var p=Ls[d];p.blockedOn===o&&(p.blockedOn=null)}for(;0<Ls.length&&(d=Ls[0],d.blockedOn===null);)sC(d),d.blockedOn===null&&Ls.shift();if(d=(o.ownerDocument||o).$$reactFormReplay,d!=null)for(p=0;p<d.length;p+=3){var y=d[p],x=d[p+1],w=y[qn]||null;if(typeof x=="function")w||lC(d);else if(w){var T=null;if(x&&x.hasAttribute("formAction")){if(y=x,w=x[qn]||null)T=w.formAction;else if(Vy(y)!==null)continue}else T=w.action;typeof T=="function"?d[p+1]=T:(d.splice(p,3),p-=3),lC(d)}}}function aC(){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),p||setTimeout(d,20)}function d(){if(!p&&!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 p=!1,y=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(d,100),function(){p=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),y!==null&&(y(),y=null)}}}function $y(o){this._internalRoot=o}Bf.prototype.render=$y.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(r(409));var d=a.current,p=dr();Qk(d,p,o,a,null,null)},Bf.prototype.unmount=$y.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;Qk(o.current,2,null,o,null,null),bf(),a[bl]=null}};function Bf(o){this._internalRoot=o}Bf.prototype.unstable_scheduleHydration=function(o){if(o){var a=bv();o={blockedOn:null,target:o,priority:a};for(var d=0;d<Ls.length&&a!==0&&a<Ls[d].priority;d++);Ls.splice(d,0,o),d===0&&sC(o)}};var cC=e.version;if(cC!=="19.2.4")throw Error(r(527,cC,"19.2.4"));K.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=f(a),o=o!==null?h(o):null,o=o===null?null:o.stateNode,o};var Lz={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:N,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Uf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Uf.isDisabled&&Uf.supportsFiber)try{mn=Uf.inject(Lz),It=Uf}catch{}}return Wc.createRoot=function(o,a){if(!i(o))throw Error(r(299));var d=!1,p="",y=gw,x=yw,w=bw;return a!=null&&(a.unstable_strictMode===!0&&(d=!0),a.identifierPrefix!==void 0&&(p=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError)),a=Jk(o,1,!1,null,null,d,p,null,y,x,w,aC),o[bl]=a.current,Cy(o),new $y(a)},Wc.hydrateRoot=function(o,a,d){if(!i(o))throw Error(r(299));var p=!1,y="",x=gw,w=yw,T=bw,D=null;return d!=null&&(d.unstable_strictMode===!0&&(p=!0),d.identifierPrefix!==void 0&&(y=d.identifierPrefix),d.onUncaughtError!==void 0&&(x=d.onUncaughtError),d.onCaughtError!==void 0&&(w=d.onCaughtError),d.onRecoverableError!==void 0&&(T=d.onRecoverableError),d.formState!==void 0&&(D=d.formState)),a=Jk(o,1,!0,a,d??null,p,y,D,x,w,T,aC),a.context=Xk(null),d=a.current,p=dr(),p=Nm(p),y=vs(p),y.callback=null,Ss(d,y,p),d=p,a.current.lanes=d,rc(a,d),ci(a),o[bl]=a.current,Cy(o),new Bf(a)},Wc.version="19.2.4",Wc}var xC;function Kz(){if(xC)return Ky.exports;xC=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(),Ky.exports=qz(),Ky.exports}var Yz=Kz();const Wz="upload://";function Gz(t){return t.startsWith(Wz)}const ph=t=>t,br=t=>t;function Zz({onDismiss:t}){return S.jsxs("div",{style:{padding:"8px 16px",background:"var(--tandem-error-bg)",borderBottom:"1px solid var(--tandem-error-border)",fontSize:"13px",color:"var(--tandem-error-fg-strong)",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",gap:"12px"},children:[S.jsx("span",{children:"Connection to the Tandem server has been lost. Ensure the server is running."}),S.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--tandem-error-fg-strong)",fontSize:"16px",lineHeight:1,padding:"0 4px"},"aria-label":"Dismiss connection banner",children:"×"})]})}const vC=3478,ud=3479,Jz=3e3,Xz=3e3,Qz=3e4,Ou={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)"},SC="tandem",Vf="tandem:mode",hM="tandem:settings",eL="tandem-panel-width",tL="tandem-left-panel-width",pM={left:tL,right:eL},mM=1e3,Nh=500,zh=3e3,nL="__tandem_ctrl__",Aa="annotations",gM="awareness",lb="userAwareness",rL="mode",iL="selectionDwellMs",wC="chat",mh="documentMeta",sL="annotationReplies",kC="savedAtVersion",CC="authorship",yM="tandem:showAuthorship",_x="tandem:recentFiles",oL=20,Dx="tandem:userName",bM="You",ab="tandem:user-name-changed",xM=40,EC={error:8e3,warning:6e3,info:4e3},lL=5,vM="tandem:tutorialCompleted",aL="tutorial-",SM="tandem:coworkOnboardingSkipped",cL=3e4,MW=2e3,TC="tandem:zoomLevel",AC=.5,MC=2,Gc=1;function OW(t){return t?t.osSupported?t.coworkDetected?"normal":"undetected":"unsupported":"loading"}function uL(t){switch(t.kind){case"adminDeclined":return"Admin permission was denied. Retry with admin, or disable Cowork integration.";case"netshNotFound":return"Windows Firewall command (netsh) was not found on PATH. Confirm your Windows install is intact.";case"netshFailure":return`Windows Firewall command failed (exit ${t.exitCode}). Details: ${dL(t.stderrTail)}`;case"subnetDetectionFailed":return"Could not detect the Hyper-V / Cowork VM subnet. Is Claude Desktop Cowork actually set up on this machine?";case"adapterEnumerationFailed":return"Could not enumerate Hyper-V network adapters. Run Tandem as administrator or reboot to refresh the adapter list.";default:return`Unexpected firewall error (${t.kind}). Please restart Tandem.`}}function dL(t){const e=t.trim();return e.length===0?"(no output)":e.length<=200?e:`${e.slice(0,197)}...`}function wM(t){try{const e=JSON.parse(t);if(typeof e=="object"&&e!==null&&"kind"in e&&typeof e.kind=="string")try{return uL(e)}catch(n){return console.error("[cowork] firewallErrorHint failed for:",e,n),t}return t}catch{return t}}function _W(t){switch(t){case"ok":return"Installed";case"alreadyPresent":return"Already installed";case"locked":return"Locked (retrying)";case"schemaDrift":return"Schema drift";case"insecureAcl":return"Insecure ACL";case"failed":return"Failed"}}function DW(t){switch(t){case"ok":case"alreadyPresent":return"success";case"locked":return"warning";case"schemaDrift":case"insecureAcl":case"failed":return"error"}}function RW(t){const e=["failed","schemaDrift","insecureAcl","locked","alreadyPresent","ok"],n=[t.installedPlugins,t.knownMarketplaces,t.coworkSettings];for(const r of e)if(n.includes(r))return r;return"ok"}function kM(t,e){return!(!t||e||!t.osSupported||!t.coworkDetected||t.enabled)}function CM(){try{return localStorage.getItem(SM)==="true"}catch{return!1}}function fL(){try{localStorage.setItem(SM,"true")}catch{}}function dd(){try{return typeof window<"u"&&"__TAURI_INTERNALS__"in window}catch{return!1}}function NW(t){let e=null;return{schedule(n){e!==null&&clearTimeout(e),e=setTimeout(()=>{e=null,n()},t)},cancel(){e!==null&&(clearTimeout(e),e=null)}}}const hL="modulepreload",pL=function(t){return"/"+t},OC={},Rx=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let l=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),u=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));i=l(n.map(f=>{if(f=pL(f),f in OC)return;OC[f]=!0;const h=f.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const g=document.createElement("link");if(g.rel=h?"stylesheet":hL,h||(g.as="script"),g.crossOrigin="",g.href=f,u&&g.setAttribute("nonce",u),document.head.appendChild(g),h)return new Promise((b,v)=>{g.addEventListener("load",b),g.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${f}`)))})}))}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)})},EM="Tauri runtime not available";async function Nx(){try{return(await Rx(()=>import("./core-DhEqZVGG.js"),[])).invoke}catch(t){return dd()&&console.error("[cowork] Failed to load @tauri-apps/api/core:",t),(()=>Promise.reject(new Error(EM)))}}function mL(t){return t("cowork_get_status")}function TM(t,e){return t("cowork_toggle_integration",{enabled:e})}function zW(t){return t("cowork_rescan")}function LW(t,e){return t("cowork_set_lan_ip_override",{enabled:e})}function gL(t){return t("cowork_retry_admin_elevation")}function AM(t){const[e,n]=M.useState(null),[r,i]=M.useState(t),[s,l]=M.useState(null),c=M.useRef(null),u=M.useRef(!1),f=M.useRef(!0),h=M.useRef(null),m=M.useCallback(async()=>{if(u.current){f.current&&i(!1);return}const g=c.current;if(g)try{const b=await mL(g);if(!f.current)return;n(b),l(null)}catch(b){if(!f.current)return;const v=b instanceof Error?b.message:String(b);if(v===EM){u.current=!0,h.current!==null&&(clearInterval(h.current),h.current=null),i(!1);return}l(v)}finally{f.current&&i(!1)}},[]);return M.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),M.useEffect(()=>{if(!t){i(!1);return}let g=!1;return Nx().then(b=>{if(!g)return c.current=b,i(!0),m()}).catch(b=>{if(g)return;const v=b instanceof Error?b.message:String(b);l(v),i(!1)}),h.current=setInterval(()=>{g||u.current||m()},cL),()=>{g=!0,h.current!==null&&(clearInterval(h.current),h.current=null)}},[t,m]),{status:e,loading:r,error:s,refetch:m}}const yL='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function bL(){const{status:t,error:e,refetch:n}=AM(!0),r=(t==null?void 0:t.uacDeclined)===!0,i=M.useRef(null),s=M.useRef(!0),[l,c]=M.useState(!1),[u,f]=M.useState(!1),[h,m]=M.useState(null);M.useEffect(()=>(s.current=!0,()=>{s.current=!1}),[]),M.useEffect(()=>{if(!r)return;const k=typeof document<"u"?document.title:null;return typeof document<"u"&&!document.title.startsWith("⚠")&&(document.title=`⚠ ${document.title}`),()=>{typeof document<"u"&&k!==null&&(document.title=k)}},[r]),M.useEffect(()=>{if(!r)return;const k=C=>{if(C.key!=="Tab"||!i.current)return;const E=i.current.querySelectorAll(yL);if(E.length===0)return;const L=E[0],j=E[E.length-1],Y=document.activeElement;if(!i.current.contains(Y)){C.preventDefault(),L.focus();return}C.shiftKey&&Y===L?(C.preventDefault(),j.focus()):!C.shiftKey&&Y===j&&(C.preventDefault(),L.focus())};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[r]),M.useEffect(()=>{var k;r&&((k=i.current)==null||k.focus())},[r]);const g=M.useCallback(async(k,C)=>{f(!0),m(null);try{const E=await Nx();await k(E)}catch(E){const L=E instanceof Error?E.message:String(E),j=wM(L);s.current&&m(`${C}: ${j}`)}finally{s.current&&f(!1)}},[]),b=M.useCallback(async()=>{await g(async k=>{await gL(k),await n()},"Retry failed")},[g,n]),v=M.useCallback(async()=>{await g(async k=>{await TM(k,!1),await n()},"Failed to disable Cowork"),c(!1)},[g,n]);return e&&!t?S.jsx("div",{"data-testid":"cowork-admin-declined-status-error",role:"alert",style:{position:"fixed",bottom:16,right:16,zIndex:1e4,maxWidth:400,border:"1px solid var(--tandem-error-border)",background:"var(--tandem-error-bg)",color:"var(--tandem-error-fg-strong)",borderRadius:6,padding:"10px 14px",fontSize:12,lineHeight:1.5},children:"Cowork status check failed: unable to determine if admin elevation was declined. Please restart Tandem to restore normal operation."}):r?S.jsx("div",{"data-testid":"cowork-admin-declined-backdrop",style:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.45)",zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center"},children:S.jsxs("div",{ref:i,"data-testid":"cowork-admin-declined-modal",role:"dialog","aria-modal":"true","aria-labelledby":"cowork-admin-declined-heading",tabIndex:-1,style:{width:440,maxWidth:"calc(100vw - 32px)",background:"var(--tandem-surface)",color:"var(--tandem-fg)",border:"1px solid var(--tandem-error-border)",borderRadius:8,padding:20,boxShadow:"0 8px 32px rgba(0,0,0,0.24)",outline:"none",display:"flex",flexDirection:"column",gap:12},children:[S.jsx("h2",{id:"cowork-admin-declined-heading",style:{margin:0,fontSize:16,fontWeight:600,color:"var(--tandem-error-fg-strong)"},children:"Admin permission required"}),S.jsx("div",{style:{fontSize:13,lineHeight:1.5,color:"var(--tandem-fg-muted)"},children:"Cowork integration requires Windows admin permission to configure firewall rules. Without it, Tandem can't safely be reached from inside the Cowork VM. Port 3479 is currently blocked by a deny rule to protect your machine."}),h&&S.jsx("div",{"data-testid":"cowork-admin-declined-error",role:"alert",style:{fontSize:12,color:"var(--tandem-error-fg-strong)",background:"var(--tandem-error-bg)",border:"1px solid var(--tandem-error-border)",borderRadius:4,padding:"6px 8px"},children:h}),l?S.jsxs("div",{"data-testid":"cowork-admin-declined-confirm-disable",style:{fontSize:12,color:"var(--tandem-warning-fg-strong)",background:"var(--tandem-warning-bg)",border:"1px solid var(--tandem-warning-border)",borderRadius:4,padding:"8px 10px"},children:[S.jsx("div",{style:{fontWeight:600,marginBottom:6},children:"Disable Cowork integration?"}),S.jsx("div",{style:{marginBottom:8},children:"The deny rule will remain in place. You can re-enable Cowork later from Settings."}),S.jsxs("div",{style:{display:"flex",gap:8},children:[S.jsx("button",{"data-testid":"cowork-admin-declined-disable-confirm-btn",type:"button",onClick:()=>void v(),disabled:u,style:{padding:"4px 10px",fontSize:12,border:"1px solid var(--tandem-error-border)",borderRadius:4,background:"var(--tandem-error)",color:"var(--tandem-error-fg)",cursor:"pointer",fontWeight:600},children:"Disable"}),S.jsx("button",{"data-testid":"cowork-admin-declined-disable-cancel-btn",type:"button",onClick:()=>c(!1),disabled:u,style:{padding:"4px 10px",fontSize:12,border:"1px solid var(--tandem-border-strong)",borderRadius:4,background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)",cursor:"pointer"},children:"Cancel"})]})]}):S.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[S.jsx("button",{"data-testid":"cowork-admin-declined-disable-btn",type:"button",onClick:()=>c(!0),disabled:u,style:{padding:"6px 12px",fontSize:13,border:"1px solid var(--tandem-border-strong)",borderRadius:4,background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)",cursor:"pointer"},children:"Disable Cowork"}),S.jsx("button",{"data-testid":"cowork-admin-declined-retry-btn",type:"button",onClick:()=>void b(),disabled:u,style:{padding:"6px 12px",fontSize:13,border:"1px solid var(--tandem-accent)",borderRadius:4,background:"var(--tandem-accent)",color:"var(--tandem-accent-fg)",cursor:"pointer",fontWeight:600},children:"Retry with admin"})]})]})}):null}function _C({connected:t,claudeActive:e}){const[n,r]=M.useState(!1);return M.useEffect(()=>{if(t){r(!1);return}const i=setTimeout(()=>r(!0),Xz);return()=>clearTimeout(i)},[t]),S.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--tandem-fg-subtle)",gap:"8px"},children:n?S.jsx("span",{children:"Cannot reach the Tandem server. Is it running?"}):S.jsxs(S.Fragment,{children:[S.jsx("span",{children:"No document open. Click + in the tab bar or drop a file here."}),t&&!e&&S.jsx("span",{style:{fontSize:"0.85em",color:"var(--tandem-fg-subtle)"},children:"Tip: open Claude Code in this directory to start collaborating"})]})})}const xL=[{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 vL({open:t,onClose:e}){return M.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e]),t?S.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:S.jsxs("div",{style:{backgroundColor:"var(--tandem-surface)",border:"1px solid var(--tandem-border)",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:[S.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"16px"},children:[S.jsx("h2",{style:{margin:0,fontSize:"16px",fontWeight:600,color:"var(--tandem-fg)"},children:"Keyboard Shortcuts"}),S.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:"var(--tandem-fg-muted)",lineHeight:1,padding:"2px 6px",borderRadius:"4px"},children:"✕"})]}),xL.map(n=>S.jsxs("div",{style:{marginBottom:"18px"},children:[S.jsx("div",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--tandem-fg-subtle)",marginBottom:"6px"},children:n.title}),S.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:S.jsx("tbody",{children:n.rows.map(r=>S.jsxs("tr",{children:[S.jsx("td",{style:{paddingBottom:"5px",paddingRight:"16px",whiteSpace:"nowrap",verticalAlign:"middle",width:"1%"},children:S.jsx("span",{style:{display:"flex",gap:"4px",alignItems:"center"},children:r.keys.map((i,s)=>S.jsxs("span",{children:[S.jsx("kbd",{style:{display:"inline-block",padding:"1px 6px",fontSize:"12px",fontFamily:"ui-monospace, SFMono-Regular, monospace",background:"var(--tandem-surface-muted)",border:"1px solid var(--tandem-border-strong)",borderBottom:"2px solid var(--tandem-border-strong)",borderRadius:"4px",color:"var(--tandem-fg)",lineHeight:"1.5"},children:i}),s<r.keys.length-1&&S.jsx("span",{style:{color:"var(--tandem-fg-subtle)",fontSize:"11px",margin:"0 2px"},children:"+"})]},i))})}),S.jsx("td",{style:{paddingBottom:"5px",fontSize:"13px",color:"var(--tandem-fg-muted)",verticalAlign:"middle"},children:r.description})]},r.description))})})]},n.title)),S.jsxs("div",{style:{marginTop:"12px",paddingTop:"10px",borderTop:"1px solid var(--tandem-border)",fontSize:"11px",color:"var(--tandem-fg-subtle)",textAlign:"center"},children:["Press"," ",S.jsx("kbd",{style:{fontSize:"11px",padding:"1px 4px",background:"var(--tandem-surface-muted)",border:"1px solid var(--tandem-border)",borderRadius:"3px",color:"var(--tandem-fg-subtle)"},children:"?"})," ","or"," ",S.jsx("kbd",{style:{fontSize:"11px",padding:"1px 4px",background:"var(--tandem-surface-muted)",border:"1px solid var(--tandem-border)",borderRadius:"3px",color:"var(--tandem-fg-subtle)"},children:"Esc"})," ","to close"]})]})}):null}function SL({status:t,onAdvance:e,onLearnMore:n}){const[r,i]=M.useState(!1),[s,l]=M.useState(!1),[c,u]=M.useState(null),f=M.useRef(!0);M.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]);const h=M.useCallback(async(b,v)=>{l(!0),u(null);try{const k=await Nx();return await b(k),!0}catch(k){const C=k instanceof Error?k.message:String(k),E=wM(C);return f.current&&u(`${v}: ${E}`),!1}finally{f.current&&l(!1)}},[]),m=M.useCallback(async()=>{await h(async v=>{await TM(v,!0)},"Failed to enable Cowork")&&e()},[h,e]),g=M.useCallback(()=>{fL(),e()},[e]);return S.jsxs("div",{"data-testid":"cowork-onboarding-step",style:{display:"flex",flexDirection:"column",gap:8},children:[S.jsx("div",{style:{fontSize:14,fontWeight:600,color:"var(--tandem-fg)"},children:"Claude Desktop Cowork detected"}),S.jsxs("div",{style:{fontSize:13,lineHeight:1.5,color:"var(--tandem-fg-muted)"},children:["Enable Tandem inside Cowork workspaces?",t.vethernetCidr!==null&&S.jsxs(S.Fragment,{children:[" ","Detected VM subnet: ",S.jsx("code",{children:t.vethernetCidr}),"."]})]}),c&&S.jsx("div",{"data-testid":"cowork-onboarding-error",role:"alert",style:{fontSize:12,color:"var(--tandem-error-fg-strong)",background:"var(--tandem-error-bg)",border:"1px solid var(--tandem-error-border)",borderRadius:4,padding:"6px 8px"},children:c}),r?S.jsxs("div",{"data-testid":"cowork-onboarding-confirm",style:{fontSize:12,color:"var(--tandem-warning-fg-strong)",background:"var(--tandem-warning-bg)",border:"1px solid var(--tandem-warning-border)",borderRadius:4,padding:"8px 10px"},children:[S.jsx("div",{style:{fontWeight:600,marginBottom:6},children:"Confirm: Enable Cowork"}),S.jsx("div",{style:{marginBottom:8},children:"Windows will prompt for admin permission to modify firewall rules. This is expected."}),S.jsxs("div",{style:{display:"flex",gap:8},children:[S.jsx("button",{"data-testid":"cowork-onboarding-enable-confirm-btn",type:"button",onClick:()=>void m(),disabled:s,style:DC,children:"Enable"}),S.jsx("button",{"data-testid":"cowork-onboarding-enable-cancel-btn",type:"button",onClick:()=>i(!1),disabled:s,style:Zy,children:"Cancel"})]})]}):S.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[S.jsx("button",{"data-testid":"cowork-onboarding-enable-btn",type:"button",onClick:()=>i(!0),disabled:s,style:DC,children:"Enable"}),S.jsx("button",{"data-testid":"cowork-onboarding-skip-btn",type:"button",onClick:g,disabled:s,style:Zy,children:"Skip"}),n?S.jsx("button",{"data-testid":"cowork-onboarding-learn-more-btn",type:"button",onClick:n,disabled:s,style:Zy,children:"Learn more"}):S.jsx("a",{"data-testid":"cowork-onboarding-learn-more-link",href:"https://github.com/bloknayrb/tandem#cowork",target:"_blank",rel:"noreferrer",style:{fontSize:12,color:"var(--tandem-accent)",alignSelf:"center",textDecoration:"underline"},children:"Learn more"})]})]})}const DC={padding:"4px 10px",fontSize:12,border:"1px solid var(--tandem-accent)",borderRadius:4,background:"var(--tandem-accent)",color:"var(--tandem-accent-fg)",cursor:"pointer",fontWeight:600},Zy={padding:"4px 10px",fontSize:12,border:"1px solid var(--tandem-border-strong)",borderRadius:4,background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)",cursor:"pointer"},wL=[{id:"review",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."},{id:"question",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."},{id:"edit",title:"Make an edit",text:"Click in the document and type something. All changes sync in real-time."},{id:"cowork",title:"Claude Desktop Cowork detected",text:""},{id:"complete",title:"You're ready!",text:"You've learned the basics. Press ? anytime to see keyboard shortcuts."}];function kL({currentStep:t,onNext:e,onDismiss:n,coworkStatus:r}){const i=dd(),s=M.useMemo(CM,[]),l=i&&kM(r,s),c=M.useMemo(()=>wL.filter(g=>g.id!=="cowork"||l),[l]),u=c.length-1,f=c[t];if(!f)return null;const h=t>=u,m=f.id==="cowork";return S.jsxs("div",{"data-testid":"onboarding-tutorial",style:{position:"fixed",bottom:48,left:24,zIndex:900,maxWidth:340,background:"var(--tandem-surface)",borderLeft:"4px solid var(--tandem-accent)",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:[!h&&S.jsx("div",{style:{display:"flex",gap:6,marginBottom:12},children:Array.from({length:u},(g,b)=>S.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:b<=t?"var(--tandem-accent)":"var(--tandem-border)",transition:"background 0.2s"}},b))}),m&&r!==null?S.jsx(SL,{status:r,onAdvance:e}):S.jsxs(S.Fragment,{children:[S.jsx("div",{style:{fontSize:14,fontWeight:600,color:"var(--tandem-fg)",marginBottom:6},children:f.title}),S.jsx("div",{style:{fontSize:13,lineHeight:1.5,color:"var(--tandem-fg-muted)",marginBottom:h?0:14},children:f.text})]}),!h&&!m&&S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[S.jsxs("span",{style:{fontSize:11,color:"var(--tandem-fg-subtle)"},children:["Step ",t+1," of ",u]}),S.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[S.jsx("button",{"data-testid":"tutorial-dismiss-btn",onClick:n,style:{background:"none",border:"none",cursor:"pointer",fontSize:12,color:"var(--tandem-fg-subtle)",padding:0,textDecoration:"underline"},children:"Dismiss tutorial"}),S.jsx("button",{"data-testid":"tutorial-next-btn",onClick:e,style:{padding:"4px 12px",fontSize:12,border:"1px solid var(--tandem-border-strong)",borderRadius:4,background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)",cursor:"pointer",fontWeight:500},children:t===u-1?"Done":"Next"})]})]})]})}function CL(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const EL=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TL=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,AL={};function RC(t,e){return(AL.jsx?TL:EL).test(t)}const ML=/[ \t\n\f\r]/g;function OL(t){return typeof t=="object"?t.type==="text"?NC(t.value):!1:NC(t)}function NC(t){return t.replace(ML,"")===""}let fd=class{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}};fd.prototype.normal={};fd.prototype.property={};fd.prototype.space=void 0;function MM(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new fd(n,r,e)}function cb(t){return t.toLowerCase()}class ir{constructor(e,n){this.attribute=n,this.property=e}}ir.prototype.attribute="";ir.prototype.booleanish=!1;ir.prototype.boolean=!1;ir.prototype.commaOrSpaceSeparated=!1;ir.prototype.commaSeparated=!1;ir.prototype.defined=!1;ir.prototype.mustUseProperty=!1;ir.prototype.number=!1;ir.prototype.overloadedBoolean=!1;ir.prototype.property="";ir.prototype.spaceSeparated=!1;ir.prototype.space=void 0;let _L=0;const Pe=fl(),Kt=fl(),ub=fl(),ce=fl(),xt=fl(),ma=fl(),fr=fl();function fl(){return 2**++_L}const db=Object.freeze(Object.defineProperty({__proto__:null,boolean:Pe,booleanish:Kt,commaOrSpaceSeparated:fr,commaSeparated:ma,number:ce,overloadedBoolean:ub,spaceSeparated:xt},Symbol.toStringTag,{value:"Module"})),Jy=Object.keys(db);class zx extends ir{constructor(e,n,r,i){let s=-1;if(super(e,n),zC(this,"space",i),typeof r=="number")for(;++s<Jy.length;){const l=Jy[s];zC(this,Jy[s],(r&db[l])===db[l])}}}zx.prototype.defined=!0;function zC(t,e,n){n&&(t[e]=n)}function qa(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new zx(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[cb(r)]=r,n[cb(s.attribute)]=r}return new fd(e,n,t.space)}const OM=qa({properties:{ariaActiveDescendant:null,ariaAtomic:Kt,ariaAutoComplete:null,ariaBusy:Kt,ariaChecked:Kt,ariaColCount:ce,ariaColIndex:ce,ariaColSpan:ce,ariaControls:xt,ariaCurrent:null,ariaDescribedBy:xt,ariaDetails:null,ariaDisabled:Kt,ariaDropEffect:xt,ariaErrorMessage:null,ariaExpanded:Kt,ariaFlowTo:xt,ariaGrabbed:Kt,ariaHasPopup:null,ariaHidden:Kt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xt,ariaLevel:ce,ariaLive:null,ariaModal:Kt,ariaMultiLine:Kt,ariaMultiSelectable:Kt,ariaOrientation:null,ariaOwns:xt,ariaPlaceholder:null,ariaPosInSet:ce,ariaPressed:Kt,ariaReadOnly:Kt,ariaRelevant:null,ariaRequired:Kt,ariaRoleDescription:xt,ariaRowCount:ce,ariaRowIndex:ce,ariaRowSpan:ce,ariaSelected:Kt,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 _M(t,e){return e in t?t[e]:e}function DM(t,e){return _M(t,e.toLowerCase())}const DL=qa({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ma,acceptCharset:xt,accessKey:xt,action:null,allow:null,allowFullScreen:Pe,allowPaymentRequest:Pe,allowUserMedia:Pe,alt:null,as:null,async:Pe,autoCapitalize:null,autoComplete:xt,autoFocus:Pe,autoPlay:Pe,blocking:xt,capture:null,charSet:null,checked:Pe,cite:null,className:xt,cols:ce,colSpan:null,content:null,contentEditable:Kt,controls:Pe,controlsList:xt,coords:ce|ma,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Pe,defer:Pe,dir:null,dirName:null,disabled:Pe,download:ub,draggable:Kt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Pe,formTarget:null,headers:xt,height:ce,hidden:ub,high:ce,href:null,hrefLang:null,htmlFor:xt,httpEquiv:xt,id:null,imageSizes:null,imageSrcSet:null,inert:Pe,inputMode:null,integrity:null,is:null,isMap:Pe,itemId:null,itemProp:xt,itemRef:xt,itemScope:Pe,itemType:xt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Pe,low:ce,manifest:null,max:null,maxLength:ce,media:null,method:null,min:null,minLength:ce,multiple:Pe,muted:Pe,name:null,nonce:null,noModule:Pe,noValidate:Pe,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:Pe,optimum:ce,pattern:null,ping:xt,placeholder:null,playsInline:Pe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Pe,referrerPolicy:null,rel:xt,required:Pe,reversed:Pe,rows:ce,rowSpan:ce,sandbox:xt,scope:null,scoped:Pe,seamless:Pe,selected:Pe,shadowRootClonable:Pe,shadowRootDelegatesFocus:Pe,shadowRootMode:null,shape:null,size:ce,sizes:null,slot:null,span:ce,spellCheck:Kt,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:Pe,useMap:null,value:Kt,width:ce,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xt,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:Pe,declare:Pe,event:null,face:null,frame:null,frameBorder:null,hSpace:ce,leftMargin:ce,link:null,longDesc:null,lowSrc:null,marginHeight:ce,marginWidth:ce,noResize:Pe,noHref:Pe,noShade:Pe,noWrap:Pe,object:null,profile:null,prompt:null,rev:null,rightMargin:ce,rules:null,scheme:null,scrolling:Kt,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:Pe,disableRemotePlayback:Pe,prefix:null,property:null,results:ce,security:null,unselectable:null},space:"html",transform:DM}),RL=qa({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:fr,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:xt,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:Pe,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:ma,g2:ma,glyphName:ma,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:fr,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:xt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ce,pointsAtY:ce,pointsAtZ:ce,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:fr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:fr,rev:fr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:fr,requiredFeatures:fr,requiredFonts:fr,requiredFormats:fr,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:fr,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:fr,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:fr,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:_M}),RM=qa({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()}}),NM=qa({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:DM}),zM=qa({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),NL={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"},zL=/[A-Z]/g,LC=/-[a-z]/g,LL=/^data[-\w.:]+$/i;function jL(t,e){const n=cb(e);let r=e,i=ir;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&LL.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(LC,BL);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!LC.test(s)){let l=s.replace(zL,IL);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}i=zx}return new i(r,e)}function IL(t){return"-"+t.toLowerCase()}function BL(t){return t.charAt(1).toUpperCase()}const UL=MM([OM,DL,RM,NM,zM],"html"),Lx=MM([OM,RL,RM,NM,zM],"svg");function HL(t){return t.join(" ").trim()}var na={},Xy,jC;function VL(){if(jC)return Xy;jC=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,u=`
51
+ `,f="/",h="*",m="",g="comment",b="declaration";function v(C,E){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];E=E||{};var L=1,j=1;function Y(ae){var H=ae.match(e);H&&(L+=H.length);var N=ae.lastIndexOf(u);j=~N?ae.length-N:j+ae.length}function V(){var ae={line:L,column:j};return function(H){return H.position=new R(ae),W(),H}}function R(ae){this.start=ae,this.end={line:L,column:j},this.source=E.source}R.prototype.content=C;function B(ae){var H=new Error(E.source+":"+L+":"+j+": "+ae);if(H.reason=ae,H.filename=E.source,H.line=L,H.column=j,H.source=C,!E.silent)throw H}function te(ae){var H=ae.exec(C);if(H){var N=H[0];return Y(N),C=C.slice(N.length),H}}function W(){te(n)}function oe(ae){var H;for(ae=ae||[];H=re();)H!==!1&&ae.push(H);return ae}function re(){var ae=V();if(!(f!=C.charAt(0)||h!=C.charAt(1))){for(var H=2;m!=C.charAt(H)&&(h!=C.charAt(H)||f!=C.charAt(H+1));)++H;if(H+=2,m===C.charAt(H-1))return B("End of comment missing");var N=C.slice(2,H-2);return j+=2,Y(N),C=C.slice(H),j+=2,ae({type:g,comment:N})}}function ie(){var ae=V(),H=te(r);if(H){if(re(),!te(i))return B("property missing ':'");var N=te(s),K=ae({type:b,property:k(H[0].replace(t,m)),value:N?k(N[0].replace(t,m)):m});return te(l),K}}function ye(){var ae=[];oe(ae);for(var H;H=ie();)H!==!1&&(ae.push(H),oe(ae));return ae}return W(),ye()}function k(C){return C?C.replace(c,m):m}return Xy=v,Xy}var IC;function PL(){if(IC)return na;IC=1;var t=na&&na.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(na,"__esModule",{value:!0}),na.default=n;const e=t(VL());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(u=>{if(u.type!=="declaration")return;const{property:f,value:h}=u;c?i(f,h,u):h&&(s=s||{},s[f]=h)}),s}return na}var Zc={},BC;function $L(){if(BC)return Zc;BC=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(f){return!f||n.test(f)||t.test(f)},l=function(f,h){return h.toUpperCase()},c=function(f,h){return"".concat(h,"-")},u=function(f,h){return h===void 0&&(h={}),s(f)?f:(f=f.toLowerCase(),h.reactCompat?f=f.replace(i,c):f=f.replace(r,c),f.replace(e,l))};return Zc.camelCase=u,Zc}var Jc,UC;function FL(){if(UC)return Jc;UC=1;var t=Jc&&Jc.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(PL()),n=$L();function r(i,s){var l={};return!i||typeof i!="string"||(0,e.default)(i,function(c,u){c&&u&&(l[(0,n.camelCase)(c,s)]=u)}),l}return r.default=r,Jc=r,Jc}var qL=FL();const KL=Zp(qL),LM=jM("end"),jx=jM("start");function jM(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 YL(t){const e=jx(t),n=LM(t);if(e&&n)return{start:e,end:n}}function cu(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?HC(t.position):"start"in t||"end"in t?HC(t):"line"in t||"column"in t?fb(t):""}function fb(t){return VC(t&&t.line)+":"+VC(t&&t.column)}function HC(t){return fb(t&&t.start)+"-"+fb(t&&t.end)}function VC(t){return t&&typeof t=="number"?t:1}class Nn 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 u=r.indexOf(":");u===-1?s.ruleId=r:(s.source=r.slice(0,u),s.ruleId=r.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.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=cu(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}}Nn.prototype.file="";Nn.prototype.name="";Nn.prototype.reason="";Nn.prototype.message="";Nn.prototype.stack="";Nn.prototype.column=void 0;Nn.prototype.line=void 0;Nn.prototype.ancestors=void 0;Nn.prototype.cause=void 0;Nn.prototype.fatal=void 0;Nn.prototype.place=void 0;Nn.prototype.ruleId=void 0;Nn.prototype.source=void 0;const Ix={}.hasOwnProperty,WL=new Map,GL=/[A-Z]/g,ZL=new Set(["table","tbody","thead","tfoot","tr"]),JL=new Set(["td","th"]),IM="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function XL(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=o3(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=s3(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"?Lx:UL,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=BM(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function BM(t,e,n){if(e.type==="element")return QL(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return e3(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return n3(t,e,n);if(e.type==="mdxjsEsm")return t3(t,e);if(e.type==="root")return r3(t,e,n);if(e.type==="text")return i3(t,e)}function QL(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Lx,t.schema=i),t.ancestors.push(e);const s=HM(t,e.tagName,!1),l=l3(t,e);let c=Ux(t,e);return ZL.has(e.tagName)&&(c=c.filter(function(u){return typeof u=="string"?!OL(u):!0})),UM(t,l,s,e),Bx(l,c),t.ancestors.pop(),t.schema=r,t.create(e,s,l,n)}function e3(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)}_u(t,e.position)}function t3(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);_u(t,e.position)}function n3(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=Lx,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:HM(t,e.name,!0),l=a3(t,e),c=Ux(t,e);return UM(t,l,s,e),Bx(l,c),t.ancestors.pop(),t.schema=r,t.create(e,s,l,n)}function r3(t,e,n){const r={};return Bx(r,Ux(t,e)),t.create(e,t.Fragment,r,n)}function i3(t,e){return e.value}function UM(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function Bx(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function s3(t,e,n){return r;function r(i,s,l,c){const f=Array.isArray(l.children)?n:e;return c?f(s,l,c):f(s,l)}}function o3(t,e){return n;function n(r,i,s,l){const c=Array.isArray(s.children),u=jx(r);return e(i,s,l,c,{columnNumber:u?u.column-1:void 0,fileName:t,lineNumber:u?u.line:void 0},void 0)}}function l3(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&Ix.call(e.properties,i)){const s=c3(t,i,e.properties[i]);if(s){const[l,c]=s;t.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&JL.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 a3(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 _u(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 _u(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Ux(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:WL;for(;++r<e.children.length;){const s=e.children[r];let l;if(t.passKeys){const u=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(u){const f=i.get(u)||0;l=u+"-"+f,i.set(u,f+1)}}const c=BM(t,s,l);c!==void 0&&n.push(c)}return n}function c3(t,e,n){const r=jL(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?CL(n):HL(n)),r.property==="style"){let i=typeof n=="object"?n:u3(t,String(n));return t.stylePropertyNameCase==="css"&&(i=d3(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?NL[r.property]||r.property:r.attribute,n]}}function u3(t,e){try{return KL(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new Nn("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=IM+"#cannot-parse-style-attribute",i}}function HM(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=RC(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=RC(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return Ix.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);_u(t)}function _u(t,e){const n=new Nn("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=IM+"#cannot-handle-mdx-estrees-without-createevaluater",n}function d3(t){const e={};let n;for(n in t)Ix.call(t,n)&&(e[f3(n)]=t[n]);return e}function f3(t){let e=t.replace(GL,h3);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function h3(t){return"-"+t.toLowerCase()}const Qy={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"]},p3={};function m3(t,e){const n=p3,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return VM(t,r,i)}function VM(t,e,n){if(g3(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 PC(t.children,e,n)}return Array.isArray(t)?PC(t,e,n):""}function PC(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=VM(t[i],e,n);return r.join("")}function g3(t){return!!(t&&typeof t=="object")}const $C=document.createElement("i");function Hx(t){const e="&"+t+";";$C.innerHTML=e;const n=$C.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function vi(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 Lr(t,e){return t.length>0?(vi(t,t.length,0,e),t):e}const FC={}.hasOwnProperty;function y3(t){const e={};let n=-1;for(;++n<t.length;)b3(e,t[n]);return e}function b3(t,e){let n;for(n in e){const i=(FC.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let l;if(s)for(l in s){FC.call(i,l)||(i[l]=[]);const c=s[l];x3(i[l],Array.isArray(c)?c:c?[c]:[])}}}function x3(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);vi(t,0,0,r)}function PM(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 ga(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const mi=fo(/[A-Za-z]/),yr=fo(/[\dA-Za-z]/),v3=fo(/[#-'*+\--9=?A-Z^-~]/);function hb(t){return t!==null&&(t<32||t===127)}const pb=fo(/\d/),S3=fo(/[\dA-Fa-f]/),w3=fo(/[!-/:-@[-`{-~]/);function ze(t){return t!==null&&t<-2}function tr(t){return t!==null&&(t<0||t===32)}function at(t){return t===-2||t===-1||t===32}const k3=fo(new RegExp("\\p{P}|\\p{S}","u")),C3=fo(/\s/);function fo(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Ka(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let l="";if(s===37&&yr(t.charCodeAt(n+1))&&yr(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 vt(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return l;function l(u){return at(u)?(t.enter(n),c(u)):e(u)}function c(u){return at(u)&&s++<i?(t.consume(u),c):(t.exit(n),e(u))}}const E3={tokenize:T3};function T3(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"),vt(t,e,"linePrefix")}function i(c){return t.enter("paragraph"),s(c)}function s(c){const u=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,l(c)}function l(c){if(c===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(c);return}return ze(c)?(t.consume(c),t.exit("chunkText"),s):(t.consume(c),l)}}const A3={tokenize:M3},qC={tokenize:O3};function M3(t){const e=this,n=[];let r=0,i,s,l;return c;function c(j){if(r<n.length){const Y=n[r];return e.containerState=Y[1],t.attempt(Y[0].continuation,u,f)(j)}return f(j)}function u(j){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&L();const Y=e.events.length;let V=Y,R;for(;V--;)if(e.events[V][0]==="exit"&&e.events[V][1].type==="chunkFlow"){R=e.events[V][1].end;break}E(r);let B=Y;for(;B<e.events.length;)e.events[B][1].end={...R},B++;return vi(e.events,V+1,0,e.events.slice(Y)),e.events.length=B,f(j)}return c(j)}function f(j){if(r===n.length){if(!i)return g(j);if(i.currentConstruct&&i.currentConstruct.concrete)return v(j);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(qC,h,m)(j)}function h(j){return i&&L(),E(r),g(j)}function m(j){return e.parser.lazy[e.now().line]=r!==n.length,l=e.now().offset,v(j)}function g(j){return e.containerState={},t.attempt(qC,b,v)(j)}function b(j){return r++,n.push([e.currentConstruct,e.containerState]),g(j)}function v(j){if(j===null){i&&L(),E(0),t.consume(j);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),k(j)}function k(j){if(j===null){C(t.exit("chunkFlow"),!0),E(0),t.consume(j);return}return ze(j)?(t.consume(j),C(t.exit("chunkFlow")),r=0,e.interrupt=void 0,c):(t.consume(j),k)}function C(j,Y){const V=e.sliceStream(j);if(Y&&V.push(null),j.previous=s,s&&(s.next=j),s=j,i.defineSkip(j.start),i.write(V),e.parser.lazy[j.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 B=e.events.length;let te=B,W,oe;for(;te--;)if(e.events[te][0]==="exit"&&e.events[te][1].type==="chunkFlow"){if(W){oe=e.events[te][1].end;break}W=!0}for(E(r),R=B;R<e.events.length;)e.events[R][1].end={...oe},R++;vi(e.events,te+1,0,e.events.slice(B)),e.events.length=R}}function E(j){let Y=n.length;for(;Y-- >j;){const V=n[Y];e.containerState=V[1],V[0].exit.call(e,t)}n.length=j}function L(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function O3(t,e,n){return vt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function KC(t){if(t===null||tr(t)||C3(t))return 1;if(k3(t))return 2}function Vx(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 mb={name:"attention",resolveAll:_3,tokenize:D3};function _3(t,e){let n=-1,r,i,s,l,c,u,f,h;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;u=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};YC(m,-u),YC(g,u),l={type:u>1?"strongSequence":"emphasisSequence",start:m,end:{...t[r][1].end}},c={type:u>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},s={type:u>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},t[r][1].end={...l.start},t[n][1].start={...c.end},f=[],t[r][1].end.offset-t[r][1].start.offset&&(f=Lr(f,[["enter",t[r][1],e],["exit",t[r][1],e]])),f=Lr(f,[["enter",i,e],["enter",l,e],["exit",l,e],["enter",s,e]]),f=Lr(f,Vx(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),f=Lr(f,[["exit",s,e],["enter",c,e],["exit",c,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(h=2,f=Lr(f,[["enter",t[n][1],e],["exit",t[n][1],e]])):h=0,vi(t,r-1,n-r+3,f),n=r+f.length-h-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function D3(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=KC(r);let s;return l;function l(u){return s=u,t.enter("attentionSequence"),c(u)}function c(u){if(u===s)return t.consume(u),c;const f=t.exit("attentionSequence"),h=KC(u),m=!h||h===2&&i||n.includes(u),g=!i||i===2&&h||n.includes(r);return f._open=!!(s===42?m:m&&(i||!g)),f._close=!!(s===42?g:g&&(h||!m)),e(u)}}function YC(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const R3={name:"autolink",tokenize:N3};function N3(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 mi(b)?(t.consume(b),l):b===64?n(b):f(b)}function l(b){return b===43||b===45||b===46||yr(b)?(r=1,c(b)):f(b)}function c(b){return b===58?(t.consume(b),r=0,u):(b===43||b===45||b===46||yr(b))&&r++<32?(t.consume(b),c):(r=0,f(b))}function u(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||hb(b)?n(b):(t.consume(b),u)}function f(b){return b===64?(t.consume(b),h):v3(b)?(t.consume(b),f):n(b)}function h(b){return yr(b)?m(b):n(b)}function m(b){return b===46?(t.consume(b),r=0,h):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||yr(b))&&r++<63){const v=b===45?g:m;return t.consume(b),v}return n(b)}}const Jp={partial:!0,tokenize:z3};function z3(t,e,n){return r;function r(s){return at(s)?vt(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||ze(s)?e(s):n(s)}}const $M={continuation:{tokenize:j3},exit:I3,name:"blockQuote",tokenize:L3};function L3(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 at(l)?(t.enter("blockQuotePrefixWhitespace"),t.consume(l),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(l))}}function j3(t,e,n){const r=this;return i;function i(l){return at(l)?vt(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):s(l)}function s(l){return t.attempt($M,e,n)(l)}}function I3(t){t.exit("blockQuote")}const FM={name:"characterEscape",tokenize:B3};function B3(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 w3(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const qM={name:"characterReference",tokenize:U3};function U3(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"),u}function u(m){return m===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(m),t.exit("characterReferenceMarkerNumeric"),f):(t.enter("characterReferenceValue"),s=31,l=yr,h(m))}function f(m){return m===88||m===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(m),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,l=S3,h):(t.enter("characterReferenceValue"),s=7,l=pb,h(m))}function h(m){if(m===59&&i){const g=t.exit("characterReferenceValue");return l===yr&&!Hx(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),h):n(m)}}const WC={partial:!0,tokenize:V3},GC={concrete:!0,name:"codeFenced",tokenize:H3};function H3(t,e,n){const r=this,i={partial:!0,tokenize:V};let s=0,l=0,c;return u;function u(R){return f(R)}function f(R){const B=r.events[r.events.length-1];return s=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,c=R,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),h(R)}function h(R){return R===c?(l++,t.consume(R),h):l<3?n(R):(t.exit("codeFencedFenceSequence"),at(R)?vt(t,m,"whitespace")(R):m(R))}function m(R){return R===null||ze(R)?(t.exit("codeFencedFence"),r.interrupt?e(R):t.check(WC,k,Y)(R)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),g(R))}function g(R){return R===null||ze(R)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),m(R)):at(R)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),vt(t,b,"whitespace")(R)):R===96&&R===c?n(R):(t.consume(R),g)}function b(R){return R===null||ze(R)?m(R):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),v(R))}function v(R){return R===null||ze(R)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),m(R)):R===96&&R===c?n(R):(t.consume(R),v)}function k(R){return t.attempt(i,Y,C)(R)}function C(R){return t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),E}function E(R){return s>0&&at(R)?vt(t,L,"linePrefix",s+1)(R):L(R)}function L(R){return R===null||ze(R)?t.check(WC,k,Y)(R):(t.enter("codeFlowValue"),j(R))}function j(R){return R===null||ze(R)?(t.exit("codeFlowValue"),L(R)):(t.consume(R),j)}function Y(R){return t.exit("codeFenced"),e(R)}function V(R,B,te){let W=0;return oe;function oe(H){return R.enter("lineEnding"),R.consume(H),R.exit("lineEnding"),re}function re(H){return R.enter("codeFencedFence"),at(H)?vt(R,ie,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):ie(H)}function ie(H){return H===c?(R.enter("codeFencedFenceSequence"),ye(H)):te(H)}function ye(H){return H===c?(W++,R.consume(H),ye):W>=l?(R.exit("codeFencedFenceSequence"),at(H)?vt(R,ae,"whitespace")(H):ae(H)):te(H)}function ae(H){return H===null||ze(H)?(R.exit("codeFencedFence"),B(H)):te(H)}}}function V3(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 e0={name:"codeIndented",tokenize:$3},P3={partial:!0,tokenize:F3};function $3(t,e,n){const r=this;return i;function i(f){return t.enter("codeIndented"),vt(t,s,"linePrefix",5)(f)}function s(f){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?l(f):n(f)}function l(f){return f===null?u(f):ze(f)?t.attempt(P3,l,u)(f):(t.enter("codeFlowValue"),c(f))}function c(f){return f===null||ze(f)?(t.exit("codeFlowValue"),l(f)):(t.consume(f),c)}function u(f){return t.exit("codeIndented"),e(f)}}function F3(t,e,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i):vt(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):ze(l)?i(l):n(l)}}const q3={name:"codeText",previous:Y3,resolve:K3,tokenize:W3};function K3(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 Y3(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function W3(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"),u(m))}function u(m){return m===null?n(m):m===32?(t.enter("space"),t.consume(m),t.exit("space"),u):m===96?(s=t.enter("codeTextSequence"),i=0,h(m)):ze(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),u):(t.enter("codeTextData"),f(m))}function f(m){return m===null||m===32||m===96||ze(m)?(t.exit("codeTextData"),u(m)):(t.consume(m),f)}function h(m){return m===96?(t.consume(m),i++,h):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(m)):(s.type="codeTextData",f(m))}}class G3{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&&Xc(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),Xc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Xc(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);Xc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Xc(this.left,n.reverse())}}}function Xc(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 KM(t){const e={};let n=-1,r,i,s,l,c,u,f;const h=new G3(t);for(;++n<h.length;){for(;n in e;)n=e[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,s=0,s<u.length&&u[s][1].type==="lineEndingBlank"&&(s+=2),s<u.length&&u[s][1].type==="content"))for(;++s<u.length&&u[s][1].type!=="content";)u[s][1].type==="chunkText"&&(u[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,Z3(h,n)),n=e[n],f=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(l=h.get(s),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(h.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={...h.get(i)[1].start},c=h.slice(i,n),c.unshift(r),h.splice(i,n-i+1,c))}}return vi(t,0,Number.POSITIVE_INFINITY,h.slice(0)),!f}function Z3(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,u=[],f={};let h,m,g=-1,b=n,v=0,k=0;const C=[k];for(;b;){for(;t.get(++i)[1]!==b;);s.push(i),b._tokenizer||(h=r.sliceStream(b),b.next||h.push(null),m&&l.defineSkip(b.start),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(h),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&&(k=g+1,C.push(k),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]),L=s.pop();u.push([L,L+E.length-1]),t.splice(L,2,E)}for(u.reverse(),g=-1;++g<u.length;)f[v+u[g][0]]=v+u[g][1],v+=u[g][1]-u[g][0]-1;return f}const J3={resolve:Q3,tokenize:e4},X3={partial:!0,tokenize:t4};function Q3(t){return KM(t),t}function e4(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):ze(c)?t.check(X3,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 t4(t,e,n){const r=this;return i;function i(l){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),vt(t,s,"linePrefix")}function s(l){if(l===null||ze(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 YM(t,e,n,r,i,s,l,c,u){const f=u||Number.POSITIVE_INFINITY;let h=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||hb(E)?n(E):(t.enter(r),t.enter(l),t.enter(c),t.enter("chunkString",{contentType:"string"}),k(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||ze(E)?n(E):(t.consume(E),E===92?v:b)}function v(E){return E===60||E===62||E===92?(t.consume(E),b):b(E)}function k(E){return!h&&(E===null||E===41||tr(E))?(t.exit("chunkString"),t.exit(c),t.exit(l),t.exit(r),e(E)):h<f&&E===40?(t.consume(E),h++,k):E===41?(t.consume(E),h--,k):E===null||E===32||E===40||hb(E)?n(E):(t.consume(E),E===92?C:k)}function C(E){return E===40||E===41||E===92?(t.consume(E),k):k(E)}}function WM(t,e,n,r,i,s){const l=this;let c=0,u;return f;function f(b){return t.enter(r),t.enter(i),t.consume(b),t.exit(i),t.enter(s),h}function h(b){return c>999||b===null||b===91||b===93&&!u||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):ze(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),h):(t.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||b===91||b===93||ze(b)||c++>999?(t.exit("chunkString"),h(b)):(t.consume(b),u||(u=!at(b)),b===92?g:m)}function g(b){return b===91||b===92||b===93?(t.consume(b),c++,m):m(b)}}function GM(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,u):n(g)}function u(g){return g===l?(t.enter(i),t.consume(g),t.exit(i),t.exit(r),e):(t.enter(s),f(g))}function f(g){return g===l?(t.exit(s),u(l)):g===null?n(g):ze(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),vt(t,f,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===l||g===null||ze(g)?(t.exit("chunkString"),f(g)):(t.consume(g),g===92?m:h)}function m(g){return g===l||g===92?(t.consume(g),h):h(g)}}function uu(t,e){let n;return r;function r(i){return ze(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):at(i)?vt(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const n4={name:"definition",tokenize:i4},r4={partial:!0,tokenize:s4};function i4(t,e,n){const r=this;let i;return s;function s(b){return t.enter("definition"),l(b)}function l(b){return WM.call(r,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function c(b){return i=ga(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),u):n(b)}function u(b){return tr(b)?uu(t,f)(b):f(b)}function f(b){return YM(t,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function h(b){return t.attempt(r4,m,m)(b)}function m(b){return at(b)?vt(t,g,"whitespace")(b):g(b)}function g(b){return b===null||ze(b)?(t.exit("definition"),r.parser.defined.push(i),e(b)):n(b)}}function s4(t,e,n){return r;function r(c){return tr(c)?uu(t,i)(c):n(c)}function i(c){return GM(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function s(c){return at(c)?vt(t,l,"whitespace")(c):l(c)}function l(c){return c===null||ze(c)?e(c):n(c)}}const o4={name:"hardBreakEscape",tokenize:l4};function l4(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return ze(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const a4={name:"headingAtx",resolve:c4,tokenize:u4};function c4(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"},vi(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function u4(t,e,n){let r=0;return i;function i(h){return t.enter("atxHeading"),s(h)}function s(h){return t.enter("atxHeadingSequence"),l(h)}function l(h){return h===35&&r++<6?(t.consume(h),l):h===null||tr(h)?(t.exit("atxHeadingSequence"),c(h)):n(h)}function c(h){return h===35?(t.enter("atxHeadingSequence"),u(h)):h===null||ze(h)?(t.exit("atxHeading"),e(h)):at(h)?vt(t,c,"whitespace")(h):(t.enter("atxHeadingText"),f(h))}function u(h){return h===35?(t.consume(h),u):(t.exit("atxHeadingSequence"),c(h))}function f(h){return h===null||h===35||tr(h)?(t.exit("atxHeadingText"),c(h)):(t.consume(h),f)}}const d4=["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"],ZC=["pre","script","style","textarea"],f4={concrete:!0,name:"htmlFlow",resolveTo:m4,tokenize:g4},h4={partial:!0,tokenize:b4},p4={partial:!0,tokenize:y4};function m4(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 g4(t,e,n){const r=this;let i,s,l,c,u;return f;function f(A){return h(A)}function h(A){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(A),m}function m(A){return A===33?(t.consume(A),g):A===47?(t.consume(A),s=!0,k):A===63?(t.consume(A),i=3,r.interrupt?e:O):mi(A)?(t.consume(A),l=String.fromCharCode(A),C):n(A)}function g(A){return A===45?(t.consume(A),i=2,b):A===91?(t.consume(A),i=5,c=0,v):mi(A)?(t.consume(A),i=4,r.interrupt?e:O):n(A)}function b(A){return A===45?(t.consume(A),r.interrupt?e:O):n(A)}function v(A){const ne="CDATA[";return A===ne.charCodeAt(c++)?(t.consume(A),c===ne.length?r.interrupt?e:ie:v):n(A)}function k(A){return mi(A)?(t.consume(A),l=String.fromCharCode(A),C):n(A)}function C(A){if(A===null||A===47||A===62||tr(A)){const ne=A===47,Z=l.toLowerCase();return!ne&&!s&&ZC.includes(Z)?(i=1,r.interrupt?e(A):ie(A)):d4.includes(l.toLowerCase())?(i=6,ne?(t.consume(A),E):r.interrupt?e(A):ie(A)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(A):s?L(A):j(A))}return A===45||yr(A)?(t.consume(A),l+=String.fromCharCode(A),C):n(A)}function E(A){return A===62?(t.consume(A),r.interrupt?e:ie):n(A)}function L(A){return at(A)?(t.consume(A),L):oe(A)}function j(A){return A===47?(t.consume(A),oe):A===58||A===95||mi(A)?(t.consume(A),Y):at(A)?(t.consume(A),j):oe(A)}function Y(A){return A===45||A===46||A===58||A===95||yr(A)?(t.consume(A),Y):V(A)}function V(A){return A===61?(t.consume(A),R):at(A)?(t.consume(A),V):j(A)}function R(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(t.consume(A),u=A,B):at(A)?(t.consume(A),R):te(A)}function B(A){return A===u?(t.consume(A),u=null,W):A===null||ze(A)?n(A):(t.consume(A),B)}function te(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||tr(A)?V(A):(t.consume(A),te)}function W(A){return A===47||A===62||at(A)?j(A):n(A)}function oe(A){return A===62?(t.consume(A),re):n(A)}function re(A){return A===null||ze(A)?ie(A):at(A)?(t.consume(A),re):n(A)}function ie(A){return A===45&&i===2?(t.consume(A),N):A===60&&i===1?(t.consume(A),K):A===62&&i===4?(t.consume(A),_):A===63&&i===3?(t.consume(A),O):A===93&&i===5?(t.consume(A),_e):ze(A)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(h4,I,ye)(A)):A===null||ze(A)?(t.exit("htmlFlowData"),ye(A)):(t.consume(A),ie)}function ye(A){return t.check(p4,ae,I)(A)}function ae(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),H}function H(A){return A===null||ze(A)?ye(A):(t.enter("htmlFlowData"),ie(A))}function N(A){return A===45?(t.consume(A),O):ie(A)}function K(A){return A===47?(t.consume(A),l="",he):ie(A)}function he(A){if(A===62){const ne=l.toLowerCase();return ZC.includes(ne)?(t.consume(A),_):ie(A)}return mi(A)&&l.length<8?(t.consume(A),l+=String.fromCharCode(A),he):ie(A)}function _e(A){return A===93?(t.consume(A),O):ie(A)}function O(A){return A===62?(t.consume(A),_):A===45&&i===2?(t.consume(A),O):ie(A)}function _(A){return A===null||ze(A)?(t.exit("htmlFlowData"),I(A)):(t.consume(A),_)}function I(A){return t.exit("htmlFlow"),e(A)}}function y4(t,e,n){const r=this;return i;function i(l){return ze(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 b4(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Jp,e,n)}}const x4={name:"htmlText",tokenize:v4};function v4(t,e,n){const r=this;let i,s,l;return c;function c(O){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(O),u}function u(O){return O===33?(t.consume(O),f):O===47?(t.consume(O),V):O===63?(t.consume(O),j):mi(O)?(t.consume(O),te):n(O)}function f(O){return O===45?(t.consume(O),h):O===91?(t.consume(O),s=0,v):mi(O)?(t.consume(O),L):n(O)}function h(O){return O===45?(t.consume(O),b):n(O)}function m(O){return O===null?n(O):O===45?(t.consume(O),g):ze(O)?(l=m,K(O)):(t.consume(O),m)}function g(O){return O===45?(t.consume(O),b):m(O)}function b(O){return O===62?N(O):O===45?g(O):m(O)}function v(O){const _="CDATA[";return O===_.charCodeAt(s++)?(t.consume(O),s===_.length?k:v):n(O)}function k(O){return O===null?n(O):O===93?(t.consume(O),C):ze(O)?(l=k,K(O)):(t.consume(O),k)}function C(O){return O===93?(t.consume(O),E):k(O)}function E(O){return O===62?N(O):O===93?(t.consume(O),E):k(O)}function L(O){return O===null||O===62?N(O):ze(O)?(l=L,K(O)):(t.consume(O),L)}function j(O){return O===null?n(O):O===63?(t.consume(O),Y):ze(O)?(l=j,K(O)):(t.consume(O),j)}function Y(O){return O===62?N(O):j(O)}function V(O){return mi(O)?(t.consume(O),R):n(O)}function R(O){return O===45||yr(O)?(t.consume(O),R):B(O)}function B(O){return ze(O)?(l=B,K(O)):at(O)?(t.consume(O),B):N(O)}function te(O){return O===45||yr(O)?(t.consume(O),te):O===47||O===62||tr(O)?W(O):n(O)}function W(O){return O===47?(t.consume(O),N):O===58||O===95||mi(O)?(t.consume(O),oe):ze(O)?(l=W,K(O)):at(O)?(t.consume(O),W):N(O)}function oe(O){return O===45||O===46||O===58||O===95||yr(O)?(t.consume(O),oe):re(O)}function re(O){return O===61?(t.consume(O),ie):ze(O)?(l=re,K(O)):at(O)?(t.consume(O),re):W(O)}function ie(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(t.consume(O),i=O,ye):ze(O)?(l=ie,K(O)):at(O)?(t.consume(O),ie):(t.consume(O),ae)}function ye(O){return O===i?(t.consume(O),i=void 0,H):O===null?n(O):ze(O)?(l=ye,K(O)):(t.consume(O),ye)}function ae(O){return O===null||O===34||O===39||O===60||O===61||O===96?n(O):O===47||O===62||tr(O)?W(O):(t.consume(O),ae)}function H(O){return O===47||O===62||tr(O)?W(O):n(O)}function N(O){return O===62?(t.consume(O),t.exit("htmlTextData"),t.exit("htmlText"),e):n(O)}function K(O){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(O),t.exit("lineEnding"),he}function he(O){return at(O)?vt(t,_e,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):_e(O)}function _e(O){return t.enter("htmlTextData"),l(O)}}const Px={name:"labelEnd",resolveAll:C4,resolveTo:E4,tokenize:T4},S4={tokenize:A4},w4={tokenize:M4},k4={tokenize:O4};function C4(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&&vi(t,0,t.length,n),t}function E4(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 u={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},f={type:"label",start:{...t[s][1].start},end:{...t[l][1].end}},h={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[l-2][1].start}};return c=[["enter",u,e],["enter",f,e]],c=Lr(c,t.slice(s+1,s+r+3)),c=Lr(c,[["enter",h,e]]),c=Lr(c,Vx(e.parser.constructs.insideSpan.null,t.slice(s+r+4,l-3),e)),c=Lr(c,[["exit",h,e],t[l-2],t[l-1],["exit",f,e]]),c=Lr(c,t.slice(l+1)),c=Lr(c,[["exit",u,e]]),vi(t,s,t.length,c),t}function T4(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(ga(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(g),t.exit("labelMarker"),t.exit("labelEnd"),u):n(g)}function u(g){return g===40?t.attempt(S4,h,l?h:m)(g):g===91?t.attempt(w4,h,l?f:m)(g):l?h(g):m(g)}function f(g){return t.attempt(k4,h,m)(g)}function h(g){return e(g)}function m(g){return s._balanced=!0,n(g)}}function A4(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 tr(m)?uu(t,s)(m):s(m)}function s(m){return m===41?h(m):YM(t,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function l(m){return tr(m)?uu(t,u)(m):h(m)}function c(m){return n(m)}function u(m){return m===34||m===39||m===40?GM(t,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):h(m)}function f(m){return tr(m)?uu(t,h)(m):h(m)}function h(m){return m===41?(t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),t.exit("resource"),e):n(m)}}function M4(t,e,n){const r=this;return i;function i(c){return WM.call(r,t,s,l,"reference","referenceMarker","referenceString")(c)}function s(c){return r.parser.defined.includes(ga(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(c):n(c)}function l(c){return n(c)}}function O4(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 _4={name:"labelStartImage",resolveAll:Px.resolveAll,tokenize:D4};function D4(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 R4={name:"labelStartLink",resolveAll:Px.resolveAll,tokenize:N4};function N4(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 t0={name:"lineEnding",tokenize:z4};function z4(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),vt(t,e,"linePrefix")}}const gh={name:"thematicBreak",tokenize:L4};function L4(t,e,n){let r=0,i;return s;function s(f){return t.enter("thematicBreak"),l(f)}function l(f){return i=f,c(f)}function c(f){return f===i?(t.enter("thematicBreakSequence"),u(f)):r>=3&&(f===null||ze(f))?(t.exit("thematicBreak"),e(f)):n(f)}function u(f){return f===i?(t.consume(f),r++,u):(t.exit("thematicBreakSequence"),at(f)?vt(t,c,"whitespace")(f):c(f))}}const Xn={continuation:{tokenize:U4},exit:V4,name:"list",tokenize:B4},j4={partial:!0,tokenize:P4},I4={partial:!0,tokenize:H4};function B4(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 v=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:pb(b)){if(r.containerState.type||(r.containerState.type=v,t.enter(v,{_container:!0})),v==="listUnordered")return t.enter("listItemPrefix"),b===42||b===45?t.check(gh,n,f)(b):f(b);if(!r.interrupt||b===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),u(b)}return n(b)}function u(b){return pb(b)&&++l<10?(t.consume(b),u):(!r.interrupt||l<2)&&(r.containerState.marker?b===r.containerState.marker:b===41||b===46)?(t.exit("listItemValue"),f(b)):n(b)}function f(b){return t.enter("listItemMarker"),t.consume(b),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||b,t.check(Jp,r.interrupt?n:h,t.attempt(j4,g,m))}function h(b){return r.containerState.initialBlankLine=!0,s++,g(b)}function m(b){return at(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 U4(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Jp,i,s);function i(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,vt(t,e,"listItemIndent",r.containerState.size+1)(c)}function s(c){return r.containerState.furtherBlankLines||!at(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(I4,e,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,vt(t,t.attempt(Xn,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function H4(t,e,n){const r=this;return vt(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 V4(t){t.exit(this.containerState.type)}function P4(t,e,n){const r=this;return vt(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!at(s)&&l&&l[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const JC={name:"setextUnderline",resolveTo:$4,tokenize:F4};function $4(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 F4(t,e,n){const r=this;let i;return s;function s(f){let h=r.events.length,m;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){m=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(t.enter("setextHeadingLine"),i=f,l(f)):n(f)}function l(f){return t.enter("setextHeadingLineSequence"),c(f)}function c(f){return f===i?(t.consume(f),c):(t.exit("setextHeadingLineSequence"),at(f)?vt(t,u,"lineSuffix")(f):u(f))}function u(f){return f===null||ze(f)?(t.exit("setextHeadingLine"),e(f)):n(f)}}const q4={tokenize:K4};function K4(t){const e=this,n=t.attempt(Jp,r,t.attempt(this.parser.constructs.flowInitial,i,vt(t,t.attempt(this.parser.constructs.flow,i,t.attempt(J3,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 Y4={resolveAll:JM()},W4=ZM("string"),G4=ZM("text");function ZM(t){return{resolveAll:JM(t==="text"?Z4: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(h){return f(h)?s(h):c(h)}function c(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),u}function u(h){return f(h)?(n.exit("data"),s(h)):(n.consume(h),u)}function f(h){if(h===null)return!0;const m=i[h];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 JM(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 Z4(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,u;for(;s--;){const f=i[s];if(typeof f=="string"){for(l=f.length;f.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(f===-2)u=!0,c++;else if(f!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(c=0),c){const f={type:n===t.length||u||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={...f.start},r.start.offset===r.end.offset?Object.assign(r,f):(t.splice(n,0,["enter",f,e],["exit",f,e]),n+=2)}n++}return t}const J4={42:Xn,43:Xn,45:Xn,48:Xn,49:Xn,50:Xn,51:Xn,52:Xn,53:Xn,54:Xn,55:Xn,56:Xn,57:Xn,62:$M},X4={91:n4},Q4={[-2]:e0,[-1]:e0,32:e0},ej={35:a4,42:gh,45:[JC,gh],60:f4,61:JC,95:gh,96:GC,126:GC},tj={38:qM,92:FM},nj={[-5]:t0,[-4]:t0,[-3]:t0,33:_4,38:qM,42:mb,60:[R3,x4],91:R4,92:[o4,FM],93:Px,95:mb,96:q3},rj={null:[mb,Y4]},ij={null:[42,95]},sj={null:[]},oj=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ij,contentInitial:X4,disable:sj,document:J4,flow:ej,flowInitial:Q4,insideSpan:rj,string:tj,text:nj},Symbol.toStringTag,{value:"Module"}));function lj(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 u={attempt:B(V),check:B(R),consume:L,enter:j,exit:Y,interrupt:B(R,{interrupt:!0})},f={code:null,containerState:{},defineSkip:k,events:[],now:v,parser:t,previous:null,sliceSerialize:g,sliceStream:b,write:m};let h=e.tokenize.call(f,u);return e.resolveAll&&s.push(e),f;function m(re){return l=Lr(l,re),C(),l[l.length-1]!==null?[]:(te(e,0),f.events=Vx(s,f.events,f),f.events)}function g(re,ie){return cj(b(re),ie)}function b(re){return aj(l,re)}function v(){const{_bufferIndex:re,_index:ie,line:ye,column:ae,offset:H}=r;return{_bufferIndex:re,_index:ie,line:ye,column:ae,offset:H}}function k(re){i[re.line]=re.column,oe()}function C(){let re;for(;r._index<l.length;){const ie=l[r._index];if(typeof ie=="string")for(re=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===re&&r._bufferIndex<ie.length;)E(ie.charCodeAt(r._bufferIndex));else E(ie)}}function E(re){h=h(re)}function L(re){ze(re)?(r.line++,r.column=1,r.offset+=re===-3?2:1,oe()):re!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=re}function j(re,ie){const ye=ie||{};return ye.type=re,ye.start=v(),f.events.push(["enter",ye,f]),c.push(ye),ye}function Y(re){const ie=c.pop();return ie.end=v(),f.events.push(["exit",ie,f]),ie}function V(re,ie){te(re,ie.from)}function R(re,ie){ie.restore()}function B(re,ie){return ye;function ye(ae,H,N){let K,he,_e,O;return Array.isArray(ae)?I(ae):"tokenize"in ae?I([ae]):_(ae);function _(se){return me;function me(Ee){const Te=Ee!==null&&se[Ee],He=Ee!==null&&se.null,we=[...Array.isArray(Te)?Te:Te?[Te]:[],...Array.isArray(He)?He:He?[He]:[]];return I(we)(Ee)}}function I(se){return K=se,he=0,se.length===0?N:A(se[he])}function A(se){return me;function me(Ee){return O=W(),_e=se,se.partial||(f.currentConstruct=se),se.name&&f.parser.constructs.disable.null.includes(se.name)?Z():se.tokenize.call(ie?Object.assign(Object.create(f),ie):f,u,ne,Z)(Ee)}}function ne(se){return re(_e,O),H}function Z(se){return O.restore(),++he<K.length?A(K[he]):N}}}function te(re,ie){re.resolveAll&&!s.includes(re)&&s.push(re),re.resolve&&vi(f.events,ie,f.events.length-ie,re.resolve(f.events.slice(ie),f)),re.resolveTo&&(f.events=re.resolveTo(f.events,f))}function W(){const re=v(),ie=f.previous,ye=f.currentConstruct,ae=f.events.length,H=Array.from(c);return{from:ae,restore:N};function N(){r=re,f.previous=ie,f.currentConstruct=ye,f.events.length=ae,c=H,oe()}}function oe(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function aj(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 cj(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=`
52
+ `;break}case-3:{l=`\r
53
+ `;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 uj(t){const r={constructs:y3([oj,...(t||{}).extensions||[]]),content:i(E3),defined:[],document:i(A3),flow:i(q4),lazy:{},string:i(W4),text:i(G4)};return r;function i(s){return l;function l(c){return lj(r,s,c)}}}function dj(t){for(;!KM(t););return t}const XC=/[\0\t\n\r]/g;function fj(){let t=1,e="",n=!0,r;return i;function i(s,l,c){const u=[];let f,h,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(XC.lastIndex=m,f=XC.exec(s),g=f&&f.index!==void 0?f.index:s.length,b=s.charCodeAt(g),!f){e=s.slice(m);break}if(b===10&&m===g&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),m<g&&(u.push(s.slice(m,g)),t+=g-m),b){case 0:{u.push(65533),t++;break}case 9:{for(h=Math.ceil(t/4)*4,u.push(-2);t++<h;)u.push(-1);break}case 10:{u.push(-4),t=1;break}default:r=!0,t=1}m=g+1}return c&&(r&&u.push(-5),e&&u.push(e),u.push(null)),u}}const hj=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function pj(t){return t.replace(hj,mj)}function mj(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return PM(n.slice(s?2:1),s?16:10)}return Hx(n)||t}const XM={}.hasOwnProperty;function gj(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),yj(n)(dj(uj(n).document().write(fj()(t,e,!0))))}function yj(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Oi),autolinkProtocol:W,autolinkEmail:W,atxHeading:s(Fr),blockQuote:s(He),characterEscape:W,characterReference:W,codeFenced:s(we),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:s(we,l),codeText:s(Ge,l),codeTextData:W,data:W,codeFlowValue:W,definition:s(pn),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:s(jt),hardBreakEscape:s(vr),hardBreakTrailing:s(vr),htmlFlow:s($n,l),htmlFlowData:W,htmlText:s($n,l),htmlTextData:W,image:s(Mi),label:l,link:s(Oi),listItem:s(qr),listItemValue:g,listOrdered:s(_i,m),listUnordered:s(_i),paragraph:s(gl),reference:A,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:s(Fr),strong:s(yl),thematicBreak:s(go)},exit:{atxHeading:u(),atxHeadingSequence:V,autolink:u(),autolinkEmail:Te,autolinkProtocol:Ee,blockQuote:u(),characterEscapeValue:oe,characterReferenceMarkerHexadecimal:Z,characterReferenceMarkerNumeric:Z,characterReferenceValue:se,characterReference:me,codeFenced:u(C),codeFencedFence:k,codeFencedFenceInfo:b,codeFencedFenceMeta:v,codeFlowValue:oe,codeIndented:u(E),codeText:u(H),codeTextData:oe,data:oe,definition:u(),definitionDestinationString:Y,definitionLabelString:L,definitionTitleString:j,emphasis:u(),hardBreakEscape:u(ie),hardBreakTrailing:u(ie),htmlFlow:u(ye),htmlFlowData:oe,htmlText:u(ae),htmlTextData:oe,image:u(K),label:_e,labelText:he,lineEnding:re,link:u(N),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:ne,resourceDestinationString:O,resourceTitleString:_,resource:I,setextHeading:u(te),setextHeadingLineSequence:B,setextHeadingText:R,strong:u(),thematicBreak:u()}};QM(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(J){let de={type:"root",children:[]};const Re={stack:[de],tokenStack:[],config:e,enter:c,exit:f,buffer:l,resume:h,data:n},pe=[];let tt=-1;for(;++tt<J.length;)if(J[tt][1].type==="listOrdered"||J[tt][1].type==="listUnordered")if(J[tt][0]==="enter")pe.push(tt);else{const Ln=pe.pop();tt=i(J,Ln,tt)}for(tt=-1;++tt<J.length;){const Ln=e[J[tt][0]];XM.call(Ln,J[tt][1].type)&&Ln[J[tt][1].type].call(Object.assign({sliceSerialize:J[tt][2].sliceSerialize},Re),J[tt][1])}if(Re.tokenStack.length>0){const Ln=Re.tokenStack[Re.tokenStack.length-1];(Ln[1]||QC).call(Re,void 0,Ln[0])}for(de.position={start:Is(J.length>0?J[0][1].start:{line:1,column:1,offset:0}),end:Is(J.length>0?J[J.length-2][1].end:{line:1,column:1,offset:0})},tt=-1;++tt<e.transforms.length;)de=e.transforms[tt](de)||de;return de}function i(J,de,Re){let pe=de-1,tt=-1,Ln=!1,Kr,mn,It,Qt;for(;++pe<=Re;){const ot=J[pe];switch(ot[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ot[0]==="enter"?tt++:tt--,Qt=void 0;break}case"lineEndingBlank":{ot[0]==="enter"&&(Kr&&!Qt&&!tt&&!It&&(It=pe),Qt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Qt=void 0}if(!tt&&ot[0]==="enter"&&ot[1].type==="listItemPrefix"||tt===-1&&ot[0]==="exit"&&(ot[1].type==="listUnordered"||ot[1].type==="listOrdered")){if(Kr){let be=pe;for(mn=void 0;be--;){const bt=J[be];if(bt[1].type==="lineEnding"||bt[1].type==="lineEndingBlank"){if(bt[0]==="exit")continue;mn&&(J[mn][1].type="lineEndingBlank",Ln=!0),bt[1].type="lineEnding",mn=be}else if(!(bt[1].type==="linePrefix"||bt[1].type==="blockQuotePrefix"||bt[1].type==="blockQuotePrefixWhitespace"||bt[1].type==="blockQuoteMarker"||bt[1].type==="listItemIndent"))break}It&&(!mn||It<mn)&&(Kr._spread=!0),Kr.end=Object.assign({},mn?J[mn][1].start:ot[1].end),J.splice(mn||pe,0,["exit",Kr,ot[2]]),pe++,Re++}if(ot[1].type==="listItemPrefix"){const be={type:"listItem",_spread:!1,start:Object.assign({},ot[1].start),end:void 0};Kr=be,J.splice(pe,0,["enter",be,ot[2]]),pe++,Re++,It=void 0,Qt=!0}}}return J[de][1]._spread=Ln,Re}function s(J,de){return Re;function Re(pe){c.call(this,J(pe),pe),de&&de.call(this,pe)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(J,de,Re){this.stack[this.stack.length-1].children.push(J),this.stack.push(J),this.tokenStack.push([de,Re||void 0]),J.position={start:Is(de.start),end:void 0}}function u(J){return de;function de(Re){J&&J.call(this,Re),f.call(this,Re)}}function f(J,de){const Re=this.stack.pop(),pe=this.tokenStack.pop();if(pe)pe[0].type!==J.type&&(de?de.call(this,J,pe[0]):(pe[1]||QC).call(this,J,pe[0]));else throw new Error("Cannot close `"+J.type+"` ("+cu({start:J.start,end:J.end})+"): it’s not open");Re.position.end=Is(J.end)}function h(){return m3(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 v(){const J=this.resume(),de=this.stack[this.stack.length-1];de.meta=J}function k(){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 L(J){const de=this.resume(),Re=this.stack[this.stack.length-1];Re.label=de,Re.identifier=ga(this.sliceSerialize(J)).toLowerCase()}function j(){const J=this.resume(),de=this.stack[this.stack.length-1];de.title=J}function Y(){const J=this.resume(),de=this.stack[this.stack.length-1];de.url=J}function V(J){const de=this.stack[this.stack.length-1];if(!de.depth){const Re=this.sliceSerialize(J).length;de.depth=Re}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function B(J){const de=this.stack[this.stack.length-1];de.depth=this.sliceSerialize(J).codePointAt(0)===61?1:2}function te(){this.data.setextHeadingSlurpLineEnding=void 0}function W(J){const Re=this.stack[this.stack.length-1].children;let pe=Re[Re.length-1];(!pe||pe.type!=="text")&&(pe=Xt(),pe.position={start:Is(J.start),end:void 0},Re.push(pe)),this.stack.push(pe)}function oe(J){const de=this.stack.pop();de.value+=this.sliceSerialize(J),de.position.end=Is(J.end)}function re(J){const de=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Re=de.children[de.children.length-1];Re.position.end=Is(J.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(de.type)&&(W.call(this,J),oe.call(this,J))}function ie(){this.data.atHardBreak=!0}function ye(){const J=this.resume(),de=this.stack[this.stack.length-1];de.value=J}function ae(){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 N(){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 K(){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 he(J){const de=this.sliceSerialize(J),Re=this.stack[this.stack.length-2];Re.label=pj(de),Re.identifier=ga(de).toLowerCase()}function _e(){const J=this.stack[this.stack.length-1],de=this.resume(),Re=this.stack[this.stack.length-1];if(this.data.inReference=!0,Re.type==="link"){const pe=J.children;Re.children=pe}else Re.alt=de}function O(){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 I(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function ne(J){const de=this.resume(),Re=this.stack[this.stack.length-1];Re.label=de,Re.identifier=ga(this.sliceSerialize(J)).toLowerCase(),this.data.referenceType="full"}function Z(J){this.data.characterReferenceType=J.type}function se(J){const de=this.sliceSerialize(J),Re=this.data.characterReferenceType;let pe;Re?(pe=PM(de,Re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):pe=Hx(de);const tt=this.stack[this.stack.length-1];tt.value+=pe}function me(J){const de=this.stack.pop();de.position.end=Is(J.end)}function Ee(J){oe.call(this,J);const de=this.stack[this.stack.length-1];de.url=this.sliceSerialize(J)}function Te(J){oe.call(this,J);const de=this.stack[this.stack.length-1];de.url="mailto:"+this.sliceSerialize(J)}function He(){return{type:"blockquote",children:[]}}function we(){return{type:"code",lang:null,meta:null,value:""}}function Ge(){return{type:"inlineCode",value:""}}function pn(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function jt(){return{type:"emphasis",children:[]}}function Fr(){return{type:"heading",depth:0,children:[]}}function vr(){return{type:"break"}}function $n(){return{type:"html",value:""}}function Mi(){return{type:"image",title:null,url:"",alt:null}}function Oi(){return{type:"link",title:null,url:"",children:[]}}function _i(J){return{type:"list",ordered:J.type==="listOrdered",start:null,spread:J._spread,children:[]}}function qr(J){return{type:"listItem",spread:J._spread,checked:null,children:[]}}function gl(){return{type:"paragraph",children:[]}}function yl(){return{type:"strong",children:[]}}function Xt(){return{type:"text",value:""}}function go(){return{type:"thematicBreak"}}}function Is(t){return{line:t.line,column:t.column,offset:t.offset}}function QM(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?QM(t,r):bj(t,r)}}function bj(t,e){let n;for(n in e)if(XM.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 QC(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+cu({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+cu({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+cu({start:e.start,end:e.end})+") is still open")}function xj(t){const e=this;e.parser=n;function n(r){return gj(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function vj(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 Sj(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
54
+ `}]}function wj(t,e){const n=e.value?e.value+`
55
+ `:"",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 kj(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Cj(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Ej(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=Ka(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 u={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,u);const f={type:"element",tagName:"sup",properties:{},children:[u]};return t.patch(e,f),t.applyData(e,f)}function Tj(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 Aj(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function eO(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 Mj(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return eO(t,e);const i={src:Ka(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 Oj(t,e){const n={src:Ka(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 _j(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 Dj(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return eO(t,e);const i={href:Ka(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 Rj(t,e){const n={href:Ka(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 Nj(t,e,n){const r=t.all(e),i=n?zj(n):tO(e),s={},l=[];if(typeof e.checked=="boolean"){const h=r[0];let m;h&&h.type==="element"&&h.tagName==="p"?m=h:(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 h=r[c];(i||c!==0||h.type!=="element"||h.tagName!=="p")&&l.push({type:"text",value:`
56
+ `}),h.type==="element"&&h.tagName==="p"&&!i?l.push(...h.children):l.push(h)}const u=r[r.length-1];u&&(i||u.type!=="element"||u.tagName!=="p")&&l.push({type:"text",value:`
57
+ `});const f={type:"element",tagName:"li",properties:s,children:l};return t.patch(e,f),t.applyData(e,f)}function zj(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=tO(n[r])}return e}function tO(t){const e=t.spread;return e??t.children.length>1}function Lj(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 jj(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Ij(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function Bj(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Uj(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=jx(e.children[1]),u=LM(e.children[e.children.length-1]);c&&u&&(l.position={start:c,end:u}),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 Hj(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 u=-1;const f=[];for(;++u<c;){const m=e.children[u],g={},b=l?l[u]:void 0;b&&(g.align=b);let v={type:"element",tagName:s,properties:g,children:[]};m&&(v.children=t.all(m),t.patch(m,v),v=t.applyData(m,v)),f.push(v)}const h={type:"element",tagName:"tr",properties:{},children:t.wrap(f,!0)};return t.patch(e,h),t.applyData(e,h)}function Vj(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const eE=9,tE=32;function Pj(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push(nE(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(nE(e.slice(i),i>0,!1)),s.join("")}function nE(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===eE||s===tE;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===eE||s===tE;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function $j(t,e){const n={type:"text",value:Pj(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function Fj(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const qj={blockquote:vj,break:Sj,code:wj,delete:kj,emphasis:Cj,footnoteReference:Ej,heading:Tj,html:Aj,imageReference:Mj,image:Oj,inlineCode:_j,linkReference:Dj,link:Rj,listItem:Nj,list:Lj,paragraph:jj,root:Ij,strong:Bj,table:Uj,tableCell:Vj,tableRow:Hj,text:$j,thematicBreak:Fj,toml:Pf,yaml:Pf,definition:Pf,footnoteDefinition:Pf};function Pf(){}const nO=-1,Xp=0,du=1,Lh=2,$x=3,Fx=4,qx=5,Kx=6,rO=7,iO=8,rE=typeof self=="object"?self:globalThis,Kj=(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 Xp:case nO:return n(l,i);case du:{const c=n([],i);for(const u of l)c.push(r(u));return c}case Lh:{const c=n({},i);for(const[u,f]of l)c[r(u)]=r(f);return c}case $x:return n(new Date(l),i);case Fx:{const{source:c,flags:u}=l;return n(new RegExp(c,u),i)}case qx:{const c=n(new Map,i);for(const[u,f]of l)c.set(r(u),r(f));return c}case Kx:{const c=n(new Set,i);for(const u of l)c.add(r(u));return c}case rO:{const{name:c,message:u}=l;return n(new rE[c](u),i)}case iO: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 rE[s](l),i)};return r},iE=t=>Kj(new Map,t)(0),ra="",{toString:Yj}={},{keys:Wj}=Object,Qc=t=>{const e=typeof t;if(e!=="object"||!t)return[Xp,e];const n=Yj.call(t).slice(8,-1);switch(n){case"Array":return[du,ra];case"Object":return[Lh,ra];case"Date":return[$x,ra];case"RegExp":return[Fx,ra];case"Map":return[qx,ra];case"Set":return[Kx,ra];case"DataView":return[du,n]}return n.includes("Array")?[du,n]:n.includes("Error")?[rO,n]:[Lh,n]},$f=([t,e])=>t===Xp&&(e==="function"||e==="symbol"),Gj=(t,e,n,r)=>{const i=(l,c)=>{const u=r.push(l)-1;return n.set(c,u),u},s=l=>{if(n.has(l))return n.get(l);let[c,u]=Qc(l);switch(c){case Xp:{let h=l;switch(u){case"bigint":c=iO,h=l.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+u);h=null;break;case"undefined":return i([nO],l)}return i([c,h],l)}case du:{if(u){let g=l;return u==="DataView"?g=new Uint8Array(l.buffer):u==="ArrayBuffer"&&(g=new Uint8Array(l)),i([u,[...g]],l)}const h=[],m=i([c,h],l);for(const g of l)h.push(s(g));return m}case Lh:{if(u)switch(u){case"BigInt":return i([u,l.toString()],l);case"Boolean":case"Number":case"String":return i([u,l.valueOf()],l)}if(e&&"toJSON"in l)return s(l.toJSON());const h=[],m=i([c,h],l);for(const g of Wj(l))(t||!$f(Qc(l[g])))&&h.push([s(g),s(l[g])]);return m}case $x:return i([c,l.toISOString()],l);case Fx:{const{source:h,flags:m}=l;return i([c,{source:h,flags:m}],l)}case qx:{const h=[],m=i([c,h],l);for(const[g,b]of l)(t||!($f(Qc(g))||$f(Qc(b))))&&h.push([s(g),s(b)]);return m}case Kx:{const h=[],m=i([c,h],l);for(const g of l)(t||!$f(Qc(g)))&&h.push(s(g));return m}}const{message:f}=l;return i([c,{name:u,message:f}],l)};return s},sE=(t,{json:e,lossy:n}={})=>{const r=[];return Gj(!(e||n),!!e,new Map,r)(t),r},jh=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?iE(sE(t,e)):structuredClone(t):(t,e)=>iE(sE(t,e));function Zj(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 Jj(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function Xj(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||Zj,r=t.options.footnoteBackLabel||Jj,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",l=t.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let u=-1;for(;++u<t.footnoteOrder.length;){const f=t.footnoteById.get(t.footnoteOrder[u]);if(!f)continue;const h=t.all(f),m=String(f.identifier).toUpperCase(),g=Ka(m.toLowerCase());let b=0;const v=[],k=t.footnoteCounts.get(m);for(;k!==void 0&&++b<=k;){v.length>0&&v.push({type:"text",value:" "});let L=typeof n=="string"?n:n(u,b);typeof L=="string"&&(L={type:"text",value:L}),v.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,b),className:["data-footnote-backref"]},children:Array.isArray(L)?L:[L]})}const C=h[h.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const L=C.children[C.children.length-1];L&&L.type==="text"?L.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...v)}else h.push(...v);const E={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(h,!0)};t.patch(f,E),c.push(E)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...jh(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
58
+ `},{type:"element",tagName:"ol",properties:{},children:t.wrap(c,!0)},{type:"text",value:`
59
+ `}]}}const sO=(function(t){if(t==null)return nI;if(typeof t=="function")return Qp(t);if(typeof t=="object")return Array.isArray(t)?Qj(t):eI(t);if(typeof t=="string")return tI(t);throw new Error("Expected function, string, or object as test")});function Qj(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=sO(t[n]);return Qp(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function eI(t){const e=t;return Qp(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function tI(t){return Qp(e);function e(n){return n&&n.type===t}}function Qp(t){return e;function e(n,r,i){return!!(rI(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function nI(){return!0}function rI(t){return t!==null&&typeof t=="object"&&"type"in t}const oO=[],iI=!0,oE=!1,sI="skip";function oI(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=sO(i),l=r?-1:1;c(t,void 0,[])();function c(u,f,h){const m=u&&typeof u=="object"?u:{};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 ("+(u.type+(b?"<"+b+">":""))+")"})}return g;function g(){let b=oO,v,k,C;if((!e||s(u,f,h[h.length-1]||void 0))&&(b=lI(n(u,h)),b[0]===oE))return b;if("children"in u&&u.children){const E=u;if(E.children&&b[0]!==sI)for(k=(r?E.children.length:-1)+l,C=h.concat(E);k>-1&&k<E.children.length;){const L=E.children[k];if(v=c(L,k,C)(),v[0]===oE)return v;k=typeof v[1]=="number"?v[1]:k+l}}return b}}}function lI(t){return Array.isArray(t)?t:typeof t=="number"?[iI,t]:t==null?oO:[t]}function lO(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),oI(t,s,c,i);function c(u,f){const h=f[f.length-1],m=h?h.children.indexOf(u):void 0;return l(u,m,h)}}const gb={}.hasOwnProperty,aI={};function cI(t,e){const n=e||aI,r=new Map,i=new Map,s=new Map,l={...qj,...n.handlers},c={all:f,applyData:dI,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:l,one:u,options:n,patch:uI,wrap:hI};return lO(t,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const m=h.type==="definition"?r:i,g=String(h.identifier).toUpperCase();m.has(g)||m.set(g,h)}}),c;function u(h,m){const g=h.type,b=c.handlers[g];if(gb.call(c.handlers,g)&&b)return b(c,h,m);if(c.options.passThrough&&c.options.passThrough.includes(g)){if("children"in h){const{children:k,...C}=h,E=jh(C);return E.children=c.all(h),E}return jh(h)}return(c.options.unknownHandler||fI)(c,h,m)}function f(h){const m=[];if("children"in h){const g=h.children;let b=-1;for(;++b<g.length;){const v=c.one(g[b],h);if(v){if(b&&g[b-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=lE(v.value)),!Array.isArray(v)&&v.type==="element")){const k=v.children[0];k&&k.type==="text"&&(k.value=lE(k.value))}Array.isArray(v)?m.push(...v):m.push(v)}}}return m}}function uI(t,e){t.position&&(e.position=YL(t))}function dI(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,jh(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function fI(t,e){const n=e.data||{},r="value"in e&&!(gb.call(n,"hProperties")||gb.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 hI(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
60
+ `});++r<t.length;)r&&n.push({type:"text",value:`
61
+ `}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
62
+ `}),n}function lE(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function aE(t,e){const n=cI(t,e),r=n.one(t,void 0),i=Xj(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
63
+ `},i),s}function pI(t,e){return t&&"run"in t?async function(n,r){const i=aE(n,{file:r,...e});await t.run(i,r)}:function(n,r){return aE(n,{file:r,...t||e})}}function cE(t){if(t)throw t}var n0,uE;function mI(){if(uE)return n0;uE=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(f){return typeof Array.isArray=="function"?Array.isArray(f):e.call(f)==="[object Array]"},s=function(f){if(!f||e.call(f)!=="[object Object]")return!1;var h=t.call(f,"constructor"),m=f.constructor&&f.constructor.prototype&&t.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!h&&!m)return!1;var g;for(g in f);return typeof g>"u"||t.call(f,g)},l=function(f,h){n&&h.name==="__proto__"?n(f,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):f[h.name]=h.newValue},c=function(f,h){if(h==="__proto__")if(t.call(f,h)){if(r)return r(f,h).value}else return;return f[h]};return n0=function u(){var f,h,m,g,b,v,k=arguments[0],C=1,E=arguments.length,L=!1;for(typeof k=="boolean"&&(L=k,k=arguments[1]||{},C=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});C<E;++C)if(f=arguments[C],f!=null)for(h in f)m=c(k,h),g=c(f,h),k!==g&&(L&&g&&(s(g)||(b=i(g)))?(b?(b=!1,v=m&&i(m)?m:[]):v=m&&s(m)?m:{},l(k,{name:h,newValue:u(L,v,g)})):typeof g<"u"&&l(k,{name:h,newValue:g}));return k},n0}var gI=mI();const r0=Zp(gI);function yb(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 yI(){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(u,...f){const h=t[++s];let m=-1;if(u){l(u);return}for(;++m<i.length;)(f[m]===null||f[m]===void 0)&&(f[m]=i[m]);i=f,h?bI(h,c)(...f):l(null,...f)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function bI(t,e){let n;return r;function r(...l){const c=t.length>l.length;let u;c&&l.push(i);try{u=t.apply(this,l)}catch(f){const h=f;if(c&&n)throw h;return i(h)}c||(u&&u.then&&typeof u.then=="function"?u.then(s,i):u instanceof Error?i(u):s(u))}function i(l,...c){n||(n=!0,e(l,...c))}function s(l){i(null,l)}}const di={basename:xI,dirname:vI,extname:SI,join:wI,sep:"/"};function xI(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');hd(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 vI(t){if(hd(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 SI(t){hd(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 wI(...t){let e=-1,n;for(;++e<t.length;)hd(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":kI(n)}function kI(t){hd(t);const e=t.codePointAt(0)===47;let n=CI(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function CI(t,e){let n="",r=0,i=-1,s=0,l=-1,c,u;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(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),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 hd(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const EI={cwd:TI};function TI(){return"/"}function bb(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function AI(t){if(typeof t=="string")t=new URL(t);else if(!bb(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 MI(t)}function MI(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 i0=["history","path","basename","stem","extname","dirname"];class aO{constructor(e){let n;e?bb(e)?n={path:e}:typeof e=="string"||OI(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":EI.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<i0.length;){const s=i0[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)i0.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?di.basename(this.path):void 0}set basename(e){o0(e,"basename"),s0(e,"basename"),this.path=di.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?di.dirname(this.path):void 0}set dirname(e){dE(this.basename,"dirname"),this.path=di.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?di.extname(this.path):void 0}set extname(e){if(s0(e,"extname"),dE(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=di.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){bb(e)&&(e=AI(e)),o0(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?di.basename(this.path,this.extname):void 0}set stem(e){o0(e,"stem"),s0(e,"stem"),this.path=di.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 Nn(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 s0(t,e){if(t&&t.includes(di.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+di.sep+"`")}function o0(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function dE(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function OI(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const _I=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),DI={}.hasOwnProperty;class Yx extends _I{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=yI()}copy(){const e=new Yx;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(r0(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(c0("data",this.frozen),this.namespace[e]=n,this):DI.call(this.namespace,e)&&this.namespace[e]||void 0:e?(c0("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=Ff(e),r=this.parser||this.Parser;return l0("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),l0("process",this.parser||this.Parser),a0("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,l){const c=Ff(e),u=r.parse(c);r.run(u,c,function(h,m,g){if(h||!m||!g)return f(h);const b=m,v=r.stringify(b,g);zI(v)?g.value=v:g.result=v,f(h,g)});function f(h,m){h||!m?l(h):s?s(m):n(void 0,m)}}}processSync(e){let n=!1,r;return this.freeze(),l0("processSync",this.parser||this.Parser),a0("processSync",this.compiler||this.Compiler),this.process(e,i),hE("processSync","process",n),r;function i(s,l){n=!0,cE(s),r=l}}run(e,n,r){fE(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 u=Ff(n);i.run(e,u,f);function f(h,m,g){const b=m||e;h?c(h):l?l(b):r(void 0,b,g)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),hE("runSync","run",r),i;function s(l,c){cE(l),i=c,r=!0}}stringify(e,n){this.freeze();const r=Ff(n),i=this.compiler||this.Compiler;return a0("stringify",i),fE(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(c0("use",this.frozen),e!=null)if(typeof e=="function")u(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(f){if(typeof f=="function")u(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[h,...m]=f;u(h,m)}else l(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function l(f){if(!("plugins"in f)&&!("settings"in f))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(f.plugins),f.settings&&(i.settings=r0(!0,i.settings,f.settings))}function c(f){let h=-1;if(f!=null)if(Array.isArray(f))for(;++h<f.length;){const m=f[h];s(m)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function u(f,h){let m=-1,g=-1;for(;++m<r.length;)if(r[m][0]===f){g=m;break}if(g===-1)r.push([f,...h]);else if(h.length>0){let[b,...v]=h;const k=r[g][1];yb(k)&&yb(b)&&(b=r0(!0,k,b)),r[g]=[f,b,...v]}}}}const RI=new Yx().freeze();function l0(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function a0(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function c0(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 fE(t){if(!yb(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function hE(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Ff(t){return NI(t)?t:new aO(t)}function NI(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function zI(t){return typeof t=="string"||LI(t)}function LI(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const jI="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",pE=[],mE={allowDangerousHtml:!0},II=/^(https?|ircs?|mailto|xmpp)$/i,BI=[{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 UI(t){const e=HI(t),n=VI(t);return PI(e.runSync(e.parse(n),n),t)}function HI(t){const e=t.rehypePlugins||pE,n=t.remarkPlugins||pE,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...mE}:mE;return RI().use(xj).use(n).use(pI,r).use(e)}function VI(t){const e=t.children||"",n=new aO;return typeof e=="string"&&(n.value=e),n}function PI(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,l=e.skipHtml,c=e.unwrapDisallowed,u=e.urlTransform||$I;for(const h of BI)Object.hasOwn(e,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+jI+h.id,void 0);return lO(t,f),XL(t,{Fragment:S.Fragment,components:i,ignoreInvalidStyle:!0,jsx:S.jsx,jsxs:S.jsxs,passKeys:!0,passNode:!0});function f(h,m,g){if(h.type==="raw"&&g&&typeof m=="number")return l?g.children.splice(m,1):g.children[m]={type:"text",value:h.value},m;if(h.type==="element"){let b;for(b in Qy)if(Object.hasOwn(Qy,b)&&Object.hasOwn(h.properties,b)){const v=h.properties[b],k=Qy[b];(k===null||k.includes(h.tagName))&&(h.properties[b]=u(String(v||""),b,h))}}if(h.type==="element"){let b=n?!n.includes(h.tagName):s?s.includes(h.tagName):!1;if(!b&&r&&typeof m=="number"&&(b=!r(h,m,g)),b&&g&&typeof m=="number")return c&&h.children?g.children.splice(m,1,...h.children):g.children.splice(m,1),m}}}function $I(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||II.test(t.slice(0,e))?t:""}function Wx(t){return`${t}_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function FI(){return Wx("ann")}function qI(){return Wx("msg")}function KI(t){return Wx(t)}const Ur=()=>new Map,xb=t=>{const e=Ur();return t.forEach((n,r)=>{e.set(r,n)}),e},Ti=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},YI=(t,e)=>{const n=[];for(const[r,i]of t)n.push(e(i,r));return n},WI=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},Xo=()=>new Set,u0=t=>t[t.length-1],GI=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},io=Array.from,Gx=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},Zx=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},ZI=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},Ma=Array.isArray;class cO{constructor(){this._observers=Ur()}on(e,n){return Ti(this._observers,e,Xo).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 io((this._observers.get(e)||Ur()).values()).forEach(r=>r(...n))}destroy(){this._observers=Ur()}}const Xr=Math.floor,yh=Math.abs,is=(t,e)=>t<e?t:e,Qr=(t,e)=>t>e?t:e,uO=t=>t!==0?t<0:1/t<0,gE=1,yE=2,d0=4,f0=8,Du=32,ss=64,Bn=128,JI=1<<29,em=31,vb=63,Fo=127,XI=2147483647,Ih=Number.MAX_SAFE_INTEGER,bE=Number.MIN_SAFE_INTEGER,QI=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&Xr(t)===t),dO=String.fromCharCode,eB=t=>t.toLowerCase(),tB=/^\s*/g,nB=t=>t.replace(tB,""),rB=/([A-Z])/g,xE=(t,e)=>nB(t.replace(rB,n=>`${e}${eB(n)}`)),iB=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},Ru=typeof TextEncoder<"u"?new TextEncoder:null,sB=t=>Ru.encode(t),oB=Ru?sB:iB;let fu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});fu&&fu.decode(new Uint8Array).length===1&&(fu=null);const lB=(t,e)=>ZI(e,()=>t).join("");let pd=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}};const md=()=>new pd,aB=t=>{const e=md();return t(e),Jr(e)},cB=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},Jr=t=>{const e=new Uint8Array(cB(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},uB=(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(Qr(n,e)*2),t.cpos=0)},rn=(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},Sb=rn,Xe=(t,e)=>{for(;e>Fo;)rn(t,Bn|Fo&e),e=Xr(e/128);rn(t,Fo&e)},Jx=(t,e)=>{const n=uO(e);for(n&&(e=-e),rn(t,(e>vb?Bn:0)|(n?ss:0)|vb&e),e=Xr(e/64);e>0;)rn(t,(e>Fo?Bn:0)|Fo&e),e=Xr(e/128)},wb=new Uint8Array(3e4),dB=wb.length/3,fB=(t,e)=>{if(e.length<dB){const n=Ru.encodeInto(e,wb).written||0;Xe(t,n);for(let r=0;r<n;r++)rn(t,wb[r])}else hr(t,oB(e))},hB=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;Xe(t,r);for(let i=0;i<r;i++)rn(t,n.codePointAt(i))},ya=Ru&&Ru.encodeInto?fB:hB,tm=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=is(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(Qr(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},hr=(t,e)=>{Xe(t,e.byteLength),tm(t,e)},Xx=(t,e)=>{uB(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},pB=(t,e)=>Xx(t,4).setFloat32(0,e,!1),mB=(t,e)=>Xx(t,8).setFloat64(0,e,!1),gB=(t,e)=>Xx(t,8).setBigInt64(0,e,!1),vE=new DataView(new ArrayBuffer(4)),yB=t=>(vE.setFloat32(0,t),vE.getFloat32(0)===t),Oa=(t,e)=>{switch(typeof e){case"string":rn(t,119),ya(t,e);break;case"number":QI(e)&&yh(e)<=XI?(rn(t,125),Jx(t,e)):yB(e)?(rn(t,124),pB(t,e)):(rn(t,123),mB(t,e));break;case"bigint":rn(t,122),gB(t,e);break;case"object":if(e===null)rn(t,126);else if(Ma(e)){rn(t,117),Xe(t,e.length);for(let n=0;n<e.length;n++)Oa(t,e[n])}else if(e instanceof Uint8Array)rn(t,116),hr(t,e);else{rn(t,118);const n=Object.keys(e);Xe(t,n.length);for(let r=0;r<n.length;r++){const i=n[r];ya(t,i),Oa(t,e[i])}}break;case"boolean":rn(t,e?120:121);break;default:rn(t,127)}};class SE extends pd{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&Xe(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const wE=t=>{t.count>0&&(Jx(t.encoder,t.count===1?t.s:-t.s),t.count>1&&Xe(t.encoder,t.count-2))};class bh{constructor(){this.encoder=new pd,this.s=0,this.count=0}write(e){this.s===e?this.count++:(wE(this),this.count=1,this.s=e)}toUint8Array(){return wE(this),Jr(this.encoder)}}const kE=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);Jx(t.encoder,e),t.count>1&&Xe(t.encoder,t.count-2)}};class h0{constructor(){this.encoder=new pd,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(kE(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return kE(this),Jr(this.encoder)}}class bB{constructor(){this.sarr=[],this.s="",this.lensE=new bh}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 pd;return this.sarr.push(this.s),this.s="",ya(e,this.sarr.join("")),tm(e,this.lensE.toUint8Array()),Jr(e)}}const Si=t=>new Error(t),Hr=()=>{throw Si("Method unimplemented")},_n=()=>{throw Si("Unexpected case")},fO=Si("Unexpected end of array"),hO=Si("Integer out of Range");let nm=class{constructor(e){this.arr=e,this.pos=0}};const Ya=t=>new nm(t),xB=t=>t.pos!==t.arr.length,vB=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},pr=t=>vB(t,qe(t)),_a=t=>t.arr[t.pos++],qe=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&Fo)*n,n*=128,i<Bn)return e;if(e>Ih)throw hO}throw fO},Qx=t=>{let e=t.arr[t.pos++],n=e&vb,r=64;const i=(e&ss)>0?-1:1;if((e&Bn)===0)return i*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&Fo)*r,r*=128,e<Bn)return i*n;if(n>Ih)throw hO}throw fO},SB=t=>{let e=qe(t);if(e===0)return"";{let n=String.fromCodePoint(_a(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(_a(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))}},wB=t=>fu.decode(pr(t)),ba=fu?wB:SB,e1=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},kB=t=>e1(t,4).getFloat32(0,!1),CB=t=>e1(t,8).getFloat64(0,!1),EB=t=>e1(t,8).getBigInt64(0,!1),TB=[t=>{},t=>null,Qx,kB,CB,EB,t=>!1,t=>!0,ba,t=>{const e=qe(t),n={};for(let r=0;r<e;r++){const i=ba(t);n[i]=Nu(t)}return n},t=>{const e=qe(t),n=[];for(let r=0;r<e;r++)n.push(Nu(t));return n},pr],Nu=t=>TB[127-_a(t)](t);class CE extends nm{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),xB(this)?this.count=qe(this)+1:this.count=-1),this.count--,this.s}}class xh extends nm{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=Qx(this);const e=uO(this.s);this.count=1,e&&(this.s=-this.s,this.count=qe(this)+2)}return this.count--,this.s}}class p0 extends nm{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=Qx(this),n=e&1;this.diff=Xr(e/2),this.count=1,n&&(this.count=qe(this)+2)}return this.s+=this.diff,this.count--,this.s}}class AB{constructor(e){this.decoder=new xh(e),this.str=ba(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 MB=crypto.getRandomValues.bind(crypto),OB=Math.random,pO=()=>MB(new Uint32Array(1))[0],_B=t=>t[Xr(OB()*t.length)],DB="10000000-1000-4000-8000"+-1e11,RB=()=>DB.replace(/[018]/g,t=>(t^pO()&15>>t/4).toString(16)),NB=Date.now,EE=t=>new Promise(t);Promise.all.bind(Promise);const TE=t=>t===void 0?null:t;class zB{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let mO=new zB,LB=!0;try{typeof localStorage<"u"&&localStorage&&(mO=localStorage,LB=!1)}catch{}const jB=mO,zu=Symbol("Equality"),gO=(t,e)=>{var n;return t===e||!!((n=t==null?void 0:t[zu])!=null&&n.call(t,e))||!1},IB=t=>typeof t=="object",BB=Object.assign,yO=Object.keys,UB=(t,e)=>{for(const n in t)e(t[n],n)},Bh=t=>yO(t).length,HB=t=>{for(const e in t)return!1;return!0},Wa=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},t1=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),VB=(t,e)=>t===e||Bh(t)===Bh(e)&&Wa(t,(n,r)=>(n!==void 0||t1(e,r))&&gO(e[r],n)),PB=Object.freeze,bO=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&bO(t[e])}return PB(t)},n1=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&n1(t,e,n+1)}},$B=t=>t,vh=(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[zu]!=null)return t[zu](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)||!vh(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(Bh(t)!==Bh(e))return!1;for(const n in t)if(!t1(t,n)||!vh(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(!vh(t[n],e[n]))return!1;break;default:return!1}return!0},FB=(t,e)=>e.includes(t);var xO={};const Da=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",vO=typeof window<"u"&&typeof document<"u"&&!Da;let ui;const qB=()=>{if(ui===void 0)if(Da){ui=Ur();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&ui.set(e,""),e=r):e!==null&&(ui.set(e,r),e=null)}e!==null&&ui.set(e,"")}else typeof location=="object"?(ui=Ur(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");ui.set(`--${xE(e,"-")}`,n),ui.set(`-${xE(e,"-")}`,n)}})):ui=Ur();return ui},kb=t=>qB().has(t),Uh=t=>TE(Da?xO[t.toUpperCase().replaceAll("-","_")]:jB.getItem(t)),SO=t=>kb("--"+t)||Uh(t)!==null,KB=SO("production"),YB=Da&&FB(xO.FORCE_COLOR,["true","1","2"]),WB=YB||!kb("--no-colors")&&!SO("no-color")&&(!Da||process.stdout.isTTY)&&(!Da||kb("--color")||Uh("COLORTERM")!==null||(Uh("TERM")||"").includes("color")),GB=t=>new Uint8Array(t),ZB=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=dO(t[n]);return btoa(e)},JB=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),XB=vO?ZB:JB,QB=t=>{const e=GB(t.byteLength);return e.set(t),e},e6=t=>aB(e=>Oa(e,t));class t6{constructor(e,n){this.left=e,this.right=n}}const Gi=(t,e)=>new t6(t,e),AE=t=>t.next()>=.5,m0=(t,e,n)=>Xr(t.next()*(n+1-e)+e),wO=(t,e,n)=>Xr(t.next()*(n+1-e)+e),r1=(t,e,n)=>wO(t,e,n),n6=t=>dO(r1(t,97,122)),r6=(t,e=0,n=20)=>{const r=r1(t,e,n);let i="";for(let s=0;s<r;s++)i+=n6(t);return i},g0=(t,e)=>e[r1(t,0,e.length-1)],i6=Symbol("0schema");class s6{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(lB(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
64
+ `)}}const Cb=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[zu]?gO(t,e):Ma(t)?Gx(t,n=>Zx(e,r=>Cb(n,r))):IB(t)?Wa(t,(n,r)=>Cb(n,e[r])):!1;var ob;let Pn=(ob=class{extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),Cb(n,r)}equals(e){return this.constructor===e.constructor&&vh(this.shape,e.shape)}[i6](){return!0}[zu](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){Hr()}get nullable(){return Ga(this,lm)}get optional(){return new EO(this)}cast(e){return ME(e,this),e}expect(e){return ME(e,this),e}},Hf(ob,"_dilutes",!1),ob);class i1 extends Pn{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 Gt=(t,e=null)=>new i1(t,e);Gt(i1);class s1 extends Pn{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 hn=t=>new s1(t);Gt(s1);class rm extends Pn{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 im=(...t)=>new rm(t),kO=Gt(rm),o6=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),CO=t=>{if(Ra.check(t))return[o6(t)];if(kO.check(t))return t.shape.map(e=>e+"");if(zO.check(t))return["[+-]?\\d+.?\\d*"];if(LO.check(t))return[".*"];if(Vh.check(t))return t.shape.map(CO).flat(1);_n()};class l6 extends Pn{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(CO).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}}Gt(l6);const a6=Symbol("optional");class EO extends Pn{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[a6](){return!0}}const c6=Gt(EO);class u6 extends Pn{check(e,n){return n==null||n.extend(null,"never",typeof e),!1}}Gt(u6);const Gp=class Gp extends Pn{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}get partial(){return new Gp(this.shape,!0)}check(e,n){return e==null?(n==null||n.extend(null,"object","null"),!1):Wa(this.shape,(r,i)=>{const s=this._isPartial&&!t1(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})}};Hf(Gp,"_dilutes",!0);let Hh=Gp;const d6=t=>new Hh(t),f6=Gt(Hh),h6=hn(t=>t!=null&&(t.constructor===Object||t.constructor==null));class TO extends Pn{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&Wa(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 AO=(t,e)=>new TO(t,e),p6=Gt(TO);class MO extends Pn{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&Wa(this.shape,(r,i)=>{const s=r.check(e[i],n);return!s&&(n==null||n.extend(i.toString(),"Tuple",typeof r)),s})}}const m6=(...t)=>new MO(t);Gt(MO);class OO extends Pn{constructor(e){super(),this.shape=e.length===1?e[0]:new sm(e)}check(e,n){const r=Ma(e)&&Gx(e,i=>this.shape.check(i));return!r&&(n==null||n.extend(null,"Array","")),r}}const _O=(...t)=>new OO(t),g6=Gt(OO),y6=hn(t=>Ma(t));class DO extends Pn{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 b6=(t,e=null)=>new DO(t,e);Gt(DO);const x6=b6(Pn);class v6 extends Pn{constructor(e){super(),this.len=e.length-1,this.args=m6(...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 S6=Gt(v6),w6=hn(t=>typeof t=="function");class k6 extends Pn{constructor(e){super(),this.shape=e}check(e,n){const r=Gx(this.shape,i=>i.check(e,n));return!r&&(n==null||n.extend(null,"Intersectinon",typeof e)),r}}Gt(k6,t=>t.shape.length>0);class sm extends Pn{constructor(e){super(),this.shape=e}check(e,n){const r=Zx(this.shape,i=>i.check(e,n));return n==null||n.extend(null,"Union",typeof e),r}}Hf(sm,"_dilutes",!0);const Ga=(...t)=>t.findIndex(e=>Vh.check(e))>=0?Ga(...t.map(e=>Lu(e)).map(e=>Vh.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new sm(t),Vh=Gt(sm),RO=()=>!0,Ph=hn(RO),C6=Gt(s1,t=>t.shape===RO),o1=hn(t=>typeof t=="bigint"),E6=hn(t=>t===o1),NO=hn(t=>typeof t=="symbol");hn(t=>t===NO);const xa=hn(t=>typeof t=="number"),zO=hn(t=>t===xa),Ra=hn(t=>typeof t=="string"),LO=hn(t=>t===Ra),om=hn(t=>typeof t=="boolean"),T6=hn(t=>t===om),jO=im(void 0);Gt(rm,t=>t.shape.length===1&&t.shape[0]===void 0);im(void 0);const lm=im(null),A6=Gt(rm,t=>t.shape.length===1&&t.shape[0]===null);Gt(Uint8Array);Gt(i1,t=>t.shape===Uint8Array);const M6=Ga(xa,Ra,lm,jO,o1,om,NO);(()=>{const t=_O(Ph),e=AO(Ra,Ph),n=Ga(xa,Ra,lm,om,t,e);return t.shape=n,e.shape.values=n,n})();const Lu=t=>{if(x6.check(t))return t;if(h6.check(t)){const e={};for(const n in t)e[n]=Lu(t[n]);return d6(e)}else{if(y6.check(t))return Ga(...t.map(Lu));if(M6.check(t))return im(t);if(w6.check(t))return Gt(t)}_n()},ME=KB?()=>{}:(t,e)=>{const n=new s6;if(!e.check(t,n))throw Si(`Expected value to be of type ${e.constructor.name}.
65
+ ${n.toString()}`)};class O6{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:Lu(e),h:n}),this}else(e){return this.if(Ph,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 Si("Unhandled pattern")}}}const _6=t=>new O6(t),IO=_6(Ph).if(zO,(t,e)=>m0(e,bE,Ih)).if(LO,(t,e)=>r6(e)).if(T6,(t,e)=>AE(e)).if(E6,(t,e)=>BigInt(m0(e,bE,Ih))).if(Vh,(t,e)=>ia(e,g0(e,t.shape))).if(f6,(t,e)=>{const n={};for(const r in t.shape){let i=t.shape[r];if(c6.check(i)){if(AE(e))continue;i=i.shape}n[r]=IO(i,e)}return n}).if(g6,(t,e)=>{const n=[],r=wO(e,0,42);for(let i=0;i<r;i++)n.push(ia(e,t.shape));return n}).if(kO,(t,e)=>g0(e,t.shape)).if(A6,(t,e)=>null).if(S6,(t,e)=>{const n=ia(e,t.res);return()=>n}).if(C6,(t,e)=>ia(e,g0(e,[xa,Ra,lm,jO,o1,om,_O(xa),AO(Ga("a","b","c"),xa)]))).if(p6,(t,e)=>{const n={},r=m0(e,0,3);for(let i=0;i<r;i++){const s=ia(e,t.shape.keys),l=ia(e,t.shape.values);n[s]=l}return n}).done(),ia=(t,e)=>IO(Lu(e),t),gd=typeof document<"u"?document:{};hn(t=>t.nodeType===L6);typeof DOMParser<"u"&&new DOMParser;hn(t=>t.nodeType===R6);hn(t=>t.nodeType===N6);const D6=t=>YI(t,(e,n)=>`${n}:${e};`).join(""),R6=gd.ELEMENT_NODE,N6=gd.TEXT_NODE,z6=gd.DOCUMENT_NODE,L6=gd.DOCUMENT_FRAGMENT_NODE;hn(t=>t.nodeType===z6);const j6=t=>class{constructor(n){this._=n}destroy(){t(this._)}},I6=j6(clearTimeout),l1=(t,e)=>new I6(setTimeout(e,t)),ds=Symbol,BO=ds(),UO=ds(),B6=ds(),U6=ds(),H6=ds(),HO=ds(),V6=ds(),a1=ds(),P6=ds(),$6=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},F6={[BO]:Gi("font-weight","bold"),[UO]:Gi("font-weight","normal"),[B6]:Gi("color","blue"),[H6]:Gi("color","green"),[U6]:Gi("color","grey"),[HO]:Gi("color","red"),[V6]:Gi("color","purple"),[a1]:Gi("color","orange"),[P6]:Gi("color","black")},q6=t=>{var l;t.length===1&&((l=t[0])==null?void 0:l.constructor)===Function&&(t=t[0]());const e=[],n=[],r=Ur();let i=[],s=0;for(;s<t.length;s++){const c=t[s],u=F6[c];if(u!==void 0)r.set(u.left,u.right);else{if(c===void 0)break;if(c.constructor===String||c.constructor===Number){const f=D6(r);s>0||f.length>0?(e.push("%c"+c),n.push(f)):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},VO=WB?q6:$6,K6=(...t)=>{console.log(...VO(t)),$O.forEach(e=>e.print(t))},PO=(...t)=>{console.warn(...VO(t)),t.unshift(a1),$O.forEach(e=>e.print(t))},$O=Xo(),FO=t=>({[Symbol.iterator](){return this},next:t}),Y6=(t,e)=>FO(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),y0=(t,e)=>FO(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class am{constructor(e,n){this.clock=e,this.len=n}}class Za{constructor(){this.clients=new Map}}const so=(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 u=0,f=r[u];u<r.length&&f.clock<c;f=r[++u])i_(t,s,f.clock,f.len,n)}}),W6=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const i=Xr((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},Ja=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&W6(n,e.clock)!==null},c1=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 am(i.clock,Qr(i.len,s.clock+s.len-i.clock)):(r<n&&(e[r]=s),r++)}e.length=r})},Eb=t=>{const e=new Za;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++)GI(s,t[l].clients.get(i)||[]);e.clients.set(i,s)}});return c1(e),e},ju=(t,e,n,r)=>{Ti(t.clients,e,()=>[]).push(new am(n,r))},qO=()=>new Za,KO=t=>{const e=qO();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 u=l.length;if(s+1<n.length)for(let f=n[s+1];s+1<n.length&&f.deleted;f=n[++s+1])u+=f.length;i.push(new am(c,u))}}i.length>0&&e.clients.set(r,i)}),e},Xa=(t,e)=>{Xe(t.restEncoder,e.clients.size),io(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),Xe(t.restEncoder,n);const i=r.length;Xe(t.restEncoder,i);for(let s=0;s<i;s++){const l=r[s];t.writeDsClock(l.clock),t.writeDsLen(l.len)}})},u1=t=>{const e=new Za,n=qe(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const i=qe(t.restDecoder),s=qe(t.restDecoder);if(s>0){const l=Ti(e.clients,i,()=>[]);for(let c=0;c<s;c++)l.push(new am(t.readDsClock(),t.readDsLen()))}}return e},OE=(t,e,n)=>{const r=new Za,i=qe(t.restDecoder);for(let s=0;s<i;s++){t.resetDsCurVal();const l=qe(t.restDecoder),c=qe(t.restDecoder),u=n.clients.get(l)||[],f=Ht(n,l);for(let h=0;h<c;h++){const m=t.readDsClock(),g=m+t.readDsLen();if(m<f){f<g&&ju(r,l,f,g-f);let b=ei(u,m),v=u[b];for(!v.deleted&&v.id.clock<m&&(u.splice(b+1,0,Gh(e,v,m-v.id.clock)),b++);b<u.length&&(v=u[b++],v.id.clock<g);)v.deleted||(g<v.id.clock+v.length&&u.splice(b,0,Gh(e,v,g-v.id.clock)),v.delete(e))}else ju(r,l,m,g-m)}}if(r.clients.size>0){const s=new Qo;return Xe(s.restEncoder,0),Xa(s,r),s.toUint8Array()}return null},YO=pO;class wi extends cO{constructor({guid:e=RB(),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=YO(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new n_,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=EE(f=>{this.on("load",()=>{this.isLoaded=!0,f(this)})});const u=()=>EE(f=>{const h=m=>{(m===void 0||m===!0)&&(this.off("sync",h),f())};this.on("sync",h)});this.on("sync",f=>{f===!1&&this.isSynced&&(this.whenSynced=u()),this.isSynced=f===void 0||f===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=u()}load(){const e=this._item;e!==null&&!this.shouldLoad&&gt(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(io(this.subdocs).map(e=>e.guid))}transact(e,n=null){return gt(this,e,n)}get(e,n=an){const r=Ti(this.share,e,()=>{const s=new n;return s._integrate(this,null),s}),i=r.constructor;if(n!==an&&i!==n)if(i===an){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,wa)}getText(e=""){return this.get(e,oo)}getMap(e=""){return this.get(e,za)}getXmlElement(e=""){return this.get(e,ln)}getXmlFragment(e=""){return this.get(e,el)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,io(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new wi({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,gt(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 WO{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return qe(this.restDecoder)}readDsLen(){return qe(this.restDecoder)}}class GO extends WO{readLeftID(){return Be(qe(this.restDecoder),qe(this.restDecoder))}readRightID(){return Be(qe(this.restDecoder),qe(this.restDecoder))}readClient(){return qe(this.restDecoder)}readInfo(){return _a(this.restDecoder)}readString(){return ba(this.restDecoder)}readParentInfo(){return qe(this.restDecoder)===1}readTypeRef(){return qe(this.restDecoder)}readLen(){return qe(this.restDecoder)}readAny(){return Nu(this.restDecoder)}readBuf(){return QB(pr(this.restDecoder))}readJSON(){return JSON.parse(ba(this.restDecoder))}readKey(){return ba(this.restDecoder)}}class G6{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=qe(this.restDecoder),this.dsCurrVal}readDsLen(){const e=qe(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Na extends G6{constructor(e){super(e),this.keys=[],qe(e),this.keyClockDecoder=new p0(pr(e)),this.clientDecoder=new xh(pr(e)),this.leftClockDecoder=new p0(pr(e)),this.rightClockDecoder=new p0(pr(e)),this.infoDecoder=new CE(pr(e),_a),this.stringDecoder=new AB(pr(e)),this.parentInfoDecoder=new CE(pr(e),_a),this.typeRefDecoder=new xh(pr(e)),this.lenDecoder=new xh(pr(e))}readLeftID(){return new va(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new va(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 Nu(this.restDecoder)}readBuf(){return pr(this.restDecoder)}readJSON(){return Nu(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 ZO{constructor(){this.restEncoder=md()}toUint8Array(){return Jr(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){Xe(this.restEncoder,e)}writeDsLen(e){Xe(this.restEncoder,e)}}class yd extends ZO{writeLeftID(e){Xe(this.restEncoder,e.client),Xe(this.restEncoder,e.clock)}writeRightID(e){Xe(this.restEncoder,e.client),Xe(this.restEncoder,e.clock)}writeClient(e){Xe(this.restEncoder,e)}writeInfo(e){Sb(this.restEncoder,e)}writeString(e){ya(this.restEncoder,e)}writeParentInfo(e){Xe(this.restEncoder,e?1:0)}writeTypeRef(e){Xe(this.restEncoder,e)}writeLen(e){Xe(this.restEncoder,e)}writeAny(e){Oa(this.restEncoder,e)}writeBuf(e){hr(this.restEncoder,e)}writeJSON(e){ya(this.restEncoder,JSON.stringify(e))}writeKey(e){ya(this.restEncoder,e)}}class JO{constructor(){this.restEncoder=md(),this.dsCurrVal=0}toUint8Array(){return Jr(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,Xe(this.restEncoder,n)}writeDsLen(e){e===0&&_n(),Xe(this.restEncoder,e-1),this.dsCurrVal+=e}}class Qo extends JO{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new h0,this.clientEncoder=new bh,this.leftClockEncoder=new h0,this.rightClockEncoder=new h0,this.infoEncoder=new SE(Sb),this.stringEncoder=new bB,this.parentInfoEncoder=new SE(Sb),this.typeRefEncoder=new bh,this.lenEncoder=new bh}toUint8Array(){const e=md();return Xe(e,0),hr(e,this.keyClockEncoder.toUint8Array()),hr(e,this.clientEncoder.toUint8Array()),hr(e,this.leftClockEncoder.toUint8Array()),hr(e,this.rightClockEncoder.toUint8Array()),hr(e,Jr(this.infoEncoder)),hr(e,this.stringEncoder.toUint8Array()),hr(e,Jr(this.parentInfoEncoder)),hr(e,this.typeRefEncoder.toUint8Array()),hr(e,this.lenEncoder.toUint8Array()),tm(e,Jr(this.restEncoder)),Jr(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){Oa(this.restEncoder,e)}writeBuf(e){hr(this.restEncoder,e)}writeJSON(e){Oa(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 Z6=(t,e,n,r)=>{r=Qr(r,e[0].id.clock);const i=ei(e,r);Xe(t.restEncoder,e.length-i),t.writeClient(n),Xe(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)},d1=(t,e,n)=>{const r=new Map;n.forEach((i,s)=>{Ht(e,s)>i&&r.set(s,i)}),bd(e).forEach((i,s)=>{n.has(s)||r.set(s,0)}),Xe(t.restEncoder,r.size),io(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{Z6(t,e.clients.get(i),i,s)})},J6=(t,e)=>{const n=Ur(),r=qe(t.restDecoder);for(let i=0;i<r;i++){const s=qe(t.restDecoder),l=new Array(s),c=t.readClient();let u=qe(t.restDecoder);n.set(c,{i:0,refs:l});for(let f=0;f<s;f++){const h=t.readInfo();switch(em&h){case 0:{const m=t.readLen();l[f]=new jr(Be(c,u),m),u+=m;break}case 10:{const m=qe(t.restDecoder);l[f]=new Ir(Be(c,u),m),u+=m;break}default:{const m=(h&(ss|Bn))===0,g=new St(Be(c,u),null,(h&Bn)===Bn?t.readLeftID():null,null,(h&ss)===ss?t.readRightID():null,m?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,m&&(h&Du)===Du?t.readString():null,T_(t,h));l[f]=g,u+=g.length}}}}return n},X6=(t,e,n)=>{const r=[];let i=io(n.keys()).sort((b,v)=>b-v);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 n_,u=new Map,f=(b,v)=>{const k=u.get(b);(k==null||k>v)&&u.set(b,v)};let h=l.refs[l.i++];const m=new Map,g=()=>{for(const b of r){const v=b.id.client,k=n.get(v);k?(k.i--,c.clients.set(v,k.refs.slice(k.i)),n.delete(v),k.i=0,k.refs=[]):c.clients.set(v,[b]),i=i.filter(C=>C!==v)}r.length=0};for(;;){if(h.constructor!==Ir){const v=Ti(m,h.id.client,()=>Ht(e,h.id.client))-h.id.clock;if(v<0)r.push(h),f(h.id.client,h.id.clock-1),g();else{const k=h.getMissing(t,e);if(k!==null){r.push(h);const C=n.get(k)||{refs:[],i:0};if(C.refs.length===C.i)f(k,Ht(e,k)),g();else{h=C.refs[C.i++];continue}}else(v===0||v<h.length)&&(h.integrate(t,v),m.set(h.id.client,h.id.clock+h.length))}}if(r.length>0)h=r.pop();else if(l!==null&&l.i<l.refs.length)h=l.refs[l.i++];else{if(l=s(),l===null)break;h=l.refs[l.i++]}}if(c.clients.size>0){const b=new Qo;return d1(b,c,new Map),Xe(b.restEncoder,0),{missing:u,update:b.toUint8Array()}}return null},Q6=(t,e)=>d1(t,e.doc.store,e.beforeState),e5=(t,e,n,r=new Na(t))=>gt(e,i=>{i.local=!1;let s=!1;const l=i.doc,c=l.store,u=J6(r,l),f=X6(i,c,u),h=c.pendingStructs;if(h){for(const[g,b]of h.missing)if(b<Ht(c,g)){s=!0;break}if(f){for(const[g,b]of f.missing){const v=h.missing.get(g);(v==null||v>b)&&h.missing.set(g,b)}h.update=Fh([h.update,f.update])}}else c.pendingStructs=f;const m=OE(r,i,c);if(c.pendingDs){const g=new Na(Ya(c.pendingDs));qe(g.restDecoder);const b=OE(g,i,c);m&&b?c.pendingDs=Fh([m,b]):c.pendingDs=m||b}else c.pendingDs=m;if(s){const g=c.pendingStructs.update;c.pendingStructs=null,$h(i.doc,g)}},n,!1),$h=(t,e,n,r=Na)=>{const i=Ya(e);e5(i,t,n,new r(i))},t5=(t,e,n)=>$h(t,e,n,GO),n5=(t,e,n=new Map)=>{d1(t,e.store,n),Xa(t,KO(e.store))},r5=(t,e=new Uint8Array([0]),n=new Qo)=>{const r=XO(e);n5(n,t,r);const i=[n.toUint8Array()];if(t.store.pendingDs&&i.push(t.store.pendingDs),t.store.pendingStructs&&i.push(w5(t.store.pendingStructs.update,e)),i.length>1){if(n.constructor===yd)return v5(i.map((s,l)=>l===0?s:C5(s)));if(n.constructor===Qo)return Fh(i)}return i[0]},i5=(t,e)=>r5(t,e,new yd),s5=t=>{const e=new Map,n=qe(t.restDecoder);for(let r=0;r<n;r++){const i=qe(t.restDecoder),s=qe(t.restDecoder);e.set(i,s)}return e},XO=t=>s5(new WO(Ya(t))),QO=(t,e)=>(Xe(t.restEncoder,e.size),io(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{Xe(t.restEncoder,n),Xe(t.restEncoder,r)}),t),o5=(t,e)=>QO(t,bd(e.store)),l5=(t,e=new JO)=>(t instanceof Map?QO(e,t):o5(e,t),e.toUint8Array()),a5=t=>l5(t,new ZO);class c5{constructor(){this.l=[]}}const _E=()=>new c5,DE=(t,e)=>t.l.push(e),RE=(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.")},e_=(t,e,n)=>n1(t.l,[e,n]);class va{constructor(e,n){this.client=e,this.clock=n}}const fa=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,Be=(t,e)=>new va(t,e),Iu=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw _n()},Bu=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class Uu{constructor(e,n,r,i=0){this.type=e,this.tname=n,this.item=r,this.assoc=i}}const qo=t=>new Uu(t.type==null?null:Be(t.type.client,t.type.clock),t.tname??null,t.item==null?null:Be(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class u5{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const d5=(t,e,n=0)=>new u5(t,e,n),qf=(t,e,n)=>{let r=null,i=null;return t._item===null?i=Iu(t):r=Be(t._item.id.client,t._item.id.clock),new Uu(r,i,e,n)},b0=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return qf(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return qf(t,Be(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return qf(t,r.lastId,n);r=r.right}return qf(t,null,n)},f5=(t,e)=>{const n=Sa(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},Tb=(t,e,n=!0)=>{const r=e.store,i=t.item,s=t.type,l=t.tname,c=t.assoc;let u=null,f=0;if(i!==null){if(Ht(r,i.client)<=i.clock)return null;const h=n?_b(r,i):f5(r,i),m=h.item;if(!(m instanceof St))return null;if(u=m.parent,u._item===null||!u._item.deleted){f=m.deleted||!m.countable?0:h.diff+(c>=0?0:1);let g=m.left;for(;g!==null;)!g.deleted&&g.countable&&(f+=g.length),g=g.left}}else{if(l!==null)u=e.get(l);else if(s!==null){if(Ht(r,s.client)<=s.clock)return null;const{item:h}=n?_b(r,s):{item:Sa(r,s)};if(h instanceof St&&h.content instanceof ni)u=h.content.type;else return null}else throw _n();c>=0?f=u._length:f=0}return d5(u,f,t.assoc)},NE=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&fa(t.item,e.item)&&fa(t.type,e.type)&&t.assoc===e.assoc;class f1{constructor(e,n){this.ds=e,this.sv=n}}const t_=(t,e)=>new f1(t,e),x0=t=>t_(KO(t.store),bd(t.store)),jo=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!Ja(e.ds,t.id),Ab=(t,e)=>{const n=Ti(t.meta,Ab,Xo),r=t.doc.store;n.has(e)||(e.sv.forEach((i,s)=>{i<Ht(r,s)&&er(t,Be(s,i))}),so(t,e.ds,i=>{}),n.add(e))};class n_{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const bd=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},Ht=(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},r_=(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 _n()}n.push(e)},ei=(t,e)=>{let n=0,r=t.length-1,i=t[r],s=i.id.clock;if(s===e)return r;let l=Xr(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=Xr((n+r)/2)}throw _n()},h5=(t,e)=>{const n=t.clients.get(e.client);return n[ei(n,e.clock)]},Sa=h5,Mb=(t,e,n)=>{const r=ei(e,n),i=e[r];return i.id.clock<n&&i instanceof St?(e.splice(r+1,0,Gh(t,i,n-i.id.clock)),r+1):r},er=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[Mb(t,n,e.clock)]},zE=(t,e,n)=>{const r=e.clients.get(n.client),i=ei(r,n.clock),s=r[i];return n.clock!==s.id.clock+s.length-1&&s.constructor!==jr&&r.splice(i+1,0,Gh(t,s,n.clock-s.id.clock+1)),s},p5=(t,e,n)=>{const r=t.clients.get(e.id.client);r[ei(r,e.id.clock)]=n},i_=(t,e,n,r,i)=>{if(r===0)return;const s=n+r;let l=Mb(t,e,n),c;do c=e[l++],s<c.id.clock+c.length&&Mb(t,e,s),i(c);while(l<e.length&&e[l].id.clock<s)};let m5=class{constructor(e,n,r){this.doc=e,this.deleteSet=new Za,this.beforeState=bd(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 LE=(t,e)=>e.deleteSet.clients.size===0&&!WI(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(c1(e.deleteSet),Q6(t,e),Xa(t,e.deleteSet),!0),jE=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&Ti(t.changed,e,Xo).add(n)},Sh=(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 St&&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},g5=(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],u=c.clock+c.len;for(let f=ei(s,c.clock),h=s[f];f<s.length&&h.id.clock<u;h=s[++f]){const m=s[f];if(c.clock+c.len<=m.id.clock)break;m instanceof St&&m.deleted&&!m.keep&&n(m)&&m.gc(e,!1)}}}},y5=(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=is(i.length-1,1+ei(i,l.clock+l.len-1));for(let u=c,f=i[u];u>0&&f.id.clock>=l.clock;f=i[u])u-=1+Sh(i,u)}})},s_=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,i=r.store,s=n.deleteSet,l=n._mergeStructs;try{c1(s),n.afterState=bd(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const c=[];n.changed.forEach((u,f)=>c.push(()=>{(f._item===null||!f._item.deleted)&&f._callObserver(n,u)})),c.push(()=>{n.changedParentTypes.forEach((u,f)=>{f._dEH.l.length>0&&(f._item===null||!f._item.deleted)&&(u=u.filter(h=>h.target._item===null||!h.target._item.deleted),u.forEach(h=>{h.currentTarget=f,h._path=null}),u.sort((h,m)=>h.path.length-m.path.length),c.push(()=>{e_(f._dEH,u,n)}))}),c.push(()=>r.emit("afterTransaction",[n,r])),c.push(()=>{n._needFormattingCleanup&&B5(n)})}),n1(c,[])}finally{r.gc&&g5(s,i,r.gcFilter),y5(s,i),n.afterState.forEach((h,m)=>{const g=n.beforeState.get(m)||0;if(g!==h){const b=i.clients.get(m),v=Qr(ei(b,g),1);for(let k=b.length-1;k>=v;)k-=1+Sh(b,k)}});for(let h=l.length-1;h>=0;h--){const{client:m,clock:g}=l[h].id,b=i.clients.get(m),v=ei(b,g);v+1<b.length&&Sh(b,v+1)>1||v>0&&Sh(b,v)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(K6(a1,BO,"[yjs] ",UO,HO,"Changed the client-id because another client seems to be using it."),r.clientID=YO()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const h=new yd;LE(h,n)&&r.emit("update",[h.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const h=new Qo;LE(h,n)&&r.emit("updateV2",[h.toUint8Array(),n.origin,r,n])}const{subdocsAdded:c,subdocsLoaded:u,subdocsRemoved:f}=n;(c.size>0||f.size>0||u.size>0)&&(c.forEach(h=>{h.clientID=r.clientID,h.collectionid==null&&(h.collectionid=r.collectionid),r.subdocs.add(h)}),f.forEach(h=>r.subdocs.delete(h)),r.emit("subdocs",[{loaded:u,added:c,removed:f},r,n]),f.forEach(h=>h.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):s_(t,e+1)}}},gt=(t,e,n=null,r=!0)=>{const i=t._transactionCleanups;let s=!1,l=null;t._transaction===null&&(s=!0,t._transaction=new m5(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&&s_(i,0)}}return l};class b5{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const IE=(t,e,n)=>{so(t,n.deletions,r=>{r instanceof St&&e.scope.some(i=>i===t.doc||Bu(i,r))&&v1(r,!1)})},BE=(t,e,n)=>{let r=null;const i=t.doc,s=t.scope;gt(i,c=>{for(;e.length>0&&t.currStackItem===null;){const u=i.store,f=e.pop(),h=new Set,m=[];let g=!1;so(c,f.insertions,b=>{if(b instanceof St){if(b.redone!==null){let{item:v,diff:k}=_b(u,b.id);k>0&&(v=er(c,Be(v.id.client,v.id.clock+k))),b=v}!b.deleted&&s.some(v=>v===c.doc||Bu(v,b))&&m.push(b)}}),so(c,f.deletions,b=>{b instanceof St&&s.some(v=>v===c.doc||Bu(v,b))&&!Ja(f.insertions,b.id)&&h.add(b)}),h.forEach(b=>{g=E_(c,b,h,f.insertions,t.ignoreRemoteMapChanges,t)!==null||g});for(let b=m.length-1;b>=0;b--){const v=m[b];t.deleteFilter(v)&&(v.delete(c),g=!0)}t.currStackItem=g?f:null}c.changed.forEach((u,f)=>{u.has(null)&&f._searchMarker&&(f._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 o_ extends cO{constructor(e,{captureTimeout:n=500,captureTransaction:r=u=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:l=!1,doc:c=Ma(e)?e[0].doc:e instanceof wi?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=u=>{if(!this.captureTransaction(u)||!this.scope.some(C=>u.changedParentTypes.has(C)||C===this.doc)||!this.trackedOrigins.has(u.origin)&&(!u.origin||!this.trackedOrigins.has(u.origin.constructor)))return;const f=this.undoing,h=this.redoing,m=f?this.redoStack:this.undoStack;f?this.stopCapturing():h||this.clear(!1,!0);const g=new Za;u.afterState.forEach((C,E)=>{const L=u.beforeState.get(E)||0,j=C-L;j>0&&ju(g,E,L,j)});const b=NB();let v=!1;if(this.lastChange>0&&b-this.lastChange<this.captureTimeout&&m.length>0&&!f&&!h){const C=m[m.length-1];C.deletions=Eb([C.deletions,u.deleteSet]),C.insertions=Eb([C.insertions,g])}else m.push(new b5(u.deleteSet,g)),v=!0;!f&&!h&&(this.lastChange=b),so(u,u.deleteSet,C=>{C instanceof St&&this.scope.some(E=>E===u.doc||Bu(E,C))&&v1(C,!0)});const k=[{stackItem:m[m.length-1],origin:u.origin,type:f?"redo":"undo",changedParentTypes:u.changedParentTypes},this];v?this.emit("stack-item-added",k):this.emit("stack-item-updated",k)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){const n=new Set(this.scope);e=Ma(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof an?r.doc!==this.doc:r!==this.doc)&&PO("[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=>IE(r,this,i)),this.undoStack=[]),n&&(this.redoStack.forEach(i=>IE(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=BE(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=BE(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*x5(t){const e=qe(t.restDecoder);for(let n=0;n<e;n++){const r=qe(t.restDecoder),i=t.readClient();let s=qe(t.restDecoder);for(let l=0;l<r;l++){const c=t.readInfo();if(c===10){const u=qe(t.restDecoder);yield new Ir(Be(i,s),u),s+=u}else if((em&c)!==0){const u=(c&(ss|Bn))===0,f=new St(Be(i,s),null,(c&Bn)===Bn?t.readLeftID():null,null,(c&ss)===ss?t.readRightID():null,u?t.readParentInfo()?t.readString():t.readLeftID():null,u&&(c&Du)===Du?t.readString():null,T_(t,c));yield f,s+=f.length}else{const u=t.readLen();yield new jr(Be(i,s),u),s+=u}}}}class h1{constructor(e,n){this.gen=x5(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===Ir);return this.curr}}class p1{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const v5=t=>Fh(t,GO,yd),S5=(t,e)=>{if(t.constructor===jr){const{client:n,clock:r}=t.id;return new jr(Be(n,r+e),t.length-e)}else if(t.constructor===Ir){const{client:n,clock:r}=t.id;return new Ir(Be(n,r+e),t.length-e)}else{const n=t,{client:r,clock:i}=n.id;return new St(Be(r,i+e),null,Be(r,i+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},Fh=(t,e=Na,n=Qo)=>{if(t.length===1)return t[0];const r=t.map(h=>new e(Ya(h)));let i=r.map(h=>new h1(h,!0)),s=null;const l=new n,c=new p1(l);for(;i=i.filter(g=>g.curr!==null),i.sort((g,b)=>{if(g.curr.id.client===b.curr.id.client){const v=g.curr.id.clock-b.curr.id.clock;return v===0?g.curr.constructor===b.curr.constructor?0:g.curr.constructor===Ir?1:-1:v}else return b.curr.id.client-g.curr.id.client}),i.length!==0;){const h=i[0],m=h.curr.id.client;if(s!==null){let g=h.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=h.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)qs(c,s.struct,s.offset),s={struct:g,offset:0},h.next();else if(s.struct.id.clock+s.struct.length<g.id.clock)if(s.struct.constructor===Ir)s.struct.length=g.id.clock+g.length-s.struct.id.clock;else{qs(c,s.struct,s.offset);const v=g.id.clock-s.struct.id.clock-s.struct.length;s={struct:new Ir(Be(m,s.struct.id.clock+s.struct.length),v),offset:0}}else{const v=s.struct.id.clock+s.struct.length-g.id.clock;v>0&&(s.struct.constructor===Ir?s.struct.length-=v:g=S5(g,v)),s.struct.mergeWith(g)||(qs(c,s.struct,s.offset),s={struct:g,offset:0},h.next())}}else s={struct:h.curr,offset:0},h.next();for(let g=h.curr;g!==null&&g.id.client===m&&g.id.clock===s.struct.id.clock+s.struct.length&&g.constructor!==Ir;g=h.next())qs(c,s.struct,s.offset),s={struct:g,offset:0}}s!==null&&(qs(c,s.struct,s.offset),s=null),m1(c);const u=r.map(h=>u1(h)),f=Eb(u);return Xa(l,f),l.toUint8Array()},w5=(t,e,n=Na,r=Qo)=>{const i=XO(e),s=new r,l=new p1(s),c=new n(Ya(t)),u=new h1(c,!1);for(;u.curr;){const h=u.curr,m=h.id.client,g=i.get(m)||0;if(u.curr.constructor===Ir){u.next();continue}if(h.id.clock+h.length>g)for(qs(l,h,Qr(g-h.id.clock,0)),u.next();u.curr&&u.curr.id.client===m;)qs(l,u.curr,0),u.next();else for(;u.curr&&u.curr.id.client===m&&u.curr.id.clock+u.curr.length<=g;)u.next()}m1(l);const f=u1(c);return Xa(s,f),s.toUint8Array()},l_=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:Jr(t.encoder.restEncoder)}),t.encoder.restEncoder=md(),t.written=0)},qs=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&l_(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),Xe(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},m1=t=>{l_(t);const e=t.encoder.restEncoder;Xe(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];Xe(e,r.written),tm(e,r.restEncoder)}},k5=(t,e,n,r)=>{const i=new n(Ya(t)),s=new h1(i,!1),l=new r,c=new p1(l);for(let f=s.curr;f!==null;f=s.next())qs(c,e(f),0);m1(c);const u=u1(i);return Xa(l,u),l.toUint8Array()},C5=t=>k5(t,$B,Na,yd),UE="You must not compute changes after the event-handler fired.";class cm{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=E5(this.currentTarget,this.target))}deletes(e){return Ja(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Si(UE);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 u=s.left;for(;u!==null&&this.adds(u);)u=u.left;if(this.deletes(s))if(u!==null&&this.deletes(u))l="delete",c=u0(u.content.getContent());else return;else u!==null&&this.deletes(u)?(l="update",c=u0(u.content.getContent())):(l="add",c=void 0)}else if(this.deletes(s))l="delete",c=u0(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 Si(UE);const n=this.target,r=Xo(),i=Xo(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(n).has(null)){let c=null;const u=()=>{c&&s.push(c)};for(let f=n._start;f!==null;f=f.right)f.deleted?this.deletes(f)&&!this.adds(f)&&((c===null||c.delete===void 0)&&(u(),c={delete:0}),c.delete+=f.length,i.add(f)):this.adds(f)?((c===null||c.insert===void 0)&&(u(),c={insert:[]}),c.insert=c.insert.concat(f.content.getContent()),r.add(f)):((c===null||c.retain===void 0)&&(u(),c={retain:0}),c.retain+=f.length);c!==null&&c.retain===void 0&&u()}this._changes=e}return e}}const E5=(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},Mn=()=>{PO("Invalid access: Add Yjs type to a document before reading data.")},a_=80;let g1=0;class T5{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=g1++}}const A5=t=>{t.timestamp=g1++},c_=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=g1++},M5=(t,e,n)=>{if(t.length>=a_){const r=t.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return c_(r,e,n),r}else{const r=new T5(e,n);return t.push(r),r}},um=(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)=>yh(e-s.index)<yh(e-l.index)?s:l);let r=t._start,i=0;for(n!==null&&(r=n.p,i=n.index,A5(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&&yh(n.index-i)<r.parent.length/a_?(c_(n,r,i),n):M5(t._searchMarker,r,i)},Hu=(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=Qr(e,i.index+n))}},dm=(t,e,n)=>{const r=t,i=e.changedParentTypes;for(;Ti(i,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;e_(r._eH,n,e)};class an{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=_E(),this._dEH=_E(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw Hr()}clone(){throw Hr()}_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){DE(this._eH,e)}observeDeep(e){DE(this._dEH,e)}unobserve(e){RE(this._eH,e)}unobserveDeep(e){RE(this._dEH,e)}toJSON(){}}const u_=(t,e,n)=>{t.doc??Mn(),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},d_=t=>{t.doc??Mn();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},f_=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&jo(r,e)){const i=r.content.getContent();for(let s=0;s<i.length;s++)n.push(i[s])}r=r.right}return n},Vu=(t,e)=>{let n=0,r=t._start;for(t.doc??Mn();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}},h_=(t,e)=>{const n=[];return Vu(t,(r,i)=>{n.push(e(r,i,t))}),n},O5=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}}}},p_=(t,e)=>{t.doc??Mn();const n=um(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}},qh=(t,e,n,r)=>{let i=n;const s=t.doc,l=s.clientID,c=s.store,u=n===null?e._start:n.right;let f=[];const h=()=>{f.length>0&&(i=new St(Be(l,Ht(c,l)),i,i&&i.lastId,u,u&&u.id,e,null,new tl(f)),i.integrate(t,0),f=[])};r.forEach(m=>{if(m===null)f.push(m);else switch(m.constructor){case Number:case Object:case Boolean:case Array:case String:f.push(m);break;default:switch(h(),m.constructor){case Uint8Array:case ArrayBuffer:i=new St(Be(l,Ht(c,l)),i,i&&i.lastId,u,u&&u.id,e,null,new xd(new Uint8Array(m))),i.integrate(t,0);break;case wi:i=new St(Be(l,Ht(c,l)),i,i&&i.lastId,u,u&&u.id,e,null,new vd(m)),i.integrate(t,0);break;default:if(m instanceof an)i=new St(Be(l,Ht(c,l)),i,i&&i.lastId,u,u&&u.id,e,null,new ni(m)),i.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),h()},m_=()=>Si("Length exceeded!"),g_=(t,e,n,r)=>{if(n>e._length)throw m_();if(n===0)return e._searchMarker&&Hu(e._searchMarker,n,r.length),qh(t,e,null,r);const i=n,s=um(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&&er(t,Be(l.id.client,l.id.clock+n));break}n-=l.length}return e._searchMarker&&Hu(e._searchMarker,i,r.length),qh(t,e,l,r)},_5=(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 qh(t,e,i,n)},y_=(t,e,n,r)=>{if(r===0)return;const i=n,s=r,l=um(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&&er(t,Be(c.id.client,c.id.clock+n)),n-=c.length);for(;r>0&&c!==null;)c.deleted||(r<c.length&&er(t,Be(c.id.client,c.id.clock+r)),c.delete(t),r-=c.length),c=c.right;if(r>0)throw m_();e._searchMarker&&Hu(e._searchMarker,i,-s+r)},Kh=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},y1=(t,e,n,r)=>{const i=e._map.get(n)||null,s=t.doc,l=s.clientID;let c;if(r==null)c=new tl([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:c=new tl([r]);break;case Uint8Array:c=new xd(r);break;case wi:c=new vd(r);break;default:if(r instanceof an)c=new ni(r);else throw new Error("Unexpected content type")}new St(Be(l,Ht(s.store,l)),i,i&&i.lastId,null,null,e,n,c).integrate(t,0)},b1=(t,e)=>{t.doc??Mn();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},b_=t=>{const e={};return t.doc??Mn(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},x_=(t,e)=>{t.doc??Mn();const n=t._map.get(e);return n!==void 0&&!n.deleted},D5=(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&&jo(s,e)&&(n[i]=s.content.getContent()[s.length-1])}),n},Kf=t=>(t.doc??Mn(),Y6(t._map.entries(),e=>!e[1].deleted));class R5 extends cm{}class wa extends an{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new wa;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new wa}clone(){const e=new wa;return e.insert(0,this.toArray().map(n=>n instanceof an?n.clone():n)),e}get length(){return this.doc??Mn(),this._length}_callObserver(e,n){super._callObserver(e,n),dm(this,e,new R5(this,e))}insert(e,n){this.doc!==null?gt(this.doc,r=>{g_(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?gt(this.doc,n=>{_5(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?gt(this.doc,r=>{y_(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return p_(this,e)}toArray(){return d_(this)}slice(e=0,n=this.length){return u_(this,e,n)}toJSON(){return this.map(e=>e instanceof an?e.toJSON():e)}map(e){return h_(this,e)}forEach(e){Vu(this,e)}[Symbol.iterator](){return O5(this)}_write(e){e.writeTypeRef(rU)}}const N5=t=>new wa;class z5 extends cm{constructor(e,n,r){super(e,n),this.keysChanged=r}}class za extends an{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 za}clone(){const e=new za;return this.forEach((n,r)=>{e.set(r,n instanceof an?n.clone():n)}),e}_callObserver(e,n){dm(this,e,new z5(this,e,n))}toJSON(){this.doc??Mn();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];e[r]=i instanceof an?i.toJSON():i}}),e}get size(){return[...Kf(this)].length}keys(){return y0(Kf(this),e=>e[0])}values(){return y0(Kf(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return y0(Kf(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??Mn(),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?gt(this.doc,n=>{Kh(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?gt(this.doc,r=>{y1(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return b1(this,e)}has(e){return x_(this,e)}clear(){this.doc!==null?gt(this.doc,e=>{this.forEach(function(n,r,i){Kh(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(iU)}}const L5=t=>new za,Gs=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&VB(t,e);class Ob{constructor(e,n,r,i){this.left=e,this.right=n,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&_n(),this.right.content.constructor){case Wt:this.right.deleted||Qa(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 HE=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case Wt:e.right.deleted||Qa(e.currentAttributes,e.right.content);break;default:e.right.deleted||(n<e.right.length&&er(t,Be(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},Yf=(t,e,n,r)=>{const i=new Map,s=r?um(e,n):null;if(s){const l=new Ob(s.p.left,s.p,s.index,i);return HE(t,l,n-s.index)}else{const l=new Ob(null,e._start,0,i);return HE(t,l,n)}},v_=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Wt&&Gs(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 u=n.left,f=n.right,h=new St(Be(s,Ht(i.store,s)),u,u&&u.lastId,f,f&&f.id,e,null,new Wt(c,l));h.integrate(t,0),n.right=h,n.forward()})},Qa=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},S_=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===Wt&&Gs(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},w_=(t,e,n,r)=>{const i=t.doc,s=i.clientID,l=new Map;for(const c in r){const u=r[c],f=n.currentAttributes.get(c)??null;if(!Gs(f,u)){l.set(c,f);const{left:h,right:m}=n;n.right=new St(Be(s,Ht(i.store,s)),h,h&&h.lastId,m,m&&m.id,e,null,new Wt(c,u)),n.right.integrate(t,0),n.forward()}}return l},v0=(t,e,n,r,i)=>{n.currentAttributes.forEach((g,b)=>{i[b]===void 0&&(i[b]=null)});const s=t.doc,l=s.clientID;S_(n,i);const c=w_(t,e,n,i),u=r.constructor===String?new ti(r):r instanceof an?new ni(r):new hl(r);let{left:f,right:h,index:m}=n;e._searchMarker&&Hu(e._searchMarker,n.index,u.getLength()),h=new St(Be(l,Ht(s.store,l)),f,f&&f.lastId,h,h&&h.id,e,null,u),h.integrate(t,0),n.right=h,n.index=m,n.forward(),v_(t,e,n,c)},VE=(t,e,n,r,i)=>{const s=t.doc,l=s.clientID;S_(n,i);const c=w_(t,e,n,i);e:for(;n.right!==null&&(r>0||c.size>0&&(n.right.deleted||n.right.content.constructor===Wt));){if(!n.right.deleted)switch(n.right.content.constructor){case Wt:{const{key:u,value:f}=n.right.content,h=i[u];if(h!==void 0){if(Gs(h,f))c.delete(u);else{if(r===0)break e;c.set(u,f)}n.right.delete(t)}else n.currentAttributes.set(u,f);break}default:r<n.right.length&&er(t,Be(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let u="";for(;r>0;r--)u+=`
66
+ `;n.right=new St(Be(l,Ht(s.store,l)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new ti(u)),n.right.integrate(t,0),n.forward()}v_(t,e,n,c)},k_=(t,e,n,r,i)=>{let s=e;const l=Ur();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===Wt){const f=s.content;l.set(f.key,f)}s=s.right}let c=0,u=!1;for(;e!==s;){if(n===e&&(u=!0),!e.deleted){const f=e.content;switch(f.constructor){case Wt:{const{key:h,value:m}=f,g=r.get(h)??null;(l.get(h)!==f||g===m)&&(e.delete(t),c++,!u&&(i.get(h)??null)===m&&g!==m&&(g===null?i.delete(h):i.set(h,g))),!u&&!e.deleted&&Qa(i,f);break}}}e=e.right}return c},j5=(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===Wt){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},I5=t=>{let e=0;return gt(t.doc,n=>{let r=t._start,i=t._start,s=Ur();const l=xb(s);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case Wt:Qa(l,i.content);break;default:e+=k_(n,r,i,s,l),s=xb(l),r=i;break}i=i.right}}),e},B5=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&&i_(t,n.store.clients.get(r),s,i,l=>{!l.deleted&&l.content.constructor===Wt&&l.constructor!==jr&&e.add(l.parent)})}gt(n,r=>{so(t,t.deleteSet,i=>{if(i instanceof jr||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===Wt?e.add(s):j5(r,i)});for(const i of e)I5(i)})},PE=(t,e,n)=>{const r=n,i=xb(e.currentAttributes),s=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case ni:case hl:case ti:n<e.right.length&&er(t,Be(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}s&&k_(t,s,e.right,i,e.currentAttributes);const l=(e.left||e.right).parent;return l._searchMarker&&Hu(l._searchMarker,e.index,-r+n),e};class U5 extends cm{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=[];gt(e,r=>{const i=new Map,s=new Map;let l=this.target._start,c=null;const u={};let f="",h=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 f=="object"||f.length>0)&&(b={insert:f},i.size>0&&(b.attributes={},i.forEach((v,k)=>{v!==null&&(b.attributes[k]=v)}))),f="";break;case"retain":h>0&&(b={retain:h},HB(u)||(b.attributes=BB({},u))),h=0;break}b&&n.push(b),c=null}};for(;l!==null;){switch(l.content.constructor){case ni:case hl:this.adds(l)?this.deletes(l)||(g(),c="insert",f=l.content.getContent()[0],g()):this.deletes(l)?(c!=="delete"&&(g(),c="delete"),m+=1):l.deleted||(c!=="retain"&&(g(),c="retain"),h+=1);break;case ti:this.adds(l)?this.deletes(l)||(c!=="insert"&&(g(),c="insert"),f+=l.content.str):this.deletes(l)?(c!=="delete"&&(g(),c="delete"),m+=l.length):l.deleted||(c!=="retain"&&(g(),c="retain"),h+=l.length);break;case Wt:{const{key:b,value:v}=l.content;if(this.adds(l)){if(!this.deletes(l)){const k=i.get(b)??null;Gs(k,v)?v!==null&&l.delete(r):(c==="retain"&&g(),Gs(v,s.get(b)??null)?delete u[b]:u[b]=v)}}else if(this.deletes(l)){s.set(b,v);const k=i.get(b)??null;Gs(k,v)||(c==="retain"&&g(),u[b]=k)}else if(!l.deleted){s.set(b,v);const k=u[b];k!==void 0&&(Gs(k,v)?k!==null&&l.delete(r):(c==="retain"&&g(),v===null?delete u[b]:u[b]=v))}l.deleted||(c==="insert"&&g(),Qa(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 oo extends an{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Mn(),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 oo}clone(){const e=new oo;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new U5(this,e,n);dm(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??Mn();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===ti&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?gt(this.doc,r=>{const i=new Ob(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)===`
67
+ `?l.insert.slice(0,-1):l.insert;(typeof c!="string"||c.length>0)&&v0(r,this,i,c,l.attributes||{})}else l.retain!==void 0?VE(r,this,i,l.retain,l.attributes||{}):l.delete!==void 0&&PE(r,i,l.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??Mn();const i=[],s=new Map,l=this.doc;let c="",u=this._start;function f(){if(c.length>0){const m={};let g=!1;s.forEach((v,k)=>{g=!0,m[k]=v});const b={insert:c};g&&(b.attributes=m),i.push(b),c=""}}const h=()=>{for(;u!==null;){if(jo(u,e)||n!==void 0&&jo(u,n))switch(u.content.constructor){case ti:{const m=s.get("ychange");e!==void 0&&!jo(u,e)?(m===void 0||m.user!==u.id.client||m.type!=="removed")&&(f(),s.set("ychange",r?r("removed",u.id):{type:"removed"})):n!==void 0&&!jo(u,n)?(m===void 0||m.user!==u.id.client||m.type!=="added")&&(f(),s.set("ychange",r?r("added",u.id):{type:"added"})):m!==void 0&&(f(),s.delete("ychange")),c+=u.content.str;break}case ni:case hl:{f();const m={insert:u.content.getContent()[0]};if(s.size>0){const g={};m.attributes=g,s.forEach((b,v)=>{g[v]=b})}i.push(m);break}case Wt:jo(u,e)&&(f(),Qa(s,u.content));break}u=u.right}f()};return e||n?gt(l,m=>{e&&Ab(m,e),n&&Ab(m,n),h()},"cleanup"):h(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?gt(i,s=>{const l=Yf(s,this,e,!r);r||(r={},l.currentAttributes.forEach((c,u)=>{r[u]=c})),v0(s,this,l,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?gt(i,s=>{const l=Yf(s,this,e,!r);v0(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?gt(r,i=>{PE(i,Yf(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?gt(i,s=>{const l=Yf(s,this,e,!1);l.right!==null&&VE(s,this,l,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?gt(this.doc,n=>{Kh(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?gt(this.doc,r=>{y1(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return b1(this,e)}getAttributes(){return b_(this)}_write(e){e.writeTypeRef(sU)}}const H5=t=>new oo;class S0{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Mn()}[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===ln||n.constructor===el)&&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 el extends an{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 el}clone(){const e=new el;return e.insert(0,this.toArray().map(n=>n instanceof an?n.clone():n)),e}get length(){return this.doc??Mn(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new S0(this,e)}querySelector(e){e=e.toUpperCase();const r=new S0(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),io(new S0(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){dm(this,e,new $5(this,n,e))}toString(){return h_(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),Vu(this,s=>{i.insertBefore(s.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?gt(this.doc,r=>{g_(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)gt(this.doc,r=>{const i=e&&e instanceof an?e._item:e;qh(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 Si("Reference item not found");r.splice(i,0,...n)}}delete(e,n=1){this.doc!==null?gt(this.doc,r=>{y_(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return d_(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return p_(this,e)}slice(e=0,n=this.length){return u_(this,e,n)}forEach(e){Vu(this,e)}_write(e){e.writeTypeRef(lU)}}const V5=t=>new el;class ln extends el{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 ln(this.nodeName)}clone(){const e=new ln(this.nodeName),n=this.getAttributes();return UB(n,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof an?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 u=r[c];n.push(u+'="'+e[u]+'"')}const s=this.nodeName.toLocaleLowerCase(),l=n.length>0?" "+n.join(" "):"";return`<${s}${l}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?gt(this.doc,n=>{Kh(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?gt(this.doc,r=>{y1(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return b1(this,e)}hasAttribute(e){return x_(this,e)}getAttributes(e){return e?D5(this,e):b_(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 Vu(this,l=>{i.appendChild(l.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(oU),e.writeKey(this.nodeName)}}const P5=t=>new ln(t.readKey());class $5 extends cm{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 Yh extends za{constructor(e){super(),this.hookName=e}_copy(){return new Yh(this.hookName)}clone(){const e=new Yh(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(aU),e.writeKey(this.hookName)}}const F5=t=>new Yh(t.readKey());class Un extends oo{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 Un}clone(){const e=new Un;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(cU)}}const q5=t=>new Un;class x1{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Hr()}mergeWith(e){return!1}write(e,n,r){throw Hr()}integrate(e,n){throw Hr()}}const K5=0;class jr extends x1{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),r_(e.doc.store,this)}write(e,n){e.writeInfo(K5),e.writeLen(this.length-n)}getMissing(e,n){return null}}class xd{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new xd(this.content)}splice(e){throw Hr()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const Y5=t=>new xd(t.readBuf());class Pu{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Pu(this.len)}splice(e){const n=new Pu(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){ju(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 W5=t=>new Pu(t.readLen()),C_=(t,e)=>new wi({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class vd{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 vd(C_(this.doc.guid,this.opts))}splice(e){throw Hr()}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 G5=t=>new vd(C_(t.readString(),t.readAny()));class hl{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new hl(this.embed)}splice(e){throw Hr()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const Z5=t=>new hl(t.readJSON());class Wt{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Wt(this.key,this.value)}splice(e){throw Hr()}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 J5=t=>new Wt(t.readKey(),t.readJSON());class Wh{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Wh(this.arr)}splice(e){const n=new Wh(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 X5=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 Wh(n)},Q5=Uh("node_env")==="development";class tl{constructor(e){this.arr=e,Q5&&bO(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new tl(this.arr)}splice(e){const n=new tl(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 eU=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new tl(n)};class ti{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new ti(this.str)}splice(e){const n=new ti(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 tU=t=>new ti(t.readString()),nU=[N5,L5,H5,P5,V5,F5,q5],rU=0,iU=1,sU=2,oU=3,lU=4,aU=5,cU=6;class ni{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new ni(this.type._copy())}splice(e){throw Hr()}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 uU=t=>new ni(nU[t.readTypeRef()](t)),_b=(t,e)=>{let n=e,r=0,i;do r>0&&(n=Be(n.client,n.clock+r)),i=Sa(t,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof St);return{item:i,diff:r}},v1=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},Gh=(t,e,n)=>{const{client:r,clock:i}=e.id,s=new St(Be(r,i+n),e,Be(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=Be(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},$E=(t,e)=>Zx(t,n=>Ja(n.deletions,e)),E_=(t,e,n,r,i,s)=>{const l=t.doc,c=l.store,u=l.clientID,f=e.redone;if(f!==null)return er(t,f);let h=e.parent._item,m=null,g;if(h!==null&&h.deleted===!0){if(h.redone===null&&(!n.has(h)||E_(t,h,n,r,i,s)===null))return null;for(;h.redone!==null;)h=er(t,h.redone)}const b=h===null?e.parent:h.content.type;if(e.parentSub===null){for(m=e.left,g=e;m!==null;){let E=m;for(;E!==null&&E.parent._item!==h;)E=E.redone===null?null:er(t,E.redone);if(E!==null&&E.parent._item===h){m=E;break}m=m.left}for(;g!==null;){let E=g;for(;E!==null&&E.parent._item!==h;)E=E.redone===null?null:er(t,E.redone);if(E!==null&&E.parent._item===h){g=E;break}g=g.right}}else if(g=null,e.right&&!i){for(m=e;m!==null&&m.right!==null&&(m.right.redone||Ja(r,m.right.id)||$E(s.undoStack,m.right.id)||$E(s.redoStack,m.right.id));)for(m=m.right;m.redone;)m=er(t,m.redone);if(m&&m.right!==null)return null}else m=b._map.get(e.parentSub)||null;const v=Ht(c,u),k=Be(u,v),C=new St(k,m,m&&m.lastId,g,g&&g.id,b,e.parentSub,e.content.copy());return e.redone=k,v1(C,!0),C.integrate(t,0),C};let St=class Db extends x1{constructor(e,n,r,i,s,l,c,u){super(e,u.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=s,this.parent=l,this.parentSub=c,this.redone=null,this.content=u,this.info=this.content.isCountable()?yE:0}set marker(e){(this.info&f0)>0!==e&&(this.info^=f0)}get marker(){return(this.info&f0)>0}get keep(){return(this.info&gE)>0}set keep(e){this.keep!==e&&(this.info^=gE)}get countable(){return(this.info&yE)>0}get deleted(){return(this.info&d0)>0}set deleted(e){this.deleted!==e&&(this.info^=d0)}markDeleted(){this.info|=d0}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Ht(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Ht(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===va&&this.id.client!==this.parent.client&&this.parent.clock>=Ht(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=zE(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=er(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===jr||this.right&&this.right.constructor===jr)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Db?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===Db&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===va){const r=Sa(n,this.parent);r.constructor===jr?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=zE(e,e.doc.store,Be(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),fa(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(fa(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&l.has(Sa(e.doc.store,i.origin)))s.has(Sa(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),r_(e.doc.store,this),this.content.integrate(e,this),jE(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new jr(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:Be(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&fa(e.origin,this.lastId)&&this.right===e&&fa(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(),ju(e.deleteSet,this.id.client,this.id.clock,this.length),jE(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw _n();this.content.gc(e),n?p5(e,this,new jr(this.id,this.length)):this.content=new Pu(this.length)}write(e,n){const r=n>0?Be(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,s=this.parentSub,l=this.content.getRef()&em|(r===null?0:Bn)|(i===null?0:ss)|(s===null?0:Du);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 u=c._item;if(u===null){const f=Iu(c);e.writeParentInfo(!0),e.writeString(f)}else e.writeParentInfo(!1),e.writeLeftID(u.id)}else c.constructor===String?(e.writeParentInfo(!0),e.writeString(c)):c.constructor===va?(e.writeParentInfo(!1),e.writeLeftID(c)):_n();s!==null&&e.writeString(s)}this.content.write(e,n)}};const T_=(t,e)=>dU[e&em](t),dU=[()=>{_n()},W5,X5,Y5,tU,Z5,J5,uU,eU,G5,()=>{_n()}],fU=10;class Ir extends x1{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){_n()}write(e,n){e.writeInfo(fU),Xe(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const A_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},M_="__ $YJS$ __";A_[M_]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");A_[M_]=!0;function O_(t){return t?t+1:0}function fm(t){let e=0;return t.forEach(n=>{n.isText?e+=n.text.length:n.type.name==="hardBreak"&&(e+=1)}),e}function Sd(t){if(t.isTextblock)return fm(t);let e=0;for(let n=0;n<t.childCount;n++)n>0&&(e+=1),e+=Sd(t.child(n));return e}function __(t,e,n){if(t.isTextblock)return br(n+Math.min(e,fm(t)));let r=0,i=n;for(let s=0;s<t.childCount;s++){const l=t.child(s),c=i+1;s>0&&(r+=1);const u=Sd(l);if(r+u>e)return __(l,e-r,c);r+=u,i+=l.nodeSize}return br(n+t.content.size)}function nl(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,u=l.type.name==="heading"?O_(l.attrs.level||1):0,f=Sd(l),h=u+f;if(n+h>e){const m=e-n,g=Math.max(0,m-u);return __(l,g,c)}if(n+=h,r+=l.nodeSize,s<i-1&&(n+=1,n>e))return br(c+l.content.size)}return br(t.content.size)}function D_(t,e,n){if(t.isTextblock)return Math.min(e-n,fm(t));let r=0,i=n;for(let s=0;s<t.childCount;s++){const l=t.child(s),c=i+1;s>0&&(r+=1);const u=i+l.nodeSize;if(e<u)return e<=c?r:r+D_(l,e,c);r+=Sd(l),i+=l.nodeSize}return r}function La(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,u=l.type.name==="heading"?O_(l.attrs.level||1):0,f=Sd(l),h=r+l.nodeSize;if(e<h)return e<=c?ph(n+u):ph(n+u+D_(l,e,c));n+=u+f,r+=l.nodeSize,s<i-1&&(n+=1)}return ph(n)}function R_(t,e,n,r){if(e.isTextblock){let l=0;for(let c=0;c<t.length;c++){const u=t.get(c);if(u instanceof Un){if(u===r.type)return br(n+Math.min(l+r.index,fm(e)));l+=u.length}}return null}let i=n;t.length!==e.childCount&&console.warn(`[positions] Y.js/PM child count mismatch: yEl(${t.nodeName}).length=${t.length} vs pmNode(${e.type.name}).childCount=${e.childCount}`);const s=Math.min(t.length,e.childCount);for(let l=0;l<s;l++){const c=t.get(l),u=e.child(l),f=i+1;if(c instanceof ln){const h=R_(c,u,f,r);if(h!==null)return h}i+=u.nodeSize}return null}function FE(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),u=r+1;if(l instanceof ln){const f=R_(l,c,u,n);if(f!==null)return f}r+=c.nodeSize}return null}function N_(t,e,n){let r,i;try{const u=qo(n.fromRel),f=qo(n.toRel);r=Tb(u,t),i=Tb(f,t)}catch(u){return console.warn("[positions] relRangeToPmPositions: failed to resolve relRange:",u),null}if(!r||!i)return null;const s=t.getXmlFragment("default"),l=FE(e,s,r),c=FE(e,s,i);return l===null||c===null?null:{from:l,to:c}}function Zh(t,e,n){if(t.relRange&&n){const r=N_(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:nl(e,t.range.from),to:nl(e,t.range.to),method:"flat"}:null}function z_(t,e){return{from:La(t,e.from),to:La(t,e.to)}}const hU=[0,.2,.4];function pU({ctrlYdoc:t,editor:e,activeDocId:n,openDocs:r,claudeActive:i,claudeStatus:s,visible:l,capturedAnchor:c,onCapturedAnchorChange:u,inputRef:f,reduceMotion:h}){const m=h?"auto":"smooth",[g,b]=M.useState([]),[v,k]=M.useState(""),C=M.useRef(null),E=M.useRef(null);M.useEffect(()=>{f&&(f.current=E.current)},[f]),M.useEffect(()=>{if(!t)return;const W=t.getMap(wC),oe=()=>{const re=[];W.forEach(ie=>{re.push(ie)}),re.sort((ie,ye)=>ie.timestamp-ye.timestamp||ie.id.localeCompare(ye.id)),b(re)};return W.observe(oe),oe(),()=>W.unobserve(oe)},[t]);const L=M.useRef(!1);M.useEffect(()=>{var W;if(!i&&L.current){L.current=!1;return}L.current=!!i,(W=C.current)==null||W.scrollIntoView({behavior:m})},[g,i,m]),M.useEffect(()=>{var W;l&&((W=C.current)==null||W.scrollIntoView({behavior:m}))},[l,m]);const j=M.useCallback(()=>{if(!t||!v.trim())return;const W=t.getMap(wC),oe={id:qI(),author:"user",text:v.trim(),timestamp:Date.now(),...n?{documentId:n}:{},...c?{anchor:c}:{},read:!1};W.set(oe.id,oe),k(""),u(null)},[t,v,n,c,u]),Y=M.useCallback(W=>{W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),j())},[j]),V=M.useCallback((W,oe)=>{if(!(!e||oe&&oe!==n))try{const re=nl(e.state.doc,W.from),ie=nl(e.state.doc,W.to);e.chain().focus().setTextSelection({from:re,to:ie}).scrollIntoView().run()}catch(re){console.warn("[ChatPanel] Could not scroll to anchor:",re instanceof Error?re.message:re)}},[e,n]),R=W=>{if(!W)return null;const oe=r.find(re=>re.id===W);return(oe==null?void 0:oe.fileName)??null},B=g.filter(W=>W.author==="claude"&&!W.read).length,te=M.useCallback(async()=>{try{await fetch(`http://localhost:${ud}/api/chat`,{method:"DELETE"})}catch(W){console.warn("[ChatPanel] Failed to clear chat:",W)}},[]);return S.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",background:"var(--tandem-surface-muted)",flex:1,minHeight:0},children:[S.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--tandem-border)",fontWeight:600,fontSize:"14px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Chat",S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[B>0&&S.jsx("span",{style:{background:"var(--tandem-accent)",color:"var(--tandem-accent-fg)",borderRadius:"10px",padding:"2px 8px",fontSize:"11px"},children:B}),g.length>0&&S.jsx("button",{onClick:te,title:"Clear chat history","data-testid":"clear-chat-btn",style:{background:"none",border:"none",cursor:"pointer",color:"var(--tandem-fg-subtle)",fontSize:"13px",padding:"2px 4px",lineHeight:1},children:"Clear"})]})]}),S.jsxs("div",{style:{flex:1,overflow:"auto",padding:"12px",minHeight:0},children:[g.length===0&&S.jsx("div",{style:{color:"var(--tandem-fg-subtle)",fontSize:"13px",textAlign:"center",marginTop:"24px"},children:"No messages yet. Select text and send a message to Claude."}),g.map(W=>S.jsxs("div",{style:{marginBottom:"12px",padding:"8px 12px",borderRadius:"8px",background:W.author==="user"?"var(--tandem-accent-bg)":"var(--tandem-surface)",border:`1px solid ${W.author==="user"?"var(--tandem-accent-border)":"var(--tandem-border)"}`,fontSize:"13px",color:"var(--tandem-fg)"},children:[S.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center",marginBottom:"4px"},children:[S.jsx("span",{style:{fontWeight:600,fontSize:"11px",color:W.author==="claude"?"var(--tandem-accent)":"var(--tandem-fg-muted)",textTransform:"uppercase"},children:W.author}),W.documentId&&S.jsx("span",{style:{fontSize:"10px",color:"var(--tandem-fg-muted)",background:"var(--tandem-surface-muted)",padding:"1px 6px",borderRadius:"4px"},children:R(W.documentId)??W.documentId}),S.jsx("span",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginLeft:"auto"},children:new Date(W.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),W.anchor&&S.jsx("div",{onClick:()=>V(W.anchor,W.documentId),className:"chat-anchor-quote",style:{padding:"4px 8px",marginBottom:"6px",borderLeft:"3px solid var(--tandem-accent-border)",background:"var(--tandem-accent-bg)",fontSize:"12px",color:"var(--tandem-accent-fg-strong)",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:oe=>{oe.currentTarget.style.maxHeight="500px"},onMouseLeave:oe=>{oe.currentTarget.style.maxHeight="60px"},children:W.anchor.textSnapshot}),W.author==="claude"?S.jsx("div",{className:"chat-markdown",children:S.jsx(UI,{children:W.text})}):S.jsx("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:W.text})]},W.id)),i&&S.jsxs("div",{style:{padding:"8px 12px",marginBottom:"8px",fontSize:"12px",color:"var(--tandem-author-claude)",display:"flex",alignItems:"center",gap:"8px"},children:[S.jsx("span",{style:{display:"inline-flex",gap:"3px"},children:hU.map(W=>S.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"var(--tandem-author-claude)",animation:`tandem-typing-bounce 1.2s ease-in-out ${W}s infinite`}},W))}),S.jsx("span",{children:s??"Claude is thinking..."})]}),S.jsx("div",{ref:C})]}),c&&S.jsxs("div",{style:{padding:"4px 12px",background:"var(--tandem-accent-bg)",borderTop:"1px solid var(--tandem-accent-border)",fontSize:"11px",color:"var(--tandem-accent-fg-strong)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[S.jsxs("span",{children:["with selection: “",c.textSnapshot.slice(0,40),c.textSnapshot.length>40?"...":"","”"]}),S.jsx("button",{onClick:()=>u(null),style:{background:"none",border:"none",cursor:"pointer",color:"var(--tandem-fg-muted)",fontSize:"14px"},children:"x"})]}),S.jsxs("div",{style:{padding:"8px 12px",borderTop:"1px solid var(--tandem-border)",display:"flex",gap:"8px"},children:[S.jsx("textarea",{ref:E,value:v,onChange:W=>k(W.target.value),onKeyDown:Y,placeholder:"Message Claude...",rows:2,style:{flex:1,padding:"8px",border:"1px solid var(--tandem-border-strong)",borderRadius:"6px",fontSize:"13px",resize:"none",outline:"none",fontFamily:"inherit",background:"var(--tandem-surface)",color:"var(--tandem-fg)"}}),S.jsx("button",{onClick:j,disabled:!v.trim(),style:{padding:"8px 12px",background:v.trim()?"var(--tandem-accent)":"var(--tandem-border-strong)",color:v.trim()?"var(--tandem-accent-fg)":"var(--tandem-fg-subtle)",border:"none",borderRadius:"6px",cursor:v.trim()?"pointer":"default",fontSize:"13px",fontWeight:500,alignSelf:"flex-end"},children:"Send"})]}),S.jsx("style",{children:`
68
+ @keyframes tandem-typing-bounce {
69
+ 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
70
+ 30% { transform: translateY(-4px); opacity: 1; }
71
+ }
72
+ `})]})}function $u(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}:{},...typeof e.rev=="number"?{rev:e.rev}:{}};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"})}const rl=`http://localhost:${ud}/api`;function mU(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 gU(t){return t.toLowerCase().endsWith(".docx")}async function L_(t){if(gU(t.name)){const e=await t.arrayBuffer();return mU(e)}return t.text()}function yU({annotations:t,activeDocFormat:e,documentId:n}){const[r,i]=M.useState(!1);if(e!=="docx")return null;const s=t.filter(f=>f.status==="accepted"),l=t.filter(f=>f.status==="pending"),c=s.length===0||r;async function u(){if(c||!n)return;let f=`Apply ${s.length} change(s) as tracked revisions?
73
+
74
+ The changes will appear as tracked revisions in Word — you can Accept or Reject each one individually.
75
+
76
+ Your original file will be backed up.`;if(l.length>0&&(f+=`
77
+
78
+ ⚠ ${l.length} annotation(s) are still pending review and will not be applied.`),!!confirm(f)){i(!0);try{const h=await fetch(`${rl}/apply-changes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:n})}),m=await h.json().catch(b=>(console.error("[ApplyChanges] Failed to parse response JSON:",b),null));if(!h.ok){alert((m==null?void 0:m.message)??`Apply failed (HTTP ${h.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(`
79
+ Backup saved to:
80
+ ${g.backupPath}`),alert(b.join(" "))}else alert("Changes applied successfully.")}catch(h){console.error("[ApplyChanges] Request failed:",h),alert(h instanceof TypeError?"Could not reach the server.":`Apply failed: ${h instanceof Error?h.message:String(h)}`)}finally{i(!1)}}}return S.jsx("button",{type:"button","data-testid":"apply-changes-btn",onClick:u,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 ${c?"var(--tandem-border)":"var(--tandem-info-border)"}`,borderRadius:"4px",background:c?"var(--tandem-surface-muted)":"var(--tandem-info)",color:c?"var(--tandem-fg-subtle)":"var(--tandem-info-fg)",cursor:c?"default":"pointer",opacity:r?.6:1,whiteSpace:"nowrap"},children:r?"Applying…":`Apply as Tracked Changes (${s.length})`})}const w0={background:"var(--tandem-warning-bg)",border:"var(--tandem-warning-border)",color:"var(--tandem-warning-fg-strong)"};function bU({annotationId:t,isPending:e,isEditing:n,undoable:r,onAccept:i,onDismiss:s,onUndo:l,onRemove:c}){const[u,f]=M.useState(!1),h=M.useRef(null);return M.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]),e&&!n&&(i||s)?S.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"6px"},children:[i&&S.jsx("button",{"data-testid":`accept-btn-${t}`,onClick:m=>{m.stopPropagation(),i(t)},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-success-bg)",color:"var(--tandem-success-fg-strong)",cursor:"pointer"},children:"Accept"}),s&&S.jsx("button",{"data-testid":`dismiss-btn-${t}`,onClick:m=>{m.stopPropagation(),s(t)},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-error-bg)",color:"var(--tandem-error-fg-strong)",cursor:"pointer"},children:"Reject"})]}):e&&!n&&c?S.jsx("button",{"data-testid":`remove-btn-${t}`,onClick:m=>{m.stopPropagation(),c(t)},style:{marginTop:"6px",padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-surface-muted)",color:"var(--tandem-fg-muted)",cursor:"pointer"},children:"Remove"}):!e&&r&&l?S.jsxs("div",{style:{marginTop:"4px"},children:[S.jsx("button",{"data-testid":"undo-btn",onClick:m=>{m.stopPropagation(),l(t)||(f(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>f(!1),3e3))},style:{padding:"1px 6px",fontSize:"11px",border:"none",background:"none",color:"var(--tandem-accent)",cursor:"pointer",textDecoration:"underline"},children:"Undo"}),u&&S.jsx("div",{style:{fontSize:"11px",color:"var(--tandem-error-fg)",marginTop:"2px"},children:"Can't undo — text has changed."})]}):null}function xU({annotationId:t,hasSuggestedText:e,editText:n,editNewText:r,editReason:i,onChangeEditText:s,onChangeEditNewText:l,onChangeEditReason:c,onKeyDown:u,onSave:f,onCancel:h}){return S.jsxs("div",{style:{marginTop:"4px"},onClick:m=>m.stopPropagation(),children:[e?S.jsxs(S.Fragment,{children:[S.jsx("label",{style:{fontSize:"11px",color:"var(--tandem-fg-muted)",display:"block",marginBottom:"2px"},children:"Replacement text"}),S.jsx("textarea",{"data-testid":`edit-newtext-${t}`,value:r,onChange:m=>l(m.target.value),onKeyDown:u,style:wh,autoFocus:!0}),S.jsx("label",{style:{fontSize:"11px",color:"var(--tandem-fg-muted)",display:"block",marginTop:"4px",marginBottom:"2px"},children:"Reason"}),S.jsx("textarea",{"data-testid":`edit-reason-${t}`,value:i,onChange:m=>c(m.target.value),onKeyDown:u,style:wh})]}):S.jsx("textarea",{"data-testid":`edit-text-${t}`,value:n,onChange:m=>s(m.target.value),onKeyDown:u,style:wh,autoFocus:!0}),S.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"4px"},children:[S.jsx("button",{"data-testid":`edit-save-btn-${t}`,onClick:m=>{m.stopPropagation(),f()},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-success-bg)",color:"var(--tandem-success-fg-strong)",cursor:"pointer"},children:"Save"}),S.jsx("button",{"data-testid":`edit-cancel-btn-${t}`,onClick:m=>{m.stopPropagation(),h()},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)",cursor:"pointer"},children:"Cancel"})]})]})}function vU(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 SU({replies:t}){return t.length===0?null:S.jsx("div",{"data-testid":"comment-thread",style:{marginTop:"6px",paddingLeft:"8px",borderLeft:"2px solid var(--tandem-border)"},children:t.map(e=>S.jsxs("div",{"data-testid":`reply-${e.id}`,style:{padding:"4px 0",fontSize:"12px",lineHeight:"1.4"},children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[S.jsx("span",{style:{fontWeight:600,fontSize:"11px",color:e.author==="claude"?"var(--tandem-accent)":"var(--tandem-fg-muted)"},children:e.author==="claude"?"Claude":"You"}),S.jsxs("span",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:[e.editedAt&&S.jsx("span",{style:{fontStyle:"italic",marginRight:"4px"},children:"(edited)"}),vU(e.timestamp)]})]}),S.jsx("p",{style:{margin:0,color:"var(--tandem-fg)"},children:e.text})]},e.id))})}function wU({annotationId:t,replies:e,isPending:n,isEditing:r,onReply:i}){const[s,l]=M.useState(!1),[c,u]=M.useState(""),[f,h]=M.useState(!1),m=!!c.trim();function g(v){v.key==="Escape"&&(v.stopPropagation(),l(!1),u(""))}async function b(){const v=c.trim();if(!(!v||f)){h(!0);try{await(i==null?void 0:i(t,v))!==!1&&(u(""),l(!1))}finally{h(!1)}}}return S.jsxs(S.Fragment,{children:[S.jsx(SU,{replies:e}),n&&i&&!r&&S.jsx("div",{style:{marginTop:"6px"},onClick:v=>v.stopPropagation(),children:s?S.jsxs("div",{children:[S.jsx("textarea",{"data-testid":`reply-input-${t}`,value:c,onChange:v=>u(v.target.value),onKeyDown:g,placeholder:"Write a reply...",style:wh,autoFocus:!0}),S.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"4px"},children:[S.jsx("button",{"data-testid":`reply-send-btn-${t}`,onClick:b,disabled:!m||f,style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:m?"var(--tandem-accent-bg)":"var(--tandem-surface-muted)",color:m?"var(--tandem-accent-fg-strong)":"var(--tandem-fg-subtle)",cursor:m?"pointer":"default"},children:"Send"}),S.jsx("button",{"data-testid":`reply-cancel-btn-${t}`,onClick:()=>{l(!1),u("")},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)",cursor:"pointer"},children:"Cancel"})]})]}):S.jsxs("button",{"data-testid":`reply-btn-${t}`,onClick:()=>l(!0),style:{padding:"1px 4px",fontSize:"11px",border:"none",background:"none",color:"var(--tandem-fg-subtle)",cursor:"pointer"},children:["Reply",e.length>0?` (${e.length})`:""]})}),!n&&e.length>0&&!i&&S.jsxs("div",{style:{marginTop:"4px",fontSize:"11px",color:"var(--tandem-fg-subtle)"},children:[e.length," ",e.length===1?"reply":"replies"]})]})}const wh={width:"100%",padding:"4px 6px",fontSize:"12px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",resize:"vertical",fontFamily:"inherit",minHeight:"40px",boxSizing:"border-box",background:"var(--tandem-surface)",color:"var(--tandem-fg)"},kU={padding:"1px 4px",fontSize:"11px",border:"none",background:"none",color:"var(--tandem-fg-subtle)",cursor:"pointer",lineHeight:1};function CU(t){return t.suggestedText!==void 0?"replacement":t.directedAt==="claude"?"question":t.type}function EU(t){return t==="claude"?"Claude":t==="import"?"Imported":"You"}function TU(t){return t.color?Ou[t.color]||"var(--tandem-border)":t.suggestedText!==void 0?"var(--tandem-suggestion)":t.directedAt==="claude"?"var(--tandem-accent)":t.type==="flag"?"var(--tandem-error)":"var(--tandem-author-user)"}const qE=sn.memo(function({annotation:e,replies:n=[],isReviewTarget:r,onAccept:i,onDismiss:s,onUndo:l,onEdit:c,onReply:u,onRemove:f,undoable:h,onClick:m}){const g=TU(e),b=e.status==="pending",[v,k]=M.useState(!1),[C,E]=M.useState(""),[L,j]=M.useState(""),[Y,V]=M.useState(""),R=e.suggestedText!==void 0,B=CU(e);function te(){R?(j(e.suggestedText??""),V(e.content)):E(e.content),k(!0)}function W(){const ae=R?JSON.stringify({suggestedText:L,content:Y}):C;c==null||c(e.id,ae),k(!1)}function oe(){k(!1)}function re(ae){ae.key==="Escape"&&(ae.stopPropagation(),oe())}const ie=e.content?e.content.length>60?e.content.slice(0,57)+"...":e.content:"",ye=`${B} annotation${ie?": "+ie:""}, ${e.status}`;return S.jsxs("div",{onClick:m,"data-testid":`annotation-card-${e.id}`,role:"listitem","aria-label":ye,"aria-current":r?"true":void 0,style:{padding:"8px 10px",marginBottom:"6px",borderLeft:`3px solid ${g}`,background:r?"var(--tandem-accent-bg)":"var(--tandem-surface)",borderRadius:"0 4px 4px 0",fontSize:"13px",opacity:b?1:.6,cursor:m?"pointer":"default",outline:r?"2px solid var(--tandem-accent)":"none",transition:"background 0.15s, outline 0.15s"},children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[S.jsxs("span",{style:{fontWeight:500,textTransform:"capitalize",display:"flex",alignItems:"center",gap:"4px"},children:[B,!b&&S.jsx("span",{style:{marginLeft:"6px",fontSize:"10px",color:e.status==="accepted"?"var(--tandem-success)":"var(--tandem-error)",fontWeight:600},children:e.status}),b&&c&&!r&&!v&&S.jsx("button",{"data-testid":`edit-btn-${e.id}`,onClick:ae=>{ae.stopPropagation(),te()},style:kU,title:"Edit this annotation's content",children:"✎ Edit"})]}),S.jsxs("span",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)",display:"flex",alignItems:"center",gap:"4px"},children:[e.editedAt&&S.jsx("span",{style:{fontStyle:"italic",fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:"(edited)"}),EU(e.author)]})]}),e.textSnapshot&&S.jsx("div",{"data-testid":`annotation-snippet-${e.id}`,style:{padding:"4px 8px",marginBottom:"6px",borderLeft:"3px solid var(--tandem-border-strong)",color:"var(--tandem-fg-muted)",fontSize:"12px",fontStyle:"italic",backgroundColor:"var(--tandem-surface-muted)",borderRadius:"2px"},children:e.textSnapshot.length>80?e.textSnapshot.slice(0,77)+"...":e.textSnapshot}),v?S.jsx(xU,{annotationId:e.id,hasSuggestedText:R,editText:C,editNewText:L,editReason:Y,onChangeEditText:E,onChangeEditNewText:j,onChangeEditReason:V,onKeyDown:re,onSave:W,onCancel:oe}):S.jsx("div",{style:{margin:0,color:"var(--tandem-fg)",lineHeight:"1.4"},children:R?S.jsxs(S.Fragment,{children:[S.jsxs("div",{"data-testid":`suggestion-diff-${e.id}`,style:{padding:"4px 8px",marginBottom:e.content?"4px":0,backgroundColor:"var(--tandem-surface-muted)",borderRadius:"3px",fontSize:"12px",lineHeight:"1.5"},children:[e.textSnapshot&&S.jsx("span",{style:{textDecoration:"line-through",color:"var(--tandem-error)",backgroundColor:"var(--tandem-error-bg)",padding:"0 2px",borderRadius:"2px"},children:e.textSnapshot}),e.textSnapshot&&" → ",S.jsx("span",{style:{color:"var(--tandem-success-fg-strong)",backgroundColor:"var(--tandem-success-bg)",padding:"0 2px",borderRadius:"2px"},children:e.suggestedText})]}),e.content&&S.jsx("p",{style:{margin:0,fontSize:"12px",color:"var(--tandem-fg-muted)"},children:e.content})]}):S.jsx("p",{style:{margin:0},children:e.content||"(no note)"})}),S.jsx(bU,{annotationId:e.id,isPending:b,isEditing:v,undoable:h,onAccept:i,onDismiss:s,onUndo:l,onRemove:f}),S.jsx(wU,{annotationId:e.id,replies:n,isPending:b,isEditing:v,onReply:u})]})}),Wf={padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",cursor:"pointer"};function AU({bulkConfirm:t,pendingCount:e,allPendingCount:n,confirmRef:r,onConfirmAccept:i,onConfirmDismiss:s,onCancel:l,onRequestAccept:c,onRequestDismiss:u}){if(e<=1)return null;const f=t==="accept",h=e===n?`${e} annotations?`:`${e} of ${n} pending?`;return S.jsx("div",{style:{padding:"6px 16px",borderBottom:"1px solid var(--tandem-border)",display:"flex",gap:"6px",alignItems:"center"},children:t?S.jsxs(S.Fragment,{children:[S.jsxs("span",{style:{fontSize:"11px",color:"var(--tandem-fg)"},children:[f?"Accept":"Reject"," ",h]}),S.jsx("button",{ref:r,"data-testid":"bulk-confirm-btn",onClick:f?i:s,style:{...Wf,background:f?"var(--tandem-success-bg)":"var(--tandem-error-bg)",color:f?"var(--tandem-success-fg-strong)":"var(--tandem-error-fg-strong)",fontWeight:600},children:"Confirm"}),S.jsx("button",{"data-testid":"bulk-cancel-btn",onClick:l,style:{...Wf,background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)"},children:"Cancel"})]}):S.jsxs(S.Fragment,{children:[S.jsxs("button",{"data-testid":"bulk-accept-btn",onClick:c,style:{...Wf,background:"var(--tandem-success-bg)",color:"var(--tandem-success-fg-strong)"},children:["Accept All (",e,")"]}),S.jsx("button",{"data-testid":"bulk-dismiss-btn",onClick:u,style:{...Wf,background:"var(--tandem-error-bg)",color:"var(--tandem-error-fg-strong)"},children:"Reject All"})]})})}function k0({value:t,onChange:e,options:n,testId:r}){return S.jsx("select",{"data-testid":r,value:t,onChange:i=>e(i.target.value),style:{padding:"2px 4px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-surface)",color:"var(--tandem-fg)",cursor:"pointer",outline:"none"},children:n.map(i=>S.jsx("option",{value:i.value,children:i.label},i.value))})}function MU({filterType:t,setFilterType:e,filterAuthor:n,setFilterAuthor:r,filterStatus:i,setFilterStatus:s,hasFilters:l,onClearFilters:c}){return S.jsxs("div",{style:{padding:"8px 16px",borderBottom:"1px solid var(--tandem-border)",display:"flex",gap:"4px",flexWrap:"wrap",alignItems:"center"},children:[S.jsx(k0,{testId:"filter-type",value:t,onChange:u=>e(u),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"}]}),S.jsx(k0,{testId:"filter-author",value:n,onChange:u=>r(u),options:[{value:"all",label:"Anyone"},{value:"claude",label:"Claude"},{value:"user",label:"You"},{value:"import",label:"Imported"}]}),S.jsx(k0,{testId:"filter-status",value:i,onChange:u=>s(u),options:[{value:"all",label:"Any status"},{value:"pending",label:"Pending"},{value:"accepted",label:"Accepted"},{value:"dismissed",label:"Dismissed"}]}),l&&S.jsx("button",{"data-testid":"clear-filters-btn",onClick:c,style:{background:"none",border:"none",color:"var(--tandem-accent)",fontSize:"11px",cursor:"pointer",padding:"2px 4px"},children:"Clear"})]})}function OU(t,e){M.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 _U(t,e,n){if(t.suggestedText===void 0)return!1;const r=t.suggestedText,i=Zh(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 DU({ydocRef:t,editorRef:e,annotations:n,onActiveAnnotationChange:r,reviewMode:i,onToggleReviewMode:s,onExitReviewMode:l,bulkConfirmRef:c,setBulkConfirm:u,scrollBehavior:f}){const[h,m]=M.useState(0),g=M.useRef(0),b=M.useRef(null),[v,k]=M.useState(new Set),C=M.useRef(null),E=M.useRef(new Map);M.useEffect(()=>()=>{for(const O of E.current.values())clearTimeout(O)},[]);const L=M.useMemo(()=>n.filter(O=>O.status==="pending"),[n]),j=M.useRef(L);j.current=L;function Y(O,_){const I=t.current;if(!I)return;const A=I.getMap(Aa),ne=A.get(O);if(!ne)return;const Z=$u(ne);if(A.set(O,{...Z,status:_}),_==="accepted"&&Z.suggestedText!==void 0&&e.current&&!_U(Z,e.current,t.current)){A.set(O,{...Z,status:"pending"});return}C.current=O,k(se=>new Set(se).add(O))}function V(O){const _=E.current.get(O);_&&clearTimeout(_),E.current.set(O,setTimeout(()=>{E.current.delete(O),k(I=>{const A=new Set(I);return A.delete(O),A})},3e3))}function R(O){const _=E.current.get(O);_&&(clearTimeout(_),E.current.delete(O)),k(I=>{const A=new Set(I);return A.delete(O),A})}function B(O){const _=t.current;if(!_)return!1;const I=_.getMap(Aa),A=I.get(O);if(!A||A.status==="pending")return R(O),!1;const ne=$u(A);if(ne.status==="accepted"&&ne.suggestedText!==void 0&&e.current)try{const Z=ne.suggestedText,se=ne.textSnapshot;if(typeof Z=="string"&&typeof se=="string"){const me=Zh(ne,e.current.state.doc,_);if(!me)return console.warn(`[undo] Cannot resolve range for annotation ${O}, skipping`),V(O),!1;if(e.current.state.doc.textBetween(me.from,me.to)!==Z)return console.warn(`[undo] Text changed since accept for annotation ${O}, skipping`),V(O),!1;e.current.chain().focus().deleteRange({from:me.from,to:me.to}).insertContentAt(me.from,se).run()}}catch(Z){return console.warn(`[undo] Failed to revert text for annotation ${O}:`,Z),V(O),!1}return I.set(O,{...ne,status:"pending"}),R(O),C.current===O&&(C.current=null),!0}function te(O){Y(O,"accepted")}function W(O){Y(O,"dismissed")}const oe=M.useCallback(O=>{const _=e.current;if(!_)return;const I=Zh(O,_.state.doc,t.current);if(!I)return;_.chain().focus().setTextSelection({from:I.from,to:I.to}).run();const A=_.view.domAtPos(I.from),ne=A.node instanceof HTMLElement?A.node:A.node.parentElement;ne==null||ne.scrollIntoView({behavior:f,block:"center"})},[f,e,t]),re=M.useCallback(O=>{const _=j.current;if(_.length===0)return;let I=g.current;I=O==="next"?(I+1)%_.length:(I-1+_.length)%_.length,g.current=I,m(I),oe(_[I])},[oe]),ie=M.useCallback(()=>{const O=j.current;if(O.length===0)return;const _=O[g.current];_&&Y(_.id,"accepted")},[]),ye=M.useCallback(()=>{const O=j.current;if(O.length===0)return;const _=O[g.current];_&&Y(_.id,"dismissed")},[]),ae=M.useRef(!1);M.useEffect(()=>{i&&!ae.current&&L.length>0&&(g.current=0,m(0),oe(L[0])),ae.current=i},[i,L,oe]),M.useEffect(()=>{var O;i&&L.length>0?r(((O=L[h])==null?void 0:O.id)??null):r(null)},[i,h,L,r]);const H=M.useCallback(()=>{const _=j.current[g.current];_&&oe(_),l()},[oe,l]),N=M.useCallback(()=>{const O=C.current;O&&B(O)},[]),K=M.useCallback(()=>{c.current?u(null):l()},[l,c,u]),he=M.useMemo(()=>({onToggleReviewMode:s,onExitReviewMode:l,navigateReview:re,acceptCurrent:ie,dismissCurrent:ye,scrollToCurrentAndExit:H,cancelBulkOrExit:K,undoLast:N}),[s,l,re,ie,ye,H,K,N]);OU(i,he),M.useEffect(()=>{if(i&&g.current>=L.length){const O=Math.max(0,L.length-1);g.current=O,m(O)}},[i,L.length]),M.useEffect(()=>{i&&L.length===0&&l()},[i,L.length,l]);const _e=i&&L.length>0?L[h]:null;return{resolveAnnotation:Y,undoResolveAnnotation:B,handleAccept:te,handleDismiss:W,scrollToAnnotation:oe,recentlyResolved:v,reviewIndex:h,reviewTargets:L,activeReviewAnn:_e,confirmRef:b}}function RU({annotations:t,editor:e,ydoc:n,heldCount:r=0,tandemMode:i,onModeChange:s,activeDocFormat:l,documentId:c,reviewMode:u,onToggleReviewMode:f,onExitReviewMode:h,activeAnnotationId:m,onActiveAnnotationChange:g,reduceMotion:b}){const v=b?"auto":"smooth",[k,C]=M.useState("all"),[E,L]=M.useState("all"),[j,Y]=M.useState("all"),[V,R]=M.useState(null),B=M.useRef(V);B.current=V;const te=M.useRef(n),W=M.useRef(e);te.current=n,W.current=e;const oe=DU({ydocRef:te,editorRef:W,annotations:t,onActiveAnnotationChange:g,reviewMode:u,onToggleReviewMode:f,onExitReviewMode:h,bulkConfirmRef:B,setBulkConfirm:R,scrollBehavior:v});M.useEffect(()=>{var Z;V&&((Z=oe.confirmRef.current)==null||Z.focus())},[V,oe.confirmRef]);const[re,ie]=M.useState(new Map);M.useEffect(()=>{if(!n){ie(new Map);return}const Z=n.getMap(sL);function se(){const Ee=new Map;Z.forEach(Te=>{const He=Te;if(He&&typeof He=="object"&&He.annotationId){const we=Ee.get(He.annotationId)??[];we.push(He),Ee.set(He.annotationId,we)}});for(const Te of Ee.values())Te.sort((He,we)=>He.timestamp-we.timestamp);ie(Ee)}se();const me=()=>se();return Z.observe(me),()=>Z.unobserve(me)},[n]);const{filtered:ye,pending:ae,resolved:H,allPending:N}=M.useMemo(()=>{const Z=[],se=[];for(const Te of t){Te.status==="pending"&&se.push(Te);let He;k==="all"?He=!0:k==="with-replacement"?He=Te.suggestedText!==void 0:k==="for-claude"?He=Te.directedAt==="claude":He=Te.type===k;const we=E==="all"||Te.author===E,Ge=j==="all"||Te.status===j;He&&we&&Ge&&Z.push(Te)}const me=Z.filter(Te=>Te.status==="pending"),Ee=Z.filter(Te=>Te.status!=="pending");return{filtered:Z,pending:me,resolved:Ee,allPending:se}},[t,k,E,j]);function K(Z,se){const me=te.current;if(!me)return;const Ee=me.getMap(Aa),Te=Ee.get(Z);if(!Te)return;const He=$u(Te);if(He.suggestedText!==void 0){try{const we=JSON.parse(se);Ee.set(Z,{...He,suggestedText:we.suggestedText,content:we.content,editedAt:Date.now()})}catch{console.warn(`[SidePanel] Failed to parse edit payload for annotation ${Z}`)}return}Ee.set(Z,{...He,content:se,editedAt:Date.now()})}async function he(Z){try{const se=await fetch(`${rl}/remove-annotation`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({annotationId:Z,documentId:c})});if(!se.ok){const me=await se.json().catch(()=>({message:"Unknown error"}));console.error("[Tandem] Remove annotation failed:",me)}}catch(se){console.error("[Tandem] Remove annotation failed:",se)}}async function _e(Z,se){try{const me=await fetch(`${rl}/annotation-reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({annotationId:Z,text:se,documentId:c})});if(!me.ok){const Ee=await me.json().catch(()=>({}));return console.warn(`[SidePanel] Reply failed (${me.status}): ${Ee.message??"unknown error"}`),!1}return!0}catch(me){return console.error("[SidePanel] Reply request failed:",me),!1}}function O(Z){for(const se of ae)oe.resolveAnnotation(se.id,Z);R(null)}M.useEffect(()=>{R(null)},[k,E,j]);const _=M.useRef(null),I=M.useRef(!1),A=M.useRef(m);A.current=m,M.useEffect(()=>{var se;if(!I.current){I.current=!0;return}const Z=A.current;if(Z){const me=document.querySelector(`[data-testid="annotation-card-${Z}"]`);if(me){me.scrollIntoView({block:"center"});return}console.warn(`[tandem] SidePanel: active annotation ${Z} not found on filter change; scrolling to top`)}(se=_.current)==null||se.scrollTo({top:0})},[k,E,j]),M.useEffect(()=>{if(!m)return;const Z=setTimeout(()=>{const se=document.querySelector(`[data-testid="annotation-card-${m}"]`);if(se){se.scrollIntoView({behavior:v,block:"nearest"}),se.classList.add("tandem-annotation-flash");const me=()=>se.classList.remove("tandem-annotation-flash");se.addEventListener("animationend",me,{once:!0})}else console.warn(`[tandem] SidePanel: active annotation ${m} not found after 50ms delay; scroll-to-card skipped`)},50);return()=>clearTimeout(Z)},[m,v]);const ne=k!=="all"||E!=="all"||j!=="all";return S.jsxs("div",{ref:_,"data-testid":"annotation-list-scroll-container",style:{width:"100%",background:"var(--tandem-surface-muted)",display:"flex",flexDirection:"column",overflowY:"auto"},children:[r>0&&S.jsxs("div",{style:{padding:"6px 16px",background:w0.background,borderBottom:`1px solid ${w0.border}`,fontSize:"12px",color:w0.color,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[S.jsxs("span",{"data-testid":"held-banner",children:[r," annotation",r!==1?"s":""," held"]}),S.jsx("button",{onClick:()=>s==null?void 0:s("tandem"),style:{fontSize:"11px",padding:"1px 8px",border:"1px solid var(--tandem-warning-border)",borderRadius:"4px",background:"var(--tandem-surface)",color:"var(--tandem-warning-fg-strong)",cursor:"pointer",fontWeight:500},children:"Show all"})]}),S.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--tandem-border)"},children:S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[S.jsxs("h3",{style:{fontSize:"14px",fontWeight:600,margin:0},children:["Annotations",N.length>0&&S.jsx("span",{style:{marginLeft:"8px",padding:"1px 6px",fontSize:"11px",background:"var(--tandem-accent)",color:"var(--tandem-accent-fg)",borderRadius:"10px"},children:N.length})]}),S.jsxs("span",{"aria-live":"polite",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)"},children:[N.length," pending annotation",N.length!==1?"s":""]}),N.length>0&&S.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end"},children:[S.jsx("button",{"data-testid":"review-mode-btn",onClick:f,title:"Keyboard review mode (Ctrl+Shift+R)","aria-pressed":u,style:{padding:"2px 8px",fontSize:"11px",border:`1px solid ${u?"var(--tandem-accent)":"var(--tandem-border-strong)"}`,borderRadius:"3px",background:u?"var(--tandem-accent-bg)":"var(--tandem-surface)",color:u?"var(--tandem-accent)":"var(--tandem-fg-muted)",cursor:"pointer",fontWeight:u?600:400},children:u?"Exit Review":"Review"}),S.jsx("div",{"data-testid":"review-shortcut-hints",style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"2px"},children:"Y / N / ↑↓ / Z"})]})]})}),u&&oe.reviewTargets.length>0&&S.jsxs("div",{style:{padding:"8px 16px",background:"var(--tandem-accent-bg)",borderBottom:"1px solid var(--tandem-border)",fontSize:"12px",color:"var(--tandem-accent-fg-strong)"},children:[S.jsxs("div",{"aria-live":"polite",style:{fontWeight:600,marginBottom:"2px"},children:["Reviewing ",oe.reviewIndex+1," / ",oe.reviewTargets.length]}),S.jsx("div",{style:{color:"var(--tandem-accent)"},children:"Tab: next · Shift+Tab: prev · Y: accept · N: dismiss · Z: undo · E: examine · Esc: exit"})]}),S.jsx(MU,{filterType:k,setFilterType:C,filterAuthor:E,setFilterAuthor:L,filterStatus:j,setFilterStatus:Y,hasFilters:ne,onClearFilters:()=>{C("all"),L("all"),Y("all")}}),S.jsx("div",{style:{padding:"4px 16px 0"},children:S.jsx(yU,{annotations:t,activeDocFormat:l,documentId:c})}),S.jsx(AU,{bulkConfirm:V,pendingCount:ae.length,allPendingCount:N.length,confirmRef:oe.confirmRef,onConfirmAccept:()=>O("accepted"),onConfirmDismiss:()=>O("dismissed"),onCancel:()=>R(null),onRequestAccept:()=>R("accept"),onRequestDismiss:()=>R("dismiss")}),S.jsx("div",{style:{padding:"8px 16px",flex:1},role:"list","aria-label":"Annotations",children:ye.length===0?S.jsx("p",{role:"status",style:{fontSize:"13px",color:"var(--tandem-fg-subtle)",marginTop:"8px"},children:ne?"No annotations match filters.":"No annotations yet. Open a document to get started."}):S.jsxs(S.Fragment,{children:[ae.map(Z=>{var me;const se=((me=oe.activeReviewAnn)==null?void 0:me.id)===Z.id;return S.jsx(qE,{annotation:Z,replies:re.get(Z.id)??[],isReviewTarget:se,onAccept:Z.author!=="user"?oe.handleAccept:void 0,onDismiss:Z.author!=="user"?oe.handleDismiss:void 0,onRemove:Z.author==="user"?he:void 0,onEdit:K,onReply:_e,onClick:()=>oe.scrollToAnnotation(Z)},Z.id)}),H.length>0&&S.jsxs("details",{style:{marginTop:"12px"},children:[S.jsxs("summary",{style:{fontSize:"12px",color:"var(--tandem-fg-subtle)",cursor:"pointer"},children:[H.length," resolved"]}),S.jsx("div",{role:"list","aria-label":"Resolved annotations",children:H.map(Z=>S.jsx(qE,{annotation:Z,replies:re.get(Z.id)??[],onUndo:oe.undoResolveAnnotation,undoable:oe.recentlyResolved.has(Z.id),onClick:()=>oe.scrollToAnnotation(Z)},Z.id))})]})]})}),S.jsx("style",{children:`
81
+ @keyframes tandem-annotation-flash {
82
+ 0% { background-color: color-mix(in srgb, var(--tandem-accent) 20%, transparent); }
83
+ 100% { background-color: transparent; }
84
+ }
85
+ .tandem-annotation-flash {
86
+ animation: tandem-annotation-flash 0.8s ease-out;
87
+ }
88
+ @media (prefers-reduced-motion: reduce) {
89
+ .tandem-annotation-flash { animation: none; }
90
+ }
91
+ body.tandem-reduce-motion .tandem-annotation-flash { animation: none; }
92
+ `})]})}function j_({visible:t,children:e}){return t===void 0?S.jsx(S.Fragment,{children:e}):S.jsx("div",{style:{display:t?"flex":"none",flexDirection:"column",flex:1,minHeight:0},children:e})}function C0({visible:t,...e}){return S.jsx(j_,{visible:t,children:S.jsx(pU,{...e,visible:t})})}function E0({visible:t,...e}){return S.jsx(j_,{visible:t,children:S.jsx(RU,{...e})})}const KE="tandem:reviewOnlyBannerDismissed";function YE({visible:t,documentId:e}){const[n,r]=M.useState(()=>{try{return localStorage.getItem(KE)==="true"}catch{return!1}}),[i,s]=M.useState(!1),[l,c]=M.useState(null);if(!t||n)return null;async function u(){if(!(!e||i)){s(!0),c(null);try{const f=await fetch(`${rl}/convert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:e})});if(!f.ok){const h=await f.json().catch(()=>null);c((h==null?void 0:h.message)??`Conversion failed (HTTP ${f.status}).`)}}catch{c("Could not reach the server.")}finally{s(!1)}}}return S.jsxs("div",{"data-testid":"review-only-banner",style:{padding:"8px 16px",backgroundColor:"var(--tandem-info-bg)",borderBottom:"1px solid var(--tandem-info-border)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"13px",color:"var(--tandem-info-fg-strong)",gap:"12px"},children:[S.jsx("span",{children:"This document is open in review-only mode. You can add annotations and review, but cannot edit directly."}),S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[l&&S.jsx("span",{style:{color:"var(--tandem-error-fg-strong)",fontSize:"12px",maxWidth:"200px"},children:l}),e&&S.jsx("button",{type:"button","data-testid":"convert-to-markdown-btn",onClick:u,disabled:i,style:{background:"var(--tandem-info)",border:"none",color:"var(--tandem-info-fg)",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"}),S.jsx("button",{type:"button","data-testid":"review-only-dismiss",onClick:()=>{try{localStorage.setItem(KE,"true")}catch{}r(!0)},style:{background:"none",border:"none",color:"var(--tandem-info-fg-strong)",cursor:"pointer",fontWeight:500,fontSize:"13px",padding:"2px 8px",whiteSpace:"nowrap"},children:"Dismiss"})]})]})}function S1(t){return(t==null?void 0:t.trim())||bM}function w1(){try{return S1(localStorage.getItem(Dx))}catch{return bM}}function NU(t){const e=S1(t);try{localStorage.setItem(Dx,e)}catch{}return typeof window<"u"&&window.dispatchEvent(new Event(ab)),e}function I_(t){const e=()=>t(w1()),n=r=>{r.key===Dx&&t(S1(r.newValue))};return window.addEventListener(ab,e),window.addEventListener("storage",n),()=>{window.removeEventListener(ab,e),window.removeEventListener("storage",n)}}function B_(){const[t,e]=M.useState(w1);M.useEffect(()=>I_(e),[]);const n=M.useCallback(r=>{const i=NU(r);e(i)},[]);return{userName:t,setUserName:n}}const ns={fontSize:"11px",fontWeight:600,color:"var(--tandem-fg)",marginBottom:"6px",textTransform:"uppercase",letterSpacing:"0.5px"};function zU({settings:t,onUpdate:e}){return S.jsxs("div",{children:[S.jsx("div",{style:ns,children:"Authorship"}),S.jsxs("label",{"data-testid":"authorship-toggle",style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",fontSize:"12px",color:"var(--tandem-fg)",minHeight:"24px"},children:[S.jsx("input",{type:"checkbox",checked:t.showAuthorship,onChange:n=>e({showAuthorship:n.target.checked}),style:{accentColor:"var(--tandem-accent)"}}),S.jsx("span",{children:"Show who wrote what"})]}),S.jsxs("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:["Highlights text by author: ",S.jsx("span",{style:{color:"var(--tandem-author-user)"},children:"you"})," /"," ",S.jsx("span",{style:{color:"var(--tandem-author-claude)"},children:"Claude"})]})]})}function eu(t,e,n,r){const i=r?e.filter(u=>!r(u)):e,s=u=>{var C;const{key:f}=u;if(f!=="ArrowLeft"&&f!=="ArrowRight"&&f!=="ArrowUp"&&f!=="ArrowDown"&&f!=="Home"&&f!=="End"||i.length===0)return;u.preventDefault();const h=i.indexOf(t),m=i.length-1;let g;f==="Home"?g=0:f==="End"?g=m:f==="ArrowLeft"||f==="ArrowUp"?g=h<=0?m:h-1:g=h>=m?0:h+1;const b=i[g];n(b);const v=u.currentTarget.querySelectorAll('[role="radio"]'),k=e.indexOf(b);(C=v[k])==null||C.focus()},l=r!=null&&r(t)?i[0]:t;return{handleKeyDown:s,tabIndexFor:u=>r!=null&&r(u)?-1:u===l?0:-1}}function Bs(t,e){return{flex:1,padding:"8px",minHeight:"24px",border:`2px solid ${t?"var(--tandem-accent)":"var(--tandem-border)"}`,borderRadius:"6px",background:e?"var(--tandem-surface-muted)":t?"var(--tandem-accent-bg)":"var(--tandem-surface)",cursor:e?"not-allowed":"pointer",textAlign:"center",fontSize:"11px",color:e?"var(--tandem-fg-subtle)":t?"var(--tandem-accent-fg-strong)":"var(--tandem-fg-muted)",fontWeight:t?600:400,opacity:e?.6:1,transition:"border-color 0.15s, background 0.15s"}}function LU({open:t,settings:e,onUpdate:n}){const[r,i]=M.useState(window.innerWidth),s=r<768,l=eu(e.theme,["light","dark","system"],m=>n({theme:m})),c=eu(e.layout,["tabbed","three-panel"],m=>n({layout:m}),m=>m==="three-panel"&&s),u=eu(e.primaryTab,["chat","annotations"],m=>n({primaryTab:m})),f=eu(e.panelOrder,["chat-editor-annotations","annotations-editor-chat"],m=>n({panelOrder:m})),h=eu(e.textSize,["s","m","l"],m=>n({textSize:m}));return M.useEffect(()=>{if(!t)return;i(window.innerWidth);const m=()=>i(window.innerWidth);return window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[t]),S.jsxs(S.Fragment,{children:[S.jsxs("div",{children:[S.jsx("div",{id:"settings-theme-label",style:ns,children:"Theme"}),S.jsx("div",{role:"radiogroup","aria-labelledby":"settings-theme-label",onKeyDown:l.handleKeyDown,style:{display:"flex",gap:"8px"},children:["light","dark","system"].map(m=>S.jsx("button",{"data-testid":`theme-${m}-btn`,role:"radio","aria-checked":e.theme===m,tabIndex:l.tabIndexFor(m),onClick:()=>n({theme:m}),style:Bs(e.theme===m),children:m==="light"?"Light":m==="dark"?"Dark":"System"},m))})]}),S.jsxs("div",{children:[S.jsx("div",{id:"settings-layout-label",style:ns,children:"Layout"}),S.jsxs("div",{role:"radiogroup","aria-labelledby":"settings-layout-label",onKeyDown:c.handleKeyDown,style:{display:"flex",gap:"8px"},children:[S.jsxs("button",{"data-testid":"layout-tabbed-btn",role:"radio","aria-checked":e.layout==="tabbed",tabIndex:c.tabIndexFor("tabbed"),onClick:()=>n({layout:"tabbed"}),style:Bs(e.layout==="tabbed"),children:[S.jsx("div",{style:{fontSize:"18px",marginBottom:"2px"},children:"[=|]"}),"Tabbed"]}),S.jsxs("button",{"data-testid":"layout-three-panel-btn",role:"radio","aria-checked":e.layout==="three-panel","aria-disabled":s||void 0,tabIndex:c.tabIndexFor("three-panel"),onClick:()=>{s||n({layout:"three-panel"})},style:Bs(e.layout==="three-panel",s),title:s?"Requires viewport wider than 768px":void 0,children:[S.jsx("div",{style:{fontSize:"18px",marginBottom:"2px"},children:"[|||]"}),"Three-Panel"]})]}),s&&S.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:"Three-panel requires a wider viewport"})]}),e.layout==="tabbed"&&S.jsxs("div",{children:[S.jsx("div",{id:"settings-default-tab-label",style:ns,children:"Default Tab"}),S.jsxs("div",{role:"radiogroup","aria-labelledby":"settings-default-tab-label",onKeyDown:u.handleKeyDown,style:{display:"flex",gap:"8px"},children:[S.jsx("button",{"data-testid":"default-tab-chat-btn",role:"radio","aria-checked":e.primaryTab==="chat",tabIndex:u.tabIndexFor("chat"),onClick:()=>n({primaryTab:"chat"}),style:Bs(e.primaryTab==="chat"),children:"Chat"}),S.jsx("button",{"data-testid":"default-tab-annotations-btn",role:"radio","aria-checked":e.primaryTab==="annotations",tabIndex:u.tabIndexFor("annotations"),onClick:()=>n({primaryTab:"annotations"}),style:Bs(e.primaryTab==="annotations"),children:"Annotations"})]})]}),e.layout==="three-panel"&&S.jsxs("div",{children:[S.jsx("div",{id:"settings-panel-order-label",style:ns,children:"Panel Order"}),S.jsxs("div",{role:"radiogroup","aria-labelledby":"settings-panel-order-label",onKeyDown:f.handleKeyDown,style:{display:"flex",gap:"8px"},children:[S.jsx("button",{"data-testid":"panel-order-cea-btn",role:"radio","aria-checked":e.panelOrder==="chat-editor-annotations",tabIndex:f.tabIndexFor("chat-editor-annotations"),onClick:()=>n({panelOrder:"chat-editor-annotations"}),style:Bs(e.panelOrder==="chat-editor-annotations"),children:"Chat | Editor | Ann."}),S.jsx("button",{"data-testid":"panel-order-aec-btn",role:"radio","aria-checked":e.panelOrder==="annotations-editor-chat",tabIndex:f.tabIndexFor("annotations-editor-chat"),onClick:()=>n({panelOrder:"annotations-editor-chat"}),style:Bs(e.panelOrder==="annotations-editor-chat"),children:"Ann. | Editor | Chat"})]})]}),S.jsxs("div",{children:[S.jsx("div",{id:"settings-text-size-label",style:ns,children:"Text Size"}),S.jsx("div",{role:"radiogroup","aria-labelledby":"settings-text-size-label",onKeyDown:h.handleKeyDown,style:{display:"flex",gap:"8px"},children:["s","m","l"].map(m=>S.jsx("button",{"data-testid":`text-size-${m}-btn`,role:"radio","aria-checked":e.textSize===m,tabIndex:h.tabIndexFor(m),onClick:()=>n({textSize:m}),style:Bs(e.textSize===m),children:m==="s"?"Small":m==="m"?"Medium":"Large"},m))}),S.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."})]}),S.jsxs("div",{children:[S.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:[S.jsx("input",{type:"checkbox",checked:e.reduceMotion,onChange:m=>n({reduceMotion:m.target.checked}),style:{accentColor:"var(--tandem-accent)"}}),S.jsx("span",{children:"Reduce motion"})]}),S.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:"Disables smooth autoscroll and the annotation flash animation."})]})]})}function jU({settings:t,onUpdate:e}){return S.jsxs("div",{children:[S.jsxs("div",{style:ns,children:["Editor Width:"," ",S.jsxs("span",{style:{fontWeight:400,textTransform:"none"},children:[t.editorWidthPercent,"%"]})]}),S.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginBottom:"6px"},children:"How much of the available space the editor text fills"}),S.jsx("input",{"data-testid":"editor-width-slider",type:"range",min:50,max:100,step:5,value:t.editorWidthPercent,onChange:n=>e({editorWidthPercent:Number(n.target.value)}),style:{width:"100%",accentColor:"var(--tandem-accent)"},"aria-label":"Editor width"}),S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:[S.jsx("span",{children:"50%"}),S.jsx("span",{children:"100%"})]})]})}const IU=M.lazy(()=>Rx(()=>import("./CoworkSettings-CXODT6KV.js"),[]).then(t=>({default:t.CoworkSettings}))),BU=320,WE="tandem-settings-heading",UU='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function HU({open:t,onClose:e,settings:n,onUpdate:r,returnFocusRef:i,anchorRef:s}){const l=M.useRef(null),c=M.useRef(null),{userName:u,setUserName:f}=B_(),[h,m]=M.useState(u);return M.useEffect(()=>{h!==u&&document.activeElement!==c.current&&m(u)},[u,h]),M.useEffect(()=>{if(!t)return;const g=l.current;return g==null||g.focus(),()=>{var b;(b=i==null?void 0:i.current)==null||b.focus()}},[t,i]),M.useEffect(()=>{if(!t)return;const g=v=>{var C;const k=v.target;(C=s==null?void 0:s.current)!=null&&C.contains(k)||l.current&&!l.current.contains(k)&&e()},b=setTimeout(()=>document.addEventListener("pointerdown",g),0);return()=>{clearTimeout(b),document.removeEventListener("pointerdown",g)}},[t,e,s]),M.useEffect(()=>{if(!t)return;const g=b=>{if(b.key==="Escape"){e();return}if(b.key!=="Tab"||!l.current)return;const v=l.current.querySelectorAll(UU);if(v.length===0)return;const k=v[0],C=v[v.length-1],E=document.activeElement;if(!l.current.contains(E)){b.preventDefault(),k.focus();return}b.shiftKey&&E===k?(b.preventDefault(),C.focus()):!b.shiftKey&&E===C&&(b.preventDefault(),k.focus())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[t,e]),t?S.jsxs("div",{ref:l,"data-testid":"settings-popover",role:"dialog","aria-modal":"true","aria-labelledby":WE,tabIndex:-1,style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",maxHeight:"calc(100vh - 32px)",overflowY:"auto",width:`${BU}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:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[S.jsx("span",{id:WE,style:{fontSize:"13px",fontWeight:600,color:"var(--tandem-fg)"},children:"Settings"}),S.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:"×"})]}),S.jsxs("div",{children:[S.jsx("label",{htmlFor:"settings-display-name",style:ns,children:"Display Name"}),S.jsx("input",{ref:c,id:"settings-display-name","data-testid":"settings-display-name",type:"text",value:h,onChange:g=>m(g.target.value),onBlur:()=>f(h),onKeyDown:g=>{g.key==="Enter"&&g.currentTarget.blur(),g.key==="Escape"&&(m(u),g.currentTarget.blur())},maxLength:xM,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"}})]}),S.jsx(LU,{open:t,settings:n,onUpdate:r}),S.jsx(jU,{settings:n,onUpdate:r}),S.jsx(zU,{settings:n,onUpdate:r}),S.jsxs("div",{children:[S.jsxs("div",{style:ns,children:["Selection Sensitivity:"," ",S.jsxs("span",{style:{fontWeight:400,textTransform:"none"},children:[(n.selectionDwellMs/1e3).toFixed(1),"s"]})]}),S.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginBottom:"6px"},children:"How long you must hold a selection before Claude notices it"}),S.jsx("input",{"data-testid":"dwell-time-slider",type:"range",min:Nh,max:zh,step:100,value:n.selectionDwellMs,onChange:g=>r({selectionDwellMs:Number(g.target.value)}),style:{width:"100%",accentColor:"var(--tandem-accent)"},"aria-label":"Selection dwell time"}),S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:[S.jsxs("span",{children:[(Nh/1e3).toFixed(1),"s"]}),S.jsxs("span",{children:[(zh/1e3).toFixed(1),"s"]})]})]}),dd()&&S.jsx(M.Suspense,{fallback:S.jsx("div",{"data-testid":"cowork-settings-suspense-fallback",style:{fontSize:12,color:"var(--tandem-fg-subtle)"},children:"Loading Cowork integration..."}),children:S.jsx(IU,{})})]}):null}const VU={error:"var(--tandem-error)",warning:"var(--tandem-warning)",info:"var(--tandem-accent)"},PU={error:"var(--tandem-error-bg)",warning:"var(--tandem-warning-bg)",info:"var(--tandem-accent-bg)"},$U={error:"var(--tandem-error-fg-strong)",warning:"var(--tandem-warning-fg-strong)",info:"var(--tandem-accent-fg-strong)"};function FU({toasts:t,onDismiss:e}){return t.length===0?null:S.jsxs(S.Fragment,{children:[S.jsx("style",{children:`
93
+ @keyframes tandem-toast-slide-in {
94
+ from {
95
+ opacity: 0;
96
+ transform: translateX(40px);
97
+ }
98
+ to {
99
+ opacity: 1;
100
+ transform: translateX(0);
101
+ }
102
+ }
103
+ `}),S.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=>S.jsx(qU,{toast:n,onDismiss:e},n.id))})]})}function qU({toast:t,onDismiss:e}){const n=VU[t.severity],r=PU[t.severity],i=$U[t.severity],s=t.severity==="info"?"status":"alert";return S.jsxs("div",{role:s,"data-testid":`toast-${t.id}`,style:{pointerEvents:"auto",background:"var(--tandem-surface)",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:"var(--tandem-fg)"},children:[S.jsx("span",{children:t.message}),t.count>1&&S.jsxs("span",{"data-testid":`toast-count-${t.id}`,style:{marginLeft:6,fontSize:11,fontWeight:600,color:i,background:r,padding:"1px 5px",borderRadius:8},children:["×",t.count]}),S.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:"var(--tandem-fg-subtle)",lineHeight:1,padding:"2px 4px"},"aria-label":"Dismiss notification",children:"×"})]})}function Sn(t){this.content=t}Sn.prototype={constructor:Sn,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 Sn(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 Sn(n)},addToStart:function(t,e){return new Sn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Sn(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 Sn(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=Sn.from(t),t.size?new Sn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Sn.from(t),t.size?new Sn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Sn.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}};Sn.from=function(t){if(t instanceof Sn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Sn(e)};function U_(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=U_(i.content,s.content,n+1);if(l!=null)return l}n+=i.nodeSize}}function H_(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),u=l.nodeSize;if(l==c){n-=u,r-=u;continue}if(!l.sameMarkup(c))return{a:n,b:r};if(l.isText&&l.text!=c.text){let f=0,h=Math.min(l.text.length,c.text.length);for(;f<h&&l.text[l.text.length-f-1]==c.text[c.text.length-f-1];)f++,n--,r--;return{a:n,b:r}}if(l.content.size||c.content.size){let f=H_(l.content,c.content,n-1,r-1);if(f)return f}n-=u,r-=u}}class ee{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 u=this.content[l],f=c+u.nodeSize;if(f>e&&r(u,i+c,s||null,l)!==!1&&u.content.size){let h=c+1;u.nodesBetween(Math.max(0,e-h),Math.min(u.content.size,n-h),r,i+h)}c=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",l=!0;return this.nodesBetween(e,n,(c,u)=>{let f=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&f||c.isTextblock)&&r&&(l?l=!1:s+=r),s+=f},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 ee(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],u=l+c.nodeSize;u>e&&((l<e||u>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=u}return new ee(r,i)}cutByIndex(e,n){return e==n?ee.empty:e==0&&n==this.content.length?this:new ee(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 ee(i,s)}addToStart(e){return new ee([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ee(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 U_(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return H_(this,e,n,r)}findIndex(e){if(e==0)return Gf(0,e);if(e==this.size)return Gf(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?Gf(n+1,s):Gf(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 ee.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ee(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ee.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 ee(n||e,r)}static from(e){if(!e)return ee.empty;if(e instanceof ee)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ee([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ee.empty=new ee([],0);const T0={index:0,offset:0};function Gf(t,e){return T0.index=t,T0.offset=e,T0}function Jh(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(!Jh(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Jh(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let yt=class Rb{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&&Jh(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 Rb.none;if(e instanceof Rb)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};yt.none=[];class Xh extends Error{}class fe{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=P_(this.content,e+this.openStart,n);return r&&new fe(r,this.openStart,this.openEnd)}removeBetween(e,n){return new fe(V_(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 fe.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 fe(ee.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 fe(e,r,i)}}fe.empty=new fe(ee.empty,0,0);function V_(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(V_(s.content,e-i-1,n-i-1)))}function P_(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=P_(l.content,e-s-1,n,l);return c&&t.replaceChild(i,l.copy(c))}function KU(t,e,n){if(n.openStart>t.depth)throw new Xh("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Xh("Inconsistent open depths");return $_(t,e,n,0)}function $_(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=$_(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 Yo(l,c.cut(0,t.parentOffset).append(n.content).append(c.cut(e.parentOffset)))}else{let{start:l,end:c}=YU(n,t);return Yo(s,q_(t,l,c,e,r))}else return Yo(s,Qh(t,e,r))}function F_(t,e){if(!e.type.compatibleContent(t.type))throw new Xh("Cannot join "+e.type.name+" onto "+t.type.name)}function Nb(t,e,n){let r=t.node(n);return F_(r,e.node(n)),r}function Ko(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 hu(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&&(Ko(t.nodeAfter,r),s++));for(let c=s;c<l;c++)Ko(i.child(c),r);e&&e.depth==n&&e.textOffset&&Ko(e.nodeBefore,r)}function Yo(t,e){return t.type.checkContent(e),t.copy(e)}function q_(t,e,n,r,i){let s=t.depth>i&&Nb(t,e,i+1),l=r.depth>i&&Nb(n,r,i+1),c=[];return hu(null,t,i,c),s&&l&&e.index(i)==n.index(i)?(F_(s,l),Ko(Yo(s,q_(t,e,n,r,i+1)),c)):(s&&Ko(Yo(s,Qh(t,e,i+1)),c),hu(e,n,i,c),l&&Ko(Yo(l,Qh(n,r,i+1)),c)),hu(r,null,i,c),new ee(c)}function Qh(t,e,n){let r=[];if(hu(null,t,n,r),t.depth>n){let i=Nb(t,e,n+1);Ko(Yo(i,Qh(t,e,n+1)),r)}return hu(e,null,n,r),new ee(r)}function YU(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(ee.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Fu{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 yt.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 ep(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:u}=l.content.findIndex(s),f=s-u;if(r.push(l,c,i+u),!f||(l=l.child(c),l.isText))break;s=f-1,i+=u+1}return new Fu(n,r,s)}static resolveCached(e,n){let r=GE.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 GE.set(e,r=new WU);let i=r.elts[r.i]=Fu.resolve(e,n);return r.i=(r.i+1)%GU,i}}class WU{constructor(){this.elts=[],this.i=0}}const GU=12,GE=new WeakMap;class ep{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 ZU=Object.create(null);let Qs=class zb{constructor(e,n,r,i=yt.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||ee.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&&Jh(this.attrs,n||e.defaultAttrs||ZU)&&yt.sameSet(this.marks,r||yt.none)}copy(e=null){return e==this.content?this:new zb(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new zb(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 fe.empty;let i=this.resolve(e),s=this.resolve(n),l=r?0:i.sharedDepth(n),c=i.start(l),f=i.node(l).content.cut(i.pos-c,s.pos-c);return new fe(f,i.depth-l,s.depth-l)}replace(e,n,r){return KU(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 Fu.resolveCached(this,e)}resolveNoCache(e){return Fu.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()+")"),K_(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=ee.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 u=i;u<s;u++)if(!this.type.allowsMarks(r.child(u).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=yt.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(!yt.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=ee.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Qs.prototype.text=void 0;class tp extends Qs{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):K_(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 tp(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new tp(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 K_(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class il{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new JU(e,n);if(r.next==null)return il.empty;let i=Y_(r);r.next&&r.err("Unexpected trailing text");let s=iH(rH(i));return sH(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 u=l.matchFragment(e,r);if(u&&(!n||u.validEnd))return ee.from(c.map(f=>f.createAndFill()));for(let f=0;f<l.next.length;f++){let{type:h,next:m}=l.next[f];if(!(h.isText||h.hasRequiredAttrs())&&i.indexOf(m)==-1){i.push(m);let g=s(m,c.concat(h));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:u}=s.next[l];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in n)&&(!i.type||u.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(`
104
+ `)}}il.empty=new il(!0);class JU{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 Y_(t){let e=[];do e.push(XU(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function XU(t){let e=[];do e.push(QU(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function QU(t){let e=nH(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=eH(t,e);else break;return e}function ZE(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function eH(t,e){let n=ZE(t),r=n;return t.eat(",")&&(t.next!="}"?r=ZE(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function tH(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 nH(t){if(t.eat("(")){let e=Y_(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=tH(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 rH(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(l,c,u){let f={term:u,to:c};return e[l].push(f),f}function i(l,c){l.forEach(u=>u.to=c)}function s(l,c){if(l.type=="choice")return l.exprs.reduce((u,f)=>u.concat(s(f,c)),[]);if(l.type=="seq")for(let u=0;;u++){let f=s(l.exprs[u],c);if(u==l.exprs.length-1)return f;i(f,c=n())}else if(l.type=="star"){let u=n();return r(c,u),i(s(l.expr,u),u),[r(u)]}else if(l.type=="plus"){let u=n();return i(s(l.expr,c),u),i(s(l.expr,u),u),[r(u)]}else{if(l.type=="opt")return[r(c)].concat(s(l.expr,c));if(l.type=="range"){let u=c;for(let f=0;f<l.min;f++){let h=n();i(s(l.expr,u),h),u=h}if(l.max==-1)i(s(l.expr,u),u);else for(let f=l.min;f<l.max;f++){let h=n();r(u,h),i(s(l.expr,u),h),u=h}return[r(u)]}else{if(l.type=="name")return[r(c,void 0,l.value)];throw new Error("Unknown expr type")}}}}function W_(t,e){return e-t}function JE(t,e){let n=[];return r(e),n.sort(W_);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:u}=s[l];!c&&n.indexOf(u)==-1&&r(u)}}}function iH(t){let e=Object.create(null);return n(JE(t,0));function n(r){let i=[];r.forEach(l=>{t[l].forEach(({term:c,to:u})=>{if(!c)return;let f;for(let h=0;h<i.length;h++)i[h][0]==c&&(f=i[h][1]);JE(t,u).forEach(h=>{f||i.push([c,f=[]]),f.indexOf(h)==-1&&f.push(h)})})});let s=e[r.join(",")]=new il(r.indexOf(t.length-1)>-1);for(let l=0;l<i.length;l++){let c=i[l][1].sort(W_);s.next.push({type:i[l][0],next:e[c.join(",")]||n(c)})}return s}}function sH(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:u,next:f}=i.next[c];l.push(u.name),s&&!(u.isText||u.hasRequiredAttrs())&&(s=!1),r.indexOf(f)==-1&&r.push(f)}s&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function G_(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 Z_(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 J_(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 X_(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new lH(t,r,e[r]);return n}let XE=class Q_{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=X_(e,r.attrs),this.defaultAttrs=G_(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==il.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:Z_(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Qs(this,this.computeAttrs(e),ee.from(n),yt.setFrom(r))}createChecked(e=null,n,r){return n=ee.from(n),this.checkContent(n),new Qs(this,this.computeAttrs(e),n,yt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ee.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(ee.empty,!0);return s?new Qs(this,e,n.append(s),yt.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){J_(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:yt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,l)=>r[s]=new Q_(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 oH(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 lH{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?oH(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class hm{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=X_(e,i.attrs),this.excluded=null;let s=G_(this.attrs);this.instance=s?new yt(this,s):null}create(e=null){return!e&&this.instance?this.instance:new yt(this,Z_(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,l)=>r[s]=new hm(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){J_(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class eD{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=Sn.from(e.nodes),n.marks=Sn.from(e.marks||{}),this.nodes=XE.compile(this.spec.nodes,this),this.marks=hm.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]=il.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?QE(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==""?[]:QE(this,l.split(" "))}this.nodeFromJSON=i=>Qs.fromJSON(this,i),this.markFromJSON=i=>yt.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 XE){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 tp(r,r.defaultAttrs,e,yt.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 QE(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 u=t.marks[c];(i=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(i)>-1)&&n.push(l=u)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function aH(t){return t.tag!=null}function cH(t){return t.style!=null}let pu=class Lb{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(aH(i))this.tags.push(i);else if(cH(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 tT(this,n,!1);return r.addAll(e,yt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new tT(this,n,!0);return r.addAll(e,yt.none,n.from,n.to),fe.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(fH(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 u=l.getAttrs(n);if(u===!1)continue;l.attrs=u||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=nT(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=nT(l)),l.node||l.ignore||l.mark||(l.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Lb(e,Lb.schemaRules(e)))}};const tD={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},uH={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},nD={ol:!0,ul:!0},qu=1,jb=2,mu=4;function eT(t,e,n){return e!=null?(e?qu:0)|(e==="full"?jb:0):t&&t.whitespace=="pre"?qu|jb:n&~mu}class Zf{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=yt.none,this.match=s||(l&mu?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ee.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&qu)){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=ee.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ee.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&&!tD.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class tT{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=eT(null,n.preserveWhitespace,0)|(r?mu:0);i?s=new Zf(i.type,i.attrs,yt.none,!0,n.topMatch||i.type.contentMatch,l):r?s=new Zf(null,null,yt.none,!0,null,l):s=new Zf(e.schema.topNodeType,null,yt.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&jb?"full":this.localPreserveWS||(i.options&qu)>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,`
105
+ `);else if(l.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(l.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u<c.length;u++)u&&this.insertNode(l.linebreakReplacement.create(),n,!0),c[u]&&this.insertNode(l.text(c[u]),n,!/\S/.test(c[u]));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],u=e.previousSibling;(!c||u&&u.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;nD.hasOwnProperty(l)&&this.parser.normalizeLists&&dH(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(c=this.parser.matchTag(e,this,r));e:if(u?u.ignore:uH.hasOwnProperty(l))this.findInside(e),this.ignoreFallback(e,n);else if(!u||u.skip||u.closeParent){u&&u.closeParent?this.open=Math.max(0,this.open-1):u&&u.skip.nodeType&&(e=u.skip);let f,h=this.needsBlock;if(tD.hasOwnProperty(l))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),f=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let m=u&&u.skip?n:this.readStyles(e,n);m&&this.addAll(e,m),f&&this.sync(s),this.needsBlock=h}else{let f=this.readStyles(e,n);f&&this.addElementByRule(e,u,f,u.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(`
106
+ `),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 u=this.parser.matchStyle(s,l,this,c);if(!u)break;if(u.ignore)return null;if(u.clearMark?n=n.filter(f=>!u.clearMark(f)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;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 u=this.enter(l,n.attrs||null,r,n.preserveWhitespace);u&&(s=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.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(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!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 u=this.nodes[l],f=u.findWrapping(e);if(f&&(!i||i.length>f.length+c)&&(i=f,s=u,!f.length))break;if(u.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=yt.none;for(let c of i.concat(e.marks))(s.type?s.type.allowsMarkType(c.type):rT(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=eT(e,s,l.options);l.options&mu&&l.content.length==0&&(c|=mu);let u=yt.none;return r=r.filter(f=>(l.type?l.type.allowsMarkType(f.type):rT(f.type,e))?(u=f.addToSet(u),!1):!0),this.nodes.push(new Zf(e,n,u,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|=qu)}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,u)=>{for(;c>=0;c--){let f=n[c];if(f==""){if(c==n.length-1||c==0)continue;for(;u>=s;u--)if(l(c-1,u))return!0;return!1}else{let h=u>0||u==0&&i?this.nodes[u].type:r&&u>=s?r.node(u-s).type:null;if(!h||h.name!=f&&!h.isInGroup(f))return!1;u--}}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 dH(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&nD.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function fH(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function nT(t){let e={};for(let n in t)e[n]=t[n];return e}function rT(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 u=0;u<c.edgeCount;u++){let{type:f,next:h}=c.edge(u);if(f==e||s.indexOf(h)<0&&l(h))return!0}};if(l(i.contentMatch))return!0}}class pl{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=A0(n).createDocumentFragment());let i=r,s=[];return e.forEach(l=>{if(s.length||l.marks.length){let c=0,u=0;for(;c<s.length&&u<l.marks.length;){let f=l.marks[u];if(!this.marks[f.type.name]){u++;continue}if(!f.eq(s[c][0])||f.type.spec.spanning===!1)break;c++,u++}for(;c<s.length;)i=s.pop()[1];for(;u<l.marks.length;){let f=l.marks[u++],h=this.serializeMark(f,l.isInline,n);h&&(s.push([f,i]),i.appendChild(h.dom),i=h.contentDOM||h.dom)}}i.appendChild(this.serializeNodeInner(l,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=kh(A0(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&&kh(A0(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return kh(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new pl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=iT(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return iT(e.marks)}}function iT(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function A0(t){return t.document||window.document}const sT=new WeakMap;function hH(t){let e=sT.get(t);return e===void 0&&sT.set(t,e=pH(t)),e}function pH(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 kh(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=hH(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,u=n?t.createElementNS(n,i):t.createElement(i),f=e[1],h=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){h=2;for(let m in f)if(f[m]!=null){let g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+1),f[m]):m=="style"&&u.style?u.style.cssText=f[m]:u.setAttribute(m,f[m])}}for(let m=h;m<e.length;m++){let g=e[m];if(g===0){if(m<e.length-1||m>h)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:b,contentDOM:v}=kh(t,g,n,r);if(u.appendChild(b),v){if(c)throw new RangeError("Multiple content holes");c=v}}}return{dom:u,contentDOM:c}}const rD=65535,iD=Math.pow(2,16);function mH(t,e){return t+e*iD}function oT(t){return t&rD}function gH(t){return(t-(t&rD))/iD}const sD=1,oD=2,Ch=4,lD=8;class Ib{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&lD)>0}get deletedBefore(){return(this.delInfo&(sD|Ch))>0}get deletedAfter(){return(this.delInfo&(oD|Ch))>0}get deletedAcross(){return(this.delInfo&Ch)>0}}class mr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&mr.empty)return mr.empty}recover(e){let n=0,r=oT(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+gH(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 u=this.ranges[c]-(this.inverted?i:0);if(u>e)break;let f=this.ranges[c+s],h=this.ranges[c+l],m=u+f;if(e<=m){let g=f?e==u?-1:e==m?1:n:n,b=u+i+(g<0?0:h);if(r)return b;let v=e==(n<0?u:m)?null:mH(c/3,e-u),k=e==u?oD:e==m?sD:Ch;return(n<0?e!=u:e!=m)&&(k|=lD),new Ib(b,k,v)}i+=h-f}return r?e+i:new Ib(e+i,0,null)}touches(e,n){let r=0,i=oT(n),s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?r:0);if(u>e)break;let f=this.ranges[c+s],h=u+f;if(e<=h&&c==i*3)return!0;r+=this.ranges[c+l]-f}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),u=l+(this.inverted?0:s),f=this.ranges[i+n],h=this.ranges[i+r];e(c,c+f,u,u+h),s+=h-f}}invert(){return new mr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?mr.empty:new mr(e<0?[0,-e,0]:[0,0,e])}}mr.empty=new mr([]);class Ku{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 Ku(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 Ku;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 u=this.getMirror(s);if(u!=null&&u>s&&u<this.to){s=u,e=this._maps[u].recover(c.recover);continue}}i|=c.delInfo,e=c.pos}return r?e:new Ib(e,i,null)}}const M0=Object.create(null);class zn{getMap(){return mr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=M0[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 M0)throw new RangeError("Duplicate use of step JSON ID "+e);return M0[e]=n,n.prototype.jsonID=e,n}}class Yt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Yt(e,null)}static fail(e){return new Yt(null,e)}static fromReplace(e,n,r,i){try{return Yt.ok(e.replace(n,r,i))}catch(s){if(s instanceof Xh)return Yt.fail(s.message);throw s}}}function k1(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(k1(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return ee.fromArray(r)}class Zs extends zn{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 fe(k1(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 Yt.fromReplace(e,this.from,this.to,s)}invert(){return new gi(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 Zs(n.pos,r.pos,this.mark)}merge(e){return e instanceof Zs&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Zs(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 Zs(n.from,n.to,e.markFromJSON(n.mark))}}zn.jsonID("addMark",Zs);class gi extends zn{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 fe(k1(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Yt.fromReplace(e,this.from,this.to,r)}invert(){return new Zs(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 gi(n.pos,r.pos,this.mark)}merge(e){return e instanceof gi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new gi(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 gi(n.from,n.to,e.markFromJSON(n.mark))}}zn.jsonID("removeMark",gi);class Js extends zn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Yt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Yt.fromReplace(e,this.pos,this.pos+1,new fe(ee.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 Js(this.pos,n.marks[i]);return new Js(this.pos,this.mark)}}return new sl(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Js(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 Js(n.pos,e.markFromJSON(n.mark))}}zn.jsonID("addNodeMark",Js);class sl extends zn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Yt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Yt.fromReplace(e,this.pos,this.pos+1,new fe(ee.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Js(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new sl(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 sl(n.pos,e.markFromJSON(n.mark))}}zn.jsonID("removeNodeMark",sl);class on extends zn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Bb(e,this.from,this.to)?Yt.fail("Structure replace would overwrite content"):Yt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new mr([this.from,this.to-this.from,this.slice.size])}invert(e){return new on(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 on(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof on)||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?fe.empty:new fe(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new on(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?fe.empty:new fe(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new on(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 on(n.from,n.to,fe.fromJSON(e,n.slice),!!n.structure)}}zn.jsonID("replace",on);class cn extends zn{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&&(Bb(e,this.from,this.gapFrom)||Bb(e,this.gapTo,this.to)))return Yt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Yt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Yt.fromReplace(e,this.from,this.to,r):Yt.fail("Content does not fit in gap")}getMap(){return new mr([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 cn(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 cn(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 cn(n.from,n.to,n.gapFrom,n.gapTo,fe.fromJSON(e,n.slice),n.insert,!!n.structure)}}zn.jsonID("replaceAround",cn);function Bb(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 yH(t,e,n,r){let i=[],s=[],l,c;t.doc.nodesBetween(e,n,(u,f,h)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&h.type.allowsMarkType(r.type)){let g=Math.max(f,e),b=Math.min(f+u.nodeSize,n),v=r.addToSet(m);for(let k=0;k<m.length;k++)m[k].isInSet(v)||(l&&l.to==g&&l.mark.eq(m[k])?l.to=b:i.push(l=new gi(g,b,m[k])));c&&c.to==g?c.to=b:s.push(c=new Zs(g,b,r))}}),i.forEach(u=>t.step(u)),s.forEach(u=>t.step(u))}function bH(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(l,c)=>{if(!l.isInline)return;s++;let u=null;if(r instanceof hm){let f=l.marks,h;for(;h=r.isInSet(f);)(u||(u=[])).push(h),f=h.removeFromSet(f)}else r?r.isInSet(l.marks)&&(u=[r]):u=l.marks;if(u&&u.length){let f=Math.min(c+l.nodeSize,n);for(let h=0;h<u.length;h++){let m=u[h],g;for(let b=0;b<i.length;b++){let v=i[b];v.step==s-1&&m.eq(i[b].style)&&(g=v)}g?(g.to=f,g.step=s):i.push({style:m,from:Math.max(c,e),to:f,step:s})}}}),i.forEach(l=>t.step(new gi(l.from,l.to,l.style)))}function C1(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),l=[],c=e+1;for(let u=0;u<s.childCount;u++){let f=s.child(u),h=c+f.nodeSize,m=r.matchType(f.type);if(!m)l.push(new on(c,h,fe.empty));else{r=m;for(let g=0;g<f.marks.length;g++)n.allowsMarkType(f.marks[g].type)||t.step(new gi(c,h,f.marks[g]));if(i&&f.isText&&n.whitespace!="pre"){let g,b=/\r?\n|\r/g,v;for(;g=b.exec(f.text);)v||(v=new fe(ee.from(n.schema.text(" ",n.allowedMarks(f.marks))),0,0)),l.push(new on(c+g.index,c+g.index+g[0].length,v))}}c=h}if(!r.validEnd){let u=r.fillBefore(ee.empty,!0);t.replace(c,c,new fe(u,0,0))}for(let u=l.length-1;u>=0;u--)t.step(l[u])}function xH(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function ec(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,u=t.$to.indexAfter(r)-s;if(r<t.depth&&l.canReplace(c,u,n))return r;if(r==0||l.type.spec.isolating||!xH(l,c,u))break;c&&(i=1),u<l.childCount&&(s=1)}return null}function vH(t,e,n){let{$from:r,$to:i,depth:s}=e,l=r.before(s+1),c=i.after(s+1),u=l,f=c,h=ee.empty,m=0;for(let v=s,k=!1;v>n;v--)k||r.index(v)>0?(k=!0,h=ee.from(r.node(v).copy(h)),m++):u--;let g=ee.empty,b=0;for(let v=s,k=!1;v>n;v--)k||i.after(v+1)<i.end(v)?(k=!0,g=ee.from(i.node(v).copy(g)),b++):f++;t.step(new cn(u,f,l,c,new fe(h.append(g),m,b),h.size-m,!0))}function E1(t,e,n=null,r=t){let i=SH(t,e),s=i&&wH(r,e);return s?i.map(lT).concat({type:e,attrs:n}).concat(s.map(lT)):null}function lT(t){return{type:t,attrs:null}}function SH(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 wH(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 u=(l.length?l[l.length-1]:e).contentMatch;for(let f=r;u&&f<i;f++)u=u.matchType(n.child(f).type);return!u||!u.validEnd?null:l}function kH(t,e,n){let r=ee.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=ee.from(n[l].type.create(n[l].attrs,r))}let i=e.start,s=e.end;t.step(new cn(i,s,i,s,new fe(r,0,0),n.length,!0))}function CH(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 u=typeof i=="function"?i(l):i;if(l.isTextblock&&!l.hasMarkup(r,u)&&EH(t.doc,t.mapping.slice(s).map(c),r)){let f=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!v?f=!1:!b&&v&&(f=!0)}f===!1&&cD(t,l,c,s),C1(t,t.mapping.slice(s).map(c,1),r,void 0,f===null);let h=t.mapping.slice(s),m=h.map(c,1),g=h.map(c+l.nodeSize,1);return t.step(new cn(m,g,m+1,g-1,new fe(ee.from(r.create(u,null,l.marks)),0,0),1,!0)),f===!0&&aD(t,l,c,s),!1}})}function aD(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 u=t.mapping.slice(r).map(n+1+s+l.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function cD(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(`
107
+ `))}})}function EH(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function TH(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 cn(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new fe(ee.from(l),0,0),1,!0))}function ls(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 f=i.depth-1,h=n-2;f>s;f--,h--){let m=i.node(f),g=i.index(f);if(m.type.spec.isolating)return!1;let b=m.content.cutByIndex(g,m.childCount),v=r&&r[h+1];v&&(b=b.replaceChild(0,v.type.create(v.attrs)));let k=r&&r[h]||m;if(!m.canReplace(g+1,m.childCount)||!k.type.validContent(b))return!1}let c=i.indexAfter(s),u=r&&r[0];return i.node(s).canReplaceWith(c,c,u?u.type:i.node(s+1).type)}function AH(t,e,n=1,r){let i=t.doc.resolve(e),s=ee.empty,l=ee.empty;for(let c=i.depth,u=i.depth-n,f=n-1;c>u;c--,f--){s=ee.from(i.node(c).copy(s));let h=r&&r[f];l=ee.from(h?h.type.create(h.attrs,l):i.node(c).copy(l))}t.step(new on(e,e,new fe(s.append(l),n,n),!0))}function ho(t,e){let n=t.resolve(e),r=n.index();return uD(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function MH(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 uD(t,e){return!!(t&&e&&!t.isLeaf&&MH(t,e))}function pm(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&&uD(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 OH(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 h=l.whitespace=="pre",m=!!l.contentMatch.matchType(i);h&&!m?r=!1:!h&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let h=t.doc.resolve(e+n);cD(t,h.node(),h.before(),c)}l.inlineContent&&C1(t,e+n-1,l,s.node().contentMatchAt(s.index()),r==null);let u=t.mapping.slice(c),f=u.map(e-n);if(t.step(new on(f,u.map(e+n,-1),fe.empty,!0)),r===!0){let h=t.doc.resolve(f);aD(t,h.node(),h.before(),t.steps.length)}return t}function _H(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 dD(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,u=r.index(l)+(c>0?1:0),f=r.node(l),h=!1;if(s==1)h=f.canReplace(u,u,i);else{let m=f.contentMatchAt(u).findWrapping(i.firstChild.type);h=m&&f.canReplaceWith(u,u,m[0])}if(h)return c==0?r.pos:c<0?r.before(l+1):r.after(l+1)}return null}function mm(t,e,n=e,r=fe.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return fD(i,s,r)?new on(e,n,r):new DH(i,s,r).fit()}function fD(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class DH{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ee.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=ee.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let f=this.findFittable();f?this.placeNodes(f):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 u=new fe(s,l,c);return e>-1?new cn(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new on(r.pos,i.pos,u):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=O0(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:u,match:f}=this.frontier[c],h,m=null;if(n==1&&(l?f.matchType(l.type)||(m=f.fillBefore(ee.from(l),!1)):s&&u.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:c,parent:s,inject:m};if(n==2&&l&&(h=f.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:c,parent:s,wrap:h};if(s&&f.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=O0(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new fe(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=O0(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new fe(iu(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new fe(iu(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 k=0;k<s.length;k++)this.openFrontierNode(s[k]);let l=this.unplaced,c=r?r.content:l.content,u=l.openStart-e,f=0,h=[],{match:m,type:g}=this.frontier[n];if(i){for(let k=0;k<i.childCount;k++)h.push(i.child(k));m=m.matchFragment(i)}let b=c.size+e-(l.content.size-l.openEnd);for(;f<c.childCount;){let k=c.child(f),C=m.matchType(k.type);if(!C)break;f++,(f>1||u==0||k.content.size)&&(m=C,h.push(hD(k.mark(g.allowedMarks(k.marks)),f==1?u:0,f==c.childCount?b:-1)))}let v=f==c.childCount;v||(b=-1),this.placed=su(this.placed,n,ee.from(h)),this.frontier[n].match=m,v&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let k=0,C=c;k<b;k++){let E=C.lastChild;this.frontier.push({type:E.type,match:E.contentMatchAt(E.childCount)}),C=E.content}this.unplaced=v?e==0?fe.empty:new fe(iu(l.content,e-1,1),e-1,b<0?l.openEnd:e-1):new fe(iu(l.content,e,f),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!_0(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=_0(e,n,i,r,s);if(l){for(let c=n-1;c>=0;c--){let{match:u,type:f}=this.frontier[c],h=_0(e,c,f,u,!0);if(!h||h.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=su(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=su(this.placed,this.depth,ee.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ee.empty,!0);n.childCount&&(this.placed=su(this.placed,this.frontier.length,n))}}function iu(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(iu(t.firstChild.content,e-1,n)))}function su(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(su(t.lastChild.content,e-1,n)))}function O0(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function hD(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,hD(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(ee.empty,!0)))),t.copy(r)}function _0(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&&!RH(n,s.content,l)?c:null}function RH(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function NH(t){return t.spec.defining||t.spec.definingForContent}function zH(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(fD(i,s,r))return t.step(new on(e,n,r));let l=mD(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 v=i.node(g).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;l.indexOf(g)>-1?c=g:i.before(g)==b&&l.splice(1,0,-g)}let u=l.indexOf(c),f=[],h=r.openStart;for(let g=r.content,b=0;;b++){let v=g.firstChild;if(f.push(v),b==r.openStart)break;g=v.content}for(let g=h-1;g>=0;g--){let b=f[g],v=NH(b.type);if(v&&!b.sameMarkup(i.node(Math.abs(c)-1)))h=g;else if(v||!b.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let b=(g+h+1)%(r.openStart+1),v=f[b];if(v)for(let k=0;k<l.length;k++){let C=l[(k+u)%l.length],E=!0;C<0&&(E=!1,C=-C);let L=i.node(C-1),j=i.index(C-1);if(L.canReplaceWith(j,j,v.type,v.marks))return t.replace(i.before(C),E?s.after(C):n,new fe(pD(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 pD(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(pD(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(ee.empty,!0))}return t}function LH(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=_H(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new fe(ee.from(r),0,0))}function jH(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=mD(r,i);for(let l=0;l<s.length;l++){let c=s[l],u=l==s.length-1;if(u&&c==0||r.node(c).type.contentMatch.validEnd)return t.delete(r.start(c),i.end(c));if(c>0&&(u||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 mD(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 ka extends zn{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 Yt.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 Yt.fromReplace(e,this.pos,this.pos+1,new fe(ee.from(i),0,n.isLeaf?0:1))}getMap(){return mr.empty}invert(e){return new ka(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 ka(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 ka(n.pos,n.attr,n.value)}}zn.jsonID("attr",ka);class Yu extends zn{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 Yt.ok(r)}getMap(){return mr.empty}invert(e){return new Yu(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 Yu(n.attr,n.value)}}zn.jsonID("docAttr",Yu);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 T1{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ku}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,u)=>{e=Math.min(e,c),n=Math.max(n,u)})}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=fe.empty){let i=mm(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new fe(ee.from(r),0,0))}delete(e,n){return this.replace(e,n,fe.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return zH(this,e,n,r),this}replaceRangeWith(e,n,r){return LH(this,e,n,r),this}deleteRange(e,n){return jH(this,e,n),this}lift(e,n){return vH(this,e,n),this}join(e,n=1){return OH(this,e,n),this}wrap(e,n){return kH(this,e,n),this}setBlockType(e,n=e,r,i=null){return CH(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return TH(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new ka(e,n,r)),this}setDocAttribute(e,n){return this.step(new Yu(e,n)),this}addNodeMark(e,n){return this.step(new Js(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 yt)n.isInSet(r.marks)&&this.step(new sl(e,n));else{let i=r.marks,s,l=[];for(;s=n.isInSet(i);)l.push(new sl(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 AH(this,e,n,r),this}addMark(e,n,r){return yH(this,e,n,r),this}removeMark(e,n,r){return bH(this,e,n,r),this}clearIncompatible(e,n,r){return C1(this,e,n,r),this}}const D0=Object.create(null);class Ne{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new gD(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=fe.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:u,$to:f}=l[c],h=e.mapping.slice(s);e.replaceRange(h.map(u.pos),h.map(f.pos),c?fe.empty:n),c==0&&uT(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],u=e.mapping.slice(r),f=u.map(l.pos),h=u.map(c.pos);s?e.deleteRange(f,h):(e.replaceRangeWith(f,h,n),uT(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new Oe(e):la(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?la(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):la(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 nr(e.node(0))}static atStart(e){return la(e,e,0,0,1)||new nr(e)}static atEnd(e){return la(e,e,e.content.size,e.childCount,-1)||new nr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=D0[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 D0)throw new RangeError("Duplicate use of selection JSON ID "+e);return D0[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Oe.between(this.$anchor,this.$head).getBookmark()}}Ne.prototype.visible=!0;class gD{constructor(e,n){this.$from=e,this.$to=n}}let aT=!1;function cT(t){!aT&&!t.parent.inlineContent&&(aT=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Oe extends Ne{constructor(e,n=e){cT(e),cT(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 Ne.near(r);let i=e.resolve(n.map(this.anchor));return new Oe(i.parent.inlineContent?i:r,r)}replace(e,n=fe.empty){if(super.replace(e,n),n==fe.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 gm(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=Ne.findFrom(n,r,!0)||Ne.findFrom(n,-r,!0);if(s)n=s.$head;else return Ne.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Ne.findFrom(e,-r,!0)||Ne.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new Oe(e,n)}}Ne.jsonID("text",Oe);class gm{constructor(e,n){this.anchor=e,this.head=n}map(e){return new gm(e.map(this.anchor),e.map(this.head))}resolve(e){return Oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ae extends Ne{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?Ne.near(s):new Ae(s)}content(){return new fe(ee.from(this.node),0,0)}eq(e){return e instanceof Ae&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new A1(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ae(e.resolve(n.anchor))}static create(e,n){return new Ae(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ae.prototype.visible=!1;Ne.jsonID("node",Ae);class A1{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new gm(r,r):new A1(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Ae.isSelectable(r)?new Ae(n):Ne.near(n)}}class nr extends Ne{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=fe.empty){if(n==fe.empty){e.delete(0,e.doc.content.size);let r=Ne.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new nr(e)}map(e){return new nr(e)}eq(e){return e instanceof nr}getBookmark(){return IH}}Ne.jsonID("all",nr);const IH={map(){return this},resolve(t){return new nr(t)}};function la(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&&Ae.isSelectable(c))return Ae.create(t,n-(i<0?c.nodeSize:0))}else{let u=la(t,c,n+i,i<0?c.childCount:0,i,s);if(u)return u}n+=c.nodeSize*i}return null}function uT(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof on||i instanceof cn))return;let s=t.mapping.maps[r],l;s.forEach((c,u,f,h)=>{l==null&&(l=h)}),t.setSelection(Ne.near(t.doc.resolve(l),n))}const dT=1,Jf=2,fT=4;class BH extends T1{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|dT)&~Jf,this.storedMarks=null,this}get selectionSet(){return(this.updated&dT)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Jf,this}ensureMarks(e){return yt.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&Jf)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Jf,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)||yt.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(Ne.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|=fT,this}get scrolledIntoView(){return(this.updated&fT)>0}}function hT(t,e){return!e||!t?t:t.bind(e)}class ou{constructor(e,n,r){this.name=e,this.init=hT(n.init,r),this.apply=hT(n.apply,r)}}const UH=[new ou("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ou("selection",{init(t,e){return t.selection||Ne.atStart(e.doc)},apply(t){return t.selection}}),new ou("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ou("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class R0{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=UH.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 ou(r.key,r.spec.state,r))})}}class ha{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 u=i?i[l].n:0,f=i?i[l].state:this,h=u<n.length&&c.spec.appendTransaction.call(c,u?n.slice(u):n,f,r);if(h&&r.filterTransaction(h,l)){if(h.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(h),r=r.applyInner(h),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 ha(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 BH(this)}static create(e){let n=new R0(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ha(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 R0(this.schema,e.plugins),r=n.fields,i=new ha(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 R0(e.schema,e.plugins),s=new ha(i);return i.fields.forEach(l=>{if(l.name=="doc")s.doc=Qs.fromJSON(e.schema,n.doc);else if(l.name=="selection")s.selection=Ne.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 u=r[c],f=u.spec.state;if(u.key==l.name&&f&&f.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){s[l.name]=f.fromJSON.call(u,e,n[c],s);return}}s[l.name]=l.init(e,s)}}),s}}function yD(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=yD(i,e,{})),n[r]=i}return n}class pt{constructor(e){this.spec=e,this.props={},e.props&&yD(e.props,this,this.props),this.key=e.key?e.key.key:bD("plugin")}getState(e){return e[this.key]}}const N0=Object.create(null);function bD(t){return t in N0?t+"$"+ ++N0[t]:(N0[t]=0,t+"$")}class Tt{constructor(e="key"){this.key=bD(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const kn=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 Ub=null;const ts=function(t,e,n){let r=Ub||(Ub=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},HH=function(){Ub=null},ol=function(t,e,n,r){return n&&(pT(t,e,n,r,-1)||pT(t,e,n,r,1))},VH=/^(img|br|input|textarea|hr)$/i;function pT(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Br(t))){let l=t.parentNode;if(!l||l.nodeType!=1||wd(t)||VH.test(t.nodeName)||t.contentEditable=="false")return!1;e=kn(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?Br(t):0}else return!1}}function Br(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function PH(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=Br(t)}else if(t.parentNode&&!wd(t))e=kn(t),t=t.parentNode;else return null}}function $H(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&&!wd(t))e=kn(t)+1,t=t.parentNode;else return null}}function FH(t,e,n){for(let r=e==0,i=e==Br(t);r||i;){if(t==n)return!0;let s=kn(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Br(t)}}function wd(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 ym=function(t){return t.focusNode&&ol(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Io(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function qH(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function KH(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Br(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Br(r.startContainer),r.startOffset)}}}const ki=typeof navigator<"u"?navigator:null,mT=typeof document<"u"?document:null,po=ki&&ki.userAgent||"",Hb=/Edge\/(\d+)/.exec(po),xD=/MSIE \d/.exec(po),Vb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(po),rr=!!(xD||Vb||Hb),eo=xD?document.documentMode:Vb?+Vb[1]:Hb?+Hb[1]:0,Vr=!rr&&/gecko\/(\d+)/i.test(po);Vr&&+(/Firefox\/(\d+)/.exec(po)||[0,0])[1];const Pb=!rr&&/Chrome\/(\d+)/.exec(po),En=!!Pb,vD=Pb?+Pb[1]:0,Dn=!rr&&!!ki&&/Apple Computer/.test(ki.vendor),Ba=Dn&&(/Mobile\/\w+/.test(po)||!!ki&&ki.maxTouchPoints>2),zr=Ba||(ki?/Mac/.test(ki.platform):!1),SD=ki?/Win/.test(ki.platform):!1,rs=/Android \d/.test(po),kd=!!mT&&"webkitFontSmoothing"in mT.documentElement.style,YH=kd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function WH(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 Zi(t,e){return typeof t=="number"?t:t[e]}function GH(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 gT(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,u=c==s.body,f=u?WH(s):GH(c),h=0,m=0;if(e.top<f.top+Zi(r,"top")?m=-(f.top-e.top+Zi(i,"top")):e.bottom>f.bottom-Zi(r,"bottom")&&(m=e.bottom-e.top>f.bottom-f.top?e.top+Zi(i,"top")-f.top:e.bottom-f.bottom+Zi(i,"bottom")),e.left<f.left+Zi(r,"left")?h=-(f.left-e.left+Zi(i,"left")):e.right>f.right-Zi(r,"right")&&(h=e.right-f.right+Zi(i,"right")),h||m)if(u)s.defaultView.scrollBy(h,m);else{let b=c.scrollLeft,v=c.scrollTop;m&&(c.scrollTop+=m),h&&(c.scrollLeft+=h);let k=c.scrollLeft-b,C=c.scrollTop-v;e={left:e.left-k,top:e.top-C,right:e.right-k,bottom:e.bottom-C}}let g=u?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(g))break;l=g=="absolute"?l.offsetParent:Ia(l)}}function ZH(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 u=c.getBoundingClientRect();if(u.top>=n-20){r=c,i=u.top;break}}return{refDOM:r,refTop:i,stack:wD(t.dom)}}function wD(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 JH({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;kD(n,r==0?0:r-e)}function kD(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 sa=null;function XH(t){if(t.setActive)return t.setActive();if(sa)return t.focus(sa);let e=wD(t);t.focus(sa==null?{get preventScroll(){return sa={preventScroll:!0},!0}}:void 0),sa||(sa=!1,kD(e,0))}function CD(t,e){let n,r=2e8,i,s=0,l=e.top,c=e.top,u,f;for(let h=t.firstChild,m=0;h;h=h.nextSibling,m++){let g;if(h.nodeType==1)g=h.getClientRects();else if(h.nodeType==3)g=ts(h).getClientRects();else continue;for(let b=0;b<g.length;b++){let v=g[b];if(v.top<=l&&v.bottom>=c){l=Math.max(v.bottom,l),c=Math.min(v.top,c);let k=v.left>e.left?v.left-e.left:v.right<e.left?e.left-v.right:0;if(k<r){n=h,r=k,i=k&&n.nodeType==3?{left:v.right<e.left?v.right:v.left,top:e.top}:e,h.nodeType==1&&k&&(s=m+(e.left>=(v.left+v.right)/2?1:0));continue}}else v.top>e.top&&!u&&v.left<=e.left&&v.right>=e.left&&(u=h,f={left:Math.max(v.left,Math.min(v.right,e.left)),top:v.top});!n&&(e.left>=v.right&&e.top>=v.top||e.left>=v.left&&e.top>=v.bottom)&&(s=m+1)}}return!n&&u&&(n=u,i=f,r=0),n&&n.nodeType==3?QH(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:CD(n,i)}function QH(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=Hs(r,1);if(l.top!=l.bottom&&M1(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 M1(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function e8(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function t8(t,e,n){let{node:r,offset:i}=CD(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 n8(t,e,n,r){let i=-1;for(let s=e,l=!1;s!=t.dom;){let c=t.docView.nearestDesc(s,!0),u;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((u=c.dom.getBoundingClientRect()).width||u.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!l&&u.left>r.left||u.top>r.top?i=c.posBefore:(!l&&u.right<r.left||u.bottom<r.top)&&(i=c.posAfter),l=!0),!c.contentDOM&&i<0&&!c.node.isText))return(c.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?c.posBefore:c.posAfter;s=c.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function ED(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 u=0;u<c.length;u++){let f=c[u];if(M1(e,f))return ED(l,e,f)}}if((s=(s+1)%r)==i)break}return t}function r8(t,e){let n=t.dom.ownerDocument,r,i=0,s=KH(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 f=t.dom.getBoundingClientRect();if(!M1(e,f)||(l=ED(t.dom,e,f),!l))return null}if(Dn)for(let f=l;r&&f;f=Ia(f))f.draggable&&(r=void 0);if(l=e8(l,e),r){if(Vr&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let h=r.childNodes[i],m;h.nodeName=="IMG"&&(m=h.getBoundingClientRect()).right<=e.left&&m.bottom>e.top&&i++}let f;kd&&i&&r.nodeType==1&&(f=r.childNodes[i-1]).nodeType==1&&f.contentEditable=="false"&&f.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=n8(t,r,i,e))}c==null&&(c=t8(t,l,e));let u=t.docView.nearestDesc(l,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function yT(t){return t.top<t.bottom||t.left<t.right}function Hs(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(yT(r))return r}return Array.prototype.find.call(n,yT)||t.getBoundingClientRect()}const i8=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function TD(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),l=kd||Vr;if(r.nodeType==3)if(l&&(i8.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let u=Hs(ts(r,i,i),n);if(Vr&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let f=Hs(ts(r,i-1,i-1),-1);if(f.top==u.top){let h=Hs(ts(r,i,i+1),-1);if(h.top!=u.top)return tu(h,h.left<f.left)}}return u}else{let u=i,f=i,h=n<0?1:-1;return n<0&&!i?(f++,h=-1):n>=0&&i==r.nodeValue.length?(u--,h=1):n<0?u--:f++,tu(Hs(ts(r,u,f),h),h<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Br(r))){let u=r.childNodes[i-1];if(u.nodeType==1)return z0(u.getBoundingClientRect(),!1)}if(s==null&&i<Br(r)){let u=r.childNodes[i];if(u.nodeType==1)return z0(u.getBoundingClientRect(),!0)}return z0(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Br(r))){let u=r.childNodes[i-1],f=u.nodeType==3?ts(u,Br(u)-(l?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(f)return tu(Hs(f,1),!1)}if(s==null&&i<Br(r)){let u=r.childNodes[i];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let f=u?u.nodeType==3?ts(u,0,l?0:1):u.nodeType==1?u:null:null;if(f)return tu(Hs(f,-1),!0)}return tu(Hs(r.nodeType==3?ts(r):r,-n),n>=0)}function tu(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 z0(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 AD(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 s8(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return AD(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=TD(t,i.pos,1);for(let c=s.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=ts(c,0,c.nodeValue.length).getClientRects();else continue;for(let f=0;f<u.length;f++){let h=u[f];if(h.bottom>h.top+1&&(n=="up"?l.top-h.top>(h.bottom-l.top)*2:h.bottom-l.bottom>(l.bottom-h.top)*2))return!1}}return!0})}const o8=/[\u0590-\u08ac]/;function l8(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?!o8.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?s:l:AD(t,e,()=>{let{focusNode:u,focusOffset:f,anchorNode:h,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:v,focusOffset:k}=t.domSelectionRange(),C=v&&!b.contains(v.nodeType==1?v:v.parentNode)||u==v&&f==k;try{c.collapse(h,m),u&&(u!=h||f!=m)&&c.extend&&c.extend(u,f)}catch{}return g!=null&&(c.caretBidiLevel=g),C}):r.pos==r.start()||r.pos==r.end()}let bT=null,xT=null,vT=!1;function a8(t,e,n){return bT==e&&xT==n?vT:(bT=e,xT=n,vT=n=="up"||n=="down"?s8(t,e,n):l8(t,e,n))}const Pr=0,ST=1,Uo=2,Ci=3;class Cd{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Pr,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>kn(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 OD){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 MD&&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?kn(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?kn(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 u=this.children[c],f=l+u.size;if(i==-1&&e<=f){let h=l+u.border;if(e>=h&&n<=f-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,h);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=kn(g.dom)+1;break}e-=g.size}i==-1&&(i=0)}if(i>-1&&(f>n||c==this.children.length-1)){n=f;for(let h=c+1;h<this.children.length;h++){let m=this.children[h];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(-1)){s=kn(m.dom);break}n+=m.size}s==-1&&(s=this.contentDOM.childNodes.length);break}l=f}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,v=0;b<this.children.length;b++){let k=this.children[b],C=v+k.size;if(s>v&&l<C)return k.setSelection(e-v-k.border,n-v-k.border,r,i);v=C}let c=this.domFromPos(e,e?-1:1),u=n==e?c:this.domFromPos(n,n?-1:1),f=r.root.getSelection(),h=r.domSelectionRange(),m=!1;if((Vr||Dn)&&e==n){let{node:b,offset:v}=c;if(b.nodeType==3){if(m=!!(v&&b.nodeValue[v-1]==`
108
+ `),m&&v==b.nodeValue.length)for(let k=b,C;k;k=k.parentNode){if(C=k.nextSibling){C.nodeName=="BR"&&(c=u={node:C.parentNode,offset:kn(C)+1});break}let E=k.pmViewDesc;if(E&&E.node&&E.node.isBlock)break}}else{let k=b.childNodes[v-1];m=k&&(k.nodeName=="BR"||k.contentEditable=="false")}}if(Vr&&h.focusNode&&h.focusNode!=u.node&&h.focusNode.nodeType==1){let b=h.focusNode.childNodes[h.focusOffset];b&&b.contentEditable=="false"&&(i=!0)}if(!(i||m&&Dn)&&ol(c.node,c.offset,h.anchorNode,h.anchorOffset)&&ol(u.node,u.offset,h.focusNode,h.focusOffset))return;let g=!1;if((f.extend||e==n)&&!(m&&Vr)){f.collapse(c.node,c.offset);try{e!=n&&f.extend(u.node,u.offset),g=!0}catch{}}if(!g){if(e>n){let v=c;c=u,u=v}let b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(c.node,c.offset),f.removeAllRanges(),f.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,u=l-s.border;if(e>=c&&n<=u){this.dirty=e==r||n==l?Uo:ST,e==c&&n==u&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Ci:s.markDirty(e-c,n-c);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Uo:Ci}r=l}this.dirty=Uo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Uo:ST;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class MD extends Cd{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==Pr&&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 c8 extends Cd{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 ll extends Cd{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=pl.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ll(e,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Ci||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ci&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Pr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Pr}}slice(e,n,r){let i=ll.create(this.parent,this.mark,!0,r),s=this.children,l=this.size;n<l&&(s=Fb(s,n,l,r)),e>0&&(s=Fb(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 to extends Cd{constructor(e,n,r,i,s,l,c,u,f){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],u,f=c&&c(n,s,()=>{if(!u)return l;if(u.parent)return u.parent.posBeforeChild(u)},r,i),h=f&&f.dom,m=f&&f.contentDOM;if(n.isText){if(!h)h=document.createTextNode(n.text);else if(h.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else h||({dom:h,contentDOM:m}=pl.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&h.nodeName!="BR"&&(h.hasAttribute("contenteditable")||(h.contentEditable="false"),n.type.spec.draggable&&(h.draggable=!0));let g=h;return h=RD(h,r,n),f?u=new u8(e,n,r,i,h,m||null,g,f,s,l+1):n.isText?new bm(e,n,r,i,h,g,s):new to(e,n,r,i,h,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=()=>ee.empty)}return e}matchesNode(e,n,r){return this.dirty==Pr&&e.eq(this.node)&&np(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,u=new f8(this,l&&l.node,e);m8(this.node,this.innerDeco,(f,h,m)=>{f.spec.marks?u.syncToMarks(f.spec.marks,r,e,h):f.type.side>=0&&!m&&u.syncToMarks(h==this.node.childCount?yt.none:this.node.child(h).marks,r,e,h),u.placeWidget(f,e,i)},(f,h,m,g)=>{u.syncToMarks(f.marks,r,e,g);let b;u.findNodeMatch(f,h,m,g)||c&&e.state.selection.from>i&&e.state.selection.to<i+f.nodeSize&&(b=u.findIndexWithChild(s.node))>-1&&u.updateNodeAt(f,h,m,b,e)||u.updateNextNode(f,h,m,e,g,i)||u.addNode(f,h,m,e,i),i+=f.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==Uo)&&(l&&this.protectLocalComposition(e,l),_D(this.contentDOM,this.children,e),Ba&&g8(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=y8(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 c8(this,s,n,i);e.input.compositionNodes.push(l),this.children=Fb(this.children,r,r+i.length,e,l)}update(e,n,r,i){return this.dirty==Ci||!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=Pr}updateOuterDeco(e){if(np(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=DD(this.dom,this.nodeDOM,$b(this.outerDeco,this.node,n),$b(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 wT(t,e,n,r,i){RD(r,e,t);let s=new to(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class bm extends to{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==Ci||this.dirty!=Pr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Pr||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=Pr,!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 bm(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=Ci)}get domAtom(){return!1}isText(e){return this.node.text==e}}class OD extends Cd{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Pr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class u8 extends to{constructor(e,n,r,i,s,l,c,u,f,h){super(e,n,r,i,s,l,c,f,h),this.spec=u}update(e,n,r,i){if(this.dirty==Ci)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 _D(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=kT(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(c,r);if(l instanceof ll){let u=r?r.previousSibling:t.lastChild;_D(l.contentDOM,l.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=kT(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const gu=function(t){t&&(this.nodeName=t)};gu.prototype=Object.create(null);const Ho=[new gu];function $b(t,e,n){if(t.length==0)return Ho;let r=n?Ho[0]:new gu,i=[r];for(let s=0;s<t.length;s++){let l=t[s].type.attrs;if(l){l.nodeName&&i.push(r=new gu(l.nodeName));for(let c in l){let u=l[c];u!=null&&(n&&i.length==1&&i.push(r=new gu(e.isInline?"span":"div")),c=="class"?r.class=(r.class?r.class+" ":"")+u:c=="style"?r.style=(r.style?r.style+";":"")+u:c!="nodeName"&&(r[c]=u))}}}return i}function DD(t,e,n,r){if(n==Ho&&r==Ho)return e;let i=e;for(let s=0;s<r.length;s++){let l=r[s],c=n[s];if(s){let u;c&&c.nodeName==l.nodeName&&i!=t&&(u=i.parentNode)&&u.nodeName.toLowerCase()==l.nodeName||(u=document.createElement(l.nodeName),u.pmIsDeco=!0,u.appendChild(i),c=Ho[0]),i=u}d8(i,c||Ho[0],l)}return i}function d8(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 RD(t,e,n){return DD(t,t,Ho,$b(e,n,t.nodeType!=1))}function np(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 kT(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class f8{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=h8(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=Pr,this.index=this.stack.pop(),this.top=this.stack.pop(),l--;for(;l<e.length;){this.stack.push(this.top,this.index+1);let u=-1,f=this.top.children.length;i<this.preMatch.index&&(f=Math.min(this.index+3,f));for(let h=this.index;h<f;h++){let m=this.top.children[h];if(m.matchesMark(e[l])&&!this.isLocked(m.dom)){u=h;break}}if(u>-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let h=ll.create(this.top,e[l],n,r);this.top.children.splice(this.index,0,h),this.top=h,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,u=Math.min(this.top.children.length,c+5);c<u;c++){let f=this.top.children[c];if(f.matchesNode(e,n,r)&&!this.preMatch.matched.has(f)){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==Ci&&l.dom==l.contentDOM&&(l.dirty=Uo),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 u=this.top.children[c];if(u instanceof to){let f=this.preMatch.matched.get(u);if(f!=null&&f!=s)return!1;let h=u.dom,m,g=this.isLocked(h)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=Ci&&np(n,u.outerDeco));if(!g&&u.update(e,n,r,i))return this.destroyBetween(this.index,c),u.dom!=h&&(this.changed=!0),this.index++,!0;if(!g&&(m=this.recreateWrapper(u,e,n,r,i,l)))return this.destroyBetween(this.index,c),this.top.children[this.index]=m,m.contentDOM&&(m.dirty=Uo,m.updateChildren(i,l+1),m.dirty=Pr),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)||!np(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let c=to.create(this.top,n,r,i,s,l);if(c.contentDOM){c.children=e.children,e.children=[];for(let u of c.children)u.parent=c}return e.destroy(),c}addNode(e,n,r,i,s){let l=to.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 MD(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 ll;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof bm)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Dn||En)&&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 OD(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 h8(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 f=n.children[r-1];if(f instanceof ll)n=f,r=f.children.length;else{c=f,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=c.node;if(u){if(u!=t.child(i-1))break;--i,s.set(c,i),l.push(c)}}return{index:i,matched:s,matches:l.reverse()}}function p8(t,e){return t.type.side-e.type.side}function m8(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let f=0;f<t.childCount;f++){let h=t.child(f);r(h,i,e.forChild(s,h),f),s+=h.nodeSize}return}let l=0,c=[],u=null;for(let f=0;;){let h,m;for(;l<i.length&&i[l].to==s;){let C=i[l++];C.widget&&(h?(m||(m=[h])).push(C):h=C)}if(h)if(m){m.sort(p8);for(let C=0;C<m.length;C++)n(m[C],f,!!u)}else n(h,f,!!u);let g,b;if(u)b=-1,g=u,u=null;else if(f<t.childCount)b=f,g=t.child(f++);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 v=s+g.nodeSize;if(g.isText){let C=v;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<v&&(u=g.cut(C-s),g=g.cut(0,C-s),v=C,b=-1)}else for(;l<i.length&&i[l].to<v;)l++;let k=g.isInline&&!g.isLeaf?c.filter(C=>!C.inline):c.slice();r(g,k,e.forChild(s,g),b),s=v}}function g8(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 y8(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 u=l.text;for(;i<t.childCount;){let f=t.child(i++);if(s+=f.nodeSize,!f.isText)break;u+=f.text}if(s>=n){if(s>=r&&u.slice(r-e.length-c,r-c)==e)return r-e.length;let f=c<r?u.lastIndexOf(e,r-c-1):-1;if(f>=0&&f+e.length+c>=n)return c+f;if(n==r&&u.length>=r+e.length-c&&u.slice(r-c,r-c+e.length)==e)return r}}return-1}function Fb(t,e,n,r,i){let s=[];for(let l=0,c=0;l<t.length;l++){let u=t[l],f=c,h=c+=u.size;f>=n||h<=e?s.push(u):(f<e&&s.push(u.slice(0,e-f,r)),i&&(s.push(i),i=void 0),h>n&&s.push(u.slice(n-f,u.size,r)))}return s}function O1(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),u,f;if(ym(n)){for(u=l;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&Ae.isSelectable(m)&&i.parent&&!(m.isInline&&FH(n.focusNode,n.focusOffset,i.dom))){let g=i.posBefore;f=new Ae(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 v=n.getRangeAt(b);m=Math.min(m,t.docView.posFromDOM(v.startContainer,v.startOffset,1)),g=Math.max(g,t.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(m<0)return null;[u,l]=g==t.state.selection.anchor?[g,m]:[m,g],c=r.resolve(l)}else u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null}let h=r.resolve(u);if(!f){let m=e=="pointer"||t.state.selection.head<c.pos&&!s?1:-1;f=_1(t,h,c,m)}return f}function ND(t){return t.editable?t.hasFocus():LD(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function as(t,e=!1){let n=t.state.selection;if(zD(t,n),!!ND(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&En){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ol(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)x8(t);else{let{anchor:r,head:i}=n,s,l;CT&&!(n instanceof Oe)&&(n.$from.parent.inlineContent||(s=ET(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=ET(t,n.to))),t.docView.setSelection(r,i,t,e),CT&&(s&&TT(s),l&&TT(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&b8(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const CT=Dn||En&&vD<63;function ET(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(Dn&&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",Dn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function TT(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function b8(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(()=>{(!ND(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function x8(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,kn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&rr&&eo<=11&&(n.disabled=!0,n.disabled=!1)}function zD(t,e){if(e instanceof Ae){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(AT(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else AT(t)}function AT(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function _1(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Oe.between(e,n,r)}function MT(t){return t.editable&&!t.hasFocus()?!1:LD(t)}function LD(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 v8(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ol(e.node,e.offset,n.anchorNode,n.anchorOffset)}function qb(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&&Ne.findFrom(s,e)}function Vs(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function OT(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 Vs(t,new Oe(r.$anchor,l))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=qb(t.state,e);return i&&i instanceof Ae?Vs(t,i):!1}else if(!(zr&&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?Ae.isSelectable(s)?Vs(t,new Ae(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):kd?Vs(t,new Oe(t.state.doc.resolve(e<0?c:c+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ae&&r.node.isInline)return Vs(t,new Oe(e>0?r.$to:r.$from));{let i=qb(t.state,e);return i?Vs(t,i):!1}}}function rp(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function yu(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function oa(t,e){return e<0?S8(t):w8(t)}function S8(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,l=!1;for(Vr&&n.nodeType==1&&r<rp(n)&&yu(n.childNodes[r],-1)&&(l=!0);;)if(r>0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(yu(c,-1))i=n,s=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(jD(n))break;{let c=n.previousSibling;for(;c&&yu(c,-1);)i=n.parentNode,s=kn(c),c=c.previousSibling;if(c)n=c,r=rp(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}l?Kb(t,n,r):i&&Kb(t,i,s)}function w8(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=rp(n),s,l;for(;;)if(r<i){if(n.nodeType!=1)break;let c=n.childNodes[r];if(yu(c,1))s=n,l=++r;else break}else{if(jD(n))break;{let c=n.nextSibling;for(;c&&yu(c,1);)s=c.parentNode,l=kn(c)+1,c=c.nextSibling;if(c)n=c,r=0,i=rp(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Kb(t,s,l)}function jD(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function k8(t,e){for(;t&&e==t.childNodes.length&&!wd(t);)e=kn(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 C8(t,e){for(;t&&!e&&!wd(t);)e=kn(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 Kb(t,e,n){if(e.nodeType!=3){let s,l;(l=k8(e,n))?(e=l,n=0):(s=C8(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(ym(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&&as(t)},50)}function _T(t,e){let n=t.state.doc.resolve(e);if(!(En||SD)&&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 DT(t,e,n){let r=t.state.selection;if(r instanceof Oe&&!r.empty||n.indexOf("s")>-1||zr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let l=qb(t.state,e);if(l&&l instanceof Ae)return Vs(t,l)}if(!i.parent.inlineContent){let l=e<0?i:s,c=r instanceof nr?Ne.near(l,e):Ne.findFrom(l,e);return c?Vs(t,c):!1}return!1}function RT(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 NT(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function E8(t){if(!Dn||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;NT(t,r,"true"),setTimeout(()=>NT(t,r,"false"),20)}return!1}function T8(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function A8(t,e){let n=e.keyCode,r=T8(e);if(n==8||zr&&n==72&&r=="c")return RT(t,-1)||oa(t,-1);if(n==46&&!e.shiftKey||zr&&n==68&&r=="c")return RT(t,1)||oa(t,1);if(n==13||n==27)return!0;if(n==37||zr&&n==66&&r=="c"){let i=n==37?_T(t,t.state.selection.from)=="ltr"?-1:1:-1;return OT(t,i,r)||oa(t,i)}else if(n==39||zr&&n==70&&r=="c"){let i=n==39?_T(t,t.state.selection.from)=="ltr"?1:-1:1;return OT(t,i,r)||oa(t,i)}else{if(n==38||zr&&n==80&&r=="c")return DT(t,-1,r)||oa(t,-1);if(n==40||zr&&n==78&&r=="c")return E8(t)||DT(t,1,r)||oa(t,1);if(r==(zr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function D1(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")||pl.fromSchema(t.state.schema),c=PD(),u=c.createElement("div");u.appendChild(l.serializeFragment(r,{document:c}));let f=u.firstChild,h,m=0;for(;f&&f.nodeType==1&&(h=VD[f.nodeName.toLowerCase()]);){for(let b=h.length-1;b>=0;b--){let v=c.createElement(h[b]);for(;u.firstChild;)v.appendChild(u.firstChild);u.appendChild(v),m++}f=u.firstChild}f&&f.nodeType==1&&f.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,`
109
+
110
+ `);return{dom:u,text:g,slice:e}}function ID(t,e,n,r,i){let s=i.parent.type.spec.code,l,c;if(!n&&!e)return null;let u=!!e&&(r||s||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,s||r,t)}),s)return c=new fe(ee.from(t.state.schema.text(e.replace(/\r\n?/g,`
111
+ `))),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,v=pl.fromSchema(b);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(k=>{let C=l.appendChild(document.createElement("p"));k&&C.appendChild(v.serializeNode(b.text(k,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),l=D8(n),kd&&R8(l);let f=l&&l.querySelector("[data-pm-slice]"),h=f&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(f.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let m=+h[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")||pu.fromSchema(t.state.schema)).parseSlice(l,{preserveWhitespace:!!(u||h),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!M8.test(g.parentNode.nodeName)?{ignore:!0}:null}})),h)c=N8(zT(c,+h[1],+h[2]),h[4]);else if(c=fe.maxOpen(O8(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=zT(c,m,g)}return t.someProp("transformPasted",m=>{c=m(c,t,u)}),c}const M8=/^(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 O8(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 u=i.findWrapping(c.type),f;if(!u)return l=null;if(f=l.length&&s.length&&UD(u,s,c,l[l.length-1],0))l[l.length-1]=f;else{l.length&&(l[l.length-1]=HD(l[l.length-1],s.length));let h=BD(c,u);l.push(h),i=i.matchType(h.type),s=u}}),l)return ee.from(l)}return t}function BD(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,ee.from(t));return t}function UD(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=UD(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(ee.from(BD(n,t,i+1))))}}function HD(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,HD(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(ee.empty,!0);return t.copy(n.append(r))}function Yb(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=Yb(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(ee.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,l.copy(c))}function zT(t,e,n){return e<t.openStart&&(t=new fe(Yb(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new fe(Yb(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const VD={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 LT=null;function PD(){return LT||(LT=document.implementation.createHTMLDocument("title"))}let j0=null;function _8(t){let e=window.trustedTypes;return e?(j0||(j0=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),j0.createHTML(t)):t}function D8(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=PD().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&VD[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=_8(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function R8(t){let e=t.querySelectorAll(En?"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 N8(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 u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;i=ee.from(u.create(r[c+1],i)),s++,l++}return new fe(i,s,l)}const Hn={},Vn={},z8={touchstart:!0,touchmove:!0};class L8{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 j8(t){for(let e in Hn){let n=Hn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{B8(t,r)&&!R1(t,r)&&(t.editable||!(r.type in Vn))&&n(t,r)},z8[e]?{passive:!0}:void 0)}Dn&&t.dom.addEventListener("input",()=>null),Wb(t)}function Xs(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function I8(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 Wb(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>R1(t,r))})}function R1(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function B8(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 U8(t,e){!R1(t,e)&&Hn[e.type]&&(t.editable||!(e.type in Vn))&&Hn[e.type](t,e)}Vn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!FD(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(rs&&En&&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,Io(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||A8(t,n)?n.preventDefault():Xs(t,"key")};Vn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Vn.keypress=(t,e)=>{let n=e;if(FD(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||zr&&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 xm(t){return{left:t.clientX,top:t.clientY}}function H8(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function N1(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 Ca(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 V8(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ae.isSelectable(r)?(Ca(t,new Ae(n)),!0):!1}function P8(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Ae&&(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(Ae.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?(Ca(t,Ae.create(t.state.doc,i)),!0):!1}function $8(t,e,n,r,i){return N1(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?P8(t,n):V8(t,n))}function F8(t,e,n,r){return N1(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function q8(t,e,n,r){return N1(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||K8(t,n,r)}function K8(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Ca(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)Ca(t,Oe.create(r,c+1,c+1+l.content.size));else if(Ae.isSelectable(l))Ca(t,Ae.create(r,c));else continue;return!0}}function z1(t){return ip(t)}const $D=zr?"metaKey":"ctrlKey";Hn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=z1(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&H8(n,t.input.lastClick)&&!n[$D]&&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(xm(n));l&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Y8(t,l,n,!!r)):(s=="doubleClick"?F8:q8)(t,l.pos,l.inside,n)?n.preventDefault():Xs(t,"pointer"))};class Y8{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[$D],this.allowDefault=r.shiftKey;let s,l;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),l=n.inside;else{let h=e.state.doc.resolve(n.pos);s=h.parent,l=h.depth?h.before():0}const c=i?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:f}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||f instanceof Ae&&f.from<=l&&f.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Vr&&!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)),Xs(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(()=>as(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(xm(e))),this.updateAllowDefault(e),this.allowDefault||!n?Xs(this.view,"pointer"):$8(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Dn&&this.mightDrag&&!this.mightDrag.node.isAtom||En&&!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)?(Ca(this.view,Ne.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Xs(this.view,"pointer")}move(e){this.updateAllowDefault(e),Xs(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)}}Hn.touchstart=t=>{t.input.lastTouch=Date.now(),z1(t),Xs(t,"pointer")};Hn.touchmove=t=>{t.input.lastTouch=Date.now(),Xs(t,"pointer")};Hn.contextmenu=t=>z1(t);function FD(t,e){return t.composing?!0:Dn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const W8=rs?5e3:-1;Vn.compositionstart=Vn.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)||En&&SD&&G8(t)))t.markCursor=t.state.storedMarks||n.marks(),ip(t,!0),t.markCursor=null;else if(ip(t,!e.selection.empty),Vr&&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}qD(t,W8)};function G8(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"}Vn.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++,qD(t,20))};function qD(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ip(t),e))}function KD(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=J8());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Z8(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=PH(e.focusNode,e.focusOffset),r=$H(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 J8(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ip(t,e=!1){if(!(rs&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),KD(t),e||t.docView&&t.docView.dirty){let n=O1(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 X8(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 Wu=rr&&eo<15||Ba&&YH<604;Hn.copy=Vn.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Wu?null:n.clipboardData,l=r.content(),{dom:c,text:u}=D1(t,l);s?(n.preventDefault(),s.clearData(),s.setData("text/html",c.innerHTML),s.setData("text/plain",u)):X8(t,c),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Q8(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function eV(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?Gu(t,r.value,null,i,e):Gu(t,r.textContent,r.innerHTML,i,e)},50)}function Gu(t,e,n,r,i){let s=ID(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,i,s||fe.empty)))return!0;if(!s)return!1;let l=Q8(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 YD(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," "):""}Vn.paste=(t,e)=>{let n=e;if(t.composing&&!rs)return;let r=Wu?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Gu(t,YD(r),r.getData("text/html"),i,n)?n.preventDefault():eV(t,n)};class WD{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const tV=zr?"altKey":"ctrlKey";function GD(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[tV]}Hn.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(xm(n)),l;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Ae?i.to-1:i.to))){if(r&&r.mightDrag)l=Ae.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=Ae.create(t.state.doc,m.posBefore))}}let c=(l||t.state.selection).content(),{dom:u,text:f,slice:h}=D1(t,c);(!n.dataTransfer.files.length||!En||vD>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Wu?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Wu||n.dataTransfer.setData("text/plain",f),t.dragging=new WD(h,GD(t,n),l)};Hn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Vn.dragover=Vn.dragenter=(t,e)=>e.preventDefault();Vn.drop=(t,e)=>{try{nV(t,e,t.dragging)}finally{t.dragging=null}};function nV(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(xm(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=ID(t,YD(e.dataTransfer),Wu?null:e.dataTransfer.getData("text/html"),!1,i);let l=!!(n&&GD(t,e));if(t.someProp("handleDrop",b=>b(t,e,s||fe.empty,l))){e.preventDefault();return}if(!s)return;e.preventDefault();let c=s?dD(t.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let u=t.state.tr;if(l){let{node:b}=n;b?b.replace(u):u.deleteSelection()}let f=u.mapping.map(c),h=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,m=u.doc;if(h?u.replaceRangeWith(f,f,s.content.firstChild):u.replaceRange(f,f,s),u.doc.eq(m))return;let g=u.doc.resolve(f);if(h&&Ae.isSelectable(s.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new Ae(g));else{let b=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((v,k,C,E)=>b=E),u.setSelection(_1(t,g,u.doc.resolve(b)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}Hn.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())&&as(t)},20))};Hn.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)};Hn.beforeinput=(t,e)=>{if(En&&rs&&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,Io(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 Vn)Hn[t]=Vn[t];function Zu(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 sp{constructor(e,n){this.toDOM=e,this.spec=n||Wo,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 zt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof sp&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Zu(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class no{constructor(e,n){this.attrs=e,this.spec=n||Wo}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 zt(s,l,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof no&&Zu(this.attrs,e.attrs)&&Zu(this.spec,e.spec)}static is(e){return e.type instanceof no}destroy(){}}class L1{constructor(e,n){this.attrs=e,this.spec=n||Wo}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 zt(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 L1&&Zu(this.attrs,e.attrs)&&Zu(this.spec,e.spec)}destroy(){}}class zt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new zt(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 zt(e,e,new sp(n,r))}static inline(e,n,r,i){return new zt(e,n,new no(r,i))}static node(e,n,r,i){return new zt(e,n,new L1(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof no}get widget(){return this.type instanceof sp}}const aa=[],Wo={};class it{constructor(e,n){this.local=e.length?e:aa,this.children=n.length?n:aa}static create(e,n){return n.length?op(n,e,0,Wo):An}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==An||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Wo)}mapInner(e,n,r,i,s){let l;for(let c=0;c<this.local.length;c++){let u=this.local[c].map(e,r,i);u&&u.type.valid(n,u)?(l||(l=[])).push(u):s.onRemove&&s.onRemove(this.local[c].spec)}return this.children.length?rV(this.children,l||[],e,n,r,i,s):l?new it(l.sort(Go),aa):An}add(e,n){return n.length?this==An?it.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((c,u)=>{let f=u+r,h;if(h=JD(n,c,f)){for(i||(i=this.children.slice());s<i.length&&i[s]<u;)s+=3;i[s]==u?i[s+2]=i[s+2].addInner(c,h,f+1):i.splice(s,0,u,u+c.nodeSize,op(h,c,f+1,Wo)),s+=3}});let l=ZD(s?XD(n):n,-r);for(let c=0;c<l.length;c++)l[c].type.valid(e,l[c])||l.splice(c--,1);return new it(l.length?this.local.concat(l).sort(Go):this.local,i||this.children)}remove(e){return e.length==0||this==An?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,u=r[s+1]+n;for(let h=0,m;h<e.length;h++)(m=e[h])&&m.from>c&&m.to<u&&(e[h]=null,(l||(l=[])).push(m));if(!l)continue;r==this.children&&(r=this.children.slice());let f=r[s+2].removeInner(l,c+1);f!=An?r[s+2]=f:(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 it(i,r):An}forChild(e,n){if(this==An)return this;if(n.isLeaf)return it.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 u=this.local[c];if(u.from<l&&u.to>s&&u.type instanceof no){let f=Math.max(s,u.from)-s,h=Math.min(l,u.to)-s;f<h&&(i||(i=[])).push(u.copy(f,h))}}if(i){let c=new it(i.sort(Go),aa);return r?new Ks([c,r]):c}return r||An}eq(e){if(this==e)return!0;if(!(e instanceof it)||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 j1(this.localsInner(e))}localsInner(e){if(this==An)return aa;if(e.inlineContent||!this.local.some(no.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof no||n.push(this.local[r]);return n}forEachSet(e){e(this)}}it.empty=new it([],[]);it.removeOverlap=j1;const An=it.empty;class Ks{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Wo));return Ks.from(r)}forChild(e,n){if(n.isLeaf)return it.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=An&&(s instanceof Ks?r=r.concat(s.members):r.push(s))}return Ks.from(r)}eq(e){if(!(e instanceof Ks)||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?j1(r?n:n.sort(Go)):aa}static from(e){switch(e.length){case 0:return An;case 1:return e[0];default:return new Ks(e.every(n=>n instanceof it)?e:e.reduce((n,r)=>n.concat(r instanceof it?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function rV(t,e,n,r,i,s,l){let c=t.slice();for(let f=0,h=s;f<n.maps.length;f++){let m=0;n.maps[f].forEach((g,b,v,k)=>{let C=k-v-(b-g);for(let E=0;E<c.length;E+=3){let L=c[E+1];if(L<0||g>L+h-m)continue;let j=c[E]+h-m;b>=j?c[E+1]=g<=j?-2:-1:g>=h&&C&&(c[E]+=C,c[E+1]+=C)}m+=C}),h=n.maps[f].map(h,-1)}let u=!1;for(let f=0;f<c.length;f+=3)if(c[f+1]<0){if(c[f+1]==-2){u=!0,c[f+1]=-1;continue}let h=n.map(t[f]+s),m=h-i;if(m<0||m>=r.content.size){u=!0;continue}let g=n.map(t[f+1]+s,-1),b=g-i,{index:v,offset:k}=r.content.findIndex(m),C=r.maybeChild(v);if(C&&k==m&&k+C.nodeSize==b){let E=c[f+2].mapInner(n,C,h+1,t[f]+s+1,l);E!=An?(c[f]=m,c[f+1]=b,c[f+2]=E):(c[f+1]=-2,u=!0)}else u=!0}if(u){let f=iV(c,t,e,n,i,s,l),h=op(f,r,0,l);e=h.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<h.children.length;m+=3){let b=h.children[m];for(;g<c.length&&c[g]<b;)g+=3;c.splice(g,0,h.children[m],h.children[m+1],h.children[m+2])}}return new it(e.sort(Go),c)}function ZD(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 zt(i.from+e,i.to+e,i.type))}return n}function iV(t,e,n,r,i,s,l){function c(u,f){for(let h=0;h<u.local.length;h++){let m=u.local[h].map(r,i,f);m?n.push(m):l.onRemove&&l.onRemove(u.local[h].spec)}for(let h=0;h<u.children.length;h+=3)c(u.children[h+2],u.children[h]+f+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&c(t[u+2],e[u]+s+1);return n}function JD(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 XD(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function op(t,e,n,r){let i=[],s=!1;e.forEach((c,u)=>{let f=JD(t,c,u+n);if(f){s=!0;let h=op(f,c,n+u+1,r);h!=An&&i.push(u,u+c.nodeSize,h)}});let l=ZD(s?XD(t):t,-n).sort(Go);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 it(l,i):An}function Go(t,e){return t.from-e.from||t.to-e.to}function j1(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),jT(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),jT(e,i,r.copy(s.from,r.to)));break}}}return e}function jT(t,e,n){for(;e<t.length&&Go(n,t[e])>0;)e++;t.splice(e,0,n)}function I0(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=An&&e.push(r)}),t.cursorWrapper&&e.push(it.create(t.state.doc,[t.cursorWrapper.deco])),Ks.from(e)}const sV={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},oV=rr&&eo<=11;class lV{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 aV{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new lV,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]);rr&&eo<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Dn&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),oV&&(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,sV)),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(MT(this.view)){if(this.suppressingSelectionUpdates)return as(this.view);if(rr&&eo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ol(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)&&MT(e)&&!this.ignoreSelectionChange(r),s=-1,l=-1,c=!1,u=[];if(e.editable)for(let h=0;h<n.length;h++){let m=this.registerMutation(n[h],u);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(u.some(h=>h.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let h of u)if(h.nodeName=="BR"&&h.parentNode){let m=h.nextSibling;for(;m&&m.nodeType==1;){if(m.contentEditable=="false"){h.parentNode.removeChild(h);break}m=m.firstChild}}}else if(Vr&&u.length){let h=u.filter(m=>m.nodeName=="BR");if(h.length==2){let[m,g]=h;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of h){let b=g.parentNode;b&&b.nodeName=="LI"&&(!m||dV(e,m)!=b)&&g.remove()}}}let f=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ym(r)&&(f=O1(e))&&f.eq(Ne.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,as(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,l),cV(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,fV(e,u)),this.handleDOMChange(s,l,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||as(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 h=0;h<e.addedNodes.length;h++){let m=e.addedNodes[h];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(rr&&eo<=11&&e.addedNodes.length)for(let h=0;h<e.addedNodes.length;h++){let{previousSibling:m,nextSibling:g}=e.addedNodes[h];(!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?kn(i)+1:0,c=r.localPosFromDOM(e.target,l,-1),u=s&&s.parentNode==e.target?kn(s):e.target.childNodes.length,f=r.localPosFromDOM(e.target,u,1);return{from:c,to:f}}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 IT=new WeakMap,BT=!1;function cV(t){if(!IT.has(t)&&(IT.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Vr,BT)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."),BT=!0}}function UT(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return ol(l.node,l.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function uV(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return UT(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?UT(t,n):null}function dV(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 fV(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 u=c.firstChild;if(!u||u.nodeType!=1||u.contentEditable=="false"||/^(BR|IMG)$/.test(u.nodeName))break;c=u}c.insertBefore(s,c.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function hV(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:l,to:c}=t.docView.parseRange(e,n),u=t.domSelectionRange(),f,h=u.anchorNode;if(h&&t.dom.contains(h.nodeType==1?h:h.parentNode)&&(f=[{node:h,offset:u.anchorOffset}],ym(u)||f.push({node:u.focusNode,offset:u.focusOffset})),En&&t.input.lastKeyCode===8)for(let C=s;C>i;C--){let E=r.childNodes[C-1],L=E.pmViewDesc;if(E.nodeName=="BR"&&!L){s=C;break}if(!L||L.size)break}let m=t.state.doc,g=t.someProp("domParser")||pu.fromSchema(t.state.schema),b=m.resolve(l),v=null,k=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:f,ruleFromNode:pV,context:b});if(f&&f[0].pos!=null){let C=f[0].pos,E=f[1]&&f[1].pos;E==null&&(E=C),v={anchor:C+l,head:E+l}}return{doc:k,sel:v,from:l,to:c}}function pV(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Dn&&/^(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||Dn&&/^(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 mV=/^(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 gV(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let B=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,te=O1(t,B);if(te&&!t.state.selection.eq(te)){if(En&&rs&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",oe=>oe(t,Io(13,"Enter"))))return;let W=t.state.tr.setSelection(te);B=="pointer"?W.setMeta("pointer",!0):B=="key"&&W.scrollIntoView(),s&&W.setMeta("composition",s),t.dispatch(W)}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 u=t.state.selection,f=hV(t,e,n),h=t.state.doc,m=h.slice(f.from,f.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 v=xV(m.content,f.doc.content,f.from,g,b);if(v&&t.input.domChangeCount++,(Ba&&t.input.lastIOSEnter>Date.now()-225||rs)&&i.some(B=>B.nodeType==1&&!mV.test(B.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",B=>B(t,Io(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&u instanceof Oe&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))v={start:u.from,endA:u.to,endB:u.to};else{if(f.sel){let B=HT(t,t.state.doc,f.sel);if(B&&!B.eq(t.state.selection)){let te=t.state.tr.setSelection(B);s&&te.setMeta("composition",s),t.dispatch(te)}}return}t.state.selection.from<t.state.selection.to&&v.start==v.endB&&t.state.selection instanceof Oe&&(v.start>t.state.selection.from&&v.start<=t.state.selection.from+2&&t.state.selection.from>=f.from?v.start=t.state.selection.from:v.endA<t.state.selection.to&&v.endA>=t.state.selection.to-2&&t.state.selection.to<=f.to&&(v.endB+=t.state.selection.to-v.endA,v.endA=t.state.selection.to)),rr&&eo<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>f.from&&f.doc.textBetween(v.start-f.from-1,v.start-f.from+1)=="  "&&(v.start--,v.endA--,v.endB--);let k=f.doc.resolveNoCache(v.start-f.from),C=f.doc.resolveNoCache(v.endB-f.from),E=h.resolve(v.start),L=k.sameParent(C)&&k.parent.inlineContent&&E.end()>=v.endA;if((Ba&&t.input.lastIOSEnter>Date.now()-225&&(!L||i.some(B=>B.nodeName=="DIV"||B.nodeName=="P"))||!L&&k.pos<f.doc.content.size&&(!k.sameParent(C)||!k.parent.inlineContent)&&k.pos<C.pos&&!/\S/.test(f.doc.textBetween(k.pos,C.pos,"","")))&&t.someProp("handleKeyDown",B=>B(t,Io(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&bV(h,v.start,v.endA,k,C)&&t.someProp("handleKeyDown",B=>B(t,Io(8,"Backspace")))){rs&&En&&t.domObserver.suppressSelectionUpdates();return}En&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),rs&&!L&&k.start()!=C.start()&&C.parentOffset==0&&k.depth==C.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==v.endA&&(v.endB-=2,C=f.doc.resolveNoCache(v.endB-f.from),setTimeout(()=>{t.someProp("handleKeyDown",function(B){return B(t,Io(13,"Enter"))})},20));let j=v.start,Y=v.endA,V=B=>{let te=B||t.state.tr.replace(j,Y,f.doc.slice(v.start-f.from,v.endB-f.from));if(f.sel){let W=HT(t,te.doc,f.sel);W&&!(En&&t.composing&&W.empty&&(v.start!=v.endB||t.input.lastChromeDelete<Date.now()-100)&&(W.head==j||W.head==te.mapping.map(Y)-1)||rr&&W.empty&&W.head==j)&&te.setSelection(W)}return s&&te.setMeta("composition",s),te.scrollIntoView()},R;if(L)if(k.pos==C.pos){rr&&eo<=11&&k.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>as(t),20));let B=V(t.state.tr.delete(j,Y)),te=h.resolve(v.start).marksAcross(h.resolve(v.endA));te&&B.ensureMarks(te),t.dispatch(B)}else if(v.endA==v.endB&&(R=yV(k.parent.content.cut(k.parentOffset,C.parentOffset),E.parent.content.cut(E.parentOffset,v.endA-E.start())))){let B=V(t.state.tr);R.type=="add"?B.addMark(j,Y,R.mark):B.removeMark(j,Y,R.mark),t.dispatch(B)}else if(k.parent.child(k.index()).isText&&k.index()==C.index()-(C.textOffset?0:1)){let B=k.parent.textBetween(k.parentOffset,C.parentOffset),te=()=>V(t.state.tr.insertText(B,j,Y));t.someProp("handleTextInput",W=>W(t,j,Y,B,te))||t.dispatch(te())}else t.dispatch(V());else t.dispatch(V())}function HT(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:_1(t,e.resolve(n.anchor),e.resolve(n.head))}function yV(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,l,c,u;for(let h=0;h<r.length;h++)i=r[h].removeFromSet(i);for(let h=0;h<n.length;h++)s=n[h].removeFromSet(s);if(i.length==1&&s.length==0)c=i[0],l="add",u=h=>h.mark(c.addToSet(h.marks));else if(i.length==0&&s.length==1)c=s[0],l="remove",u=h=>h.mark(c.removeFromSet(h.marks));else return null;let f=[];for(let h=0;h<e.childCount;h++)f.push(u(e.child(h)));if(ee.from(f).eq(t))return{mark:c,type:l}}function bV(t,e,n,r,i){if(n-e<=i.pos-r.pos||B0(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(B0(s,!0,!0));return!l.parent.isTextblock||l.pos>n||B0(l,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function B0(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 xV(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 u=Math.max(0,s-Math.min(l,c));r-=l+u-s}if(l<s&&t.size<e.size){let u=r<=s&&r>=l?s-r:0;s-=u,s&&s<e.size&&VT(e.textBetween(s-1,s+1))&&(s+=u?1:-1),c=s+(c-l),l=s}else if(c<s){let u=r<=s&&r>=c?s-r:0;s-=u,s&&s<t.size&&VT(t.textBetween(s-1,s+1))&&(s+=u?1:-1),l=s+(l-c),c=s}return{start:s,endA:l,endB:c}}function VT(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 QD{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 L8,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(KT),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=FT(this),$T(this),this.nodeViews=qT(this),this.docView=wT(this.state.doc,PT(this),I0(this),this.dom,this),this.domObserver=new aV(this,(r,i,s,l)=>gV(this,r,i,s,l)),this.domObserver.start(),j8(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&&Wb(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(KT),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&&(KD(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=qT(this);SV(b,this.nodeViews)&&(this.nodeViews=b,s=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&Wb(this),this.editable=FT(this),$T(this);let u=I0(this),f=PT(this),h=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",m=s||!this.docView.matchesNode(e.doc,f,u);(m||!e.selection.eq(i.selection))&&(l=!0);let g=h=="preserve"&&l&&this.dom.style.overflowAnchor==null&&ZH(this);if(l){this.domObserver.stop();let b=m&&(rr||En)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&vV(i.selection,e.selection);if(m){let v=En?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Z8(this)),(s||!this.docView.update(e.doc,f,u,this))&&(this.docView.updateOuterDeco(f),this.docView.destroy(),this.docView=wT(e.doc,f,u,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&v8(this))?as(this,b):(zD(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),h=="reset"?this.dom.scrollTop=0:h=="to selection"?this.scrollToSelection():g&&JH(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 Ae){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&gT(this,n.getBoundingClientRect(),e)}else gT(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 WD(e.slice,e.move,i<0?void 0:Ae.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(rr){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&&XH(this.dom),as(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 r8(this,e)}coordsAtPos(e,n=1){return TD(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 a8(this,n||this.state,e)}pasteHTML(e,n){return Gu(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Gu(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return D1(this,e)}destroy(){this.docView&&(I8(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],I0(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,HH())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return U8(this,e)}domSelectionRange(){let e=this.domSelection();return e?Dn&&this.root.nodeType===11&&qH(this.dom.ownerDocument)==this.dom&&uV(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}QD.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function PT(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"),[zt.node(0,t.state.doc.content.size,e)]}function $T(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:zt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function FT(t){return!t.someProp("editable",e=>e(t.state)===!1)}function vV(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 qT(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 SV(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 KT(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 lo={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:"'"},lp={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},wV=typeof navigator<"u"&&/Mac/.test(navigator.platform),kV=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Cn=0;Cn<10;Cn++)lo[48+Cn]=lo[96+Cn]=String(Cn);for(var Cn=1;Cn<=24;Cn++)lo[Cn+111]="F"+Cn;for(var Cn=65;Cn<=90;Cn++)lo[Cn]=String.fromCharCode(Cn+32),lp[Cn]=String.fromCharCode(Cn);for(var U0 in lo)lp.hasOwnProperty(U0)||(lp[U0]=lo[U0]);function CV(t){var e=wV&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||kV&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?lp:lo)[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 EV=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),TV=typeof navigator<"u"&&/Win/.test(navigator.platform);function AV(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 u=e[c];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))EV?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),l&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function MV(t){let e=Object.create(null);for(let n in t)e[AV(n)]=t[n];return e}function H0(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 OV(t){return new pt({props:{handleKeyDown:I1(t)}})}function I1(t){let e=MV(t);return function(n,r){let i=CV(r),s,l=e[H0(i,r)];if(l&&l(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=e[H0(i,r,!1)];if(c&&c(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(TV&&r.ctrlKey&&r.altKey)&&(s=lo[r.keyCode])&&s!=i){let c=e[H0(s,r)];if(c&&c(n.state,n.dispatch,n))return!0}}return!1}}const B1=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function eR(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const tR=(t,e,n)=>{let r=eR(t,n);if(!r)return!1;let i=U1(r);if(!i){let l=r.blockRange(),c=l&&ec(l);return c==null?!1:(e&&e(t.tr.lift(l,c).scrollIntoView()),!0)}let s=i.nodeBefore;if(uR(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Ua(s,"end")||Ae.isSelectable(s)))for(let l=r.depth;;l--){let c=mm(t.doc,r.before(l),r.after(l),fe.empty);if(c&&c.slice.size<c.to-c.from){if(e){let u=t.tr.step(c);u.setSelection(Ua(s,"end")?Ne.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):Ae.create(u.doc,i.pos-s.nodeSize)),e(u.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},_V=(t,e,n)=>{let r=eR(t,n);if(!r)return!1;let i=U1(r);return i?nR(t,i,e):!1},DV=(t,e,n)=>{let r=iR(t,n);if(!r)return!1;let i=H1(r);return i?nR(t,i,e):!1};function nR(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 h=i.lastChild;if(!h)return!1;i=h}let l=e.nodeAfter,c=l,u=e.pos+1;for(;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;let h=c.firstChild;if(!h)return!1;c=h}let f=mm(t.doc,s,u,fe.empty);if(!f||f.from!=s||f instanceof on&&f.slice.size>=u-s)return!1;if(n){let h=t.tr.step(f);h.setSelection(Oe.create(h.doc,s)),n(h.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 rR=(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=U1(r)}let l=s&&s.nodeBefore;return!l||!Ae.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Ae.create(t.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function U1(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 iR(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const sR=(t,e,n)=>{let r=iR(t,n);if(!r)return!1;let i=H1(r);if(!i)return!1;let s=i.nodeAfter;if(uR(t,i,e,1))return!0;if(r.parent.content.size==0&&(Ua(s,"start")||Ae.isSelectable(s))){let l=mm(t.doc,r.before(),r.after(),fe.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(Ua(s,"start")?Ne.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):Ae.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},oR=(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=H1(r)}let l=s&&s.nodeAfter;return!l||!Ae.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Ae.create(t.doc,s.pos)).scrollIntoView()),!0)};function H1(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 RV=(t,e)=>{let n=t.selection,r=n instanceof Ae,i;if(r){if(n.node.isTextblock||!ho(t.doc,n.from))return!1;i=n.from}else if(i=pm(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(Ae.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},NV=(t,e)=>{let n=t.selection,r;if(n instanceof Ae){if(n.node.isTextblock||!ho(t.doc,n.to))return!1;r=n.to}else if(r=pm(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},zV=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&ec(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},lR=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
112
+ `).scrollIntoView()),!0)};function V1(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 LV=(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=V1(i.contentMatchAt(s));if(!l||!i.canReplaceWith(s,s,l))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,l.createAndFill());u.setSelection(Ne.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},aR=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof nr||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=V1(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},cR=(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(ls(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&ec(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function jV(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Ae&&e.selection.node.isBlock)return!r.parentOffset||!ls(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],l,c,u=!1,f=!1;for(let b=r.depth;;b--)if(r.node(b).isBlock){u=r.end(b)==r.pos+(r.depth-b),f=r.start(b)==r.pos-(r.depth-b),c=V1(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),s.unshift(u&&c?{type:c}:null),l=b;break}else{if(b==1)return!1;s.unshift(null)}let h=e.tr;(e.selection instanceof Oe||e.selection instanceof nr)&&h.deleteSelection();let m=h.mapping.map(r.pos),g=ls(h.doc,m,s.length,s);if(g||(s[0]=c?{type:c}:null,g=ls(h.doc,m,s.length,s)),!g)return!1;if(h.split(m,s.length,s),!u&&f&&r.node(l).type!=c){let b=h.mapping.map(r.before(l)),v=h.doc.resolve(b);c&&r.node(l-1).canReplaceWith(v.index(),v.index()+1,c)&&h.setNodeMarkup(h.mapping.map(r.before(l)),c)}return n&&n(h.scrollIntoView()),!0}}const IV=jV(),BV=(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(Ae.create(t.doc,i))),!0)};function UV(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||ho(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function uR(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,l,c,u=i.type.spec.isolating||s.type.spec.isolating;if(!u&&UV(t,e,n))return!0;let f=!u&&e.parent.canReplace(e.index(),e.index()+1);if(f&&(l=(c=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&c.matchType(l[0]||s.type).validEnd){if(n){let b=e.pos+s.nodeSize,v=ee.empty;for(let E=l.length-1;E>=0;E--)v=ee.from(l[E].create(null,v));v=ee.from(i.copy(v));let k=t.tr.step(new cn(e.pos-1,b,e.pos,b,new fe(v,1,0),l.length,!0)),C=k.doc.resolve(b+2*l.length);C.nodeAfter&&C.nodeAfter.type==i.type&&ho(k.doc,C.pos)&&k.join(C.pos),n(k.scrollIntoView())}return!0}let h=s.type.spec.isolating||r>0&&u?null:Ne.findFrom(e,1),m=h&&h.$from.blockRange(h.$to),g=m&&ec(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(f&&Ua(s,"start",!0)&&Ua(i,"end")){let b=i,v=[];for(;v.push(b),!b.isTextblock;)b=b.lastChild;let k=s,C=1;for(;!k.isTextblock;k=k.firstChild)C++;if(b.canReplace(b.childCount,b.childCount,k.content)){if(n){let E=ee.empty;for(let j=v.length-1;j>=0;j--)E=ee.from(v[j].copy(E));let L=t.tr.step(new cn(e.pos-v.length,e.pos+s.nodeSize,e.pos+C,e.pos+s.nodeSize-C,new fe(E,v.length,0),0,!0));n(L.scrollIntoView())}return!0}}return!1}function dR(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 HV=dR(-1),VV=dR(1);function PV(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,l=i.blockRange(s),c=l&&E1(l,t,e);return c?(r&&r(n.tr.wrap(l,c).scrollIntoView()),!0):!1}}function YT(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,(u,f)=>{if(i)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)i=!0;else{let h=n.doc.resolve(f),m=h.index();i=h.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:u}}=n.selection.ranges[l];s.setBlockType(c,u,t,e)}r(s.scrollIntoView())}return!0}}function P1(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}P1(B1,tR,rR);P1(B1,sR,oR);P1(lR,aR,cR,IV);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function $V(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 FV(c,l,t,e)?(r&&r(c.scrollIntoView()),!0):!1}}function FV(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 u=l.resolve(e.start-2);s=new ep(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new ep(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let c=E1(s,n,r,e);return c?(t&&qV(t,e,c,i,n),!0):!1}function qV(t,e,n,r,i){let s=ee.empty;for(let h=n.length-1;h>=0;h--)s=ee.from(n[h].type.create(n[h].attrs,s));t.step(new cn(e.start-(r?2:0),e.end,e.start,e.end,new fe(s,0,0),n.length,!0));let l=0;for(let h=0;h<n.length;h++)n[h].type==i&&(l=h+1);let c=n.length-l,u=e.start+n.length-(r?2:0),f=e.parent;for(let h=e.startIndex,m=e.endIndex,g=!0;h<m;h++,g=!1)!g&&ls(t.doc,u,c)&&(t.split(u,c),u+=2*c),u+=f.child(h).nodeSize;return t}function KV(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?YV(e,n,t,s):WV(e,n,s):!0:!1}}function YV(t,e,n,r){let i=t.tr,s=r.end,l=r.$to.end(r.depth);s<l&&(i.step(new cn(s-1,l,s,l,new fe(ee.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ep(i.doc.resolve(r.$from.pos),i.doc.resolve(l),r.depth));const c=ec(r);if(c==null)return!1;i.lift(r,c);let u=i.doc.resolve(i.mapping.map(s,-1)-1);return ho(i.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&i.join(u.pos),e(i.scrollIntoView()),!0}function WV(t,e,n){let r=t.tr,i=n.parent;for(let b=n.end,v=n.endIndex-1,k=n.startIndex;v>k;v--)b-=i.child(v).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,u=n.endIndex==i.childCount,f=s.node(-1),h=s.index(-1);if(!f.canReplace(h+(c?0:1),h+1,l.content.append(u?ee.empty:ee.from(i))))return!1;let m=s.pos,g=m+l.nodeSize;return r.step(new cn(m-(c?1:0),g+(u?1:0),m+1,g-1,new fe((c?ee.empty:ee.from(i.copy(ee.empty))).append(u?ee.empty:ee.from(i.copy(ee.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function GV(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,f=>f.childCount>0&&f.firstChild.type==t);if(!s)return!1;let l=s.startIndex;if(l==0)return!1;let c=s.parent,u=c.child(l-1);if(u.type!=t)return!1;if(n){let f=u.lastChild&&u.lastChild.type==c.type,h=ee.from(f?t.create():null),m=new fe(ee.from(t.create(null,ee.from(c.type.create(null,h)))),f?3:1,0),g=s.start,b=s.end;n(e.tr.step(new cn(g-(f?3:1),b,g,b,m,1,!0)).scrollIntoView())}return!0}}function vm(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 Sm{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,u])=>[c,(...h)=>{const m=u(...h)(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=[],u=!!e,f=e||s.tr,h=()=>(!u&&n&&!f.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(f),c.every(g=>g===!0)),m={...Object.fromEntries(Object.entries(r).map(([g,b])=>[g,(...k)=>{const C=this.buildProps(f,n),E=b(...k)(C);return c.push(E),m}])),run:h};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(([u,f])=>[u,(...h)=>f(...h)({...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:vm({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(([u,f])=>[u,(...h)=>f(...h)(c)]))}};return c}}let ZV=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 ve(t,e,n){return t.config[e]===void 0&&t.parent?ve(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ve(t.parent,e,n):null}):t.config[e]}function wm(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 fR(t){const e=[],{nodeExtensions:n,markExtensions:r}=wm(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},u=ve(l,"addGlobalAttributes",c);if(!u)return;u().forEach(h=>{h.types.forEach(m=>{Object.entries(h.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},u=ve(l,"addAttributes",c);if(!u)return;const f=u();Object.entries(f).forEach(([h,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:h,attribute:g})})}),e}function dn(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 Lt(...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(" "):[],u=r[i]?r[i].split(" "):[],f=c.filter(h=>!u.includes(h));r[i]=[...u,...f].join(" ")}else if(i==="style"){const c=s?s.split(";").map(h=>h.trim()).filter(Boolean):[],u=r[i]?r[i].split(";").map(h=>h.trim()).filter(Boolean):[],f=new Map;u.forEach(h=>{const[m,g]=h.split(":").map(b=>b.trim());f.set(m,g)}),c.forEach(h=>{const[m,g]=h.split(":").map(b=>b.trim());f.set(m,g)}),r[i]=Array.from(f.entries()).map(([h,m])=>`${h}: ${m}`).join("; ")}else r[i]=s}),r},{})}function Gb(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)=>Lt(n,r),{})}function hR(t){return typeof t=="function"}function Fe(t,e=void 0,...n){return hR(t)?e?t.bind(e)(...n):t(...n):t}function JV(t={}){return Object.keys(t).length===0&&t.constructor===Object}function XV(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function WT(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):XV(n.getAttribute(l.name));return c==null?s:{...s,[l.name]:c}},{});return{...r,...i}}}}function GT(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&JV(n)?!1:n!=null))}function QV(t,e){var n;const r=fR(t),{nodeExtensions:i,markExtensions:s}=wm(t),l=(n=i.find(f=>ve(f,"topNode")))===null||n===void 0?void 0:n.name,c=Object.fromEntries(i.map(f=>{const h=r.filter(E=>E.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((E,L)=>{const j=ve(L,"extendNodeSchema",m);return{...E,...j?j(f):{}}},{}),b=GT({...g,content:Fe(ve(f,"content",m)),marks:Fe(ve(f,"marks",m)),group:Fe(ve(f,"group",m)),inline:Fe(ve(f,"inline",m)),atom:Fe(ve(f,"atom",m)),selectable:Fe(ve(f,"selectable",m)),draggable:Fe(ve(f,"draggable",m)),code:Fe(ve(f,"code",m)),whitespace:Fe(ve(f,"whitespace",m)),linebreakReplacement:Fe(ve(f,"linebreakReplacement",m)),defining:Fe(ve(f,"defining",m)),isolating:Fe(ve(f,"isolating",m)),attrs:Object.fromEntries(h.map(E=>{var L;return[E.name,{default:(L=E==null?void 0:E.attribute)===null||L===void 0?void 0:L.default}]}))}),v=Fe(ve(f,"parseHTML",m));v&&(b.parseDOM=v.map(E=>WT(E,h)));const k=ve(f,"renderHTML",m);k&&(b.toDOM=E=>k({node:E,HTMLAttributes:Gb(E,h)}));const C=ve(f,"renderText",m);return C&&(b.toText=C),[f.name,b]})),u=Object.fromEntries(s.map(f=>{const h=r.filter(C=>C.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((C,E)=>{const L=ve(E,"extendMarkSchema",m);return{...C,...L?L(f):{}}},{}),b=GT({...g,inclusive:Fe(ve(f,"inclusive",m)),excludes:Fe(ve(f,"excludes",m)),group:Fe(ve(f,"group",m)),spanning:Fe(ve(f,"spanning",m)),code:Fe(ve(f,"code",m)),attrs:Object.fromEntries(h.map(C=>{var E;return[C.name,{default:(E=C==null?void 0:C.attribute)===null||E===void 0?void 0:E.default}]}))}),v=Fe(ve(f,"parseHTML",m));v&&(b.parseDOM=v.map(C=>WT(C,h)));const k=ve(f,"renderHTML",m);return k&&(b.toDOM=C=>k({mark:C,HTMLAttributes:Gb(C,h)})),[f.name,b]}));return new eD({topNode:l,nodes:c,marks:u})}function V0(t,e){return e.nodes[t]||e.marks[t]||null}function ZT(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function $1(t,e){const n=pl.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const eP=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,l,c)=>{var u,f;const h=((f=(u=i.type.spec).toText)===null||f===void 0?void 0:f.call(u,{node:i,pos:s,parent:l,index:c}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?h:h.slice(0,Math.max(0,r-s))}),n};function F1(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class km{constructor(e){this.find=e.find,this.handler=e.handler}}const tP=(t,e)=>{if(F1(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 Xf(t){var e;const{editor:n,from:r,to:i,text:s,rules:l,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const f=u.state.doc.resolve(r);if(f.parent.type.spec.code||!((e=f.nodeBefore||f.nodeAfter)===null||e===void 0)&&e.marks.find(g=>g.type.spec.code))return!1;let h=!1;const m=eP(f)+s;return l.forEach(g=>{if(h)return;const b=tP(m,g.find);if(!b)return;const v=u.state.tr,k=vm({state:u.state,transaction:v}),C={from:r-(b[0].length-s.length),to:i},{commands:E,chain:L,can:j}=new Sm({editor:n,state:k});g.handler({state:k,range:C,match:b,commands:E,chain:L,can:j})===null||!v.steps.length||(v.setMeta(c,{transform:v,from:r,to:i,text:s}),u.dispatch(v),h=!0)}),h}function nP(t){const{editor:e,rules:n}=t,r=new pt({state:{init(){return null},apply(i,s,l){const c=i.getMeta(r);if(c)return c;const u=i.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:h}=u;typeof h=="string"?h=h:h=$1(ee.from(h),l.schema);const{from:m}=u,g=m+h.length;Xf({editor:e,from:m,to:g,text:h,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,l,c){return Xf({editor:e,from:s,to:l,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Xf({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?Xf({editor:e,from:l.pos,to:l.pos,text:`
113
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function rP(t){return Object.prototype.toString.call(t).slice(8,-1)}function Qf(t){return rP(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Cm(t,e){const n={...t};return Qf(t)&&Qf(e)&&Object.keys(e).forEach(r=>{Qf(e[r])&&Qf(t[r])?n[r]=Cm(t[r],e[r]):n[r]=e[r]}),n}class Ei{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=Fe(ve(this,"addOptions",{name:this.name}))),this.storage=Fe(ve(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ei(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 Ei(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=Fe(ve(n,"addOptions",{name:n.name})),n.storage=Fe(ve(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(f=>(f==null?void 0:f.type.name)===n.name))return!1;const u=l.find(f=>(f==null?void 0:f.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function iP(t){return typeof t=="number"}class sP{constructor(e){this.find=e.find,this.handler=e.handler}}const oP=(t,e,n)=>{if(F1(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 lP(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:l,dropEvent:c}=t,{commands:u,chain:f,can:h}=new Sm({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,i,(b,v)=>{if(!b.isTextblock||b.type.spec.code)return;const k=Math.max(r,v),C=Math.min(i,v+b.content.size),E=b.textBetween(k-v,C-v,void 0,"");oP(E,s.find,l).forEach(j=>{if(j.index===void 0)return;const Y=k+j.index+1,V=Y+j[0].length,R={from:n.tr.mapping.map(Y),to:n.tr.mapping.map(V)},B=s.handler({state:n,range:R,match:j,commands:u,chain:f,can:h,pasteEvent:l,dropEvent:c});m.push(B)})}),m.every(b=>b!==null)}let eh=null;const aP=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 cP(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 u=({state:h,from:m,to:g,rule:b,pasteEvt:v})=>{const k=h.tr,C=vm({state:h,transaction:k});if(!(!lP({editor:e,state:C,from:Math.max(m-1,0),to:g.b-1,rule:b,pasteEvent:v,dropEvent:c})||!k.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,k}};return n.map(h=>new pt({view(m){const g=v=>{var k;r=!((k=m.dom.parentElement)===null||k===void 0)&&k.contains(v.target)?m.dom.parentElement:null,r&&(eh=e)},b=()=>{eh&&(eh=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=eh;b!=null&&b.isEditable&&setTimeout(()=>{const v=b.state.selection;v&&b.commands.deleteRange({from:v.from,to:v.to})},10)}return!1},paste:(m,g)=>{var b;const v=(b=g.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return l=g,i=!!(v!=null&&v.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,b)=>{const v=m[0],k=v.getMeta("uiEvent")==="paste"&&!i,C=v.getMeta("uiEvent")==="drop"&&!s,E=v.getMeta("applyPasteRules"),L=!!E;if(!k&&!C&&!L)return;if(L){let{text:V}=E;typeof V=="string"?V=V:V=$1(ee.from(V),b.schema);const{from:R}=E,B=R+V.length,te=aP(V);return u({rule:h,state:b,from:R,to:{b:B},pasteEvt:te})}const j=g.doc.content.findDiffStart(b.doc.content),Y=g.doc.content.findDiffEnd(b.doc.content);if(!(!iP(j)||!Y||j===Y.b))return u({rule:h,state:b,from:j,to:Y,pasteEvt:l})}}))}function uP(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class pa{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=pa.resolve(e),this.schema=QV(this.extensions,n),this.setupExtensions()}static resolve(e){const n=pa.sort(pa.flatten(e)),r=uP(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=ve(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=ve(r,"priority")||100,l=ve(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:V0(n.name,this.schema)},i=ve(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=pa.sort([...this.extensions].reverse()),r=[],i=[],s=n.map(l=>{const c={name:l.name,options:l.options,storage:l.storage,editor:e,type:V0(l.name,this.schema)},u=[],f=ve(l,"addKeyboardShortcuts",c);let h={};if(l.type==="mark"&&ve(l,"exitable",c)&&(h.ArrowRight=()=>Ei.handleExit({editor:e,mark:l})),f){const k=Object.fromEntries(Object.entries(f()).map(([C,E])=>[C,()=>E({editor:e})]));h={...h,...k}}const m=OV(h);u.push(m);const g=ve(l,"addInputRules",c);ZT(l,e.options.enableInputRules)&&g&&r.push(...g());const b=ve(l,"addPasteRules",c);ZT(l,e.options.enablePasteRules)&&b&&i.push(...b());const v=ve(l,"addProseMirrorPlugins",c);if(v){const k=v();u.push(...k)}return u}).flat();return[nP({editor:e,rules:r}),...cP({editor:e,rules:i}),...s]}get attributes(){return fR(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=wm(this.extensions);return Object.fromEntries(n.filter(r=>!!ve(r,"addNodeView")).map(r=>{const i=this.attributes.filter(u=>u.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:dn(r.name,this.schema)},l=ve(r,"addNodeView",s);if(!l)return[];const c=(u,f,h,m,g)=>{const b=Gb(u,i);return l()({node:u,view:f,getPos:h,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:V0(e.name,this.schema)};e.type==="mark"&&(!((n=Fe(ve(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=ve(e,"onBeforeCreate",r),s=ve(e,"onCreate",r),l=ve(e,"onUpdate",r),c=ve(e,"onSelectionUpdate",r),u=ve(e,"onTransaction",r),f=ve(e,"onFocus",r),h=ve(e,"onBlur",r),m=ve(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),u&&this.editor.on("transaction",u),f&&this.editor.on("focus",f),h&&this.editor.on("blur",h),m&&this.editor.on("destroy",m)})}}class Vt{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=Fe(ve(this,"addOptions",{name:this.name}))),this.storage=Fe(ve(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Vt(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 Vt({...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=Fe(ve(n,"addOptions",{name:n.name})),n.storage=Fe(ve(n,"addStorage",{name:n.name,options:n.options})),n}}function pR(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
114
+
115
+ `,textSerializers:l={}}=n||{};let c="";return t.nodesBetween(r,i,(u,f,h,m)=>{var g;u.isBlock&&f>r&&(c+=s);const b=l==null?void 0:l[u.type.name];if(b)return h&&(c+=b({node:u,pos:f,parent:h,index:m,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)===null||g===void 0?void 0:g.slice(Math.max(r,f)-f,i-f))}),c}function mR(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const dP=Vt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new pt({key:new Tt("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(h=>h.$from.pos)),c=Math.max(...s.map(h=>h.$to.pos)),u=mR(n);return pR(r,{from:l,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),fP=()=>({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),hP=(t=!1)=>({commands:e})=>e.setContent("",t),pP=()=>({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,u)=>{if(c.type.isText)return;const{doc:f,mapping:h}=e,m=f.resolve(h.map(u)),g=f.resolve(h.map(u+c.nodeSize)),b=m.blockRange(g);if(!b)return;const v=ec(b);if(c.type.isTextblock){const{defaultType:k}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(b.start,k)}(v||v===0)&&e.lift(b,v)})}),!0},mP=t=>e=>t(e),gP=()=>({state:t,dispatch:e})=>aR(t,e),yP=(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},bP=()=>({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),u=i.after(s);t.delete(c,u).scrollIntoView()}return!0}return!1},xP=t=>({tr:e,state:n,dispatch:r})=>{const i=dn(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 u=s.before(l),f=s.after(l);e.delete(u,f).scrollIntoView()}return!0}return!1},vP=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},SP=()=>({state:t,dispatch:e})=>B1(t,e),wP=()=>({commands:t})=>t.keyboardShortcut("Enter"),kP=()=>({state:t,dispatch:e})=>LV(t,e);function ap(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:F1(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function gR(t,e,n={}){return t.find(r=>r.type===e&&ap(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function JT(t,e,n={}){return!!gR(t,e,n)}function q1(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(h=>h.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(h=>h.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!gR([...i.node.marks],e,n)))return;let l=i.index,c=t.start()+i.offset,u=l+1,f=c+i.node.nodeSize;for(;l>0&&JT([...t.parent.child(l-1).marks],e,n);)l-=1,c-=t.parent.child(l).nodeSize;for(;u<t.parent.childCount&&JT([...t.parent.child(u).marks],e,n);)f+=t.parent.child(u).nodeSize,u+=1;return{from:c,to:f}}function mo(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 CP=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=mo(t,r.schema),{doc:l,selection:c}=n,{$from:u,from:f,to:h}=c;if(i){const m=q1(u,s,e);if(m&&m.from<=f&&m.to>=h){const g=Oe.create(l,m.from,m.to);n.setSelection(g)}}return!0},EP=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 yR(t){return t instanceof Oe}function Vo(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function bR(t,e=null){if(!e)return null;const n=Ne.atStart(t),r=Ne.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,Vo(0,i,s),Vo(t.content.size,i,s)):Oe.create(t,Vo(e,i,s),Vo(e,i,s))}function XT(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function cp(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function TP(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const AP=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const l=()=>{(cp()||XT())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),TP()&&!cp()&&!XT()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!yR(n.state.selection))return l(),!0;const c=bR(i.doc,t)||n.state.selection,u=n.state.selection.eq(c);return s&&(u||i.setSelection(c),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},MP=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),OP=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),xR=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&&xR(r)}return t};function th(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return xR(n)}function Ju(t,e,n){if(t instanceof Qs||t instanceof ee)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 ee.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),Ju("",e,n)}if(i){if(n.errorOnInvalidContent){let l=!1,c="";const u=new eD({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:f=>(l=!0,c=typeof f=="string"?f:f.outerHTML,null)}]}})});if(n.slice?pu.fromSchema(u).parseSlice(th(t),n.parseOptions):pu.fromSchema(u).parse(th(t),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=pu.fromSchema(e);return n.slice?s.parseSlice(th(t),n.parseOptions).content:s.parse(th(t),n.parseOptions)}return Ju("",e,n)}function _P(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof on||i instanceof cn))return;const s=t.mapping.maps[r];let l=0;s.forEach((c,u,f,h)=>{l===0&&(l=h)}),t.setSelection(Ne.near(t.doc.resolve(l),n))}const DP=t=>!("type"in t),RP=(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 u=C=>{s.emit("contentError",{editor:s,error:C,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},f={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Ju(e,s.schema,{parseOptions:f,errorOnInvalidContent:!0})}catch(C){u(C)}try{c=Ju(e,s.schema,{parseOptions:f,errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:s.options.enableContentCheck})}catch(C){return u(C),!1}let{from:h,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,b=!0;if((DP(c)?c:[c]).forEach(C=>{C.check(),g=g?C.isText&&C.marks.length===0:!1,b=b?C.isBlock:!1}),h===m&&b){const{parent:C}=r.doc.resolve(h);C.isTextblock&&!C.type.spec.code&&!C.childCount&&(h-=1,m+=1)}let k;if(g){if(Array.isArray(e))k=e.map(C=>C.text||"").join("");else if(e instanceof ee){let C="";e.forEach(E=>{E.text&&(C+=E.text)}),k=C}else typeof e=="object"&&e&&e.text?k=e.text:k=e;r.insertText(k,h,m)}else k=c,r.replaceWith(h,m,k);n.updateSelection&&_P(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:h,text:k}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:h,text:k})}return!0},NP=()=>({state:t,dispatch:e})=>RV(t,e),zP=()=>({state:t,dispatch:e})=>NV(t,e),LP=()=>({state:t,dispatch:e})=>tR(t,e),jP=()=>({state:t,dispatch:e})=>sR(t,e),IP=()=>({state:t,dispatch:e,tr:n})=>{try{const r=pm(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},BP=()=>({state:t,dispatch:e,tr:n})=>{try{const r=pm(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},UP=()=>({state:t,dispatch:e})=>_V(t,e),HP=()=>({state:t,dispatch:e})=>DV(t,e);function vR(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function VP(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 u=e[c];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))cp()||vR()?l=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),l&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const PP=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=VP(t).split(/-(?!$)/),l=s.find(f=>!["Alt","Ctrl","Meta","Shift"].includes(f)),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}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",f=>f(n,c))});return u==null||u.steps.forEach(f=>{const h=f.map(r.mapping);h&&i&&r.maybeStep(h)}),!0};function Xu(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,l=e?dn(e,t.schema):null,c=[];t.doc.nodesBetween(r,i,(m,g)=>{if(m.isText)return;const b=Math.max(r,g),v=Math.min(i,g+m.nodeSize);c.push({node:m,from:b,to:v})});const u=i-r,f=c.filter(m=>l?l.name===m.node.type.name:!0).filter(m=>ap(m.node.attrs,n,{strict:!1}));return s?!!f.length:f.reduce((m,g)=>m+g.to-g.from,0)>=u}const $P=(t,e={})=>({state:n,dispatch:r})=>{const i=dn(t,n.schema);return Xu(n,i,e)?zV(n,r):!1},FP=()=>({state:t,dispatch:e})=>cR(t,e),qP=t=>({state:e,dispatch:n})=>{const r=dn(t,e.schema);return KV(r)(e,n)},KP=()=>({state:t,dispatch:e})=>lR(t,e);function Em(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function QT(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 YP=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=Em(typeof t=="string"?t:t.name,r.schema);return c?(c==="node"&&(s=dn(t,r.schema)),c==="mark"&&(l=mo(t,r.schema)),i&&n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(f,h)=>{s&&s===f.type&&n.setNodeMarkup(h,void 0,QT(f.attrs,e)),l&&f.marks.length&&f.marks.forEach(m=>{l===m.type&&n.addMark(h,h+f.nodeSize,l.create(QT(m.attrs,e)))})})}),!0):!1},WP=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),GP=()=>({tr:t,dispatch:e})=>{if(e){const n=new nr(t.doc);t.setSelection(n)}return!0},ZP=()=>({state:t,dispatch:e})=>rR(t,e),JP=()=>({state:t,dispatch:e})=>oR(t,e),XP=()=>({state:t,dispatch:e})=>BV(t,e),QP=()=>({state:t,dispatch:e})=>VV(t,e),e9=()=>({state:t,dispatch:e})=>HV(t,e);function Zb(t,e,n={},r={}){return Ju(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const t9=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:l,commands:c})=>{var u,f;const{doc:h}=s;if(n.preserveWhitespace!=="full"){const m=Zb(t,i.schema,n,{errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck});return l&&s.replaceWith(0,h.content.size,m).setMeta("preventUpdate",!e),!0}return l&&s.setMeta("preventUpdate",!e),c.insertContentAt({from:0,to:h.content.size},t,{parseOptions:n,errorOnInvalidContent:(f=r.errorOnInvalidContent)!==null&&f!==void 0?f:i.options.enableContentCheck})};function SR(t,e){const n=mo(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,u=>{l.push(...u.marks)});const c=l.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function n9(t,e){const n=new T1(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function r9(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 i9(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function wR(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 K1(t){return e=>wR(e.$from,t)}function s9(t,e){const n={from:0,to:t.content.size};return pR(t,n,e)}function o9(t,e){const n=dn(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 kR(t,e){const n=Em(typeof e=="string"?e:e.name,t.schema);return n==="node"?o9(t,e):n==="mark"?SR(t,e):{}}function l9(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 a9(t){const e=l9(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 c9(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const l=[];if(i.ranges.length)i.forEach((c,u)=>{l.push({from:c,to:u})});else{const{from:c,to:u}=n[s];if(c===void 0||u===void 0)return;l.push({from:c,to:u})}l.forEach(({from:c,to:u})=>{const f=e.slice(s).map(c,-1),h=e.slice(s).map(u),m=e.invert().map(f,-1),g=e.invert().map(h);r.push({oldRange:{from:m,to:g},newRange:{from:f,to:h}})})}),a9(r)}function Y1(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),l=q1(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 Eh(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 Jb(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?mo(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>s?s.name===m.type.name:!0).find(m=>ap(m.attrs,n,{strict:!1}));let l=0;const c=[];if(i.forEach(({$from:m,$to:g})=>{const b=m.pos,v=g.pos;t.doc.nodesBetween(b,v,(k,C)=>{if(!k.isText&&!k.marks.length)return;const E=Math.max(b,C),L=Math.min(v,C+k.nodeSize),j=L-E;l+=j,c.push(...k.marks.map(Y=>({mark:Y,from:E,to:L})))})}),l===0)return!1;const u=c.filter(m=>s?s.name===m.mark.type.name:!0).filter(m=>ap(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),f=c.filter(m=>s?m.mark.type!==s&&m.mark.type.excludes(s):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+f:u)>=l}function u9(t,e,n={}){if(!e)return Xu(t,null,n)||Jb(t,null,n);const r=Em(e,t.schema);return r==="node"?Xu(t,e,n):r==="mark"?Jb(t,e,n):!1}function eA(t,e){const{nodeExtensions:n}=wm(e),r=n.find(l=>l.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=Fe(ve(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Tm(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&&(Tm(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function d9(t){return t instanceof Ae}function f9(t,e,n){var r;const{selection:i}=e;let s=null;if(yR(i)&&(s=i.$cursor),s){const c=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(c)||!c.some(u=>u.type.excludes(n))}const{ranges:l}=i;return l.some(({$from:c,$to:u})=>{let f=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(h,m,g)=>{if(f)return!1;if(h.isInline){const b=!g||g.type.allowsMarkType(n),v=!!n.isInSet(h.marks)||!h.marks.some(k=>k.type.excludes(n));f=b&&v}return!f}),f})}const h9=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:l,ranges:c}=s,u=mo(t,r.schema);if(i)if(l){const f=SR(r,u);n.addStoredMark(u.create({...f,...e}))}else c.forEach(f=>{const h=f.$from.pos,m=f.$to.pos;r.doc.nodesBetween(h,m,(g,b)=>{const v=Math.max(b,h),k=Math.min(b+g.nodeSize,m);g.marks.find(E=>E.type===u)?g.marks.forEach(E=>{u===E.type&&n.addMark(v,k,u.create({...E.attrs,...e}))}):n.addMark(v,k,u.create(e))})});return f9(r,n,u)},p9=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),m9=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=dn(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})=>YT(s,{...l,...e})(n)?!0:c.clearNodes()).command(({state:c})=>YT(s,{...l,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},g9=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Vo(t,0,r.content.size),s=Ae.create(r,i);e.setSelection(s)}return!0},y9=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,u=Vo(i,l,c),f=Vo(s,l,c),h=Oe.create(r,u,f);e.setSelection(h)}return!0},b9=t=>({state:e,dispatch:n})=>{const r=dn(t,e.schema);return GV(r)(e,n)};function tA(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 x9=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:l}=e,{$from:c,$to:u}=s,f=i.extensionManager.attributes,h=Eh(f,c.node().type.name,c.node().attrs);if(s instanceof Ae&&s.node.isBlock)return!c.parentOffset||!ls(l,c.pos)?!1:(r&&(t&&tA(n,i.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:r9(c.node(-1).contentMatchAt(c.indexAfter(-1)));let b=m&&g?[{type:g,attrs:h}]:void 0,v=ls(e.doc,e.mapping.map(c.pos),1,b);if(!b&&!v&&ls(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(v=!0,b=g?[{type:g,attrs:h}]:void 0),r){if(v&&(s instanceof Oe&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,b),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const k=e.mapping.map(c.before()),C=e.doc.resolve(k);c.node(-1).canReplaceWith(C.index(),C.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&tA(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return v},v9=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var l;const c=dn(t,r.schema),{$from:u,$to:f}=r.selection,h=r.selection.node;if(h&&h.isBlock||u.depth<2||!u.sameParent(f))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=s.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(i){let E=ee.empty;const L=u.index(-1)?1:u.index(-2)?2:3;for(let te=u.depth-L;te>=u.depth-3;te-=1)E=ee.from(u.node(te).copy(E));const j=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,Y={...Eh(g,u.node().type.name,u.node().attrs),...e},V=((l=c.contentMatch.defaultType)===null||l===void 0?void 0:l.createAndFill(Y))||void 0;E=E.append(ee.from(c.createAndFill(null,V)||void 0));const R=u.before(u.depth-(L-1));n.replace(R,u.after(-j),new fe(E,4-L,0));let B=-1;n.doc.nodesBetween(R,n.doc.content.size,(te,W)=>{if(B>-1)return!1;te.isTextblock&&te.content.size===0&&(B=W+1)}),B>-1&&n.setSelection(Oe.near(n.doc.resolve(B))),n.scrollIntoView()}return!0}const b=f.pos===u.end()?m.contentMatchAt(0).defaultType:null,v={...Eh(g,m.type.name,m.attrs),...e},k={...Eh(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,f.pos);const C=b?[{type:c,attrs:v},{type:b,attrs:k}]:[{type:c,attrs:v}];if(!ls(n.doc,u.pos,2))return!1;if(i){const{selection:E,storedMarks:L}=r,{splittableMarks:j}=s.extensionManager,Y=L||E.$to.parentOffset&&E.$from.marks();if(n.split(u.pos,2,C).scrollIntoView(),!Y||!i)return!0;const V=Y.filter(R=>j.includes(R.type.name));n.ensureMarks(V)}return!0},P0=(t,e)=>{const n=K1(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)&&ho(t.doc,n.pos)&&t.join(n.pos),!0},$0=(t,e)=>{const n=K1(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)&&ho(t.doc,r)&&t.join(r),!0},S9=(t,e,n,r={})=>({editor:i,tr:s,state:l,dispatch:c,chain:u,commands:f,can:h})=>{const{extensions:m,splittableMarks:g}=i.extensionManager,b=dn(t,l.schema),v=dn(e,l.schema),{selection:k,storedMarks:C}=l,{$from:E,$to:L}=k,j=E.blockRange(L),Y=C||k.$to.parentOffset&&k.$from.marks();if(!j)return!1;const V=K1(R=>eA(R.type.name,m))(k);if(j.depth>=1&&V&&j.depth-V.depth<=1){if(V.node.type===b)return f.liftListItem(v);if(eA(V.node.type.name,m)&&b.validContent(V.node.content)&&c)return u().command(()=>(s.setNodeMarkup(V.pos,b),!0)).command(()=>P0(s,b)).command(()=>$0(s,b)).run()}return!n||!Y||!c?u().command(()=>h().wrapInList(b,r)?!0:f.clearNodes()).wrapInList(b,r).command(()=>P0(s,b)).command(()=>$0(s,b)).run():u().command(()=>{const R=h().wrapInList(b,r),B=Y.filter(te=>g.includes(te.type.name));return s.ensureMarks(B),R?!0:f.clearNodes()}).wrapInList(b,r).command(()=>P0(s,b)).command(()=>$0(s,b)).run()},w9=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,l=mo(t,r.schema);return Jb(r,l,e)?i.unsetMark(l,{extendEmptyMarkRange:s}):i.setMark(l,e)},k9=(t,e,n={})=>({state:r,commands:i})=>{const s=dn(t,r.schema),l=dn(e,r.schema),c=Xu(r,s,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?i.setNode(l,u):i.setNode(s,{...u,...n})},C9=(t,e={})=>({state:n,commands:r})=>{const i=dn(t,n.schema);return Xu(n,i,e)?r.lift(i):r.wrapIn(i,e)},E9=()=>({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 u=c.steps.length-1;u>=0;u-=1)l.step(c.steps[u].invert(c.docs[u]));if(s.text){const u=l.doc.resolve(s.from).marks();l.replaceWith(s.from,s.to,t.schema.text(s.text,u))}else l.delete(s.from,s.to)}return!0}}return!1},T9=()=>({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},A9=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:l=!1}=e,{selection:c}=n,u=mo(t,r.schema),{$from:f,empty:h,ranges:m}=c;if(!i)return!0;if(h&&l){let{from:g,to:b}=c;const v=(s=f.marks().find(C=>C.type===u))===null||s===void 0?void 0:s.attrs,k=q1(f,u,v);k&&(g=k.from,b=k.to),n.removeMark(g,b,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},M9=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=Em(typeof t=="string"?t:t.name,r.schema);return c?(c==="node"&&(s=dn(t,r.schema)),c==="mark"&&(l=mo(t,r.schema)),i&&n.selection.ranges.forEach(u=>{const f=u.$from.pos,h=u.$to.pos;let m,g,b,v;n.selection.empty?r.doc.nodesBetween(f,h,(k,C)=>{s&&s===k.type&&(b=Math.max(C,f),v=Math.min(C+k.nodeSize,h),m=C,g=k)}):r.doc.nodesBetween(f,h,(k,C)=>{C<f&&s&&s===k.type&&(b=Math.max(C,f),v=Math.min(C+k.nodeSize,h),m=C,g=k),C>=f&&C<=h&&(s&&s===k.type&&n.setNodeMarkup(C,void 0,{...k.attrs,...e}),l&&k.marks.length&&k.marks.forEach(E=>{if(l===E.type){const L=Math.max(C,f),j=Math.min(C+k.nodeSize,h);n.addMark(L,j,l.create({...E.attrs,...e}))}}))}),g&&(m!==void 0&&n.setNodeMarkup(m,void 0,{...g.attrs,...e}),l&&g.marks.length&&g.marks.forEach(k=>{l===k.type&&n.addMark(b,v,l.create({...k.attrs,...e}))}))}),!0):!1},O9=(t,e={})=>({state:n,dispatch:r})=>{const i=dn(t,n.schema);return PV(i,e)(n,r)},_9=(t,e={})=>({state:n,dispatch:r})=>{const i=dn(t,n.schema);return $V(i,e)(n,r)};var D9=Object.freeze({__proto__:null,blur:fP,clearContent:hP,clearNodes:pP,command:mP,createParagraphNear:gP,cut:yP,deleteCurrentNode:bP,deleteNode:xP,deleteRange:vP,deleteSelection:SP,enter:wP,exitCode:kP,extendMarkRange:CP,first:EP,focus:AP,forEach:MP,insertContent:OP,insertContentAt:RP,joinBackward:LP,joinDown:zP,joinForward:jP,joinItemBackward:IP,joinItemForward:BP,joinTextblockBackward:UP,joinTextblockForward:HP,joinUp:NP,keyboardShortcut:PP,lift:$P,liftEmptyBlock:FP,liftListItem:qP,newlineInCode:KP,resetAttributes:YP,scrollIntoView:WP,selectAll:GP,selectNodeBackward:ZP,selectNodeForward:JP,selectParentNode:XP,selectTextblockEnd:QP,selectTextblockStart:e9,setContent:t9,setMark:h9,setMeta:p9,setNode:m9,setNodeSelection:g9,setTextSelection:y9,sinkListItem:b9,splitBlock:x9,splitListItem:v9,toggleList:S9,toggleMark:w9,toggleNode:k9,toggleWrap:C9,undoInputRule:E9,unsetAllMarks:T9,unsetMark:A9,updateAttributes:M9,wrapIn:O9,wrapInList:_9});const R9=Vt.create({name:"commands",addCommands(){return{...D9}}}),N9=Vt.create({name:"drop",addProseMirrorPlugins(){return[new pt({key:new Tt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),z9=Vt.create({name:"editable",addProseMirrorPlugins(){return[new pt({key:new Tt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),L9=new Tt("focusEvents"),j9=Vt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new pt({key:L9,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}}}})]}}),I9=Vt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:c})=>{const{selection:u,doc:f}=c,{empty:h,$anchor:m}=u,{pos:g,parent:b}=m,v=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,k=v.parent.type.spec.isolating,C=m.pos-m.parentOffset,E=k&&v.parent.childCount===1?C===m.pos:Ne.atStart(f).from===g;return!h||!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 cp()||vR()?s:i},addProseMirrorPlugins(){return[new pt({key:new Tt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(k=>k.getMeta("composition")))return;const r=t.some(k=>k.docChanged)&&!e.doc.eq(n.doc),i=t.some(k=>k.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:l,to:c}=e.selection,u=Ne.atStart(e.doc).from,f=Ne.atEnd(e.doc).to;if(s||!(l===u&&c===f)||!Tm(n.doc))return;const g=n.tr,b=vm({state:n,transaction:g}),{commands:v}=new Sm({editor:this.editor,state:b});if(v.clearNodes(),!!g.steps.length)return g}})]}}),B9=Vt.create({name:"paste",addProseMirrorPlugins(){return[new pt({key:new Tt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),U9=Vt.create({name:"tabindex",addProseMirrorPlugins(){return[new pt({key:new Tt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Bo{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 Bo(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 Bo(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 Bo(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 u=new Bo(c,this.editor,i,i?n:null);i&&(u.actualDepth=this.depth+1),e.push(new Bo(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 u=l[c];if(s[u]!==n[u])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(u=>n[u]===l.node.attrs[u])&&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 H9=`.ProseMirror {
116
+ position: relative;
117
+ }
118
+
119
+ .ProseMirror {
120
+ word-wrap: break-word;
121
+ white-space: pre-wrap;
122
+ white-space: break-spaces;
123
+ -webkit-font-variant-ligatures: none;
124
+ font-variant-ligatures: none;
125
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
126
+ }
127
+
128
+ .ProseMirror [contenteditable="false"] {
129
+ white-space: normal;
130
+ }
131
+
132
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
133
+ white-space: pre-wrap;
134
+ }
135
+
136
+ .ProseMirror pre {
137
+ white-space: pre-wrap;
138
+ }
139
+
140
+ img.ProseMirror-separator {
141
+ display: inline !important;
142
+ border: none !important;
143
+ margin: 0 !important;
144
+ width: 0 !important;
145
+ height: 0 !important;
146
+ }
147
+
148
+ .ProseMirror-gapcursor {
149
+ display: none;
150
+ pointer-events: none;
151
+ position: absolute;
152
+ margin: 0;
153
+ }
154
+
155
+ .ProseMirror-gapcursor:after {
156
+ content: "";
157
+ display: block;
158
+ position: absolute;
159
+ top: -2px;
160
+ width: 20px;
161
+ border-top: 1px solid black;
162
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
163
+ }
164
+
165
+ @keyframes ProseMirror-cursor-blink {
166
+ to {
167
+ visibility: hidden;
168
+ }
169
+ }
170
+
171
+ .ProseMirror-hideselection *::selection {
172
+ background: transparent;
173
+ }
174
+
175
+ .ProseMirror-hideselection *::-moz-selection {
176
+ background: transparent;
177
+ }
178
+
179
+ .ProseMirror-hideselection * {
180
+ caret-color: transparent;
181
+ }
182
+
183
+ .ProseMirror-focused .ProseMirror-gapcursor {
184
+ display: block;
185
+ }
186
+
187
+ .tippy-box[data-animation=fade][data-state=hidden] {
188
+ opacity: 0
189
+ }`;function V9(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 P9=class extends ZV{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=V9(H9,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=hR(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?[z9,dP.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),R9,j9,I9,U9,N9,B9].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 pa(i,this)}createCommandManager(){this.commandManager=new Sm({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=Zb(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=Zb(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=bR(n,this.options.autofocus);this.view=new QD(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:ha.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 kR(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return u9(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return $1(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
190
+
191
+ `,textSerializers:r={}}=e||{};return s9(this.state.doc,{blockSeparator:n,textSerializers:{...mR(this.schema),...r}})}get isEmpty(){return Tm(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 Bo(n,this)}get $doc(){return this.$pos(0)}};function al(t){return new km({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Fe(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 u=c.search(/\S/),f=n.from+c.indexOf(l),h=f+l.length;if(Y1(n.from,n.to,e.doc).filter(b=>b.mark.type.excluded.find(k=>k===t.type&&k!==b.mark.type)).filter(b=>b.to>f).length)return null;h<n.to&&s.delete(h,n.to),f>n.from&&s.delete(n.from+u,f);const g=n.from+u+l.length;s.addMark(n.from+u,g,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function $9(t){return new km({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Fe(t.getAttributes,void 0,r)||{},{tr:s}=e,l=n.from;let c=n.to;const u=t.type.create(i);if(r[1]){const f=r[0].lastIndexOf(r[1]);let h=l+f;h>c?h=c:c=h+r[1].length;const m=r[0][r[0].length-1];s.insertText(m,l+r[0].length-1),s.replaceWith(h,c,u)}else if(r[0]){const f=t.type.isInline?l:l-1;s.insert(f,t.type.create(i)).delete(s.mapping.map(l),s.mapping.map(c))}s.scrollIntoView()}})}function Xb(t){return new km({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=Fe(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 Qu(t){return new km({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=Fe(t.getAttributes,void 0,r)||{},l=e.tr.delete(n.from,n.to),u=l.doc.resolve(n.from).blockRange(),f=u&&E1(u,t.type,s);if(!f)return null;if(l.wrap(u,f),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:b}=t.editor.extensionManager,v=g||m.$to.parentOffset&&m.$from.marks();if(v){const k=v.filter(C=>b.includes(C.type.name));l.ensureMarks(k)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(m,s).run()}const h=l.doc.resolve(n.from-1).nodeBefore;h&&h.type===t.type&&ho(l.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,h))&&l.join(n.from-1)}})}class fn{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=Fe(ve(this,"addOptions",{name:this.name}))),this.storage=Fe(ve(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new fn(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 fn(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=Fe(ve(n,"addOptions",{name:n.name})),n.storage=Fe(ve(n,"addStorage",{name:n.name,options:n.options})),n}}function ao(t){return new sP({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=Fe(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:l}=e,c=r[r.length-1],u=r[0];let f=n.to;if(c){const h=u.search(/\S/),m=n.from+u.indexOf(c),g=m+c.length;if(Y1(n.from,n.to,e.doc).filter(v=>v.mark.type.excluded.find(C=>C===t.type&&C!==v.mark.type)).filter(v=>v.to>m).length)return null;g<n.to&&l.delete(g,n.to),m>n.from&&l.delete(n.from+h,m),f=n.from+h+c.length,l.addMark(n.from+h,f,t.type.create(s||{})),l.removeStoredMark(t.type)}}})}function F9(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Ae){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 q9=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},K9=/[\uD800-\uDBFF]/,Y9=/[\uDC00-\uDFFF]/,W9=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&K9.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&&Y9.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},G9=W9,Mt=new Tt("y-sync"),yi=new Tt("y-undo"),nh=new Tt("yjs-cursor"),bi=(t,e)=>t>>>e|t<<32-e,Z9=t=>bi(t,2)^bi(t,13)^bi(t,22),J9=t=>bi(t,6)^bi(t,11)^bi(t,25),X9=t=>bi(t,7)^bi(t,18)^t>>>3,Q9=t=>bi(t,17)^bi(t,19)^t>>>10,e$=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]),t$=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class n${constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(t$),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let m=16;m<64;m++)n[m]=Q9(n[m-2])+n[m-7]+X9(n[m-15])+n[m-16];let r=e[0],i=e[1],s=e[2],l=e[3],c=e[4],u=e[5],f=e[6],h=e[7];for(let m=0,g,b;m<64;m++)g=h+J9(c)+(c&u^~c&f)+e$[m]+n[m]>>>0,b=Z9(r)+(r&i^r&s^i&s)>>>0,h=f,f=u,u=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]+=u,e[6]+=f,e[7]+=h}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]|=Bn<<(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)]|=Bn<<(3-n%4)*8),this._W[14]=e.byteLength/JI,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 r$=t=>new n$().digest(t),i$=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},s$=t=>XB(i$(r$(e6(t)))),up=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!Ja(e.ds,t.id),o$=[{light:"#ecd44433",dark:"#ecd444"}],l$=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=Xo();t.forEach(i=>r.add(i)),e=e.filter(i=>!r.has(i))}t.set(n,_B(e))}return t.get(n)},a$=(t,{colors:e=o$,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:s}={})=>{let l=!1;const c=new u$(t,s),u=new pt({props:{editable:f=>{const h=Mt.getState(f);return h.snapshot==null&&h.prevSnapshot==null}},key:Mt,state:{init:(f,h)=>({type:t,doc:t.doc,binding:c,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(f,h)=>{const m=f.getMeta(Mt);if(m!==void 0){h=Object.assign({},h);for(const g in m)h[g]=m[g]}return h.addToHistory=f.getMeta("addToHistory")!==!1,h.isChangeOrigin=m!==void 0&&!!m.isChangeOrigin,h.isUndoRedoOperation=m!==void 0&&!!m.isChangeOrigin&&!!m.isUndoRedoOperation,c.prosemirrorView!==null&&m!==void 0&&(m.snapshot!=null||m.prevSnapshot!=null)&&l1(0,()=>{c.prosemirrorView!=null&&(m.restore==null?c._renderSnapshot(m.snapshot,m.prevSnapshot,h):(c._renderSnapshot(m.snapshot,m.snapshot,h),delete h.restore,delete h.snapshot,delete h.prevSnapshot,c.mux(()=>{c._prosemirrorChanged(c.prosemirrorView.state.doc)})))}),h}},view:f=>(c.initView(f),s==null&&c._forceRerender(),i(),{update:()=>{const h=u.getState(f.state);if(h.snapshot==null&&h.prevSnapshot==null&&(l||f.state.doc.content.findDiffStart(f.state.doc.type.createAndFill().content)!==null)){if(l=!0,h.addToHistory===!1&&!h.isChangeOrigin){const m=yi.getState(f.state),g=m&&m.undoManager;g&&g.stopCapturing()}c.mux(()=>{h.doc.transact(m=>{m.meta.set("addToHistory",h.addToHistory),c._prosemirrorChanged(f.state.doc)},Mt)})}},destroy:()=>{c.destroy()}})});return u},c$=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new nr(t.doc));else if(e.type==="node"){const r=Ea(n.doc,n.type,e.anchor,n.mapping);t.setSelection(Ae.create(t.doc,r))}else{const r=Ea(n.doc,n.type,e.anchor,n.mapping),i=Ea(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)}}},Qb=(t,e)=>({type:e.selection.jsonID,anchor:fp(e.selection.anchor,t.type,t.mapping),head:fp(e.selection.head,t.type,t.mapping)});class u${constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=q9(),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=Qb(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()?(vO&&this._domSelectionInView===null&&(l1(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=gd.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=t_(qO(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(Mt,{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 fe(ee.from(e),0,0));n.setMeta(Mt,{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 fe(ee.from(n),0,0));if(e){const i=is(Qr(e.anchor,0),r.doc.content.size),s=is(Qr(e.head,0),r.doc.content.size);r.setSelection(Oe.create(r.doc,i,s))}this.prosemirrorView.dispatch(r.setMeta(Mt,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let i=this.doc,s=this.type;if(e||(e=x0(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&_n(),i=new wi({gc:!1}),$h(i,n),n=x0(i),$h(i,e),e=x0(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=ei(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=>{so(l,m,g=>{})});const u=(m,g)=>{const b=m==="added"?c.getUserByClientId(g.client):c.getUserByDeletedId(g);return{user:b,type:m,color:l$(r.colorMapping,r.colors,b)}},f=f_(s,new f1(n.ds,e.sv)).map(m=>!m._item.deleted||up(m._item,e)||up(m._item,n)?Th(m,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,u):null).filter(m=>m!==null),h=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new fe(ee.from(f),0,0));this.prosemirrorView.dispatch(h.setMeta(Mt,{isChangeOrigin:!0}))},Mt)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=Mt.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,u)=>this.mapping.delete(u);so(n,n.deleteSet,c=>{if(c.constructor===St){const u=c.content.type;u&&this.mapping.delete(u)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const s=this.type.toArray().map(c=>CR(c,this.prosemirrorView.state.schema,this)).filter(c=>c!==null);let l=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new fe(ee.from(s),0,0));c$(l,this.beforeTransactionSelection,this),l=l.setMeta(Mt,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof o_}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&l.scrollIntoView(),this.prosemirrorView.dispatch(l)})}_prosemirrorChanged(e){this.doc.transact(()=>{tx(this.doc,this.type,e,this),this.beforeTransactionSelection=Qb(this,this.prosemirrorView.state)},Mt)}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 CR=(t,e,n,r,i,s)=>{const l=n.mapping.get(t);if(l===void 0){if(t instanceof ln)return Th(t,e,n,r,i,s);throw Hr()}return l},Th=(t,e,n,r,i,s)=>{const l=[],c=u=>{var f,h;if(u instanceof ln){const m=CR(u,e,n,r,i,s);m!==null&&l.push(m)}else{const m=(h=(f=u._item.right)==null?void 0:f.content)==null?void 0:h.type;m instanceof oo&&!m._item.deleted&&m._item.id.client===m.doc.clientID&&(u.applyDelta([{retain:u.length},...m.toDelta()]),m.doc.transact(b=>{m._item.delete(b)}));const g=d$(u,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):f_(t,new f1(i.ds,r.sv)).forEach(c);try{const u=t.getAttributes(r);r!==void 0&&(up(t._item,r)?up(t._item,i)||(u.ychange=s?s("added",t._item.id):{type:"added"}):u.ychange=s?s("removed",t._item.id):{type:"removed"});const f=e.node(t.nodeName,u,l);return n.mapping.set(t,f),f}catch{return t.doc.transact(f=>{t._item.delete(f)},Mt),n.mapping.delete(t),null}},d$=(t,e,n,r,i,s)=>{const l=[],c=t.toDelta(r,i,s);try{for(let u=0;u<c.length;u++){const f=c[u];l.push(e.text(f.insert,y$(f.attributes,e)))}}catch{return t.doc.transact(f=>{t._item.delete(f)},Mt),null}return l},f$=(t,e)=>{const n=new Un,r=t.map(i=>({insert:i.text,attributes:TR(i.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},h$=(t,e)=>{const n=new ln(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,Am(t).map(r=>ex(r,e))),e.mapping.set(n,t),n},ex=(t,e)=>t instanceof Array?f$(t,e):h$(t,e),nA=t=>typeof t=="object"&&t!==null,W1=(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||nA(l)&&nA(c)&&W1(l,c)}return r},Am=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},ER=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,i)=>r.insert===e[i].text&&yO(r.attributes||{}).length===e[i].marks.length&&Wa(r.attributes,(s,l)=>{var f;const c=G1(l),u=e[i].marks;return W1(s,(f=u.find(h=>h.type.name===c))==null?void 0:f.attrs)}))},ed=(t,e)=>{if(t instanceof ln&&!(e instanceof Array)&&nx(t,e)){const n=Am(e);return t._length===n.length&&W1(t.getAttributes(),e.attrs)&&t.toArray().every((r,i)=>ed(r,n[i]))}return t instanceof Un&&e instanceof Array&&ER(t,e)},dp=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),rA=(t,e,n)=>{const r=t.toArray(),i=Am(e),s=i.length,l=r.length,c=is(l,s);let u=0,f=0,h=!1;for(;u<c;u++){const m=r[u],g=i[u];if(dp(n.mapping.get(m),g))h=!0;else if(!ed(m,g))break}for(;u+f<c;f++){const m=r[l-f-1],g=i[s-f-1];if(dp(n.mapping.get(m),g))h=!0;else if(!ed(m,g))break}return{equalityFactor:u+f,foundMappedChild:h}},p$=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof ti?e+=n.content.str:n.content instanceof Wt&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},m$=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:i}=p$(t),s=e.map(f=>({insert:f.text,attributes:Object.assign({},r,TR(f.marks,n))})),{insert:l,remove:c,index:u}=G9(i,s.map(f=>f.insert).join(""));t.delete(u,c),t.insert(u,l),t.applyDelta(s.map(f=>({retain:f.insert.length,attributes:f.attributes})))},g$=/(.*)(--[a-zA-Z0-9+/=]{8})$/,G1=t=>{var e;return((e=g$.exec(t))==null?void 0:e[1])??t},y$=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(G1(r),t[r]));return n},TR=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const i=Ti(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[i?`${r.type.name}--${s$(r.toJSON())}`:r.type.name]=r.attrs}}),n},tx=(t,e,n,r)=>{if(e instanceof ln&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof ln){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=Am(n),s=i.length,l=e.toArray(),c=l.length,u=is(s,c);let f=0,h=0;for(;f<u;f++){const m=l[f],g=i[f];if(!dp(r.mapping.get(m),g))if(ed(m,g))r.mapping.set(m,g);else break}for(;h+f<u;h++){const m=l[c-h-1],g=i[s-h-1];if(!dp(r.mapping.get(m),g))if(ed(m,g))r.mapping.set(m,g);else break}t.transact(()=>{for(;c-f-h>0&&s-f-h>0;){const g=l[f],b=i[f],v=l[c-h-1],k=i[s-h-1];if(g instanceof Un&&b instanceof Array)ER(g,b)||m$(g,b,r),f+=1;else{let C=g instanceof ln&&nx(g,b),E=v instanceof ln&&nx(v,k);if(C&&E){const L=rA(g,b,r),j=rA(v,k,r);L.foundMappedChild&&!j.foundMappedChild?E=!1:!L.foundMappedChild&&j.foundMappedChild||L.equalityFactor<j.equalityFactor?C=!1:E=!1}C?(tx(t,g,b,r),f+=1):E?(tx(t,v,k,r),h+=1):(r.mapping.delete(e.get(f)),e.delete(f,1),e.insert(f,[ex(b,r)]),f+=1)}}const m=c-f-h;if(c===1&&s===0&&l[0]instanceof Un?(r.mapping.delete(l[0]),l[0].delete(0,l[0].length)):m>0&&(e.slice(f,f+m).forEach(g=>r.mapping.delete(g)),e.delete(f,m)),f+h<s){const g=[];for(let b=f;b<s-h;b++)g.push(ex(i[b],r));e.insert(f,g)}},Mt)},nx=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let bu=null;const b$=()=>{const t=bu;bu=null,t.forEach((e,n)=>{const r=n.state.tr,i=Mt.getState(n.state);i&&i.binding&&!i.binding.isDestroyed&&(e.forEach((s,l)=>{r.setMeta(l,s)}),n.dispatch(r))})},x$=(t,e,n)=>{bu||(bu=new Map,l1(0,b$)),Ti(bu,t,Ur).set(e,n)},fp=(t,e,n)=>{if(t===0)return b0(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 Un){if(r._length>=t)return b0(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 Uu(r._item===null?null:r._item.id,r._item===null?Iu(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 Uu(r._item===null?null:r._item.id,r._item===null?Iu(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 _n();if(t===0&&r.constructor!==Un&&r!==e)return v$(r._item.parent,r._item)}return b0(e,e._length,e.length===0?-1:0)},v$=(t,e)=>{let n=null,r=null;return t._item===null?r=Iu(t):n=Be(t._item.id.client,t._item.id.clock),new Uu(n,r,e.id)},Ea=(t,e,n,r)=>{const i=Tb(n,t);if(i===null||i.type!==e&&!Bu(e,i.type._item))return null;let s=i.type,l=0;if(s.constructor===Un)l=i.index;else if(s._item===null||!s._item.deleted){let c=s._first,u=0;for(;u<s._length&&u<i.index&&c!==null;){if(!c.deleted){const f=c.content.type;u++,f instanceof Un?l+=f._length:l+=r.get(f).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 u=c._first;for(;u!==null;){const f=u.content.type;if(f===s)break;u.deleted||(f instanceof Un?l+=f._length:l+=r.get(f).nodeSize),u=u.right}}s=c}return l-1};function S$(t){const e=t.toArray(),n=r=>{let i;if(r instanceof Un)i=r.toDelta().map(l=>{const c={type:"text",text:l.insert};return l.attributes&&(c.marks=Object.keys(l.attributes).map(u=>{const f=l.attributes[u],m={type:G1(u)};return Object.keys(f)&&(m.attrs=f),m})),c});else if(r instanceof ln){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 _n();return i};return{type:"doc",content:e.map(n)}}const w$=(t,e,n)=>t!==e,k$=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},AR=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),C$=/^#[0-9a-fA-F]{6}$/,iA=(t,e,n,r,i)=>{const s=Mt.getState(t),l=s.doc,c=[];return s.snapshot!=null||s.prevSnapshot!=null||s.binding.mapping.size===0?it.create(t.doc,[]):(e.getStates().forEach((u,f)=>{if(n(l.clientID,f,u)&&u.cursor!=null){const h=u.user||{};h.color==null?h.color="#ffa500":C$.test(h.color)||console.warn("A user uses an unsupported color format",h),h.name==null&&(h.name=`User: ${f}`);let m=Ea(l,s.type,qo(u.cursor.anchor),s.binding.mapping),g=Ea(l,s.type,qo(u.cursor.head),s.binding.mapping);if(m!==null&&g!==null){const b=Qr(t.doc.content.size-1,0);m=is(m,b),g=is(g,b),c.push(zt.widget(g,()=>r(h,f),{key:f+"",side:10}));const v=is(m,g),k=Qr(m,g);c.push(zt.inline(v,k,i(h,f),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),it.create(t.doc,c))},E$=(t,{awarenessStateFilter:e=w$,cursorBuilder:n=k$,selectionBuilder:r=AR,getSelection:i=l=>l.selection}={},s="cursor")=>new pt({key:nh,state:{init(l,c){return iA(c,t,e,n,r)},apply(l,c,u,f){const h=Mt.getState(f),m=l.getMeta(nh);return h&&h.isChangeOrigin||m&&m.awarenessUpdated?iA(f,t,e,n,r):c.map(l.mapping,l.doc)}},props:{decorations:l=>nh.getState(l)},view:l=>{const c=()=>{l.docView&&x$(l,nh,{awarenessUpdated:!0})},u=()=>{const f=Mt.getState(l.state),h=t.getLocalState()||{};if(l.hasFocus()){const m=i(l.state),g=fp(m.anchor,f.type,f.binding.mapping),b=fp(m.head,f.type,f.binding.mapping);(h.cursor==null||!NE(qo(h.cursor.anchor),g)||!NE(qo(h.cursor.head),b))&&t.setLocalStateField(s,{anchor:g,head:b})}else h.cursor!=null&&Ea(f.doc,f.type,qo(h.cursor.anchor),f.binding.mapping)!==null&&t.setLocalStateField(s,null)};return t.on("change",c),l.dom.addEventListener("focusin",u),l.dom.addEventListener("focusout",u),{update:u,destroy:()=>{l.dom.removeEventListener("focusin",u),l.dom.removeEventListener("focusout",u),t.off("change",c),t.setLocalStateField(s,null)}}}}),T$=t=>{var e,n;return((n=(e=yi.getState(t))==null?void 0:e.undoManager)==null?void 0:n.undo())!=null},A$=t=>{var e,n;return((n=(e=yi.getState(t))==null?void 0:e.undoManager)==null?void 0:n.redo())!=null},M$=new Set(["paragraph"]),O$=(t,e)=>!(t instanceof St)||!(t.content instanceof ni)||!(t.content.type instanceof oo||t.content.type instanceof ln&&e.has(t.content.type.nodeName))||t.content.type._length===0,_$=({protectedNodes:t=M$,trackedOrigins:e=[],undoManager:n=null}={})=>new pt({key:yi,state:{init:(r,i)=>{const s=Mt.getState(i),l=n||new o_(s.type,{trackedOrigins:new Set([Mt].concat(e)),deleteFilter:c=>O$(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=Mt.getState(l).binding,u=i.undoManager,f=u.undoStack.length>0,h=u.redoStack.length>0;return c?{undoManager:u,prevSel:Qb(c,s),hasUndoOps:f,hasRedoOps:h}:f!==i.hasUndoOps||h!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:u.undoStack.length>0,hasRedoOps:u.redoStack.length>0}):i}},view:r=>{const i=Mt.getState(r.state),s=yi.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:l})=>{const c=i.binding;c&&l.meta.set(c,yi.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()}}}}),D$=Vt.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),yi.getState(e).undoManager.undoStack.length===0?!1:n?T$(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),yi.getState(e).undoManager.redoStack.length===0?!1:n?A$(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=_$(this.options.yUndoOptions),r=n.spec.view;n.spec.view=l=>{const{undoManager:c}=yi.getState(l.state);c.restore&&(c.restore(),c.restore=()=>{});const u=r?r(l):void 0;return{destroy:()=>{const f=c.trackedOrigins.has(c),h=c._observers;c.restore=()=>{f&&c.trackedOrigins.add(c),c.doc.on("afterTransaction",c.afterTransactionHandler),c._observers=h},u!=null&&u.destroy&&u.destroy()}}};const i={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},s=a$(e,i);return this.editor.options.enableContentCheck&&((t=e.doc)===null||t===void 0||t.on("beforeTransaction",()=>{try{const l=S$(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 pt({key:new Tt("filterInvalidContent"),filterTransaction:()=>{var l;return this.storage.isDisabled&&((l=e.doc)===null||l===void 0||l.destroy()),!0}})].filter(Boolean)}}),sA=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n.user})),oA=()=>null,R$=Vt.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:AR,onUpdate:oA}},onCreate(){if(this.options.onUpdate!==oA&&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[E$((this.options.provider.awareness.setLocalStateField("user",this.options.user),this.storage.users=sA(this.options.provider.awareness.states),this.options.provider.awareness.on("update",()=>{this.storage.users=sA(this.options.provider.awareness.states)}),this.options.provider.awareness),{cursorBuilder:this.options.render,selectionBuilder:this.options.selectionRender})]}}),N$=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,z$=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,L$=Ei.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",Lt(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[al({find:N$,type:this.type})]},addPasteRules(){return[ao({find:z$,type:this.type})]}}),j$="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",I$="ελ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",rx="numeric",ix="ascii",sx="alpha",xu="asciinumeric",lu="alphanumeric",ox="domain",MR="emoji",B$="scheme",U$="slashscheme",F0="whitespace";function H$(t,e){return t in e||(e[t]=[]),e[t]}function Po(t,e,n){e[rx]&&(e[xu]=!0,e[lu]=!0),e[ix]&&(e[xu]=!0,e[sx]=!0),e[xu]&&(e[lu]=!0),e[sx]&&(e[lu]=!0),e[lu]&&(e[ox]=!0),e[MR]&&(e[ox]=!0);for(const r in e){const i=H$(r,n);i.indexOf(t)<0&&i.push(t)}}function V$(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Qn(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Qn.groups={};Qn.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||Qn.groups;let i;return e&&e.j?i=e:(i=new Qn(e),n&&r&&Po(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||Qn.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 Qn,Object.assign(l.j,c.j),l.jr.push.apply(l.jr,c.jr),l.jd=c.jd,l.t=c.t):l=new Qn,s){if(r)if(l.t&&typeof l.t=="string"){const u=Object.assign(V$(l.t,r),n);Po(s,u,r)}else n&&Po(s,n,r);l.t=s}return i.j[t]=l,l}};const $e=(t,e,n,r,i)=>t.ta(e,n,r,i),Dt=(t,e,n,r,i)=>t.tr(e,n,r,i),lA=(t,e,n,r,i)=>t.ts(e,n,r,i),le=(t,e,n,r,i)=>t.tt(e,n,r,i),Qi="WORD",lx="UWORD",OR="ASCIINUMERICAL",_R="ALPHANUMERICAL",td="LOCALHOST",ax="TLD",cx="UTLD",Ah="SCHEME",ca="SLASH_SCHEME",Z1="NUM",ux="WS",J1="NL",vu="OPENBRACE",Su="CLOSEBRACE",hp="OPENBRACKET",pp="CLOSEBRACKET",mp="OPENPAREN",gp="CLOSEPAREN",yp="OPENANGLEBRACKET",bp="CLOSEANGLEBRACKET",xp="FULLWIDTHLEFTPAREN",vp="FULLWIDTHRIGHTPAREN",Sp="LEFTCORNERBRACKET",wp="RIGHTCORNERBRACKET",kp="LEFTWHITECORNERBRACKET",Cp="RIGHTWHITECORNERBRACKET",Ep="FULLWIDTHLESSTHAN",Tp="FULLWIDTHGREATERTHAN",Ap="AMPERSAND",Mp="APOSTROPHE",Op="ASTERISK",Ps="AT",_p="BACKSLASH",Dp="BACKTICK",Rp="CARET",Ys="COLON",X1="COMMA",Np="DOLLAR",fi="DOT",zp="EQUALS",Q1="EXCLAMATION",Nr="HYPHEN",wu="PERCENT",Lp="PIPE",jp="PLUS",Ip="POUND",ku="QUERY",ev="QUOTE",DR="FULLWIDTHMIDDLEDOT",tv="SEMI",hi="SLASH",Cu="TILDE",Bp="UNDERSCORE",RR="EMOJI",Up="SYM";var NR=Object.freeze({__proto__:null,ALPHANUMERICAL:_R,AMPERSAND:Ap,APOSTROPHE:Mp,ASCIINUMERICAL:OR,ASTERISK:Op,AT:Ps,BACKSLASH:_p,BACKTICK:Dp,CARET:Rp,CLOSEANGLEBRACKET:bp,CLOSEBRACE:Su,CLOSEBRACKET:pp,CLOSEPAREN:gp,COLON:Ys,COMMA:X1,DOLLAR:Np,DOT:fi,EMOJI:RR,EQUALS:zp,EXCLAMATION:Q1,FULLWIDTHGREATERTHAN:Tp,FULLWIDTHLEFTPAREN:xp,FULLWIDTHLESSTHAN:Ep,FULLWIDTHMIDDLEDOT:DR,FULLWIDTHRIGHTPAREN:vp,HYPHEN:Nr,LEFTCORNERBRACKET:Sp,LEFTWHITECORNERBRACKET:kp,LOCALHOST:td,NL:J1,NUM:Z1,OPENANGLEBRACKET:yp,OPENBRACE:vu,OPENBRACKET:hp,OPENPAREN:mp,PERCENT:wu,PIPE:Lp,PLUS:jp,POUND:Ip,QUERY:ku,QUOTE:ev,RIGHTCORNERBRACKET:wp,RIGHTWHITECORNERBRACKET:Cp,SCHEME:Ah,SEMI:tv,SLASH:hi,SLASH_SCHEME:ca,SYM:Up,TILDE:Cu,TLD:ax,UNDERSCORE:Bp,UTLD:cx,UWORD:lx,WORD:Qi,WS:ux});const Ji=/[a-z]/,nu=new RegExp("\\p{L}","u"),q0=new RegExp("\\p{Emoji}","u"),Xi=/\d/,K0=/\s/,aA="\r",Y0=`
192
+ `,P$="️",$$="‍",W0="";let rh=null,ih=null;function F$(t=[]){const e={};Qn.groups=e;const n=new Qn;rh==null&&(rh=cA(j$)),ih==null&&(ih=cA(I$)),le(n,"'",Mp),le(n,"{",vu),le(n,"}",Su),le(n,"[",hp),le(n,"]",pp),le(n,"(",mp),le(n,")",gp),le(n,"<",yp),le(n,">",bp),le(n,"(",xp),le(n,")",vp),le(n,"「",Sp),le(n,"」",wp),le(n,"『",kp),le(n,"』",Cp),le(n,"<",Ep),le(n,">",Tp),le(n,"&",Ap),le(n,"*",Op),le(n,"@",Ps),le(n,"`",Dp),le(n,"^",Rp),le(n,":",Ys),le(n,",",X1),le(n,"$",Np),le(n,".",fi),le(n,"=",zp),le(n,"!",Q1),le(n,"-",Nr),le(n,"%",wu),le(n,"|",Lp),le(n,"+",jp),le(n,"#",Ip),le(n,"?",ku),le(n,'"',ev),le(n,"/",hi),le(n,";",tv),le(n,"~",Cu),le(n,"_",Bp),le(n,"\\",_p),le(n,"・",DR);const r=Dt(n,Xi,Z1,{[rx]:!0});Dt(r,Xi,r);const i=Dt(r,Ji,OR,{[xu]:!0}),s=Dt(r,nu,_R,{[lu]:!0}),l=Dt(n,Ji,Qi,{[ix]:!0});Dt(l,Xi,i),Dt(l,Ji,l),Dt(i,Xi,i),Dt(i,Ji,i);const c=Dt(n,nu,lx,{[sx]:!0});Dt(c,Ji),Dt(c,Xi,s),Dt(c,nu,c),Dt(s,Xi,s),Dt(s,Ji),Dt(s,nu,s);const u=le(n,Y0,J1,{[F0]:!0}),f=le(n,aA,ux,{[F0]:!0}),h=Dt(n,K0,ux,{[F0]:!0});le(n,W0,h),le(f,Y0,u),le(f,W0,h),Dt(f,K0,h),le(h,aA),le(h,Y0),Dt(h,K0,h),le(h,W0,h);const m=Dt(n,q0,RR,{[MR]:!0});le(m,"#"),Dt(m,q0,m),le(m,P$,m);const g=le(m,$$);le(g,"#"),Dt(g,q0,m);const b=[[Ji,l],[Xi,i]],v=[[Ji,null],[nu,c],[Xi,s]];for(let k=0;k<rh.length;k++)Us(n,rh[k],ax,Qi,b);for(let k=0;k<ih.length;k++)Us(n,ih[k],cx,lx,v);Po(ax,{tld:!0,ascii:!0},e),Po(cx,{utld:!0,alpha:!0},e),Us(n,"file",Ah,Qi,b),Us(n,"mailto",Ah,Qi,b),Us(n,"http",ca,Qi,b),Us(n,"https",ca,Qi,b),Us(n,"ftp",ca,Qi,b),Us(n,"ftps",ca,Qi,b),Po(Ah,{scheme:!0,ascii:!0},e),Po(ca,{slashscheme:!0,ascii:!0},e),t=t.sort((k,C)=>k[0]>C[0]?1:-1);for(let k=0;k<t.length;k++){const C=t[k][0],L=t[k][1]?{[B$]:!0}:{[U$]:!0};C.indexOf("-")>=0?L[ox]=!0:Ji.test(C)?Xi.test(C)?L[xu]=!0:L[ix]=!0:L[rx]=!0,lA(n,C,C,L)}return lA(n,"localhost",td,{ascii:!0}),n.jd=new Qn(Up),{start:n,tokens:Object.assign({groups:e},NR)}}function zR(t,e){const n=q$(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,i=[];let s=0,l=0;for(;l<r;){let c=t,u=null,f=0,h=null,m=-1,g=-1;for(;l<r&&(u=c.go(n[l]));)c=u,c.accepts()?(m=0,g=0,h=c):m>=0&&(m+=n[l].length,g++),f+=n[l].length,s+=n[l].length,l++;s-=m,l-=g,f-=m,i.push({t:h.t,v:e.slice(s-f,s),s:s-f,e:s})}return i}function q$(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 Us(t,e,n,r,i){let s;const l=e.length;for(let c=0;c<l-1;c++){const u=e[c];t.j[u]?s=t.j[u]:(s=new Qn(r),s.jr=i.slice(),t.j[u]=s),t=s}return s=new Qn(n),s.jr=i.slice(),t.j[e[l-1]]=s,s}function cA(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 nd={defaultProtocol:"http",events:null,format:uA,formatHref:uA,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function nv(t,e=null){let n=Object.assign({},nd);t&&(n=Object.assign(n,t instanceof nv?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}nv.prototype={o:nd,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]:nd[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 uA(t){return t}function LR(t,e){this.t="token",this.v=t,this.tk=e}LR.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=nd.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),u=t.get("target",n,e),f=t.get("rel",n,e),h=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return l.href=r,c&&(l.class=c),u&&(l.target=u),f&&(l.rel=f),h&&Object.assign(l,h),{tagName:i,attributes:l,content:s,eventListeners:m}}};function Mm(t,e){class n extends LR{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 dA=Mm("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),fA=Mm("text"),K$=Mm("nl"),sh=Mm("url",{isLink:!0,toHref(t=nd.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==td&&t[1].t===Ys}}),Dr=t=>new Qn(t);function Y$({groups:t}){const e=t.domain.concat([Ap,Op,Ps,_p,Dp,Rp,Np,zp,Nr,Z1,wu,Lp,jp,Ip,hi,Up,Cu,Bp]),n=[Mp,Ys,X1,fi,Q1,wu,ku,ev,tv,yp,bp,vu,Su,pp,hp,mp,gp,xp,vp,Sp,wp,kp,Cp,Ep,Tp],r=[Ap,Mp,Op,_p,Dp,Rp,Np,zp,Nr,vu,Su,wu,Lp,jp,Ip,ku,hi,Up,Cu,Bp],i=Dr(),s=le(i,Cu);$e(s,r,s),$e(s,t.domain,s);const l=Dr(),c=Dr(),u=Dr();$e(i,t.domain,l),$e(i,t.scheme,c),$e(i,t.slashscheme,u),$e(l,r,s),$e(l,t.domain,l);const f=le(l,Ps);le(s,Ps,f),le(c,Ps,f),le(u,Ps,f);const h=le(s,fi);$e(h,r,s),$e(h,t.domain,s);const m=Dr();$e(f,t.domain,m),$e(m,t.domain,m);const g=le(m,fi);$e(g,t.domain,m);const b=Dr(dA);$e(g,t.tld,b),$e(g,t.utld,b),le(f,td,b);const v=le(m,Nr);le(v,Nr,v),$e(v,t.domain,m),$e(b,t.domain,m),le(b,fi,g),le(b,Nr,v);const k=le(b,Ys);$e(k,t.numeric,dA);const C=le(l,Nr),E=le(l,fi);le(C,Nr,C),$e(C,t.domain,l),$e(E,r,s),$e(E,t.domain,l);const L=Dr(sh);$e(E,t.tld,L),$e(E,t.utld,L),$e(L,t.domain,l),$e(L,r,s),le(L,fi,E),le(L,Nr,C),le(L,Ps,f);const j=le(L,Ys),Y=Dr(sh);$e(j,t.numeric,Y);const V=Dr(sh),R=Dr();$e(V,e,V),$e(V,n,R),$e(R,e,V),$e(R,n,R),le(L,hi,V),le(Y,hi,V);const B=le(c,Ys),te=le(u,Ys),W=le(te,hi),oe=le(W,hi);$e(c,t.domain,l),le(c,fi,E),le(c,Nr,C),$e(u,t.domain,l),le(u,fi,E),le(u,Nr,C),$e(B,t.domain,V),le(B,hi,V),le(B,ku,V),$e(oe,t.domain,V),$e(oe,e,V),le(oe,hi,V);const re=[[vu,Su],[hp,pp],[mp,gp],[yp,bp],[xp,vp],[Sp,wp],[kp,Cp],[Ep,Tp]];for(let ie=0;ie<re.length;ie++){const[ye,ae]=re[ie],H=le(V,ye);le(R,ye,H),le(H,ae,V);const N=Dr(sh);$e(H,e,N);const K=Dr();$e(H,n),$e(N,e,N),$e(N,n,K),$e(K,e,N),$e(K,n,K),le(N,ae,V),le(K,ae,V)}return le(i,td,L),le(i,J1,K$),{start:i,tokens:NR}}function W$(t,e,n){let r=n.length,i=0,s=[],l=[];for(;i<r;){let c=t,u=null,f=null,h=0,m=null,g=-1;for(;i<r&&!(u=c.go(n[i].t));)l.push(n[i++]);for(;i<r&&(f=u||c.go(n[i].t));)u=null,c=f,c.accepts()?(g=0,m=c):g>=0&&g++,i++,h++;if(g<0)i-=h,i<r&&(l.push(n[i]),i++);else{l.length>0&&(s.push(G0(fA,e,l)),l=[]),i-=g,h-=g;const b=m.t,v=n.slice(i-h,i);s.push(G0(b,e,v))}}return l.length>0&&s.push(G0(fA,e,l)),s}function G0(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 G$=typeof console<"u"&&console&&console.warn||(()=>{}),Z$="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Et={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function J$(){return Qn.groups={},Et.scanner=null,Et.parser=null,Et.tokenQueue=[],Et.pluginQueue=[],Et.customSchemes=[],Et.initialized=!1,Et}function hA(t,e=!1){if(Et.initialized&&G$(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Z$}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
193
+ 1. Must only contain digits, lowercase ASCII letters or "-"
194
+ 2. Cannot start or end with "-"
195
+ 3. "-" cannot repeat`);Et.customSchemes.push([t,e])}function X$(){Et.scanner=F$(Et.customSchemes);for(let t=0;t<Et.tokenQueue.length;t++)Et.tokenQueue[t][1]({scanner:Et.scanner});Et.parser=Y$(Et.scanner.tokens);for(let t=0;t<Et.pluginQueue.length;t++)Et.pluginQueue[t][1]({scanner:Et.scanner,parser:Et.parser});return Et.initialized=!0,Et}function rv(t){return Et.initialized||X$(),W$(Et.parser.start,t,zR(Et.scanner.start,t))}rv.scan=zR;function jR(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 nv(n),i=rv(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 iv="[\0-   ᠎ -\u2029  ]",Q$=new RegExp(iv),eF=new RegExp(`${iv}$`),tF=new RegExp(iv,"g");function nF(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function rF(t){return new pt({key:new Tt("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(f=>f.docChanged)&&!n.doc.eq(r.doc),s=e.some(f=>f.getMeta("preventAutolink"));if(!i||s)return;const{tr:l}=r,c=n9(n.doc,[...e]);if(c9(c).forEach(({newRange:f})=>{const h=i9(r.doc,f,b=>b.isTextblock);let m,g;if(h.length>1)m=h[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(h.length){const b=r.doc.textBetween(f.from,f.to," "," ");if(!eF.test(b))return;m=h[0],g=r.doc.textBetween(m.pos,f.to,void 0," ")}if(m&&g){const b=g.split(Q$).filter(Boolean);if(b.length<=0)return!1;const v=b[b.length-1],k=m.pos+g.lastIndexOf(v);if(!v)return!1;const C=rv(v).map(E=>E.toObject(t.defaultProtocol));if(!nF(C))return!1;C.filter(E=>E.isLink).map(E=>({...E,from:k+E.start+1,to:k+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=>{Y1(E.from,E.to,r.doc).some(L=>L.mark.type===t.type)||l.addMark(E.from,E.to,t.type.create({href:E.href}))})}}),!!l.steps.length)return l}})}function iF(t){return new pt({key:new Tt("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 u=kR(e.state,t.type.name),f=r.target,h=(i=f==null?void 0:f.href)!==null&&i!==void 0?i:u.href,m=(s=f==null?void 0:f.target)!==null&&s!==void 0?s:u.target;return f&&h?(window.open(h,m),!0):!1}}})}function sF(t){return new pt({key:new Tt("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(f=>{c+=f.textContent});const u=jR(c,{defaultProtocol:t.defaultProtocol}).find(f=>f.isLink&&f.value===c);return!c||!u?!1:t.editor.commands.setMark(t.type,{href:u.href})}}})}function Lo(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(tF,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const oF=Ei.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"){hA(t);return}hA(t.scheme,t.optionalSlashes)})},onDestroy(){J$()},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)=>!!Lo(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=>!!Lo(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=>!!Lo(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Lt(this.options.HTMLAttributes,t),0]:["a",Lt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Lo(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=>!!Lo(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[ao({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=jR(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!Lo(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(rF({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Lo(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(iF({type:this.type})),this.options.linkOnPaste&&t.push(sF({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),lF=Vt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new pt({key:new Tt("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 u=r>=c&&r<=c+l.nodeSize,f=!l.isLeaf&&Tm(l);if((u||!this.options.showOnlyCurrent)&&f){const h=[this.options.emptyNodeClass];s&&h.push(this.options.emptyEditorClass);const m=zt.node(c,c+l.nodeSize,{class:h.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:c,hasAnchor:u}):this.options.placeholder});i.push(m)}return this.options.includeChildren}),it.create(t,i)}}})]}});let dx,fx;if(typeof WeakMap<"u"){let t=new WeakMap;dx=e=>t.get(e),fx=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;dx=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},fx=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Nt=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:u,bottom:f}=this.findCell(e);return{left:Math.min(n,l),top:Math.min(i,u),right:Math.max(r,c),bottom:Math.max(s,f)}}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 dx(t)||fx(t,aF(t))}};function aF(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=cF(t),n=t.childCount,r=[];let i=0,s=null;const l=[];for(let f=0,h=e*n;f<h;f++)r[f]=0;for(let f=0,h=0;f<n;f++){const m=t.child(f);h++;for(let v=0;;v++){for(;i<r.length&&r[i]!=0;)i++;if(v==m.childCount)break;const k=m.child(v),{colspan:C,rowspan:E,colwidth:L}=k.attrs;for(let j=0;j<E;j++){if(j+f>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:h,n:E-j});break}const Y=i+j*e;for(let V=0;V<C;V++){r[Y+V]==0?r[Y+V]=h:(s||(s=[])).push({type:"collision",row:f,pos:h,n:C-V});const R=L&&L[V];if(R){const B=(Y+V)%e*2,te=l[B];te==null||te!=R&&l[B+1]==1?(l[B]=R,l[B+1]=1):te==R&&l[B+1]++}}}i+=C,h+=k.nodeSize}const g=(f+1)*e;let b=0;for(;i<g;)r[i++]==0&&b++;b&&(s||(s=[])).push({type:"missing",row:f,n:b}),h++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const c=new Nt(e,n,r,s);let u=!1;for(let f=0;!u&&f<l.length;f+=2)l[f]!=null&&l[f+1]<n&&(u=!0);return u&&uF(c,l,t),c}function cF(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 u=0;u<c.childCount;u++){const f=c.child(u);l+f.attrs.rowspan>r&&(s+=f.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 uF(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 u=l.attrs;for(let f=0;f<u.colspan;f++){const h=e[(i+f)%t.width*2];h!=null&&(!u.colwidth||u.colwidth[f]!=h)&&((c||(c=dF(u)))[f]=h)}c&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:c})}}function dF(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Rn(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 Ws=new Tt("selectingCells");function cl(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 fF(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 ri(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 Om(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=cl(e.$head)||hF(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function hF(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 hx(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function pF(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function sv(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function IR(t,e,n){const r=t.node(-1),i=Nt.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 ul(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 BR(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 mF(t,e,n){const r=Rn(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 wt=class es extends Ne{constructor(e,n=e){const r=e.node(-1),i=Nt.get(r),s=e.start(-1),l=i.rectBetween(e.pos-s,n.pos-s),c=e.node(0),u=i.cellsInRect(l).filter(h=>h!=n.pos-s);u.unshift(n.pos-s);const f=u.map(h=>{const m=r.nodeAt(h);if(!m)throw new RangeError(`No cell with offset ${h} found`);const g=s+h+1;return new gD(c.resolve(g),c.resolve(g+m.content.size))});super(f[0].$from,f[0].$to,f),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(hx(r)&&hx(i)&&sv(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?es.rowSelection(r,i):s&&this.isColSelection()?es.colSelection(r,i):new es(r,i)}return Oe.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Nt.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},l=[];for(let u=i.top;u<i.bottom;u++){const f=[];for(let h=u*n.width+i.left,m=i.left;m<i.right;m++,h++){const g=n.map[h];if(s[g])continue;s[g]=!0;const b=n.findCell(g);let v=e.nodeAt(g);if(!v)throw new RangeError(`No cell with offset ${g} found`);const k=i.left-b.left,C=b.right-i.right;if(k>0||C>0){let E=v.attrs;if(k>0&&(E=ul(E,0,k)),C>0&&(E=ul(E,E.colspan-C,C)),b.left<i.left){if(v=v.type.createAndFill(E),!v)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(E)}`)}else v=v.type.create(E,v.content)}if(b.top<i.top||b.bottom>i.bottom){const E={...v.attrs,rowspan:Math.min(b.bottom,i.bottom)-Math.max(b.top,i.top)};b.top<i.top?v=v.type.createAndFill(E):v=v.type.create(E,v.content)}f.push(v)}l.push(e.child(u).copy(ee.from(f)))}const c=this.isColSelection()&&this.isRowSelection()?e:l;return new fe(ee.from(c),1,1)}replace(e,n=fe.empty){const r=e.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){const{$from:c,$to:u}=i[l],f=e.mapping.slice(r);e.replace(f.map(c.pos),f.map(u.pos),l?fe.empty:n)}const s=Ne.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new fe(ee.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Nt.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=Nt.get(r),s=e.start(-1),l=i.findCell(e.pos-s),c=i.findCell(n.pos-s),u=e.node(0);return l.top<=c.top?(l.top>0&&(e=u.resolve(s+i.map[l.left])),c.bottom<i.height&&(n=u.resolve(s+i.map[i.width*(i.height-1)+c.right-1]))):(c.top>0&&(n=u.resolve(s+i.map[c.left])),l.bottom<i.height&&(e=u.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))),new es(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Nt.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 es&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Nt.get(r),s=e.start(-1),l=i.findCell(e.pos-s),c=i.findCell(n.pos-s),u=e.node(0);return l.left<=c.left?(l.left>0&&(e=u.resolve(s+i.map[l.top*i.width])),c.right<i.width&&(n=u.resolve(s+i.map[i.width*(c.top+1)-1]))):(c.left>0&&(n=u.resolve(s+i.map[c.top*i.width])),l.right<i.width&&(e=u.resolve(s+i.map[i.width*(l.top+1)-1]))),new es(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new es(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new es(e.resolve(n),e.resolve(r))}getBookmark(){return new gF(this.$anchorCell.pos,this.$headCell.pos)}};wt.prototype.visible=!1;Ne.jsonID("cell",wt);var gF=class UR{constructor(e,n){this.anchor=e,this.head=n}map(e){return new UR(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&&sv(n,r)?new wt(n,r):Ne.near(r,1)}};function yF(t){if(!(t.selection instanceof wt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(zt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),it.create(t.doc,e)}function bF({$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 xF({$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 vF(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,l;if(r instanceof Ae&&(l=r.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")s=wt.create(i,r.from);else if(l=="row"){const c=i.resolve(r.from+1);s=wt.rowSelection(c,c)}else if(!n){const c=Nt.get(r.node),u=r.from+1,f=u+c.map[c.width*c.height-1];s=wt.create(i,u+1,f)}}else r instanceof Oe&&bF(r)?s=Oe.create(i,r.from):r instanceof Oe&&xF(r)&&(s=Oe.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const SF=new Tt("fix-tables");function HR(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let l=0,c=0;l<s;l++){const u=e.child(l);for(let f=c,h=Math.min(i,l+3);f<h;f++)if(t.child(f)==u){c=f+1,n+=u.nodeSize;continue e}r(u,n),c<i&&t.child(c).sameMarkup(u)?HR(t.child(c),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function VR(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=wF(t,i,s,n))};return e?e.doc!=t.doc&&HR(e.doc,t.doc,0,r):t.doc.descendants(r),n}function wF(t,e,n,r){const i=Nt.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let u=0;u<i.height;u++)s.push(0);for(let u=0;u<i.problems.length;u++){const f=i.problems[u];if(f.type=="collision"){const h=e.nodeAt(f.pos);if(!h)continue;const m=h.attrs;for(let g=0;g<m.rowspan;g++)s[f.row+g]+=f.n;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,ul(m,m.colspan-f.n,f.n))}else if(f.type=="missing")s[f.row]+=f.n;else if(f.type=="overlong_rowspan"){const h=e.nodeAt(f.pos);if(!h)continue;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,{...h.attrs,rowspan:h.attrs.rowspan-f.n})}else if(f.type=="colwidth mismatch"){const h=e.nodeAt(f.pos);if(!h)continue;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,{...h.attrs,colwidth:f.colwidth})}else if(f.type=="zero_sized"){const h=r.mapping.map(n);r.delete(h,h+e.nodeSize)}}let l,c;for(let u=0;u<s.length;u++)s[u]&&(l==null&&(l=u),c=u);for(let u=0,f=n+1;u<i.height;u++){const h=e.child(u),m=f+h.nodeSize,g=s[u];if(g>0){let b="cell";h.firstChild&&(b=h.firstChild.type.spec.tableRole);const v=[];for(let C=0;C<g;C++){const E=Rn(t.schema)[b].createAndFill();E&&v.push(E)}const k=(u==0||l==u-1)&&c==u?f+1:m-1;r.insert(r.mapping.map(k),v)}f=m}return r.setMeta(SF,{fixTables:!0})}function Ai(t){const e=t.selection,n=Om(t),r=n.node(-1),i=n.start(-1),s=Nt.get(r);return{...e instanceof wt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function PR(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;mF(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 u=e.map[c],f=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,BR(f.attrs,i-e.colCount(u))),l+=f.attrs.rowspan-1}else{const u=s==null?Rn(r.type.schema).cell:r.nodeAt(e.map[c+s]).type,f=e.positionAt(l,i,r);t.insert(t.mapping.map(n+f),u.createAndFill())}}return t}function kF(t,e){if(!ri(t))return!1;if(e){const n=Ai(t);e(PR(t.tr,n,n.left))}return!0}function CF(t,e){if(!ri(t))return!1;if(e){const n=Ai(t);e(PR(t.tr,n,n.right))}return!0}function EF(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,u=e.map[c],f=n.nodeAt(u),h=f.attrs;if(i>0&&e.map[c-1]==u||i<e.width-1&&e.map[c+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,ul(h,i-e.colCount(u)));else{const m=t.mapping.slice(s).map(r+u);t.delete(m,m+f.nodeSize)}l+=h.rowspan}}function TF(t,e){if(!ri(t))return!1;if(e){const n=Ai(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;EF(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=Nt.get(s)}e(r)}return!0}function AF(t,e,n){var r;const i=Rn(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 $R(t,{map:e,tableStart:n,table:r},i){let s=n;for(let f=0;f<i;f++)s+=r.child(f).nodeSize;const l=[];let c=i>0?-1:0;AF(e,r,i+c)&&(c=i==0||i==e.height?null:0);for(let f=0,h=e.width*i;f<e.width;f++,h++)if(i>0&&i<e.height&&e.map[h]==e.map[h-e.width]){const m=e.map[h],g=r.nodeAt(m).attrs;t.setNodeMarkup(n+m,null,{...g,rowspan:g.rowspan+1}),f+=g.colspan-1}else{var u;const m=c==null?Rn(r.type.schema).cell:(u=r.nodeAt(e.map[h+c*e.width]))===null||u===void 0?void 0:u.type,g=m==null?void 0:m.createAndFill();g&&l.push(g)}return t.insert(s,Rn(r.type.schema).row.create(null,l)),t}function MF(t,e){if(!ri(t))return!1;if(e){const n=Ai(t);e($R(t.tr,n,n.top))}return!0}function OF(t,e){if(!ri(t))return!1;if(e){const n=Ai(t);e($R(t.tr,n,n.bottom))}return!0}function _F(t,{map:e,table:n,tableStart:r},i){let s=0;for(let f=0;f<i;f++)s+=n.child(f).nodeSize;const l=s+n.child(i).nodeSize,c=t.mapping.maps.length;t.delete(s+r,l+r);const u=new Set;for(let f=0,h=i*e.width;f<e.width;f++,h++){const m=e.map[h];if(!u.has(m)){if(u.add(m),i>0&&m==e.map[h-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),f+=g.colspan-1}else if(i<e.height&&m==e.map[h+e.width]){const g=n.nodeAt(m),b=g.attrs,v=g.type.create({...b,rowspan:g.attrs.rowspan-1},g.content),k=e.positionAt(i+1,f,n);t.insert(t.mapping.slice(c).map(r+k),v),f+=b.colspan-1}}}}function DF(t,e){if(!ri(t))return!1;if(e){const n=Ai(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;_F(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=Nt.get(n.table)}e(r)}return!0}function pA(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function RF({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 u=r.top;u<r.bottom;u++){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 u=r.left;u<r.right;u++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[l]==n[l+t])return!0;i++,l++}return!1}function mA(t,e){const n=t.selection;if(!(n instanceof wt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Ai(t),{map:i}=r;if(RF(i,r))return!1;if(e){const s=t.tr,l={};let c=ee.empty,u,f;for(let h=r.top;h<r.bottom;h++)for(let m=r.left;m<r.right;m++){const g=i.map[h*i.width+m],b=r.table.nodeAt(g);if(!(l[g]||!b))if(l[g]=!0,u==null)u=g,f=b;else{pA(b)||(c=c.append(b.content));const v=s.mapping.map(g+r.tableStart);s.delete(v,v+b.nodeSize)}}if(u==null||f==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...BR(f.attrs,f.attrs.colspan,r.right-r.left-f.attrs.colspan),rowspan:r.bottom-r.top}),c.size>0){const h=u+1+f.content.size,m=pA(f)?u+1:h;s.replaceWith(m+r.tableStart,h+r.tableStart,c)}s.setSelection(new wt(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function gA(t,e){const n=Rn(t.schema);return NF(({node:r})=>n[r.type.spec.tableRole])(t,e)}function NF(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof wt){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var l;if(i=fF(r.$from),!i)return!1;s=(l=cl(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 u=[],f=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const h=Ai(e),m=e.tr;for(let b=0;b<h.right-h.left;b++)u.push(f?{...c,colwidth:f&&f[b]?[f[b]]:null}:c);let g;for(let b=h.top;b<h.bottom;b++){let v=h.map.positionAt(b,h.left,h.table);b==h.top&&(v+=i.nodeSize);for(let k=h.left,C=0;k<h.right;k++,C++)k==h.left&&b==h.top||m.insert(g=m.mapping.map(v+h.tableStart,1),t({node:i,row:b,col:k}).createAndFill(u[C]))}m.setNodeMarkup(s,t({node:i,row:h.top,col:h.left}),u[0]),r instanceof wt&&m.setSelection(new wt(m.doc.resolve(r.$anchorCell.pos),g?m.doc.resolve(g):void 0)),n(m)}return!0}}function zF(t,e){return function(n,r){if(!ri(n))return!1;const i=Om(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof wt?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 LF(t){return function(e,n){if(!ri(e))return!1;if(n){const r=Rn(e.schema),i=Ai(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(u=>i.table.nodeAt(u));for(let u=0;u<l.length;u++)c[u].type==r.header_cell&&s.setNodeMarkup(i.tableStart+l[u],r.cell,c[u].attrs);if(s.steps.length===0)for(let u=0;u<l.length;u++)s.setNodeMarkup(i.tableStart+l[u],r.header_cell,c[u].attrs);n(s)}return!0}}function yA(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 rd(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?LF(t):function(n,r){if(!ri(n))return!1;if(r){const i=Rn(n.schema),s=Ai(n),l=n.tr,c=yA("row",s,i),u=yA("column",s,i),f=(t==="column"?c:t==="row"&&u)?1:0,h=t=="column"?{left:0,top:f,right:1,bottom:s.map.height}:t=="row"?{left:f,top:0,right:s.map.width,bottom:1}:s,m=t=="column"?u?i.cell:i.header_cell:t=="row"?c?i.cell:i.header_cell:i.cell;s.map.cellsInRect(h).forEach(g=>{const b=g+s.tableStart,v=l.doc.nodeAt(b);v&&l.setNodeMarkup(b,m,v.attrs)}),r(l)}return!0}}rd("row",{useDeprecatedLogic:!0});rd("column",{useDeprecatedLogic:!0});const jF=rd("cell",{useDeprecatedLogic:!0});function IF(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 bA(t){return function(e,n){if(!ri(e))return!1;const r=IF(Om(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Oe.between(i,pF(i))).scrollIntoView())}return!0}}function BF(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 oh(t,e){const n=t.selection;if(!(n instanceof wt))return!1;if(e){const r=t.tr,i=Rn(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 fe(i,0,0))}),r.docChanged&&e(r)}return!0}function UF(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 u=0;u<e.childCount;u++){let f=e.child(u).content;const h=u?0:Math.max(0,n-1),m=u<e.childCount-1?0:Math.max(0,r-1);(h||m)&&(f=px(Rn(l).row,new fe(f,h,m)).content),c.push(f)}else if(s=="cell"||s=="header_cell")c.push(n||r?px(Rn(l).row,new fe(e,n,r)).content:e);else return null;return HF(l,c)}function HF(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:u}=s.child(l).attrs;for(let f=i;f<i+c;f++)n[f]=(n[f]||0)+u}}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(ee.empty),n[i]<r){const s=Rn(t).cell.createAndFill(),l=[];for(let c=n[i];c<r;c++)l.push(s);e[i]=e[i].append(ee.from(l))}return{height:e.length,width:r,rows:e}}function px(t,e){const n=t.createAndFill();return new T1(n).replace(0,n.content.size,e).doc}function VF({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],l=[];for(let c=0;c<n.length;c++){const u=n[c],f=[];for(let h=s[c]||0,m=0;h<r;m++){let g=u.child(m%u.childCount);h+g.attrs.colspan>r&&(g=g.type.createChecked(ul(g.attrs,g.attrs.colspan,h+g.attrs.colspan-r),g.content)),f.push(g),h+=g.attrs.colspan;for(let b=1;b<g.attrs.rowspan;b++)s[c+b]=(s[c+b]||0)+g.attrs.colspan}l.push(ee.from(f))}n=l,t=r}if(e!=i){const s=[];for(let l=0,c=0;l<i;l++,c++){const u=[],f=n[c%e];for(let h=0;h<f.childCount;h++){let m=f.child(h);l+m.attrs.rowspan>i&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,i-m.attrs.rowspan)},m.content)),u.push(m)}s.push(ee.from(u))}n=s,e=i}return{width:t,height:e,rows:n}}function PF(t,e,n,r,i,s,l){const c=t.doc.type.schema,u=Rn(c);let f,h;if(i>e.width)for(let m=0,g=0;m<e.height;m++){const b=n.child(m);g+=b.nodeSize;const v=[];let k;b.lastChild==null||b.lastChild.type==u.cell?k=f||(f=u.cell.createAndFill()):k=h||(h=u.header_cell.createAndFill());for(let C=e.width;C<i;C++)v.push(k);t.insert(t.mapping.slice(l).map(g-1+r),v)}if(s>e.height){const m=[];for(let v=0,k=(e.height-1)*e.width;v<Math.max(e.width,i);v++){const C=v>=e.width?!1:n.nodeAt(e.map[k+v]).type==u.header_cell;m.push(C?h||(h=u.header_cell.createAndFill()):f||(f=u.cell.createAndFill()))}const g=u.row.create(null,ee.from(m)),b=[];for(let v=e.height;v<s;v++)b.push(g);t.insert(t.mapping.slice(l).map(r+n.nodeSize-2),b)}return!!(f||h)}function xA(t,e,n,r,i,s,l,c){if(l==0||l==e.height)return!1;let u=!1;for(let f=i;f<s;f++){const h=l*e.width+f,m=e.map[h];if(e.map[h-e.width]==m){u=!0;const g=n.nodeAt(m),{top:b,left:v}=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,v,n)),g.type.createAndFill({...g.attrs,rowspan:b+g.attrs.rowspan-l})),f+=g.attrs.colspan-1}}return u}function vA(t,e,n,r,i,s,l,c){if(l==0||l==e.width)return!1;let u=!1;for(let f=i;f<s;f++){const h=f*e.width+l,m=e.map[h];if(e.map[h-1]==m){u=!0;const g=n.nodeAt(m),b=e.colCount(m),v=t.mapping.slice(c).map(m+r);t.setNodeMarkup(v,null,ul(g.attrs,l-b,g.attrs.colspan-(l-b))),t.insert(v+g.nodeSize,g.type.createAndFill(ul(g.attrs,0,l-b))),f+=g.attrs.rowspan-1}}return u}function SA(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=Nt.get(s);const{top:c,left:u}=r,f=u+i.width,h=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=Nt.get(s),g=m.mapping.maps.length}PF(m,l,s,n,f,h,g)&&b(),xA(m,l,s,n,u,f,c,g)&&b(),xA(m,l,s,n,u,f,h,g)&&b(),vA(m,l,s,n,c,h,u,g)&&b(),vA(m,l,s,n,c,h,f,g)&&b();for(let v=c;v<h;v++){const k=l.positionAt(v,u,s),C=l.positionAt(v,f,s);m.replace(m.mapping.slice(g).map(k+n),m.mapping.slice(g).map(C+n),new fe(i.rows[v-c],0,0))}b(),m.setSelection(new wt(m.doc.resolve(n+l.positionAt(c,u,s)),m.doc.resolve(n+l.positionAt(h-1,f-1,s)))),e(m)}const $F=I1({ArrowLeft:lh("horiz",-1),ArrowRight:lh("horiz",1),ArrowUp:lh("vert",-1),ArrowDown:lh("vert",1),"Shift-ArrowLeft":ah("horiz",-1),"Shift-ArrowRight":ah("horiz",1),"Shift-ArrowUp":ah("vert",-1),"Shift-ArrowDown":ah("vert",1),Backspace:oh,"Mod-Backspace":oh,Delete:oh,"Mod-Delete":oh});function Mh(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function lh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof wt)return Mh(n,r,Ne.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const l=FR(i,t,e);if(l==null)return!1;if(t=="horiz")return Mh(n,r,Ne.near(n.doc.resolve(s.head+e),e));{const c=n.doc.resolve(l),u=IR(c,t,e);let f;return u?f=Ne.near(u,1):e<0?f=Ne.near(n.doc.resolve(c.before(-1)),-1):f=Ne.near(n.doc.resolve(c.after(-1)),1),Mh(n,r,f)}}}function ah(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let l;if(s instanceof wt)l=s;else{const u=FR(i,t,e);if(u==null)return!1;l=new wt(n.doc.resolve(u))}const c=IR(l.$headCell,t,e);return c?Mh(n,r,new wt(l.$anchorCell,c)):!1}}function FF(t,e){const n=t.state.doc,r=cl(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new wt(r))),!0):!1}function qF(t,e,n){if(!ri(t.state))return!1;let r=UF(n);const i=t.state.selection;if(i instanceof wt){r||(r={width:1,height:1,rows:[ee.from(px(Rn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),l=i.$anchorCell.start(-1),c=Nt.get(s).rectBetween(i.$anchorCell.pos-l,i.$headCell.pos-l);return r=VF(r,c.right-c.left,c.bottom-c.top),SA(t.state,t.dispatch,l,c,r),!0}else if(r){const s=Om(t.state),l=s.start(-1);return SA(t.state,t.dispatch,l,Nt.get(s.node(-1)).findCell(s.pos-l),r),!0}else return!1}function KF(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=wA(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof wt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=cl(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(u,f){let h=Z0(t,f);const m=Ws.getState(t.state)==null;if(!h||!sv(u,h))if(m)h=u;else return;const g=new wt(u,h);if(m||!t.state.selection.eq(g)){const b=t.state.tr.setSelection(g);m&&b.setMeta(Ws,u.pos),t.dispatch(b)}}function l(){t.root.removeEventListener("mouseup",l),t.root.removeEventListener("dragstart",l),t.root.removeEventListener("mousemove",c),Ws.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Ws,-1))}function c(u){const f=u,h=Ws.getState(t.state);let m;if(h!=null)m=t.state.doc.resolve(h);else if(wA(t,f.target)!=r&&(m=Z0(t,e),!m))return l();m&&s(m,f)}t.root.addEventListener("mouseup",l),t.root.addEventListener("dragstart",l),t.root.addEventListener("mousemove",c)}function FR(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 wA(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&&cl(t.state.doc.resolve(r))||cl(t.state.doc.resolve(i))}var YF=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")),mx(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,mx(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function mx(t,e,n,r,i,s){let l=0,c=!0,u=e.firstChild;const f=t.firstChild;if(f){for(let m=0,g=0;m<f.childCount;m++){const{colspan:b,colwidth:v}=f.child(m).attrs;for(let k=0;k<b;k++,g++){const C=i==g?s:v&&v[k],E=C?C+"px":"";if(l+=C||r,C||(c=!1),u)u.style.width!=E&&(u.style.width=E),u=u.nextSibling;else{const L=document.createElement("col");L.style.width=E,e.appendChild(L)}}}for(;u;){var h;const m=u.nextSibling;(h=u.parentNode)===null||h===void 0||h.removeChild(u),u=m}c?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}const gr=new Tt("tableColumnResizing");function WF({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=YF,lastColumnResizable:i=!0}={}){const s=new pt({key:gr,state:{init(l,c){var u;const f=(u=s.spec)===null||u===void 0||(u=u.props)===null||u===void 0?void 0:u.nodeViews,h=Rn(c.schema).table.name;return r&&f&&(f[h]=(m,g)=>new r(m,n,g)),new GF(-1,!1)},apply(l,c){return c.apply(l)}},props:{attributes:l=>{const c=gr.getState(l);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,c)=>{ZF(l,c,t,i)},mouseleave:l=>{JF(l)},mousedown:(l,c)=>{XF(l,c,e,n)}},decorations:l=>{const c=gr.getState(l);if(c&&c.activeHandle>-1)return r7(l,c.activeHandle)},nodeViews:{}}});return s}var GF=class Oh{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(gr);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 hx(e.doc.resolve(i))||(i=-1),new Oh(i,n.dragging)}return n}};function ZF(t,e,n,r){if(!t.editable)return;const i=gr.getState(t.state);if(i&&!i.dragging){const s=e7(e.target);let l=-1;if(s){const{left:c,right:u}=s.getBoundingClientRect();e.clientX-c<=n?l=kA(t,e,"left",n):u-e.clientX<=n&&(l=kA(t,e,"right",n))}if(l!=i.activeHandle){if(!r&&l!==-1){const c=t.state.doc.resolve(l),u=c.node(-1),f=Nt.get(u),h=c.start(-1);if(f.colCount(c.pos-h)+c.nodeAfter.attrs.colspan-1==f.width-1)return}qR(t,l)}}}function JF(t){if(!t.editable)return;const e=gr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&qR(t,-1)}function XF(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=gr.getState(t.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const c=t.state.doc.nodeAt(l.activeHandle),u=QF(t,l.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(gr,{setDragging:{startX:e.clientX,startWidth:u}}));function f(m){s.removeEventListener("mouseup",f),s.removeEventListener("mousemove",h);const g=gr.getState(t.state);g!=null&&g.dragging&&(t7(t,g.activeHandle,CA(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(gr,{setDragging:null})))}function h(m){if(!m.which)return f(m);const g=gr.getState(t.state);if(g&&g.dragging){const b=CA(g.dragging,m,n);EA(t,g.activeHandle,b,r)}}return EA(t,l.activeHandle,u,r),s.addEventListener("mouseup",f),s.addEventListener("mousemove",h),e.preventDefault(),!0}function QF(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 u=0;u<n;u++)r[u]&&(l-=r[u],c--);return l/c}function e7(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function kA(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=cl(t.state.doc.resolve(l));if(!c)return-1;if(n=="right")return c.pos;const u=Nt.get(c.node(-1)),f=c.start(-1),h=u.map.indexOf(c.pos-f);return h%u.width==0?-1:f+u.map[h-1]}function CA(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function qR(t,e){t.dispatch(t.state.tr.setMeta(gr,{setHandle:e}))}function t7(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Nt.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1,u=t.state.tr;for(let f=0;f<s.height;f++){const h=f*s.width+c;if(f&&s.map[h]==s.map[h-s.width])continue;const m=s.map[h],g=i.nodeAt(m).attrs,b=g.colspan==1?0:c-s.colCount(m);if(g.colwidth&&g.colwidth[b]==n)continue;const v=g.colwidth?g.colwidth.slice():n7(g.colspan);v[b]=n,u.setNodeMarkup(l+m,null,{...g,colwidth:v})}u.docChanged&&t.dispatch(u)}function EA(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),l=i.start(-1),c=Nt.get(s).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;let u=t.domAtPos(i.start(-1)).node;for(;u&&u.nodeName!="TABLE";)u=u.parentNode;u&&mx(s,u.firstChild,u,r,c,n)}function n7(t){return Array(t).fill(0)}function r7(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return it.empty;const s=Nt.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1;for(let f=0;f<s.height;f++){const h=c+f*s.width;if((c==s.width-1||s.map[h]!=s.map[h+1])&&(f==0||s.map[h]!=s.map[h-s.width])){var u;const m=s.map[h],g=l+m+i.nodeAt(m).nodeSize-1,b=document.createElement("div");b.className="column-resize-handle",!((u=gr.getState(t))===null||u===void 0)&&u.dragging&&n.push(zt.node(l+m,l+m+i.nodeAt(m).nodeSize,{class:"column-resize-dragging"})),n.push(zt.widget(g,b))}}return it.create(t.doc,n)}function i7({allowTableNodeSelection:t=!1}={}){return new pt({key:Ws,state:{init(){return null},apply(e,n){const r=e.getMeta(Ws);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:yF,handleDOMEvents:{mousedown:KF},createSelectionBetween(e){return Ws.getState(e.state)!=null?e.state.selection:null},handleTripleClick:FF,handleKeyDown:$F,handlePaste:qF},appendTransaction(e,n,r){return vF(r,VR(r,n),t)}})}function gx(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function TA(t,e,n,r,i,s){var l;let c=0,u=!0,f=e.firstChild;const h=t.firstChild;if(h!==null)for(let m=0,g=0;m<h.childCount;m+=1){const{colspan:b,colwidth:v}=h.child(m).attrs;for(let k=0;k<b;k+=1,g+=1){const C=i===g?s:v&&v[k],E=C?`${C}px`:"";if(c+=C||r,C||(u=!1),f){if(f.style.width!==E){const[L,j]=gx(r,C);f.style.setProperty(L,j)}f=f.nextSibling}else{const L=document.createElement("col"),[j,Y]=gx(r,C);L.style.setProperty(j,Y),e.appendChild(L)}}}for(;f;){const m=f.nextSibling;(l=f.parentNode)===null||l===void 0||l.removeChild(f),f=m}u?(n.style.width=`${c}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${c}px`)}class s7{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")),TA(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,TA(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function o7(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:v}=c.child(m).attrs;for(let k=0;k<b;k+=1,g+=1){const C=n===g?r:v&&v[k];i+=C||e,C||(s=!1);const[E,L]=gx(e,C);l.push(["col",{style:`${E}: ${L}`}])}}const u=s?`${i}px`:"",f=s?"":`${i}px`;return{colgroup:["colgroup",{},...l],tableWidth:u,tableMinWidth:f}}function AA(t,e){return t.createAndFill()}function l7(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 a7(t,e,n,r,i){const s=l7(t),l=[],c=[];for(let f=0;f<n;f+=1){const h=AA(s.cell);if(h&&c.push(h),r){const m=AA(s.header_cell);m&&l.push(m)}}const u=[];for(let f=0;f<e;f+=1)u.push(s.row.createChecked(null,r&&f===0?l:c));return s.table.createChecked(null,u)}function c7(t){return t instanceof wt}const ch=({editor:t})=>{const{selection:e}=t.state;if(!c7(e))return!1;let n=0;const r=wR(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},u7=fn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:s7,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}=o7(t,this.options.cellMinWidth),s=["table",Lt(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=a7(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})=>kF(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>CF(t,e),deleteColumn:()=>({state:t,dispatch:e})=>TF(t,e),addRowBefore:()=>({state:t,dispatch:e})=>MF(t,e),addRowAfter:()=>({state:t,dispatch:e})=>OF(t,e),deleteRow:()=>({state:t,dispatch:e})=>DF(t,e),deleteTable:()=>({state:t,dispatch:e})=>BF(t,e),mergeCells:()=>({state:t,dispatch:e})=>mA(t,e),splitCell:()=>({state:t,dispatch:e})=>gA(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>rd("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>rd("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>jF(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>mA(t,e)?!0:gA(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>zF(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>bA(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>bA(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&VR(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=wt.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:ch,"Mod-Backspace":ch,Delete:ch,"Mod-Delete":ch}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[WF({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],i7({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Fe(ve(t,"tableRole",e))}}}),d7=fn.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",Lt(this.options.HTMLAttributes,t),0]}}),f7=fn.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",Lt(this.options.HTMLAttributes,t),0]}}),h7=fn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Lt(this.options.HTMLAttributes,t),0]}});var p7=fM();const m7=Zp(p7);function g7(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var KR={exports:{}},J0={};/**
196
+ * @license React
197
+ * use-sync-external-store-shim.production.min.js
198
+ *
199
+ * Copyright (c) Facebook, Inc. and its affiliates.
200
+ *
201
+ * This source code is licensed under the MIT license found in the
202
+ * LICENSE file in the root directory of this source tree.
203
+ */var MA;function y7(){if(MA)return J0;MA=1;var t=sn;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(),v=r({inst:{value:b,getSnapshot:g}}),k=v[0].inst,C=v[1];return s(function(){k.value=b,k.getSnapshot=g,u(k)&&C({inst:k})},[m,b,g]),i(function(){return u(k)&&C({inst:k}),m(function(){u(k)&&C({inst:k})})},[m]),l(b),b}function u(m){var g=m.getSnapshot;m=m.value;try{var b=g();return!n(m,b)}catch{return!0}}function f(m,g){return g()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return J0.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:h,J0}KR.exports=y7();var ov=KR.exports;const b7=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},x7=({contentComponent:t})=>{const e=ov.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return sn.createElement(sn.Fragment,null,Object.values(e))};function v7(){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]:m7.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 S7 extends sn.Component{constructor(e){var n;super(e),this.editorContentRef=sn.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=v7(),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 sn.createElement(sn.Fragment,null,sn.createElement("div",{ref:b7(n,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&sn.createElement(x7,{contentComponent:e.contentComponent}))}}const w7=M.forwardRef((t,e)=>{const n=sn.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return sn.createElement(S7,{key:n,innerRef:e,...t})}),k7=sn.memo(w7);var C7=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},E7=g7(C7),YR={exports:{}},X0={};/**
204
+ * @license React
205
+ * use-sync-external-store-shim/with-selector.production.min.js
206
+ *
207
+ * Copyright (c) Facebook, Inc. and its affiliates.
208
+ *
209
+ * This source code is licensed under the MIT license found in the
210
+ * LICENSE file in the root directory of this source tree.
211
+ */var OA;function T7(){if(OA)return X0;OA=1;var t=sn,e=ov;function n(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,l=t.useEffect,c=t.useMemo,u=t.useDebugValue;return X0.useSyncExternalStoreWithSelector=function(f,h,m,g,b){var v=s(null);if(v.current===null){var k={hasValue:!1,value:null};v.current=k}else k=v.current;v=c(function(){function E(R){if(!L){if(L=!0,j=R,R=g(R),b!==void 0&&k.hasValue){var B=k.value;if(b(B,R))return Y=B}return Y=R}if(B=Y,r(j,R))return B;var te=g(R);return b!==void 0&&b(B,te)?B:(j=R,Y=te)}var L=!1,j,Y,V=m===void 0?null:m;return[function(){return E(h())},V===null?void 0:function(){return E(V())}]},[h,m,g,b]);var C=i(f,v[0],v[1]);return l(function(){k.hasValue=!0,k.value=C},[C]),u(C),C},X0}YR.exports=T7();var A7=YR.exports;const M7=typeof window<"u"?M.useLayoutEffect:M.useEffect;class O7{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 _7(t){var e;const[n]=M.useState(()=>new O7(t.editor)),r=A7.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:E7);return M7(()=>n.watch(t.editor),[t.editor,n]),M.useDebugValue(r),r}const D7=!1,yx=typeof window>"u",R7=yx||!!(typeof window<"u"&&window.next);class lv{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?yx||R7?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 P9(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?lv.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 N7(t={},e=[]){const n=M.useRef(t);n.current=t;const[r]=M.useState(()=>new lv(n)),i=ov.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return M.useDebugValue(i),M.useEffect(r.onRender(e)),_7({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&s===0?0:s+1}),i}const z7=M.createContext({editor:null});z7.Consumer;const L7=M.createContext({onDragStart:void 0}),j7=()=>M.useContext(L7);sn.forwardRef((t,e)=>{const{onDragStart:n}=j7(),r=t.as||"div";return sn.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});const I7=/^\s*>\s$/,B7=fn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Lt(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[Qu({find:I7,type:this.type})]}}),U7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,H7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,V7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,P7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,$7=Ei.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",Lt(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[al({find:U7,type:this.type}),al({find:V7,type:this.type})]},addPasteRules(){return[ao({find:H7,type:this.type}),ao({find:P7,type:this.type})]}}),F7="listItem",_A="textStyle",DA=/^\s*([-+*])\s$/,q7=fn.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",Lt(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(F7,this.editor.getAttributes(_A)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Qu({find:DA,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Qu({find:DA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(_A),editor:this.editor})),[t]}}),K7=/(^|[^`])`([^`]+)`(?!`)/,Y7=/(^|[^`])`([^`]+)`(?!`)/g,W7=Ei.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Lt(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[al({find:K7,type:this.type})]},addPasteRules(){return[ao({find:Y7,type:this.type})]}}),G7=/^```([a-z]+)?[\s\n]$/,Z7=/^~~~([a-z]+)?[\s\n]$/,J7=fn.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",Lt(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(`
212
+
213
+ `);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:f})=>(f.setSelection(Ne.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[Xb({find:G7,type:this.type,getAttributes:t=>({language:t[1]})}),Xb({find:Z7,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new pt({key:new Tt("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,u=c.text(n.replace(/\r\n?/g,`
214
+ `));return l.replaceSelectionWith(this.type.create({language:s},u)),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}}})]}}),X7=fn.create({name:"doc",topNode:!0,content:"block+"});function Q7(t={}){return new pt({view(e){return new eq(e,t)}})}class eq{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 v=b.getBoundingClientRect(),k=m?v.bottom:v.top;m&&g&&(k=(k+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let C=this.width/2*c;r={left:v.left,right:v.right,top:k-C,bottom:k+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 u=this.editorView.dom.offsetParent;this.element||(this.element=u.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 f,h;if(!u||u==document.body&&getComputedStyle(u).position=="static")f=-pageXOffset,h=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,b=m.height/u.offsetHeight;f=m.left-u.scrollLeft*g,h=m.top-u.scrollTop*b}this.element.style.left=(r.left-f)/l+"px",this.element.style.top=(r.top-h)/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=dD(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 tq=Vt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Q7(this.options)]}});class Rt extends Ne{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Rt.valid(r)?new Rt(r):Ne.near(r)}content(){return fe.empty}eq(e){return e instanceof Rt&&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 Rt(e.resolve(n.pos))}getBookmark(){return new av(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!nq(e)||!rq(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&&Rt.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 u=e.doc.resolve(i);if(Rt.valid(u))return u}for(;;){let l=n>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!Ae.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(Rt.valid(c))return c}return null}}}Rt.prototype.visible=!1;Rt.findFrom=Rt.findGapCursorFrom;Ne.jsonID("gapcursor",Rt);class av{constructor(e){this.pos=e}map(e){return new av(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Rt.valid(n)?new Rt(n):Ne.near(n)}}function WR(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function nq(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||WR(i.type))return!0;if(i.inlineContent)return!1}}return!0}function rq(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||WR(i.type))return!0;if(i.inlineContent)return!1}}return!0}function iq(){return new pt({props:{decorations:aq,createSelectionBetween(t,e,n){return e.pos==n.pos&&Rt.valid(n)?new Rt(n):null},handleClick:oq,handleKeyDown:sq,handleDOMEvents:{beforeinput:lq}}})}const sq=I1({ArrowLeft:uh("horiz",-1),ArrowRight:uh("horiz",1),ArrowUp:uh("vert",-1),ArrowDown:uh("vert",1)});function uh(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,u=l.empty;if(l instanceof Oe){if(!s.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let f=Rt.findGapCursorFrom(c,e,u);return f?(i&&i(r.tr.setSelection(new Rt(f))),!0):!1}}function oq(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Rt.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Ae.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Rt(r))),!0)}function lq(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Rt))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=ee.empty;for(let l=r.length-1;l>=0;l--)i=ee.from(r[l].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new fe(i,0,0));return s.setSelection(Oe.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function aq(t){if(!(t.selection instanceof Rt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",it.create(t.doc,[zt.widget(t.selection.head,e,{key:"gapcursor"})])}const cq=Vt.create({name:"gapCursor",addProseMirrorPlugins(){return[iq()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Fe(ve(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),uq=fn.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",Lt(this.options.HTMLAttributes,t)]},renderText(){return`
215
+ `},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,u=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:f,dispatch:h})=>{if(h&&u&&l){const m=u.filter(g=>c.includes(g.type.name));f.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),dq=fn.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]}`,Lt(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=>Xb({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Hp=200,un=function(){};un.prototype.append=function(e){return e.length?(e=un.from(e),!this.length&&e||e.length<Hp&&this.leafAppend(e)||this.length<Hp&&e.leafPrepend(this)||this.appendInner(e)):this};un.prototype.prepend=function(e){return e.length?un.from(e).append(this):this};un.prototype.appendInner=function(e){return new fq(this,e)};un.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?un.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};un.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};un.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)};un.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};un.from=function(e){return e instanceof un?e:e&&e.length?new GR(e):un.empty};var GR=(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 u=s;u<l;u++)if(i(this.values[u],c+u)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,l,c){for(var u=s-1;u>=l;u--)if(i(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Hp)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Hp)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})(un);un.empty=new GR([]);var fq=(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})(un);const hq=500;class Zr{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,u,f=[],h=[];return this.items.forEach((m,g)=>{if(!m.step){i||(i=this.remapping(r,g+1),s=i.maps.length),s--,h.push(m);return}if(i){h.push(new pi(m.map));let b=m.step.map(i.slice(s)),v;b&&l.maybeStep(b).doc&&(v=l.mapping.maps[l.mapping.maps.length-1],f.push(new pi(v,void 0,void 0,f.length+h.length))),s--,v&&i.appendMap(v,s)}else l.maybeStep(m.step);if(m.selection)return c=i?m.selection.map(i.slice(s)):m.selection,u=new Zr(this.items.slice(0,r).append(h.reverse().concat(f)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:l,selection:c}}addTransform(e,n,r,i){let s=[],l=this.eventCount,c=this.items,u=!i&&c.length?c.get(c.length-1):null;for(let h=0;h<e.steps.length;h++){let m=e.steps[h].invert(e.docs[h]),g=new pi(e.mapping.maps[h],m,n),b;(b=u&&u.merge(g))&&(g=b,h?s.pop():c=c.slice(0,c.length-1)),s.push(g),n&&(l++,n=void 0),i||(u=g)}let f=l-r.depth;return f>mq&&(c=pq(c,f),l-=f),new Zr(c.append(s),l)}remapping(e,n){let r=new Ku;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 Zr(this.items.append(e.map(n=>new pi(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 u=n;this.items.forEach(g=>{let b=s.getMirror(--u);if(b==null)return;l=Math.min(l,b);let v=s.maps[b];if(g.step){let k=e.steps[b].invert(e.docs[b]),C=g.selection&&g.selection.map(s.slice(u+1,b));C&&c++,r.push(new pi(v,k,C))}else r.push(new pi(v))},i);let f=[];for(let g=n;g<l;g++)f.push(new pi(s.maps[g]));let h=this.items.slice(0,i).append(f).append(r),m=new Zr(h,c);return m.emptyItemCount()>hq&&(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 u=l.step.map(n.slice(r)),f=u&&u.getMap();if(r--,f&&n.appendMap(f,r),u){let h=l.selection&&l.selection.map(n.slice(r));h&&s++;let m=new pi(f.invert(),u,h),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 Zr(un.from(i.reverse()),s)}}Zr.empty=new Zr(un.empty,0);function pq(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class pi{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 pi(n.getMap().invert(),n,this.selection)}}}class $s{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const mq=20;function gq(t,e,n,r){let i=n.getMeta(Zo),s;if(i)return i.historyState;n.getMeta(xq)&&(t=new $s(t.done,t.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(l&&l.getMeta(Zo))return l.getMeta(Zo).redo?new $s(t.done.addTransform(n,void 0,r,_h(e)),t.undone,RA(n.mapping.maps),t.prevTime,t.prevComposition):new $s(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"),u=t.prevTime==0||!l&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!yq(n,t.prevRanges)),f=l?Q0(t.prevRanges,n.mapping):RA(n.mapping.maps);return new $s(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,_h(e)),Zr.empty,f,n.time,c??t.prevComposition)}else return(s=n.getMeta("rebased"))?new $s(t.done.rebased(n,s),t.undone.rebased(n,s),Q0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new $s(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Q0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function yq(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 RA(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 Q0(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 bq(t,e,n){let r=_h(e),i=Zo.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),u=new $s(n?c:s.remaining,n?s.remaining:c,null,0,-1);return s.transform.setSelection(l).setMeta(Zo,{redo:n,historyState:u})}let eb=!1,NA=null;function _h(t){let e=t.plugins;if(NA!=e){eb=!1,NA=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){eb=!0;break}}return eb}const Zo=new Tt("history"),xq=new Tt("closeHistory");function vq(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new pt({key:Zo,state:{init(){return new $s(Zr.empty,Zr.empty,null,0,-1)},apply(e,n,r){return gq(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?JR:r=="historyRedo"?XR:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function ZR(t,e){return(n,r)=>{let i=Zo.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=bq(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const JR=ZR(!1,!0),XR=ZR(!0,!0),Sq=Vt.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>JR(t,e),redo:()=>({state:t,dispatch:e})=>XR(t,e)}},addProseMirrorPlugins(){return[vq(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()}}}),wq=fn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Lt(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!F9(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}):d9(n)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:l,dispatch:c})=>{var u;if(c){const{$to:f}=l.selection,h=f.end();if(f.nodeAfter)f.nodeAfter.isTextblock?l.setSelection(Oe.create(l.doc,f.pos+1)):f.nodeAfter.isBlock?l.setSelection(Ae.create(l.doc,f.pos)):l.setSelection(Oe.create(l.doc,f.pos));else{const m=(u=f.parent.type.contentMatch.defaultType)===null||u===void 0?void 0:u.create();m&&(l.insert(h,m),l.setSelection(Oe.create(l.doc,h+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[$9({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),kq=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Cq=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Eq=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Tq=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Aq=Ei.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",Lt(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[al({find:kq,type:this.type}),al({find:Eq,type:this.type})]},addPasteRules(){return[ao({find:Cq,type:this.type}),ao({find:Tq,type:this.type})]}}),Mq=fn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Lt(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)}}}),Oq="listItem",zA="textStyle",LA=/^(\d+)\.\s$/,_q=fn.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",Lt(this.options.HTMLAttributes,n),0]:["ol",Lt(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(Oq,this.editor.getAttributes(zA)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Qu({find:LA,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=Qu({find:LA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(zA)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Dq=fn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Lt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Rq=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Nq=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,zq=Ei.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",Lt(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[al({find:Rq,type:this.type})]},addPasteRules(){return[ao({find:Nq,type:this.type})]}}),Lq=fn.create({name:"text",group:"inline"}),jq=Vt.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push($7.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(B7.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(q7.configure(this.options.bulletList)),this.options.code!==!1&&t.push(W7.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(J7.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(X7.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(tq.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(cq.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(uq.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(dq.configure(this.options.heading)),this.options.history!==!1&&t.push(Sq.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(wq.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(Aq.configure(this.options.italic)),this.options.listItem!==!1&&t.push(Mq.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(_q.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(Dq.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(zq.configure(this.options.strike)),this.options.text!==!1&&t.push(Lq.configure(this.options.text)),t}}),dh=new Tt("tandemAnnotations");function jA(t,e,n){const r=[],i=t.content.size;return e.forEach(s=>{const l=$u(s);if(l.status!=="pending"||!l.range&&!l.relRange)return;const c=Zh(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:u,to:f}=c;if(u>=f||u<0||f>i)return;let h={};switch(l.type){case"highlight":{const m=l.color||"yellow",g=Ou[m]||Ou.yellow;h={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?h={class:"tandem-suggestion",style:"background: var(--tandem-suggestion-bg); text-decoration: underline wavy var(--tandem-suggestion); text-underline-offset: 3px;","data-annotation-id":l.id,"aria-label":"Replacement annotation"}:l.directedAt==="claude"?h={class:"tandem-question",style:"background: var(--tandem-accent-bg); border-bottom: 2px solid var(--tandem-accent); padding-bottom: 1px;","data-annotation-id":l.id,"aria-label":"Question annotation"}:h={class:"tandem-comment",style:"border-bottom: 2px dashed var(--tandem-author-user); padding-bottom: 1px;","data-annotation-id":l.id,"aria-label":"Comment annotation"};break;case"flag":h={class:"tandem-flag",style:"background: var(--tandem-error-bg); border-bottom: 2px solid var(--tandem-error); 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(zt.inline(u,f,h))}catch(m){if(!(m instanceof RangeError))throw m;console.debug("[annotation] RangeError for %s (from=%d, to=%d), skipping",l.id,u,f)}}),it.create(t,r)}const Iq=Vt.create({name:"tandemAnnotations",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(Aa);return[new pt({key:dh,state:{init(n,r){return jA(r.doc,e,t)},apply(n,r,i,s){return n.getMeta(dh)?jA(s.doc,e,t):n.docChanged?r.map(n.mapping,n.doc):r}},props:{decorations(n){return dh.getState(n)}},view(n){const r=()=>{const i=n.state.tr.setMeta(dh,!0);n.dispatch(i)};return e.observe(r),{destroy(){e.unobserve(r)}}}})]}}),ua=new Tt("tandemAuthorship");function Bq(t,e,n){if(t.relRange){const r=N_(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=nl(e,t.range.from),i=nl(e,t.range.to);if(r<i)return{from:r,to:i}}return null}function tb(t,e,n,r){if(!r)return it.empty;const i=[],s=t.content.size;return e.forEach(l=>{const c=l;if(!c.author||!c.range)return;const u=Bq(c,t,n);if(!u)return;const{from:f,to:h}=u;if(f>=h||f<0||h>s)return;const m={class:`tandem-authorship tandem-authorship--${c.author}`};try{i.push(zt.inline(f,h,m))}catch(g){if(!(g instanceof RangeError))throw g;console.warn("[authorship] Decoration RangeError for entry",c.id,g)}}),it.create(t,i)}const Uq=Vt.create({name:"tandemAuthorship",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(CC);let n=!1;try{n=localStorage.getItem(yM)==="true"}catch(r){console.warn("[authorship] localStorage unavailable",r)}return[new pt({key:ua,state:{init(r,i){return{visible:n,decorations:tb(i.doc,e,t,n)}},apply(r,i,s,l){const c=r.getMeta(ua);if((c==null?void 0:c.type)==="toggle"){const u=c.visible;return{visible:u,decorations:tb(l.doc,e,t,u)}}return(c==null?void 0:c.type)==="rebuild"?{visible:i.visible,decorations:tb(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=ua.getState(r))==null?void 0:i.decorations)??it.empty}},view(r){const i=()=>{const l=r.state.tr.setMeta(ua,{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(ua)||!t.docChanged)return;const n=e.getMap(CC),r=t.doc;t.steps.forEach(i=>{i.getMap().forEach((l,c,u,f)=>{if(f-u-(c-l)>0)try{const m=La(r,br(u)),g=La(r,br(f));if(g<=m)return;const b=KI("user"),v={id:b,author:"user",range:{from:m,to:g},timestamp:Date.now()};n.set(b,v)}catch(m){console.warn("[authorship] Position conversion failed during user attribution",m)}})})}}),fh=new Tt("tandemAwareness");function IA(t,e){if(!e)return it.empty;const n=[],{focusParagraph:r,focusOffset:i,active:s}=e;if(r!==null&&r>=0){let l=0;t.forEach((c,u)=>{l===r&&n.push(zt.node(u,u+c.nodeSize,{class:"tandem-claude-focus",style:"background: var(--tandem-claude-focus-bg); border-left: 3px solid var(--tandem-claude-focus-border); padding-left: 8px; transition: background 0.3s ease, border-color 0.3s ease;"})),l++})}if(i!==null&&i>=0)try{const l=nl(t,ph(i)),c=s===!1?" tandem-claude-cursor-idle":"";n.push(zt.widget(l,()=>{const u=document.createElement("span");u.className=`tandem-claude-cursor${c}`,u.setAttribute("aria-hidden","true");const f=document.createElement("span");return f.className="tandem-claude-cursor-label",f.textContent="Claude",u.appendChild(f),u}))}catch(l){console.warn("[awareness] cursor decoration failed, falling back to gutter-only:",l)}return n.length===0?it.empty:it.create(t,n)}const Hq=Vt.create({name:"tandemAwareness",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(gM),n=t.getMap(lb);return[new pt({key:fh,state:{init(r,i){const s=e.get("claude");return IA(i.doc,s??null)},apply(r,i,s,l){if(r.getMeta(fh)){const c=e.get("claude");return IA(l.doc,c??null)}return r.docChanged?i.map(r.mapping,r.doc):i}},props:{decorations(r){return fh.getState(r)}},view(r){const i=()=>{const s=r.state.tr.setMeta(fh,!0);r.dispatch(s)};return e.observe(i),{destroy(){e.unobserve(i)}}}}),new pt({key:new Tt("tandemUserAwareness"),view(){let r=null,i=null,s=null,l=!1,c=-1;return{update(u,f){const{state:h}=u;if(!h.selection.eq(f.selection)){const m=z_(h.doc,{from:br(h.selection.from),to:br(h.selection.to)});if(h.selection.from===h.selection.to)s&&(clearTimeout(s),s=null),n.set("selection",{...m,timestamp:Date.now()});else{const g=h.doc.textBetween(h.selection.from,h.selection.to,`
216
+ `),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)}}h.doc!==f.doc&&(c=h.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:u.state.selection.from,lastEdit:Date.now()})},Jz))},destroy(){r&&clearTimeout(r),i&&clearTimeout(i),s&&clearTimeout(s)}}}})]}});function BA({ydoc:t,provider:e,readOnly:n,reviewMode:r,activeAnnotationId:i,onEditorReady:s,onAnnotationClick:l}){const c=N7({extensions:[jq.configure({history:!1}),L$.configure({multicolor:!0}),oF.configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}}),lF.configure({placeholder:"Open a document with Claude to get started..."}),u7.configure({resizable:!0}),h7,d7,f7,D$.configure({document:t}),R$.configure({provider:e,user:{name:w1(),color:"var(--tandem-warning)"}}),Iq.configure({ydoc:t}),Uq.configure({ydoc:t}),Hq.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]);M.useEffect(()=>{c&&c.setEditable(!n)},[c,n]),M.useEffect(()=>{if(c)return I_(h=>c.commands.updateUser({name:h}))},[c]),M.useEffect(()=>(s==null||s(c),()=>s==null?void 0:s(null)),[c,s]),M.useEffect(()=>{if(!c)return;const h=c.view.dom;h.querySelectorAll(".tandem-annotation-active").forEach(m=>{m.classList.remove("tandem-annotation-active")}),i&&r&&h.querySelectorAll(`[data-annotation-id="${CSS.escape(i)}"]`).forEach(m=>{m.classList.add("tandem-annotation-active")})},[c,i,r]);const u=M.useCallback(h=>{const m=h.target.closest("[data-annotation-id]");if(!m)return;const g=m.getAttribute("data-annotation-id");g&&l&&l(g)},[l]),f=r?"tandem-review-dimmed":"";return S.jsx("div",{className:f,onClick:u,children:S.jsx(k7,{editor:c})})}function nn({label:t,ariaLabel:e,shortcut:n,disabled:r,disabledTitle:i,active:s,onMouseDown:l,onClick:c,style:u}){let f="1px solid var(--tandem-border)",h="var(--tandem-surface)",m="var(--tandem-fg)";r?(h="var(--tandem-surface-muted)",m="var(--tandem-fg-subtle)"):s&&(f="1px solid var(--tandem-accent)",h="var(--tandem-accent-bg)",m="var(--tandem-accent)");const g=e??(typeof t=="string"?t:void 0),b=g??"";return S.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",...u,border:f,background:h,color:m},children:t})}const Vq=S.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[S.jsx("circle",{cx:"2",cy:"4",r:"1.5",fill:"currentColor"}),S.jsx("circle",{cx:"2",cy:"8",r:"1.5",fill:"currentColor"}),S.jsx("circle",{cx:"2",cy:"12",r:"1.5",fill:"currentColor"}),S.jsx("rect",{x:"5",y:"3",width:"9",height:"2",rx:"1",fill:"currentColor"}),S.jsx("rect",{x:"5",y:"7",width:"9",height:"2",rx:"1",fill:"currentColor"}),S.jsx("rect",{x:"5",y:"11",width:"9",height:"2",rx:"1",fill:"currentColor"})]}),Pq=S.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[S.jsx("rect",{x:"5",y:"3",width:"9",height:"2",rx:"1",fill:"currentColor"}),S.jsx("rect",{x:"5",y:"7",width:"9",height:"2",rx:"1",fill:"currentColor"}),S.jsx("rect",{x:"5",y:"11",width:"9",height:"2",rx:"1",fill:"currentColor"}),S.jsx("text",{x:"0",y:"5.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"1."}),S.jsx("text",{x:"0",y:"9.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"2."}),S.jsx("text",{x:"0",y:"13.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"3."})]}),$q=S.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[S.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"}),S.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"})]}),Fq=S.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[S.jsx("path",{d:"M5 4L1 8l4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),S.jsx("path",{d:"M11 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),S.jsx("path",{d:"M9 2l-2 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),qq=S.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[S.jsx("rect",{x:"0",y:"2",width:"3",height:"12",rx:"1.5",fill:"currentColor"}),S.jsx("rect",{x:"5",y:"4",width:"9",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"}),S.jsx("rect",{x:"5",y:"8",width:"7",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"}),S.jsx("rect",{x:"5",y:"12",width:"8",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"})]}),Kq=S.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[S.jsx("path",{d:"M4 7L1 4l3-3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),S.jsx("path",{d:"M1 4h9a5 5 0 0 1 0 10H7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Yq=S.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[S.jsx("path",{d:"M12 7l3-3-3-3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),S.jsx("path",{d:"M15 4H6a5 5 0 0 0 0 10h3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),QR=[1,2,3],Wq={1:700,2:600,3:500};function Gq(t){for(const e of QR)if(t.isActive("heading",{level:e}))return e;return null}function Rr(t){return e=>{e.preventDefault(),t()}}function Zq({editor:t,disabled:e}){var v,k;const[,n]=M.useState(0),[r,i]=M.useState(!1),s=M.useRef(null);if(M.useEffect(()=>{if(!t)return;const C=()=>{t.isDestroyed||n(E=>E+1)};return t.on("transaction",C),()=>{t.off("transaction",C)}},[t]),M.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,u=yi.getState(t.state),f=!c&&(((v=u==null?void 0:u.undoManager)==null?void 0:v.undoStack.length)??0)>0,h=!c&&(((k=u==null?void 0:u.undoManager)==null?void 0:k.redoStack.length)??0)>0,m=Gq(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 S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px"},children:[S.jsx(nn,{label:Kq,ariaLabel:"Undo",shortcut:"Ctrl+Z",disabled:!f,onMouseDown:Rr(()=>t.commands.undo()),style:{minWidth:"30px",padding:"4px 6px"}}),S.jsx(nn,{label:Yq,ariaLabel:"Redo",shortcut:"Ctrl+Shift+Z",disabled:!h,onMouseDown:Rr(()=>t.commands.redo()),style:{minWidth:"30px",padding:"4px 6px"}}),S.jsx("div",{style:{width:"1px",height:"16px",background:"var(--tandem-border)",margin:"0 2px"}}),S.jsx(nn,{label:"B",shortcut:"Ctrl+B",disabled:c,active:t.isActive("bold"),onMouseDown:Rr(()=>t.chain().focus().toggleBold().run()),style:{fontWeight:700,minWidth:"30px"}}),S.jsx(nn,{label:"I",shortcut:"Ctrl+I",disabled:c,active:t.isActive("italic"),onMouseDown:Rr(()=>t.chain().focus().toggleItalic().run()),style:{fontStyle:"italic",minWidth:"30px"}}),S.jsx(nn,{label:"S",shortcut:"Ctrl+Shift+X",disabled:c,active:t.isActive("strike"),onMouseDown:Rr(()=>t.chain().focus().toggleStrike().run()),style:{textDecoration:"line-through",minWidth:"30px"}}),S.jsx(nn,{label:"<>",shortcut:"Ctrl+E",disabled:c,active:t.isActive("code"),onMouseDown:Rr(()=>t.chain().focus().toggleCode().run()),style:{fontFamily:"monospace",minWidth:"30px"}}),S.jsxs("div",{style:{position:"relative"},ref:s,onKeyDown:C=>{C.key==="Escape"&&i(!1)},children:[S.jsx(nn,{label:b,disabled:c,active:m!==null,onMouseDown:C=>{C.preventDefault(),i(E=>!E)},style:{minWidth:"30px"}}),r&&S.jsx("div",{role:"menu","aria-label":"Heading level",style:{position:"absolute",top:"100%",left:0,marginTop:"4px",background:"var(--tandem-surface)",border:"1px solid var(--tandem-border)",borderRadius:"6px",padding:"4px",display:"flex",flexDirection:"column",gap:"2px",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:QR.map(C=>S.jsxs("button",{type:"button",role:"menuitem",onMouseDown:g(C),style:{padding:"4px 12px",fontSize:"13px",border:"none",borderRadius:"4px",background:m===C?"var(--tandem-accent-bg)":"transparent",color:m===C?"var(--tandem-accent)":"var(--tandem-fg)",cursor:"pointer",textAlign:"left",fontWeight:Wq[C],whiteSpace:"nowrap"},children:["Heading ",C]},C))})]}),S.jsx("div",{style:{width:"1px",height:"16px",background:"var(--tandem-border)",margin:"0 2px"}}),S.jsx(nn,{label:Vq,ariaLabel:"Bullet list",shortcut:"Ctrl+Shift+8",disabled:c,active:t.isActive("bulletList"),onMouseDown:Rr(()=>t.chain().focus().toggleBulletList().run()),style:{minWidth:"30px",padding:"4px 6px"}}),S.jsx(nn,{label:Pq,ariaLabel:"Ordered list",shortcut:"Ctrl+Shift+7",disabled:c,active:t.isActive("orderedList"),onMouseDown:Rr(()=>t.chain().focus().toggleOrderedList().run()),style:{minWidth:"30px",padding:"4px 6px"}}),S.jsx(nn,{label:qq,ariaLabel:"Blockquote",shortcut:"Ctrl+Shift+B",disabled:c,active:t.isActive("blockquote"),onMouseDown:Rr(()=>t.chain().focus().toggleBlockquote().run()),style:{minWidth:"30px",padding:"4px 6px"}}),S.jsx("div",{style:{width:"1px",height:"16px",background:"var(--tandem-border)",margin:"0 2px"}}),S.jsx(nn,{label:$q,ariaLabel:"Link",shortcut:"Ctrl+K",disabled:c||!t.isActive("link")&&t.state.selection.from===t.state.selection.to,active:t.isActive("link"),onMouseDown:Rr(()=>{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"}}),S.jsx(nn,{label:"—",ariaLabel:"Horizontal rule",disabled:c,onMouseDown:Rr(()=>t.chain().focus().setHorizontalRule().run()),style:{minWidth:"30px"}}),S.jsx(nn,{label:Fq,ariaLabel:"Code block",disabled:c,active:t.isActive("codeBlock"),onMouseDown:Rr(()=>t.chain().focus().toggleCodeBlock().run()),style:{minWidth:"30px",padding:"4px 6px"}})]})}const Jq=[{value:"yellow",label:"Yellow"},{value:"red",label:"Red"},{value:"green",label:"Green"},{value:"blue",label:"Blue"},{value:"purple",label:"Purple"}];function Xq({disabled:t,onHighlight:e}){const[n,r]=M.useState("yellow"),[i,s]=M.useState(!1),l=M.useRef(null);M.useEffect(()=>{if(!i)return;function h(m){l.current&&!l.current.contains(m.target)&&s(!1)}return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[i]);function c(h){h.preventDefault(),e(n)}function u(h){h.preventDefault(),s(m=>!m)}function f(h){r(h),s(!1)}return S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",position:"relative"},children:[S.jsx(nn,{label:"Highlight",disabled:t,disabledTitle:"Select text first",onMouseDown:c,style:{borderRadius:"4px 0 0 4px",borderRight:"none"}}),S.jsx("button",{disabled:t,onMouseDown:u,title:"Choose highlight color",style:{padding:"4px 6px",fontSize:"13px",border:"1px solid var(--tandem-border)",borderRadius:"0 4px 4px 0",background:t?"var(--tandem-surface-muted)":"var(--tandem-surface)",cursor:t?"not-allowed":"pointer",display:"flex",alignItems:"center"},children:S.jsx("span",{style:{display:"inline-block",width:"12px",height:"12px",borderRadius:"2px",background:Ou[n],border:"1px solid rgba(0,0,0,0.15)"}})}),i&&S.jsxs("div",{ref:l,style:{position:"absolute",top:"100%",left:0,marginTop:"4px",background:"var(--tandem-surface)",border:"1px solid var(--tandem-border)",borderRadius:"6px",padding:"6px",display:"flex",gap:"4px",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[Jq.map(({value:h,label:m})=>S.jsx("button",{title:m,onClick:()=>f(h),style:{width:"24px",height:"24px",borderRadius:"4px",border:h===n?"2px solid var(--tandem-fg)":"1px solid rgba(0,0,0,0.15)",background:Ou[h],cursor:"pointer",padding:0}},h)),S.jsx("button",{"data-testid":"color-picker-close",title:"Close",onClick:()=>s(!1),style:{width:"24px",height:"24px",borderRadius:"4px",border:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)",cursor:"pointer",padding:0,fontSize:"13px",color:"var(--tandem-fg-muted)",display:"flex",alignItems:"center",justifyContent:"center"},children:"✕"})]})]})}function Qq({inputRef:t,value:e,onChange:n,onKeyDown:r,onSubmit:i,onCancel:s,placeholder:l,submitLabel:c,borderColor:u,canSubmit:f,secondaryInput:h}){return S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[S.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 ${u}`,borderRadius:"4px",outline:"none",minWidth:"120px",flex:"1 1 200px",background:"var(--tandem-surface)",color:"var(--tandem-fg)"}}),h,S.jsx(nn,{label:c,disabled:!f,onClick:i}),S.jsx(nn,{label:"Cancel",disabled:!1,onClick:s})]})}function eK({tandemMode:t,onModeChange:e}){return S.jsxs("div",{"data-testid":"mode-toggle",role:"group","aria-label":"Claude collaboration mode",style:{display:"flex",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",overflow:"hidden"},children:[S.jsxs("button",{"data-testid":"mode-solo-btn",title:"Write undisturbed — Claude only responds when you message","aria-pressed":t==="solo",onClick:()=>e("solo"),style:{padding:"3px 10px",fontSize:"12px",border:"none",cursor:"pointer",background:t==="solo"?"var(--tandem-accent)":"transparent",color:t==="solo"?"var(--tandem-accent-fg)":"var(--tandem-fg-muted)",fontWeight:t==="solo"?600:400,borderRight:"1px solid var(--tandem-border-strong)",display:"flex",alignItems:"center",gap:"5px"},children:[t==="solo"&&S.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--tandem-fg-subtle)",display:"inline-block"}}),"Solo"]}),S.jsxs("button",{"data-testid":"mode-tandem-btn",title:"Full collaboration — Claude reacts to selections and document changes","aria-pressed":t==="tandem",onClick:()=>e("tandem"),style:{padding:"3px 10px",fontSize:"12px",border:"none",cursor:"pointer",background:t==="tandem"?"var(--tandem-accent)":"transparent",color:t==="tandem"?"var(--tandem-accent-fg)":"var(--tandem-fg-muted)",fontWeight:t==="tandem"?600:400,display:"flex",alignItems:"center",gap:"5px"},children:[t==="tandem"&&S.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--tandem-success)",display:"inline-block"}}),"Tandem"]})]})}function tK({editor:t,ydoc:e,onSettingsOpen:n,settingsBtnRef:r,tandemMode:i,onModeChange:s,heldCount:l}){const[c,u]=M.useState(!1),[f,h]=M.useState("idle"),[m,g]=M.useState(""),b=M.useRef(null),v=M.useRef(null);M.useEffect(()=>{if(!t)return;const re=t;function ie(){const{from:ye,to:ae}=re.state.selection,H=ye!==ae;u(N=>N===H?N:H)}return t.on("selectionUpdate",ie),()=>{t.off("selectionUpdate",ie)}},[t]),M.useEffect(()=>{f==="comment"&&v.current&&v.current.focus()},[f]);function k(re,ie,ye){if(!t||!e)return;const ae=b.current??t.state.selection,{from:H,to:N}=ae;if(H===N)return;const K=La(t.state.doc,br(H)),he=La(t.state.doc,br(N)),_e=FI(),O={id:_e,author:"user",type:re,range:{from:K,to:he},content:ie,status:"pending",timestamp:Date.now(),...ye!=null&&ye.color?{color:ye.color}:{}};e.getMap(Aa).set(_e,O),b.current=null}function C(){if(!t)return;const{from:re,to:ie}=t.state.selection;b.current={from:re,to:ie}}function E(){b.current=null,t==null||t.chain().focus().run()}const L=f!=="idle";function j(re){k("highlight","",{color:re})}const Y=M.useCallback(re=>ie=>{ie.preventDefault(),C(),h(re),g("")},[t]),V=M.useMemo(()=>Y("comment"),[Y]);function R(){h("idle"),g(""),E()}function B(){if(!m.trim()){R();return}k("comment",m.trim()),h("idle"),g(""),t==null||t.chain().focus().run()}function te(re){re.key==="Enter"?(re.preventDefault(),B()):re.key==="Escape"&&R()}function W(re){re.preventDefault(),k("flag","")}const oe=t&&e&&c;return S.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px",minHeight:"42px",padding:"8px 16px",borderBottom:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)",userSelect:"none"},children:[S.jsx("span",{style:{fontWeight:700,fontSize:"15px",color:"var(--tandem-accent)",letterSpacing:"-0.02em"},children:"Tandem"}),S.jsx("div",{style:{width:"1px",height:"20px",background:"var(--tandem-border)",margin:"0 8px"}}),S.jsx(Zq,{editor:t,disabled:L}),S.jsx("div",{style:{width:"1px",height:"20px",background:"var(--tandem-border)",margin:"0 8px"}}),S.jsx(Xq,{disabled:!oe||L,onHighlight:j}),S.jsx(nn,{label:"Comment",disabled:!oe||L,disabledTitle:"Select text first",onMouseDown:V}),f==="comment"&&S.jsx(Qq,{inputRef:v,value:m,onChange:g,onKeyDown:te,onSubmit:B,onCancel:R,placeholder:"Add a comment...",submitLabel:"Add",borderColor:"var(--tandem-author-user)",canSubmit:!!m.trim()}),S.jsx(nn,{label:"Flag",disabled:!oe||L,onMouseDown:W}),S.jsx("div",{style:{flex:1}}),S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[(l??0)>0&&S.jsxs("span",{"data-testid":"held-badge",style:{padding:"1px 6px",fontSize:"10px",fontWeight:600,color:"var(--tandem-warning-fg-strong)",background:"var(--tandem-warning-bg)",borderRadius:"9999px"},children:[l," held"]}),i&&s&&S.jsx(eK,{tandemMode:i,onModeChange:s}),n&&S.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 var(--tandem-border-strong)",borderRadius:"4px",cursor:"pointer",color:"var(--tandem-fg-muted)",fontSize:"13px",padding:"4px 12px",minHeight:"24px"},children:"Settings"})]})]})}function nK(t){const[e,n]=M.useState(!1),[r,i]=M.useState(!1);return M.useEffect(()=>{if(t==null){n(!1),i(!1);return}const s=Date.now()-t,l=Qz-s;if(l<=0){n(!0);return}const c=setTimeout(()=>n(!0),l);return()=>clearTimeout(c)},[t]),{showBanner:e&&!r,dismiss:()=>i(!0)}}const e2=200,t2=600,n2=300;function hh(t){const e=pM[t];try{const n=localStorage.getItem(e);if(n){const r=parseInt(n,10);if(Number.isFinite(r))return Math.max(e2,Math.min(t2,r));console.warn(`[tandem] ignoring non-numeric panel width for ${e}: ${n}`)}}catch(n){console.warn(`[tandem] localStorage unavailable reading ${e}:`,n)}return n2}function rK({panelLayout:t,setPanelLayout:e}){const n=M.useRef(t);n.current=t;const r=M.useRef(null);return M.useEffect(()=>()=>{r.current&&(document.removeEventListener("mousemove",r.current.move),document.removeEventListener("mouseup",r.current.up),document.body.style.userSelect="",document.body.style.cursor="")},[]),{handleResizeStart:M.useCallback((s,l)=>{s.preventDefault();const c=s.clientX,u=n.current;let f;l==="left"?f=u.kind==="three-panel"?u.left:n2:f=u.right;const h=pM[l];let m=f;document.body.style.userSelect="none",document.body.style.cursor="col-resize";const g=v=>{const k=v.clientX-c,C=l==="left"?f+k:f-k;m=Math.max(e2,Math.min(t2,C)),e(E=>l==="right"?E.kind==="three-panel"?{...E,right:m}:{kind:"tabbed",right:m}:E.kind!=="three-panel"?E:{...E,left:m})},b=()=>{document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",b),r.current=null,document.body.style.userSelect="",document.body.style.cursor="";try{localStorage.setItem(h,String(m))}catch(v){console.warn(`[tandem] failed to persist ${h}:`,v)}};r.current={move:g,up:b},document.addEventListener("mousemove",g),document.addEventListener("mouseup",b)},[e])}}function iK(){const[t,e]=M.useState(!1),n=M.useCallback(s=>{s.dataTransfer.types.includes("Files")&&(s.preventDefault(),e(!0))},[]),r=M.useCallback(s=>{(s.currentTarget===s.target||!s.currentTarget.contains(s.relatedTarget))&&e(!1)},[]),i=M.useCallback(async s=>{if(e(!1),!s.dataTransfer.files.length)return;s.preventDefault();const l=s.dataTransfer.files[0],c=await L_(l);try{const u=await fetch(`${rl}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:l.name,content:c})});if(!u.ok){const f=await u.json().catch(()=>({message:"Upload failed"}));console.error("[useFileDrop] Upload failed:",u.status,f.message??f.error)}}catch{console.error("[useFileDrop] Server unreachable — file drop ignored")}},[]);return{fileDragOver:t,handleEditorDragOver:n,handleEditorDragLeave:r,handleEditorDrop:i}}function sK(t,e){return t.status!=="pending"||e==="tandem"?!0:t.author!=="claude"}function oK(t,e){return M.useMemo(()=>{const n=[];let r=0;for(const i of t)sK(i,e)?n.push(i):i.status==="pending"&&r++;return{visibleAnnotations:n,heldCount:r}},[t,e])}function lK(){const[t,e]=M.useState([]),n=M.useRef(new Map),r=M.useCallback((l,c)=>{const u=n.current.get(l);u&&clearTimeout(u);const f=EC[c]??EC.info,h=setTimeout(()=>{e(m=>m.filter(g=>g.id!==l)),n.current.delete(l)},f);n.current.set(l,h)},[]),i=M.useCallback(l=>{const c=n.current.get(l);c&&(clearTimeout(c),n.current.delete(l))},[]),s=M.useCallback(l=>{e(c=>c.filter(u=>u.id!==l)),i(l)},[i]);return M.useEffect(()=>{const l=`http://localhost:${ud}/api/notify-stream`,c=new EventSource(l);return c.onmessage=u=>{let f;try{f=JSON.parse(u.data)}catch{console.warn("[useNotifications] Malformed SSE data:",u.data);return}e(h=>{if(f.dedupKey){const b=h.findIndex(v=>v.dedupKey===f.dedupKey);if(b!==-1){const v=h[b];i(v.id);const k={...f,count:v.count+1},C=[...h];return C[b]=k,r(k.id,k.severity),C}}const m={...f,count:1},g=[...h,m];for(;g.length>lL;){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 u of n.current.values())clearTimeout(u);n.current.clear()}},[r,i]),{toasts:t,dismiss:s}}function aK(t){const[e,n]=M.useState(!1),[r,i]=M.useState(null),s=M.useRef(0),{pendingCount:l,acceptedCount:c,dismissedCount:u}=M.useMemo(()=>{let h=0,m=0,g=0;for(const b of t)b.status==="pending"?h++:b.status==="accepted"?m++:b.status==="dismissed"&&g++;return{pendingCount:h,acceptedCount:m,dismissedCount:g}},[t]);M.useEffect(()=>{const h=c+u;s.current>0&&l===0&&h>0&&(i({accepted:c,dismissed:u,total:h}),n(!0)),s.current=l},[l,c,u]);const f=M.useCallback(()=>{n(!1)},[]);return{pendingCount:l,showReviewSummary:e,reviewSummaryData:r,dismissReviewSummary:f}}function cK(t){const[e,n]=M.useState(!1),r=M.useRef(!1),i=M.useCallback(async()=>{if(!(!t||r.current)){r.current=!0,n(!0);try{const s=await fetch(`http://localhost:${ud}/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 M.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 uK(t){return t.isComposing||t.code!=="Comma"?!1:t.ctrlKey||t.metaKey}function dK(t){M.useEffect(()=>{const e=n=>{uK(n)&&(n.preventDefault(),t())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t])}function fK(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 hK(t,e,n){const r=M.useRef(t);r.current=t;const i=M.useRef(e);i.current=e,M.useEffect(()=>{const s=l=>{if(!l.ctrlKey&&!l.metaKey||l.key!=="Tab")return;const c=fK(r.current,i.current,l.shiftKey);c&&(l.preventDefault(),n(c))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n])}function UA(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 pK(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 u=[...s];u.splice(l,1);const f=u.indexOf(n),h=i==="right"?f+1:f;return u.splice(h,0,e),u}function mK(t){const[e,n]=M.useState([]),r=M.useMemo(()=>{const l=new Map(t.map(f=>[f.id,f])),c=t.map(f=>f.id);return UA(e,c).map(f=>l.get(f)).filter(Boolean)},[t,e]),i=M.useMemo(()=>t.map(l=>l.id),[t]);M.useEffect(()=>{n(l=>{const c=UA(l,i);return l.length===c.length&&l.every((u,f)=>u===c[f])?l:c})},[i]);const s=M.useCallback(function(c,u,f="left"){if(c===u)return;const h=new Set(i);n(m=>pK(m,c,u,h,f))},[i]);return{orderedTabs:r,reorder:s}}var st;(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})(st||(st={}));var HA;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(HA||(HA={}));const Se=st.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Fs=t=>{switch(typeof t){case"undefined":return Se.undefined;case"string":return Se.string;case"number":return Number.isNaN(t)?Se.nan:Se.number;case"boolean":return Se.boolean;case"function":return Se.function;case"bigint":return Se.bigint;case"symbol":return Se.symbol;case"object":return Array.isArray(t)?Se.array:t===null?Se.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Se.promise:typeof Map<"u"&&t instanceof Map?Se.map:typeof Set<"u"&&t instanceof Set?Se.set:typeof Date<"u"&&t instanceof Date?Se.date:Se.object;default:return Se.unknown}},ue=st.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 cs 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,u=0;for(;u<l.path.length;){const f=l.path[u];u===l.path.length-1?(c[f]=c[f]||{_errors:[]},c[f]._errors.push(n(l))):c[f]=c[f]||{_errors:[]},c=c[f],u++}}};return i(this),r}static assert(e){if(!(e instanceof cs))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,st.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()}}cs.create=t=>new cs(t);const bx=(t,e)=>{let n;switch(t.code){case ue.invalid_type:t.received===Se.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ue.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,st.jsonStringifyReplacer)}`;break;case ue.unrecognized_keys:n=`Unrecognized key(s) in object: ${st.joinValues(t.keys,", ")}`;break;case ue.invalid_union:n="Invalid input";break;case ue.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${st.joinValues(t.options)}`;break;case ue.invalid_enum_value:n=`Invalid enum value. Expected ${st.joinValues(t.options)}, received '${t.received}'`;break;case ue.invalid_arguments:n="Invalid function arguments";break;case ue.invalid_return_type:n="Invalid function return type";break;case ue.invalid_date:n="Invalid date";break;case ue.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}"`:st.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ue.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 ue.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 ue.custom:n="Invalid input";break;case ue.invalid_intersection_types:n="Intersection results could not be merged";break;case ue.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ue.not_finite:n="Number must be finite";break;default:n=e.defaultError,st.assertNever(t)}return{message:n}};let gK=bx;function yK(){return gK}const bK=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 u=r.filter(f=>!!f).slice().reverse();for(const f of u)c=f(l,{data:e,defaultError:c}).message;return{...i,path:s,message:c}};function ge(t,e){const n=yK(),r=bK({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===bx?void 0:bx].filter(i=>!!i)});t.common.issues.push(r)}class xr{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 je;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 xr.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 je;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 je=Object.freeze({status:"aborted"}),au=t=>({status:"dirty",value:t}),$r=t=>({status:"valid",value:t}),VA=t=>t.status==="aborted",PA=t=>t.status==="dirty",Ha=t=>t.status==="valid",Vp=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 co{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 $A=(t,e)=>{if(Ha(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 cs(t.common.issues);return this._error=n,this._error}}};function Ke(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:u}=t;return l.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:u??r??c.defaultError}:l.code!=="invalid_type"?{message:c.defaultError}:{message:u??n??c.defaultError}},description:i}}class et{get description(){return this._def.description}_getType(e){return Fs(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Fs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new xr,ctx:{common:e.parent.common,data:e.data,parsedType:Fs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Vp(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:Fs(e)},i=this._parseSync({data:e,path:r.path,parent:r});return $A(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:Fs(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:n});return Ha(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=>Ha(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:Fs(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(Vp(i)?i:Promise.resolve(i));return $A(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:ue.custom,...r(i)});return typeof Promise<"u"&&l instanceof Promise?l.then(u=>u?!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 Pa({schema:this,typeName:Ie.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 ro.create(this,this._def)}nullable(){return $a.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xi.create(this)}promise(){return qp.create(this,this._def)}or(e){return $p.create([this,e],this._def)}and(e){return Fp.create(this,e,this._def)}transform(e){return new Pa({...Ke(this._def),schema:this,typeName:Ie.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new vx({...Ke(this._def),innerType:this,defaultValue:n,typeName:Ie.ZodDefault})}brand(){return new VK({typeName:Ie.ZodBranded,type:this,...Ke(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Sx({...Ke(this._def),innerType:this,catchValue:n,typeName:Ie.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return cv.create(this,e)}readonly(){return wx.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const xK=/^c[^\s-]{8,}$/i,vK=/^[0-9a-z]+$/,SK=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wK=/^[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,kK=/^[a-z0-9_-]{21}$/i,CK=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,EK=/^[-+]?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)?)??$/,TK=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,AK="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let nb;const MK=/^(?:(?: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])$/,OK=/^(?:(?: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])$/,_K=/^(([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]))$/,DK=/^(([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])$/,RK=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,NK=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,r2="((\\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])))",zK=new RegExp(`^${r2}$`);function i2(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 LK(t){return new RegExp(`^${i2(t)}$`)}function jK(t){let e=`${r2}T${i2(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 IK(t,e){return!!((e==="v4"||!e)&&MK.test(t)||(e==="v6"||!e)&&_K.test(t))}function BK(t,e){if(!CK.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 UK(t,e){return!!((e==="v4"||!e)&&OK.test(t)||(e==="v6"||!e)&&DK.test(t))}class $o extends et{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Se.string){const s=this._getOrReturnCtx(e);return ge(s,{code:ue.invalid_type,expected:Se.string,received:s.parsedType}),je}const r=new xr;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),ge(i,{code:ue.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),ge(i,{code:ue.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?ge(i,{code:ue.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&ge(i,{code:ue.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")TK.test(e.data)||(i=this._getOrReturnCtx(e,i),ge(i,{validation:"email",code:ue.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")nb||(nb=new RegExp(AK,"u")),nb.test(e.data)||(i=this._getOrReturnCtx(e,i),ge(i,{validation:"emoji",code:ue.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")wK.test(e.data)||(i=this._getOrReturnCtx(e,i),ge(i,{validation:"uuid",code:ue.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")kK.test(e.data)||(i=this._getOrReturnCtx(e,i),ge(i,{validation:"nanoid",code:ue.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")xK.test(e.data)||(i=this._getOrReturnCtx(e,i),ge(i,{validation:"cuid",code:ue.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")vK.test(e.data)||(i=this._getOrReturnCtx(e,i),ge(i,{validation:"cuid2",code:ue.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")SK.test(e.data)||(i=this._getOrReturnCtx(e,i),ge(i,{validation:"ulid",code:ue.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),ge(i,{validation:"url",code:ue.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),ge(i,{validation:"regex",code:ue.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),ge(i,{code:ue.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),ge(i,{code:ue.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),ge(i,{code:ue.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?jK(s).test(e.data)||(i=this._getOrReturnCtx(e,i),ge(i,{code:ue.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?zK.test(e.data)||(i=this._getOrReturnCtx(e,i),ge(i,{code:ue.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?LK(s).test(e.data)||(i=this._getOrReturnCtx(e,i),ge(i,{code:ue.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?EK.test(e.data)||(i=this._getOrReturnCtx(e,i),ge(i,{validation:"duration",code:ue.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?IK(e.data,s.version)||(i=this._getOrReturnCtx(e,i),ge(i,{validation:"ip",code:ue.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?BK(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),ge(i,{validation:"jwt",code:ue.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?UK(e.data,s.version)||(i=this._getOrReturnCtx(e,i),ge(i,{validation:"cidr",code:ue.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?RK.test(e.data)||(i=this._getOrReturnCtx(e,i),ge(i,{validation:"base64",code:ue.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?NK.test(e.data)||(i=this._getOrReturnCtx(e,i),ge(i,{validation:"base64url",code:ue.invalid_string,message:s.message}),r.dirty()):st.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:ue.invalid_string,...Ce.errToObj(r)})}_addCheck(e){return new $o({...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 $o({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new $o({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new $o({...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}}$o.create=t=>new $o({checks:[],typeName:Ie.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Ke(t)});function HK(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 id extends et{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)!==Se.number){const s=this._getOrReturnCtx(e);return ge(s,{code:ue.invalid_type,expected:Se.number,received:s.parsedType}),je}let r;const i=new xr;for(const s of this._def.checks)s.kind==="int"?st.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ge(r,{code:ue.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),ge(r,{code:ue.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),ge(r,{code:ue.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?HK(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),ge(r,{code:ue.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ge(r,{code:ue.not_finite,message:s.message}),i.dirty()):st.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 id({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ce.toString(i)}]})}_addCheck(e){return new id({...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"&&st.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)}}id.create=t=>new id({checks:[],typeName:Ie.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Ke(t)});class sd extends et{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)!==Se.bigint)return this._getInvalidInput(e);let r;const i=new xr;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),ge(r,{code:ue.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),ge(r,{code:ue.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),ge(r,{code:ue.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):st.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return ge(n,{code:ue.invalid_type,expected:Se.bigint,received:n.parsedType}),je}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 sd({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ce.toString(i)}]})}_addCheck(e){return new sd({...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}}sd.create=t=>new sd({checks:[],typeName:Ie.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Ke(t)});class FA extends et{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Se.boolean){const r=this._getOrReturnCtx(e);return ge(r,{code:ue.invalid_type,expected:Se.boolean,received:r.parsedType}),je}return $r(e.data)}}FA.create=t=>new FA({typeName:Ie.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Ke(t)});class Pp extends et{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Se.date){const s=this._getOrReturnCtx(e);return ge(s,{code:ue.invalid_type,expected:Se.date,received:s.parsedType}),je}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return ge(s,{code:ue.invalid_date}),je}const r=new xr;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),ge(i,{code:ue.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),ge(i,{code:ue.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):st.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Pp({...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}}Pp.create=t=>new Pp({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Ie.ZodDate,...Ke(t)});class qA extends et{_parse(e){if(this._getType(e)!==Se.symbol){const r=this._getOrReturnCtx(e);return ge(r,{code:ue.invalid_type,expected:Se.symbol,received:r.parsedType}),je}return $r(e.data)}}qA.create=t=>new qA({typeName:Ie.ZodSymbol,...Ke(t)});class KA extends et{_parse(e){if(this._getType(e)!==Se.undefined){const r=this._getOrReturnCtx(e);return ge(r,{code:ue.invalid_type,expected:Se.undefined,received:r.parsedType}),je}return $r(e.data)}}KA.create=t=>new KA({typeName:Ie.ZodUndefined,...Ke(t)});class YA extends et{_parse(e){if(this._getType(e)!==Se.null){const r=this._getOrReturnCtx(e);return ge(r,{code:ue.invalid_type,expected:Se.null,received:r.parsedType}),je}return $r(e.data)}}YA.create=t=>new YA({typeName:Ie.ZodNull,...Ke(t)});class WA extends et{constructor(){super(...arguments),this._any=!0}_parse(e){return $r(e.data)}}WA.create=t=>new WA({typeName:Ie.ZodAny,...Ke(t)});class GA extends et{constructor(){super(...arguments),this._unknown=!0}_parse(e){return $r(e.data)}}GA.create=t=>new GA({typeName:Ie.ZodUnknown,...Ke(t)});class uo extends et{_parse(e){const n=this._getOrReturnCtx(e);return ge(n,{code:ue.invalid_type,expected:Se.never,received:n.parsedType}),je}}uo.create=t=>new uo({typeName:Ie.ZodNever,...Ke(t)});class ZA extends et{_parse(e){if(this._getType(e)!==Se.undefined){const r=this._getOrReturnCtx(e);return ge(r,{code:ue.invalid_type,expected:Se.void,received:r.parsedType}),je}return $r(e.data)}}ZA.create=t=>new ZA({typeName:Ie.ZodVoid,...Ke(t)});class xi extends et{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==Se.array)return ge(n,{code:ue.invalid_type,expected:Se.array,received:n.parsedType}),je;if(i.exactLength!==null){const l=n.data.length>i.exactLength.value,c=n.data.length<i.exactLength.value;(l||c)&&(ge(n,{code:l?ue.too_big:ue.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&&(ge(n,{code:ue.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&&(ge(n,{code:ue.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 co(n,l,n.path,c)))).then(l=>xr.mergeArray(r,l));const s=[...n.data].map((l,c)=>i.type._parseSync(new co(n,l,n.path,c)));return xr.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new xi({...this._def,minLength:{value:e,message:Ce.toString(n)}})}max(e,n){return new xi({...this._def,maxLength:{value:e,message:Ce.toString(n)}})}length(e,n){return new xi({...this._def,exactLength:{value:e,message:Ce.toString(n)}})}nonempty(e){return this.min(1,e)}}xi.create=(t,e)=>new xi({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ie.ZodArray,...Ke(e)});function da(t){if(t instanceof Jt){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=ro.create(da(r))}return new Jt({...t._def,shape:()=>e})}else return t instanceof xi?new xi({...t._def,type:da(t.element)}):t instanceof ro?ro.create(da(t.unwrap())):t instanceof $a?$a.create(da(t.unwrap())):t instanceof dl?dl.create(t.items.map(e=>da(e))):t}class Jt extends et{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=st.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Se.object){const f=this._getOrReturnCtx(e);return ge(f,{code:ue.invalid_type,expected:Se.object,received:f.parsedType}),je}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:l}=this._getCached(),c=[];if(!(this._def.catchall instanceof uo&&this._def.unknownKeys==="strip"))for(const f in i.data)l.includes(f)||c.push(f);const u=[];for(const f of l){const h=s[f],m=i.data[f];u.push({key:{status:"valid",value:f},value:h._parse(new co(i,m,i.path,f)),alwaysSet:f in i.data})}if(this._def.catchall instanceof uo){const f=this._def.unknownKeys;if(f==="passthrough")for(const h of c)u.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(f==="strict")c.length>0&&(ge(i,{code:ue.unrecognized_keys,keys:c}),r.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const h of c){const m=i.data[h];u.push({key:{status:"valid",value:h},value:f._parse(new co(i,m,i.path,h)),alwaysSet:h in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const f=[];for(const h of u){const m=await h.key,g=await h.value;f.push({key:m,value:g,alwaysSet:h.alwaysSet})}return f}).then(f=>xr.mergeObjectSync(r,f)):xr.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return Ce.errToObj,new Jt({...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 Jt({...this._def,unknownKeys:"strip"})}passthrough(){return new Jt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Jt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Jt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ie.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Jt({...this._def,catchall:e})}pick(e){const n={};for(const r of st.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Jt({...this._def,shape:()=>n})}omit(e){const n={};for(const r of st.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new Jt({...this._def,shape:()=>n})}deepPartial(){return da(this)}partial(e){const n={};for(const r of st.objectKeys(this.shape)){const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new Jt({...this._def,shape:()=>n})}required(e){const n={};for(const r of st.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof ro;)s=s._def.innerType;n[r]=s}return new Jt({...this._def,shape:()=>n})}keyof(){return s2(st.objectKeys(this.shape))}}Jt.create=(t,e)=>new Jt({shape:()=>t,unknownKeys:"strip",catchall:uo.create(),typeName:Ie.ZodObject,...Ke(e)});Jt.strictCreate=(t,e)=>new Jt({shape:()=>t,unknownKeys:"strict",catchall:uo.create(),typeName:Ie.ZodObject,...Ke(e)});Jt.lazycreate=(t,e)=>new Jt({shape:t,unknownKeys:"strip",catchall:uo.create(),typeName:Ie.ZodObject,...Ke(e)});class $p extends et{_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 cs(c.ctx.common.issues));return ge(n,{code:ue.invalid_union,unionErrors:l}),je}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 u of r){const f={...n,common:{...n.common,issues:[]},parent:null},h=u._parseSync({data:n.data,path:n.path,parent:f});if(h.status==="valid")return h;h.status==="dirty"&&!s&&(s={result:h,ctx:f}),f.common.issues.length&&l.push(f.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const c=l.map(u=>new cs(u));return ge(n,{code:ue.invalid_union,unionErrors:c}),je}}get options(){return this._def.options}}$p.create=(t,e)=>new $p({options:t,typeName:Ie.ZodUnion,...Ke(e)});function xx(t,e){const n=Fs(t),r=Fs(e);if(t===e)return{valid:!0,data:t};if(n===Se.object&&r===Se.object){const i=st.objectKeys(e),s=st.objectKeys(t).filter(c=>i.indexOf(c)!==-1),l={...t,...e};for(const c of s){const u=xx(t[c],e[c]);if(!u.valid)return{valid:!1};l[c]=u.data}return{valid:!0,data:l}}else if(n===Se.array&&r===Se.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],u=xx(l,c);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return n===Se.date&&r===Se.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Fp extends et{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(s,l)=>{if(VA(s)||VA(l))return je;const c=xx(s.value,l.value);return c.valid?((PA(s)||PA(l))&&n.dirty(),{status:n.value,value:c.data}):(ge(r,{code:ue.invalid_intersection_types}),je)};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}))}}Fp.create=(t,e,n)=>new Fp({left:t,right:e,typeName:Ie.ZodIntersection,...Ke(n)});class dl extends et{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Se.array)return ge(r,{code:ue.invalid_type,expected:Se.array,received:r.parsedType}),je;if(r.data.length<this._def.items.length)return ge(r,{code:ue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),je;!this._def.rest&&r.data.length>this._def.items.length&&(ge(r,{code:ue.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((l,c)=>{const u=this._def.items[c]||this._def.rest;return u?u._parse(new co(r,l,r.path,c)):null}).filter(l=>!!l);return r.common.async?Promise.all(s).then(l=>xr.mergeArray(n,l)):xr.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new dl({...this._def,rest:e})}}dl.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new dl({items:t,typeName:Ie.ZodTuple,rest:null,...Ke(e)})};class JA extends et{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!==Se.map)return ge(r,{code:ue.invalid_type,expected:Se.map,received:r.parsedType}),je;const i=this._def.keyType,s=this._def.valueType,l=[...r.data.entries()].map(([c,u],f)=>({key:i._parse(new co(r,c,r.path,[f,"key"])),value:s._parse(new co(r,u,r.path,[f,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const u of l){const f=await u.key,h=await u.value;if(f.status==="aborted"||h.status==="aborted")return je;(f.status==="dirty"||h.status==="dirty")&&n.dirty(),c.set(f.value,h.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const u of l){const f=u.key,h=u.value;if(f.status==="aborted"||h.status==="aborted")return je;(f.status==="dirty"||h.status==="dirty")&&n.dirty(),c.set(f.value,h.value)}return{status:n.value,value:c}}}}JA.create=(t,e,n)=>new JA({valueType:e,keyType:t,typeName:Ie.ZodMap,...Ke(n)});class od extends et{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Se.set)return ge(r,{code:ue.invalid_type,expected:Se.set,received:r.parsedType}),je;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(ge(r,{code:ue.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&&(ge(r,{code:ue.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(u){const f=new Set;for(const h of u){if(h.status==="aborted")return je;h.status==="dirty"&&n.dirty(),f.add(h.value)}return{status:n.value,value:f}}const c=[...r.data.values()].map((u,f)=>s._parse(new co(r,u,r.path,f)));return r.common.async?Promise.all(c).then(u=>l(u)):l(c)}min(e,n){return new od({...this._def,minSize:{value:e,message:Ce.toString(n)}})}max(e,n){return new od({...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)}}od.create=(t,e)=>new od({valueType:t,minSize:null,maxSize:null,typeName:Ie.ZodSet,...Ke(e)});class XA extends et{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})}}XA.create=(t,e)=>new XA({getter:t,typeName:Ie.ZodLazy,...Ke(e)});class QA extends et{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ge(n,{received:n.data,code:ue.invalid_literal,expected:this._def.value}),je}return{status:"valid",value:e.data}}get value(){return this._def.value}}QA.create=(t,e)=>new QA({value:t,typeName:Ie.ZodLiteral,...Ke(e)});function s2(t,e){return new Va({values:t,typeName:Ie.ZodEnum,...Ke(e)})}class Va extends et{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return ge(n,{expected:st.joinValues(r),received:n.parsedType,code:ue.invalid_type}),je}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 ge(n,{received:n.data,code:ue.invalid_enum_value,options:r}),je}return $r(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 Va.create(e,{...this._def,...n})}exclude(e,n=this._def){return Va.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Va.create=s2;class eM extends et{_parse(e){const n=st.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Se.string&&r.parsedType!==Se.number){const i=st.objectValues(n);return ge(r,{expected:st.joinValues(i),received:r.parsedType,code:ue.invalid_type}),je}if(this._cache||(this._cache=new Set(st.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=st.objectValues(n);return ge(r,{received:r.data,code:ue.invalid_enum_value,options:i}),je}return $r(e.data)}get enum(){return this._def.values}}eM.create=(t,e)=>new eM({values:t,typeName:Ie.ZodNativeEnum,...Ke(e)});class qp extends et{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Se.promise&&n.common.async===!1)return ge(n,{code:ue.invalid_type,expected:Se.promise,received:n.parsedType}),je;const r=n.parsedType===Se.promise?n.data:Promise.resolve(n.data);return $r(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}qp.create=(t,e)=>new qp({type:t,typeName:Ie.ZodPromise,...Ke(e)});class Pa extends et{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ie.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=>{ge(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 je;const u=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return u.status==="aborted"?je:u.status==="dirty"||n.value==="dirty"?au(u.value):u});{if(n.value==="aborted")return je;const c=this._def.schema._parseSync({data:l,path:r.path,parent:r});return c.status==="aborted"?je:c.status==="dirty"||n.value==="dirty"?au(c.value):c}}if(i.type==="refinement"){const l=c=>{const u=i.refinement(c,s);if(r.common.async)return Promise.resolve(u);if(u 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"?je:(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"?je:(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(!Ha(l))return je;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=>Ha(l)?Promise.resolve(i.transform(l.value,s)).then(c=>({status:n.value,value:c})):je);st.assertNever(i)}}Pa.create=(t,e,n)=>new Pa({schema:t,typeName:Ie.ZodEffects,effect:e,...Ke(n)});Pa.createWithPreprocess=(t,e,n)=>new Pa({schema:e,effect:{type:"preprocess",transform:t},typeName:Ie.ZodEffects,...Ke(n)});class ro extends et{_parse(e){return this._getType(e)===Se.undefined?$r(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ro.create=(t,e)=>new ro({innerType:t,typeName:Ie.ZodOptional,...Ke(e)});class $a extends et{_parse(e){return this._getType(e)===Se.null?$r(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}$a.create=(t,e)=>new $a({innerType:t,typeName:Ie.ZodNullable,...Ke(e)});class vx extends et{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===Se.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}vx.create=(t,e)=>new vx({innerType:t,typeName:Ie.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ke(e)});class Sx extends et{_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 Vp(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new cs(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new cs(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Sx.create=(t,e)=>new Sx({innerType:t,typeName:Ie.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ke(e)});class tM extends et{_parse(e){if(this._getType(e)!==Se.nan){const r=this._getOrReturnCtx(e);return ge(r,{code:ue.invalid_type,expected:Se.nan,received:r.parsedType}),je}return{status:"valid",value:e.data}}}tM.create=t=>new tM({typeName:Ie.ZodNaN,...Ke(t)});class VK extends et{_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 cv extends et{_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"?je:s.status==="dirty"?(n.dirty(),au(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"?je: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 cv({in:e,out:n,typeName:Ie.ZodPipeline})}}class wx extends et{_parse(e){const n=this._def.innerType._parse(e),r=i=>(Ha(i)&&(i.value=Object.freeze(i.value)),i);return Vp(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}wx.create=(t,e)=>new wx({innerType:t,typeName:Ie.ZodReadonly,...Ke(e)});var Ie;(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"})(Ie||(Ie={}));uo.create;xi.create;$p.create;Fp.create;dl.create;const ii=Va.create;qp.create;ro.create;$a.create;ii(["highlight","comment","flag"]);ii(["pending","accepted","dismissed"]);ii(["yellow","red","green","blue","purple"]);ii(["info","warning","error","success"]);const PK=ii(["solo","tandem"]);ii(["user","claude","import"]);ii(["user","claude"]);ii(["accept","dismiss"]);ii(["markdown","json"]);ii(["md","txt","html","docx"]);ii(["RANGE_GONE","RANGE_MOVED","FILE_LOCKED","FILE_NOT_FOUND","NO_DOCUMENT","INVALID_RANGE","FORMAT_ERROR","PERMISSION_DENIED"]);function $K(t,e){const[n,r]=M.useState(()=>{try{const i=localStorage.getItem(Vf),s=PK.safeParse(i);return s.success?s.data:SC}catch(i){return console.warn(`[tandem] localStorage unavailable reading ${Vf}:`,i),SC}});return M.useEffect(()=>{try{localStorage.setItem(Vf,n)}catch(i){console.warn(`[tandem] failed to persist ${Vf}:`,i)}},[n]),M.useEffect(()=>{if(t)try{t.getMap(lb).set(rL,n)}catch(i){console.warn("[tandem] failed to broadcast tandem mode to Y.Map:",i)}},[n,t]),M.useEffect(()=>{if(t)try{t.getMap(lb).set(iL,e)}catch(i){console.warn("[tandem] failed to broadcast dwell ms to Y.Map:",i)}},[e,t]),{tandemMode:n,setTandemMode:r}}const FK={s:14,m:16,l:18};function nM(){try{return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}const ru={layout:"three-panel",primaryTab:"chat",panelOrder:"chat-editor-annotations",editorWidthPercent:50,selectionDwellMs:mM,showAuthorship:!1,reduceMotion:!1,textSize:"m",theme:"system"};function qK(){let t;try{t=localStorage.getItem(hM)}catch{t=null}if(t)try{const e=JSON.parse(t);return{layout:e.layout==="three-panel"||e.layout==="tabbed"?e.layout:ru.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)||ru.editorWidthPercent)),selectionDwellMs:Math.max(Nh,Math.min(zh,Number(e.selectionDwellMs)||mM)),showAuthorship:e.showAuthorship===!0,reduceMotion:typeof e.reduceMotion=="boolean"?e.reduceMotion:nM(),textSize:e.textSize==="s"||e.textSize==="m"||e.textSize==="l"?e.textSize:ru.textSize,theme:e.theme==="light"||e.theme==="dark"||e.theme==="system"?e.theme:ru.theme}}catch(e){console.warn("[tandem] settings JSON is corrupt, resetting to defaults:",e)}return{...ru,reduceMotion:nM()}}function KK(t,e){const n={...t,...e};return{...n,editorWidthPercent:Math.max(50,Math.min(100,n.editorWidthPercent)),selectionDwellMs:Math.max(Nh,Math.min(zh,n.selectionDwellMs))}}function YK(){const[t,e]=M.useState(qK),n=M.useCallback(r=>{e(i=>{const s=KK(i,r);try{localStorage.setItem(hM,JSON.stringify(s)),localStorage.setItem(yM,String(s.showAuthorship))}catch{}return s})},[]);return{settings:t,updateSettings:n}}function o2(){try{return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}function WK(t){return t==="system"?o2():t}function GK(t){const e=document.documentElement;if(e.setAttribute("data-theme",WK(t)),t!=="system")return()=>e.removeAttribute("data-theme");const n=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>e.setAttribute("data-theme",o2());return n.addEventListener("change",r),()=>{n.removeEventListener("change",r),e.removeAttribute("data-theme")}}function ZK(t){M.useEffect(()=>GK(t),[t])}function JK(){try{return localStorage.getItem(vM)==="true"}catch{return!1}}function rM(){try{localStorage.setItem(vM,"true")}catch{}}function XK(t,e,n){const[r,i]=M.useState(JK),[s,l]=M.useState(0),c=M.useRef(0),f=!r&&n==="welcome.md",h=dd(),{status:m,error:g}=AM(h&&f),[b]=M.useState(CM),v=!h||m!==null||g!==null,k=h&&kM(m,b),C=v?k?4:3:1/0;M.useEffect(()=>{if(!f||s!==0)return;const Y=t.filter(R=>R.id.startsWith(aL));if(Y.length===0)return;Y.some(R=>R.status!=="pending")&&(c.current=Date.now(),l(1))},[f,s,t]),M.useEffect(()=>{if(!f||s!==1)return;t.some(V=>V.author==="user")&&(c.current=Date.now(),l(2))},[f,s,t]);const E=e.current;M.useEffect(()=>{if(!f||s!==2||!isFinite(C)||!E)return;const Y=()=>{Date.now()-c.current<2e3||E.isFocused&&(c.current=Date.now(),l(3))};return E.on("update",Y),()=>{E.off("update",Y)}},[f,s,C,E]),M.useEffect(()=>{if(!f||!isFinite(C)||s!==C)return;const Y=setTimeout(()=>{rM(),i(!0)},3e3);return()=>clearTimeout(Y)},[f,s,C]),M.useEffect(()=>{isFinite(C)&&l(Y=>Math.min(Y,C))},[C]);const L=M.useCallback(()=>{rM(),i(!0)},[]),j=M.useCallback(()=>{c.current=Date.now(),l(Y=>Math.min(Y+1,C))},[C]);return{tutorialActive:f,currentStep:s,dismissTutorial:L,nextStep:j,coworkStatus:m}}function QK(){M.useEffect(()=>{let t=!1,e;return Rx(async()=>{const{getCurrentWebview:n}=await import("./webview-BQBJMQvJ.js");return{getCurrentWebview:n}},__vite__mapDeps([0,1])).then(({getCurrentWebview:n})=>{if(t)return;const r=n();let i=Gc;try{const f=localStorage.getItem(TC);if(f!==null){const h=Number(f);Number.isFinite(h)?i=Math.max(AC,Math.min(MC,h)):console.warn(`[tandem] ignoring invalid stored zoom: ${f}`)}}catch{}i!==Gc&&r.setZoom(i).catch(f=>{console.warn("[tandem] failed to restore zoom level:",f)});function s(f){try{localStorage.setItem(TC,String(f))}catch{}}const l=f=>{!(f.metaKey||f.ctrlKey)||f.key!=="0"||(f.preventDefault(),f.stopPropagation(),i=Gc,r.setZoom(Gc).catch(m=>{console.warn("[tandem] failed to reset zoom:",m)}),s(Gc))},c=.1,u=f=>{if(!(f.metaKey||f.ctrlKey))return;const m=f.key==="+"||f.key==="=",g=f.key==="-"||f.key==="_";if(!m&&!g)return;const b=m?i+c:i-c;i=Math.max(AC,Math.min(MC,Math.round(b*100)/100)),s(i)};window.addEventListener("keydown",l,{capture:!0}),window.addEventListener("keydown",u,{capture:!0}),e=()=>{window.removeEventListener("keydown",l,{capture:!0}),window.removeEventListener("keydown",u,{capture:!0})}}).catch(()=>{}),()=>{t=!0,e==null||e()}},[])}const eY=Math.floor,tY=(t,e)=>t<e?t:e,nY=(t,e)=>t>e?t:e,l2=128,Dh=127,rY=Number.MAX_SAFE_INTEGER,iY=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},ld=typeof TextEncoder<"u"?new TextEncoder:null,sY=t=>ld.encode(t),oY=ld?sY:iY;let Eu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Eu&&Eu.decode(new Uint8Array).length===1&&(Eu=null);const 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},_m=(t,e)=>{for(;e>Dh;)Kp(t,l2|Dh&e),e=eY(e/128);Kp(t,Dh&e)},kx=new Uint8Array(3e4),lY=kx.length/3,aY=(t,e)=>{if(e.length<lY){const n=ld.encodeInto(e,kx).written||0;_m(t,n);for(let r=0;r<n;r++)Kp(t,kx[r])}else fY(t,oY(e))},cY=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;_m(t,r);for(let i=0;i<r;i++)Kp(t,n.codePointAt(i))},uY=ld&&ld.encodeInto?aY:cY,dY=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=tY(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(nY(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},fY=(t,e)=>{_m(t,e.byteLength),dY(t,e)},a2=t=>new Error(t),hY=a2("Unexpected end of array"),pY=a2("Integer out of Range"),mY=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},gY=t=>mY(t,uv(t)),iM=t=>t.arr[t.pos++],uv=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<l2)return e;if(e>rY)throw pY}throw hY},yY=t=>{let e=uv(t);if(e===0)return"";{let n=String.fromCodePoint(iM(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(iM(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))}},bY=t=>Eu.decode(gY(t)),sM=Eu?bY:yY;var Ta;(function(t){t[t.Token=0]="Token",t[t.PermissionDenied=1]="PermissionDenied",t[t.Authenticated=2]="Authenticated"})(Ta||(Ta={}));const xY=(t,e)=>{_m(t,Ta.Token),uY(t,e)},vY=(t,e,n,r)=>{switch(uv(t)){case Ta.Token:{e();break}case Ta.PermissionDenied:{n(sM(t));break}case Ta.Authenticated:{r(sM(t));break}}},oM=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n}));var Cx;(function(t){t[t.Connecting=0]="Connecting",t[t.Open=1]="Open",t[t.Closing=2]="Closing",t[t.Closed=3]="Closed"})(Cx||(Cx={}));function SY(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 rb(t){return new Promise(e=>setTimeout(e,t))}function wY(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 kY(t,e){const n=SY(e);for(const c of["delay","initialDelay","minDelay","maxDelay","maxAttempts","timeout"]){const u=n[c];if(!Number.isInteger(u)||u<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||wY;async function s(){if(n.beforeAttempt&&n.beforeAttempt(r,n),r.aborted){const u=new Error("Attempt aborted");throw u.code="ATTEMPT_ABORTED",u}const c=async u=>{if(n.handleError&&await n.handleError(u,r,n),r.aborted||r.attemptsRemaining===0)throw u;r.attemptNum++;const f=i(r,n);return f&&await rb(f),s()};return r.attemptsRemaining>0&&r.attemptsRemaining--,n.timeout?new Promise((u,f)=>{const h=setTimeout(()=>{if(n.handleTimeout)try{u(n.handleTimeout(r,n))}catch(m){f(m)}else{const m=new Error(`Retry timeout (attemptNum: ${r.attemptNum}, timeout: ${n.timeout})`);m.code="ATTEMPT_TIMEOUT",f(m)}},n.timeout);t(r,n).then(m=>{clearTimeout(h),u(m)}).catch(m=>{clearTimeout(h),c(m).then(u).catch(f)})}):t(r,n).catch(c)}const l=n.calculateDelay?n.calculateDelay(r,n):n.initialDelay;if(l&&await rb(l),r.attemptNum<1&&n.initialJitter){const c=i(r,n);c&&await rb(c)}return s()}const c2=Math.floor,CY=(t,e)=>t<e?t:e,EY=(t,e)=>t>e?t:e,TY=64,Yp=128,AY=63,Tu=127,u2=Number.MAX_SAFE_INTEGER,MY=()=>new Set,OY=Array.from,_Y=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},ad=typeof TextEncoder<"u"?new TextEncoder:null,DY=t=>ad.encode(t),RY=ad?DY:_Y;let Au=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Au&&Au.decode(new Uint8Array).length===1&&(Au=null);class NY{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const dv=()=>new NY,d2=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},fv=t=>{const e=new Uint8Array(d2(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},Wp=(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},On=(t,e)=>{for(;e>Tu;)Wp(t,Yp|Tu&e),e=c2(e/128);Wp(t,Tu&e)},Ex=new Uint8Array(3e4),zY=Ex.length/3,LY=(t,e)=>{if(e.length<zY){const n=ad.encodeInto(e,Ex).written||0;On(t,n);for(let r=0;r<n;r++)Wp(t,Ex[r])}else tc(t,RY(e))},jY=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;On(t,r);for(let i=0;i<r;i++)Wp(t,n.codePointAt(i))},us=ad&&ad.encodeInto?LY:jY,IY=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=CY(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(EY(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},tc=(t,e)=>{On(t,e.byteLength),IY(t,e)},f2=t=>new Error(t),h2=f2("Unexpected end of array"),p2=f2("Integer out of Range");class BY{constructor(e){this.arr=e,this.pos=0}}const m2=t=>new BY(t),UY=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},Dm=t=>UY(t,Jo(t)),lM=t=>t.arr[t.pos++],Jo=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&Tu)*n,n*=128,i<Yp)return e;if(e>u2)throw p2}throw h2},HY=t=>{let e=t.arr[t.pos++],n=e&AY,r=64;const i=(e&TY)>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&Tu)*r,r*=128,e<Yp)return i*n;if(n>u2)throw p2}throw h2},VY=t=>{let e=Jo(t);if(e===0)return"";{let n=String.fromCodePoint(lM(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(lM(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))}},PY=t=>Au.decode(Dm(t)),cd=Au?PY:VY,$Y=t=>{const e=t.pos,n=cd(t);return t.pos=e,n},Fa=Date.now,ib=()=>new Map,FY=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r};class qY{constructor(){this._observers=ib()}on(e,n){FY(this._observers,e,MY).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 OY((this._observers.get(e)||ib()).values()).forEach(r=>r(...n))}destroy(){this._observers=ib()}}const KY=Object.keys,aM=t=>KY(t).length,YY=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),WY=(t,e)=>t===e,Mu=(t,e)=>{if(t==null||e==null)return WY(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)||!Mu(t.get(n),e.get(n)))return!1;break}case Object:if(aM(t)!==aM(e))return!1;for(const n in t)if(!YY(t,n)||!Mu(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(!Mu(t[n],e[n]))return!1;break;default:return!1}return!0},sb=3e4;class GY extends qY{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=Fa();this.getLocalState()!==null&&sb/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((i,s)=>{s!==this.clientID&&sb<=n-i.lastUpdated&&this.states.has(s)&&r.push(s)}),r.length>0&&Rh(this,r,"timeout")},c2(sb/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:Fa()});const l=[],c=[],u=[],f=[];e===null?f.push(n):s==null?e!=null&&l.push(n):(c.push(n),Mu(s,e)||u.push(n)),(l.length>0||u.length>0||f.length>0)&&this.emit("change",[{added:l,updated:u,removed:f},"local"]),this.emit("update",[{added:l,updated:c,removed:f},"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:Fa()})}r.push(s)}}r.length>0&&(t.emit("change",[{added:[],updated:[],removed:r},n]),t.emit("update",[{added:[],updated:[],removed:r},n]))},Tx=(t,e,n=t.states)=>{const r=e.length,i=dv();On(i,r);for(let s=0;s<r;s++){const l=e[s],c=n.get(l)||null,u=t.meta.get(l).clock;On(i,l),On(i,u),us(i,JSON.stringify(c))}return fv(i)},ZY=(t,e,n)=>{const r=m2(e),i=Fa(),s=[],l=[],c=[],u=[],f=Jo(r);for(let h=0;h<f;h++){const m=Jo(r);let g=Jo(r);const b=JSON.parse(cd(r)),v=t.meta.get(m),k=t.states.get(m),C=v===void 0?0:v.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}),v===void 0&&b!==null?s.push(m):v!==void 0&&b===null?u.push(m):b!==null&&(Mu(b,k)||c.push(m),l.push(m)))}(s.length>0||c.length>0||u.length>0)&&t.emit("change",[{added:s,updated:c,removed:u},n]),(s.length>0||l.length>0||u.length>0)&&t.emit("update",[{added:s,updated:l,removed:u},n])};class g2{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 Ax{constructor(e){this.data=e,this.encoder=dv(),this.decoder=m2(new Uint8Array(this.data))}peekVarString(){return $Y(this.decoder)}readVarUint(){return Jo(this.decoder)}readVarString(){return cd(this.decoder)}readVarUint8Array(){return Dm(this.decoder)}writeVarUint(e){return On(this.encoder,e)}writeVarString(e){return us(this.encoder,e)}writeVarUint8Array(e){return tc(this.encoder,e)}length(){return d2(this.encoder)}}var wn;(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"})(wn||(wn={}));var In;(function(t){t.Connecting="connecting",t.Connected="connected",t.Disconnected="disconnected"})(In||(In={}));class ml{constructor(){this.encoder=dv()}get(e){return e.encoder}toUint8Array(){return fv(this.encoder)}}class JY extends ml{constructor(){super(...arguments),this.type=wn.CLOSE,this.description="Ask the server to close the connection"}get(e){return us(this.encoder,e.documentName),On(this.encoder,this.type),this.encoder}}class XY extends g2{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=In.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=In.Connected,this.emit("status",{status:In.Connected}),this.cancelWebsocketRetry=void 0,this.receivedOnOpenPayload=e}attach(e){this.configuration.providerMap.set(e.configuration.name,e),this.status===In.Disconnected&&this.shouldConnect&&this.connect(),this.receivedOnOpenPayload&&this.status===In.Connected&&e.onOpen(this.receivedOnOpenPayload)}detach(e){this.configuration.providerMap.has(e.configuration.name)&&(e.send(JY,{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===In.Connected)return;this.cancelWebsocketRetry&&(this.cancelWebsocketRetry(),this.cancelWebsocketRetry=void 0),this.receivedOnOpenPayload=void 0,this.shouldConnect=!0;const e=()=>{let i=!1;return{retryPromise:kY(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=f=>this.emit("message",f),s=f=>this.emit("close",{event:f}),l=f=>this.emit("open",f),c=f=>{n(f)};this.webSocketHandlers[r]={message:i,close:s,open:l,error:c};const u=this.webSocketHandlers[e.identifier];Object.keys(u).forEach(f=>{e.addEventListener(f,u[f])})}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=In.Connecting,this.emit("status",{status:In.Connecting}),this.connectionAttempt={resolve:e,reject:n}})}onMessage(e){var n;this.resolveConnectionAttempt(),this.lastMessageReceived=Fa();const i=new Ax(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=In.Connected,this.emit("status",{status:In.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===In.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=Fa()-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)===Cx.Open?this.webSocket.send(e):this.messageQueue.push(e)}onClose({event:e}){this.closeTries=0,this.cleanupWebSocket(),this.connectionAttempt&&this.rejectConnectionAttempt(),this.status=In.Disconnected,this.emit("status",{status:In.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 y2=0,hv=1,b2=2,QY=(t,e)=>{On(t,y2);const n=a5(e);tc(t,n)},eW=(t,e,n)=>{On(t,hv),tc(t,i5(e,n))},tW=(t,e,n)=>eW(e,n,Dm(t)),x2=(t,e,n)=>{try{t5(e,Dm(t),n)}catch(r){console.error("Caught error while handling a Yjs update",r)}},nW=(t,e)=>{On(t,b2),tc(t,e)},rW=x2,iW=(t,e,n,r)=>{const i=Jo(t);switch(i){case y2:tW(t,e,n);break;case hv:x2(t,n,r);break;case b2:rW(t,n,r);break;default:throw new Error("Unknown message type")}return i};class sW{constructor(e){this.message=e}apply(e,n){const{message:r}=this,i=r.readVarUint(),s=r.length();switch(i){case wn.Sync:this.applySyncMessage(e,n);break;case wn.Awareness:this.applyAwarenessMessage(e);break;case wn.Auth:this.applyAuthMessage(e);break;case wn.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case wn.Stateless:e.receiveStateless(cd(r.decoder));break;case wn.SyncStatus:this.applySyncStatusMessage(e,HY(r.decoder)===1);break;case wn.CLOSE:const l={code:1e3,reason:cd(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(ml,{encoder:r.encoder})}applySyncMessage(e,n){const{message:r}=this;r.writeVarUint(wn.Sync);const i=iW(r.decoder,r.encoder,e.document,e);n&&i===hv&&(e.synced=!0)}applySyncStatusMessage(e,n){n&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;const{message:n}=this;ZY(e.awareness,n.readVarUint8Array(),e)}applyAuthMessage(e){const{message:n}=this;vY(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(wn.Awareness),n.writeVarUint8Array(Tx(e.awareness,Array.from(e.awareness.getStates().keys())))}}class oW{constructor(e,n={}){this.message=new e,this.encoder=this.message.get(n)}create(){return fv(this.encoder)}send(e){e==null||e.send(this.create())}}class lW extends ml{constructor(){super(...arguments),this.type=wn.Auth,this.description="Authentication"}get(e){if(typeof e.token>"u")throw new Error("The authentication message requires `token` as an argument.");return us(this.encoder,e.documentName),On(this.encoder,this.type),xY(this.encoder,e.token),this.encoder}}class cM extends ml{constructor(){super(...arguments),this.type=wn.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");us(this.encoder,e.documentName),On(this.encoder,this.type);let n;return e.states===void 0?n=Tx(e.awareness,e.clients):n=Tx(e.awareness,e.clients,e.states),tc(this.encoder,n),this.encoder}}class aW extends ml{constructor(){super(...arguments),this.type=wn.Stateless,this.description="A stateless message"}get(e){var n;return us(this.encoder,e.documentName),On(this.encoder,this.type),us(this.encoder,(n=e.payload)!==null&&n!==void 0?n:""),this.encoder}}class uM extends ml{constructor(){super(...arguments),this.type=wn.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 us(this.encoder,e.documentName),On(this.encoder,this.type),QY(this.encoder,e.document),this.encoder}}class cW extends ml{constructor(){super(...arguments),this.type=wn.Sync,this.description="A document update"}get(e){return us(this.encoder,e.documentName),On(this.encoder,this.type),nW(this.encoder,e.update),this.encoder}}class uW extends Error{constructor(){super(...arguments),this.code=1001}}class dM extends g2{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 wi,this.configuration.awareness=e.awareness!==void 0?e.awareness:new GY(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:oM(this.awareness.getStates())})}),(r=this.awareness)===null||r===void 0||r.on("change",()=>{this.emit("awarenessChange",{states:oM(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 XY(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(uM,{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(aW,{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(lW,{token:e??"",documentName:this.configuration.name})}documentUpdateHandler(e,n){n!==this&&(this.incrementUnsyncedChanges(),this.send(cW,{update:e,documentName:this.configuration.name}))}awarenessUpdateHandler({added:e,updated:n,removed:r},i){const s=e.concat(n).concat(r);this.send(cM,{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(uM,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(cM,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.configuration.name})}send(e,n){if(!this._isAttached)return;const r=new oW(e,n);this.emit("outgoingMessage",{message:r.message}),r.send(this.configuration.websocketProvider)}onMessage(e){const n=new Ax(e.data),r=n.readVarString();n.writeVarString(r),this.emit("message",{event:e,message:new Ax(e.data)}),new sW(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 uW(`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 dW(t,e,n){return t.filter(r=>!e.has(r.id)&&!n.has(r.id))}function fW(){var O;const[t,e]=M.useState([]),[n,r]=M.useState(null),[i,s]=M.useState(!1),[l,c]=M.useState("connecting"),[u,f]=M.useState(0),[h,m]=M.useState(null),[g,b]=M.useState([]),[v,k]=M.useState(null),[C,E]=M.useState(!1),[L,j]=M.useState(!1),[Y,V]=M.useState(!1),[R,B]=M.useState(!1),te=M.useRef(null),W=M.useRef(!1),oe=M.useRef(null),re=M.useRef(null),ie=M.useRef([]);ie.current=t;const ye=M.useRef(new Set),ae=M.useRef(new Map);for(const _ of t)ye.current.delete(_.id),ae.current.delete(_.id);const H=M.useRef(new Map),N=M.useRef(new Map),K=M.useRef(void 0),he=M.useCallback(_=>{const{ydoc:I}=_,A=I.getMap(Aa),ne=()=>{const Ge=[];A.forEach(pn=>{Ge.push($u(pn))}),b(Ge)};A.observe(ne),ne();const Z=I.getMap(gM);let se=null,me=!1;const Ee=()=>{const Ge=Z.get("claude"),pn=(Ge==null?void 0:Ge.status)??null,jt=(Ge==null?void 0:Ge.active)??!1;pn!==se&&(se=pn,k(pn)),jt!==me&&(me=jt,E(jt))};Z.observe(Ee),Ee();const Te=I.getMap(mh);let He=!1;const we=()=>{const Ge=Te.get("readOnly")===!0;Ge!==He&&(He=Ge,j(Ge))};return Te.observe(we),we(),()=>{A.unobserve(ne),Z.unobserve(Ee),Te.unobserve(we)}},[]);K.current=(_,I)=>{var Te,He;const A=ie.current,ne=new Set(A.map(we=>we.id)),Z=new Set(_.map(we=>we.id));for(const[we,Ge]of ae.current)Z.has(we)||((Te=N.current.get(we))==null||Te(),N.current.delete(we),Ge.provider.destroy(),Ge.ydoc.destroy(),ae.current.delete(we),ye.current.delete(we));const se=dW(_,ne,ye.current),me=[];for(const we of se){ye.current.add(we.id);const Ge=new wi,pn=new dM({url:`ws://localhost:${vC}`,name:we.id,document:Ge});ae.current.set(we.id,{ydoc:Ge,provider:pn});const jt=Ge.getMap(mh),Fr=()=>{var Mi;const vr=jt.get("openDocuments"),$n=jt.get("activeDocumentId");vr&&((Mi=K.current)==null||Mi.call(K,vr,$n??null))};jt.observe(Fr),N.current.set(we.id,()=>jt.unobserve(Fr)),me.push({...we,ydoc:Ge,provider:pn})}const Ee=A.filter(we=>!Z.has(we.id));for(const we of Ee){const Ge=H.current.get(we.id);Ge&&(Ge.cleanup(),H.current.delete(we.id)),(He=N.current.get(we.id))==null||He(),N.current.delete(we.id),ye.current.delete(we.id),ae.current.delete(we.id),we.provider.destroy(),we.ydoc.destroy()}e(we=>[...we.filter(pn=>Z.has(pn.id)),...me]),I!==null&&r(we=>we===null||!Z.has(we)?I:Ee.length>0&&I===we?we:I)},M.useEffect(()=>{const _=new wi,I=new dM({url:`ws://localhost:${vC}`,name:nL,document:_});return oe.current={ydoc:_,provider:I},I.on("status",({status:A})=>{s(A==="connected"),c(A),A==="connected"?(W.current=!0,f(0),m(null)):A==="disconnected"?m(ne=>ne??Date.now()):A==="connecting"&&(W.current&&f(ne=>ne+1),m(ne=>ne??Date.now()))}),V(!0),()=>{I.destroy(),_.destroy(),oe.current=null}},[]),M.useEffect(()=>{if(!oe.current)return;const _=oe.current.ydoc.getMap(mh),I=()=>{var se;const A=_.get("generationId");A&&re.current&&A!==re.current&&(console.warn("[Tandem] Server restarted — refreshing documents"),B(!0),te.current&&clearTimeout(te.current),te.current=setTimeout(()=>B(!1),5e3)),A&&(re.current=A);const ne=_.get("openDocuments"),Z=_.get("activeDocumentId");ne&&((se=K.current)==null||se.call(K,ne,Z??null))};return _.observe(I),I(),()=>{_.unobserve(I),te.current&&clearTimeout(te.current)}},[]),M.useEffect(()=>{for(const I of H.current.values())I.cleanup();H.current.clear();const _=ie.current.find(I=>I.id===n);if(_){const I=he(_);H.current.set(_.id,{cleanup:I})}else b([]),k(null),E(!1),j(!1)},[n,he]);const _e=M.useCallback(_=>{r(I=>{if(I!==_)return I;const A=ie.current,ne=A.findIndex(se=>se.id===_),Z=A.filter(se=>se.id!==_);return Z.length===0?null:Z[Math.min(ne,Z.length-1)].id}),fetch(`http://localhost:${ud}/api/close`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:_})}).then(I=>{I.ok||console.warn("[Tandem] Server rejected close:",I.status)}).catch(I=>{console.warn("[Tandem] Failed to close document on server:",I)})},[]);return{tabs:t,activeTabId:n,setActiveTabId:r,handleTabClose:_e,connected:i,connectionStatus:l,reconnectAttempts:u,disconnectedSince:h,annotations:g,claudeStatus:v,claudeActive:C,readOnly:L,bootstrapYdoc:((O=oe.current)==null?void 0:O.ydoc)??null,ready:Y,serverRestarted:R}}function hW({accepted:t,dismissed:e,total:n,onDismiss:r}){const i=n>0?Math.round(t/n*100):0;return S.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:S.jsxs("div",{style:{background:"var(--tandem-surface)",borderRadius:"12px",padding:"32px 40px",maxWidth:"400px",boxShadow:"0 20px 60px rgba(0,0,0,0.2)",textAlign:"center"},onClick:s=>s.stopPropagation(),children:[S.jsx("div",{style:{fontSize:"48px",marginBottom:"8px"},children:i>=80?"✅":i>=50?"📋":"🔍"}),S.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",fontWeight:600,color:"var(--tandem-fg)"},children:"Review Complete"}),S.jsx("p",{style:{margin:"0 0 20px",color:"var(--tandem-fg-muted)",fontSize:"14px"},children:"All annotations have been resolved."}),S.jsxs("div",{style:{display:"flex",justifyContent:"center",gap:"24px",marginBottom:"20px"},children:[S.jsxs("div",{children:[S.jsx("div",{style:{fontSize:"28px",fontWeight:700,color:"var(--tandem-success)"},children:t}),S.jsx("div",{style:{fontSize:"12px",color:"var(--tandem-fg-muted)"},children:"Accepted"})]}),S.jsx("div",{style:{width:"1px",background:"var(--tandem-border)"}}),S.jsxs("div",{children:[S.jsx("div",{style:{fontSize:"28px",fontWeight:700,color:"var(--tandem-error)"},children:e}),S.jsx("div",{style:{fontSize:"12px",color:"var(--tandem-fg-muted)"},children:"Dismissed"})]}),S.jsx("div",{style:{width:"1px",background:"var(--tandem-border)"}}),S.jsxs("div",{children:[S.jsxs("div",{style:{fontSize:"28px",fontWeight:700,color:"var(--tandem-accent)"},children:[i,"%"]}),S.jsx("div",{style:{fontSize:"12px",color:"var(--tandem-fg-muted)"},children:"Accept rate"})]})]}),S.jsx("button",{onClick:r,style:{padding:"8px 24px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",background:"var(--tandem-accent)",color:"var(--tandem-accent-fg)",cursor:"pointer"},children:"Done"})]})})}const pW=2e3;function mW({connected:t,connectionStatus:e,reconnectAttempts:n,disconnectedSince:r,claudeStatus:i,claudeActive:s,readOnly:l,documentCount:c=0,saving:u=!1}){const{userName:f,setUserName:h}=B_(),[m,g]=M.useState(f),b=M.useRef(null),v=()=>{h(m)};M.useEffect(()=>{m!==f&&document.activeElement!==b.current&&g(f)},[f,m]);const[k,C]=M.useState(!1),[E,L]=M.useState(0),j=M.useRef(t);M.useEffect(()=>{const B=j.current;if(j.current=t,t&&!B){C(!0);const te=setTimeout(()=>C(!1),pW);return()=>clearTimeout(te)}},[t]),M.useEffect(()=>{if(r==null){L(0);return}L(Math.floor((Date.now()-r)/1e3));const B=setInterval(()=>{L(Math.floor((Date.now()-r)/1e3))},1e3);return()=>clearInterval(B)},[r]);const Y=e==="connecting",V=t?"var(--tandem-success)":Y?"var(--tandem-warning)":"var(--tandem-error)";let R;if(k)R="Reconnected";else if(e==="connected")R="Connected";else if(e==="connecting"){const B=["Reconnecting…"];if(n>0||E>0){const te=[];n>0&&te.push(`attempt ${n}`),E>0&&te.push(`${E}s`),B.push(`(${te.join(", ")})`)}R=B.join(" ")}else R="Disconnected — check that the server is running";return S.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"4px 16px",height:"28px",borderTop:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)",fontSize:"12px",color:"var(--tandem-fg-muted)",userSelect:"none"},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[S.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:V,display:"inline-block",animation:Y?"tandem-reconnect-pulse 1.2s ease-in-out infinite":"none"}}),S.jsx("span",{children:R}),c>0&&S.jsxs("span",{style:{color:"var(--tandem-fg-subtle)"},children:[c," doc",c!==1?"s":""," open"]}),u&&S.jsx("span",{"data-testid":"save-indicator",style:{color:"var(--tandem-accent)",fontStyle:"italic"},children:"Saving..."})]}),S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"11px",color:"var(--tandem-fg-subtle)"},children:[S.jsx("span",{children:"You:"}),S.jsx("input",{ref:b,"data-testid":"user-name-input",type:"text",value:m,onChange:B=>g(B.target.value),onBlur:v,onKeyDown:B=>{B.key==="Enter"&&B.currentTarget.blur(),B.key==="Escape"&&(g(f),B.currentTarget.blur())},"aria-label":"Display name",title:"Your display name",maxLength:xM,style:{background:"transparent",border:"none",borderBottom:"1px solid var(--tandem-border)",color:"var(--tandem-fg-muted)",fontSize:"11px",width:"80px",outline:"none",padding:"0 2px"}})]}),l&&S.jsx("span",{style:{padding:"1px 8px",fontSize:"11px",fontWeight:600,color:"var(--tandem-warning-fg-strong)",background:"var(--tandem-warning-bg)",borderRadius:"9999px",border:"1px solid var(--tandem-warning-border)"},children:"Review Only"}),S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[S.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"var(--tandem-author-claude)",opacity:s?1:.4,display:"inline-block",transition:"opacity 0.3s ease",animation:s?"tandem-status-pulse 1.5s ease-in-out infinite":"none"}}),S.jsx("span",{style:{transition:"color 0.3s ease",color:s?"var(--tandem-fg)":"var(--tandem-fg-subtle)"},children:i?`Claude -- ${i}`:"Claude -- idle"})]}),S.jsx("style",{children:`
217
+ @keyframes tandem-status-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
218
+ @keyframes tandem-reconnect-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
219
+ `})]})}function v2(t,e,n=oL){const r=t.filter(i=>i!==e);return[e,...r].slice(0,n)}function S2(){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 w2(t){try{localStorage.setItem(_x,JSON.stringify(t))}catch(e){console.warn("[tandem] failed to save recent files:",e)}}function gW(){try{localStorage.removeItem(_x)}catch(t){console.warn("[tandem] failed to clear recent files:",t)}}function yW({onClose:t}){const[e,n]=M.useState("path"),[r,i]=M.useState(""),[s,l]=M.useState(null),[c,u]=M.useState(!1),[f,h]=M.useState(!1),m=M.useRef(null),[g,b]=M.useState(S2),v=M.useCallback(V=>{b(R=>{const B=v2(R,V);return w2(B),B})},[]),k=M.useCallback(()=>{gW(),b([])},[]),C=M.useCallback(async V=>{if(!c){l(null),u(!0);try{const R=await fetch(`${rl}/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:V})}),B=await R.json();if(!R.ok){l(B.message??"Failed to open file");return}v(V),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{u(!1)}}},[c,t,v]),E=M.useCallback(()=>{r.trim()&&C(r.trim())},[r,C]),L=M.useCallback(async V=>{if(!c){l(null),u(!0);try{const R=await L_(V),B=await fetch(`${rl}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:V.name,content:R})}),te=await B.json();if(!B.ok){l(te.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{u(!1)}}},[c,t]),j=M.useCallback(V=>{V.preventDefault(),h(!1);const R=V.dataTransfer.files[0];R&&L(R)},[L]),Y=M.useCallback(V=>{var B;const R=(B=V.target.files)==null?void 0:B[0];R&&L(R)},[L]);return S.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:V=>{V.target===V.currentTarget&&t()},onKeyDown:V=>{V.key==="Escape"&&t()},children:S.jsxs("div",{style:{background:"var(--tandem-surface)",borderRadius:"8px",boxShadow:"0 8px 30px rgba(0,0,0,0.15)",width:"440px",padding:"20px"},"data-testid":"file-open-dialog",children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"16px"},children:[S.jsx("h3",{style:{margin:0,fontSize:"15px",fontWeight:600,color:"var(--tandem-fg)"},children:"Open File"}),S.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",fontSize:"16px",color:"var(--tandem-fg-subtle)"},children:"×"})]}),S.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"16px"},children:[S.jsx("button",{onClick:()=>n("path"),style:{flex:1,padding:"6px",fontSize:"13px",border:"1px solid var(--tandem-border)",borderRadius:"4px",cursor:"pointer",background:e==="path"?"var(--tandem-accent)":"var(--tandem-surface)",color:e==="path"?"var(--tandem-accent-fg)":"var(--tandem-fg)"},children:"File Path"}),S.jsx("button",{onClick:()=>n("upload"),style:{flex:1,padding:"6px",fontSize:"13px",border:"1px solid var(--tandem-border)",borderRadius:"4px",cursor:"pointer",background:e==="upload"?"var(--tandem-accent)":"var(--tandem-surface)",color:e==="upload"?"var(--tandem-accent-fg)":"var(--tandem-fg)"},children:"Upload"})]}),e==="path"?S.jsxs("div",{children:[S.jsx("input",{autoFocus:!0,type:"text",placeholder:"Paste absolute file path...",value:r,onChange:V=>i(V.target.value),onKeyDown:V=>{V.key==="Enter"&&E()},style:{width:"100%",padding:"8px 10px",fontSize:"13px",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",boxSizing:"border-box",background:"var(--tandem-surface)",color:"var(--tandem-fg)"},"data-testid":"file-path-input"}),S.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?"var(--tandem-fg-subtle)":"var(--tandem-accent)",color:"var(--tandem-accent-fg)",opacity:r.trim()?1:.5},"data-testid":"file-open-submit",children:c?"Opening...":"Open"}),g.length>0&&S.jsxs("div",{"data-testid":"recent-files-list",style:{marginTop:"14px"},children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[S.jsx("span",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Recent"}),S.jsx("button",{"data-testid":"clear-recent-files",onClick:k,type:"button",style:{background:"none",border:"none",color:"var(--tandem-fg-subtle)",fontSize:"11px",cursor:"pointer",padding:0,textDecoration:"underline"},children:"Clear all"})]}),S.jsx("div",{style:{maxHeight:"150px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"2px"},children:g.map((V,R)=>{const B=V.split(/[/\\]/),te=B.pop()??V,W=B.join("/")||"/";return S.jsxs("button",{type:"button","data-testid":`recent-file-${R}`,onClick:()=>{i(V),C(V)},style:{background:"none",border:"none",padding:"6px 8px",borderRadius:"4px",cursor:"pointer",textAlign:"left",display:"flex",flexDirection:"column",gap:"1px"},onMouseEnter:oe=>{oe.currentTarget.style.background="var(--tandem-surface-muted)"},onMouseLeave:oe=>{oe.currentTarget.style.background="transparent"},children:[S.jsx("span",{style:{fontSize:"13px",color:"var(--tandem-fg)"},children:te}),S.jsx("span",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"380px"},children:W})]},V)})})]})]}):S.jsxs("div",{onDragOver:V=>{V.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:j,onClick:()=>{var V;return(V=m.current)==null?void 0:V.click()},style:{border:`2px dashed ${f?"var(--tandem-accent)":"var(--tandem-border-strong)"}`,borderRadius:"6px",padding:"32px 16px",textAlign:"center",cursor:c?"wait":"pointer",background:f?"var(--tandem-accent-bg)":"var(--tandem-surface-muted)",transition:"border-color 0.15s, background 0.15s"},"data-testid":"file-upload-zone",children:[S.jsx("input",{ref:m,type:"file",accept:".md,.txt,.html,.htm,.docx",onChange:Y,style:{display:"none"}}),S.jsx("div",{style:{fontSize:"13px",color:"var(--tandem-fg-muted)"},children:c?"Uploading...":"Drop a file here or click to browse"}),S.jsx("div",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)",marginTop:"6px"},children:".md, .txt, .html, .docx"})]}),s&&S.jsx("div",{style:{marginTop:"10px",padding:"8px 10px",fontSize:"12px",color:"var(--tandem-error-fg-strong)",background:"var(--tandem-error-bg)",borderRadius:"4px",border:"1px solid var(--tandem-error-border)"},"data-testid":"file-open-error",children:s})]})})}function bW(t){const[e,n]=M.useState(!1),r=M.useRef(0),i=M.useRef(null);return M.useEffect(()=>{if(t.readOnly){n(!1);return}const{ydoc:s}=t,l=s.getXmlFragment("default"),c=s.getMap(mh);let u=!1;const f=setTimeout(()=>{u=!0,i.current=c.get(kC)??0,r.current=0,n(!1)},500),h=()=>{u&&(r.current++,n(!0))};l.observeDeep(h);const m=()=>{if(!u)return;const g=c.get(kC);g!==void 0&&g!==i.current&&(i.current=g,r.current=0,n(!1))};return c.observe(m),()=>{clearTimeout(f),l.unobserveDeep(h),c.unobserve(m)}},[t.ydoc,t.readOnly]),e}const xW={md:"M",txt:"T",html:"H",docx:"W"};function vW({tab:t,isActive:e,onSwitch:n,onClose:r,draggable:i,onDragStart:s,onDragOver:l,onDrop:c,onDragEnd:u,onDragLeave:f,dropIndicator:h,onKeyDown:m}){const g=bW(t);return S.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:u,onDragLeave:f,onKeyDown:b=>m(b,t.id),style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 12px",fontSize:"13px",cursor:"pointer",background:e?"var(--tandem-surface)":"transparent",color:e?"var(--tandem-fg)":"var(--tandem-fg-muted)",borderTop:e?"2px solid var(--tandem-accent)":"2px solid transparent",borderBottom:e?"1px solid var(--tandem-surface)":"1px solid transparent",borderLeft:h==="left"?"2px solid var(--tandem-accent)":"2px solid transparent",borderRight:h==="right"?"2px solid var(--tandem-accent)":"2px solid transparent",marginBottom:"-1px",userSelect:"none",whiteSpace:"nowrap",transition:"background 0.15s, color 0.15s",flexShrink:0},children:[g&&S.jsx("span",{"data-testid":`unsaved-indicator-${t.id}`,style:{color:"var(--tandem-warning)",fontSize:"10px"},children:"●"}),S.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:e?"var(--tandem-accent)":"var(--tandem-fg-subtle)",width:"14px",textAlign:"center"},children:xW[t.format]||"?"}),S.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&&S.jsx("span",{style:{fontSize:"9px",color:"var(--tandem-warning-fg-strong)",background:"var(--tandem-warning-bg)",padding:"0 3px",borderRadius:"2px"},children:"RO"}),S.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:"var(--tandem-fg-subtle)",padding:"0 2px",borderRadius:"2px"},onMouseEnter:b=>b.currentTarget.style.color="var(--tandem-error)",onMouseLeave:b=>b.currentTarget.style.color="var(--tandem-fg-subtle)",title:"Close document",children:"×"})]})}const Mx="tandem-tab-scroll-hide";function SW(){return S.jsx("style",{children:`
220
+ .${Mx} {
221
+ scrollbar-width: none;
222
+ -ms-overflow-style: none;
223
+ }
224
+ .${Mx}::-webkit-scrollbar {
225
+ display: none;
226
+ }
227
+ `})}const k2={display:"flex",alignItems:"center",justifyContent:"center",width:"28px",minWidth:"28px",background:"linear-gradient(to right, var(--tandem-surface-muted) 70%, transparent)",border:"none",cursor:"pointer",fontSize:"12px",color:"var(--tandem-fg-muted)",padding:0,zIndex:1},wW={...k2,background:"linear-gradient(to left, var(--tandem-surface-muted) 70%, transparent)"};function kW({tabs:t,activeTabId:e,onTabSwitch:n,onTabClose:r,reorder:i,reduceMotion:s}){const l=s?"auto":"smooth",[c,u]=M.useState(!1),f=M.useRef(new Set);M.useEffect(()=>{const H=new Set(t.map(N=>N.id));for(const N of f.current)H.has(N)||f.current.delete(N)},[t]);const h=M.useCallback(H=>{f.current.has(H)||(f.current.add(H),r(H))},[r]),m=M.useRef(null),[g,b]=M.useState(!1),[v,k]=M.useState(!1),[C,E]=M.useState(null),[L,j]=M.useState(null);function Y(){E(null),j(null)}const V=M.useCallback(()=>{const H=m.current;H&&(b(H.scrollLeft>0),k(H.scrollLeft+H.clientWidth<H.scrollWidth-1))},[]);M.useEffect(()=>{const H=m.current;if(!H)return;V(),H.addEventListener("scroll",V,{passive:!0});const N=new ResizeObserver(V);return N.observe(H),()=>{H.removeEventListener("scroll",V),N.disconnect()}},[V]),M.useEffect(()=>{V()},[t.length,V]),M.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]),M.useEffect(()=>{Y()},[t.length]);const R=M.useCallback((H,N)=>{E(N),H.dataTransfer.setData("text/plain",N),H.dataTransfer.effectAllowed="move"},[]),B=M.useCallback((H,N)=>{if(H.preventDefault(),!C||C===N){j(null);return}const K=H.currentTarget.getBoundingClientRect(),he=K.left+K.width/2,_e=H.clientX<he?"left":"right";j({id:N,side:_e})},[C]),te=M.useCallback((H,N)=>{H.preventDefault();const K=H.dataTransfer.getData("text/plain");if(K&&K!==N&&i){const he=H.currentTarget.getBoundingClientRect(),_e=he.left+he.width/2,O=H.clientX<_e?"left":"right";i(K,N,O)}Y()},[i]),W=M.useCallback(()=>{Y()},[]),oe=M.useCallback(()=>{j(null)},[]),re=M.useCallback((H,N)=>{if(!H.altKey||!i||H.key!=="ArrowLeft"&&H.key!=="ArrowRight")return;H.preventDefault();const K=t.findIndex(he=>he.id===N);K!==-1&&(H.key==="ArrowLeft"&&K>0?i(N,t[K-1].id):H.key==="ArrowRight"&&K<t.length-1&&i(t[K+1].id,N))},[t,i]),ie=M.useCallback(()=>{var H;(H=m.current)==null||H.scrollBy({left:-150,behavior:l})},[l]),ye=M.useCallback(()=>{var H;(H=m.current)==null||H.scrollBy({left:150,behavior:l})},[l]),ae=t.length<=1;return S.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",background:"var(--tandem-surface-muted)",borderBottom:"1px solid var(--tandem-border)",minHeight:"32px"},children:[S.jsx(SW,{}),g&&S.jsx("button",{"data-testid":"tab-scroll-left",onClick:ie,style:{...k2,background:"linear-gradient(to right, var(--tandem-surface-muted) 70%, transparent)",color:"var(--tandem-fg-muted)"},title:"Scroll tabs left",children:"◀"}),S.jsx("div",{ref:m,"data-testid":"tab-scroll-container",className:Mx,style:{display:"flex",alignItems:"center",gap:"1px",flex:1,overflowX:"auto",overflowY:"hidden",padding:"0 4px"},children:t.map(H=>S.jsx(vW,{tab:H,isActive:H.id===e,onSwitch:n,onClose:h,draggable:!ae,onDragStart:R,onDragOver:B,onDrop:te,onDragEnd:W,onDragLeave:oe,dropIndicator:(L==null?void 0:L.id)===H.id?L.side:null,onKeyDown:re},H.id))}),v&&S.jsx("button",{"data-testid":"tab-scroll-right",onClick:ye,style:{...wW,background:"linear-gradient(to left, var(--tandem-surface-muted) 70%, transparent)",color:"var(--tandem-fg-muted)"},title:"Scroll tabs right",children:"▶"}),S.jsx("button",{onClick:()=>u(!0),"data-testid":"open-file-btn",title:"Open file",style:{background:"none",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",cursor:"pointer",fontSize:"16px",lineHeight:1,color:"var(--tandem-fg-muted)",padding:"2px 8px",marginLeft:"4px",marginRight:"8px",flexShrink:0},onMouseEnter:H=>{H.currentTarget.style.color="var(--tandem-accent)",H.currentTarget.style.borderColor="var(--tandem-accent)"},onMouseLeave:H=>{H.currentTarget.style.color="var(--tandem-fg-muted)",H.currentTarget.style.borderColor="var(--tandem-border-strong)"},children:"+"}),c&&S.jsx(yW,{onClose:()=>u(!1)})]})}function CW(){QK();const{tabs:t,activeTabId:e,setActiveTabId:n,handleTabClose:r,connected:i,connectionStatus:s,reconnectAttempts:l,disconnectedSince:c,annotations:u,claudeStatus:f,claudeActive:h,readOnly:m,bootstrapYdoc:g,ready:b,serverRestarted:v}=fW(),{orderedTabs:k,reorder:C}=mK(t);hK(k,e,n),M.useEffect(()=>{if(t.length!==0)try{const be=S2();let bt=be;for(const Fn of t)Gz(Fn.filePath)||(bt=v2(bt,Fn.filePath));(bt.length!==be.length||bt.some((Fn,si)=>Fn!==be[si]))&&w2(bt)}catch(be){console.warn("[tandem] failed to sync recent files:",be)}},[t.length]);const{settings:E,updateSettings:L}=YK(),{tandemMode:j,setTandemMode:Y}=$K(g,E.selectionDwellMs),{visibleAnnotations:V,heldCount:R}=oK(u,j),{showBanner:B,dismiss:te}=nK(c),W=M.useMemo(()=>t.map(be=>({id:be.id,fileName:be.fileName})),[t]),{saving:oe}=cK(e),{toasts:re,dismiss:ie}=lK(),{fileDragOver:ye,handleEditorDragOver:ae,handleEditorDragLeave:H,handleEditorDrop:N}=iK(),{showReviewSummary:K,reviewSummaryData:he,dismissReviewSummary:_e}=aK(u),[O,_]=M.useState(!1),I=M.useRef(null),A=M.useCallback(()=>{_(!0)},[]),ne=M.useRef(O);ne.current=O;const Z=M.useCallback(()=>{if(ne.current){_(!1);return}A()},[A]);dK(Z),M.useEffect(()=>{const be=$n.current;if(!be)return;const bt=be.state.tr.setMeta(ua,{type:"toggle",visible:E.showAuthorship});be.view.dispatch(bt)},[E.showAuthorship]),M.useEffect(()=>(document.body.classList.toggle("tandem-reduce-motion",E.reduceMotion),()=>document.body.classList.remove("tandem-reduce-motion")),[E.reduceMotion]),ZK(E.theme),M.useEffect(()=>{const be=FK[E.textSize];return document.documentElement.style.setProperty("--tandem-editor-font-size",`${be}px`),()=>{document.documentElement.style.removeProperty("--tandem-editor-font-size")}},[E.textSize]);const[se,me]=M.useState(!1),[Ee,Te]=M.useState(()=>E.primaryTab==="chat"),He=M.useMemo(()=>Ee?V.filter(be=>be.status==="pending").length:0,[V,Ee]),[we,Ge]=M.useState(null),[pn,jt]=M.useState(!1),[Fr,vr]=M.useState(null),$n=M.useRef(null),Mi=M.useRef(null),Oi=M.useCallback(be=>{$n.current=be},[]),_i=M.useCallback(be=>{Te(!1),Ge(be)},[]),[qr,gl]=M.useState(()=>E.layout==="three-panel"?{kind:"three-panel",left:hh("left"),right:hh("right")}:{kind:"tabbed",right:hh("right")});M.useEffect(()=>{gl(be=>E.layout==="three-panel"?be.kind==="three-panel"?be:{kind:"three-panel",left:hh("left"),right:be.right}:be.kind==="tabbed"?be:{kind:"tabbed",right:be.right})},[E.layout]);const yl=E.editorWidthPercent<100?`${E.editorWidthPercent}%`:void 0,Xt=E.editorWidthPercent<100?"0 auto":void 0,{handleResizeStart:go}=rK({panelLayout:qr,setPanelLayout:gl}),J=M.useCallback(()=>{me(be=>!be)},[]),de=M.useCallback(()=>{me(!1)},[]),Re=M.useCallback(()=>{if(Ee)return;const be=$n.current;if(!be)return;const{from:bt,to:Fn}=be.state.selection;if(bt===Fn)return;const si=z_(be.state.doc,{from:br(bt),to:br(Fn)}),fs=be.state.doc.textBetween(bt,Fn,`
228
+ `);vr({...si,textSnapshot:fs.length>200?fs.slice(0,197)+"...":fs})},[Ee]);M.useEffect(()=>{const be=bt=>{if(bt.key!=="?")return;const Fn=bt.target;Fn.tagName==="INPUT"||Fn.tagName==="TEXTAREA"||Fn.isContentEditable||jt(si=>!si)};return window.addEventListener("keydown",be),()=>window.removeEventListener("keydown",be)},[]);const pe=t.find(be=>be.id===e),{tutorialActive:tt,currentStep:Ln,dismissTutorial:Kr,nextStep:mn,coworkStatus:It}=XK(u,$n,pe==null?void 0:pe.fileName),Qt={annotations:V,editor:$n.current,ydoc:(pe==null?void 0:pe.ydoc)??null,heldCount:R,tandemMode:j,onModeChange:Y,activeDocFormat:pe==null?void 0:pe.format,documentId:pe==null?void 0:pe.id,reviewMode:se,onToggleReviewMode:J,onExitReviewMode:de,activeAnnotationId:we,onActiveAnnotationChange:Ge,reduceMotion:E.reduceMotion},ot={ctrlYdoc:g,editor:$n.current,activeDocId:e,openDocs:W,claudeActive:h,claudeStatus:f,capturedAnchor:Fr,onCapturedAnchorChange:vr,inputRef:Mi,reduceMotion:E.reduceMotion};return b?S.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100vh"},children:[v&&S.jsx("div",{style:{padding:"8px 16px",background:"var(--tandem-warning-bg)",borderBottom:"1px solid var(--tandem-warning-border)",fontSize:"13px",color:"var(--tandem-warning-fg-strong)",textAlign:"center"},children:"Server restarted — refreshing documents"}),B&&S.jsx(Zz,{onDismiss:te}),S.jsx(tK,{editor:$n.current,ydoc:(pe==null?void 0:pe.ydoc)??null,onSettingsOpen:Z,settingsBtnRef:I,tandemMode:j,onModeChange:Y,heldCount:R}),S.jsx(kW,{tabs:k,activeTabId:e,onTabSwitch:n,onTabClose:r,reorder:C,reduceMotion:E.reduceMotion}),qr.kind==="three-panel"?S.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[S.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${qr.left}px`,borderRight:"1px solid var(--tandem-border)"},children:[S.jsx("div",{style:{padding:"6px 12px",fontSize:"11px",fontWeight:600,color:"var(--tandem-fg-muted)",borderBottom:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},children:E.panelOrder==="chat-editor-annotations"?"Chat":"Annotations"}),S.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:E.panelOrder==="chat-editor-annotations"?S.jsx(C0,{...ot,visible:!0}):S.jsx(E0,{...Qt})})]}),S.jsx("div",{"data-testid":"left-panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize left panel",tabIndex:0,onMouseDown:be=>go(be,"left"),style:{width:"4px",cursor:"col-resize",background:"transparent",flexShrink:0,transition:"background 0.15s"},onMouseEnter:be=>{be.currentTarget.style.background="var(--tandem-border-strong)"},onMouseLeave:be=>{be.currentTarget.style.background="transparent"}}),S.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px 48px",border:ye?"2px dashed var(--tandem-accent)":"2px solid transparent",background:ye?"var(--tandem-accent-bg)":void 0,transition:"border-color 0.15s, background 0.15s"},onDragOver:ae,onDragLeave:H,onDrop:N,children:[S.jsx(YE,{visible:(pe==null?void 0:pe.readOnly)===!0&&(pe==null?void 0:pe.format)==="docx",documentId:pe==null?void 0:pe.id}),S.jsx("div",{style:{maxWidth:yl,margin:Xt},children:pe?S.jsx(BA,{ydoc:pe.ydoc,provider:pe.provider,readOnly:m,reviewMode:se,activeAnnotationId:we,onEditorReady:Oi,onAnnotationClick:_i},pe.id):S.jsx(_C,{connected:i,claudeActive:h})})]}),S.jsx("div",{"data-testid":"right-panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize right panel",tabIndex:0,onMouseDown:be=>go(be,"right"),style:{width:"4px",cursor:"col-resize",background:"transparent",flexShrink:0,transition:"background 0.15s"},onMouseEnter:be=>{be.currentTarget.style.background="var(--tandem-border-strong)"},onMouseLeave:be=>{be.currentTarget.style.background="transparent"}}),S.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${qr.right}px`,borderLeft:"1px solid var(--tandem-border)"},children:[S.jsx("div",{style:{padding:"6px 12px",fontSize:"11px",fontWeight:600,color:"var(--tandem-fg-muted)",borderBottom:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},children:E.panelOrder==="chat-editor-annotations"?"Annotations":"Chat"}),S.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:E.panelOrder==="chat-editor-annotations"?S.jsx(E0,{...Qt}):S.jsx(C0,{...ot,visible:!0})})]})]}):S.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[S.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px 48px",border:ye?"2px dashed var(--tandem-accent)":"2px solid transparent",background:ye?"var(--tandem-accent-bg)":void 0,transition:"border-color 0.15s, background 0.15s"},onDragOver:ae,onDragLeave:H,onDrop:N,children:[S.jsx(YE,{visible:(pe==null?void 0:pe.readOnly)===!0&&(pe==null?void 0:pe.format)==="docx",documentId:pe==null?void 0:pe.id}),S.jsx("div",{style:{maxWidth:yl,margin:Xt},children:pe?S.jsx(BA,{ydoc:pe.ydoc,provider:pe.provider,readOnly:m,reviewMode:se,activeAnnotationId:we,onEditorReady:Oi,onAnnotationClick:_i},pe.id):S.jsx(_C,{connected:i,claudeActive:h})})]}),S.jsx("div",{"data-testid":"panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",tabIndex:0,onMouseDown:be=>go(be,"right"),style:{width:"4px",cursor:"col-resize",background:"transparent",flexShrink:0,transition:"background 0.15s"},onMouseEnter:be=>{be.currentTarget.style.background="var(--tandem-border-strong)"},onMouseLeave:be=>{be.currentTarget.style.background="transparent"}}),S.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${qr.right}px`,borderLeft:"1px solid var(--tandem-border)"},children:[S.jsxs("div",{style:{display:"flex",borderBottom:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)"},children:[S.jsxs("button",{"data-testid":"annotations-tab",onClick:()=>Te(!1),style:{flex:1,padding:"8px",fontSize:"12px",fontWeight:Ee?400:600,border:"none",borderBottom:Ee?"none":"2px solid var(--tandem-accent)",background:"transparent",cursor:"pointer",color:Ee?"var(--tandem-fg-muted)":"var(--tandem-accent)",position:"relative"},children:["Annotations",Ee&&He>0&&S.jsx("span",{style:{position:"absolute",top:"2px",right:"6px",background:"var(--tandem-error)",color:"var(--tandem-error-fg)",fontSize:"9px",width:"16px",height:"16px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700},children:He>9?"9+":He})]}),S.jsx("button",{"data-testid":"chat-tab",onMouseDown:Re,onClick:()=>Te(!0),style:{flex:1,padding:"8px",fontSize:"12px",fontWeight:Ee?600:400,border:"none",borderBottom:Ee?"2px solid var(--tandem-accent)":"none",background:"transparent",cursor:"pointer",color:Ee?"var(--tandem-accent)":"var(--tandem-fg-muted)",position:"relative"},children:"Chat"})]}),S.jsx(C0,{...ot,visible:Ee}),S.jsx(E0,{...Qt,visible:!Ee})]})]}),S.jsx(mW,{connected:i,connectionStatus:s,reconnectAttempts:l,disconnectedSince:c,claudeStatus:f,claudeActive:h,readOnly:m,documentCount:t.length,saving:oe}),K&&he&&S.jsx(hW,{accepted:he.accepted,dismissed:he.dismissed,total:he.total,onDismiss:_e}),S.jsx(HU,{open:O,onClose:()=>_(!1),settings:E,onUpdate:L,returnFocusRef:I,anchorRef:I}),S.jsx(vL,{open:pn,onClose:()=>jt(!1)}),S.jsx(FU,{toasts:re,onDismiss:ie}),dd()&&S.jsx(bL,{}),tt&&S.jsx(kL,{currentStep:Ln,onNext:mn,onDismiss:Kr,coworkStatus:It})]}):S.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100vh",color:"var(--tandem-fg-subtle)"},children:"Connecting..."})}class EW extends sn.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?S.jsxs("div",{style:{padding:"2rem",fontFamily:"system-ui, sans-serif",color:"var(--tandem-fg)"},children:[S.jsx("h2",{children:"Something went wrong"}),S.jsx("p",{style:{color:"var(--tandem-fg-muted)"},children:"The editor encountered an unexpected error. Reload the page to continue."}),S.jsx("pre",{style:{background:"var(--tandem-surface-muted)",padding:"1rem",borderRadius:"4px",fontSize:"12px",overflow:"auto",maxHeight:"200px",color:"var(--tandem-fg)",border:"1px solid var(--tandem-border)"},children:(e=this.state.error)==null?void 0:e.message}),S.jsx("button",{onClick:()=>window.location.reload(),style:{marginTop:"1rem",padding:"8px 16px",cursor:"pointer",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",background:"var(--tandem-surface)",color:"var(--tandem-fg)"},children:"Reload"})]}):this.props.children}}const TW=Yz.createRoot(document.getElementById("root"));TW.render(S.jsx(sn.StrictMode,{children:S.jsx(EW,{children:S.jsx(CW,{})})}));export{MW as C,zW as a,LW as b,TM as c,OW as d,RW as e,wM as f,_W as g,S as j,Nx as l,NW as m,M as r,AM as u,DW as w};