agentic-documents 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/README.md +161 -11
- package/dist/{chunk-TFCRPEEM.js → chunk-34C47PDC.js} +1 -1
- package/dist/chunk-5IQX2W52.js +195 -0
- package/dist/chunk-6UYJV2EJ.js +163 -0
- package/dist/{chunk-R5XUTBC3.js → chunk-CN6UAW7B.js} +32 -9
- package/dist/chunk-DWVJIKVT.js +8 -0
- package/dist/{chunk-YBBQNCMC.js → chunk-GQ5E6T7Z.js} +18 -191
- package/dist/{chunk-FZA5LQV3.js → chunk-JBAQEIOH.js} +89 -12
- package/dist/chunk-KC5KFB5R.js +354 -0
- package/dist/{chunk-IU3YIQ4Y.js → chunk-V6TBTOHW.js} +38 -13
- package/dist/cli.js +16 -12
- package/dist/client.d.ts +23 -6
- package/dist/client.js +9 -2
- package/dist/{doc-C_8kCsl7.d.ts → doc-BXG9qG5X.d.ts} +8 -2
- package/dist/editor.css +37 -0
- package/dist/embed.d.ts +86 -0
- package/dist/embed.js +431 -0
- package/dist/formats.d.ts +52 -0
- package/dist/formats.js +24 -0
- package/dist/index.d.ts +12 -10
- package/dist/index.js +15 -9
- package/dist/live-worker.d.ts +2 -2
- package/dist/live-worker.js +7 -4
- package/dist/live.d.ts +6 -2
- package/dist/live.js +5 -3
- package/dist/{mcp-P2C75IIG.js → mcp-ZTUTC4CS.js} +5 -2
- package/dist/render-463xHb-x.d.ts +16 -0
- package/dist/{review-BQW2Ci2h.d.ts → review-Ds-i5Vnc.d.ts} +2 -16
- package/dist/{service-Do2Jwb5U.d.ts → service-Ck6oX-Kq.d.ts} +38 -5
- package/dist/ui/_headers +4 -0
- package/dist/ui/app.css +1 -0
- package/dist/ui/app.js +270 -0
- package/dist/ui/assets/inter-latin-ext-wght-normal-HA22NDSG.woff2 +0 -0
- package/dist/ui/assets/inter-latin-wght-normal-NRMW37G5.woff2 +0 -0
- package/dist/ui/assets/jetbrains-mono-latin-ext-wght-normal-TSLVDSQR.woff2 +0 -0
- package/dist/ui/assets/jetbrains-mono-latin-wght-normal-VBS632QH.woff2 +0 -0
- package/dist/ui/index.html +13 -0
- package/dist/worker.d.ts +2 -2
- package/dist/worker.js +7 -4
- package/llms.txt +1 -0
- package/package.json +43 -10
- package/dist/chunk-GYQFTF2E.js +0 -389
package/dist/ui/app.js
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
var z8=Object.create;var qk=Object.defineProperty;var U8=Object.getOwnPropertyDescriptor;var P8=Object.getOwnPropertyNames;var B8=Object.getPrototypeOf,H8=Object.prototype.hasOwnProperty;var ko=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}};var j8=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of P8(e))!H8.call(t,o)&&o!==n&&qk(t,o,{get:()=>e[o],enumerable:!(r=U8(e,o))||r.enumerable});return t};var R=(t,e,n)=>(n=t!=null?z8(B8(t)):{},j8(e||!t||!t.__esModule?qk(n,"default",{value:t,enumerable:!0}):n,t));var iA=ko(te=>{"use strict";var cb=Symbol.for("react.transitional.element"),V8=Symbol.for("react.portal"),F8=Symbol.for("react.fragment"),$8=Symbol.for("react.strict_mode"),Y8=Symbol.for("react.profiler"),q8=Symbol.for("react.consumer"),K8=Symbol.for("react.context"),G8=Symbol.for("react.forward_ref"),X8=Symbol.for("react.suspense"),W8=Symbol.for("react.memo"),Jk=Symbol.for("react.lazy"),J8=Symbol.for("react.activity"),Q8=Symbol.for("react.view_transition"),Kk=Symbol.iterator;function Z8(t){return t===null||typeof t!="object"?null:(t=Kk&&t[Kk]||t["@@iterator"],typeof t=="function"?t:null)}var Qk={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Zk=Object.assign,eA={};function Qa(t,e,n){this.props=t,this.context=e,this.refs=eA,this.updater=n||Qk}Qa.prototype.isReactComponent={};Qa.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};Qa.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function tA(){}tA.prototype=Qa.prototype;function ub(t,e,n){this.props=t,this.context=e,this.refs=eA,this.updater=n||Qk}var db=ub.prototype=new tA;db.constructor=ub;Zk(db,Qa.prototype);db.isPureReactComponent=!0;var Gk=Array.isArray;function ab(){}var qe={H:null,A:null,T:null,S:null},nA=Object.prototype.hasOwnProperty;function fb(t,e,n){var r=n.ref;return{$$typeof:cb,type:t,key:e,ref:r!==void 0?r:null,props:n}}function eH(t,e){return fb(t.type,e,t.props)}function hb(t){return typeof t=="object"&&t!==null&&t.$$typeof===cb}function tH(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var Xk=/\/+/g;function lb(t,e){return typeof t=="object"&&t!==null&&t.key!=null?tH(""+t.key):e.toString(36)}function nH(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(ab,ab):(t.status="pending",t.then(function(e){t.status==="pending"&&(t.status="fulfilled",t.value=e)},function(e){t.status==="pending"&&(t.status="rejected",t.reason=e)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function Ja(t,e,n,r,o){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var s=!1;if(t===null)s=!0;else switch(i){case"bigint":case"string":case"number":s=!0;break;case"object":switch(t.$$typeof){case cb:case V8:s=!0;break;case Jk:return s=t._init,Ja(s(t._payload),e,n,r,o)}}if(s)return o=o(t),s=r===""?"."+lb(t,0):r,Gk(o)?(n="",s!=null&&(n=s.replace(Xk,"$&/")+"/"),Ja(o,e,n,"",function(c){return c})):o!=null&&(hb(o)&&(o=eH(o,n+(o.key==null||t&&t.key===o.key?"":(""+o.key).replace(Xk,"$&/")+"/")+s)),e.push(o)),1;s=0;var l=r===""?".":r+":";if(Gk(t))for(var a=0;a<t.length;a++)r=t[a],i=l+lb(r,a),s+=Ja(r,e,n,i,o);else if(a=Z8(t),typeof a=="function")for(t=a.call(t),a=0;!(r=t.next()).done;)r=r.value,i=l+lb(r,a++),s+=Ja(r,e,n,i,o);else if(i==="object"){if(typeof t.then=="function")return Ja(nH(t),e,n,r,o);throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.")}return s}function yp(t,e,n){if(t==null)return t;var r=[],o=0;return Ja(t,r,"","",function(i){return e.call(n,i,o++)}),r}function rH(t){if(t._status===-1){var e=t._result,n=e();n.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r,n.status===void 0&&(n.status="fulfilled",n.value=r))},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r,n.status===void 0&&(n.status="rejected",n.reason=r))}),t._status===-1&&(t._status=0,t._result=n)}if(t._status===1)return t._result.default;throw t._result}var Wk=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)};function rA(t){var e=qe.T,n={};n.types=e!==null?e.types:null,qe.T=n;try{var r=t(),o=qe.S;o!==null&&o(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(ab,Wk)}catch(i){Wk(i)}finally{e!==null&&n.types!==null&&(e.types=n.types),qe.T=e}}function oA(t){var e=qe.T;if(e!==null){var n=e.types;n===null?e.types=[t]:n.indexOf(t)===-1&&n.push(t)}else rA(oA.bind(null,t))}var oH={map:yp,forEach:function(t,e,n){yp(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return yp(t,function(){e++}),e},toArray:function(t){return yp(t,function(e){return e})||[]},only:function(t){if(!hb(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};te.Activity=J8;te.Children=oH;te.Component=Qa;te.Fragment=F8;te.Profiler=Y8;te.PureComponent=ub;te.StrictMode=$8;te.Suspense=X8;te.ViewTransition=Q8;te.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=qe;te.__COMPILER_RUNTIME={__proto__:null,c:function(t){return qe.H.useMemoCache(t)}};te.addTransitionType=oA;te.cache=function(t){return function(){return t.apply(null,arguments)}};te.cacheSignal=function(){return null};te.cloneElement=function(t,e,n){if(t==null)throw Error("The argument must be a React element, but you passed "+t+".");var r=Zk({},t.props),o=t.key;if(e!=null)for(i in e.key!==void 0&&(o=""+e.key),e)!nA.call(e,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&e.ref===void 0||(r[i]=e[i]);var i=arguments.length-2;if(i===1)r.children=n;else if(1<i){for(var s=Array(i),l=0;l<i;l++)s[l]=arguments[l+2];r.children=s}return fb(t.type,o,r)};te.createContext=function(t){return t={$$typeof:K8,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider=t,t.Consumer={$$typeof:q8,_context:t},t};te.createElement=function(t,e,n){var r,o={},i=null;if(e!=null)for(r in e.key!==void 0&&(i=""+e.key),e)nA.call(e,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(o[r]=e[r]);var s=arguments.length-2;if(s===1)o.children=n;else if(1<s){for(var l=Array(s),a=0;a<s;a++)l[a]=arguments[a+2];o.children=l}if(t&&t.defaultProps)for(r in s=t.defaultProps,s)o[r]===void 0&&(o[r]=s[r]);return fb(t,i,o)};te.createRef=function(){return{current:null}};te.forwardRef=function(t){return{$$typeof:G8,render:t}};te.isValidElement=hb;te.lazy=function(t){return{$$typeof:Jk,_payload:{_status:-1,_result:t},_init:rH}};te.memo=function(t,e){return{$$typeof:W8,type:t,compare:e===void 0?null:e}};te.startTransition=rA;te.unstable_useCacheRefresh=function(){return qe.H.useCacheRefresh()};te.use=function(t){return qe.H.use(t)};te.useActionState=function(t,e,n){return qe.H.useActionState(t,e,n)};te.useCallback=function(t,e){return qe.H.useCallback(t,e)};te.useContext=function(t){return qe.H.useContext(t)};te.useDebugValue=function(){};te.useDeferredValue=function(t,e){return qe.H.useDeferredValue(t,e)};te.useEffect=function(t,e){return qe.H.useEffect(t,e)};te.useEffectEvent=function(t){return qe.H.useEffectEvent(t)};te.useId=function(){return qe.H.useId()};te.useImperativeHandle=function(t,e,n){return qe.H.useImperativeHandle(t,e,n)};te.useInsertionEffect=function(t,e){return qe.H.useInsertionEffect(t,e)};te.useLayoutEffect=function(t,e){return qe.H.useLayoutEffect(t,e)};te.useMemo=function(t,e){return qe.H.useMemo(t,e)};te.useOptimistic=function(t,e){return qe.H.useOptimistic(t,e)};te.useReducer=function(t,e,n){return qe.H.useReducer(t,e,n)};te.useRef=function(t){return qe.H.useRef(t)};te.useState=function(t){return qe.H.useState(t)};te.useSyncExternalStore=function(t,e,n){return qe.H.useSyncExternalStore(t,e,n)};te.useTransition=function(){return qe.H.useTransition()};te.version="19.3.1"});var P=ko((soe,sA)=>{"use strict";sA.exports=iA()});var gA=ko(nt=>{"use strict";function yb(t,e){var n=t.length;t.push(e);e:for(;0<n;){var r=n-1>>>1,o=t[r];if(0<vp(o,e))t[r]=e,t[n]=o,n=r;else break e}}function Ao(t){return t.length===0?null:t[0]}function wp(t){if(t.length===0)return null;var e=t[0],n=t.pop();if(n!==e){t[0]=n;e:for(var r=0,o=t.length,i=o>>>1;r<i;){var s=2*(r+1)-1,l=t[s],a=s+1,c=t[a];if(0>vp(l,n))a<o&&0>vp(c,l)?(t[r]=c,t[a]=n,r=a):(t[r]=l,t[s]=n,r=s);else if(a<o&&0>vp(c,n))t[r]=c,t[a]=n,r=a;else break e}}return e}function vp(t,e){var n=t.sortIndex-e.sortIndex;return n!==0?n:t.id-e.id}nt.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(lA=performance,nt.unstable_now=function(){return lA.now()}):(pb=Date,aA=pb.now(),nt.unstable_now=function(){return pb.now()-aA});var lA,pb,aA,ai=[],ss=[],iH=1,Hr=null,xn=3,vb=!1,kd=!1,Ad=!1,bb=!1,dA=typeof setTimeout=="function"?setTimeout:null,fA=typeof clearTimeout=="function"?clearTimeout:null,cA=typeof setImmediate<"u"?setImmediate:null;function bp(t){for(var e=Ao(ss);e!==null;){if(e.callback===null)wp(ss);else if(e.startTime<=t)wp(ss),e.sortIndex=e.expirationTime,yb(ai,e);else break;e=Ao(ss)}}function wb(t){if(Ad=!1,bp(t),!kd)if(Ao(ai)!==null)kd=!0,ec||(ec=!0,Za());else{var e=Ao(ss);e!==null&&Sb(wb,e.startTime-t)}}var ec=!1,Md=-1,hA=5,pA=-1;function mA(){return bb?!0:!(nt.unstable_now()-pA<hA)}function mb(){if(bb=!1,ec){var t=nt.unstable_now();pA=t;var e=!0;try{e:{kd=!1,Ad&&(Ad=!1,fA(Md),Md=-1),vb=!0;var n=xn;try{t:{for(bp(t),Hr=Ao(ai);Hr!==null&&!(Hr.expirationTime>t&&mA());){var r=Hr.callback;if(typeof r=="function"){Hr.callback=null,xn=Hr.priorityLevel;var o=r(Hr.expirationTime<=t);if(t=nt.unstable_now(),typeof o=="function"){Hr.callback=o,bp(t),e=!0;break t}Hr===Ao(ai)&&wp(ai),bp(t)}else wp(ai);Hr=Ao(ai)}if(Hr!==null)e=!0;else{var i=Ao(ss);i!==null&&Sb(wb,i.startTime-t),e=!1}}break e}finally{Hr=null,xn=n,vb=!1}e=void 0}}finally{e?Za():ec=!1}}}var Za;typeof cA=="function"?Za=function(){cA(mb)}:typeof MessageChannel<"u"?(gb=new MessageChannel,uA=gb.port2,gb.port1.onmessage=mb,Za=function(){uA.postMessage(null)}):Za=function(){dA(mb,0)};var gb,uA;function Sb(t,e){Md=dA(function(){t(nt.unstable_now())},e)}nt.unstable_IdlePriority=5;nt.unstable_ImmediatePriority=1;nt.unstable_LowPriority=4;nt.unstable_NormalPriority=3;nt.unstable_Profiling=null;nt.unstable_UserBlockingPriority=2;nt.unstable_cancelCallback=function(t){t.callback=null};nt.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):hA=0<t?Math.floor(1e3/t):5};nt.unstable_getCurrentPriorityLevel=function(){return xn};nt.unstable_next=function(t){switch(xn){case 1:case 2:case 3:var e=3;break;default:e=xn}var n=xn;xn=e;try{return t()}finally{xn=n}};nt.unstable_requestPaint=function(){bb=!0};nt.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var n=xn;xn=t;try{return e()}finally{xn=n}};nt.unstable_scheduleCallback=function(t,e,n){var r=nt.unstable_now();switch(typeof n=="object"&&n!==null?(n=n.delay,n=typeof n=="number"&&0<n?r+n:r):n=r,t){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=n+o,t={id:iH++,callback:e,priorityLevel:t,startTime:n,expirationTime:o,sortIndex:-1},n>r?(t.sortIndex=n,yb(ss,t),Ao(ai)===null&&t===Ao(ss)&&(Ad?(fA(Md),Md=-1):Ad=!0,Sb(wb,n-r))):(t.sortIndex=o,yb(ai,t),kd||vb||(kd=!0,ec||(ec=!0,Za()))),t};nt.unstable_shouldYield=mA;nt.unstable_wrapCallback=function(t){var e=xn;return function(){var n=xn;xn=e;try{return t.apply(this,arguments)}finally{xn=n}}}});var vA=ko((aoe,yA)=>{"use strict";yA.exports=gA()});var SA=ko(Cn=>{"use strict";var sH=P();function wA(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function ls(){}var Un={d:{f:ls,r:function(){throw Error(wA(522))},D:ls,C:ls,L:ls,m:ls,X:ls,S:ls,M:ls},p:0,findDOMNode:null},lH=Symbol.for("react.portal"),aH=Symbol.for("react.recoverable"),bA=Symbol.for("react.optimistic_key");function cH(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:lH,key:r==null?null:r===bA?bA:""+r,children:t,containerInfo:e,implementation:n}}var Rd=sH.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Sp(t,e){if(t==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}Cn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Un;Cn.browser=function(t){return{$$typeof:aH,_reason:t}};Cn.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(wA(299));return cH(t,e,null,n)};Cn.flushSync=function(t){var e=Rd.T,n=Un.p;try{if(Rd.T=null,Un.p=2,t)return t()}finally{Rd.T=e,Un.p=n,Un.d.f()}};Cn.preconnect=function(t,e){typeof t=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,Un.d.C(t,e))};Cn.prefetchDNS=function(t){typeof t=="string"&&Un.d.D(t)};Cn.preinit=function(t,e){if(typeof t=="string"&&e&&typeof e.as=="string"){var n=e.as,r=Sp(n,e.crossOrigin),o=typeof e.integrity=="string"?e.integrity:void 0,i=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;n==="style"?Un.d.S(t,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:r,integrity:o,fetchPriority:i}):n==="script"&&Un.d.X(t,{crossOrigin:r,integrity:o,fetchPriority:i,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};Cn.preinitModule=function(t,e){if(typeof t=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var n=Sp(e.as,e.crossOrigin);Un.d.M(t,{crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0})}}else e==null&&Un.d.M(t)};Cn.preload=function(t,e){if(typeof t=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var n=e.as,r=Sp(n,e.crossOrigin);Un.d.L(t,n,{crossOrigin:r,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};Cn.preloadModule=function(t,e){if(typeof t=="string")if(e){var n=Sp(e.as,e.crossOrigin);Un.d.m(t,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0})}else Un.d.m(t)};Cn.requestFormReset=function(t){Un.d.r(t)};Cn.unstable_batchedUpdates=function(t,e){return t(e)};Cn.useFormState=function(t,e,n){return Rd.H.useFormState(t,e,n)};Cn.useFormStatus=function(){return Rd.H.useHostTransitionStatus()};Cn.version="19.3.1"});var tc=ko((uoe,CA)=>{"use strict";function xA(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(xA)}catch(t){console.error(t)}}xA(),CA.exports=SA()});var cN=ko(ng=>{"use strict";var It=vA(),aR=P(),uH=tc();function A(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function cR(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function yf(t){for(var e=t,n=e;n&&!n.alternate;)e=n,(e.flags&4098)!==0&&(t=e.return),n=e.return;for(;e.return;)e=e.return;return e.tag===3?t:null}function uR(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function dR(t){if(t.tag===31){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function EA(t){if(yf(t)!==t)throw Error(A(188))}function dH(t){var e=t.alternate;if(!e){if(e=yf(t),e===null)throw Error(A(188));return e!==t?null:t}for(var n=t,r=e;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return EA(o),t;if(i===r)return EA(o),e;i=i.sibling}throw Error(A(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,l=o.child;l;){if(l===n){s=!0,n=o,r=i;break}if(l===r){s=!0,r=o,n=i;break}l=l.sibling}if(!s){for(l=i.child;l;){if(l===n){s=!0,n=i,r=o;break}if(l===r){s=!0,r=i,n=o;break}l=l.sibling}if(!s)throw Error(A(189))}}if(n.alternate!==r)throw Error(A(190))}if(n.tag!==3)throw Error(A(188));return n.stateNode.current===n?t:e}function fR(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t;for(t=t.child;t!==null;){if(e=fR(t),e!==null)return e;t=t.sibling}return null}function Jn(t,e,n,r,o,i){for(;t!==null;){if((t.tag===5||t.tag===27||t.tag===6)&&n(t,r,o,i)||(t.tag!==22||t.memoizedState===null)&&(e||t.tag!==5&&t.tag!==27)&&Jn(t.child,e,n,r,o,i))return!0;t=t.sibling}return!1}function Jl(t){for(t=t.return;t!==null;){if(t.tag===3||t.tag===5||t.tag===27)return t;t=t.return}return null}function TA(t){var e=!1;for(t=t.return;t!==null&&(t.tag===4&&(e=!0),!(t.tag===3||t.tag===5||t.tag===27));)t=t.return;return e}function hR(t){var e=[null,null],n=Jl(t);return n===null||pR(e,t,n.child,{foundSelf:!1}),e}function pR(t,e,n,r){for(;n!==null;){if(n===e)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return t[1]=n,!0;t[0]=n}else if((n.tag!==22||n.memoizedState===null)&&pR(t,e,n.child,r))return!0;n=n.sibling}return!1}function _t(t){switch(t.tag){case 5:case 27:case 6:return t.stateNode;case 3:return t.stateNode.containerInfo;default:throw Error(A(559))}}var ac=null,Zb=null;function fH(t,e,n){return t===n?!0:t===e?(ac=t,!0):!1}function hH(t,e,n){return t===n?(Zb=t,!1):t===e?(Zb!==null&&(ac=t),!0):!1}function kA(t){if(t===null)return null;do t=t===null?null:t.return;while(t&&t.tag!==5&&t.tag!==27&&t.tag!==3);return t||null}function ew(t,e,n){for(var r=0,o=t;o;o=n(o))r++;o=0;for(var i=e;i;i=n(i))o++;for(;0<r-o;)t=n(t),r--;for(;0<o-r;)e=n(e),o--;for(;r--;){if(t===e||e!==null&&t===e.alternate)return t;t=n(t),e=n(e)}return null}var Be=Object.assign,pH=Symbol.for("react.element"),xp=Symbol.for("react.transitional.element"),zd=Symbol.for("react.portal"),cc=Symbol.for("react.fragment"),mR=Symbol.for("react.strict_mode"),tw=Symbol.for("react.profiler"),gR=Symbol.for("react.consumer"),_o=Symbol.for("react.context"),u1=Symbol.for("react.forward_ref"),nw=Symbol.for("react.suspense"),rw=Symbol.for("react.suspense_list"),d1=Symbol.for("react.memo"),ds=Symbol.for("react.lazy"),ow=Symbol.for("react.activity"),mH=Symbol.for("react.legacy_hidden"),gH=Symbol.for("react.memo_cache_sentinel"),iw=Symbol.for("react.view_transition"),yH=Symbol.for("react.recoverable"),AA=Symbol.iterator;function Od(t){return t===null||typeof t!="object"?null:(t=AA&&t[AA]||t["@@iterator"],typeof t=="function"?t:null)}var vH=Symbol.for("react.client.reference");function sw(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===vH?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case cc:return"Fragment";case tw:return"Profiler";case mR:return"StrictMode";case nw:return"Suspense";case rw:return"SuspenseList";case ow:return"Activity";case iw:return"ViewTransition"}if(typeof t=="object")switch(t.$$typeof){case zd:return"Portal";case _o:return t.displayName||"Context";case gR:return(t._context.displayName||"Context")+".Consumer";case u1:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case d1:return e=t.displayName||null,e!==null?e:sw(t.type)||"Memo";case ds:e=t._payload,t=t._init;try{return sw(t(e))}catch{}}return null}var Ud=Array.isArray,Q=aR.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ae=uH.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Pl={pending:!1,data:null,method:null,action:null},lw=[],uc=-1;function Ho(t){return{current:t}}function an(t){0>uc||(t.current=lw[uc],lw[uc]=null,uc--)}function Xe(t,e){uc++,lw[uc]=t.current,t.current=e}var Uo=Ho(null),ef=Ho(null),ws=Ho(null),am=Ho(null);function cm(t,e){switch(Xe(ws,e),Xe(ef,t),Xe(Uo,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?jM(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=jM(e),t=PD(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}an(Uo),Xe(Uo,t)}function Oc(){an(Uo),an(ef),an(ws)}function aw(t){var e=t.memoizedState;e!==null&&(Hc._currentValue=e.memoizedState,Xe(am,t)),e=Uo.current;var n=PD(e,t.type);e!==n&&(Xe(ef,t),Xe(Uo,n))}function um(t){ef.current===t&&(an(Uo),an(ef)),am.current===t&&(an(am),Hc._currentValue=Pl)}var xb,MA;function cs(t){if(xb===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);xb=e&&e[1]||"",MA=-1<n.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+xb+t+MA}var Cb=!1;function Eb(t,e){if(!t||Cb)return"";Cb=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(e){var d=function(){throw Error()};if(Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(p){var f=p}Reflect.construct(t,[],d)}else{try{d.call()}catch(p){f=p}d=!1;try{var h=Object.getOwnPropertyDescriptor(t.prototype,"props");Object.defineProperty(t.prototype,"props",{configurable:!0,set:function(){throw Error()}}),d=!0,new t}finally{d&&(h!==void 0?Object.defineProperty(t.prototype,"props",h):delete t.prototype.props)}}}else{try{throw Error()}catch(p){f=p}(d=t())&&typeof d.catch=="function"&&d.catch(function(){})}}catch(p){if(p&&f&&typeof p.stack=="string")return[p.stack,f.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=r.DetermineComponentFrameRoot(),s=i[0],l=i[1];if(s&&l){var a=s.split(`
|
|
4
|
+
`),c=l.split(`
|
|
5
|
+
`);for(o=r=0;r<a.length&&!a[r].includes("DetermineComponentFrameRoot");)r++;for(;o<c.length&&!c[o].includes("DetermineComponentFrameRoot");)o++;if(r===a.length||o===c.length)for(r=a.length-1,o=c.length-1;1<=r&&0<=o&&a[r]!==c[o];)o--;for(;1<=r&&0<=o;r--,o--)if(a[r]!==c[o]){if(r!==1||o!==1)do if(r--,o--,0>o||a[r]!==c[o]){var u=`
|
|
6
|
+
`+a[r].replace(" at new "," at ");return t.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",t.displayName)),u}while(1<=r&&0<=o);break}}}finally{Cb=!1,Error.prepareStackTrace=n}return(n=t?t.displayName||t.name:"")?cs(n):""}function bH(t,e){switch(t.tag){case 26:case 27:case 5:return cs(t.type);case 16:return cs("Lazy");case 13:return t.child!==e&&e!==null?cs("Suspense Fallback"):cs("Suspense");case 19:return cs("SuspenseList");case 0:case 15:return Eb(t.type,!1);case 11:return Eb(t.type.render,!1);case 1:return Eb(t.type,!0);case 31:return cs("Activity");case 30:return cs("ViewTransition");default:return""}}function RA(t){try{var e="",n=null;do e+=bH(t,n),n=t,t=t.return;while(t);return e}catch(r){return`
|
|
7
|
+
Error generating stack: `+r.message+`
|
|
8
|
+
`+r.stack}}var cw=Object.prototype.hasOwnProperty,f1=It.unstable_scheduleCallback,Tb=It.unstable_cancelCallback,wH=It.unstable_shouldYield,SH=It.unstable_requestPaint,wr=It.unstable_now,xH=It.unstable_getCurrentPriorityLevel,yR=It.unstable_ImmediatePriority,vR=It.unstable_UserBlockingPriority,dm=It.unstable_NormalPriority,CH=It.unstable_LowPriority,bR=It.unstable_IdlePriority,EH=It.log,TH=It.unstable_setDisableYieldValue,vf=null,Sr=null;function ps(t){if(typeof EH=="function"&&TH(t),Sr&&typeof Sr.setStrictMode=="function")try{Sr.setStrictMode(vf,t)}catch{}}var xr=Math.clz32?Math.clz32:MH,kH=Math.log,AH=Math.LN2;function MH(t){return t>>>=0,t===0?32:31-(kH(t)/AH|0)|0}var Cp=256,Ep=262144,Tp=4194304;function _l(t){var e=t&42;if(e!==0)return e;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 t&-t;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Um(t,e,n){var r=t.pendingLanes;if(r===0)return 0;var o=0,i=t.suspendedLanes,s=t.pingedLanes;t=t.warmLanes;var l=r&134217727;return l!==0?(r=l&~i,r!==0?o=_l(r):(s&=l,s!==0?o=_l(s):n||(n=l&~t,n!==0&&(o=_l(n))))):(l=r&~i,l!==0?o=_l(l):s!==0?o=_l(s):n||(n=r&~t,n!==0&&(o=_l(n)))),o===0?0:e!==0&&e!==o&&(e&i)===0&&(i=o&-o,n=e&-e,i>=n||i===32&&(n&4194048)!==0)?e:o}function bf(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function wR(t,e){(e&8)!==0&&(e|=e&32);var n=t.entangledLanes;if(n!==0)for(t=t.entanglements,n&=e;0<n;){var r=31-xr(n),o=1<<r;e|=t[r],n&=~o}return e}function RH(t,e){switch(t){case 1:case 2:case 4:case 8:case 64:return e+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 e+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 SR(){var t=Tp;return Tp<<=1,(Tp&62914560)===0&&(Tp=4194304),t}function kb(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function wf(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function OH(t,e,n,r,o,i){var s=t.pendingLanes;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=n,t.entangledLanes&=n,t.errorRecoveryDisabledLanes&=n,t.shellSuspendCounter=0;var l=t.entanglements,a=t.expirationTimes,c=t.hiddenUpdates;for(n=s&~n;0<n;){var u=31-xr(n),d=1<<u;l[u]=0,a[u]=-1;var f=c[u];if(f!==null)for(c[u]=null,u=0;u<f.length;u++){var h=f[u];h!==null&&(h.lane&=-536870913)}n&=~d}r!==0&&xR(t,r,0),i!==0&&o===0&&t.tag!==0&&(t.suspendedLanes|=i&~(s&~e))}function xR(t,e,n){t.pendingLanes|=e,t.suspendedLanes&=~e;var r=31-xr(e);t.entangledLanes|=e,t.entanglements[r]=t.entanglements[r]|1073741824|n&261930}function CR(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-xr(n),o=1<<r;o&e|t[r]&e&&(t[r]|=e),n&=~o}}function ER(t,e){var n=e&-e;return n=(n&42)!==0?1:h1(n),(n&(t.suspendedLanes|e))!==0?0:n}function h1(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function p1(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function TR(){var t=Ae.p;return t!==0?t:(t=window.event,t===void 0?32:sN(t.type))}function OA(t,e){var n=Ae.p;try{return Ae.p=t,e()}finally{Ae.p=n}}var Si=Math.random().toString(36).slice(2),sn="__reactFiber$"+Si,Qn="__reactProps$"+Si,Fc="__reactContainer$"+Si,DA="__reactEvents$"+Si,DH="__reactListeners$"+Si,NH="__reactHandles$"+Si,NA="__reactResources$"+Si,Sf="__reactMarker$"+Si,fm="__reactLoad$"+Si;function Pm(t){delete t[sn],delete t[Qn],delete t[DH],delete t[NH]}function zl(t){var e;if(e=t[sn])return e;for(var n=t.parentNode;n;){if(e=n[Fc]||n[sn]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=XM(t);t!==null;){if(n=t[sn])return n;t=XM(t)}return e}t=n,n=t.parentNode}return null}function $c(t){if(t=t[sn]||t[Fc]){var e=t.tag;if(e===5||e===6||e===13||e===31||e===26||e===27||e===3)return t}return null}function Pd(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t.stateNode;throw Error(A(33))}function wc(t){var e=t[NA];return e||(e=t[NA]={hoistableStyles:new Map,hoistableScripts:new Map}),e}function qt(t){t[Sf]=!0}function kR(t){t[fm]=void 0}var AR=new Set,MR={};function Ql(t,e){Dc(t,e),Dc(t+"Capture",e)}function Dc(t,e){for(MR[t]=e,t=0;t<e.length;t++)AR.add(e[t])}var _H=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]*$"),_A={},IA={};function IH(t){return cw.call(IA,t)?!0:cw.call(_A,t)?!1:_H.test(t)?IA[t]=!0:(_A[t]=!0,!1)}var we=!1;function LA(){var t=we;return we=!1,t}function Fp(t,e,n){if(IH(e))if(n===null)t.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":t.removeAttribute(e);return;case"boolean":var r=e.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){t.removeAttribute(e);return}}t.setAttribute(e,n)}}function kp(t,e,n){if(n===null)t.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(e);return}t.setAttribute(e,n)}}function ci(t,e,n,r){if(r===null)t.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttributeNS(e,n,r)}}function gr(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function RR(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function LH(t,e,n){var r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e);if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var o=r.get,i=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return o.call(this)},set:function(s){n=""+s,i.call(this,s)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function uw(t){if(!t._valueTracker){var e=RR(t)?"checked":"value";t._valueTracker=LH(t,e,""+t[e])}}function OR(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=RR(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}var zH=/[\n"\\]/g;function Yr(t){return t.replace(zH,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function dw(t,e,n,r,o,i,s,l){t.name="",s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?t.type=s:t.removeAttribute("type"),e!=null?s==="number"?(e===0&&t.value===""||t.value!=e)&&(t.value=""+gr(e)):t.value!==""+gr(e)&&(t.value=""+gr(e)):s!=="submit"&&s!=="reset"||t.removeAttribute("value"),e!=null?s==="number"&&t.value==e?Ab(t,gr(t.value)):Ab(t,gr(e)):n!=null?Ab(t,gr(n)):r!=null&&t.removeAttribute("value"),o==null&&i!=null&&(t.defaultChecked=!!i),o!=null&&(t.checked=o&&typeof o!="function"&&typeof o!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?t.name=""+gr(l):t.removeAttribute("name")}function DR(t,e,n,r,o,i,s,l){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(t.type=i),e!=null||n!=null){if(!(i!=="submit"&&i!=="reset"||e!=null)){uw(t);return}n=n!=null?""+gr(n):"",e=e!=null?""+gr(e):n,l||e===t.value||(t.value=e),t.defaultValue=e}r=r??o,r=typeof r!="function"&&typeof r!="symbol"&&!!r,t.checked=l?t.checked:!!r,t.defaultChecked=!!r,s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(t.name=s),uw(t)}function Ab(t,e){t.defaultValue!==""+e&&(t.defaultValue=""+e)}function Sc(t,e,n,r){if(t=t.options,e){e={};for(var o=0;o<n.length;o++)e["$"+n[o]]=!0;for(n=0;n<t.length;n++)o=e.hasOwnProperty("$"+t[n].value),t[n].selected!==o&&(t[n].selected=o),o&&r&&(t[n].defaultSelected=!0)}else{for(n=""+gr(n),e=null,o=0;o<t.length;o++){if(t[o].value===n){t[o].selected=!0,r&&(t[o].defaultSelected=!0);return}e!==null||t[o].disabled||(e=t[o])}e!==null&&(e.selected=!0)}}function NR(t,e,n){if(e!=null&&(e=""+gr(e),e!==t.value&&(t.value=e),n==null)){t.defaultValue!==e&&(t.defaultValue=e);return}t.defaultValue=n!=null?""+gr(n):""}function _R(t,e,n,r){if(e==null){if(r!=null){if(n!=null)throw Error(A(92));if(Ud(r)){if(1<r.length)throw Error(A(93));r=r[0]}n=r}n==null&&(n=""),e=n}n=gr(e),t.defaultValue=n,r=t.textContent,r===n&&r!==""&&r!==null&&(t.value=r),uw(t)}function Nc(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var UH=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 zA(t,e,n){var r=e.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?r?t.setProperty(e,""):e==="float"?t.cssFloat="":t[e]="":r?t.setProperty(e,n):typeof n!="number"||n===0||UH.has(e)?e==="float"?t.cssFloat=n:t[e]=(""+n).trim():t[e]=n+"px"}function IR(t,e,n){if(e!=null&&typeof e!="object")throw Error(A(62));if(t=t.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||e!=null&&e.hasOwnProperty(r)||(r.indexOf("--")===0?t.setProperty(r,""):r==="float"?t.cssFloat="":t[r]="",we=!0);for(var o in e)r=e[o],e.hasOwnProperty(o)&&n[o]!==r&&(zA(t,o,r),we=!0)}else for(var i in e)e.hasOwnProperty(i)&&zA(t,i,e[i])}function m1(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var PH=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"],["maskType","mask-type"],["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"]]),BH=/^[\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 $p(t){return BH.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Io(){}var fw=null;function g1(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var dc=null,xc=null;function UA(t){var e=$c(t);if(e&&(t=e.stateNode)){var n=t[Qn]||null;e:switch(t=e.stateNode,e.type){case"input":if(dw(t,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Yr(""+e)+'"][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var o=r[Qn]||null;if(!o)throw Error(A(90));dw(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(e=0;e<n.length;e++)r=n[e],r.form===t.form&&OR(r)}break e;case"textarea":NR(t,n.value,n.defaultValue);break e;case"select":e=n.value,e!=null&&Sc(t,!!n.multiple,e,!1)}}}var Mb=!1;function LR(t,e,n){if(Mb)return t(e,n);Mb=!0;try{var r=t(e);return r}finally{if(Mb=!1,(dc!==null||xc!==null)&&(Qm(),dc&&(e=dc,t=xc,xc=dc=null,UA(e),t)))for(e=0;e<t.length;e++)UA(t[e])}}function tf(t,e){var n=t.stateNode;if(n===null)return null;var r=n[Qn]||null;if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(A(231,e,typeof n));return n}var mi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hw=!1;if(mi)try{nc={},Object.defineProperty(nc,"passive",{get:function(){hw=!0}}),window.addEventListener("test",nc,nc),window.removeEventListener("test",nc,nc)}catch{hw=!1}var nc,ms=null,y1=null,Yp=null;function zR(){if(Yp)return Yp;var t,e=y1,n=e.length,r,o="value"in ms?ms.value:ms.textContent,i=o.length;for(t=0;t<n&&e[t]===o[t];t++);var s=n-t;for(r=1;r<=s&&e[n-r]===o[i-r];r++);return Yp=o.slice(t,1<r?1-r:void 0)}function qp(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Ap(){return!0}function PA(){return!1}function jn(t){function e(n,r,o,i,s){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null;for(var l in t)t.hasOwnProperty(l)&&(n=t[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Ap:PA,this.isPropagationStopped=PA,this}return Be(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Ap)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ap)},persist:function(){},isPersistent:Ap}),e}var Ls={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bm=jn(Ls),xf=Be({},Ls,{view:0,detail:0}),HH=jn(xf),Rb,Ob,Dd,Hm=Be({},xf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:v1,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Dd&&(Dd&&t.type==="mousemove"?(Rb=t.screenX-Dd.screenX,Ob=t.screenY-Dd.screenY):Ob=Rb=0,Dd=t),Rb)},movementY:function(t){return"movementY"in t?t.movementY:Ob}}),BA=jn(Hm),jH=Be({},Hm,{dataTransfer:0}),VH=jn(jH),FH=Be({},xf,{relatedTarget:0}),Db=jn(FH),$H=Be({},Ls,{animationName:0,elapsedTime:0,pseudoElement:0}),YH=jn($H),qH=Be({},Ls,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),KH=jn(qH),GH=Be({},Ls,{data:0}),HA=jn(GH),XH={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},WH={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"},JH={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function QH(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=JH[t])?!!e[t]:!1}function v1(){return QH}var ZH=Be({},xf,{key:function(t){if(t.key){var e=XH[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=qp(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?WH[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:v1,charCode:function(t){return t.type==="keypress"?qp(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?qp(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),ej=jn(ZH),tj=Be({},Hm,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jA=jn(tj),nj=Be({},Ls,{submitter:0}),rj=jn(nj),oj=Be({},xf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:v1}),ij=jn(oj),sj=Be({},Ls,{propertyName:0,elapsedTime:0,pseudoElement:0}),lj=jn(sj),aj=Be({},Hm,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),cj=jn(aj),uj=Be({},Ls,{newState:0,oldState:0,source:0}),dj=jn(uj),fj=[9,13,27,32],b1=mi&&"CompositionEvent"in window,jd=null;mi&&"documentMode"in document&&(jd=document.documentMode);var hj=mi&&"TextEvent"in window&&!jd,UR=mi&&(!b1||jd&&8<jd&&11>=jd),VA=" ",FA=!1;function PR(t,e){switch(t){case"keyup":return fj.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function BR(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var fc=!1;function pj(t,e){switch(t){case"compositionend":return BR(e);case"keypress":return e.which!==32?null:(FA=!0,VA);case"textInput":return t=e.data,t===VA&&FA?null:t;default:return null}}function mj(t,e){if(fc)return t==="compositionend"||!b1&&PR(t,e)?(t=zR(),Yp=y1=ms=null,fc=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return UR&&e.locale!=="ko"?null:e.data;default:return null}}var gj={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 $A(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!gj[t.type]:e==="textarea"}function HR(t,e,n,r){dc?xc?xc.push(r):xc=[r]:dc=r,e=Im(e,"onChange"),0<e.length&&(n=new Bm("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var Vd=null,nf=null;function yj(t){LD(t,0)}function jm(t){var e=Pd(t);if(OR(e))return t}function YA(t,e){if(t==="change")return e}var jR=!1;mi&&(mi?(Rp="oninput"in document,Rp||(Nb=document.createElement("div"),Nb.setAttribute("oninput","return;"),Rp=typeof Nb.oninput=="function"),Mp=Rp):Mp=!1,jR=Mp&&(!document.documentMode||9<document.documentMode));var Mp,Rp,Nb;function qA(){Vd&&(Vd.detachEvent("onpropertychange",VR),nf=Vd=null)}function VR(t){if(t.propertyName==="value"&&jm(nf)){var e=[];HR(e,nf,t,g1(t)),LR(yj,e)}}function vj(t,e,n){t==="focusin"?(qA(),Vd=e,nf=n,Vd.attachEvent("onpropertychange",VR)):t==="focusout"&&qA()}function bj(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return jm(nf)}function wj(t,e){if(t==="click")return jm(e)}function Sj(t,e){if(t==="input"||t==="change")return jm(e)}function xj(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Er=typeof Object.is=="function"?Object.is:xj;function rf(t,e){if(Er(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!cw.call(e,o)||!Er(t[o],e[o]))return!1}return!0}function pw(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function KA(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function GA(t,e){var n=KA(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=KA(n)}}function FR(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?FR(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function $R(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var e=pw(t.document);e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=pw(t.document)}return e}function w1(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}var Cj=mi&&"documentMode"in document&&11>=document.documentMode,hc=null,mw=null,Fd=null,gw=!1;function XA(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;gw||hc==null||hc!==pw(r)||(r=hc,"selectionStart"in r&&w1(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Fd&&rf(Fd,r)||(Fd=r,r=Im(mw,"onSelect"),0<r.length&&(e=new Bm("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=hc)))}function Dl(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var pc={animationend:Dl("Animation","AnimationEnd"),animationiteration:Dl("Animation","AnimationIteration"),animationstart:Dl("Animation","AnimationStart"),transitionrun:Dl("Transition","TransitionRun"),transitionstart:Dl("Transition","TransitionStart"),transitioncancel:Dl("Transition","TransitionCancel"),transitionend:Dl("Transition","TransitionEnd")},_b={},YR={};mi&&(YR=document.createElement("div").style,"AnimationEvent"in window||(delete pc.animationend.animation,delete pc.animationiteration.animation,delete pc.animationstart.animation),"TransitionEvent"in window||delete pc.transitionend.transition);function Zl(t){if(_b[t])return _b[t];if(!pc[t])return t;var e=pc[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in YR)return _b[t]=e[n];return t}var qR=Zl("animationend"),KR=Zl("animationiteration"),GR=Zl("animationstart"),Ej=Zl("transitionrun"),Tj=Zl("transitionstart"),kj=Zl("transitioncancel"),XR=Zl("transitionend"),WR=new Map,yw="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(" ");yw.push("scrollEnd");function po(t,e){WR.set(t,e),Ql(e,[t])}var Aj=0;function gi(t,e){if(t.name!=null&&t.name!=="auto")return t.name;if(e.autoName!==null)return e.autoName;t=ho.identifierPrefix;var n=Aj++;return t="_"+t+"t_"+n.toString(32)+"_",e.autoName=t}function WA(t){if(t==null||typeof t=="string")return t;var e=null,n=Rc;if(n!==null)for(var r=0;r<n.length;r++){var o=t[n[r]];if(o!=null){if(o==="none")return"none";e=e==null?o:e+(" "+o)}}return e??t.default}function xi(t,e){return t=WA(t),e=WA(e),e==null?t==="auto"?null:t:e==="auto"?null:e}var hm=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Vr=[],mc=0,S1=0;function Vm(){for(var t=mc,e=S1=mc=0;e<t;){var n=Vr[e];Vr[e++]=null;var r=Vr[e];Vr[e++]=null;var o=Vr[e];Vr[e++]=null;var i=Vr[e];if(Vr[e++]=null,r!==null&&o!==null){var s=r.pending;s===null?o.next=o:(o.next=s.next,s.next=o),r.pending=o}i!==0&&JR(n,o,i)}}function Fm(t,e,n,r){Vr[mc++]=t,Vr[mc++]=e,Vr[mc++]=n,Vr[mc++]=r,S1|=r,t.lanes|=r,t=t.alternate,t!==null&&(t.lanes|=r)}function x1(t,e,n,r){return Fm(t,e,n,r),pm(t)}function ea(t,e){return Fm(t,null,null,e),pm(t)}function JR(t,e,n){t.lanes|=n;var r=t.alternate;r!==null&&(r.lanes|=n);for(var o=!1,i=t.return;i!==null;)i.childLanes|=n,r=i.alternate,r!==null&&(r.childLanes|=n),i.tag===22&&(t=i.stateNode,t===null||t._visibility&1||(o=!0)),t=i,i=i.return;return t.tag===3?(i=t.stateNode,o&&e!==null&&(o=31-xr(n),t=i.hiddenUpdates,r=t[o],r===null?t[o]=[e]:r.push(e),e.lane=n|536870912),i):null}function pm(t){if(50<Zd)throw Zd=0,nm=null,Error(A(185));for(var e=t.return;e!==null;)t=e,e=t.return;return t.tag===3?t.stateNode:null}var gc={};function Mj(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Xn(t,e,n,r){return new Mj(t,e,n,r)}function C1(t){return t=t.prototype,!(!t||!t.isReactComponent)}function hi(t,e){var n=t.alternate;return n===null?(n=Xn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&1206910976,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n.refCleanup=t.refCleanup,n}function QR(t,e){t.flags&=1206910978;var n=t.alternate;return n===null?(t.childLanes=0,t.lanes=e,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,t.type=n.type,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),t}function Kp(t,e,n,r,o,i){var s=0;if(r=t,typeof r=="function")C1(r)&&(s=1);else if(typeof r=="string")s=e6(t,n,Uo.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(r){case ow:return t=Xn(31,n,e,o),t.elementType=ow,t.lanes=i,t;case cc:return Bl(n.children,o,i,e);case mR:s=8,o|=24;break;case tw:return t=Xn(12,n,e,o|2),t.elementType=tw,t.lanes=i,t;case nw:return t=Xn(13,n,e,o),t.elementType=nw,t.lanes=i,t;case rw:return t=Xn(19,n,e,o),t.elementType=rw,t.lanes=i,t;case mH:case iw:return t=o|32,t=Xn(30,n,e,t),t.elementType=iw,t.lanes=i,t.stateNode={autoName:null,paired:null,clones:null,ref:null},t;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case _o:s=10;break e;case gR:s=9;break e;case u1:s=11;break e;case d1:s=14;break e;case ds:s=16,r=null;break e}s=29,n=Error(A(130,t===null?"null":typeof t,"")),r=null}return e=Xn(s,n,e,o),e.elementType=t,e.type=r,e.lanes=i,e}function Bl(t,e,n,r){return t=Xn(7,t,r,e),t.lanes=n,t}function Ib(t,e,n){return t=Xn(6,t,null,e),t.lanes=n,t}function ZR(t){var e=Xn(18,null,null,0);return e.stateNode=t,e}function Lb(t,e,n){return e=Xn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}var JA=new WeakMap;function qr(t,e){if(typeof t=="object"&&t!==null){var n=JA.get(t);return n!==void 0?n:(e={value:t,source:e,stack:RA(e)},JA.set(t,e),e)}return{value:t,source:e,stack:RA(e)}}var yc=[],vc=0,mm=null,of=0,Fr=[],$r=0,Os=null,Lo=1,zo="";function di(t,e){yc[vc++]=of,yc[vc++]=mm,mm=t,of=e}function eO(t,e,n){Fr[$r++]=Lo,Fr[$r++]=zo,Fr[$r++]=Os,Os=t;var r=Lo;t=zo;var o=32-xr(r)-1;r&=~(1<<o),n+=1;var i=32-xr(e)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,Lo=1<<32-xr(e)+o|n<<o|r,zo=i+t}else Lo=1<<i|n<<o|r,zo=t}function $m(t){t.return!==null&&(di(t,1),eO(t,1,0))}function E1(t){for(;t===mm;)mm=yc[--vc],yc[vc]=null,of=yc[--vc],yc[vc]=null;for(;t===Os;)Os=Fr[--$r],Fr[$r]=null,zo=Fr[--$r],Fr[$r]=null,Lo=Fr[--$r],Fr[$r]=null}function tO(t,e){Fr[$r++]=Lo,Fr[$r++]=zo,Fr[$r++]=Os,Lo=e.id,zo=e.overflow,Os=t}var Kt=null,Ge=null,ue=!1,Ss=null,Kr=!1,vw=Error(A(519));function Ds(t){var e=Error(A(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw sf(qr(e,t)),vw}function QA(t){var e=t.stateNode,n=t.type,r=t.memoizedProps;switch(e[sn]=t,e[Qn]=r,n){case"dialog":fe("cancel",e),fe("close",e);break;case"iframe":case"object":case"embed":fe("load",e);break;case"video":case"audio":for(n=0;n<uf.length;n++)fe(uf[n],e);break;case"source":fe("error",e);break;case"img":case"image":case"link":fe("error",e),fe("load",e);break;case"details":fe("toggle",e);break;case"input":fe("invalid",e),DR(e,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":fe("invalid",e);break;case"textarea":fe("invalid",e),_R(e,r.value,r.defaultValue,r.children)}n=r.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||e.textContent===""+n||r.suppressHydrationWarning===!0||UD(e.textContent,n)?(r.popover!=null&&(fe("beforetoggle",e),fe("toggle",e)),r.onScroll!=null&&fe("scroll",e),r.onScrollEnd!=null&&fe("scrollend",e),r.onClick!=null&&(e.onclick=Io),e=!0):e=!1,e||Ds(t,!0)}function gm(t){for(Kt=t.return;Kt;)switch(Kt.tag){case 5:case 31:case 13:Kr=!1;return;case 27:case 3:Kr=!0;return;default:Kt=Kt.return}}function rc(t){if(t!==Kt)return!1;if(!ue)return gm(t),ue=!0,!1;var e=t.tag,n;if((n=e!==3&&e!==27)&&((n=e===5)&&(n=t.type,n=!(n!=="form"&&n!=="button")||n1(t.type,t.memoizedProps)),n=!n),n&&Ge&&Ds(t),gm(t),e===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(A(317));Ge=GM(t)}else if(e===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(A(317));Ge=GM(t)}else e===27?(e=Ge,zs(t.type)?(t=s1,s1=null,Ge=t):Ge=e):Ge=Kt?Gr(t.stateNode.nextSibling):null;return!0}function Fl(){Ge=Kt=null,ue=!1}function zb(){var t=Ss;return t!==null&&(Kn===null?Kn=t:Kn.push.apply(Kn,t),Ss=null),t}function sf(t){Ss===null?Ss=[t]:Ss.push(t)}var bw=Ho(null),ta=null,fi=null;function gs(t,e,n){Xe(bw,e._currentValue),e._currentValue=n}function pi(t){t._currentValue=bw.current,an(bw)}function Gp(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function ww(t,e,n,r){var o=t.child;for(o!==null&&(o.return=t);o!==null;){var i=o.dependencies;if(i!==null){var s=o.child;i=i.firstContext;e:for(;i!==null;){var l=i;i=o;for(var a=0;a<e.length;a++)if(l.context===e[a]){i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Gp(i.return,n,t),r||(s=null);break e}i=l.next}}else if(o.tag===18){if(s=o.return,s===null)throw Error(A(341));s.lanes|=n,i=s.alternate,i!==null&&(i.lanes|=n),Gp(s,n,t),s=null}else o.tag===13&&o.memoizedState!==null&&o.memoizedState.dehydrated===null?(o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),Gp(o.return,n,t),s=o.child,s=s!==null?s.sibling:null):s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}function $l(t,e,n,r){t=null;for(var o=e,i=!1;o!==null;){if(!i){if((o.flags&524288)!==0)i=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var s=o.alternate;if(s===null)throw Error(A(387));if(s=s.memoizedProps,s!==null){var l=o.type;Er(o.pendingProps.value,s.value)||(t!==null?t.push(l):t=[l])}}else if(o===am.current){if(s=o.alternate,s===null)throw Error(A(387));s.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(t!==null?t.push(Hc):t=[Hc])}o=o.return}return t!==null&&ww(e,t,n,r),e.flags|=262144,t!==null}function ym(t){for(t=t.firstContext;t!==null;){if(!Er(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Yl(t){ta=t,fi=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function ln(t){return nO(ta,t)}function Op(t,e){return ta===null&&Yl(t),nO(t,e)}function nO(t,e){var n=e._currentValue;if(e={context:e,memoizedValue:n,next:null},fi===null){if(t===null)throw Error(A(308));fi=e,t.dependencies={lanes:0,firstContext:e},t.flags|=524288}else fi=fi.next=e;return n}var Rj=typeof AbortController<"u"?AbortController:function(){var t=[],e=this.signal={aborted:!1,addEventListener:function(n,r){t.push(r)}};this.abort=function(){e.aborted=!0,t.forEach(function(n){return n()})}},Oj=It.unstable_scheduleCallback,Dj=It.unstable_NormalPriority,xt={$$typeof:_o,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function T1(){return{controller:new Rj,data:new Map,refCount:0}}function Cf(t){t.refCount--,t.refCount===0&&Oj(Dj,function(){t.controller.abort()})}function ZA(t,e){if((t.pendingLanes&4194048)!==0){var n=t.transitionTypes;for(n===null&&(n=t.transitionTypes=[]),t=0;t<e.length;t++){var r=e[t];n.indexOf(r)===-1&&n.push(r)}}}var Bd=null;function Nj(t){var e=t.transitionTypes;return t.transitionTypes=null,e}var $d=null,Sw=0,ql=0,Cc=null;function _j(t,e){if($d===null){var n=$d=[];Sw=0,ql=Z1(),Cc={status:"pending",value:void 0,then:function(r){n.push(r)}}}return Sw++,e.then(eM,eM),e}function eM(){if(--Sw===0&&(Bd=null,$d!==null)){Cc!==null&&(Cc.status="fulfilled");var t=$d;$d=null,ql=0,Cc=null;for(var e=0;e<t.length;e++)(0,t[e])()}}function Ij(t,e){var n=[],r={status:"pending",value:null,reason:null,then:function(o){n.push(o)}};return t.then(function(){r.status="fulfilled",r.value=e;for(var o=0;o<n.length;o++)(0,n[o])(e)},function(o){for(r.status="rejected",r.reason=o,o=0;o<n.length;o++)(0,n[o])(void 0)}),r}var tM=Q.S;Q.S=function(t,e){if(wD=wr(),typeof e=="object"&&e!==null&&typeof e.then=="function"&&_j(t,e),Bd!==null)for(var n=Uc;n!==null;)ZA(n,Bd),n=n.next;if(n=t.types,n!==null){for(var r=Uc;r!==null;)ZA(r,n),r=r.next;if(ql!==0){r=Bd,r===null&&(r=Bd=[]);for(var o=0;o<n.length;o++){var i=n[o];r.indexOf(i)===-1&&r.push(i)}}}tM!==null&&tM(t,e)};var Hl=Ho(null);function k1(){var t=Hl.current;return t!==null?t:Pe.pooledCache}function Xp(t,e){e===null?Xe(Hl,Hl.current):Xe(Hl,e.pool)}function rO(){var t=k1();return t===null?null:{parent:xt._currentValue,pool:t}}var Yc=Error(A(460)),A1=Error(A(474)),Ym=Error(A(542)),vm={then:function(){}};function nM(t){return t=t.status,t==="fulfilled"||t==="rejected"}function oO(t,e,n){switch(n=t[n],n===void 0?t.push(e):n!==e&&(e.then(Io,Io),e=n),e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,oM(t),t===void 0&&!("reason"in e)?Error(A(600)):t;default:if(typeof e.status=="string")e.then(Io,Io);else{if(t=Pe,t!==null&&100<t.shellSuspendCounter)throw Error(A(482));t=e,t.status="pending",t.then(function(r){if(e.status==="pending"){var o=e;o.status="fulfilled",o.value=r}},function(r){if(e.status==="pending"){var o=e;o.status="rejected",o.reason=r}})}switch(e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,oM(t),t}throw jl=e,Yc}}function Il(t){try{var e=t._init;return e(t._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(jl=n,Yc):n}}var jl=null;function rM(){if(jl===null)throw Error(A(459));var t=jl;return jl=null,t}function oM(t){if(t===Yc||t===Ym)throw Error(A(483))}var Ec=null,lf=0;function Dp(t){var e=lf;return lf+=1,Ec===null&&(Ec=[]),oO(Ec,t,e)}function as(t,e){e=e.props.ref,t.ref=e!==void 0?e:null}function Np(t,e){throw e.$$typeof===pH?Error(A(525)):(t=Object.prototype.toString.call(e),Error(A(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)))}function iO(t){function e(g,v){if(t){var b=g.deletions;b===null?(g.deletions=[v],g.flags|=16):b.push(v)}}function n(g,v){if(!t)return null;for(;v!==null;)e(g,v),v=v.sibling;return null}function r(g){for(var v=new Map;g!==null;)g.key===null?v.set(g.index,g):v.set(g.key,g),g=g.sibling;return v}function o(g,v){return g=hi(g,v),g.index=0,g.sibling=null,g}function i(g,v,b){return g.index=b,t?(b=g.alternate,b!==null?(b=b.index,b<v?(g.flags|=2,v):b):(g.flags|=134217730,v)):(g.flags|=1048576,v)}function s(g){return t&&g.alternate===null&&(g.flags|=134217730),g}function l(g,v,b,w){return v===null||v.tag!==6?(v=Ib(b,g.mode,w),v.return=g,v):(v=o(v,b),v.return=g,v)}function a(g,v,b,w){var S=b.type;return S===cc?(g=u(g,v,b.props.children,w,b.key),as(g,b),g):v!==null&&(v.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===ds&&Il(S)===v.type)?(v=o(v,b.props),as(v,b),v.return=g,v):(v=Kp(b.type,b.key,b.props,null,g.mode,w),as(v,b),v.return=g,v)}function c(g,v,b,w){return v===null||v.tag!==4||v.stateNode.containerInfo!==b.containerInfo||v.stateNode.implementation!==b.implementation?(v=Lb(b,g.mode,w),v.return=g,v):(v=o(v,b.children||[]),v.return=g,v)}function u(g,v,b,w,S){return v===null||v.tag!==7?(v=Bl(b,g.mode,w,S),v.return=g,v):(v=o(v,b),v.return=g,v)}function d(g,v,b){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return v=Ib(""+v,g.mode,b),v.return=g,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case xp:return b=Kp(v.type,v.key,v.props,null,g.mode,b),as(b,v),b.return=g,b;case zd:return v=Lb(v,g.mode,b),v.return=g,v;case ds:return v=Il(v),d(g,v,b)}if(Ud(v)||Od(v))return v=Bl(v,g.mode,b,null),v.return=g,v;if(typeof v.then=="function")return d(g,Dp(v),b);if(v.$$typeof===_o)return d(g,Op(g,v),b);Np(g,v)}return null}function f(g,v,b,w){var S=v!==null?v.key:null;if(typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint")return S!==null?null:l(g,v,""+b,w);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case xp:return b.key===S?a(g,v,b,w):null;case zd:return b.key===S?c(g,v,b,w):null;case ds:return b=Il(b),f(g,v,b,w)}if(Ud(b)||Od(b))return S!==null?null:u(g,v,b,w,null);if(typeof b.then=="function")return f(g,v,Dp(b),w);if(b.$$typeof===_o)return f(g,v,Op(g,b),w);Np(g,b)}return null}function h(g,v,b,w,S){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return g=g.get(b)||null,l(v,g,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case xp:return g=g.get(w.key===null?b:w.key)||null,a(v,g,w,S);case zd:return g=g.get(w.key===null?b:w.key)||null,c(v,g,w,S);case ds:return w=Il(w),h(g,v,b,w,S)}if(Ud(w)||Od(w))return g=g.get(b)||null,u(v,g,w,S,null);if(typeof w.then=="function")return h(g,v,b,Dp(w),S);if(w.$$typeof===_o)return h(g,v,b,Op(v,w),S);Np(v,w)}return null}function p(g,v,b,w){for(var S=null,C=null,x=v,E=v=0,k=null;x!==null&&E<b.length;E++){x.index>E?(k=x,x=null):k=x.sibling;var T=f(g,x,b[E],w);if(T===null){x===null&&(x=k);break}t&&x&&T.alternate===null&&e(g,x),v=i(T,v,E),C===null?S=T:C.sibling=T,C=T,x=k}if(E===b.length)return n(g,x),ue&&di(g,E),S;if(x===null){for(;E<b.length;E++)x=d(g,b[E],w),x!==null&&(v=i(x,v,E),C===null?S=x:C.sibling=x,C=x);return ue&&di(g,E),S}for(x=r(x);E<b.length;E++)k=h(x,g,E,b[E],w),k!==null&&(t&&(T=k.alternate,T!==null&&x.delete(T.key===null?E:T.key)),v=i(k,v,E),C===null?S=k:C.sibling=k,C=k);return t&&x.forEach(function(_){return e(g,_)}),ue&&di(g,E),S}function m(g,v,b,w){if(b==null)throw Error(A(151));for(var S=null,C=null,x=v,E=v=0,k=null,T=b.next();x!==null&&!T.done;E++,T=b.next()){x.index>E?(k=x,x=null):k=x.sibling;var _=f(g,x,T.value,w);if(_===null){x===null&&(x=k);break}t&&x&&_.alternate===null&&e(g,x),v=i(_,v,E),C===null?S=_:C.sibling=_,C=_,x=k}if(T.done)return n(g,x),ue&&di(g,E),S;if(x===null){for(;!T.done;E++,T=b.next())T=d(g,T.value,w),T!==null&&(v=i(T,v,E),C===null?S=T:C.sibling=T,C=T);return ue&&di(g,E),S}for(x=r(x);!T.done;E++,T=b.next())T=h(x,g,E,T.value,w),T!==null&&(t&&(k=T.alternate,k!==null&&x.delete(k.key===null?E:k.key)),v=i(T,v,E),C===null?S=T:C.sibling=T,C=T);return t&&x.forEach(function(z){return e(g,z)}),ue&&di(g,E),S}function y(g,v,b,w){if(typeof b=="object"&&b!==null&&b.type===cc&&b.key===null&&b.props.ref===void 0&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case xp:e:{for(var S=b.key;v!==null;){if(v.key===S){if(S=b.type,S===cc){if(v.tag===7){n(g,v.sibling),w=o(v,b.props.children),as(w,b),w.return=g,g=w;break e}}else if(v.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===ds&&Il(S)===v.type){n(g,v.sibling),w=o(v,b.props),as(w,b),w.return=g,g=w;break e}n(g,v);break}else e(g,v);v=v.sibling}b.type===cc?(w=Bl(b.props.children,g.mode,w,b.key),as(w,b),w.return=g,g=w):(w=Kp(b.type,b.key,b.props,null,g.mode,w),as(w,b),w.return=g,g=w)}return s(g);case zd:e:{for(S=b.key;v!==null;){if(v.key===S)if(v.tag===4&&v.stateNode.containerInfo===b.containerInfo&&v.stateNode.implementation===b.implementation){n(g,v.sibling),w=o(v,b.children||[]),w.return=g,g=w;break e}else{n(g,v);break}else e(g,v);v=v.sibling}w=Lb(b,g.mode,w),w.return=g,g=w}return s(g);case ds:return b=Il(b),y(g,v,b,w)}if(Ud(b))return p(g,v,b,w);if(Od(b)){if(S=Od(b),typeof S!="function")throw Error(A(150));return b=S.call(b),m(g,v,b,w)}if(typeof b.then=="function")return y(g,v,Dp(b),w);if(b.$$typeof===_o)return y(g,v,Op(g,b),w);Np(g,b)}return typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint"?(b=""+b,v!==null&&v.tag===6?(n(g,v.sibling),w=o(v,b),w.return=g,g=w):(n(g,v),w=Ib(b,g.mode,w),w.return=g,g=w),s(g)):n(g,v)}return function(g,v,b,w){try{lf=0;var S=y(g,v,b,w);return Ec=null,S}catch(x){if(x===Yc||x===Ym)throw x;var C=Xn(29,x,null,g.mode);return C.lanes=w,C.return=g,C}}}var Kl=iO(!0),sO=iO(!1),fs=!1;function M1(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xw(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function xs(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Cs(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,(ke&2)!==0){var o=r.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),r.pending=e,e=pm(t),JR(t,null,n),e}return Fm(t,r,e,n),pm(t)}function Yd(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194048)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,CR(t,n)}}function Ub(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=e:i=i.next=e}else o=i=e;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,callbacks:r.callbacks},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}var Cw=!1;function qd(){if(Cw){var t=Cc;if(t!==null)throw t}}function Kd(t,e,n,r){Cw=!1;var o=t.updateQueue;fs=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,l=o.shared.pending;if(l!==null){o.shared.pending=null;var a=l,c=a.next;a.next=null,s===null?i=c:s.next=c,s=a;var u=t.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==s&&(l===null?u.firstBaseUpdate=c:l.next=c,u.lastBaseUpdate=a))}if(i!==null){var d=o.baseState;s=0,u=c=a=null,l=i;do{var f=l.lane&-536870913,h=f!==l.lane;if(h?(pe&f)===f:(r&f)===f){f!==0&&f===ql&&(Cw=!0),u!==null&&(u=u.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var p=t,m=l;f=e;var y=n;switch(m.tag){case 1:if(p=m.payload,typeof p=="function"){d=p.call(y,d,f);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,f=typeof p=="function"?p.call(y,d,f):p,f==null)break e;d=Be({},d,f);break e;case 2:fs=!0}}f=l.callback,f!==null&&(t.flags|=64,h&&(t.flags|=8192),h=o.callbacks,h===null?o.callbacks=[f]:h.push(f))}else h={lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(c=u=h,a=d):u=u.next=h,s|=f;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;h=l,l=h.next,h.next=null,o.lastBaseUpdate=h,o.shared.pending=null}}while(!0);u===null&&(a=d),o.baseState=a,o.firstBaseUpdate=c,o.lastBaseUpdate=u,i===null&&(o.shared.lanes=0),Is|=s,t.lanes=s,t.memoizedState=d}}function lO(t,e){if(typeof t!="function")throw Error(A(191,t));t.call(e)}function aO(t,e){var n=t.callbacks;if(n!==null)for(t.callbacks=null,t=0;t<n.length;t++)lO(n[t],e)}var Ns=Ho(null),bm=Ho(0);function iM(t,e){t=wi,Xe(bm,t),Xe(Ns,e),wi=t|e.baseLanes}function Ew(){Xe(bm,wi),Xe(Ns,Ns.current)}function R1(){wi=bm.current,an(Ns),an(bm)}var dn=Ho(null),En=null;function Es(t){var e=t.alternate;Xe(cn,cn.current&1),Xe(dn,t),En===null&&(e===null||Ns.current!==null||e.memoizedState!==null)&&(En=t)}function Tw(t){Xe(cn,cn.current),Xe(dn,t),En===null&&(En=t)}function cO(t){t.tag===22?(Xe(cn,cn.current),Xe(dn,t),En===null&&(En=t)):Ts()}function Ts(){Xe(cn,cn.current),Xe(dn,dn.current)}function yr(t){an(dn),En===t&&(En=null),an(cn)}var cn=Ho(0);function af(t,e){Xe(dn,dn.current),Xe(cn,e)}function O1(t){an(cn),an(dn),En===t&&(En=null)}function wm(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||i1(n)||rS(n)))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!=="independent"){if((e.flags&128)!==0)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var yi=0,se=null,Le=null,St=null,Sm=!1,Tc=!1,Gl=!1,xm=0,cf=0,kc=null,Lj=0;function ut(){throw Error(A(321))}function D1(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Er(t[n],e[n]))return!1;return!0}function N1(t,e,n,r,o,i){return yi=i,se=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Q.H=t===null||t.memoizedState===null?HO:jO,Gl=!1,i=n(r,o),Gl=!1,Tc&&(i=dO(e,n,r,o)),uO(t),i}function uO(t){Q.H=Cm;var e=Le!==null&&Le.next!==null;if(yi=0,St=Le=se=null,Sm=!1,cf=0,kc=null,e)throw Error(A(300));t===null||Ct||(t=t.dependencies,t!==null&&ym(t)&&(Ct=!0))}function dO(t,e,n,r){se=t;var o=0;do{if(Tc&&(kc=null),cf=0,Tc=!1,25<=o)throw Error(A(301));if(o+=1,St=Le=null,t.updateQueue!=null){var i=t.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}Q.H=Fj,i=e(n,r)}while(Tc);return i}function zj(){var t=Q.H,e=t.useState()[0];return e=typeof e.then=="function"?Ef(e):e,t=t.useState()[0],(Le!==null?Le.memoizedState:null)!==t&&(se.flags|=1024),e}function _1(){var t=xm!==0;return xm=0,t}function I1(t,e,n){e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n}function L1(t){if(Sm){for(t=t.memoizedState;t!==null;){var e=t.queue;e!==null&&(e.pending=null),t=t.next}Sm=!1}yi=0,St=Le=se=null,Tc=!1,cf=xm=0,kc=null}function Hn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return St===null?se.memoizedState=St=t:St=St.next=t,St}function yt(){if(Le===null){var t=se.alternate;t=t!==null?t.memoizedState:null}else t=Le.next;var e=St===null?se.memoizedState:St.next;if(e!==null)St=e,Le=t;else{if(t===null)throw se.alternate===null?Error(A(467)):Error(A(310));Le=t,t={memoizedState:Le.memoizedState,baseState:Le.baseState,baseQueue:Le.baseQueue,queue:Le.queue,next:null},St===null?se.memoizedState=St=t:St=St.next=t}return St}function qm(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ef(t){var e=cf;return cf+=1,kc===null&&(kc=[]),t=oO(kc,t,e),e=se,(St===null?e.memoizedState:St.next)===null&&(e=e.alternate,Q.H=e===null||e.memoizedState===null?HO:jO),t}function Km(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Ef(t);if(t.$$typeof===yH)return;if(t.$$typeof===_o)return ln(t)}throw Error(A(438,String(t)))}function z1(t){var e=null,n=se.updateQueue;if(n!==null&&(e=n.memoCache),e==null){var r=se.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(e={data:r.data.map(function(o){return o.slice()}),index:0})))}if(e==null&&(e={data:[],index:0}),n===null&&(n=qm(),se.updateQueue=n),n.memoCache=e,n=e.data[e.index],n===void 0)for(n=e.data[e.index]=Array(t),r=0;r<t;r++)n[r]=gH;return e.index++,n}function vi(t,e){return typeof e=="function"?e(t):e}function Wp(t){var e=yt();return U1(e,Le,t)}function U1(t,e,n){var r=t.queue;if(r===null)throw Error(A(311));r.lastRenderedReducer=n;var o=t.baseQueue,i=r.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}e.baseQueue=o=i,r.pending=null}if(i=t.baseState,o===null)t.memoizedState=i;else{e=o.next;var l=s=null,a=null,c=e,u=!1;do{var d=c.lane&-536870913;if(d!==c.lane?(pe&d)===d:(yi&d)===d){var f=c.revertLane;if(f===0)a!==null&&(a=a.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),d===ql&&(u=!0);else if((yi&f)===f){c=c.next,f===ql&&(u=!0);continue}else d={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},a===null?(l=a=d,s=i):a=a.next=d,se.lanes|=f,Is|=f;d=c.action,Gl&&n(i,d),i=c.hasEagerState?c.eagerState:n(i,d)}else f={lane:d,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},a===null?(l=a=f,s=i):a=a.next=f,se.lanes|=d,Is|=d;c=c.next}while(c!==null&&c!==e);if(a===null?s=i:a.next=l,!Er(i,t.memoizedState)&&(Ct=!0,u&&(n=Cc,n!==null)))throw n;t.memoizedState=i,t.baseState=s,t.baseQueue=a,r.lastRenderedState=i}return o===null&&(r.lanes=0),[t.memoizedState,r.dispatch]}function Pb(t){var e=yt(),n=e.queue;if(n===null)throw Error(A(311));n.lastRenderedReducer=t;var r=n.dispatch,o=n.pending,i=e.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=t(i,s.action),s=s.next;while(s!==o);Er(i,e.memoizedState)||(Ct=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function fO(t,e,n){var r=se,o=yt(),i=ue;if(i){if(n===void 0)throw Error(A(407));n=n()}else n=e();var s=!Er((Le||o).memoizedState,n);if(s&&(o.memoizedState=n,Ct=!0),o=o.queue,P1(mO.bind(null,r,o,t),[t]),t=o.getSnapshot!==e||s||St!==null&&(St.memoizedState.tag&1)!==0,_c(t?9:8,{destroy:void 0},pO.bind(null,r,o,n,e),null),t){if(r.flags|=2048,Pe===null)throw Error(A(349));i||(yi&127)!==0||hO(r,e,n)}return n}function hO(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=se.updateQueue,e===null?(e=qm(),se.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function pO(t,e,n,r){e.value=n,e.getSnapshot=r,gO(e)&&yO(t)}function mO(t,e,n){return n(function(){gO(e)&&yO(t)})}function gO(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Er(t,n)}catch{return!0}}function yO(t){var e=ea(t,2);e!==null&&Wn(e,t,2)}function kw(t){var e=Hn();if(typeof t=="function"){var n=t;if(t=n(),Gl){ps(!0);try{n()}finally{ps(!1)}}}return e.memoizedState=e.baseState=t,e.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vi,lastRenderedState:t},e}function vO(t,e,n,r){return t.baseState=n,U1(t,Le,typeof r=="function"?r:vi)}function Uj(t,e,n,r,o){if(Xm(t))throw Error(A(485));if(t=e.action,t!==null){var i={payload:o,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(s){i.listeners.push(s)}};Q.T!==null?n(!0):i.isTransition=!1,r(i),n=e.pending,n===null?(i.next=e.pending=i,bO(e,i)):(i.next=n.next,e.pending=n.next=i)}}function bO(t,e){var n=e.action,r=e.payload,o=t.state;if(e.isTransition){var i=Q.T,s={};s.types=i!==null?i.types:null,Q.T=s;try{var l=n(o,r),a=Q.S;a!==null&&a(s,l),sM(t,e,l)}catch(c){Aw(t,e,c)}finally{i!==null&&s.types!==null&&(i.types=s.types),Q.T=i}}else try{i=n(o,r),sM(t,e,i)}catch(c){Aw(t,e,c)}}function sM(t,e,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){lM(t,e,r)},function(r){return Aw(t,e,r)}):lM(t,e,n)}function lM(t,e,n){e.status="fulfilled",e.value=n,wO(e),t.state=n,e=t.pending,e!==null&&(n=e.next,n===e?t.pending=null:(n=n.next,e.next=n,bO(t,n)))}function Aw(t,e,n){var r=t.pending;if(t.pending=null,r!==null){r=r.next;do e.status="rejected",e.reason=n,wO(e),e=e.next;while(e!==r)}t.action=null}function wO(t){t=t.listeners;for(var e=0;e<t.length;e++)(0,t[e])()}function SO(t,e){return e}function aM(t,e){if(ue){var n=Pe.formState;if(n!==null){e:{var r=se;if(ue){if(Ge){t:{for(var o=Ge,i=Kr;o.nodeType!==8;){if(!i){o=null;break t}if(o=Gr(o.nextSibling),o===null){o=null;break t}}i=o.data,o=i==="F!"||i==="F"?o:null}if(o){Ge=Gr(o.nextSibling),r=o.data==="F!";break e}}Ds(r)}r=!1}r&&(e=n[0])}}return n=Hn(),n.memoizedState=n.baseState=e,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:SO,lastRenderedState:e},n.queue=r,n=UO.bind(null,se,r),r.dispatch=n,r=kw(!1),i=V1.bind(null,se,!1,r.queue),r=Hn(),o={state:e,dispatch:null,action:t,pending:null},r.queue=o,n=Uj.bind(null,se,o,i,n),o.dispatch=n,r.memoizedState=t,[e,n,!1]}function cM(t){var e=yt();return xO(e,Le,t)}function xO(t,e,n){if(e=U1(t,e,SO)[0],t=Wp(vi)[0],typeof e=="object"&&e!==null&&typeof e.then=="function")try{var r=Ef(e)}catch(s){throw s===Yc?Ym:s}else r=e;e=yt();var o=e.queue,i=o.dispatch;return n!==e.memoizedState&&(se.flags|=2048,_c(9,{destroy:void 0},Pj.bind(null,o,n),null)),[r,i,t]}function Pj(t,e){t.action=e}function uM(t){var e=yt(),n=Le;if(n!==null)return xO(e,n,t);yt(),e=e.memoizedState,n=yt();var r=n.queue.dispatch;return n.memoizedState=t,[e,r,!1]}function _c(t,e,n,r){return t={tag:t,create:n,deps:r,inst:e,next:null},e=se.updateQueue,e===null&&(e=qm(),se.updateQueue=e),n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t),t}function CO(){return yt().memoizedState}function Jp(t,e,n,r){var o=Hn();se.flags|=t,o.memoizedState=_c(1|e,{destroy:void 0},n,r===void 0?null:r)}function Gm(t,e,n,r){var o=yt();r=r===void 0?null:r;var i=o.memoizedState.inst;Le!==null&&r!==null&&D1(r,Le.memoizedState.deps)?o.memoizedState=_c(e,i,n,r):(se.flags|=t,o.memoizedState=_c(1|e,i,n,r))}function dM(t,e){Jp(8390656,8,t,e)}function P1(t,e){Gm(2048,8,t,e)}function Bj(t){se.flags|=4;var e=se.updateQueue;if(e===null)e=qm(),se.updateQueue=e,e.events=[t];else{var n=e.events;n===null?e.events=[t]:n.push(t)}}function EO(t){var e=yt().memoizedState;return Bj({ref:e,nextImpl:t}),function(){if((ke&2)!==0)throw Error(A(440));return e.impl.apply(void 0,arguments)}}function TO(t,e){return Gm(4,2,t,e)}function kO(t,e){return Gm(4,4,t,e)}function AO(t,e){if(typeof e=="function"){t=t();var n=e(t);return function(){typeof n=="function"?n():e(null)}}if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function MO(t,e,n){n=n!=null?n.concat([t]):null,Gm(4,4,AO.bind(null,e,t),n)}function B1(){}function RO(t,e){var n=yt();e=e===void 0?null:e;var r=n.memoizedState;return e!==null&&D1(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function OO(t,e){var n=yt();e=e===void 0?null:e;var r=n.memoizedState;if(e!==null&&D1(e,r[1]))return r[0];if(r=t(),Gl){ps(!0);try{t()}finally{ps(!1)}}return n.memoizedState=[r,e],r}function H1(t,e,n){return n===void 0||(yi&1073741824)!==0&&(pe&261930)===0?t.memoizedState=e:(t.memoizedState=n,t=xD(),se.lanes|=t,Is|=t,n)}function DO(t,e,n,r){return Er(n,e)?n:Ns.current!==null?(t=H1(t,n,r),Er(t,e)||(Ct=!0),t):(yi&106)===0||(yi&1073741824)!==0&&(pe&261930)===0?(Ct=!0,t.memoizedState=n):(t=xD(),se.lanes|=t,Is|=t,e)}function NO(t,e,n,r,o){var i=Ae.p;Ae.p=i!==0&&8>i?i:8;var s=Q.T,l={};l.types=s!==null?s.types:null,Q.T=l,V1(t,!1,e,n);try{var a=o(),c=Q.S;if(c!==null&&c(l,a),a!==null&&typeof a=="object"&&typeof a.then=="function"){var u=Ij(a,r);Gd(t,e,u,Cr(t))}else Gd(t,e,r,Cr(t))}catch(d){Gd(t,e,{then:function(){},status:"rejected",reason:d},Cr())}finally{Ae.p=i,s!==null&&l.types!==null&&(s.types=l.types),Q.T=s}}function Hj(){}function Mw(t,e,n,r){if(t.tag!==5)throw Error(A(476));var o=_O(t).queue;NO(t,o,e,Pl,n===null?Hj:function(){return IO(t),n(r)})}function _O(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:Pl,baseState:Pl,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vi,lastRenderedState:Pl},next:null};var n={};return e.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vi,lastRenderedState:n},next:null},t.memoizedState=e,t=t.alternate,t!==null&&(t.memoizedState=e),e}function IO(t){var e=_O(t);e.next===null&&(e=t.alternate.memoizedState),Gd(t,e.next.queue,{},Cr())}function j1(){return ln(Hc)}function LO(){return yt().memoizedState}function zO(){return yt().memoizedState}function jj(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var n=Cr();t=xs(n);var r=Cs(e,t,n);r!==null&&(Wn(r,e,n),Yd(r,e,n)),e={cache:T1()},t.payload=e;return}e=e.return}}function Vj(t,e,n){var r=Cr();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Xm(t)?PO(e,n):(n=x1(t,e,n,r),n!==null&&(Wn(n,t,r),BO(n,e,r)))}function UO(t,e,n){var r=Cr();Gd(t,e,n,r)}function Gd(t,e,n,r){var o={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Xm(t))PO(e,o);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var s=e.lastRenderedState,l=i(s,n);if(o.hasEagerState=!0,o.eagerState=l,Er(l,s))return Fm(t,e,o,0),Pe===null&&Vm(),!1}catch{}if(n=x1(t,e,o,r),n!==null)return Wn(n,t,r),BO(n,e,r),!0}return!1}function V1(t,e,n,r){if(r={lane:2,revertLane:Z1(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Xm(t)){if(e)throw Error(A(479))}else e=x1(t,n,r,2),e!==null&&Wn(e,t,2)}function Xm(t){var e=t.alternate;return t===se||e!==null&&e===se}function PO(t,e){Tc=Sm=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function BO(t,e,n){if((n&4194048)!==0){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,CR(t,n)}}var Cm={readContext:ln,use:Km,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useLayoutEffect:ut,useInsertionEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useSyncExternalStore:ut,useId:ut,useHostTransitionStatus:ut,useFormState:ut,useActionState:ut,useOptimistic:ut,useMemoCache:ut,useCacheRefresh:ut,useEffectEvent:ut},HO={readContext:ln,use:Km,useCallback:function(t,e){return Hn().memoizedState=[t,e===void 0?null:e],t},useContext:ln,useEffect:dM,useImperativeHandle:function(t,e,n){n=n!=null?n.concat([t]):null,Jp(4194308,4,AO.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Jp(4194308,4,t,e)},useInsertionEffect:function(t,e){Jp(4,2,t,e)},useMemo:function(t,e){var n=Hn();e=e===void 0?null:e;var r=t();if(Gl){ps(!0);try{t()}finally{ps(!1)}}return n.memoizedState=[r,e],r},useReducer:function(t,e,n){var r=Hn();if(n!==void 0){var o=n(e);if(Gl){ps(!0);try{n(e)}finally{ps(!1)}}}else o=e;return r.memoizedState=r.baseState=o,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:o},r.queue=t,t=t.dispatch=Vj.bind(null,se,t),[r.memoizedState,t]},useRef:function(t){var e=Hn();return t={current:t},e.memoizedState=t},useState:function(t){t=kw(t);var e=t.queue,n=UO.bind(null,se,e);return e.dispatch=n,[t.memoizedState,n]},useDebugValue:B1,useDeferredValue:function(t,e){var n=Hn();return H1(n,t,e)},useTransition:function(){var t=kw(!1);return t=NO.bind(null,se,t.queue,!0,!1),Hn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,n){var r=se,o=Hn();if(ue){if(n===void 0)throw Error(A(407));n=n()}else{if(n=e(),Pe===null)throw Error(A(349));(pe&127)!==0||hO(r,e,n)}o.memoizedState=n;var i={value:n,getSnapshot:e};return o.queue=i,dM(mO.bind(null,r,i,t),[t]),r.flags|=2048,_c(9,{destroy:void 0},pO.bind(null,r,i,n,e),null),n},useId:function(){var t=Hn(),e=Pe.identifierPrefix;if(ue){var n=zo,r=Lo;n=(r&~(1<<32-xr(r)-1)).toString(32)+n,e="_"+e+"R_"+n,n=xm++,0<n&&(e+="H"+n.toString(32)),e+="_"}else n=Lj++,e="_"+e+"r_"+n.toString(32)+"_";return t.memoizedState=e},useHostTransitionStatus:j1,useFormState:aM,useActionState:aM,useOptimistic:function(t){var e=Hn();e.memoizedState=e.baseState=t;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return e.queue=n,e=V1.bind(null,se,!0,n),n.dispatch=e,[t,e]},useMemoCache:z1,useCacheRefresh:function(){return Hn().memoizedState=jj.bind(null,se)},useEffectEvent:function(t){var e=Hn(),n={impl:t};return e.memoizedState=n,function(){if((ke&2)!==0)throw Error(A(440));return n.impl.apply(void 0,arguments)}}},jO={readContext:ln,use:Km,useCallback:RO,useContext:ln,useEffect:P1,useImperativeHandle:MO,useInsertionEffect:TO,useLayoutEffect:kO,useMemo:OO,useReducer:Wp,useRef:CO,useState:function(){return Wp(vi)},useDebugValue:B1,useDeferredValue:function(t,e){var n=yt();return DO(n,Le.memoizedState,t,e)},useTransition:function(){var t=Wp(vi)[0],e=yt().memoizedState;return[typeof t=="boolean"?t:Ef(t),e]},useSyncExternalStore:fO,useId:LO,useHostTransitionStatus:j1,useFormState:cM,useActionState:cM,useOptimistic:function(t,e){var n=yt();return vO(n,Le,t,e)},useMemoCache:z1,useCacheRefresh:zO,useEffectEvent:EO},Fj={readContext:ln,use:Km,useCallback:RO,useContext:ln,useEffect:P1,useImperativeHandle:MO,useInsertionEffect:TO,useLayoutEffect:kO,useMemo:OO,useReducer:Pb,useRef:CO,useState:function(){return Pb(vi)},useDebugValue:B1,useDeferredValue:function(t,e){var n=yt();return Le===null?H1(n,t,e):DO(n,Le.memoizedState,t,e)},useTransition:function(){var t=Pb(vi)[0],e=yt().memoizedState;return[typeof t=="boolean"?t:Ef(t),e]},useSyncExternalStore:fO,useId:LO,useHostTransitionStatus:j1,useFormState:uM,useActionState:uM,useOptimistic:function(t,e){var n=yt();return Le!==null?vO(n,Le,t,e):(n.baseState=t,[t,n.queue.dispatch])},useMemoCache:z1,useCacheRefresh:zO,useEffectEvent:EO};function Bb(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Be({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var Rw={enqueueSetState:function(t,e,n){t=t._reactInternals;var r=Cr(),o=xs(r);o.payload=e,n!=null&&(o.callback=n),e=Cs(t,o,r),e!==null&&(Wn(e,t,r),Yd(e,t,r))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=Cr(),o=xs(r);o.tag=1,o.payload=e,n!=null&&(o.callback=n),e=Cs(t,o,r),e!==null&&(Wn(e,t,r),Yd(e,t,r))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=Cr(),r=xs(n);r.tag=2,e!=null&&(r.callback=e),e=Cs(t,r,n),e!==null&&(Wn(e,t,n),Yd(e,t,n))}};function fM(t,e,n,r,o,i,s){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,s):e.prototype&&e.prototype.isPureReactComponent?!rf(n,r)||!rf(o,i):!0}function hM(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&Rw.enqueueReplaceState(e,e.state,null)}function Xl(t,e){var n=e;if("ref"in e){n={};for(var r in e)r!=="ref"&&(n[r]=e[r])}if(t=t.defaultProps){n===e&&(n=Be({},n));for(var o in t)n[o]===void 0&&(n[o]=t[o])}return n}function VO(t){hm(t)}function FO(t){console.error(t)}function $O(t){hm(t)}function Em(t,e){try{var n=t.onUncaughtError;n(e.value,{componentStack:e.stack})}catch(r){setTimeout(function(){throw r})}}function pM(t,e,n){try{var r=t.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:e.tag===1?e.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function Ow(t,e,n){return n=xs(n),n.tag=3,n.payload={element:null},n.callback=function(){Em(t,e)},n}function YO(t){return t=xs(t),t.tag=3,t}function qO(t,e,n,r){var o=n.type.getDerivedStateFromError;if(typeof o=="function"){var i=r.value;t.payload=function(){return o(i)},t.callback=function(){pM(e,n,r)}}var s=n.stateNode;s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){pM(e,n,r),typeof o!="function"&&(ks===null?ks=new Set([this]):ks.add(this));var l=r.stack;this.componentDidCatch(r.value,{componentStack:l!==null?l:""})})}function $j(t,e,n,r,o){if(n.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(e=n.alternate,e!==null&&$l(e,n,o,!0),n=dn.current,n!==null){switch(n.tag){case 31:case 13:case 19:return En===null?Nm():n.alternate===null&&dt===0&&(dt=3),n.flags&=-257,n.flags|=65536,n.lanes=o,r===vm?n.flags|=16384:(e=n.updateQueue,e===null?n.updateQueue=new Set([r]):e.add(r),qb(t,r,o)),!1;case 22:return n.flags|=65536,r===vm?n.flags|=16384:(e=n.updateQueue,e===null?(e={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=e):(n=e.retryQueue,n===null?e.retryQueue=new Set([r]):n.add(r)),qb(t,r,o)),!1}throw Error(A(435,n.tag))}return qb(t,r,o),Nm(),!1}if(ue)return e=dn.current,e!==null?((e.flags&65536)===0&&(e.flags|=256),e.flags|=65536,e.lanes=o,r!==vw&&(t=Error(A(422),{cause:r}),sf(qr(t,n)))):(r!==vw&&(e=Error(A(423),{cause:r}),sf(qr(e,n))),t=t.current.alternate,t.flags|=65536,o&=-o,t.lanes|=o,r=qr(r,n),o=Ow(t.stateNode,r,o),Ub(t,o),dt!==4&&(dt=2)),!1;var i=Error(A(520),{cause:r});if(i=qr(i,n),Qd===null?Qd=[i]:Qd.push(i),dt!==4&&(dt=2),e===null)return!0;r=qr(r,n),n=e;do{switch(n.tag){case 3:return n.flags|=65536,t=o&-o,n.lanes|=t,t=Ow(n.stateNode,r,t),Ub(n,t),!1;case 1:if(e=n.type,i=n.stateNode,(n.flags&128)===0&&(typeof e.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(ks===null||!ks.has(i))))return n.flags|=65536,o&=-o,n.lanes|=o,o=YO(o),qO(o,t,n,r),Ub(n,o),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var F1=Error(A(461)),Ct=!1;function Nt(t,e,n,r){e.child=t===null?sO(e,null,n,r):Kl(e,t.child,n,r)}function mM(t,e,n,r,o){n=n.render;var i=e.ref;if("ref"in r){var s={};for(var l in r)l!=="ref"&&(s[l]=r[l])}else s=r;return Yl(e),r=N1(t,e,n,s,i,o),l=_1(),t!==null&&!Ct?(I1(t,e,o),bi(t,e,o)):(ue&&l&&$m(e),e.flags|=1,Nt(t,e,r,o),e.child)}function gM(t,e,n,r,o){if(t===null){var i=n.type;return typeof i=="function"&&!C1(i)&&i.defaultProps===void 0&&n.compare===null?(e.tag=15,e.type=i,KO(t,e,i,r,o)):(t=Kp(n.type,null,r,e,e.mode,o),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!Y1(t,o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:rf,n(s,r)&&t.ref===e.ref)return bi(t,e,o)}return e.flags|=1,t=hi(i,r),t.ref=e.ref,t.return=e,e.child=t}function KO(t,e,n,r,o){if(t!==null){var i=t.memoizedProps;if(rf(i,r)&&t.ref===e.ref)if(Ct=!1,e.pendingProps=r=i,Y1(t,o))(t.flags&131072)!==0&&(Ct=!0);else return e.lanes=t.lanes,bi(t,e,o)}return Dw(t,e,n,r,o)}function GO(t,e,n,r){var o=r.children,i=t!==null?t.memoizedState:null;if(t===null&&e.stateNode===null&&(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((e.flags&128)!==0){if(i=i!==null?i.baseLanes|n:n,t!==null){for(r=e.child=t.child,o=0;r!==null;)o=o|r.lanes|r.childLanes,r=r.sibling;r=o&~i}else r=0,e.child=null;return yM(t,e,i,n,r)}if((n&536870912)!==0)e.memoizedState={baseLanes:0,cachePool:null},t!==null&&Xp(e,i!==null?i.cachePool:null),i!==null?iM(e,i):Ew(),cO(e);else return r=e.lanes=536870912,yM(t,e,i!==null?i.baseLanes|n:n,n,r)}else i!==null?(Xp(e,i.cachePool),iM(e,i),Ts(),e.memoizedState=null):(t!==null&&Xp(e,null),Ew(),Ts());return Nt(t,e,o,n),e.child}function Xd(t,e){return t!==null&&t.tag===22||e.stateNode!==null||(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),e.sibling}function yM(t,e,n,r,o){var i=k1();return i=i===null?null:{parent:xt._currentValue,pool:i},e.memoizedState={baseLanes:n,cachePool:i},t!==null&&Xp(e,null),Ew(),cO(e),t!==null&&$l(t,e,r,!0),e.childLanes=o,null}function Qp(t,e){return e=Wm({mode:e.mode,children:e.children},t.mode),e.ref=t.ref,t.child=e,e.return=t,e}function vM(t,e,n){return Kl(e,t.child,null,n),t=Qp(e,e.pendingProps),t.flags|=2,yr(e),e.memoizedState=null,t}function Yj(t,e,n){var r=e.pendingProps,o=(e.flags&128)!==0;if(e.flags&=-129,t===null){if(ue){if(r.mode==="hidden")return t=Qp(e,r),e.lanes=536870912,t.memoizedState={baseLanes:0,cachePool:null},Xd(null,t);if(Tw(e),(t=Ge)?(t=GD(t,Kr),t=t!==null&&t.data==="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:Os!==null?{id:Lo,overflow:zo}:null,retryLane:536870912,hydrationErrors:null},n=ZR(t),n.return=e,e.child=n,Kt=e,Ge=null)):t=null,t===null)throw Ds(e);return e.lanes=536870912,null}return Qp(e,r)}var i=t.memoizedState;if(i!==null){var s=i.dehydrated;if(Tw(e),o)if(e.flags&256)e.flags&=-257,e=vM(t,e,n);else if(e.memoizedState!==null)e.child=t.child,e.flags|=128,e=null;else throw Error(A(558));else if(Ct||$l(t,e,n,!1),o=(n&t.childLanes)!==0,Ct||o){if(Ns.current===null){if(r=Pe,r!==null&&(s=ER(r,n),s!==0&&s!==i.retryLane))throw i.retryLane=s,ea(t,s),Wn(r,t,s),F1;Nm()}e=vM(t,e,n)}else t=i.treeContext,Ge=Gr(s.nextSibling),Kt=e,ue=!0,Ss=null,Kr=!1,t!==null&&tO(e,t),e=Qp(e,r),e.flags|=134221824;return e}return t=hi(t.child,{mode:r.mode,children:r.children}),t.ref=e.ref,e.child=t,t.return=e,t}function ic(t,e){var n=e.ref;if(n===null)t!==null&&t.ref!==null&&(e.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(A(284));(t===null||t.ref!==n)&&(e.flags|=4194816)}}function Dw(t,e,n,r,o){return Yl(e),n=N1(t,e,n,r,void 0,o),r=_1(),t!==null&&!Ct?(I1(t,e,o),bi(t,e,o)):(ue&&r&&$m(e),e.flags|=1,Nt(t,e,n,o),e.child)}function bM(t,e,n,r,o,i){return Yl(e),e.updateQueue=null,n=dO(e,r,n,o),uO(t),r=_1(),t!==null&&!Ct?(I1(t,e,i),bi(t,e,i)):(ue&&r&&$m(e),e.flags|=1,Nt(t,e,n,i),e.child)}function wM(t,e,n,r,o){if(Yl(e),e.stateNode===null){var i=gc,s=n.contextType;typeof s=="object"&&s!==null&&(i=ln(s)),i=new n(r,i),e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Rw,e.stateNode=i,i._reactInternals=e,i=e.stateNode,i.props=r,i.state=e.memoizedState,i.refs={},M1(e),s=n.contextType,i.context=typeof s=="object"&&s!==null?ln(s):gc,i.state=e.memoizedState,s=n.getDerivedStateFromProps,typeof s=="function"&&(Bb(e,n,s,r),i.state=e.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(s=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),s!==i.state&&Rw.enqueueReplaceState(i,i.state,null),Kd(e,r,i,o),qd(),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308),r=!0}else if(t===null){i=e.stateNode;var l=e.memoizedProps,a=Xl(n,l);i.props=a;var c=i.context,u=n.contextType;s=gc,typeof u=="object"&&u!==null&&(s=ln(u));var d=n.getDerivedStateFromProps;u=typeof d=="function"||typeof i.getSnapshotBeforeUpdate=="function",l=e.pendingProps!==l,u||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l||c!==s)&&hM(e,i,r,s),fs=!1;var f=e.memoizedState;i.state=f,Kd(e,r,i,o),qd(),c=e.memoizedState,l||f!==c||fs?(typeof d=="function"&&(Bb(e,n,d,r),c=e.memoizedState),(a=fs||fM(e,n,a,r,f,c,s))?(u||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(e.flags|=4194308)):(typeof i.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=c),i.props=r,i.state=c,i.context=s,r=a):(typeof i.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{i=e.stateNode,xw(t,e),s=e.memoizedProps,u=Xl(n,s),i.props=u,d=e.pendingProps,f=i.context,c=n.contextType,a=gc,typeof c=="object"&&c!==null&&(a=ln(c)),l=n.getDerivedStateFromProps,(c=typeof l=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(s!==d||f!==a)&&hM(e,i,r,a),fs=!1,f=e.memoizedState,i.state=f,Kd(e,r,i,o),qd();var h=e.memoizedState;s!==d||f!==h||fs||t!==null&&t.dependencies!==null&&ym(t.dependencies)?(typeof l=="function"&&(Bb(e,n,l,r),h=e.memoizedState),(u=fs||fM(e,n,u,r,f,h,a)||t!==null&&t.dependencies!==null&&ym(t.dependencies))?(c||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,h,a),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,h,a)),typeof i.componentDidUpdate=="function"&&(e.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof i.componentDidUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=h),i.props=r,i.state=h,i.context=a,r=u):(typeof i.componentDidUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return i=r,ic(t,e),r=(e.flags&128)!==0,i||r?(i=e.stateNode,n=r&&typeof n.getDerivedStateFromError!="function"?null:i.render(),e.flags|=1,t!==null&&r?(e.child=Kl(e,t.child,null,o),e.child=Kl(e,null,n,o)):Nt(t,e,n,o),e.memoizedState=i.state,t=e.child):t=bi(t,e,o),t}function SM(t,e,n,r){return Fl(),e.flags|=256,Nt(t,e,n,r),e.child}var Nw={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _w(t){return{baseLanes:t,cachePool:rO()}}function Iw(t,e,n){return t=t!==null?t.childLanes&~n:0,e&&(t|=br),t}function XO(t,e,n){var r=e.pendingProps,o=!1,i=(e.flags&128)!==0,s;if((s=i)||(s=t!==null&&t.memoizedState===null?!1:(cn.current&2)!==0),s&&(o=!0,e.flags&=-129),s=(e.flags&32)!==0,e.flags&=-33,t===null){if(ue){if(o?Es(e):Ts(),(t=Ge)?(t=GD(t,Kr),t=t!==null&&t.data!=="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:Os!==null?{id:Lo,overflow:zo}:null,retryLane:536870912,hydrationErrors:null},n=ZR(t),n.return=e,e.child=n,Kt=e,Ge=null)):t=null,t===null)throw Ds(e);return rS(t)?e.lanes=32:e.lanes=536870912,null}return i=r.children,r=r.fallback,o?(Ts(),o=e.mode,i=Wm({mode:"hidden",children:i},o),r=Bl(r,o,n,null),i.return=e,r.return=e,i.sibling=r,e.child=i,r=e.child,r.memoizedState=_w(n),r.childLanes=Iw(t,s,n),e.memoizedState=Nw,Xd(null,r)):(Es(e),$1(e,i))}var l=t.memoizedState;if(l!==null){var a=l.dehydrated;if(a!==null)return qj(t,e,i,s,r,a,l,n)}return o?(Ts(),o=r.fallback,i=e.mode,l=t.child,a=l.sibling,r=hi(l,{mode:"hidden",children:r.children}),r.subtreeFlags=l.subtreeFlags&1206910976,a!==null?o=hi(a,o):(o=Bl(o,i,n,null),o.flags|=2),o.return=e,r.return=e,r.sibling=o,e.child=r,Xd(null,r),r=e.child,o=t.child.memoizedState,o===null?o=_w(n):(i=o.cachePool,i!==null?(l=xt._currentValue,i=i.parent!==l?{parent:l,pool:l}:i):i=rO(),o={baseLanes:o.baseLanes|n,cachePool:i}),r.memoizedState=o,r.childLanes=Iw(t,s,n),e.memoizedState=Nw,Xd(t.child,r)):(Es(e),n=t.child,t=n.sibling,n=hi(n,{mode:"visible",children:r.children}),n.return=e,n.sibling=null,t!==null&&(s=e.deletions,s===null?(e.deletions=[t],e.flags|=16):s.push(t)),e.child=n,e.memoizedState=null,n)}function $1(t,e){return e=Wm({mode:"visible",children:e},t.mode),e.return=t,t.child=e}function Wm(t,e){return t=Xn(22,t,null,e),t.lanes=0,t}function _p(t,e,n){return Kl(e,t.child,null,n),t=$1(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function qj(t,e,n,r,o,i,s,l){if(n)return e.flags&256?(Es(e),e.flags&=-257,_p(t,e,l)):e.memoizedState!==null?(Ts(),e.child=t.child,e.flags|=128,null):(Ts(),i=o.fallback,s=e.mode,o=Wm({mode:"visible",children:o.children},s),i=Bl(i,s,l,null),i.flags|=2,o.return=e,i.return=e,o.sibling=i,e.child=o,Kl(e,t.child,null,l),o=e.child,o.memoizedState=_w(l),o.childLanes=Iw(t,r,l),e.memoizedState=Nw,Xd(null,o));if(Es(e),rS(i)){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,r!==""&&(o=Error(A(419)),o.stack="",o.digest=r,sf({value:o,source:null,stack:null})),_p(t,e,l)}if(Ct||$l(t,e,l,!1),r=(l&t.childLanes)!==0,Ct||r){if(Ns.current!==null)return _p(t,e,l);if(r=Pe,r!==null&&(o=ER(r,l),o!==0&&o!==s.retryLane))throw s.retryLane=o,ea(t,o),Wn(r,t,o),F1;return i1(i)||Nm(),_p(t,e,l)}return i1(i)?(e.flags|=192,e.child=t.child,null):(t=s.treeContext,Ge=Gr(i.nextSibling),Kt=e,ue=!0,Ss=null,Kr=!1,t!==null&&tO(e,t),e=$1(e,o.children),e.flags|=134221824,e)}function xM(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),Gp(t.return,e,n)}function CM(t){for(var e=null;t!==null;){var n=t.alternate;n!==null&&wm(n)===null&&(e=t),t=t.sibling}return e}function Ip(t,e,n,r,o,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o,treeForkCount:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=o,s.treeForkCount=i)}function Hb(t){var e=t.child;for(t.child=null;e!==null;){var n=e.sibling;e.sibling=t.child,t.child=e,e=n}}function Lw(t,e,n){var r=e.pendingProps,o=r.revealOrder,i=r.tail;r=r.children;var s=cn.current;if(e.flags&128)return af(e,s),null;var l=(s&2)!==0;if(l?(s=s&1|2,e.flags|=128):s&=1,af(e,s),o==="backwards"&&t!==null?(Hb(t),Nt(t,e,r,n),Hb(t)):Nt(t,e,r,n),r=ue?of:0,!l&&t!==null&&(t.flags&128)!==0)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&xM(t,n,e);else if(t.tag===19)xM(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(o){case"backwards":n=CM(e.child),n===null?(o=e.child,e.child=null):(o=n.sibling,n.sibling=null,Hb(e)),Ip(e,!0,o,null,i,r);break;case"unstable_legacy-backwards":for(n=null,o=e.child,e.child=null;o!==null;){if(t=o.alternate,t!==null&&wm(t)===null){e.child=o;break}t=o.sibling,o.sibling=n,n=o,o=t}Ip(e,!0,n,null,i,r);break;case"together":Ip(e,!1,null,null,void 0,r);break;case"independent":e.memoizedState=null;break;default:n=CM(e.child),n===null?(o=e.child,e.child=null):(o=n.sibling,n.sibling=null),Ip(e,!1,o,n,i,r)}return e.child}function EM(t,e,n){var r=e.pendingProps;return gs(e,e.type,r.value),Nt(t,e,r.children,n),e.child}function bi(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Is|=e.lanes,(n&e.childLanes)===0)if(t!==null){if($l(t,e,n,!1),(n&e.childLanes)===0)return null}else return null;if(t!==null&&e.child!==t.child)throw Error(A(153));if(e.child!==null){for(t=e.child,n=hi(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=hi(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function Y1(t,e){return(t.lanes&e)!==0?!0:(t=t.dependencies,!!(t!==null&&ym(t)))}function Kj(t,e,n){switch(e.tag){case 3:cm(e,e.stateNode.containerInfo),gs(e,xt,t.memoizedState.cache),Fl();break;case 27:case 5:aw(e);break;case 4:cm(e,e.stateNode.containerInfo);break;case 10:gs(e,e.type,e.memoizedProps.value);break;case 31:if(e.memoizedState!==null)return e.flags|=128,Tw(e),null;break;case 13:var r=e.memoizedState;if(r!==null){if(r.dehydrated!==null)return Es(e),e.flags|=128,null;r=$l(t,e,n,!1);var o=e.child.childLanes;return r||(n&o)!==0?XO(t,e,n):(Es(e),t=bi(t,e,n),t!==null?t.sibling:null)}Es(e);break;case 19:if(e.flags&128)return Lw(t,e,n);if(o=(t.flags&128)!==0,r=(n&e.childLanes)!==0,r||($l(t,e,n,!1),r=(n&e.childLanes)!==0),o){if(r)return Lw(t,e,n);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),af(e,cn.current),r)break;return null;case 22:return e.lanes=0,GO(t,e,n,e.pendingProps);case 24:gs(e,xt,t.memoizedState.cache)}return bi(t,e,n)}function WO(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps)Ct=!0;else{if(!Y1(t,n)&&(e.flags&128)===0)return Ct=!1,Kj(t,e,n);Ct=(t.flags&131072)!==0}else Ct=!1,ue&&(e.flags&1048576)!==0&&eO(e,of,e.index);switch(e.lanes=0,e.tag){case 16:e:{var r=e.pendingProps;if(t=Il(e.elementType),e.type=t,typeof t=="function")C1(t)?(r=Xl(t,r),e.tag=1,e=wM(null,e,t,r,n)):(e.tag=0,e=Dw(null,e,t,r,n));else{if(t!=null){var o=t.$$typeof;if(o===u1){e.tag=11,e=mM(null,e,t,r,n);break e}else if(o===d1){e.tag=14,e=gM(null,e,t,r,n);break e}else if(o===_o){e.tag=10,e.type=t,e=EM(null,e,n);break e}}throw e=sw(t)||t,Error(A(306,e,""))}}return e;case 0:return Dw(t,e,e.type,e.pendingProps,n);case 1:return r=e.type,o=Xl(r,e.pendingProps),wM(t,e,r,o,n);case 3:e:{if(cm(e,e.stateNode.containerInfo),t===null)throw Error(A(387));r=e.pendingProps;var i=e.memoizedState;o=i.element,xw(t,e),Kd(e,r,null,n);var s=e.memoizedState;if(r=s.cache,gs(e,xt,r),r!==i.cache&&ww(e,[xt],n,!0),qd(),r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){e=SM(t,e,r,n);break e}else if(r!==o){o=qr(Error(A(424)),e),sf(o),e=SM(t,e,r,n);break e}else for(t=e.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,Ge=Gr(t.firstChild),Kt=e,ue=!0,Ss=null,Kr=!0,n=sO(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling;else{if(Fl(),r===o){e=bi(t,e,n);break e}Nt(t,e,r,n)}e=e.child}return e;case 26:return ic(t,e),t===null?(n=JM(e.type,null,e.pendingProps,null))?e.memoizedState=n:ue||(e.stateNode=BD(e.type,e.pendingProps,ws.current,e)):e.memoizedState=JM(e.type,t.memoizedProps,e.pendingProps,t.memoizedState),null;case 27:return aw(e),t===null&&ue&&(r=e.stateNode=XD(e.type,e.pendingProps,ws.current),Kt=e,Kr=!0,o=Ge,zs(e.type)?(s1=o,Ge=Gr(r.firstChild)):Ge=o),Nt(t,e,e.pendingProps.children,n),ic(t,e),t===null&&(e.flags|=4194304),e.child;case 5:return t===null&&ue&&((o=r=Ge)&&(r=BV(r,e.type,e.pendingProps,Kr),r!==null?(e.stateNode=r,Kt=e,Ge=Gr(r.firstChild),Kr=!1,o=!0):o=!1),o||Ds(e)),aw(e),o=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,r=i.children,n1(o,i)?r=null:s!==null&&n1(o,s)&&(e.flags|=32),e.memoizedState!==null&&(o=N1(t,e,zj,null,null,n),Hc._currentValue=o),ic(t,e),Nt(t,e,r,n),e.child;case 6:return t===null&&ue&&((t=n=Ge)&&(n=HV(n,e.pendingProps,Kr),n!==null?(e.stateNode=n,Kt=e,Ge=null,t=!0):t=!1),t||Ds(e)),null;case 13:return XO(t,e,n);case 4:return cm(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Kl(e,null,r,n):Nt(t,e,r,n),e.child;case 11:return mM(t,e,e.type,e.pendingProps,n);case 7:return r=e.pendingProps,ic(t,e),Nt(t,e,r,n),e.child;case 8:return Nt(t,e,e.pendingProps.children,n),e.child;case 12:return Nt(t,e,e.pendingProps.children,n),e.child;case 10:return EM(t,e,n);case 9:return o=e.type._context,r=e.pendingProps.children,Yl(e),o=ln(o),r=r(o),e.flags|=1,Nt(t,e,r,n),e.child;case 14:return gM(t,e,e.type,e.pendingProps,n);case 15:return KO(t,e,e.type,e.pendingProps,n);case 19:return Lw(t,e,n);case 31:return Yj(t,e,n);case 22:return GO(t,e,n,e.pendingProps);case 24:return Yl(e),r=ln(xt),t===null?(o=k1(),o===null&&(o=Pe,i=T1(),o.pooledCache=i,i.refCount++,i!==null&&(o.pooledCacheLanes|=n),o=i),e.memoizedState={parent:r,cache:o},M1(e),gs(e,xt,o)):((t.lanes&n)!==0&&(xw(t,e),Kd(e,null,null,n),qd()),o=t.memoizedState,i=e.memoizedState,o.parent!==r?(o={parent:r,cache:r},e.memoizedState=o,e.lanes===0&&(e.memoizedState=e.updateQueue.baseState=o),gs(e,xt,r)):(r=i.cache,gs(e,xt,r),r!==o.cache&&ww(e,[xt],n,!0))),Nt(t,e,e.pendingProps.children,n),e.child;case 30:return e.stateNode===null&&(e.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=e.pendingProps,r.name!=null&&r.name!=="auto"?e.flags|=t===null?18882560:18874368:ue&&$m(e),t!==null&&t.memoizedProps.name!==r.name?e.flags|=4194816:ic(t,e),Nt(t,e,r.children,n),e.child;case 29:throw e.pendingProps}throw Error(A(156,e.tag))}function ui(t){t.flags|=4}function jb(t,e,n,r,o){var i;if((i=(t.mode&32)!==0)&&(i=n===null?eR(e,r):eR(e,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),i){if(t.flags|=16777216,(o&335544128)===o)if(t.stateNode.complete)t.flags|=8192;else if(TD())t.flags|=8192;else throw jl=vm,A1}else t.flags&=-16777217}function TM(t,e){if(e.type!=="stylesheet"||(e.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!ZD(e))if(TD())t.flags|=8192;else throw jl=vm,A1}function Lp(t,e){e!==null&&(t.flags|=4),t.flags&16384&&(e=t.tag!==22?SR():536870912,t.lanes|=e,Ic|=e)}function Nd(t,e){if(!ue)switch(t.tailMode){case"visible":break;case"collapsed":for(var n=t.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null;break;default:for(e=t.tail,n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null}}function Ke(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var o=t.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&1206910976,r|=o.flags&1206910976,o.return=t,o=o.sibling;else for(o=t.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=t,o=o.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function Gj(t,e,n){var r=e.pendingProps;switch(E1(e),e.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ke(e),null;case 1:return Ke(e),null;case 3:return n=e.stateNode,r=null,t!==null&&(r=t.memoizedState.cache),e.memoizedState.cache!==r&&(e.flags|=2048),pi(xt),Oc(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(rc(e)?ui(e):t===null||t.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,zb())),Ke(e),null;case 26:var o=e.type,i=e.memoizedState;return t===null?(ui(e),i!==null?(Ke(e),TM(e,i)):(Ke(e),jb(e,o,null,r,n))):i?i!==t.memoizedState?(ui(e),Ke(e),TM(e,i)):(Ke(e),e.flags&=-16777217):(t=t.memoizedProps,t!==r&&ui(e),Ke(e),jb(e,o,t,r,n)),null;case 27:if(um(e),n=ws.current,o=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==r&&ui(e);else{if(!r){if(e.stateNode===null)throw Error(A(166));return Ke(e),e.subtreeFlags&=-33554433,null}t=Uo.current,rc(e)?QA(e,t):(t=XD(o,r,n),e.stateNode=t,ui(e))}return Ke(e),e.subtreeFlags&=-33554433,null;case 5:if(um(e),o=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==r&&ui(e);else{if(!r){if(e.stateNode===null)throw Error(A(166));return Ke(e),e.subtreeFlags&=-33554433,null}if(i=Uo.current,rc(e))QA(e,i);else{var s=ff(ws.current);switch(i){case 1:i=s.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:i=s.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":i=s.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":i=s.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":i=s.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof r.is=="string"?s.createElement("select",{is:r.is}):s.createElement("select"),r.multiple?i.multiple=!0:r.size&&(i.size=r.size);break;default:i=typeof r.is=="string"?s.createElement(o,{is:r.is}):s.createElement(o)}}i[sn]=e,i[Qn]=r;e:for(s=e.child;s!==null;){if(s.tag===5||s.tag===6)i.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break e;for(;s.sibling===null;){if(s.return===null||s.return===e)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}e.stateNode=i;e:switch(un(i,o,r),o){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&ui(e)}}return Ke(e),e.subtreeFlags&=-33554433,jb(e,e.type,t===null?null:t.memoizedProps,e.pendingProps,n),null;case 6:if(t&&e.stateNode!=null)t.memoizedProps!==r&&ui(e);else{if(typeof r!="string"&&e.stateNode===null)throw Error(A(166));if(t=ws.current,rc(e)){if(t=e.stateNode,n=e.memoizedProps,r=null,o=Kt,o!==null)switch(o.tag){case 27:case 5:r=o.memoizedProps}t[sn]=e,t=!!(t.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||UD(t.nodeValue,n)),t||Ds(e,!0)}else t=ff(t).createTextNode(r),t[sn]=e,e.stateNode=t}return Ke(e),null;case 31:if(n=e.memoizedState,t===null||t.memoizedState!==null){if(r=rc(e),n!==null){if(t===null){if(!r)throw Error(A(318));if(t=e.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(A(557));t[sn]=e}else Fl(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Ke(e),t=!1}else n=zb(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),t=!0;if(!t)return e.flags&256?(yr(e),e):(yr(e),null);if((e.flags&128)!==0)throw Error(A(558))}return Ke(e),null;case 13:if(r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(o=rc(e),r!==null&&r.dehydrated!==null){if(t===null){if(!o)throw Error(A(318));if(o=e.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(A(317));o[sn]=e}else Fl(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Ke(e),o=!1}else o=zb(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=o),o=!0;if(!o)return e.flags&256?(yr(e),e):(yr(e),null)}return yr(e),(e.flags&128)!==0?(e.lanes=n,e):(n=r!==null,t=t!==null&&t.memoizedState!==null,n&&(r=e.child,o=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(o=r.alternate.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==o&&(r.flags|=2048)),n!==t&&n&&(e.child.flags|=8192),Lp(e,e.updateQueue),Ke(e),null);case 4:return Oc(),t===null&&eS(e.stateNode.containerInfo),e.flags|=67108864,Ke(e),null;case 10:return pi(e.type),Ke(e),null;case 19:if(O1(e),r=e.memoizedState,r===null)return Ke(e),null;if(o=(e.flags&128)!==0,i=r.rendering,i===null)if(o)Nd(r,!1);else{if(dt!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(i=wm(t),i!==null){for(e.flags|=128,Nd(r,!1),t=i.updateQueue,e.updateQueue=t,Lp(e,t),e.subtreeFlags=0,t=n,n=e.child;n!==null;)QR(n,t),n=n.sibling;return af(e,cn.current&1|2),ue&&di(e,r.treeForkCount),e.child}t=t.sibling}r.tail!==null&&wr()>Om&&(e.flags|=128,o=!0,Nd(r,!1),e.lanes=4194304)}else{if(!o)if(t=wm(i),t!==null){if(e.flags|=128,o=!0,t=t.updateQueue,e.updateQueue=t,Lp(e,t),Nd(r,!0),r.tail===null&&r.tailMode!=="collapsed"&&r.tailMode!=="visible"&&!i.alternate&&!ue)return Ke(e),null}else 2*wr()-r.renderingStartTime>Om&&n!==536870912&&(e.flags|=128,o=!0,Nd(r,!1),e.lanes=4194304);r.isBackwards?(i.sibling=e.child,e.child=i):(t=r.last,t!==null?t.sibling=i:e.child=i,r.last=i)}if(r.tail!==null){t=r.tail;e:{for(n=t;n!==null;){if(n.alternate!==null){n=!1;break e}n=n.sibling}n=!0}return r.rendering=t,r.tail=t.sibling,r.renderingStartTime=wr(),t.sibling=null,i=cn.current,i=o?i&1|2:i&1,r.tailMode==="visible"||r.tailMode==="collapsed"||!n||ue?af(e,i):(n=i,Xe(dn,e),Xe(cn,n),En===null&&(En=e)),ue&&di(e,r.treeForkCount),t}return Ke(e),null;case 22:case 23:return yr(e),R1(),r=e.memoizedState!==null,t!==null?t.memoizedState!==null!==r&&(e.flags|=8192):r&&(e.flags|=8192),r?(n&536870912)!==0&&(e.flags&128)===0&&(Ke(e),e.subtreeFlags&6&&(e.flags|=8192)):Ke(e),n=e.updateQueue,n!==null&&Lp(e,n.retryQueue),n=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),r=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),r!==n&&(e.flags|=2048),t!==null&&an(Hl),null;case 24:return n=null,t!==null&&(n=t.memoizedState.cache),e.memoizedState.cache!==n&&(e.flags|=2048),pi(xt),Ke(e),null;case 25:return null;case 30:return e.flags|=33554432,Ke(e),null}throw Error(A(156,e.tag))}function Xj(t,e){switch(E1(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return pi(xt),Oc(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return um(e),null;case 31:if(e.memoizedState!==null){if(yr(e),e.alternate===null)throw Error(A(340));Fl()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 13:if(yr(e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(A(340));Fl()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return O1(e),t=e.flags,t&65536?(e.flags=t&-65537|128,t=e.memoizedState,t!==null&&(t.rendering=null,t.tail=null),e.flags|=4,e):null;case 4:return Oc(),null;case 10:return pi(e.type),null;case 22:case 23:return yr(e),R1(),t!==null&&an(Hl),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 24:return pi(xt),null;case 25:return null;default:return null}}function JO(t,e){switch(E1(e),e.tag){case 3:pi(xt),Oc();break;case 26:case 27:case 5:um(e);break;case 4:Oc();break;case 31:e.memoizedState!==null&&yr(e);break;case 13:yr(e);break;case 19:O1(e);break;case 10:pi(e.type);break;case 22:case 23:yr(e),R1(),t!==null&&an(Hl);break;case 24:pi(xt)}}function Tf(t,e){try{var n=e.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var o=r.next;n=o;do{if((n.tag&t)===t){r=void 0;var i=n.create,s=n.inst;r=i(),s.destroy=r}n=n.next}while(n!==o)}}catch(l){De(e,e.return,l)}}function _s(t,e,n){try{var r=e.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var i=o.next;r=i;do{if((r.tag&t)===t){var s=r.inst,l=s.destroy;if(l!==void 0){s.destroy=void 0,o=e;var a=n,c=l;try{c()}catch(u){De(o,a,u)}}}r=r.next}while(r!==i)}}catch(u){De(e,e.return,u)}}function QO(t){var e=t.updateQueue;if(e!==null){var n=t.stateNode;try{aO(e,n)}catch(r){De(t,t.return,r)}}}function ZO(t,e,n){n.props=Xl(t.type,t.memoizedProps),n.state=t.memoizedState;try{n.componentWillUnmount()}catch(r){De(t,e,r)}}function Do(t,e){try{var n=t.ref;if(n!==null){switch(t.tag){case 26:case 27:case 5:var r=t.stateNode;break;case 30:var o=t.stateNode,i=gi(t.memoizedProps,o);(o.ref===null||o.ref.name!==i)&&(o.ref=FD(i)),r=o.ref;break;case 7:if(t.stateNode===null){var s=new Tr(t);Jn(t.child,!1,UV,s,void 0,void 0),t.stateNode=s}r=t.stateNode;break;default:r=t.stateNode}typeof n=="function"?t.refCleanup=n(r):n.current=r}}catch(l){De(t,e,l)}}function on(t,e){var n=t.ref,r=t.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(o){De(t,e,o)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(o){De(t,e,o)}else n.current=null}function Tm(t,e){if((t.tag===5||t.tag===27||t.tag===6)&&t.alternate===null&&e!==null)for(var n=0;n<e.length;n++)KD(t.stateNode,e[n])}function kM(t){for(var e=t.return;e!==null&&(K1(e)&&KD(t.stateNode,e.stateNode),!q1(e));)e=e.return}function Wd(t){for(var e=t.return;e!==null&&(K1(e)&&PV(t.stateNode,e.stateNode),!q1(e));)e=e.return}function q1(t){return t.tag===5||t.tag===3||t.tag===27}function K1(t){return t&&t.tag===7&&t.stateNode!==null}function zw(t){var e=t.type,n=t.memoizedProps,r=t.stateNode;try{e:switch(e){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(o){De(t,t.return,o)}}function Vb(t,e,n){try{var r=t.stateNode;bV(r,t.type,n,e),r[Qn]=e}catch(o){De(t,t.return,o)}}function eD(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&zs(t.type)||t.tag===4}function Fb(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||eD(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&zs(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Uw(t,e,n,r){var o=t.tag;if(o===5||o===6)o=t.stateNode,e?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(o,e):(e=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,e.appendChild(o),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Io)),Tm(t,r),we=!0;else if(o!==4&&(o===27&&(Tm(t,r),r=null,zs(t.type)&&(n=t.stateNode,e=null)),t=t.child,t!==null))for(Uw(t,e,n,r),t=t.sibling;t!==null;)Uw(t,e,n,r),t=t.sibling}function km(t,e,n,r){var o=t.tag;if(o===5||o===6)o=t.stateNode,e?n.insertBefore(o,e):n.appendChild(o),Tm(t,r),we=!0;else if(o!==4&&(o===27&&(Tm(t,r),r=null,zs(t.type)&&(n=t.stateNode)),t=t.child,t!==null))for(km(t,e,n,r),t=t.sibling;t!==null;)km(t,e,n,r),t=t.sibling}function tD(t){var e=t.stateNode,n=t.memoizedProps;try{for(var r=t.type,o=e.attributes;o.length;)e.removeAttributeNode(o[0]);un(e,r,n),e[sn]=t,e[Qn]=n}catch(i){De(t,t.return,i)}}var Am=!1,vr=null;function AM(t){(t.tag===30||(t.subtreeFlags&33554432)!==0)&&(Am=!0)}var No=null;function MM(){var t=No;return No=null,t}var Gn=0;function qc(t,e,n,r,o){return Gn=0,nD(t.child,e,n,r,o)}function nD(t,e,n,r,o){for(var i=!1;t!==null;){if(t.tag===5){var s=t.stateNode;if(r!==null){var l=r1(s);r.push(l),l.view&&(i=!0)}else i||r1(s).view&&(i=!0);Am=!0,HD(s,Gn===0?e:e+"_"+Gn,n),Gn++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o||nD(t.child,e,n,r,o)&&(i=!0));t=t.sibling}return i}function Bo(t,e){for(;t!==null;)t.tag===5?jD(t.stateNode,t.memoizedProps):(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&e||Bo(t.child,e)),t=t.sibling}function Zp(t){if((t.subtreeFlags&18874368)!==0)for(t=t.child;t!==null;){if((t.tag!==22||t.memoizedState===null)&&(Zp(t),t.tag===30&&(t.flags&18874368)!==0&&t.stateNode.paired)){var e=t.memoizedProps;if(e.name==null||e.name==="auto")throw Error(A(544));var n=e.name;e=xi(e.default,e.share),e!=="none"&&(qc(t,n,e,null,!1)||Bo(t.child,!1))}t=t.sibling}}function Pw(t,e){if(t.tag===30){var n=t.stateNode,r=t.memoizedProps,o=gi(r,n),i=xi(r.default,n.paired?r.share:r.enter);i!=="none"?qc(t,o,i,null,!1)?(Zp(t),n.paired||e||Lc(t,r.onEnter)):Bo(t.child,!1):Zp(t)}else if((t.subtreeFlags&33554432)!==0)for(t=t.child;t!==null;)Pw(t,e),t=t.sibling;else Zp(t)}function Bw(t){if(vr!==null&&vr.size!==0){var e=vr;if((t.subtreeFlags&18874368)!==0)for(t=t.child;t!==null;){if(t.tag!==22||t.memoizedState===null){if(t.tag===30&&(t.flags&18874368)!==0){var n=t.memoizedProps,r=n.name;if(r!=null&&r!=="auto"){var o=e.get(r);if(o!==void 0){var i=xi(n.default,n.share);if(i!=="none"&&(qc(t,r,i,null,!1)?(i=t.stateNode,o.paired=i,i.paired=o,Lc(t,n.onShare)):Bo(t.child,!1)),e.delete(r),e.size===0)break}}}Bw(t)}t=t.sibling}}}function Hw(t){if(t.tag===30){var e=t.memoizedProps,n=gi(e,t.stateNode),r=vr!==null?vr.get(n):void 0,o=xi(e.default,r!==void 0?e.share:e.exit);o!=="none"&&(qc(t,n,o,null,!1)?r!==void 0?(o=t.stateNode,r.paired=o,o.paired=r,vr.delete(n),Lc(t,e.onShare)):Lc(t,e.onExit):Bo(t.child,!1)),vr!==null&&Bw(t)}else if((t.subtreeFlags&33554432)!==0)for(t=t.child;t!==null;)Hw(t),t=t.sibling;else vr!==null&&Bw(t)}function rD(t){for(t=t.child;t!==null;){if(t.tag===30){var e=t.memoizedProps,n=gi(e,t.stateNode);e=xi(e.default,e.update),t.flags&=-5,e!=="none"&&qc(t,n,e,t.memoizedState=[],!1)}else(t.subtreeFlags&33554432)!==0&&rD(t);t=t.sibling}}function jw(t){if((t.subtreeFlags&18874368)!==0)for(t=t.child;t!==null;){if(t.tag!==22||t.memoizedState===null){if(t.tag===30&&(t.flags&18874368)!==0){var e=t.stateNode;e.paired!==null&&(e.paired=null,Bo(t.child,!1))}jw(t)}t=t.sibling}}function em(t){if(t.tag===30)t.stateNode.paired=null,Bo(t.child,!1),jw(t);else if((t.subtreeFlags&33554432)!==0)for(t=t.child;t!==null;)em(t),t=t.sibling;else jw(t)}function oD(t){for(t=t.child;t!==null;)t.tag===30?Bo(t.child,!1):(t.subtreeFlags&33554432)!==0&&oD(t),t=t.sibling}function G1(t,e,n,r,o,i,s){for(var l=!1;e!==null;){if(e.tag===5){var a=e.stateNode;if(i!==null&&Gn<i.length){var c=i[Gn],u=r1(a);(c.view||u.view)&&(l=!0);var d;if(d=(t.flags&4)===0)if(u.clip)d=!0;else{d=c.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}d&&(t.flags|=4),u.abs?u=!c.abs:(c=c.rect,u=u.rect,u=c.height!==u.height||c.width!==u.width),u&&(t.flags|=32)}else t.flags|=32;(t.flags&4)!==0&&HD(a,Gn===0?n:n+"_"+Gn,o),l&&(t.flags&4)!==0||(No===null&&(No=[]),No.push(a,Gn===0?r:r+"_"+Gn,e.memoizedProps)),Gn++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&s?t.flags|=e.flags&32:G1(t,e.child,n,r,o,i,s)&&(l=!0));e=e.sibling}return l}function iD(t,e){for(t=t.child;t!==null;){if(t.tag===30){var n=t.memoizedProps,r=t.stateNode,o=gi(n,r),i=xi(n.default,n.update);if(e){r=r.clones;var s=r===null?null:r.map(TV)}else s=t.memoizedState,t.memoizedState=null;r=t;var l=t.child;Gn=0,o=G1(r,l,o,o,i,s,!1),(t.flags&4)!==0&&o&&(e||Lc(t,n.onUpdate))}else(t.subtreeFlags&33554432)!==0&&iD(t,e);t=t.sibling}}var $t=!1,Me=!1,Mo=!1,$b=!1,RM=typeof WeakSet=="function"?WeakSet:Set,Yt=null,Ro=!1,Hd=!1,Mm=!1,Vw=!1;function Wj(t,e,n){if(t=t.containerInfo,e1=jc,t=$R(t),w1(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var o=r.getSelection&&r.getSelection();if(o&&o.rangeCount!==0){r=o.anchorNode;var i=o.anchorOffset,s=o.focusNode;o=o.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var l=0,a=-1,c=-1,u=0,d=0,f=t,h=null;t:for(;;){for(var p;f!==r||i!==0&&f.nodeType!==3||(a=l+i),f!==s||o!==0&&f.nodeType!==3||(c=l+o),f.nodeType===3&&(l+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===t)break t;if(h===r&&++u===i&&(a=l),h===s&&++d===o&&(c=l),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}r=a===-1||c===-1?null:{start:a,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(t1={focusedElem:t,selectionRange:r},jc=!1,n=(n&335544064)===n,Yt=e,e=n?9270:1024;Yt!==null;){if(t=Yt,n&&(r=t.deletions,r!==null))for(i=0;i<r.length;i++)n&&Hw(r[i]);if(t.alternate===null&&(t.flags&2)!==0)n&&AM(t),zp(n);else{if(t.tag===22){if(r=t.alternate,t.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&Hw(r),zp(n);continue}else if(r!==null&&r.memoizedState!==null){n&&AM(t),zp(n);continue}}r=t.child,(t.subtreeFlags&e)!==0&&r!==null?(r.return=t,Yt=r):(n&&rD(t),zp(n))}}vr=null}function zp(t){for(;Yt!==null;){var e=Yt,n=t,r=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 15:break;case 1:if((o&1024)!==0&&r!==null){n=void 0,o=r.memoizedProps,r=r.memoizedState;var i=e.stateNode;try{var s=Xl(e.type,o);n=i.getSnapshotBeforeUpdate(s,r),i.__reactInternalSnapshotBeforeUpdate=n}catch(l){De(e,e.return,l)}}break;case 3:if((o&1024)!==0){if(r=e.stateNode.containerInfo,n=r.nodeType,n===9)o1(r);else if(n===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":o1(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=gi(r.memoizedProps,r.stateNode),o=e.memoizedProps,o=xi(o.default,o.update),o!=="none"&&qc(r,n,o,r.memoizedState=[],!0));break;default:if((o&1024)!==0)throw Error(A(163))}if(r=e.sibling,r!==null){r.return=e.return,Yt=r;break}Yt=e.return}}function sD(t,e,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Oo(t,n),r&4&&Tf(5,n);break;case 1:if(Oo(t,n),r&4)if(t=n.stateNode,e===null)try{t.componentDidMount()}catch(s){De(n,n.return,s)}else{var o=Xl(n.type,e.memoizedProps);e=e.memoizedState;try{t.componentDidUpdate(o,e,t.__reactInternalSnapshotBeforeUpdate)}catch(s){De(n,n.return,s)}}r&64&&QO(n),r&512&&Do(n,n.return);break;case 3:if(Oo(t,n),r&64&&(t=n.updateQueue,t!==null)){if(e=null,n.child!==null)switch(n.child.tag){case 27:case 5:e=n.child.stateNode;break;case 1:e=n.child.stateNode}try{aO(t,e)}catch(s){De(n,n.return,s)}}break;case 27:e===null&&r&4&&tD(n);case 26:case 5:Oo(t,n),e===null&&r&4&&zw(n),r&512&&Do(n,n.return);break;case 12:Oo(t,n);break;case 31:Oo(t,n),r&4&&uD(t,n);break;case 13:Oo(t,n),r&4&&dD(t,n),r&64&&(t=n.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(n=aV.bind(null,n),jV(t,n))));break;case 22:if(r=n.memoizedState!==null||$t,!r){var i=e!==null&&e.memoizedState!==null||Me;e=$t,o=Me,$t=r,(Me=i)&&!o?(r=2,(n.subtreeFlags&8772)!==0&&(r|=1),co(t,n,r)):Oo(t,n),$t=e,Me=o}break;case 30:Oo(t,n),r&512&&Do(n,n.return);break;case 7:r&512&&Do(n,n.return);default:Oo(t,n)}}function Fw(t,e){for(t=t.child;t!==null;)lD(t,e),t=t.sibling}function lD(t,e){switch(t.tag){case 5:case 26:try{var n=t.stateNode;if(e){var r=n.style;typeof r.setProperty=="function"?r.setProperty("display","none","important"):r.display="none"}else{var o=t.stateNode,i=t.memoizedProps.style,s=i!=null&&i.hasOwnProperty("display")?i.display:null;o.style.display=s==null||typeof s=="boolean"?"":(""+s).trim()}}catch(a){De(t,t.return,a)}$w(t,e);break;case 6:try{t.stateNode.nodeValue=e?"":t.memoizedProps,we=!0}catch(a){De(t,t.return,a)}break;case 18:try{var l=t.stateNode;e?YM(l,!0):YM(t.stateNode,!1)}catch(a){De(t,t.return,a)}break;case 22:case 23:t.memoizedState===null&&Fw(t,e);break;default:Fw(t,e)}}function $w(t,e){if(t.subtreeFlags&67108864)for(t=t.child;t!==null;){e:{var n=t,r=e;switch(n.tag){case 4:lD(n,r);break e;case 22:n.memoizedState===null&&$w(n,r);break e;default:$w(n,r)}}t=t.sibling}}function aD(t){var e=t.alternate;e!==null&&(t.alternate=null,aD(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&Pm(e)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var rt=null,qn=!1;function ao(t,e,n){for(n=n.child;n!==null;)cD(t,e,n),n=n.sibling}function cD(t,e,n){if(Sr&&typeof Sr.onCommitFiberUnmount=="function")try{Sr.onCommitFiberUnmount(vf,n)}catch{}switch(n.tag){case 26:Me||on(n,e),ao(t,e,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!Me&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Me||on(n,e),Wd(n);var r=rt,o=qn;zs(n.type)&&(rt=n.stateNode,qn=!1),ao(t,e,n),WD(n.stateNode,n.type,n.memoizedProps),rt=r,qn=o;break;case 5:Me||on(n,e),Wd(n);case 6:if(n.tag===6&&Wd(n),r=rt,o=qn,rt=null,ao(t,e,n),rt=r,qn=o,rt!==null)if(qn)try{(rt.nodeType===9?rt.body:rt.nodeName==="HTML"?rt.ownerDocument.body:rt).removeChild(n.stateNode),we=!0}catch(i){De(n,e,i)}else try{rt.removeChild(n.stateNode),we=!0}catch(i){De(n,e,i)}break;case 18:rt!==null&&(qn?(t=rt,$M(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,n.stateNode),Vc(t)):$M(rt,n.stateNode));break;case 4:r=rt,o=qn,rt=n.stateNode.containerInfo,qn=!0,ao(t,e,n),rt=r,qn=o;break;case 0:case 11:case 14:case 15:_s(2,n,e),Me||_s(4,n,e),ao(t,e,n);break;case 1:Me||(on(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"&&ZO(n,e,r)),ao(t,e,n);break;case 21:ao(t,e,n);break;case 22:Me=(r=Me)||n.memoizedState!==null,ao(t,e,n),Me=r;break;case 30:on(n,e),ao(t,e,n);break;case 7:Me||on(n,e),ao(t,e,n);break;default:ao(t,e,n)}}function uD(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Vc(t)}catch(n){De(e,e.return,n)}}}function dD(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Vc(t)}catch(n){De(e,e.return,n)}}function Jj(t){switch(t.tag){case 31:case 13:case 19:var e=t.stateNode;return e===null&&(e=t.stateNode=new RM),e;case 22:return t=t.stateNode,e=t._retryCache,e===null&&(e=t._retryCache=new RM),e;default:throw Error(A(435,t.tag))}}function Up(t,e){var n=Jj(t);e.forEach(function(r){if(!n.has(r)){n.add(r);var o=cV.bind(null,t,r);r.then(o,o)}})}function Pn(t,e,n){var r=e.deletions;if(r!==null)for(var o=0;o<r.length;o++){var i=r[o],s=t,l=e,a=l;e:for(;a!==null;){switch(a.tag){case 27:if(zs(a.type)){rt=a.stateNode,qn=!1;break e}break;case 5:rt=a.stateNode,qn=!1;break e;case 3:case 4:rt=a.stateNode.containerInfo,qn=!0;break e}a=a.return}if(rt===null)throw Error(A(160));cD(s,l,i),rt=null,qn=!1,s=i.alternate,s!==null&&(s.return=null),i.return=null}if(e.subtreeFlags&13886)for(e=e.child;e!==null;)fD(e,t,n),e=e.sibling}var uo=null;function fD(t,e,n){var r=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(o&4&&(r=t.updateQueue,r=r!==null?r.events:null,r!==null))for(var i=0;i<r.length;i++){var s=r[i];s.ref.impl=s.nextImpl}Pn(e,t,n),Bn(t),o&4&&(_s(3,t,t.return),Tf(3,t),_s(5,t,t.return));break;case 1:Pn(e,t,n),Bn(t),o&512&&(Me||r===null||on(r,r.return)),o&64&&$t&&(t=t.updateQueue,t!==null&&(e=t.callbacks,e!==null&&(n=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=n===null?e:n.concat(e))));break;case 26:if(i=uo,Pn(e,t,n),Bn(t),o&512&&(Me||r===null||on(r,r.return)),o&4)if(o=r!==null?r.memoizedState:null,n=t.memoizedState,r===null)if(n===null)if(t.stateNode===null)if($t)t.stateNode=BD(t.type,t.memoizedProps,e.containerInfo,t);else{e:{e=t.type,n=t.memoizedProps,o=i.ownerDocument||i;t:switch(e){case"title":r=o.getElementsByTagName("title")[0],(!r||r[Sf]||r[sn]||r.namespaceURI==="http://www.w3.org/2000/svg"||r.hasAttribute("itemprop"))&&(r=o.createElement(e),o.head.insertBefore(r,o.querySelector("head > title"))),un(r,e,n),r[sn]=t,qt(r),e=r;break e;case"link":if(i=ZM("link","href",o).get(e+(n.href||""))){for(s=0;s<i.length;s++)if(r=i[s],r.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&r.getAttribute("rel")===(n.rel==null?null:n.rel)&&r.getAttribute("title")===(n.title==null?null:n.title)&&r.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){i.splice(s,1);break t}}r=o.createElement(e),un(r,e,n),o.head.appendChild(r);break;case"meta":if(i=ZM("meta","content",o).get(e+(n.content||""))){for(s=0;s<i.length;s++)if(r=i[s],r.getAttribute("content")===(n.content==null?null:""+n.content)&&r.getAttribute("name")===(n.name==null?null:n.name)&&r.getAttribute("property")===(n.property==null?null:n.property)&&r.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute("charset")===(n.charSet==null?null:n.charSet)){i.splice(s,1);break t}}r=o.createElement(e),un(r,e,n),o.head.appendChild(r);break;default:throw Error(A(468,e))}r[sn]=t,qt(r),e=r}t.stateNode=e}else $t||l1(i,t.type,t.stateNode);else t.stateNode=QM(i,n,t.memoizedProps);else o!==n?(o===null?(e=r.stateNode,e===null||Me||e.parentNode.removeChild(e)):o.count--,n===null?$t||l1(i,t.type,t.stateNode):QM(i,n,t.memoizedProps)):n===null&&t.stateNode!==null&&Vb(t,t.memoizedProps,r.memoizedProps);break;case 27:Pn(e,t,n),Bn(t),o&512&&(Me||r===null||on(r,r.return)),r!==null&&o&4&&Vb(t,t.memoizedProps,r.memoizedProps);break;case 5:if(i=Mo,Mo=!1,Pn(e,t,n),Mo=i,Bn(t),o&512&&(Me||r===null||on(r,r.return)),t.flags&32){e=t.stateNode;try{Nc(e,""),we=!0}catch(u){De(t,t.return,u)}}o&4&&t.stateNode!=null&&(e=t.memoizedProps,Vb(t,e,r!==null?r.memoizedProps:e)),o&1024&&($b=!0);break;case 6:if(Pn(e,t,n),Bn(t),o&4){if(t.stateNode===null)throw Error(A(162));e=t.memoizedProps,n=t.stateNode;try{n.nodeValue=e,we=!0}catch(u){De(t,t.return,u)}}break;case 3:if(we=!1,om=null,i=uo,uo=hf(e.containerInfo),Pn(e,t,n),uo=i,Bn(t),o&4&&r!==null&&r.memoizedState.isDehydrated)try{Vc(e.containerInfo)}catch(u){De(t,t.return,u)}$b&&($b=!1,hD(t)),we=!1;break;case 4:o=Mo,Mo=$t,r=LA(),i=uo,uo=hf(t.stateNode.containerInfo),Pn(e,t,n),Bn(t),uo=i,we&&Hd&&(Mm=!0),we=r,Mo=o;break;case 12:Pn(e,t,n),Bn(t);break;case 31:Pn(e,t,n),Bn(t),o&4&&(e=t.updateQueue,e!==null&&(t.updateQueue=null,Up(t,e)));break;case 13:Pn(e,t,n),Bn(t),t.child.flags&8192&&t.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Jm=wr()),o&4&&(e=t.updateQueue,e!==null&&(t.updateQueue=null,Up(t,e)));break;case 22:i=t.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var l=$t,a=Me,c=Mo;$t=l||i,Mo=c||i,Me=a||s,Pn(e,t,n),Me=a,Mo=c,$t=l,Bn(t),o&8192&&(e=t.stateNode,e._visibility=i?e._visibility&-2:e._visibility|1,!i||r===null||s||$t||Me||(e=s||Me,n=$t,r=Me,$t=i||$t,Me=e,us(t,2),$t=n,Me=r),!i&&Mo||Fw(t,i)),o&4&&(e=t.updateQueue,e!==null&&(n=e.retryQueue,n!==null&&(e.retryQueue=null,Up(t,n))));break;case 19:Pn(e,t,n),Bn(t),o&4&&(e=t.updateQueue,e!==null&&(t.updateQueue=null,Up(t,e)));break;case 30:o&512&&(Me||r===null||on(r,r.return)),o=LA(),i=Hd,s=(n&335544064)===n,l=t.memoizedProps,Hd=s&&xi(l.default,l.update)!=="none",Pn(e,t,n),Bn(t),s&&r!==null&&we&&(t.flags|=4),Hd=i,we=o;break;case 21:break;case 7:o&512&&(Me||r===null||on(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=t);default:Pn(e,t,n),Bn(t)}}function Bn(t){var e=t.flags;if(e&2){try{for(var n,r=t.return;r!==null;){if(eD(r)){n=r;break}r=r.return}r=null;for(var o=t.return;o!==null;){if(K1(o)){var i=o.stateNode;r===null?r=[i]:r.push(i)}if(q1(o))break;o=o.return}var s=r;if(n==null)throw Error(A(160));switch(n.tag){case 27:var l=n.stateNode,a=Fb(t);km(t,a,l,s);break;case 5:var c=n.stateNode;n.flags&32&&(Nc(c,""),n.flags&=-33);var u=Fb(t);km(t,u,c,s);break;case 3:case 4:var d=n.stateNode.containerInfo,f=Fb(t);Uw(t,f,d,s);break;default:throw Error(A(161))}}catch(h){De(t,t.return,h)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function hD(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var e=t;hD(e),e.tag===5&&e.flags&1024&&(e=e.stateNode,jc=!0,e.reset(),jc=!1),t=t.sibling}}function oc(t,e){if(e.subtreeFlags&9270)for(e=e.child;e!==null;)pD(e,t),e=e.sibling;else iD(e,!1)}function pD(t,e){var n=t.alternate;if(n===null)Pw(t,!1);else switch(t.tag){case 3:if(Vw=Ro=!1,MM(),oc(e,t),!Ro&&!Mm){if(t=No,t!==null)for(var r=0;r<t.length;r+=3){n=t[r];var o=t[r+1];jD(n,t[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+o+")"})}t=e.containerInfo,t=t.nodeType===9?t.documentElement:t.ownerDocument.documentElement,t!==null&&t.style.viewTransitionName===""&&(t.style.viewTransitionName="none",t.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),t.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),Vw=!0}No=null;break;case 5:oc(e,t);break;case 4:r=Ro,Ro=!1,oc(e,t),Ro&&(Mm=!0),Ro=r;break;case 22:t.memoizedState===null&&(n.memoizedState!==null?Pw(t,!1):oc(e,t));break;case 30:r=Ro,o=MM(),Ro=!1,oc(e,t),Ro&&(t.flags|=4);var i=t.memoizedProps,s=t.stateNode;e=gi(i,s),s=gi(n.memoizedProps,s);var l=xi(i.default,i.update);l==="none"?e=!1:(i=n.memoizedState,n.memoizedState=null,n=t.child,Gn=0,e=G1(t,n,e,s,l,i,!0),Gn!==(i===null?0:i.length)&&(t.flags|=32)),(t.flags&4)!==0&&e?(Lc(t,t.memoizedProps.onUpdate),No=o):o!==null&&(o.push.apply(o,No),No=o),Ro=(t.flags&32)!==0?!0:r;break;default:oc(e,t)}}function Oo(t,e){if(e.subtreeFlags&8772)for(e=e.child;e!==null;)sD(t,e.alternate,e),e=e.sibling}function us(t,e){for(t=t.child;t!==null;){var n=t,r=e;switch(n.tag){case 0:case 11:case 14:case 15:_s(4,n,n.return),us(n,r);break;case 1:on(n,n.return);var o=n.stateNode;typeof o.componentWillUnmount=="function"&&ZO(n,n.return,o),us(n,r);break;case 27:(r&2)!==0&&WD(n.stateNode,n.type,n.memoizedProps);case 5:on(n,n.return),n.tag!==5&&n.tag!==27||Wd(n),us(n,r);break;case 6:Wd(n);break;case 26:on(n,n.return),o=n.stateNode,n.memoizedState!==null||o===null||Me||o.parentNode.removeChild(o),us(n,r);break;case 22:n.memoizedState===null&&us(n,r);break;case 30:on(n,n.return),us(n,r);break;case 7:on(n,n.return);default:us(n,r)}t=t.sibling}}function co(t,e,n){for(n=(e.subtreeFlags&8772)!==0?n:n&-2,e=e.child;e!==null;){var r=e.alternate,o=t,i=e,s=i.flags,l=(n&1)!==0;switch(i.tag){case 0:case 11:case 15:co(o,i,n),Tf(4,i);break;case 1:if(co(o,i,n),r=i,o=r.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(u){De(r,r.return,u)}if(r=i,o=r.updateQueue,o!==null){var a=r.stateNode;try{var c=o.shared.hiddenCallbacks;if(c!==null)for(o.shared.hiddenCallbacks=null,o=0;o<c.length;o++)lO(c[o],a)}catch(u){De(r,r.return,u)}}l&&s&64&&QO(i),Do(i,i.return);break;case 27:(n&2)!==0&&tD(i);case 5:i.tag!==5&&i.tag!==27||kM(i),co(o,i,n),l&&r===null&&s&4&&zw(i),Do(i,i.return);break;case 6:kM(i);break;case 26:a=i.stateNode,i.memoizedState!==null||a===null||$t||l1(hf(a.ownerDocument),i.type,a),co(o,i,n),l&&r===null&&s&4&&zw(i),Do(i,i.return);break;case 12:co(o,i,n);break;case 31:co(o,i,n),l&&s&4&&uD(o,i);break;case 13:co(o,i,n),l&&s&4&&dD(o,i);break;case 22:i.memoizedState===null&&co(o,i,n),Do(i,i.return);break;case 30:co(o,i,n),Do(i,i.return);break;case 7:Do(i,i.return);default:co(o,i,n)}e=e.sibling}}function X1(t,e){var n=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),t=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(t=e.memoizedState.cachePool.pool),t!==n&&(t!=null&&t.refCount++,n!=null&&Cf(n))}function W1(t,e){t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&Cf(t))}function jr(t,e,n,r){var o=(n&335544064)===n;if(e.subtreeFlags&(o?10262:10256))for(e=e.child;e!==null;)mD(t,e,n,r),e=e.sibling;else o&&oD(e)}function mD(t,e,n,r){var o=(n&335544064)===n;o&&e.alternate===null&&e.return!==null&&e.return.alternate!==null&&em(e);var i=e.flags;switch(e.tag){case 0:case 11:case 15:jr(t,e,n,r),i&2048&&Tf(9,e);break;case 1:jr(t,e,n,r);break;case 3:jr(t,e,n,r),o&&Vw&&(t=t.containerInfo,t=t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,t.style.viewTransitionName==="root"&&(t.style.viewTransitionName=""),t=t.ownerDocument.documentElement,t!==null&&t.style.viewTransitionName==="none"&&(t.style.viewTransitionName="")),i&2048&&(i=null,e.alternate!==null&&(i=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==i&&(e.refCount++,i!=null&&Cf(i)));break;case 12:if(i&2048){jr(t,e,n,r),i=e.stateNode;try{var s=e.memoizedProps,l=s.id,a=s.onPostCommit;typeof a=="function"&&a(l,e.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(c){De(e,e.return,c)}}else jr(t,e,n,r);break;case 31:jr(t,e,n,r);break;case 13:jr(t,e,n,r);break;case 23:break;case 22:s=e.stateNode,l=e.alternate,e.memoizedState!==null?(o&&l!==null&&l.memoizedState===null&&em(l),s._visibility&2?jr(t,e,n,r):Jd(t,e)):(o&&l!==null&&l.memoizedState!==null&&em(e),s._visibility&2?jr(t,e,n,r):(s._visibility|=2,sc(t,e,n,r,(e.subtreeFlags&10256)!==0||!1))),i&2048&&X1(l,e);break;case 24:jr(t,e,n,r),i&2048&&W1(e.alternate,e);break;case 30:o&&(i=e.alternate,i!==null&&(Bo(i.child,!0),Bo(e.child,!0))),jr(t,e,n,r);break;default:jr(t,e,n,r)}}function sc(t,e,n,r,o){for(o=o&&((e.subtreeFlags&10256)!==0||!1),e=e.child;e!==null;){var i=t,s=e,l=n,a=r,c=s.flags;switch(s.tag){case 0:case 11:case 15:sc(i,s,l,a,o),Tf(8,s);break;case 23:break;case 22:var u=s.stateNode;s.memoizedState!==null?u._visibility&2?sc(i,s,l,a,o):Jd(i,s):(u._visibility|=2,sc(i,s,l,a,o)),o&&c&2048&&X1(s.alternate,s);break;case 24:sc(i,s,l,a,o),o&&c&2048&&W1(s.alternate,s);break;default:sc(i,s,l,a,o)}e=e.sibling}}function Jd(t,e){if(e.subtreeFlags&10256)for(e=e.child;e!==null;){var n=t,r=e,o=r.flags;switch(r.tag){case 22:Jd(n,r),o&2048&&X1(r.alternate,r);break;case 24:Jd(n,r),o&2048&&W1(r.alternate,r);break;default:Jd(n,r)}e=e.sibling}}var Ll=8192;function Nl(t,e,n){if(t.subtreeFlags&Ll)for(t=t.child;t!==null;)gD(t,e,n),t=t.sibling}function gD(t,e,n){switch(t.tag){case 26:Nl(t,e,n),t.flags&Ll&&(t.memoizedState!==null?t6(n,uo,t.memoizedState,t.memoizedProps):(t=t.stateNode,(e&335544128)===e&&tR(n,t)));break;case 5:Nl(t,e,n),t.flags&Ll&&(t=t.stateNode,(e&335544128)===e&&tR(n,t));break;case 3:case 4:var r=uo;uo=hf(t.stateNode.containerInfo),Nl(t,e,n),uo=r;break;case 22:t.memoizedState===null&&(r=t.alternate,r!==null&&r.memoizedState!==null?(r=Ll,Ll=16777216,Nl(t,e,n),Ll=r):Nl(t,e,n));break;case 30:if((t.flags&Ll)!==0&&(r=t.memoizedProps.name,r!=null&&r!=="auto")){var o=t.stateNode;o.paired=null,vr===null&&(vr=new Map),vr.set(r,o)}Nl(t,e,n);break;default:Nl(t,e,n)}}function yD(t){var e=t.alternate;if(e!==null&&(t=e.child,t!==null)){e.child=null;do e=t.sibling,t.sibling=null,t=e;while(t!==null)}}function _d(t){var e=t.deletions;if((t.flags&16)!==0){if(e!==null)for(var n=0;n<e.length;n++){var r=e[n];Yt=r,bD(r,t)}yD(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)vD(t),t=t.sibling}function vD(t){switch(t.tag){case 0:case 11:case 15:_d(t),t.flags&2048&&_s(9,t,t.return);break;case 3:_d(t);break;case 12:_d(t);break;case 22:var e=t.stateNode;t.memoizedState!==null&&e._visibility&2&&(t.return===null||t.return.tag!==13)?(e._visibility&=-3,tm(t)):_d(t);break;default:_d(t)}}function tm(t){var e=t.deletions;if((t.flags&16)!==0){if(e!==null)for(var n=0;n<e.length;n++){var r=e[n];Yt=r,bD(r,t)}yD(t)}for(t=t.child;t!==null;){switch(e=t,e.tag){case 0:case 11:case 15:_s(8,e,e.return),tm(e);break;case 22:n=e.stateNode,n._visibility&2&&(n._visibility&=-3,tm(e));break;default:tm(e)}t=t.sibling}}function bD(t,e){for(;Yt!==null;){var n=Yt;switch(n.tag){case 0:case 11:case 15:_s(8,n,e);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Cf(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Yt=r;else e:for(n=t;Yt!==null;){r=Yt;var o=r.sibling,i=r.return;if(aD(r),r===n){Yt=null;break e}if(o!==null){o.return=i,Yt=o;break e}Yt=i}}}var Qj={getCacheForType:function(t){var e=ln(xt),n=e.data.get(t);return n===void 0&&(n=t(),e.data.set(t,n)),n},cacheSignal:function(){return ln(xt).controller.signal}},Zj=typeof WeakMap=="function"?WeakMap:Map,ke=0,Pe=null,he=null,pe=0,Re=0,mr=null,ys=!1,Kc=!1,J1=!1,wi=0,dt=0,Is=0,Vl=0,Rm=0,br=0,Ic=0,Qd=null,Kn=null,Yw=!1,Jm=0,wD=0,Om=1/0,Dm=null,ks=null,it=0,ho=null,Wl=null,Po=0,qw=0,Kw=null,SD=null,Ac=null,Mc=null,Rc=null,Zd=0,nm=null;function Cr(){return(ke&2)!==0&&pe!==0?pe&-pe:Q.T!==null?Z1():TR()}function xD(){if(br===0)if((pe&536870912)===0||ue){var t=Ep;Ep<<=1,(Ep&3932160)===0&&(Ep=262144),br=t}else br=536870912;return t=dn.current,t!==null&&(t.flags|=32),br}function Lc(t,e){if(e!=null){var n=t.stateNode,r=n.ref;r===null&&(r=n.ref=FD(gi(t.memoizedProps,n))),Mc===null&&(Mc=[]),Mc.push(e.bind(null,r))}}function Wn(t,e,n){(t===Pe&&(Re===2||Re===9)||t.cancelPendingCommit!==null)&&(zc(t,0),vs(t,pe,br,!1)),wf(t,n),((ke&2)===0||t!==Pe)&&(t===Pe&&((ke&2)===0&&(Vl|=n),dt===4&&vs(t,pe,br,!1)),jo(t))}function CD(t,e,n){if((ke&6)!==0)throw Error(A(327));var r=!n&&(e&127)===0&&(e&t.expiredLanes)===0||bf(t,e),o=r?nV(t,e):Yb(t,e,!0),i=r;do{if(o===0){Kc&&!r&&vs(t,e,0,!1);break}else{if(n=t.current.alternate,i&&!eV(n)){o=Yb(t,e,!1),i=!1;continue}if(o===2){if(i=e,t.errorRecoveryDisabledLanes&i)var s=0;else s=t.pendingLanes&-536870913,s=s!==0?s:s&536870912?536870912:0;if(s!==0){e=s;e:{var l=t;o=Qd;var a=l.current.memoizedState.isDehydrated;if(a&&(zc(l,s).flags|=256),s=Yb(l,s,!1),s!==2&&s!==6){if(J1&&!a){l.errorRecoveryDisabledLanes|=i,Vl|=i,o=4;break e}i=Kn,Kn=o,i!==null&&(Kn===null?Kn=i:Kn.push.apply(Kn,i))}o=s}if(i=!1,o!==2)continue}}if(o===1){zc(t,0),vs(t,e,0,!0);break}e:{switch(r=t,i=o,i){case 0:case 1:throw Error(A(345));case 4:if((e&4194048)!==e&&(e&62914560)!==e)break;case 6:vs(r,e,br,!ys);break e;case 2:Kn=null;break;case 3:case 5:break;default:throw Error(A(329))}if((e&62914560)===e&&(o=Jm+300-wr(),10<o)){if(vs(r,e,br,!ys),Um(r,0,!0)!==0)break e;Po=e,r.timeoutHandle=tS(OM.bind(null,r,n,Kn,Dm,Yw,e,br,Vl,Ic,ys,i,"Throttled",-0,0),o);break e}OM(r,n,Kn,Dm,Yw,e,br,Vl,Ic,ys,i,null,-0,0)}}break}while(!0);jo(t)}function OM(t,e,n,r,o,i,s,l,a,c,u,d,f,h){t.timeoutHandle=-1;var p=e.subtreeFlags,m=(i&335544064)===i;if(d=null,(m||p&8192||(p&16785408)===16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Io},vr=null,gD(e,i,d),m&&(p=d,m=t.containerInfo,m=(m.nodeType===9?m:m.ownerDocument).__reactViewTransition,m!=null&&(p.count++,p.waitingForViewTransition=!0,p=pf.bind(p),m.finished.then(p,p))),p=(i&62914560)===i?Jm-wr():(i&4194048)===i?wD-wr():0,p=n6(d,p),p!==null)){Po=i,t.cancelPendingCommit=p(NM.bind(null,t,e,i,n,r,o,s,l,a,c,u,d,null,f,h)),vs(t,i,s,!c);return}NM(t,e,i,n,r,o,s,l,a,c,u,d)}function eV(t){for(var e=t;;){var n=e.tag;if((n===0||n===11||n===15)&&e.flags&16384&&(n=e.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!Er(i(),o))return!1}catch{return!1}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function vs(t,e,n,r){e=wR(t,e),e&=~Rm,e&=~Vl,t.suspendedLanes|=e,t.pingedLanes&=~e,r&&(t.warmLanes|=e),r=t.expirationTimes;for(var o=e;0<o;){var i=31-xr(o),s=1<<i;r[i]=-1,o&=~s}n!==0&&xR(t,n,e)}function Qm(){return(ke&6)===0?(kf(0,!1),!1):!0}function Q1(){if(he!==null){if(Re===0)var t=he.return;else t=he,fi=ta=null,L1(t),Ec=null,lf=0,t=he;for(;t!==null;)JO(t.alternate,t),t=t.return;he=null}}function zc(t,e){var n=t.timeoutHandle;return n!==-1&&(t.timeoutHandle=-1,xV(n)),n=t.cancelPendingCommit,n!==null&&(t.cancelPendingCommit=null,n()),Po=0,Q1(),Pe=t,he=n=hi(t.current,null),pe=e,Re=0,mr=null,ys=!1,Kc=bf(t,e),J1=!1,Ic=br=Rm=Vl=Is=dt=0,Kn=Qd=null,Yw=!1,wi=wR(t,e),Vm(),n}function ED(t,e){se=null,Q.H=Cm,e===Yc||e===Ym?(e=rM(),Re=3):e===A1?(e=rM(),Re=4):Re=e===F1?8:e!==null&&typeof e=="object"&&typeof e.then=="function"?6:1,mr=e,he===null&&(dt=1,Em(t,qr(e,t.current)))}function TD(){var t=dn.current;return t===null?!0:(pe&4194048)===pe?En===null:(pe&62914560)===pe||(pe&536870912)!==0?t===En:!1}function kD(){var t=Q.H;return Q.H=Cm,t===null?Cm:t}function AD(){var t=Q.A;return Q.A=Qj,t}function Nm(){dt=4,ys||(pe&4194048)!==pe&&dn.current!==null||(Kc=!0),(Is&134217727)===0&&(Vl&134217727)===0||Pe===null||vs(Pe,pe,br,!1)}function Yb(t,e,n){var r=ke;ke|=2;var o=kD(),i=AD();(Pe!==t||pe!==e)&&(Dm=null,zc(t,e)),e=!1;var s=dt;e:do try{if(Re!==0&&he!==null){var l=he,a=mr;switch(Re){case 8:Q1(),s=6;break e;case 3:case 2:case 9:case 6:dn.current===null&&(e=!0);var c=Re;if(Re=0,mr=null,bc(t,l,a,c),n&&Kc){s=0;break e}break;default:c=Re,Re=0,mr=null,bc(t,l,a,c)}}tV(),s=dt;break}catch(u){ED(t,u)}while(!0);return e&&t.shellSuspendCounter++,fi=ta=null,ke=r,Q.H=o,Q.A=i,he===null&&(Pe=null,pe=0,Vm()),s}function tV(){for(;he!==null;)MD(he)}function nV(t,e){var n=ke;ke|=2;var r=kD(),o=AD();Pe!==t||pe!==e?(Dm=null,Om=wr()+500,zc(t,e)):Kc=bf(t,e);e:do try{if(Re!==0&&he!==null){e=he;var i=mr;t:switch(Re){case 1:Re=0,mr=null,bc(t,e,i,1);break;case 2:case 9:if(nM(i)){Re=0,mr=null,DM(e);break}e=function(){Re!==2&&Re!==9||Pe!==t||(Re=7),jo(t)},i.then(e,e);break e;case 3:Re=7;break e;case 4:Re=5;break e;case 7:nM(i)?(Re=0,mr=null,DM(e)):(Re=0,mr=null,bc(t,e,i,7));break;case 5:var s=null;switch(he.tag){case 26:s=he.memoizedState;case 5:case 27:var l=he;if(s?ZD(s):l.stateNode.complete){Re=0,mr=null;var a=l.sibling;if(a!==null)he=a;else{var c=l.return;c!==null?(he=c,Zm(c)):he=null}break t}}Re=0,mr=null,bc(t,e,i,5);break;case 6:Re=0,mr=null,bc(t,e,i,6);break;case 8:Q1(),dt=6;break e;default:throw Error(A(462))}}rV();break}catch(u){ED(t,u)}while(!0);return fi=ta=null,Q.H=r,Q.A=o,ke=n,he!==null?0:(Pe=null,pe=0,Vm(),dt)}function rV(){for(;he!==null&&!wH();)MD(he)}function MD(t){var e=WO(t.alternate,t,wi);t.memoizedProps=t.pendingProps,e===null?Zm(t):he=e}function DM(t){var e=t,n=e.alternate;switch(e.tag){case 15:case 0:e=bM(n,e,e.pendingProps,e.type,void 0,pe);break;case 11:e=bM(n,e,e.pendingProps,e.type.render,e.ref,pe);break;case 5:L1(e);var r=e;r===Kt&&(ue?(gm(r),r.tag===5&&r.stateNode!=null&&(Ge=r.stateNode)):(gm(r),ue=!0));default:JO(n,e),e=he=QR(e,wi),e=WO(n,e,wi)}t.memoizedProps=t.pendingProps,e===null?Zm(t):he=e}function bc(t,e,n,r){fi=ta=null,L1(e),Ec=null,lf=0;var o=e.return;try{if($j(t,o,e,n,pe)){dt=1,Em(t,qr(n,t.current)),he=null;return}}catch(i){if(o!==null)throw he=o,i;dt=1,Em(t,qr(n,t.current)),he=null;return}e.flags&32768?(ue||r===1?t=!0:Kc||(pe&536870912)!==0?t=!1:(ys=t=!0,(r===2||r===9||r===3||r===6)&&(r=dn.current,r!==null&&r.tag===13&&(r.flags|=16384))),RD(e,t)):Zm(e)}function Zm(t){var e=t;do{if((e.flags&32768)!==0){RD(e,ys);return}t=e.return;var n=Gj(e.alternate,e,wi);if(n!==null){he=n;return}if(e=e.sibling,e!==null){he=e;return}he=e=t}while(e!==null);dt===0&&(dt=5)}function RD(t,e){do{var n=Xj(t.alternate,t);if(n!==null){n.flags&=32767,he=n;return}if(n=t.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!e&&(t=t.sibling,t!==null)){he=t;return}he=t=n}while(t!==null);dt=6,he=null}function NM(t,e,n,r,o,i,s,l,a,c,u,d){t.cancelPendingCommit=null;do eg();while(it!==0);if((ke&6)!==0)throw Error(A(327));if(e!==null){if(e===t.current)throw Error(A(177));t===Pe&&(he=Pe=null,pe=0),Wl=e,ho=t,Po=n,Kw=o,SD=r,oV(t,e,n,s,l,a,d)}}function oV(t,e,n,r,o,i,s){var l=e.lanes|e.childLanes;if(qw=l,l|=S1,OH(t,n,l,r,o,i),Mc=null,(n&335544064)===n?(Rc=Nj(t),r=10262):(Rc=null,r=10256),(e.subtreeFlags&r)!==0||(e.flags&r)!==0?(t.callbackNode=null,t.callbackPriority=0,uV(dm,function(){return Jw(),null})):(t.callbackNode=null,t.callbackPriority=0),Am=!1,r=(e.flags&13878)!==0,(e.subtreeFlags&13878)!==0||r){r=Q.T,Q.T=null,o=Ae.p,Ae.p=2,i=ke,ke|=4;try{Wj(t,e,n)}finally{ke=i,Ae.p=o,Q.T=r}}it=1,Am?Ac=MV(s,t.containerInfo,Rc,Gw,Xw,sV,Ww,Jw,iV,null,null):(Gw(),Xw(),Ww())}function iV(t){if(it!==0){var e=ho.onRecoverableError;e(t,{componentStack:null})}}function sV(){it===3&&(it=0,pD(Wl,ho),it=4)}function Gw(){if(it===1){it=0;var t=ho,e=Wl,n=Po,r=(e.flags&13878)!==0;if((e.subtreeFlags&13878)!==0||r){r=Q.T,Q.T=null;var o=Ae.p;Ae.p=2;var i=ke;ke|=4;try{Hd=Mm=!1,fD(e,t,n),n=t1;var s=$R(t.containerInfo),l=n.focusedElem,a=n.selectionRange;if(s!==l&&l&&l.ownerDocument&&FR(l.ownerDocument.documentElement,l)){if(a!==null&&w1(l)){var c=a.start,u=a.end;if(u===void 0&&(u=c),"selectionStart"in l)l.selectionStart=c,l.selectionEnd=Math.min(u,l.value.length);else{var d=l.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var h=f.getSelection(),p=l.textContent.length,m=Math.min(a.start,p),y=a.end===void 0?m:Math.min(a.end,p);!h.extend&&m>y&&(s=y,y=m,m=s);var g=GA(l,m),v=GA(l,y);if(g&&v&&(h.rangeCount!==1||h.anchorNode!==g.node||h.anchorOffset!==g.offset||h.focusNode!==v.node||h.focusOffset!==v.offset)){var b=d.createRange();b.setStart(g.node,g.offset),h.removeAllRanges(),m>y?(h.addRange(b),h.extend(v.node,v.offset)):(b.setEnd(v.node,v.offset),h.addRange(b))}}}}for(d=[],h=l;h=h.parentNode;)h.nodeType===1&&d.push({element:h,left:h.scrollLeft,top:h.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<d.length;l++){var w=d[l];w.element.scrollLeft=w.left,w.element.scrollTop=w.top}}jc=!!e1,t1=e1=null}finally{ke=i,Ae.p=o,Q.T=r}}t.current=e,it=2}}function Xw(){if(it===2){it=0;var t=ho,e=Wl,n=(e.flags&8772)!==0;if((e.subtreeFlags&8772)!==0||n){n=Q.T,Q.T=null;var r=Ae.p;Ae.p=2;var o=ke;ke|=4;try{sD(t,e.alternate,e)}finally{ke=o,Ae.p=r,Q.T=n}}it=3}}function Ww(){if(it===4||it===3){it=0;var t=Ac;Ac=null,SH();var e=ho,n=Wl,r=Po,o=SD,i=(r&335544064)===r?10262:10256;if((n.subtreeFlags&i)!==0||(n.flags&i)!==0?it=5:(it=0,Wl=ho=null,OD(e,e.pendingLanes)),i=e.pendingLanes,i===0&&(ks=null),p1(r),n=n.stateNode,Sr&&typeof Sr.onCommitFiberRoot=="function")try{Sr.onCommitFiberRoot(vf,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=Q.T,i=Ae.p,Ae.p=2,Q.T=null;try{for(var s=e.onRecoverableError,l=0;l<o.length;l++){var a=o[l];s(a.value,{componentStack:a.stack})}}finally{Q.T=n,Ae.p=i}}if(o=Mc,s=Rc,Rc=null,o!==null&&(Mc=null,s===null&&(s=[]),t!==null))for(a=0;a<o.length;a++)n=(0,o[a])(s),n!==void 0&&t.finished.finally(n);(Po&3)!==0&&eg(),jo(e),i=e.pendingLanes,(r&261930)!==0&&(i&42)!==0?e===nm?Zd++:(Zd=0,nm=e):(Zd=0,nm=null),kf(0,!1)}}function OD(t,e){(t.pooledCacheLanes&=e)===0&&(e=t.pooledCache,e!=null&&(t.pooledCache=null,Cf(e)))}function eg(){return Ac!==null&&(Ac.skipTransition(),Ac=null),Gw(),Xw(),Ww(),Jw()}function Jw(){if(it!==5)return!1;var t=ho,e=qw;qw=0;var n=p1(Po),r=Q.T,o=Ae.p;try{Ae.p=32>n?32:n,Q.T=null,n=Kw,Kw=null;var i=ho,s=Po;if(it=0,Wl=ho=null,Po=0,(ke&6)!==0)throw Error(A(331));var l=ke;if(ke|=4,vD(i.current),mD(i,i.current,s,n),ke=l,kf(0,!1),Sr&&typeof Sr.onPostCommitFiberRoot=="function")try{Sr.onPostCommitFiberRoot(vf,i)}catch{}return!0}finally{Ae.p=o,Q.T=r,OD(t,e)}}function _M(t,e,n){e=qr(n,e),e=Ow(t.stateNode,e,2),t=Cs(t,e,2),t!==null&&(wf(t,2),jo(t))}function De(t,e,n){if(t.tag===3)_M(t,t,n);else for(;e!==null;){if(e.tag===3){_M(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ks===null||!ks.has(r))){t=qr(n,t),n=YO(2),r=Cs(e,n,2),r!==null&&(qO(n,r,e,t),wf(r,2),jo(r));break}}e=e.return}}function qb(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new Zj;var o=new Set;r.set(e,o)}else o=r.get(e),o===void 0&&(o=new Set,r.set(e,o));o.has(n)||(J1=!0,o.add(n),t=lV.bind(null,t,e,n),e.then(t,t))}function lV(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),t.pingedLanes|=t.suspendedLanes&n,t.warmLanes&=~n,Pe===t&&(pe&n)===n&&((dt===4||dt===3&&(pe&62914560)===pe&&300>wr()-Jm)&&(ke&2)===0?zc(t,0):Rm|=n,Ic===pe&&(Ic=0)),jo(t)}function DD(t,e){e===0&&(e=SR()),t=ea(t,e),t!==null&&(wf(t,e),jo(t))}function aV(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),DD(t,n)}function cV(t,e){var n=0;switch(t.tag){case 31:case 13:var r=t.stateNode,o=t.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=t.stateNode;break;case 22:r=t.stateNode._retryCache;break;default:throw Error(A(314))}r!==null&&r.delete(e),DD(t,n)}function uV(t,e){return f1(t,e)}var Uc=null,lc=null,Qw=!1,_m=!1,Kb=!1,bs=0;function jo(t){t!==lc&&t.next===null&&(lc===null?Uc=lc=t:lc=lc.next=t),_m=!0,Qw||(Qw=!0,fV())}function kf(t,e){if(!Kb&&_m){Kb=!0;do for(var n=!1,r=Uc;r!==null;){if(!e)if(t!==0){var o=r.pendingLanes;if(o===0)var i=0;else{var s=r.suspendedLanes,l=r.pingedLanes;i=(1<<31-xr(42|t)+1)-1,i&=o&~(s&~l),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,IM(r,i))}else i=pe,i=Um(r,r===Pe?i:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(i&3)===0||bf(r,i)||(n=!0,IM(r,i));r=r.next}while(n);Kb=!1}}function dV(){ND()}function ND(){_m=Qw=!1;var t=0;bs!==0&&SV()&&(t=bs);for(var e=wr(),n=null,r=Uc;r!==null;){var o=r.next,i=_D(r,e);i===0?(r.next=null,n===null?Uc=o:n.next=o,o===null&&(lc=n)):(n=r,(t!==0||(i&3)!==0)&&(_m=!0)),r=o}it!==0&&it!==5||kf(t,!1),bs!==0&&(bs=0)}function _D(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes&-62914561;0<i;){var s=31-xr(i),l=1<<s,a=o[s];a===-1?((l&n)===0||(l&r)!==0)&&(o[s]=RH(l,e)):a<=e&&(t.expiredLanes|=l),i&=~l}if(e=Pe,n=pe,n=Um(t,t===e?n:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),r=t.callbackNode,n===0||t===e&&(Re===2||Re===9)||t.cancelPendingCommit!==null)return r!==null&&r!==null&&Tb(r),t.callbackNode=null,t.callbackPriority=0;if((n&3)===0||bf(t,n)){if(e=n&-n,e===t.callbackPriority)return e;switch(r!==null&&Tb(r),p1(n)){case 2:case 8:n=vR;break;case 32:n=dm;break;case 268435456:n=bR;break;default:n=dm}return r=ID.bind(null,t),n=f1(n,r),t.callbackPriority=e,t.callbackNode=n,e}return r!==null&&r!==null&&Tb(r),t.callbackPriority=2,t.callbackNode=null,2}function ID(t,e){if(it!==0&&it!==5)return t.callbackNode=null,t.callbackPriority=0,null;var n=t.callbackNode;if(eg()&&t.callbackNode!==n)return null;var r=pe;return r=Um(t,t===Pe?r:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),r===0?null:(CD(t,r,e),_D(t,wr()),t.callbackNode!=null&&t.callbackNode===n?ID.bind(null,t):null)}function IM(t,e){if(eg())return null;CD(t,e,!0)}function fV(){CV(function(){(ke&6)!==0?f1(yR,dV):ND()})}function Z1(){if(bs===0){var t=ql;t===0&&(t=Cp,Cp<<=1,(Cp&261888)===0&&(Cp=256)),bs=t}return bs}function LM(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:$p(t)}function hV(t,e,n,r,o){if(e==="submit"&&n&&n.stateNode===o){var i=LM((o[Qn]||null).action),s=r.submitter;s&&(e=(e=s[Qn]||null)?LM(e.formAction):s.getAttribute("formAction"),e!==null&&(i=e,s=null));var l=new Bm("action","action",null,r,o);t.push({event:l,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(bs!==0){var a=new FormData(o,s);Mw(n,{pending:!0,data:a,method:o.method,action:i},null,a)}}else typeof i=="function"&&(l.preventDefault(),a=new FormData(o,s),Mw(n,{pending:!0,data:a,method:o.method,action:i},i,a))},currentTarget:o}]})}}for(Pp=0;Pp<yw.length;Pp++)Bp=yw[Pp],zM=Bp.toLowerCase(),UM=Bp[0].toUpperCase()+Bp.slice(1),po(zM,"on"+UM);var Bp,zM,UM,Pp;po(qR,"onAnimationEnd");po(KR,"onAnimationIteration");po(GR,"onAnimationStart");po("dblclick","onDoubleClick");po("focusin","onFocus");po("focusout","onBlur");po(Ej,"onTransitionRun");po(Tj,"onTransitionStart");po(kj,"onTransitionCancel");po(XR,"onTransitionEnd");Dc("onMouseEnter",["mouseout","mouseover"]);Dc("onMouseLeave",["mouseout","mouseover"]);Dc("onPointerEnter",["pointerout","pointerover"]);Dc("onPointerLeave",["pointerout","pointerover"]);Ql("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ql("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ql("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ql("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ql("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ql("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var uf="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(" "),pV=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(uf));function LD(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],o=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var s=r.length-1;0<=s;s--){var l=r[s],a=l.instance,c=l.currentTarget;if(l=l.listener,a!==i&&o.isPropagationStopped())break e;i=l,o.currentTarget=c;try{i(o)}catch(u){hm(u)}o.currentTarget=null,i=a}else for(s=0;s<r.length;s++){if(l=r[s],a=l.instance,c=l.currentTarget,l=l.listener,a!==i&&o.isPropagationStopped())break e;i=l,o.currentTarget=c;try{i(o)}catch(u){hm(u)}o.currentTarget=null,i=a}}}}function fe(t,e){var n=e[DA];n===void 0&&(n=e[DA]=new Set);var r=t+"__bubble";n.has(r)||(zD(e,t,2,!1),n.add(r))}function Gb(t,e,n){var r=0;e&&(r|=4),zD(n,t,r,e)}var Hp="_reactListening"+Math.random().toString(36).slice(2);function eS(t){if(!t[Hp]){t[Hp]=!0,AR.forEach(function(n){n!=="selectionchange"&&(pV.has(n)||Gb(n,!1,t),Gb(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Hp]||(e[Hp]=!0,Gb("selectionchange",!1,e))}}function zD(t,e,n,r){switch(sN(e)){case 2:var o=s6;break;case 8:o=l6;break;default:o=lS}n=o.bind(null,e,n,t),o=void 0,!hw||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(o=!0),r?o!==void 0?t.addEventListener(e,n,{capture:!0,passive:o}):t.addEventListener(e,n,!0):o!==void 0?t.addEventListener(e,n,{passive:o}):t.addEventListener(e,n,!1)}function Xb(t,e,n,r,o){var i=r;if((e&1)===0&&(e&2)===0&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var l=r.stateNode.containerInfo;if(l===o)break;if(s===4)for(s=r.return;s!==null;){var a=s.tag;if((a===3||a===4)&&s.stateNode.containerInfo===o)return;s=s.return}for(;l!==null;){if(s=zl(l),s===null)return;if(a=s.tag,a===5||a===6||a===26||a===27){r=i=s;continue e}l=l.parentNode}}r=r.return}LR(function(){var c=i,u=g1(n),d=[];e:{var f=WR.get(t);if(f!==void 0){var h=Bm,p=t;switch(t){case"keypress":if(qp(n)===0)break e;case"keydown":case"keyup":h=ej;break;case"focusin":p="focus",h=Db;break;case"focusout":p="blur",h=Db;break;case"beforeblur":case"afterblur":h=Db;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=BA;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=VH;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=ij;break;case qR:case KR:case GR:h=YH;break;case XR:h=lj;break;case"scroll":case"scrollend":h=HH;break;case"wheel":h=cj;break;case"copy":case"cut":case"paste":h=KH;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=jA;break;case"submit":h=rj;break;case"toggle":case"beforetoggle":h=dj}var m=(e&4)!==0,y=!m&&(t==="scroll"||t==="scrollend"),g=m?f!==null?f+"Capture":null:f;m=[];for(var v=c,b;v!==null;){var w=v;if(b=w.stateNode,w=w.tag,w!==5&&w!==26&&w!==27||b===null||g===null||(w=tf(v,g),w!=null&&m.push(df(v,w,b))),y)break;v=v.return}0<m.length&&(f=new h(f,p,null,n,u),d.push({event:f,listeners:m}))}}if((e&7)===0){e:{if(h=t==="mouseover"||t==="pointerover",f=t==="mouseout"||t==="pointerout",h&&n!==fw&&(p=n.relatedTarget||n.fromElement)&&(zl(p)||p[Fc]))break e;(f||h)&&(p=u.window===u?u:(h=u.ownerDocument)?h.defaultView||h.parentWindow:window,f?(h=n.relatedTarget||n.toElement,f=c,h=h?zl(h):null,h!==null&&(y=yf(h),m=h.tag,h!==y||m!==5&&m!==27&&m!==6)&&(h=null)):(f=null,h=c),f!==h&&(m=BA,w="onMouseLeave",g="onMouseEnter",v="mouse",(t==="pointerout"||t==="pointerover")&&(m=jA,w="onPointerLeave",g="onPointerEnter",v="pointer"),y=f==null?p:Pd(f),b=h==null?p:Pd(h),p=new m(w,v+"leave",f,n,u),p.target=y,p.relatedTarget=b,w=null,zl(u)===c&&(m=new m(g,v+"enter",h,n,u),m.target=b,m.relatedTarget=y,w=m),y=w,m=f&&h?ew(f,h,mV):null,f!==null&&PM(d,p,f,m,!1),h!==null&&y!==null&&PM(d,y,h,m,!0)))}e:{if(f=c?Pd(c):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var S=YA;else if($A(f))if(jR)S=Sj;else{S=bj;var C=vj}else h=f.nodeName,!h||h.toLowerCase()!=="input"||f.type!=="checkbox"&&f.type!=="radio"?c&&m1(c.elementType)&&(S=YA):S=wj;if(S&&(S=S(t,c))){HR(d,S,n,u);break e}C&&C(t,f,c)}switch(C=c?Pd(c):window,t){case"focusin":($A(C)||C.contentEditable==="true")&&(hc=C,mw=c,Fd=null);break;case"focusout":Fd=mw=hc=null;break;case"mousedown":gw=!0;break;case"contextmenu":case"mouseup":case"dragend":gw=!1,XA(d,n,u);break;case"selectionchange":if(Cj)break;case"keydown":case"keyup":XA(d,n,u)}var x;if(b1)e:{switch(t){case"compositionstart":var E="onCompositionStart";break e;case"compositionend":E="onCompositionEnd";break e;case"compositionupdate":E="onCompositionUpdate";break e}E=void 0}else fc?PR(t,n)&&(E="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(E="onCompositionStart");E&&(UR&&n.locale!=="ko"&&(fc||E!=="onCompositionStart"?E==="onCompositionEnd"&&fc&&(x=zR()):(ms=u,y1="value"in ms?ms.value:ms.textContent,fc=!0)),C=Im(c,E),0<C.length&&(E=new HA(E,t,null,n,u),d.push({event:E,listeners:C}),x?E.data=x:(x=BR(n),x!==null&&(E.data=x)))),(x=hj?pj(t,n):mj(t,n))&&(E=Im(c,"onBeforeInput"),0<E.length&&(C=new HA("onBeforeInput","beforeinput",null,n,u),d.push({event:C,listeners:E}),C.data=x)),hV(d,t,c,n,u)}LD(d,e)})}function df(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Im(t,e){for(var n=e+"Capture",r=[];t!==null;){var o=t,i=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||i===null||(o=tf(t,n),o!=null&&r.unshift(df(t,o,i)),o=tf(t,e),o!=null&&r.push(df(t,o,i))),t.tag===3)return r;t=t.return}return[]}function mV(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function PM(t,e,n,r,o){for(var i=e._reactName,s=[];n!==null&&n!==r;){var l=n,a=l.alternate,c=l.stateNode;if(l=l.tag,a!==null&&a===r)break;l!==5&&l!==26&&l!==27||c===null||(a=c,o?(c=tf(n,i),c!=null&&s.unshift(df(n,c,a))):o||(c=tf(n,i),c!=null&&s.push(df(n,c,a)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}var gV=/\r\n?/g,yV=/\u0000|\uFFFD/g;function BM(t){return(typeof t=="string"?t:""+t).replace(gV,`
|
|
9
|
+
`).replace(yV,"")}function UD(t,e){return e=BM(e),BM(t)===e}function Oe(t,e,n,r,o,i){switch(n){case"children":if(typeof r=="string")e==="body"||e==="textarea"&&r===""||Nc(t,r);else if(typeof r=="number"||typeof r=="bigint")e!=="body"&&Nc(t,""+r);else return;break;case"className":kp(t,"class",r);break;case"tabIndex":kp(t,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":kp(t,n,r);break;case"style":IR(t,r,i);return;case"data":if(e!=="object"){kp(t,"data",r);break}case"src":case"href":if(r===""&&(e!=="a"||n!=="href")){t.removeAttribute(n);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){t.removeAttribute(n);break}r=$p(r),t.setAttribute(n,r);break;case"action":case"formAction":if(typeof r=="function"){t.setAttribute(n,"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 i=="function"&&(n==="formAction"?(e!=="input"&&Oe(t,e,"name",o.name,o,null),Oe(t,e,"formEncType",o.formEncType,o,null),Oe(t,e,"formMethod",o.formMethod,o,null),Oe(t,e,"formTarget",o.formTarget,o,null)):(Oe(t,e,"encType",o.encType,o,null),Oe(t,e,"method",o.method,o,null),Oe(t,e,"target",o.target,o,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){t.removeAttribute(n);break}r=$p(r),t.setAttribute(n,r);break;case"onClick":r!=null&&(t.onclick=Io);return;case"onScroll":r!=null&&fe("scroll",t);return;case"onScrollEnd":r!=null&&fe("scrollend",t);return;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(A(61));if(n=r.__html,n!=null){if(o.children!=null)throw Error(A(60));i?.__html!==n&&(t.innerHTML=n)}}break;case"multiple":t.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":t.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){t.removeAttribute("xlink:href");break}n=$p(r),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?t.setAttribute(n,r):t.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":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":r&&typeof r!="function"&&typeof r!="symbol"?t.setAttribute(n,""):t.removeAttribute(n);break;case"capture":case"download":r===!0?t.setAttribute(n,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?t.setAttribute(n,r):t.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?t.setAttribute(n,r):t.removeAttribute(n);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?t.removeAttribute(n):t.setAttribute(n,r);break;case"popover":fe("beforetoggle",t),fe("toggle",t),Fp(t,"popover",r);break;case"xlinkActuate":ci(t,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":ci(t,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":ci(t,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":ci(t,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":ci(t,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":ci(t,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":ci(t,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":ci(t,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":ci(t,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Fp(t,"is",r);break;case"innerText":case"textContent":return;default:if(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")n=PH.get(n)||n,Fp(t,n,r);else return}we=!0}function Zw(t,e,n,r,o,i){switch(n){case"style":IR(t,r,i);return;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(A(61));if(n=r.__html,n!=null){if(o.children!=null)throw Error(A(60));i?.__html!==n&&(t.innerHTML=n)}}break;case"children":if(typeof r=="string")Nc(t,r);else if(typeof r=="number"||typeof r=="bigint")Nc(t,""+r);else return;break;case"onScroll":r!=null&&fe("scroll",t);return;case"onScrollEnd":r!=null&&fe("scrollend",t);return;case"onClick":r!=null&&(t.onclick=Io);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!MR.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(o=n.endsWith("Capture"),i=n.slice(2,o?n.length-7:void 0),e=t[Qn]||null,e=e!=null?e[n]:null,typeof e=="function"&&t.removeEventListener(i,e,o),typeof r=="function")){typeof e!="function"&&e!==null&&(n in t?t[n]=null:t.hasAttribute(n)&&t.removeAttribute(n)),t.addEventListener(i,r,o);break e}we=!0,n in t?t[n]=r:r===!0?t.setAttribute(n,""):Fp(t,n,r)}return}we=!0}function un(t,e,n){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":fe("error",t),fe("load",t);var r=!1,o=!1,i;for(i in n)if(n.hasOwnProperty(i)){var s=n[i];if(s!=null)switch(i){case"src":r=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(A(137,e));default:Oe(t,e,i,s,n,null)}}o&&Oe(t,e,"srcSet",n.srcSet,n,null),r&&Oe(t,e,"src",n.src,n,null);return;case"input":fe("invalid",t);var l=i=s=o=null,a=null,c=null;for(r in n)if(n.hasOwnProperty(r)){var u=n[r];if(u!=null)switch(r){case"name":o=u;break;case"type":s=u;break;case"checked":a=u;break;case"defaultChecked":c=u;break;case"value":i=u;break;case"defaultValue":l=u;break;case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(A(137,e));break;default:Oe(t,e,r,u,n,null)}}DR(t,i,l,a,c,s,o,!1);return;case"select":fe("invalid",t),r=s=i=null;for(o in n)if(n.hasOwnProperty(o)&&(l=n[o],l!=null))switch(o){case"value":i=l;break;case"defaultValue":s=l;break;case"multiple":r=l;default:Oe(t,e,o,l,n,null)}e=i,n=s,t.multiple=!!r,e!=null?Sc(t,!!r,e,!1):n!=null&&Sc(t,!!r,n,!0);return;case"textarea":fe("invalid",t),i=o=r=null;for(s in n)if(n.hasOwnProperty(s)&&(l=n[s],l!=null))switch(s){case"value":r=l;break;case"defaultValue":o=l;break;case"children":i=l;break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(A(91));break;default:Oe(t,e,s,l,n,null)}_R(t,r,o,i);return;case"option":for(a in n)n.hasOwnProperty(a)&&(r=n[a],r!=null)&&(a==="selected"?t.selected=r&&typeof r!="function"&&typeof r!="symbol":Oe(t,e,a,r,n,null));return;case"dialog":fe("beforetoggle",t),fe("toggle",t),fe("cancel",t),fe("close",t);break;case"iframe":case"object":fe("load",t);break;case"video":case"audio":for(r=0;r<uf.length;r++)fe(uf[r],t);break;case"image":fe("error",t),fe("load",t);break;case"details":fe("toggle",t);break;case"embed":case"source":case"link":fe("error",t),fe("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(c in n)if(n.hasOwnProperty(c)&&(r=n[c],r!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(A(137,e));default:Oe(t,e,c,r,n,null)}return;default:if(m1(e)){for(u in n)n.hasOwnProperty(u)&&(r=n[u],r!==void 0&&Zw(t,e,u,r,n,void 0));return}}for(l in n)n.hasOwnProperty(l)&&(r=n[l],r!=null&&Oe(t,e,l,r,n,null))}var vV={};function bV(t,e,n,r){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,i=null,s=null,l=null,a=null,c=null,u=null;for(h in n){var d=n[h];if(n.hasOwnProperty(h)&&d!=null)switch(h){case"checked":break;case"value":break;case"defaultValue":a=d;default:r.hasOwnProperty(h)||Oe(t,e,h,null,r,d)}}for(var f in r){var h=r[f];if(d=n[f],r.hasOwnProperty(f)&&(h!=null||d!=null))switch(f){case"type":h!==d&&(we=!0),i=h;break;case"name":h!==d&&(we=!0),o=h;break;case"checked":h!==d&&(we=!0),c=h;break;case"defaultChecked":h!==d&&(we=!0),u=h;break;case"value":h!==d&&(we=!0),s=h;break;case"defaultValue":h!==d&&(we=!0),l=h;break;case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(A(137,e));break;default:h!==d&&Oe(t,e,f,h,r,d)}}dw(t,s,l,a,c,u,i,o);return;case"select":h=s=l=f=null;for(i in n)if(a=n[i],n.hasOwnProperty(i)&&a!=null)switch(i){case"value":break;case"multiple":h=a;default:r.hasOwnProperty(i)||Oe(t,e,i,null,r,a)}for(o in r)if(i=r[o],a=n[o],r.hasOwnProperty(o)&&(i!=null||a!=null))switch(o){case"value":i!==a&&(we=!0),f=i;break;case"defaultValue":i!==a&&(we=!0),l=i;break;case"multiple":i!==a&&(we=!0),s=i;default:i!==a&&Oe(t,e,o,i,r,a)}e=l,n=s,r=h,f!=null?Sc(t,!!n,f,!1):!!r!=!!n&&(e!=null?Sc(t,!!n,e,!0):Sc(t,!!n,n?[]:"",!1));return;case"textarea":h=f=null;for(l in n)if(o=n[l],n.hasOwnProperty(l)&&o!=null&&!r.hasOwnProperty(l))switch(l){case"value":break;case"children":break;default:Oe(t,e,l,null,r,o)}for(s in r)if(o=r[s],i=n[s],r.hasOwnProperty(s)&&(o!=null||i!=null))switch(s){case"value":o!==i&&(we=!0),f=o;break;case"defaultValue":o!==i&&(we=!0),h=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(A(91));break;default:o!==i&&Oe(t,e,s,o,r,i)}NR(t,f,h);return;case"option":for(var p in n)f=n[p],n.hasOwnProperty(p)&&f!=null&&!r.hasOwnProperty(p)&&(p==="selected"?t.selected=!1:Oe(t,e,p,null,r,f));for(a in r)f=r[a],h=n[a],r.hasOwnProperty(a)&&f!==h&&(f!=null||h!=null)&&(a==="selected"?(f!==h&&(we=!0),t.selected=f&&typeof f!="function"&&typeof f!="symbol"):Oe(t,e,a,f,r,h));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 m in n)f=n[m],n.hasOwnProperty(m)&&f!=null&&!r.hasOwnProperty(m)&&Oe(t,e,m,null,r,f);for(c in r)if(f=r[c],h=n[c],r.hasOwnProperty(c)&&f!==h&&(f!=null||h!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(A(137,e));break;default:Oe(t,e,c,f,r,h)}return;default:if(m1(e)){for(var y in n)f=n[y],n.hasOwnProperty(y)&&f!==void 0&&!r.hasOwnProperty(y)&&Zw(t,e,y,void 0,r,f);for(u in r)f=r[u],h=n[u],!r.hasOwnProperty(u)||f===h||f===void 0&&h===void 0||Zw(t,e,u,f,r,h);return}}for(var g in n)f=n[g],n.hasOwnProperty(g)&&f!=null&&!r.hasOwnProperty(g)&&Oe(t,e,g,null,r,f);for(d in r)f=r[d],h=n[d],!r.hasOwnProperty(d)||f===h||f==null&&h==null||Oe(t,e,d,f,r,h)}function HM(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function wV(){if(typeof performance.getEntriesByType=="function"){for(var t=0,e=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var o=n[r],i=o.transferSize,s=o.initiatorType,l=o.duration;if(i&&l&&HM(s)){for(s=0,l=o.responseEnd,r+=1;r<n.length;r++){var a=n[r],c=a.startTime;if(c>l)break;var u=a.transferSize,d=a.initiatorType;u&&HM(d)&&(a=a.responseEnd,s+=u*(a<l?1:(l-c)/(a-c)))}if(--r,e+=8*(i+s)/(o.duration/1e3),t++,10<t)break}}if(0<t)return e/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var e1=null,t1=null;function ff(t){return t.nodeType===9?t:t.ownerDocument}function jM(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function PD(t,e){if(t===0)switch(e){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&e==="foreignObject"?0:t}function BD(t,e,n,r){return n=ff(n).createElement(t),n[sn]=r,n[Qn]=e,un(n,t,e),qt(n),n}function n1(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.children=="bigint"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Wb=null;function SV(){var t=window.event;return t&&t.type==="popstate"?t===Wb?!1:(Wb=t,!0):(Wb=null,!1)}var tS=typeof setTimeout=="function"?setTimeout:void 0,xV=typeof clearTimeout=="function"?clearTimeout:void 0,VM=typeof Promise=="function"?Promise:void 0,FM=typeof requestAnimationFrame=="function"?requestAnimationFrame:tS,CV=typeof queueMicrotask=="function"?queueMicrotask:typeof VM<"u"?function(t){return VM.resolve(null).then(t).catch(EV)}:tS;function EV(t){setTimeout(function(){throw t})}function zs(t){return t==="head"}function $M(t,e){var n=e,r=0;do{var o=n.nextSibling;if(t.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"||n==="/&"){if(r===0){t.removeChild(o),Vc(e);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")Qb(t.ownerDocument.documentElement);else if(n==="head"){n=t.ownerDocument.head,Qb(n);for(var i=n.firstChild;i;){var s=i.nextSibling,l=i.nodeName;i[Sf]||l==="SCRIPT"||l==="STYLE"||l==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=s}}else n==="body"&&Qb(t.ownerDocument.body);n=o}while(n);Vc(e)}function YM(t,e){var n=t;t=0;do{var r=n.nextSibling;if(n.nodeType===1?e?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(e?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(t===0)break;t--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||t++;n=r}while(n)}function HD(t,e,n){if(e=CSS.escape(e)!==e?"r-"+btoa(e).replace(/=/g,""):e,t.style.viewTransitionName=e,n!=null&&(t.style.viewTransitionClass=n),n=getComputedStyle(t),n.display==="inline"){if(e=t.getClientRects(),e.length===1)var r=1;else for(var o=r=0;o<e.length;o++){var i=e[o];0<i.width&&0<i.height&&r++}r===1&&(t=t.style,t.display=e.length===1?"inline-block":"block",t.marginTop="-"+n.paddingTop,t.marginBottom="-"+n.paddingBottom)}}function jD(t,e){t=t.style,e=e.style;var n=e!=null?e.hasOwnProperty("viewTransitionName")?e.viewTransitionName:e.hasOwnProperty("view-transition-name")?e["view-transition-name"]:null:null;t.viewTransitionName=n==null||typeof n=="boolean"?"":(""+n).trim(),n=e!=null?e.hasOwnProperty("viewTransitionClass")?e.viewTransitionClass:e.hasOwnProperty("view-transition-class")?e["view-transition-class"]:null:null,t.viewTransitionClass=n==null||typeof n=="boolean"?"":(""+n).trim(),t.display==="inline-block"&&(e==null?t.display=t.margin="":(n=e.display,t.display=n==null||typeof n=="boolean"?"":n,n=e.margin,n!=null?t.margin=n:(n=e.hasOwnProperty("marginTop")?e.marginTop:e["margin-top"],t.marginTop=n==null||typeof n=="boolean"?"":n,e=e.hasOwnProperty("marginBottom")?e.marginBottom:e["margin-bottom"],t.marginBottom=e==null||typeof e=="boolean"?"":e)))}function VD(t,e,n){return n=n.ownerDocument.defaultView,{rect:t,abs:e.position==="absolute"||e.position==="fixed",clip:e.clipPath!=="none"||e.overflow!=="visible"||e.filter!=="none"||e.mask!=="none"||e.mask!=="none"||e.borderRadius!=="0px",view:0<=t.bottom&&0<=t.right&&t.top<=n.innerHeight&&t.left<=n.innerWidth}}function r1(t){var e=t.getBoundingClientRect(),n=getComputedStyle(t);return VD(e,n,t)}function TV(t){var e=t.getBoundingClientRect();e=new DOMRect(e.x+2e4,e.y+2e4,e.width,e.height);var n=getComputedStyle(t);return VD(e,n,t)}function kV(t){return t.documentElement.clientHeight}function AV(t){this.addEventListener("load",t),this.addEventListener("error",t)}function MV(t,e,n,r,o,i,s,l,a){var c=e.nodeType===9?e:e.ownerDocument;try{var u=c.startViewTransition({update:function(){var f=c.defaultView,h=f.navigation&&f.navigation.transition,p=c.fonts.status;r();var m=[];if(p==="loaded"&&(kV(c),c.fonts.status==="loading"&&m.push(c.fonts.ready)),p=m.length,t!==null)for(var y=t.suspenseyImages,g=0,v=0;v<y.length;v++){var b=y[v];if(!b.complete){var w=b.getBoundingClientRect();if(0<w.bottom&&0<w.right&&w.top<f.innerHeight&&w.left<f.innerWidth){if(g+=eN(b),g>im){m.length=p;break}b=new Promise(AV.bind(b)),m.push(b)}}}if(0<m.length)return f=Promise.race([Promise.all(m),new Promise(function(S){return setTimeout(S,500)})]).then(o,o),(h?Promise.allSettled([h.finished,f]):f).then(i,i);if(o(),h)return h.finished.then(i,i);i()},types:n});c.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var f=c.documentElement.getAnimations({subtree:!0}),h=0;h<f.length;h++){var p=f[h],m=p.effect,y=m.pseudoElement;if(y!=null&&y.startsWith("::view-transition")){d.push(p),p=m.getKeyframes();for(var g=y=void 0,v=!0,b=0;b<p.length;b++){var w=p[b],S=w.width;if(y===void 0)y=S;else if(y!==S){v=!1;break}if(S=w.height,g===void 0)g=S;else if(g!==S){v=!1;break}delete w.width,delete w.height,w.transform==="none"&&delete w.transform}v&&y!==void 0&&g!==void 0&&(m.setKeyframes(p),v=getComputedStyle(m.target,m.pseudoElement),v.width!==y||v.height!==g)&&(v=p[0],v.width=y,v.height=g,v=p[p.length-1],v.width=y,v.height=g,m.setKeyframes(p))}}s()},function(f){c.__reactViewTransition===u&&(c.__reactViewTransition=null);try{typeof f=="object"&&f!==null&&f.name==="InvalidStateError"&&(f.message==="View transition was skipped because document visibility state is hidden."||f.message==="Skipping view transition because document visibility state has become hidden."||f.message==="Skipping view transition because viewport size changed."||f.message==="Transition was aborted because of invalid state")&&(f=null),f!==null&&a(f)}finally{r(),o(),s()}}),u.finished.finally(function(){for(var f=0;f<d.length;f++)d[f].cancel();c.__reactViewTransition===u&&(c.__reactViewTransition=null),l()}),u}catch{return r(),o(),s(),null}}function Ul(t,e){this._scope=document.documentElement,this._selector="::view-transition-"+t+"("+e+")"}Ul.prototype.animate=function(t,e){return e=typeof e=="number"?{duration:e}:Be({},e),e.pseudoElement=this._selector,this._scope.animate(t,e)};Ul.prototype.getAnimations=function(){for(var t=this._scope,e=this._selector,n=t.getAnimations({subtree:!0}),r=[],o=0;o<n.length;o++){var i=n[o].effect;i!==null&&i.target===t&&i.pseudoElement===e&&r.push(n[o])}return r};Ul.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function FD(t){return{name:t,group:new Ul("group",t),imagePair:new Ul("image-pair",t),old:new Ul("old",t),new:new Ul("new",t)}}function Tr(t){this._fragmentFiber=t,this._observers=this._eventListeners=null}Tr.prototype.addEventListener=function(t,e,n){var r=null,o=null;if(!(n!=null&&typeof n!="boolean"&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var i=this._eventListeners;if($D(i,t,e,n)===-1){var s=this,l=e;n!=null&&typeof n!="boolean"&&n.once===!0&&(l=function(a){s.removeEventListener(t,e,n),typeof e=="function"?e.call(this,a):e.handleEvent(a)}),r!==null&&(o=s.removeEventListener.bind(s,t,e,n),r.addEventListener("abort",o,{once:!0}),o=r.removeEventListener.bind(r,"abort",o)),r=Pc(n),i.push({type:t,listener:e,optionsOrUseCapture:n,attachedListener:l,cleanup:o}),Jn(this._fragmentFiber.child,!1,RV,t,l,r)}this._eventListeners=i}};function RV(t,e,n,r){return _t(t).addEventListener(e,n,r),!1}Tr.prototype.removeEventListener=function(t,e,n){var r=this._eventListeners;if(r!==null&&(e=$D(r,t,e,n),e!==-1)){var o=r[e];n=o.attachedListener;var i=o.cleanup;o=Pc(o.optionsOrUseCapture),Jn(this._fragmentFiber.child,!1,OV,t,n,o),r.splice(e,1),i!==null&&i()}};function OV(t,e,n,r){return _t(t).removeEventListener(e,n,r),!1}function Pc(t){return t!=null&&typeof t!="boolean"&&(t.once===!0||t.signal instanceof AbortSignal)?{capture:t.capture,passive:t.passive}:t}function qM(t){return t==null?"c=0":typeof t=="boolean"?"c="+(t?"1":"0"):"c="+(t.capture?"1":"0")}function $D(t,e,n,r){if(t.length===0)return-1;r=qM(r);for(var o=0;o<t.length;o++){var i=t[o];if(i.type===e&&i.listener===n&&qM(i.optionsOrUseCapture)===r)return o}return-1}Tr.prototype.dispatchEvent=function(t){var e=Jl(this._fragmentFiber);if(e===null)return!0;e=_t(e);var n=this._eventListeners;if(n!==null&&0<n.length||!t.bubbles){var r=e.nodeType===9?e.createComment(""):document.createTextNode("");if(n)for(var o=0;o<n.length;o++){var i=n[o];r.addEventListener(i.type,i.attachedListener,Pc(i.optionsOrUseCapture))}if(e.appendChild(r),t=r.dispatchEvent(t),n)for(o=0;o<n.length;o++)i=n[o],r.removeEventListener(i.type,i.attachedListener,Pc(i.optionsOrUseCapture));return e.removeChild(r),t}return e.dispatchEvent(t)};Tr.prototype.focus=function(t){Jn(this._fragmentFiber.child,!0,YD,t,void 0,void 0)};function YD(t,e){return t.tag===6?!1:(t=_t(t),VV(t,e))}Tr.prototype.focusLast=function(t){var e=[];Jn(this._fragmentFiber.child,!0,nS,e,void 0,void 0);for(var n=e.length-1;0<=n&&!YD(e[n],t);n--);};function nS(t,e){return e.push(t),!1}Tr.prototype.blur=function(){var t=Jl(this._fragmentFiber);t!==null&&(t=_t(t),t=ff(t).activeElement,t!==null&&Jn(this._fragmentFiber.child,!1,DV,t,void 0,void 0))};function DV(t,e){return t.tag===6?!1:(t=_t(t),t===e||t.contains(e)?(e.blur(),!0):!1)}Tr.prototype.observeUsing=function(t){this._observers===null&&(this._observers=new Set),this._observers.add(t),Jn(this._fragmentFiber.child,!1,NV,t,void 0,void 0)};function NV(t,e){return t.tag===6||(t=_t(t),e.observe(t)),!1}Tr.prototype.unobserveUsing=function(t){var e=this._observers;if(e!==null&&e.has(t)){e.delete(t),Jn(this._fragmentFiber.child,!1,_V,t,void 0,void 0);for(var n=e=0;n<fo.length;n++){var r=fo[n];r.fragmentInstance===this&&r.observer===t?t.unobserve(r.instance):fo[e++]=r}fo.length=e}};function _V(t,e){return t.tag===6||(t=_t(t),e.unobserve(t)),!1}var fo=[],Jb=!1;function IV(t,e,n){fo.push({fragmentInstance:t,observer:e,instance:n}),Jb||(Jb=!0,FV(function(){Jb=!1;var r=fo;fo=[];for(var o=0;o<r.length;o++){var i=r[o];i.observer.unobserve(i.instance)}}))}Tr.prototype.getClientRects=function(){var t=[];return Jn(this._fragmentFiber.child,!1,LV,t,void 0,void 0),t};function LV(t,e){if(t.tag===6){t=t.stateNode;var n=t.ownerDocument.createRange();n.selectNodeContents(t),e.push.apply(e,n.getClientRects())}else t=_t(t),e.push.apply(e,t.getClientRects());return!1}Tr.prototype.getRootNode=function(t){var e=Jl(this._fragmentFiber);return e===null?this:_t(e).getRootNode(t)};Tr.prototype.compareDocumentPosition=function(t){var e=Jl(this._fragmentFiber);if(e===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];Jn(this._fragmentFiber.child,!1,nS,n,void 0,void 0);var r=_t(e);if(n.length===0){if(n=r,TA(this._fragmentFiber)){e:{for(e=this._fragmentFiber.return;e!==null;){if(e.tag===4){e=e.stateNode.containerInfo;break e}if(e.tag===3||e.tag===5||e.tag===27)break;e=e.return}e=null}e!=null&&(n=e)}e=this._fragmentFiber;var o=r=n.compareDocumentPosition(t);return n===t?o=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=hR(e)[1],n===null?o=Node.DOCUMENT_POSITION_PRECEDING:(t=_t(n).compareDocumentPosition(t),o=t===0||t&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),o|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}e=_t(n[0]),o=_t(n[n.length-1]);var i=TA(this._fragmentFiber)?e.parentElement:r;if(i==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=i.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY,i=i.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_CONTAINED_BY;var s=e.compareDocumentPosition(t),l=o.compareDocumentPosition(t),a=s&Node.DOCUMENT_POSITION_CONTAINED_BY||l&Node.DOCUMENT_POSITION_CONTAINED_BY;return l=r&&i&&s&Node.DOCUMENT_POSITION_FOLLOWING&&l&Node.DOCUMENT_POSITION_PRECEDING,e=r&&e===t||i&&o===t||a||l?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&e===t||!i&&o===t?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:s,e&Node.DOCUMENT_POSITION_DISCONNECTED||e&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||zV(e,this._fragmentFiber,n[0],n[n.length-1],t)?e:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function zV(t,e,n,r,o){var i=zl(o);if(t&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!i)e:{for(;i!==null;){if(i.tag===7&&(i===e||i.alternate===e)){n=!0;break e}i=i.return}n=!1}return n}if(t&Node.DOCUMENT_POSITION_CONTAINS){if(i===null)return i=o.ownerDocument,o===i||o===i.documentElement||o===i.body;e:{for(i=e,e=Jl(e);i!==null;){if(!(i.tag!==5&&i.tag!==3&&i.tag!==27||i!==e&&i.alternate!==e)){i=!0;break e}i=i.return}i=!1}return i}return t&Node.DOCUMENT_POSITION_PRECEDING?((e=!!i)&&!(e=i===n)&&(e=ew(n,i,kA),e===null?e=!1:(Jn(e,!0,fH,i,n),i=ac,ac=null,e=i!==null)),e):t&Node.DOCUMENT_POSITION_FOLLOWING?((e=!!i)&&!(e=i===r)&&(e=ew(r,i,kA),e===null?e=!1:(Jn(e,!0,hH,i,r),i=ac,Zb=ac=null,e=i!==null)),e):!1}function KM(t,e){var n=t.ownerDocument.createRange();n.selectNodeContents(t),t=n.getBoundingClientRect(),window.scrollTo(window.scrollX+t.left,e?window.scrollY+t.top:window.scrollY+t.bottom-window.innerHeight)}Tr.prototype.scrollIntoView=function(t){if(typeof t=="object")throw Error(A(566));var e=[];Jn(this._fragmentFiber.child,!1,nS,e,void 0,void 0);var n=t!==!1;if(e.length===0){var r=hR(this._fragmentFiber);if(r=n?r[1]||r[0]||Jl(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){t=_t(r),KM(t,n);return}if(r=_t(r),r.nodeType!==9){if(r.nodeType===11){n="host"in r?r.host:null,n!==null&&n.scrollIntoView(t);return}r.scrollIntoView(t)}}for(r=n?e.length-1:0;r!==(n?-1:e.length);){var o=e[r];o.tag===6?(o=_t(o),KM(o,n)):_t(o).scrollIntoView(t),r+=n?-1:1}};function UV(t,e){return t=_t(t),qD(t,e),!1}function qD(t,e){t.reactFragments==null&&(t.reactFragments=new Set),t.reactFragments.add(e)}function KD(t,e){var n=e._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];t.addEventListener(o.type,o.attachedListener,Pc(o.optionsOrUseCapture))}t.nodeType!==3&&(n=e._observers,n!==null&&n.forEach(function(i){for(var s=0,l=0;l<fo.length;l++){var a=fo[l];(a.fragmentInstance!==e||a.observer!==i||a.instance!==t)&&(fo[s++]=a)}fo.length=s,i.observe(t)}),qD(t,e))}function PV(t,e){var n=e._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];t.removeEventListener(o.type,o.attachedListener,Pc(o.optionsOrUseCapture))}t.nodeType!==3&&(n=e._observers,n!==null&&n.forEach(function(i){typeof i.rootMargin=="string"?IV(e,i,t):i.unobserve(t)}),t.reactFragments!=null&&t.reactFragments.delete(e))}function o1(t){var e=t.firstChild;for(e&&e.nodeType===10&&(e=e.nextSibling);e;){var n=e;switch(e=e.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":o1(n),Pm(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}t.removeChild(n)}}function BV(t,e,n,r){for(;t.nodeType===1;){var o=n;if(t.nodeName.toLowerCase()!==e.toLowerCase()){if(!r&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(r){if(!t[Sf])switch(e){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(i=t.getAttribute("rel"),i==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(i!==o.rel||t.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||t.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||t.getAttribute("title")!==(o.title==null?null:o.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(i=t.getAttribute("src"),(i!==(o.src==null?null:o.src)||t.getAttribute("type")!==(o.type==null?null:o.type)||t.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&i&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(e==="input"&&t.type==="hidden"){var i=o.name==null?null:""+o.name;if(o.type==="hidden"&&t.getAttribute("name")===i)return t}else return t;if(t=Gr(t.nextSibling),t===null)break}return null}function HV(t,e,n){if(e==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Gr(t.nextSibling),t===null))return null;return t}function GD(t,e){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!e||(t=Gr(t.nextSibling),t===null))return null;return t}function i1(t){return t.data==="$?"||t.data==="$~"}function rS(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function jV(t,e){var n=t.ownerDocument;if(t.data==="$~")t._reactRetry=e;else if(t.data!=="$?"||n.readyState!=="loading")e();else{var r=function(){e(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),t._reactRetry=r}}function Gr(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?"||e==="$~"||e==="&"||e==="F!"||e==="F")break;if(e==="/$"||e==="/&")return null}}return t}var s1=null;function GM(t){t=t.nextSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"||n==="/&"){if(e===0)return Gr(t.nextSibling);e--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||e++}t=t.nextSibling}return null}function XM(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(e===0)return t;e--}else n!=="/$"&&n!=="/&"||e++}t=t.previousSibling}return null}function VV(t,e){function n(){r=!0}if(t.ownerDocument.activeElement===t)return!0;var r=!1;try{t.ownerDocument.addEventListener("focus",n,!0),(t.focus||HTMLElement.prototype.focus).call(t,e)}finally{t.ownerDocument.removeEventListener("focus",n,!0)}return r}function FV(t){FM(function(){FM(function(e){return t(e)})})}function XD(t,e,n){switch(e=ff(n),t){case"html":if(t=e.documentElement,!t)throw Error(A(452));return t;case"head":if(t=e.head,!t)throw Error(A(453));return t;case"body":if(t=e.body,!t)throw Error(A(454));return t;default:throw Error(A(451))}}function WD(t,e,n){for(var r in n){var o=n[r];n.hasOwnProperty(r)&&o!=null&&Oe(t,e,r,null,vV,o)}n.dangerouslySetInnerHTML!=null&&(t.textContent=""),t.onclick===Io&&(t.onclick=null),Pm(t)}function Qb(t){for(var e=t.attributes;e.length;)t.removeAttributeNode(e[0]);Pm(t)}var Xr=new Map,WM=new Set;function hf(t){if(typeof t.getRootNode=="function"){var e=t.getRootNode();if(e.nodeType===9||e.nodeType===11)return e}return t.nodeType===9?t:t.ownerDocument}var Ci=Ae.d;Ae.d={f:$V,r:YV,D:qV,C:KV,L:GV,m:XV,X:JV,S:WV,M:QV};function $V(){var t=Ci.f(),e=Qm();return t||e}function YV(t){var e=$c(t);e!==null&&e.tag===5&&e.type==="form"?IO(e):Ci.r(t)}var Gc=typeof document>"u"?null:document;function JD(t,e,n){var r=Gc;if(r&&typeof e=="string"&&e){var o=Yr(e);o='link[rel="'+t+'"][href="'+o+'"]',typeof n=="string"&&(o+='[crossorigin="'+n+'"]'),WM.has(o)||(WM.add(o),t={rel:t,crossOrigin:n,href:e},r.querySelector(o)===null&&(e=r.createElement("link"),un(e,"link",t),qt(e),r.head.appendChild(e)))}}function qV(t){Ci.D(t),JD("dns-prefetch",t,null)}function KV(t,e){Ci.C(t,e),JD("preconnect",t,e)}function GV(t,e,n){Ci.L(t,e,n);var r=Gc;if(r&&t&&e){var o='link[rel="preload"][as="'+Yr(e)+'"]';e==="image"&&n&&n.imageSrcSet?(o+='[imagesrcset="'+Yr(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(o+='[imagesizes="'+Yr(n.imageSizes)+'"]')):o+='[href="'+Yr(t)+'"]';var i=o;switch(e){case"style":i=Bc(t);break;case"script":i=Xc(t)}if(!(Xr.has(i)||(t=Be({rel:"preload",href:e==="image"&&n&&n.imageSrcSet?void 0:t,as:e},n),Xr.set(i,t),r.querySelector(o)!==null||e==="style"&&r.querySelector(Af(i))||e==="script"&&r.querySelector(Mf(i))))){var s=r.createElement("link");un(s,"link",t),e==="style"&&(s[fm]=!0,s.onload=s.onerror=function(){kR(s)}),qt(s),r.head.appendChild(s)}}}function XV(t,e){Ci.m(t,e);var n=Gc;if(n&&t){var r=e&&typeof e.as=="string"?e.as:"script",o='link[rel="modulepreload"][as="'+Yr(r)+'"][href="'+Yr(t)+'"]',i=o;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=Xc(t)}if(!Xr.has(i)&&(t=Be({rel:"modulepreload",href:t},e),Xr.set(i,t),n.querySelector(o)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Mf(i)))return}r=n.createElement("link"),un(r,"link",t),qt(r),n.head.appendChild(r)}}}function WV(t,e,n){Ci.S(t,e,n);var r=Gc;if(r&&t){var o=wc(r).hoistableStyles,i=Bc(t);e=e||"default";var s=o.get(i);if(!s){var l={loading:0,preload:null};if(s=r.querySelector(Af(i)))l.loading=5;else{t=Be({rel:"stylesheet",href:t,"data-precedence":e},n),(n=Xr.get(i))&&oS(t,n);var a=s=r.createElement("link");qt(a),un(a,"link",t),a._p=new Promise(function(c,u){a.onload=c,a.onerror=u}),a.addEventListener("load",function(){l.loading|=1}),a.addEventListener("error",function(){l.loading|=2}),l.loading|=4,rm(s,e,r)}s={type:"stylesheet",instance:s,count:1,state:l},o.set(i,s)}}}function JV(t,e){Ci.X(t,e);var n=Gc;if(n&&t){var r=wc(n).hoistableScripts,o=Xc(t),i=r.get(o);i||(i=n.querySelector(Mf(o)),i||(t=Be({src:t,async:!0},e),(e=Xr.get(o))&&iS(t,e),i=n.createElement("script"),qt(i),un(i,"link",t),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(o,i))}}function QV(t,e){Ci.M(t,e);var n=Gc;if(n&&t){var r=wc(n).hoistableScripts,o=Xc(t),i=r.get(o);i||(i=n.querySelector(Mf(o)),i||(t=Be({src:t,async:!0,type:"module"},e),(e=Xr.get(o))&&iS(t,e),i=n.createElement("script"),qt(i),un(i,"link",t),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(o,i))}}function JM(t,e,n,r){var o=(o=ws.current)?hf(o):null;if(!o)throw Error(A(446));switch(t){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(n=Bc(n.href),e=wc(o).hoistableStyles,r=e.get(n),r||(r={type:"style",instance:null,count:0,state:null},e.set(n,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){t=Bc(n.href);var i=wc(o).hoistableStyles,s=i.get(t);if(s||(o=o.ownerDocument||o,s={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(t,s),(i=o.querySelector(Af(t)))?i._p||(s.instance=i,s.state.loading=5):(i=Xr.get(t),i||(i={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Xr.set(t,i)),ZV(o,t,i,s.state))),e&&r===null)throw Error(A(528,""));return s}if(e&&r!==null)throw Error(A(529,""));return null;case"script":return e=n.async,n=n.src,typeof n=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(n=Xc(n),e=wc(o).hoistableScripts,r=e.get(n),r||(r={type:"script",instance:null,count:0,state:null},e.set(n,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(A(444,t))}}function Bc(t){return'href="'+Yr(t)+'"'}function Af(t){return'link[rel="stylesheet"]['+t+"]"}function QD(t){return Be({},t,{"data-precedence":t.precedence,precedence:null})}function ZV(t,e,n,r){if(e=t.querySelector('link[rel="preload"][as="style"]['+e+"]")){if(e[fm]!==!0){r.loading=1;return}}else e=t.createElement("link"),e[fm]=!0,e.onload=e.onerror=kR.bind(null,e),un(e,"link",n),qt(e),t.head.appendChild(e);r.preload=e,e.addEventListener("load",function(){return r.loading|=1}),e.addEventListener("error",function(){return r.loading|=2})}function Xc(t){return'[src="'+Yr(t)+'"]'}function Mf(t){return"script[async]"+t}function QM(t,e,n){if(e.count++,e.instance===null)switch(e.type){case"style":var r=t.querySelector('style[data-href~="'+Yr(n.href)+'"]');if(r)return e.instance=r,qt(r),r;var o=Be({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(t.ownerDocument||t).createElement("style"),qt(r),un(r,"style",o),rm(r,n.precedence,t),e.instance=r;case"stylesheet":o=Bc(n.href);var i=t.querySelector(Af(o));if(i)return e.state.loading|=4,e.instance=i,qt(i),i;r=QD(n),(o=Xr.get(o))&&oS(r,o),i=(t.ownerDocument||t).createElement("link"),qt(i);var s=i;return s._p=new Promise(function(l,a){s.onload=l,s.onerror=a}),un(i,"link",r),e.state.loading|=4,rm(i,n.precedence,t),e.instance=i;case"script":return i=Xc(n.src),(o=t.querySelector(Mf(i)))?(e.instance=o,qt(o),o):(r=n,(o=Xr.get(i))&&(r=Be({},n),iS(r,o)),t=t.ownerDocument||t,o=t.createElement("script"),qt(o),un(o,"link",r),t.head.appendChild(o),e.instance=o);case"void":return null;default:throw Error(A(443,e.type))}else e.type==="stylesheet"&&(e.state.loading&4)===0&&(r=e.instance,e.state.loading|=4,rm(r,n.precedence,t));return e.instance}function rm(t,e,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=r.length?r[r.length-1]:null,i=o,s=0;s<r.length;s++){var l=r[s];if(l.dataset.precedence===e)i=l;else if(i!==o)break}i?i.parentNode.insertBefore(t,i.nextSibling):(e=n.nodeType===9?n.head:n,e.insertBefore(t,e.firstChild))}function oS(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.title==null&&(t.title=e.title)}function iS(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.integrity==null&&(t.integrity=e.integrity)}var om=null;function ZM(t,e,n){if(om===null){var r=new Map,o=om=new Map;o.set(n,r)}else o=om,r=o.get(n),r||(r=new Map,o.set(n,r));if(r.has(t))return r;for(r.set(t,null),n=n.getElementsByTagName(t),o=0;o<n.length;o++){var i=n[o];if(!(i[Sf]||i[sn]||t==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var s=i.getAttribute(e)||"";s=t+s;var l=r.get(s);l?l.push(i):r.set(s,[i])}}return r}function l1(t,e,n){t=t.ownerDocument||t,t.head.insertBefore(n,e==="title"?t.querySelector("head > title"):null)}function e6(t,e,n){if(n===1||e.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;return e.rel==="stylesheet"?(t=e.disabled,typeof e.precedence=="string"&&t==null):!0;case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function eR(t,e){return t==="img"&&e.src!=null&&e.src!==""&&e.onLoad==null&&e.loading!=="lazy"}function ZD(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function eN(t){return(t.width||100)*(t.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function tR(t,e){typeof e.decode=="function"&&(t.imgCount++,e.complete||(t.imgBytes+=eN(e),t.suspenseyImages.push(e)),t=r6.bind(t),e.decode().then(t,t))}function t6(t,e,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var o=Bc(r.href),i=e.querySelector(Af(o));if(i){e=i._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=pf.bind(t),e.then(t,t)),n.state.loading|=4,n.instance=i,qt(i);return}i=e.ownerDocument||e,r=QD(r),(o=Xr.get(o))&&oS(r,o),i=i.createElement("link"),qt(i);var s=i;s._p=new Promise(function(l,a){s.onload=l,s.onerror=a}),un(i,"link",r),n.instance=i}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(n,e),(e=n.state.preload)&&(n.state.loading&3)===0&&(t.count++,n=pf.bind(t),e.addEventListener("load",n),e.addEventListener("error",n))}}var im=0;function n6(t,e){return t.stylesheets&&t.count===0&&sm(t,t.stylesheets),0<t.count||0<t.imgCount?function(n){var r=setTimeout(function(){if(t.stylesheets&&sm(t,t.stylesheets),t.unsuspend){var i=t.unsuspend;t.unsuspend=null,i()}},6e4+e);0<t.imgBytes&&im===0&&(im=62500*wV());var o=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&sm(t,t.stylesheets),t.unsuspend)){var i=t.unsuspend;t.unsuspend=null,i()}},(t.imgBytes>im?50:800)+e);return t.unsuspend=n,function(){t.unsuspend=null,clearTimeout(r),clearTimeout(o)}}:null}function tN(t){if(t.count===0&&(t.imgCount===0||!t.waitingForImages)){if(t.stylesheets)sm(t,t.stylesheets);else if(t.unsuspend){var e=t.unsuspend;t.unsuspend=null,e()}}}function pf(){this.count--,tN(this)}function r6(){this.imgCount--,tN(this)}var Lm=null;function sm(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Lm=new Map,e.forEach(o6,t),Lm=null,pf.call(t))}function o6(t,e){if(!(e.state.loading&4)){var n=Lm.get(t);if(n)var r=n.get(null);else{n=new Map,Lm.set(t,n);for(var o=t.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<o.length;i++){var s=o[i];(s.nodeName==="LINK"||s.getAttribute("media")!=="not all")&&(n.set(s.dataset.precedence,s),r=s)}r&&n.set(null,r)}o=e.instance,s=o.getAttribute("data-precedence"),i=n.get(s)||r,i===r&&n.set(null,o),n.set(s,o),this.count++,r=pf.bind(this),o.addEventListener("load",r),o.addEventListener("error",r),i?i.parentNode.insertBefore(o,i.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(o,t.firstChild)),e.state.loading|=4}}var Hc={$$typeof:_o,Provider:null,Consumer:null,_currentValue:Pl,_currentValue2:Pl,_threadCount:0};function i6(t,e,n,r,o,i,s,l,a){this.tag=1,this.containerInfo=t,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=kb(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=kb(0),this.hiddenUpdates=kb(null),this.identifierPrefix=r,this.onUncaughtError=o,this.onCaughtError=i,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=a,this.transitionTypes=null,this.incompleteTransitions=new Map}function nN(t,e,n,r,o,i,s,l,a,c,u,d){return t=new i6(t,e,n,s,a,c,u,d,l),e=1,i===!0&&(e|=24),i=Xn(3,null,null,e),t.current=i,i.stateNode=t,e=T1(),e.refCount++,t.pooledCache=e,e.refCount++,i.memoizedState={element:r,isDehydrated:n,cache:e},M1(i),t}function rN(t){return t?(t=gc,t):gc}function oN(t,e,n,r,o,i){o=rN(o),r.context===null?r.context=o:r.pendingContext=o,r=xs(e),r.payload={element:n},i=i===void 0?null:i,i!==null&&(r.callback=i),n=Cs(t,r,e),n!==null&&(Wn(n,t,e),Yd(n,t,e))}function nR(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function sS(t,e){nR(t,e),(t=t.alternate)&&nR(t,e)}function iN(t){if(t.tag===13||t.tag===31){var e=ea(t,67108864);e!==null&&Wn(e,t,67108864),sS(t,67108864)}}function rR(t){if(t.tag===13||t.tag===31){var e=Cr();e=h1(e);var n=ea(t,e);n!==null&&Wn(n,t,e),sS(t,e)}}var jc=!0;function s6(t,e,n,r){var o=Q.T;Q.T=null;var i=Ae.p;try{Ae.p=2,lS(t,e,n,r)}finally{Ae.p=i,Q.T=o}}function l6(t,e,n,r){var o=Q.T;Q.T=null;var i=Ae.p;try{Ae.p=8,lS(t,e,n,r)}finally{Ae.p=i,Q.T=o}}function lS(t,e,n,r){if(jc){var o=a1(r);if(o===null)Xb(t,e,r,zm,n),oR(t,r);else if(c6(o,t,e,n,r))r.stopPropagation();else if(oR(t,r),e&4&&-1<a6.indexOf(t)){for(;o!==null;){var i=$c(o);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var s=_l(i.pendingLanes);if(s!==0){var l=i;for(l.pendingLanes|=2,l.entangledLanes|=2;s;){var a=1<<31-xr(s);l.entanglements[1]|=a,s&=~a}jo(i),(ke&6)===0&&(Om=wr()+500,kf(0,!1))}}break;case 31:case 13:l=ea(i,2),l!==null&&Wn(l,i,2),Qm(),sS(i,2)}if(i=a1(r),i===null&&Xb(t,e,r,zm,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else Xb(t,e,r,null,n)}}function a1(t){return t=g1(t),aS(t)}var zm=null;function aS(t){if(zm=null,t=zl(t),t!==null){var e=yf(t);if(e===null)t=null;else{var n=e.tag;if(n===13){if(t=uR(e),t!==null)return t;t=null}else if(n===31){if(t=dR(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null)}}return zm=t,null}function sN(t){switch(t){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"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"fullscreenerror":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"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(xH()){case yR:return 2;case vR:return 8;case dm:case CH:return 32;case bR:return 268435456;default:return 32}default:return 32}}var c1=!1,As=null,Ms=null,Rs=null,mf=new Map,gf=new Map,hs=[],a6="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 oR(t,e){switch(t){case"focusin":case"focusout":As=null;break;case"dragenter":case"dragleave":Ms=null;break;case"mouseover":case"mouseout":Rs=null;break;case"pointerover":case"pointerout":mf.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":gf.delete(e.pointerId)}}function Id(t,e,n,r,o,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},e!==null&&(e=$c(e),e!==null&&iN(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function c6(t,e,n,r,o){switch(e){case"focusin":return As=Id(As,t,e,n,r,o),!0;case"dragenter":return Ms=Id(Ms,t,e,n,r,o),!0;case"mouseover":return Rs=Id(Rs,t,e,n,r,o),!0;case"pointerover":var i=o.pointerId;return mf.set(i,Id(mf.get(i)||null,t,e,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,gf.set(i,Id(gf.get(i)||null,t,e,n,r,o)),!0}return!1}function lN(t){var e=zl(t.target);if(e!==null){var n=yf(e);if(n!==null){if(e=n.tag,e===13){if(e=uR(n),e!==null){t.blockedOn=e,OA(t.priority,function(){rR(n)});return}}else if(e===31){if(e=dR(n),e!==null){t.blockedOn=e,OA(t.priority,function(){rR(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function lm(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=a1(t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);fw=r,n.target.dispatchEvent(r),fw=null}else return e=$c(n),e!==null&&iN(e),t.blockedOn=n,!1;e.shift()}return!0}function iR(t,e,n){lm(t)&&n.delete(e)}function u6(){c1=!1,As!==null&&lm(As)&&(As=null),Ms!==null&&lm(Ms)&&(Ms=null),Rs!==null&&lm(Rs)&&(Rs=null),mf.forEach(iR),gf.forEach(iR)}function jp(t,e){t.blockedOn===e&&(t.blockedOn=null,c1||(c1=!0,It.unstable_scheduleCallback(It.unstable_NormalPriority,u6)))}var Vp=null;function sR(t){Vp!==t&&(Vp=t,It.unstable_scheduleCallback(It.unstable_NormalPriority,function(){Vp===t&&(Vp=null);for(var e=0;e<t.length;e+=3){var n=t[e],r=t[e+1],o=t[e+2];if(typeof r!="function"){if(aS(r||n)===null)continue;break}var i=$c(n);i!==null&&(t.splice(e,3),e-=3,Mw(i,{pending:!0,data:o,method:n.method,action:r},r,o))}}))}function Vc(t){function e(a){return jp(a,t)}As!==null&&jp(As,t),Ms!==null&&jp(Ms,t),Rs!==null&&jp(Rs,t),mf.forEach(e),gf.forEach(e);for(var n=0;n<hs.length;n++){var r=hs[n];r.blockedOn===t&&(r.blockedOn=null)}for(;0<hs.length&&(n=hs[0],n.blockedOn===null);)lN(n),n.blockedOn===null&&hs.shift();if(n=(t.ownerDocument||t).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var o=n[r],i=n[r+1],s=o[Qn]||null;if(typeof i=="function")s||sR(n);else if(s){var l=null;if(i&&i.hasAttribute("formAction")){if(o=i,s=i[Qn]||null)l=s.formAction;else if(aS(o)!==null)continue}else l=s.action;typeof l=="function"?n[r+1]=l:(n.splice(r,3),r-=3),sR(n)}}}function aN(){function t(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(s){return o=s})},focusReset:"manual",scroll:"manual"})}function e(){o!==null&&(o(),o=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,o=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",e),navigation.addEventListener("navigateerror",e),setTimeout(n,100),function(){r=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",e),navigation.removeEventListener("navigateerror",e),o!==null&&(o(),o=null)}}}function cS(t){this._internalRoot=t}tg.prototype.render=cS.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(A(409));var n=e.current,r=Cr();oN(n,r,t,e,null,null)};tg.prototype.unmount=cS.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;oN(t.current,2,null,t,null,null),Qm(),e[Fc]=null}};function tg(t){this._internalRoot=t}tg.prototype.unstable_scheduleHydration=function(t){if(t){var e=TR();t={blockedOn:null,target:t,priority:e};for(var n=0;n<hs.length&&e!==0&&e<hs[n].priority;n++);hs.splice(n,0,t),n===0&&lN(t)}};var lR=aR.version;if(lR!=="19.3.1")throw Error(A(527,lR,"19.3.1"));Ae.findDOMNode=function(t){var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(A(188)):(t=Object.keys(t).join(","),Error(A(268,t)));return t=dH(e),t=t!==null?fR(t):null,t=t===null?null:t.stateNode,t};var d6={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:Q,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Ld=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Ld.isDisabled&&Ld.supportsFiber))try{vf=Ld.inject(d6),Sr=Ld}catch{}var Ld;ng.createRoot=function(t,e){if(!cR(t))throw Error(A(299));var n=!1,r="",o=VO,i=FO,s=$O;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onUncaughtError!==void 0&&(o=e.onUncaughtError),e.onCaughtError!==void 0&&(i=e.onCaughtError),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=nN(t,1,!1,null,null,n,r,null,o,i,s,aN),t[Fc]=e.current,eS(t),new cS(e)};ng.hydrateRoot=function(t,e,n){if(!cR(t))throw Error(A(299));var r=!1,o="",i=VO,s=FO,l=$O,a=null;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(i=n.onUncaughtError),n.onCaughtError!==void 0&&(s=n.onCaughtError),n.onRecoverableError!==void 0&&(l=n.onRecoverableError),n.formState!==void 0&&(a=n.formState)),e=nN(t,1,!0,e,n??null,r,o,a,i,s,l,aN),e.context=rN(null),n=e.current,r=Cr(),r=h1(r),o=xs(r),o.callback=null,Cs(n,o,r),n=r,e.current.lanes=n,wf(e,n),jo(e),t[Fc]=e.current,eS(t),new tg(e)};ng.version="19.3.1"});var uS=ko((foe,dN)=>{"use strict";function uN(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(uN)}catch(t){console.error(t)}}uN(),dN.exports=cN()});var pN=ko(rg=>{"use strict";var f6=Symbol.for("react.transitional.element"),h6=Symbol.for("react.fragment");function hN(t,e,n){var r=null;if(n!==void 0&&(r=""+n),e.key!==void 0&&(r=""+e.key),"key"in e){n={};for(var o in e)o!=="key"&&(n[o]=e[o])}else n=e;return e=n.ref,{$$typeof:f6,type:t,key:r,ref:e!==void 0?e:null,props:n}}rg.Fragment=h6;rg.jsx=hN;rg.jsxs=hN});var ee=ko((moe,mN)=>{"use strict";mN.exports=pN()});var Ln=R(P(),1),L8=R(uS(),1);var fN="agentic-design-theme";var hn=R(P(),1),e_=R(ee(),1),Eg=R(P(),1),ie=R(P(),1),a_=R(P(),1),Jr=R(P(),1),qS=R(ee(),1),Se=R(P(),1),d_=R(P(),1),f_=R(tc(),1),mn=R(P(),1),S_=R(ee(),1),x_=R(P(),1),zf=R(P(),1),GS=R(ee(),1),st=R(P(),1),JS=R(ee(),1),nx=R(P(),1),kn=R(P(),1),Tt=R(P(),1),$_=R(P(),1),Y_=R(tc(),1),K_=R(P(),1),nu=R(ee(),1),Ig=R(P(),1),r2=R(tc(),1),o2=R(ee(),1),fn=R(P(),1),i2=R(P(),1),Qr=R(P(),1),mo=R(P(),1),au=R(P(),1),p2=R(P(),1),m2=R(ee(),1),Jt=R(ee(),1),zg=R(P(),1),Ti=R(ee(),1),qs=R(ee(),1),Xs=R(P(),1),er=R(ee(),1),_e=R(ee(),1),ze=R(P(),1),N2=R(P(),1),Bg=R(P(),1),An=R(P(),1),I2=R(P(),1),Hg=R(P(),1),L2=R(P(),1),Qe=R(P(),1),uu=R(P(),1),P2=R(P(),1),vt=R(ee(),1),Ko=R(P(),1),ne=R(P(),1),go=R(P(),1),hg=R(ee(),1),Ut=R(P(),1),Us=R(ee(),1),$g=R(P(),1),Toe=R(ee(),1),Wt=R(P(),1),V$=R(P(),1),qg=R(P(),1),js=R(ee(),1),He=R(ee(),1),Oi=R(ee(),1),Cx=R(P(),1),z9=R(ee(),1),oe=R(P(),1),OI=R(tc(),1),Ne=R(ee(),1),tr=R(P(),1),me=R(ee(),1),Gt=R(P(),1),Vn=R(ee(),1),Qg=R(P(),1),VI=R(P(),1),FI=R(ee(),1),Hoe=R(P(),1),joe=R(ee(),1),ra=R(ee(),1),Lf=R(ee(),1),Xt=R(ee(),1),Tn=R(ee(),1),i3=R(P(),1),Dx=R(ee(),1),t_=(0,hn.createContext)(null),n_="(prefers-color-scheme: dark)";function p6(t){let e=window.matchMedia(n_);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}var xS=["light","dark","system"],CS=t=>xS.includes(t);function gN(t,e){try{let n=window.localStorage.getItem(t);return CS(n)?n:e}catch{return e}}function r_({children:t,defaultPreference:e="system",storageKey:n=fN}){if(!CS(e))throw new Error(`defaultPreference must be one of ${xS.join(", ")}`);let[r,o]=(0,hn.useState)(e),[i,s]=(0,hn.useState)(!1);(0,hn.useEffect)(()=>{o(gN(n,e)),s(!0)},[n,e]);let l=(0,hn.useSyncExternalStore)(p6,()=>window.matchMedia(n_).matches,()=>!1),a=r==="system"?l?"dark":"light":r;(0,hn.useEffect)(()=>{if(!i)return;let d=document.documentElement;return r==="system"?d.removeAttribute("data-theme"):d.setAttribute("data-theme",r),()=>d.removeAttribute("data-theme")},[r,i]),(0,hn.useEffect)(()=>{let d=f=>{(f.key===n||f.key===null)&&o(gN(n,e))};return window.addEventListener("storage",d),()=>window.removeEventListener("storage",d)},[n,e]);let c=(0,hn.useCallback)(d=>{if(!CS(d))throw new Error(`The theme must be one of ${xS.join(", ")}, got "${String(d)}"`);o(d);try{window.localStorage.setItem(n,d)}catch{}},[n]),u=(0,hn.useMemo)(()=>({preference:r,theme:a,setPreference:c}),[r,a,c]);return(0,e_.jsx)(t_.Provider,{value:u,children:t})}function o_(){let t=(0,hn.useContext)(t_);if(!t)throw new Error("useTheme needs a ThemeProvider above it.");return t}function qo(...t){return t.filter(Boolean).join(" ")}var m6=Object.defineProperty,iu=(t,e)=>m6(t,"name",{value:e,configurable:!0}),i_=!!(typeof window<"u"&&window.document&&window.document.createElement);function Z(t,e,{checkForDefaultPrevented:n=!0}={}){return iu(function(o){if(t?.(o),n===!1||!o||!o.defaultPrevented)return e?.(o)},"handleEvent")}iu(Z,"composeEventHandlers");function g6(t){if(!i_)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}iu(g6,"getOwnerWindow");function ES(t){if(!i_)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}iu(ES,"getOwnerDocument");function s_(t,e=!1){let{activeElement:n}=ES(t);if(!n?.nodeName)return null;if(l_(n)&&n.contentDocument)return s_(n.contentDocument.body,e);if(e){let r=n.getAttribute("aria-activedescendant");if(r){let o=ES(n).getElementById(r);if(o)return o}}return n}iu(s_,"getActiveElement");function l_(t){return t.tagName==="IFRAME"}iu(l_,"isFrame");var y6=Object.defineProperty,YS=(t,e)=>y6(t,"name",{value:e,configurable:!0});function TS(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}YS(TS,"setRef");function c_(...t){return e=>{let n=!1,r=t.map(o=>{let i=TS(o,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){let i=r[o];typeof i=="function"?i():TS(t[o],null)}}}}YS(c_,"composeRefs");function Je(...t){return a_.useCallback(c_(...t),t)}YS(Je,"useComposedRefs");var v6=Object.defineProperty,Wr=(t,e)=>v6(t,"name",{value:e,configurable:!0});function b6(t,e){let n=Jr.createContext(e);n.displayName=t+"Context";let r=Wr(i=>{let{children:s,...l}=i,a=Jr.useMemo(()=>l,Object.values(l));return(0,qS.jsx)(n.Provider,{value:a,children:s})},"Provider");r.displayName=t+"Provider";function o(i,s={}){let{optional:l=!1}=s,a=Jr.useContext(n);if(a)return a;if(e!==void 0)return e;if(!l)throw new Error(`\`${i}\` must be used within \`${t}\``)}return Wr(o,"useContext"),[r,o]}Wr(b6,"createContext");function Ar(t,e=[]){let n=[];function r(i,s){let l=Jr.createContext(s);l.displayName=i+"Context";let a=n.length;n=[...n,s];let c=Wr(d=>{let{scope:f,children:h,...p}=d,m=f?.[t]?.[a]||l,y=Jr.useMemo(()=>p,Object.values(p));return(0,qS.jsx)(m.Provider,{value:y,children:h})},"Provider");c.displayName=i+"Provider";function u(d,f,h={}){let{optional:p=!1}=h,m=f?.[t]?.[a]||l,y=Jr.useContext(m);if(y)return y;if(s!==void 0)return s;if(!p)throw new Error(`\`${d}\` must be used within \`${i}\``)}return Wr(u,"useContext"),[c,u]}Wr(r,"createContext");let o=Wr(()=>{let i=n.map(s=>Jr.createContext(s));return Wr(function(l){let a=l?.[t]||i;return Jr.useMemo(()=>({[`__scope${t}`]:{...l,[t]:a}}),[l,a])},"useScope")},"createScope");return o.scopeName=t,[r,u_(o,...e)]}Wr(Ar,"createContextScope");function u_(...t){let e=t[0];if(t.length===1)return e;let n=Wr(()=>{let r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return Wr(function(i){let s=r.reduce((l,{useScope:a,scopeName:c})=>{let d=a(i)[`__scope${c}`];return{...l,...d}},{});return Jr.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}Wr(u_,"composeContextScopes");var w6=Object.defineProperty,Mr=(t,e)=>w6(t,"name",{value:e,configurable:!0});function Fs(t){let e=mn.forwardRef((n,r)=>{let{children:o,...i}=n,s=null,l=!1,a=[];o=b_(o),mn.Children.forEach(o,f=>{if(y_(f)){l=!0;let h=f,p="child"in h.props?h.props.child:h.props.children;for(;KS(p)&&typeof vg=="function";)p=vg(p._payload);s=S6(h,p),a.push(s?.props?.children)}else a.push(f)}),s?s=mn.cloneElement(s,void 0,a):!l&&mn.Children.count(o)===1&&mn.isValidElement(o)&&(s=o);let c=s?g_(s):void 0,u=Je(r,c);if(!s){if(o||o===0)throw new Error(l?E6(t):C6(t));return o}let d=m_(i,s.props??{});return s.type!==mn.Fragment&&(d.ref=r?u:c),mn.cloneElement(s,d)});return e.displayName=`${t}.Slot`,e}Mr(Fs,"createSlot");var h_=Symbol.for("radix.slottable");function p_(t){let e=Mr(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=h_,e}Mr(p_,"createSlottable");var S6=Mr((t,e)=>"child"in t.props?mn.isValidElement(e)?mn.cloneElement(e,void 0,t.props.children(e.props.children)):null:mn.isValidElement(e)?e:null,"getSlottableElementFromSlottable");function m_(t,e){let n={...e};for(let r in e){let o=t[r],i=e[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{let a=i(...l);return o(...l),a}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"?n[r]=[o,i].filter(Boolean).join(" "):r==="aria-describedby"&&(n[r]=w_(i,o))}return{...t,...n}}Mr(m_,"mergeProps");function g_(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}Mr(g_,"getElementRef");function y_(t){return mn.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===h_}Mr(y_,"isSlottable");var x6=Symbol.for("react.lazy");function KS(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===x6&&"_payload"in t&&v_(t._payload)}Mr(KS,"isLazyComponent");function v_(t){return typeof t=="object"&&t!==null&&"then"in t}Mr(v_,"isPromiseLike");function b_(t){let e=t;for(;KS(e)&&typeof vg=="function";)e=vg(e._payload);return e}Mr(b_,"useUnwrappedLazy");function w_(...t){let e=new Set;for(let n of t)if(typeof n=="string")for(let r of String(n).trim().split(/\s+/))r&&e.add(r);return e.size>0?Array.from(e).join(" "):void 0}Mr(w_,"concatAriaDescribedby");var C6=Mr(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),E6=Mr(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),vg=mn[" use ".trim().toString()],T6=Object.defineProperty,k6=(t,e)=>T6(t,"name",{value:e,configurable:!0}),A6=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ve=A6.reduce((t,e)=>{let n=Fs(`Primitive.${e}`),r=d_.forwardRef((o,i)=>{let{asChild:s,...l}=o,a=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,S_.jsx)(a,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Tg(t,e){t&&f_.flushSync(()=>t.dispatchEvent(e))}k6(Tg,"dispatchDiscreteCustomEvent");var pn=globalThis?.document?x_.useLayoutEffect:()=>{},M6=Object.defineProperty,R6=(t,e)=>M6(t,"name",{value:e,configurable:!0}),yN=zf[" useInsertionEffect ".trim().toString()];function kr(t){let e=zf.useRef(t);return typeof yN=="function"?yN(()=>{e.current=t}):pn(()=>{e.current=t}),zf.useMemo(()=>((...n)=>e.current?.(...n)),[])}R6(kr,"useCallbackRef");var O6=Object.defineProperty,Lt=(t,e)=>O6(t,"name",{value:e,configurable:!0}),kS="dismissableLayer.update",D6="dismissableLayer.pointerDownOutside",N6="dismissableLayer.focusOutside",vN,XS=Se.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),kg=Se.forwardRef(Lt(function(e,n){let{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:l,onInteractOutside:a,onDismiss:c,...u}=e,d=Se.useContext(XS),[f,h]=Se.useState(null),p=f?.ownerDocument??globalThis?.document,[,m]=Se.useState({}),y=Je(n,h),g=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v?g.indexOf(v):-1,w=f?g.indexOf(f):-1,S=d.layersWithOutsidePointerEventsDisabled.size>0,C=w>=b,x=Se.useRef(!1),E=E_(z=>{s?.(z),a?.(z),z.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:x,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:Se.useCallback(z=>{if(!(z instanceof Node))return!1;let $=[...d.branches].some(I=>I.contains(z));return C&&!$},[d.branches,C])}),k=T_(z=>{if(o&&x.current)return;let $=z.target;[...d.branches].some(V=>V.contains($))||(l?.(z),a?.(z),z.defaultPrevented||c?.())},p),T=f?w===g.length-1:!1,_=kr(z=>{z.key==="Escape"&&(i?.(z),!z.defaultPrevented&&c&&(z.preventDefault(),c()))});return Se.useEffect(()=>{if(T)return p.addEventListener("keydown",_,{capture:!0}),()=>p.removeEventListener("keydown",_,{capture:!0})},[p,T,_]),Se.useEffect(()=>{if(f)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(vN=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),AS(),()=>{r&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=vN))}},[f,p,r,d]),Se.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),AS())},[f,d]),Se.useEffect(()=>{let z=Lt(()=>m({}),"handleUpdate");return document.addEventListener(kS,z),()=>document.removeEventListener(kS,z)},[]),(0,GS.jsx)(Ve.div,{...u,ref:y,style:{pointerEvents:S?C?"auto":"none":void 0,...e.style},onFocusCapture:Z(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Z(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Z(e.onPointerDownCapture,E.onPointerDownCapture)})},"DismissableLayer")),_6=Se.forwardRef(Lt(function(e,n){let r=Se.useContext(XS),o=Se.useRef(null),i=Je(n,o);return Se.useEffect(()=>{let s=o.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),(0,GS.jsx)(Ve.div,{...e,ref:i})},"DismissableLayerBranch"));function C_(){let t=Se.useContext(XS),[e,n]=Se.useState(null);return Se.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}Lt(C_,"useDismissableLayerSurface");var I6=Lt(()=>!0,"IS_TRUE");function E_(t,e){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:i,shouldHandlePointerDownOutside:s=I6}=e,l=kr(t),a=Se.useRef(!1),c=Se.useRef(!1),u=Se.useRef(new Map),d=Se.useRef(()=>{});return Se.useEffect(()=>{function f(){c.current=!1,o.current=!1,u.current.clear()}Lt(f,"resetOutsideInteraction");function h(){return Array.from(u.current.values()).some(Boolean)}Lt(h,"isOutsideInteractionIntercepted");function p(b){if(!c.current)return;let w=b.target;w instanceof Node&&[...i].some(C=>C.contains(w))||u.current.set(b.type,!0),b.type==="click"&&window.setTimeout(()=>{c.current&&d.current()},0)}Lt(p,"handleInteractionCapture");function m(b){c.current&&u.current.set(b.type,!1)}Lt(m,"handleInteractionBubble");let y=Lt(b=>{if(b.target&&!a.current){let S=function(){n.removeEventListener("click",d.current);let x=h();f(),x||WS(D6,l,C,{discrete:!0})};var w=S;if(Lt(S,"handleAndDispatchPointerDownOutsideEvent"),!s(b.target)){n.removeEventListener("click",d.current),f(),a.current=!1;return}let C={originalEvent:b};c.current=!0,o.current=r&&b.button===0,u.current.clear(),!r||b.button!==0?S():(n.removeEventListener("click",d.current),d.current=S,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),f();a.current=!1},"handlePointerDown"),g=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(let b of g)n.addEventListener(b,p,!0),n.addEventListener(b,m);let v=window.setTimeout(()=>{n.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(v),n.removeEventListener("pointerdown",y),n.removeEventListener("click",d.current);for(let b of g)n.removeEventListener(b,p,!0),n.removeEventListener(b,m)}},[n,l,r,o,i,s]),{onPointerDownCapture:Lt(()=>a.current=!0,"onPointerDownCapture")}}Lt(E_,"usePointerDownOutside");function T_(t,e=globalThis?.document){let n=kr(t),r=Se.useRef(!1);return Se.useEffect(()=>{let o=Lt(i=>{i.target&&!r.current&&WS(N6,n,{originalEvent:i},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:Lt(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Lt(()=>r.current=!1,"onBlurCapture")}}Lt(T_,"useFocusOutside");function AS(){let t=new CustomEvent(kS);document.dispatchEvent(t)}Lt(AS,"dispatchUpdate");function WS(t,e,n,{discrete:r}){let o=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?Tg(o,i):o.dispatchEvent(i)}Lt(WS,"handleAndDispatchCustomEvent");var L6=Object.defineProperty,Et=(t,e)=>L6(t,"name",{value:e,configurable:!0}),dS="focusScope.autoFocusOnMount",fS="focusScope.autoFocusOnUnmount",bN={bubbles:!1,cancelable:!0},k_=st.forwardRef(Et(function(e,n){let{loop:r=!1,trapped:o=!1,branches:i,onMountAutoFocus:s,onUnmountAutoFocus:l,...a}=e,[c,u]=st.useState(null),d=kr(s),f=kr(l),h=st.useRef(null),p=Je(n,u),m=st.useRef(i);st.useEffect(()=>{m.current=i});let y=st.useCallback(b=>b?c?.contains(b)?!0:!!m.current?.some(w=>w.contains(b)):!1,[c]),g=st.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;st.useEffect(()=>{if(o){let C=function(T){if(g.paused||!c)return;let _=T.target;y(_)?h.current=_:Ei(h.current,{select:!0})},x=function(T){if(g.paused||!c)return;let _=T.relatedTarget;_!==null&&(y(_)||Ei(h.current,{select:!0}))},E=function(T){if(document.activeElement===document.body)for(let z of T)z.removedNodes.length>0&&Ei(c)};var b=C,w=x,S=E;Et(C,"handleFocusIn"),Et(x,"handleFocusOut"),Et(E,"handleMutations"),document.addEventListener("focusin",C),document.addEventListener("focusout",x);let k=new MutationObserver(E);return c&&k.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",C),document.removeEventListener("focusout",x),k.disconnect()}}},[o,c,g.paused,y]),st.useEffect(()=>{if(c){wN.add(g);let b=document.activeElement;if(!c.contains(b)){let S=new CustomEvent(dS,bN);c.addEventListener(dS,d),c.dispatchEvent(S),S.defaultPrevented||(M_(__(tx(c)),{select:!0}),document.activeElement===b&&Ei(c))}return()=>{c.removeEventListener(dS,d);let S=c.ownerDocument,C=CustomEvent;setTimeout(()=>{let x=new C(fS,bN);c.addEventListener(fS,f),c.dispatchEvent(x),x.defaultPrevented||Ei(b??S.body,{select:!0}),c.removeEventListener(fS,f),wN.remove(g)},0)}}},[c,d,f,g]);let v=st.useCallback(b=>{if(!r&&!o||g.paused)return;let w=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,S=document.activeElement;if(w&&S){let C=b.currentTarget,[x,E]=R_(C);x&&E?!b.shiftKey&&S===E?(b.preventDefault(),r&&Ei(x,{select:!0})):b.shiftKey&&S===x&&(b.preventDefault(),r&&Ei(E,{select:!0})):S===C&&b.preventDefault()}},[r,o,g.paused]);return(0,JS.jsx)(Ve.div,{tabIndex:-1,...a,ref:p,onKeyDown:v})},"FocusScope")),A_=st.createContext(null);function QS({registry:t,children:e}){return t?(0,JS.jsx)(A_.Provider,{value:t,children:e}):e}Et(QS,"FocusScopeBranchProvider");function ZS(){let[t,e]=st.useState([]),n=st.useMemo(()=>({add:Et(r=>e(o=>o.includes(r)?o:[...o,r]),"add"),remove:Et(r=>e(o=>o.filter(i=>i!==r)),"remove")}),[]);return{nodes:t,registry:n}}Et(ZS,"useFocusScopeBranchRegistry");function ex(t){let e=st.useContext(A_);st.useEffect(()=>{if(!(!t||!e))return e.add(t),()=>e.remove(t)},[t,e])}Et(ex,"useFocusScopeBranch");function M_(t,{select:e=!1}={}){let n=document.activeElement;for(let r of t)if(Ei(r,{select:e}),document.activeElement!==n)return}Et(M_,"focusFirst");function R_(t){let e=tx(t),n=MS(e,t),r=MS(e.reverse(),t);return[n,r]}Et(R_,"getTabbableEdges");function tx(t){let e=[],r=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:Et(o=>{let i=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||i?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;r.nextNode();)e.push(r.currentNode);return e}Et(tx,"getTabbableCandidates");function MS(t,e){let n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(let r of t)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):O_(r,{upTo:e})))return r}Et(MS,"findVisible");function O_(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}Et(O_,"isHidden");function D_(t){return t.tagName==="INPUT"&&typeof t.select=="function"}Et(D_,"isSelectableInput");function Ei(t,{select:e=!1}={}){if(t&&t.focus){let r=(t.ownerDocument??document).activeElement;t.focus({preventScroll:!0}),t!==r&&D_(t)&&e&&t.select()}}Et(Ei,"focus");var wN=N_();function N_(){let t=[];return{add(e){let n=t[0];e!==n&&n?.pause(),t=RS(t,e),t.unshift(e)},remove(e){t=RS(t,e),t[0]?.resume()}}}Et(N_,"createFocusScopesStack");function RS(t,e){let n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}Et(RS,"arrayRemove");function __(t){return t.filter(e=>e.tagName!=="A")}Et(__,"removeLinks");var z6=Object.defineProperty,U6=(t,e)=>z6(t,"name",{value:e,configurable:!0}),P6=nx[" useId ".trim().toString()]||(()=>{}),B6=0;function Bs(t){let[e,n]=nx.useState(P6());return pn(()=>{t||n(r=>r??String(B6++))},[t]),t||(e?`radix-${e}`:"")}U6(Bs,"useId");var H6=["top","right","bottom","left"],$s=Math.min,ki=Math.max,bg=Math.round,og=Math.floor,Ai=t=>({x:t,y:t}),j6={left:"right",right:"left",bottom:"top",top:"bottom"};function I_(t,e,n){return ki(t,$s(e,n))}function Mi(t,e){return typeof t=="function"?t(e):t}function Ys(t){return t.split("-")[0]}function su(t){return t.split("-")[1]}function rx(t){return t==="x"?"y":"x"}function ox(t){return t==="y"?"height":"width"}function Fo(t){let e=t[0];return e==="t"||e==="b"?"y":"x"}function ix(t){return rx(Fo(t))}function V6(t,e,n){n===void 0&&(n=!1);let r=su(t),o=ix(t),i=ox(o),s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=wg(s)),[s,wg(s)]}function F6(t){let e=wg(t);return[OS(t),e,OS(e)]}function OS(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}var SN=["left","right"],xN=["right","left"],$6=["top","bottom"],Y6=["bottom","top"];function q6(t,e,n){switch(t){case"top":case"bottom":return n?e?xN:SN:e?SN:xN;case"left":case"right":return e?$6:Y6;default:return[]}}function K6(t,e,n,r){let o=su(t),i=q6(Ys(t),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),e&&(i=i.concat(i.map(OS)))),i}function wg(t){let e=Ys(t);return j6[e]+t.slice(e.length)}function G6(t){var e,n,r,o;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(r=t.bottom)!=null?r:0,left:(o=t.left)!=null?o:0}}function L_(t){return typeof t!="number"?G6(t):{top:t,right:t,bottom:t,left:t}}function Sg(t){let{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}function CN(t,e,n){let{reference:r,floating:o}=t,i=Fo(e),s=ix(e),l=ox(s),a=Ys(e),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2,h;switch(a){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}let p=su(e);return p&&(h[s]+=f*(p==="end"?1:-1)*(n&&c?-1:1)),h}async function X6(t,e){var n;e===void 0&&(e={});let{x:r,y:o,platform:i,rects:s,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=Mi(e,t),p=L_(h),y=l[f?d==="floating"?"reference":"floating":d],g=Sg(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),v=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),w=await(i.isElement==null?void 0:i.isElement(b))&&await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1},S=Sg(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:b,strategy:a}):v);return{top:(g.top-S.top+p.top)/w.y,bottom:(S.bottom-g.bottom+p.bottom)/w.y,left:(g.left-S.left+p.left)/w.x,right:(S.right-g.right+p.right)/w.x}}var W6=50,J6=async(t,e,n)=>{let{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=s.detectOverflow?s:{...s,detectOverflow:X6},a=await(s.isRTL==null?void 0:s.isRTL(e)),c=await s.getElementRects({reference:t,floating:e,strategy:o}),{x:u,y:d}=CN(c,r,a),f=r,h=0,p={};for(let m=0;m<i.length;m++){let y=i[m];if(!y)continue;let{name:g,fn:v}=y,{x:b,y:w,data:S,reset:C}=await v({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:l,elements:{reference:t,floating:e}});u=b??u,d=w??d,p[g]={...p[g],...S},C&&h<W6&&(h++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(c=C.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:o}):C.rects),{x:u,y:d}=CN(c,f,a)),m=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}},Q6=t=>({name:"arrow",options:t,async fn(e){let{x:n,y:r,placement:o,rects:i,platform:s,elements:l,middlewareData:a}=e,{element:c,padding:u=0}=Mi(t,e)||{};if(c==null)return{};let d=L_(u),f={x:n,y:r},h=ix(o),p=ox(h),m=await s.getDimensions(c),y=h==="y",g=y?"top":"left",v=y?"bottom":"right",b=y?"clientHeight":"clientWidth",w=i.reference[p]+i.reference[h]-f[h]-i.floating[p],S=f[h]-i.reference[h],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c)),x=C?C[b]:0;(!x||!await(s.isElement==null?void 0:s.isElement(C)))&&(x=l.floating[b]||i.floating[p]);let E=w/2-S/2,k=x/2-m[p]/2-1,T=$s(d[g],k),_=$s(d[v],k),z=x-m[p]-_,$=x/2-m[p]/2+E,I=I_(T,$,z),V=!a.arrow&&su(o)!=null&&$!==I&&i.reference[p]/2-($<T?T:_)-m[p]/2<0,D=V?$<T?$-T:$-z:0;return{[h]:f[h]+D,data:{[h]:I,centerOffset:$-I-D,...V&&{alignmentOffset:D}},reset:V}}}),Z6=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;let{placement:o,middlewareData:i,rects:s,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...y}=Mi(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Ys(o),v=Fo(l),b=Ys(l)===l,w=await(a.isRTL==null?void 0:a.isRTL(c.floating)),S=f||(b||!m?[wg(l)]:F6(l)),C=p!=="none";!f&&C&&S.push(...K6(l,m,p,w));let x=[l,...S],E=await a.detectOverflow(e,y),k=[],T=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&k.push(E[g]),d){let I=V6(o,s,w);k.push(E[I[0]],E[I[1]])}if(T=[...T,{placement:o,overflows:k}],!k.every(I=>I<=0)){var _,z;let I=(((_=i.flip)==null?void 0:_.index)||0)+1,V=x[I];if(V&&(!(d==="alignment"?v!==Fo(V):!1)||T.every(U=>Fo(U.placement)===v?U.overflows[0]>0:!0)))return{data:{index:I,overflows:T},reset:{placement:V}};let D=(z=T.filter(q=>q.overflows[0]<=0).sort((q,U)=>q.overflows[1]-U.overflows[1])[0])==null?void 0:z.placement;if(!D)switch(h){case"bestFit":{var $;let q=($=T.filter(U=>{if(C){let re=Fo(U.placement);return re===v||re==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(re=>re>0).reduce((re,Y)=>re+Y,0)]).sort((U,re)=>U[1]-re[1])[0])==null?void 0:$[0];q&&(D=q);break}case"initialPlacement":D=l;break}if(o!==D)return{reset:{placement:D}}}return{}}}};function EN(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function TN(t){return H6.some(e=>t[e]>=0)}var eF=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:n,platform:r}=e,{strategy:o="referenceHidden",...i}=Mi(t,e);switch(o){case"referenceHidden":{let s=await r.detectOverflow(e,{...i,elementContext:"reference"}),l=EN(s,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:TN(l)}}}case"escaped":{let s=await r.detectOverflow(e,{...i,altBoundary:!0}),l=EN(s,n.floating);return{data:{escapedOffsets:l,escaped:TN(l)}}}default:return{}}}}},z_=new Set(["left","top"]);async function tF(t,e){let{placement:n,platform:r,elements:o}=t,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Ys(n),l=su(n),a=Fo(n)==="y",c=z_.has(s)?-1:1,u=i&&a?-1:1,d=Mi(e,t),{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof p=="number"&&(h=l==="end"?p*-1:p),a?{x:h*u,y:f*c}:{x:f*c,y:h*u}}var nF=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;let{x:o,y:i,placement:s,middlewareData:l}=e,a=await tF(e,t);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:i+a.y,data:{...a,placement:s}}}}},rF=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:r,placement:o,platform:i}=e,{mainAxis:s=!0,crossAxis:l=!1,limiter:a={fn:v=>{let{x:b,y:w}=v;return{x:b,y:w}}},...c}=Mi(t,e),u={x:n,y:r},d=await i.detectOverflow(e,c),f=Fo(o),h=rx(f),p=u[h],m=u[f],y=(v,b)=>I_(b+d[v==="y"?"top":"left"],b,b-d[v==="y"?"bottom":"right"]);s&&(p=y(h,p)),l&&(m=y(f,m));let g=a.fn({...e,[h]:p,[f]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[h]:s,[f]:l}}}}}},oF=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,r;let{x:o,y:i,placement:s,rects:l,middlewareData:a}=e,{offset:c=0,mainAxis:u=!0,crossAxis:d=!0}=Mi(t,e),f={x:o,y:i},h=Fo(s),p=rx(h),m=f[p],y=f[h],g=Mi(c,e),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:(n=g.mainAxis)!=null?n:0,crossAxis:(r=g.crossAxis)!=null?r:0};if(u){let S=p==="y"?"height":"width",C=l.reference[p]-l.floating[S]+v.mainAxis,x=l.reference[p]+l.reference[S]-v.mainAxis;m<C?m=C:m>x&&(m=x)}if(d){var b,w;let S=p==="y"?"width":"height",C=z_.has(Ys(s)),x=l.reference[h]-l.floating[S]+(C&&((b=a.offset)==null?void 0:b[h])||0)+(C?0:v.crossAxis),E=l.reference[h]+l.reference[S]+(C?0:((w=a.offset)==null?void 0:w[h])||0)-(C?v.crossAxis:0);y<x?y=x:y>E&&(y=E)}return{[p]:m,[h]:y}}}},iF=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){let{placement:n,rects:r,platform:o,elements:i}=e,{apply:s=()=>{},...l}=Mi(t,e),a=await o.detectOverflow(e,l),c=Ys(n),u=su(n),d=Fo(n)==="y",{width:f,height:h}=r.floating,p,m;c==="top"||c==="bottom"?(p=c,m=u===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(m=c,p=u==="end"?"top":"bottom");let y=h-a.top-a.bottom,g=f-a.left-a.right,v=$s(h-a[p],y),b=$s(f-a[m],g),w=e.middlewareData.shift,S=!w,C=v,x=b;w!=null&&w.enabled.x&&(x=g),w!=null&&w.enabled.y&&(C=y),S&&!u&&(d?x=f-2*ki(a.left,a.right):C=h-2*ki(a.top,a.bottom)),await s({...e,availableWidth:x,availableHeight:C});let E=await o.getDimensions(i.floating);return f!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}};function Ag(){return typeof window<"u"}function lu(t){return U_(t)?(t.nodeName||"").toLowerCase():"#document"}function Zn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Di(t){var e;return(e=(U_(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function U_(t){return Ag()?t instanceof Node||t instanceof Zn(t).Node:!1}function $o(t){return Ag()?t instanceof Element||t instanceof Zn(t).Element:!1}function Ks(t){return Ag()?t instanceof HTMLElement||t instanceof Zn(t).HTMLElement:!1}function kN(t){return!Ag()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Zn(t).ShadowRoot}function Mg(t){let{overflow:e,overflowX:n,overflowY:r,display:o}=Yo(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&o!=="inline"&&o!=="contents"}function sF(t){return/^(table|td|th)$/.test(lu(t))}function Rg(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}var lF=/transform|translate|scale|rotate|perspective|filter/,aF=/paint|layout|strict|content/,na=t=>!!t&&t!=="none",hS;function sx(t){let e=$o(t)?Yo(t):t;return na(e.transform)||na(e.translate)||na(e.scale)||na(e.rotate)||na(e.perspective)||!lx()&&(na(e.backdropFilter)||na(e.filter))||lF.test(e.willChange||"")||aF.test(e.contain||"")}function cF(t){let e=oa(t);for(;Ks(e)&&!Df(e);){if(sx(e))return e;if(Rg(e))return null;e=oa(e)}return null}function lx(){return hS==null&&(hS=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),hS}function Df(t){return/^(html|body|#document)$/.test(lu(t))}function Yo(t){return Zn(t).getComputedStyle(t)}function Og(t){return $o(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function oa(t){if(lu(t)==="html")return t;let e=t.assignedSlot||t.parentNode||kN(t)&&t.host||Di(t);return kN(e)?e.host:e}function P_(t){let e=oa(t);return Df(e)?(t.ownerDocument||t).body:Ks(e)&&Mg(e)?e:P_(e)}function Nf(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);let o=P_(t),i=o===((r=t.ownerDocument)==null?void 0:r.body),s=Zn(o);if(i){let l=DS(s);return e.concat(s,s.visualViewport||[],Mg(o)?o:[],l&&n?Nf(l):[])}else return e.concat(o,Nf(o,[],n))}function DS(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function B_(t){let e=Yo(t),n=parseFloat(e.width)||0,r=parseFloat(e.height)||0,o=Ks(t),i=o?t.offsetWidth:n,s=o?t.offsetHeight:r,l=bg(n)!==i||bg(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function ax(t){return $o(t)?t:t.contextElement}function tu(t){let e=ax(t);if(!Ks(e))return Ai(1);let n=e.getBoundingClientRect(),{width:r,height:o,$:i}=B_(e),s=(i?bg(n.width):n.width)/r,l=(i?bg(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}var uF=Ai(0);function H_(t){let e=Zn(t);return!lx()||!e.visualViewport?uF:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function dF(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===Zn(t)}function ia(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);let o=t.getBoundingClientRect(),i=ax(t),s=Ai(1);e&&(r?$o(r)&&(s=tu(r)):s=tu(t));let l=dF(i,n,r)?H_(i):Ai(0),a=(o.left+l.x)/s.x,c=(o.top+l.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i&&r){let f=Zn(i),h=$o(r)?Zn(r):r,p=f,m=DS(p);for(;m&&h!==p;){let y=tu(m),g=m.getBoundingClientRect(),v=Yo(m),b=g.left+(m.clientLeft+parseFloat(v.paddingLeft))*y.x,w=g.top+(m.clientTop+parseFloat(v.paddingTop))*y.y;a*=y.x,c*=y.y,u*=y.x,d*=y.y,a+=b,c+=w,p=Zn(m),m=DS(p)}}return Sg({width:u,height:d,x:a,y:c})}function Dg(t,e){let n=Og(t).scrollLeft;return e?e.left+n:ia(Di(t)).left+n}function j_(t,e){let n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Dg(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function fF(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t,i=o==="fixed",s=Di(r),l=e?Rg(e.floating):!1;if(r===s||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=Ai(1),u=Ai(0),d=Ks(r);if((d||!i)&&((lu(r)!=="body"||Mg(s))&&(a=Og(r)),d)){let h=ia(r);c=tu(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}let f=s&&!d&&!i?j_(s,a):Ai(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-a.scrollTop*c.y+u.y+f.y}}function hF(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function pF(t){let e=Og(t),n=t.ownerDocument.body,r=ki(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=ki(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight),i=-e.scrollLeft+Dg(t),s=-e.scrollTop;return Yo(n).direction==="rtl"&&(i+=ki(t.clientWidth,n.clientWidth)-r),{width:r,height:o,x:i,y:s}}var mF=25;function gF(t,e,n){n===void 0&&(n="viewport");let r=n==="layoutViewport",o=Zn(t),i=Di(t),s=o.visualViewport,l=i.clientWidth,a=i.clientHeight,c=0,u=0;if(s){let f=!lx()||e==="fixed";r?f||(c=-s.offsetLeft,u=-s.offsetTop):(l=s.width,a=s.height,f&&(c=s.offsetLeft,u=s.offsetTop))}if(Dg(i)<=0){let f=i.ownerDocument,h=f.body,p=getComputedStyle(h),m=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,y=Math.abs(i.clientWidth-h.clientWidth-m),g=getComputedStyle(i).scrollbarGutter==="stable both-edges"?y/2:y;g<=mF&&(l-=g)}return{width:l,height:a,x:c,y:u}}function yF(t,e){let n=ia(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,i=tu(t),s=t.clientWidth*i.x,l=t.clientHeight*i.y,a=o*i.x,c=r*i.y;return{width:s,height:l,x:a,y:c}}function AN(t,e,n){let r;if(e==="viewport"||e==="layoutViewport")r=gF(t,n,e);else if(e==="document")r=pF(Di(t));else if($o(e))r=yF(e,n);else{let o=H_(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Sg(r)}function vF(t,e){let n=e.get(t);if(n)return n;let r=Nf(t,[],!1).filter(l=>$o(l)&&lu(l)!=="body"),o=null,i=Yo(t).position==="fixed",s=i?oa(t):t;for(;$o(s)&&!Df(s);){let l=Yo(s),a=sx(s),c=o?o.position:i?"fixed":"";!a&&(c==="fixed"||c==="absolute"&&l.position==="static")?r=r.filter(d=>d!==s):o=l,s=oa(s)}return e.set(t,r),r}function bF(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t,s=[...n==="clippingAncestors"?Rg(e)?[]:vF(e,this._c):[].concat(n),r],l=AN(e,s[0],o),a=l.top,c=l.right,u=l.bottom,d=l.left;for(let f=1;f<s.length;f++){let h=AN(e,s[f],o);a=ki(h.top,a),c=$s(h.right,c),u=$s(h.bottom,u),d=ki(h.left,d)}return{width:c-d,height:u-a,x:d,y:a}}function wF(t){let{width:e,height:n}=B_(t);return{width:e,height:n}}function SF(t,e,n){let r=Ks(e),o=Di(e),i=n==="fixed",s=ia(t,!0,i,e),l={scrollLeft:0,scrollTop:0},a=Ai(0);if((r||!i)&&((lu(e)!=="body"||Mg(o))&&(l=Og(e)),r)){let f=ia(e,!0,i,e);a.x=f.x+e.clientLeft,a.y=f.y+e.clientTop}!r&&o&&(a.x=Dg(o));let c=o&&!r&&!i?j_(o,l):Ai(0),u=s.left+l.scrollLeft-a.x-c.x,d=s.top+l.scrollTop-a.y-c.y;return{x:u,y:d,width:s.width,height:s.height}}function pS(t){return Yo(t).position==="static"}function MN(t,e){if(!Ks(t)||Yo(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Di(t)===n&&(n=n.ownerDocument.body),n}function V_(t,e){let n=Zn(t);if(Rg(t))return n;if(!Ks(t)){let o=oa(t);for(;o&&!Df(o);){if($o(o)&&!pS(o))return o;o=oa(o)}return n}let r=MN(t,e);for(;r&&sF(r)&&pS(r);)r=MN(r,e);return r&&Df(r)&&pS(r)&&!sx(r)?n:r||cF(t)||n}var xF=async function(t){let e=this.getOffsetParent||V_,n=this.getDimensions,r=await n(t.floating);return{reference:SF(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function CF(t){return Yo(t).direction==="rtl"}var EF={convertOffsetParentRelativeRectToViewportRelativeRect:fF,getDocumentElement:Di,getClippingRect:bF,getOffsetParent:V_,getElementRects:xF,getClientRects:hF,getDimensions:wF,getScale:tu,isElement:$o,isRTL:CF};function F_(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function TF(t,e,n){let r=null,o,i=Di(t);function s(){var u;clearTimeout(o),(u=r)==null||u.disconnect(),r=null}function l(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),s();let f=t.getBoundingClientRect(),{left:h,top:p,width:m,height:y}=f;if(u||e(),!m||!y)return;let g=og(p),v=og(i.clientWidth-(h+m)),b=og(i.clientHeight-(p+y)),w=og(h),C={rootMargin:-g+"px "+-v+"px "+-b+"px "+-w+"px",threshold:ki(0,$s(1,d))||1},x=!0;function E(k){let T=k[0].intersectionRatio;if(!F_(f,t.getBoundingClientRect()))return l();if(T!==d){if(!x)return l();T?l(!1,T):o=setTimeout(()=>{l(!1,1e-7)},1e3)}x=!1}try{r=new IntersectionObserver(E,{...C,root:i.ownerDocument})}catch{r=new IntersectionObserver(E,C)}r.observe(t)}let a=Zn(t),c=()=>l(n);return a.addEventListener("resize",c),l(!0),()=>{a.removeEventListener("resize",c),s()}}function kF(t,e,n,r){r===void 0&&(r={});let{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=ax(t),u=o||i?[...c?Nf(c):[],...e?Nf(e):[]]:[];u.forEach(g=>{o&&g.addEventListener("scroll",n),i&&g.addEventListener("resize",n)});let d=c&&l?TF(c,n,i):null,f=-1,h=null;s&&(h=new ResizeObserver(g=>{let[v]=g;v&&v.target===c&&h&&e&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(e)})),n()}),c&&!a&&h.observe(c),e&&h.observe(e));let p,m=a?ia(t):null;a&&y();function y(){let g=ia(t);m&&!F_(m,g)&&n(),m=g,p=requestAnimationFrame(y)}return n(),()=>{var g;u.forEach(v=>{o&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),d?.(),(g=h)==null||g.disconnect(),h=null,a&&cancelAnimationFrame(p)}}var AF=nF,MF=rF,RF=Z6,OF=iF,DF=eF,RN=Q6,NF=oF,_F=(t,e,n)=>{let r=new Map,o=n??{},i={...EF,...o.platform,_c:r};return J6(t,e,{...o,platform:i})},IF=typeof document<"u",LF=function(){},ug=IF?$_.useLayoutEffect:LF;function xg(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!xg(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){let i=o[r];if(!(i==="_owner"&&t.$$typeof)&&!xg(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function q_(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function ON(t,e){let n=q_(t);return Math.round(e*n)/n}function mS(t){let e=Tt.useRef(t);return ug(()=>{e.current=t}),e}function zF(t){t===void 0&&(t={});let{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:a,open:c}=t,[u,d]=Tt.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=Tt.useState(r);xg(f,r)||h(r);let[p,m]=Tt.useState(null),[y,g]=Tt.useState(null),v=Tt.useCallback(U=>{U!==C.current&&(C.current=U,m(U))},[]),b=Tt.useCallback(U=>{U!==x.current&&(x.current=U,g(U))},[]),w=i||p,S=s||y,C=Tt.useRef(null),x=Tt.useRef(null),E=Tt.useRef(u),k=a!=null,T=mS(a),_=mS(o),z=mS(c),$=Tt.useCallback(()=>{if(!C.current||!x.current)return;let U={placement:e,strategy:n,middleware:f};_.current&&(U.platform=_.current),_F(C.current,x.current,U).then(re=>{let Y={...re,isPositioned:z.current!==!1};I.current&&!xg(E.current,Y)&&(E.current=Y,Y_.flushSync(()=>{d(Y)}))})},[f,e,n,_,z]);ug(()=>{c===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(U=>({...U,isPositioned:!1})))},[c]);let I=Tt.useRef(!1);ug(()=>(I.current=!0,()=>{I.current=!1}),[]),ug(()=>{if(w&&(C.current=w),S&&(x.current=S),w&&S){if(T.current)return T.current(w,S,$);$()}},[w,S,$,T,k]);let V=Tt.useMemo(()=>({reference:C,floating:x,setReference:v,setFloating:b}),[v,b]),D=Tt.useMemo(()=>({reference:w,floating:S}),[w,S]),q=Tt.useMemo(()=>{let U={position:n,left:0,top:0};if(!D.floating)return U;let re=ON(D.floating,u.x),Y=ON(D.floating,u.y);return l?{...U,transform:"translate("+re+"px, "+Y+"px)",...q_(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:re,top:Y}},[n,l,D.floating,u.x,u.y]);return Tt.useMemo(()=>({...u,update:$,refs:V,elements:D,floatingStyles:q}),[u,$,V,D,q])}var UF=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){let{element:r,padding:o}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?RN({element:r.current,padding:o}).fn(n):{}:r?RN({element:r,padding:o}).fn(n):{}}}},PF=(t,e)=>{let n=AF(t);return{name:n.name,fn:n.fn,options:[t,e]}},BF=(t,e)=>{let n=MF(t);return{name:n.name,fn:n.fn,options:[t,e]}},HF=(t,e)=>({fn:NF(t).fn,options:[t,e]}),jF=(t,e)=>{let n=RF(t);return{name:n.name,fn:n.fn,options:[t,e]}},VF=(t,e)=>{let n=OF(t);return{name:n.name,fn:n.fn,options:[t,e]}},FF=(t,e)=>{let n=DF(t);return{name:n.name,fn:n.fn,options:[t,e]}},$F=(t,e)=>{let n=UF(t);return{name:n.name,fn:n.fn,options:[t,e]}},YF=Object.defineProperty,qF=(t,e)=>YF(t,"name",{value:e,configurable:!0});function G_(t){let[e,n]=K_.useState(void 0);return pn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});let r=0,o=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;let s=i[0];window.cancelAnimationFrame(r),r=window.requestAnimationFrame(()=>{let l,a;if("borderBoxSize"in s){let c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;l=u.inlineSize,a=u.blockSize}else l=t.offsetWidth,a=t.offsetHeight;n({width:l,height:a})})});return o.observe(t,{box:"border-box"}),()=>{window.cancelAnimationFrame(r),o.unobserve(t)}}else n(void 0)},[t]),e}qF(G_,"useSize");var KF=Object.defineProperty,Hs=(t,e)=>KF(t,"name",{value:e,configurable:!0}),DN={Partial:"partial",Always:"always"},NN={Optimized:"optimized",Always:"always"},X_="Popper",[W_,Ng]=Ar(X_),[GF,J_]=W_(X_),Q_=Hs(t=>{let{__scopePopper:e,children:n}=t,[r,o]=kn.useState(null),[i,s]=kn.useState(void 0);return(0,nu.jsx)(GF,{scope:e,anchor:r,onAnchorChange:o,placementState:i,setPlacementState:s,children:n})},"Popper"),XF="PopperAnchor",Z_=kn.forwardRef(Hs(function(e,n){let{__scopePopper:r,virtualRef:o,...i}=e,s=J_(XF,r),l=kn.useRef(null),a=s.onAnchorChange,c=kn.useCallback(m=>{l.current=m,m&&a(m)},[a]),u=Je(n,c),d=kn.useRef(null);kn.useEffect(()=>{if(!o)return;let m=d.current;d.current=o.current,m!==d.current&&a(d.current)});let f=s.placementState&&_g(s.placementState),h=f?.[0],p=f?.[1];return o?null:(0,nu.jsx)(Ve.div,{"data-radix-popper-side":h,"data-radix-popper-align":p,...i,ref:u})},"PopperAnchor")),e2="PopperContent",[WF,boe]=W_(e2),t2=kn.forwardRef(Hs(function(e,n){let{__scopePopper:r,side:o="bottom",sideOffset:i=0,align:s="center",alignOffset:l=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f=DN.Partial,hideWhenDetached:h=!1,updatePositionStrategy:p=NN.Optimized,onPlaced:m,...y}=e,g=J_(e2,r),[v,b]=kn.useState(null),w=Je(n,b),[S,C]=kn.useState(null),x=G_(S),E=x?.width??0,k=x?.height??0,T=o+(s!=="center"?"-"+s:""),_=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},z=Array.isArray(u)?u:[u],$=z.length>0,I={padding:_,boundary:z.filter(n2),altBoundary:$},{refs:V,floatingStyles:D,placement:q,isPositioned:U,middlewareData:re}=zF({strategy:"fixed",placement:T,whileElementsMounted:Hs((...si)=>kF(...si,{animationFrame:p===NN.Always}),"whileElementsMounted"),elements:{reference:g.anchor},middleware:[PF({mainAxis:i+k,alignmentAxis:l}),c&&BF({mainAxis:!0,crossAxis:!1,...f===DN.Partial?{limiter:HF()}:{},...I}),c&&jF({...I}),VF({...I,apply:Hs(({elements:si,rects:Wa,availableWidth:Td,availableHeight:gp})=>{let{width:Ol,height:li}=Wa.reference,zn=si.floating.style;zn.setProperty("--radix-popper-available-width",`${Td}px`),zn.setProperty("--radix-popper-available-height",`${gp}px`),zn.setProperty("--radix-popper-anchor-width",`${Ol}px`),zn.setProperty("--radix-popper-anchor-height",`${li}px`)},"apply")}),S&&$F({element:S,padding:a}),JF({arrowWidth:E,arrowHeight:k}),h&&FF($?{strategy:"referenceHidden",...I}:{strategy:"referenceHidden",padding:I.padding,altBoundary:I.altBoundary})]}),Y=g.setPlacementState;pn(()=>(Y(q),()=>{Y(void 0)}),[q,Y]);let[Te,rn]=_g(q),ct=kr(m);pn(()=>{U&&ct?.()},[U,ct]);let Br=re.arrow?.x,Sn=re.arrow?.y,X=re.arrow?.centerOffset!==0,[To,ii]=kn.useState();return pn(()=>{v&&ii(window.getComputedStyle(v).zIndex)},[v]),(0,nu.jsx)("div",{ref:V.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:U?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:To,"--radix-popper-transform-origin":[re.transformOrigin?.x,re.transformOrigin?.y].join(" "),...re.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,nu.jsx)(WF,{scope:r,placedSide:Te,placedAlign:rn,onArrowChange:C,arrowX:Br,arrowY:Sn,shouldHideArrow:X,children:(0,nu.jsx)(Ve.div,{"data-side":Te,"data-align":rn,...y,ref:w,style:{...y.style,animation:U?y.style?.animation:"none"}})})})},"PopperContent"));function n2(t){return t!==null}Hs(n2,"isNotNull");var JF=Hs(t=>({name:"transformOrigin",options:t,fn(e){let{placement:n,rects:r,middlewareData:o}=e,s=o.arrow?.centerOffset!==0,l=s?0:t.arrowWidth,a=s?0:t.arrowHeight,[c,u]=_g(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(o.arrow?.x??0)+l/2,h=(o.arrow?.y??0)+a/2,p="",m="";return c==="bottom"?(p=s?d:`${f}px`,m=`${-a}px`):c==="top"?(p=s?d:`${f}px`,m=`${r.floating.height+a}px`):c==="right"?(p=`${-a}px`,m=s?d:`${h}px`):c==="left"&&(p=`${r.floating.width+a}px`,m=s?d:`${h}px`),{data:{x:p,y:m}}}}),"transformOrigin");function _g(t){let[e,n="center"]=t.split("-");return[e,n]}Hs(_g,"getSideAndAlignFromPlacement");var QF=Object.defineProperty,ZF=(t,e)=>QF(t,"name",{value:e,configurable:!0}),Lg=Ig.forwardRef(ZF(function(e,n){let{container:r,...o}=e,[i,s]=Ig.useState(!1);pn(()=>s(!0),[]);let l=r||i&&globalThis?.document?.body;return l?r2.createPortal((0,o2.jsx)(Ve.div,{...o,ref:n}),l):null},"Portal")),e7=Object.defineProperty,Ri=(t,e)=>e7(t,"name",{value:e,configurable:!0});function s2(t,e){return i2.useReducer((n,r)=>e[n][r]??n,t)}Ri(s2,"useStateMachine");var Gs=Ri(t=>{let{present:e,children:n}=t,r=l2(e),o=typeof n=="function"?n({present:r.isPresent}):fn.Children.only(n),i=a2(r.ref,c2(o));return typeof n=="function"||r.isPresent?fn.cloneElement(o,{ref:i}):null},"Presence");function l2(t){let[e,n]=fn.useState(),r=fn.useRef(null),o=fn.useRef(t),i=fn.useRef("none"),s=fn.useRef(void 0),l=t?"mounted":"unmounted",[a,c]=s2(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return fn.useEffect(()=>{a==="mounted"?(i.current=s.current??eu(r.current),s.current=void 0):i.current="none"},[a]),pn(()=>{let u=r.current,d=o.current;if(d!==t){let h=i.current,p=eu(u);t?(s.current=p,c("MOUNT")):p==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,c]),pn(()=>{if(e){let u,d=e.ownerDocument.defaultView??window,f=Ri(p=>{let y=eu(r.current).includes(CSS.escape(p.animationName));if(p.target===e&&y&&(c("ANIMATION_END"),!o.current)){let g=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},"handleAnimationEnd"),h=Ri(p=>{p.target===e&&(i.current=eu(r.current))},"handleAnimationStart");return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:fn.useCallback(u=>{if(u){let d=getComputedStyle(u);r.current=d,s.current=eu(d)}else r.current=null;n(u)},[])}}Ri(l2,"usePresence");function NS(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}Ri(NS,"setRef");function a2(...t){let e=fn.useRef(t);return e.current=t,fn.useCallback(n=>{let r=e.current,o=!1,i=r.map(s=>{let l=NS(s,n);return!o&&typeof l=="function"&&(o=!0),l});if(o)return()=>{for(let s=0;s<i.length;s++){let l=i[s];typeof l=="function"?l():NS(r[s],null)}}},[])}Ri(a2,"useStableComposedRefs");function eu(t){return t?.animationName||"none"}Ri(eu,"getAnimationName");function c2(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}Ri(c2,"getElementRef");var u2=!1,t7=Object.defineProperty,n7=(t,e)=>t7(t,"name",{value:e,configurable:!0}),_N=au[" useEffectEvent ".trim().toString()],IN=au[" useInsertionEffect ".trim().toString()];function d2(t){if(typeof _N=="function")return _N(t);let e=au.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof IN=="function"?IN(()=>{e.current=t}):pn(()=>{e.current=t}),au.useMemo(()=>((...n)=>e.current?.(...n)),[])}n7(d2,"useEffectEvent");var r7=Object.defineProperty,Uf=(t,e)=>r7(t,"name",{value:e,configurable:!0}),o7=Qr[" useInsertionEffect ".trim().toString()]||pn;function cu({prop:t,defaultProp:e,onChange:n=Uf(()=>{},"onChange"),caller:r}){let[o,i,s]=f2({defaultProp:e,onChange:n}),l=t!==void 0,a=l?t:o;if(u2){let u=Qr.useRef(t!==void 0);Qr.useEffect(()=>{let d=u.current;d!==l&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,r])}let c=Qr.useCallback(u=>{if(l){let d=h2(u)?u(t):u;d!==t&&s.current?.(d)}else i(u)},[l,t,i,s]);return[a,c]}Uf(cu,"useControllableState");function f2({defaultProp:t,onChange:e}){let[n,r]=Qr.useState(t),o=Qr.useRef(n),i=Qr.useRef(e);return o7(()=>{i.current=e},[e]),Qr.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}Uf(f2,"useUncontrolledState");function h2(t){return typeof t=="function"}Uf(h2,"isFunction");var LN=Symbol("RADIX:SYNC_STATE");function i7(t,e,n,r){let{prop:o,defaultProp:i,onChange:s,caller:l}=e,a=o!==void 0,c=d2(s);if(u2){let y=mo.useRef(o!==void 0);mo.useEffect(()=>{let g=y.current;g!==a&&console.warn(`${l} is changing from ${g?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=a},[a,l])}let u=[{...n,state:i}];r&&u.push(r);let[d,f]=mo.useReducer((y,g)=>{if(g.type===LN)return{...y,state:g.state};let v=t(y,g);return a&&!Object.is(v.state,y.state)&&c(v.state),v},...u),h=d.state,p=mo.useRef(h);mo.useEffect(()=>{p.current!==h&&(p.current=h,a||c(h))},[h,p,a]);let m=mo.useMemo(()=>o!==void 0?{...d,state:o}:d,[d,o]);return mo.useEffect(()=>{a&&!Object.is(o,d.state)&&f({type:LN,state:o})},[o,d.state,a]),[m,f]}Uf(i7,"useControllableStateReducer");var s7=Object.defineProperty,l7=(t,e)=>s7(t,"name",{value:e,configurable:!0}),a7=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),cx=p2.forwardRef(l7(function(e,n){return(0,m2.jsx)(Ve.span,{...e,ref:n,style:{...a7,...e.style}})},"VisuallyHidden")),c7=Object.defineProperty,Pt=(t,e)=>c7(t,"name",{value:e,configurable:!0}),[ux,woe]=Ar("Tooltip",[Ng]),dx=Ng(),u7="TooltipProvider",d7=700,_S="tooltip.open",[f7,fx]=ux(u7),h7=Pt(t=>{let{__scopeTooltip:e,delayDuration:n=d7,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=t,s=ie.useRef(!0),l=ie.useRef(!1),a=ie.useRef(0);return ie.useEffect(()=>{let c=a.current;return()=>window.clearTimeout(c)},[]),(0,Jt.jsx)(f7,{scope:e,isOpenDelayedRef:s,delayDuration:n,onOpen:ie.useCallback(()=>{r<=0||(window.clearTimeout(a.current),s.current=!1)},[r]),onClose:ie.useCallback(()=>{r<=0||(window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.current=!0,r))},[r]),isPointerInTransitRef:l,onPointerInTransitChange:ie.useCallback(c=>{l.current=c},[]),disableHoverableContent:o,children:i})},"TooltipProvider"),IS="Tooltip",[p7,Pf]=ux(IS),m7=Pt(t=>{let{__scopeTooltip:e,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:s,delayDuration:l}=t,a=fx(IS,t.__scopeTooltip),c=dx(e),[u,d]=ie.useState(null),[f,h]=ie.useState(void 0),p=Bs(),m=ie.useRef(0),y=s??a.disableHoverableContent,g=l??a.delayDuration,v=ie.useRef(!1),[b,w]=cu({prop:r,defaultProp:o??!1,onChange:Pt(T=>{T?(a.onOpen(),document.dispatchEvent(new CustomEvent(_S))):a.onClose(),i?.(T)},"onChange"),caller:IS}),S=ie.useMemo(()=>b?v.current?"delayed-open":"instant-open":"closed",[b]),C=ie.useCallback(()=>{window.clearTimeout(m.current),m.current=0,v.current=!1,w(!0)},[w]),x=ie.useCallback(()=>{window.clearTimeout(m.current),m.current=0,w(!1)},[w]),E=ie.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{v.current=!0,w(!0),m.current=0},g)},[g,w]);return ie.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),(0,Jt.jsx)(Q_,{...c,children:(0,Jt.jsx)(p7,{scope:e,contentId:f??p,setContentId:h,open:b,stateAttribute:S,trigger:u,onTriggerChange:d,onTriggerEnter:ie.useCallback(()=>{a.isOpenDelayedRef.current?E():C()},[a.isOpenDelayedRef,E,C]),onTriggerLeave:ie.useCallback(()=>{y?x():(window.clearTimeout(m.current),m.current=0)},[x,y]),onOpen:C,onClose:x,disableHoverableContent:y,children:n})})},"Tooltip"),zN="TooltipTrigger",g7=ie.forwardRef(Pt(function(e,n){let{__scopeTooltip:r,"aria-describedby":o,...i}=e,s=Pf(zN,r),l=fx(zN,r),a=dx(r),c=ie.useRef(null),u=Je(n,c,s.onTriggerChange),d=ie.useRef(!1),f=ie.useRef(!1),h=ie.useCallback(()=>d.current=!1,[]);return ie.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),(0,Jt.jsx)(Z_,{asChild:!0,...a,children:(0,Jt.jsx)(Ve.button,{"aria-describedby":s.open?E2(o,s.contentId):o,"data-state":s.stateAttribute,...i,ref:u,onPointerMove:Z(e.onPointerMove,p=>{p.pointerType!=="touch"&&!f.current&&!l.isPointerInTransitRef.current&&(s.onTriggerEnter(),f.current=!0)}),onPointerLeave:Z(e.onPointerLeave,()=>{s.onTriggerLeave(),f.current=!1}),onPointerDown:Z(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Z(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:Z(e.onBlur,s.onClose),onClick:Z(e.onClick,s.onClose)})})},"TooltipTrigger")),g2="TooltipPortal",[y7,v7]=ux(g2,{forceMount:void 0}),b7=Pt(t=>{let{__scopeTooltip:e,forceMount:n,children:r,container:o}=t,i=Pf(g2,e);return(0,Jt.jsx)(y7,{scope:e,forceMount:n,children:(0,Jt.jsx)(Gs,{present:n||i.open,children:(0,Jt.jsx)(Lg,{asChild:!0,container:o,children:r})})})},"TooltipPortal"),_f="TooltipContent",w7=ie.forwardRef(Pt(function(e,n){let r=v7(_f,e.__scopeTooltip),{forceMount:o=r.forceMount,side:i="top",...s}=e,l=Pf(_f,e.__scopeTooltip);return(0,Jt.jsx)(Gs,{present:o||l.open,children:l.disableHoverableContent?(0,Jt.jsx)(y2,{side:i,...s,ref:n}):(0,Jt.jsx)(S7,{side:i,...s,ref:n})})},"TooltipContent")),S7=ie.forwardRef(Pt(function(e,n){let r=Pf(_f,e.__scopeTooltip),o=fx(_f,e.__scopeTooltip),i=ie.useRef(null),s=Je(n,i),[l,a]=ie.useState(null),{trigger:c,onClose:u}=r,d=i.current,{onPointerInTransitChange:f}=o,h=ie.useCallback(()=>{a(null),f(!1)},[f]),p=ie.useCallback((m,y)=>{let g=m.currentTarget,v={x:m.clientX,y:m.clientY},b=v2(v,g.getBoundingClientRect()),w=b2(v,b),S=w2(y.getBoundingClientRect()),C=x2([...w,...S]);a(C),f(!0)},[f]);return ie.useEffect(()=>()=>h(),[h]),ie.useEffect(()=>{if(c&&d){let m=Pt(g=>p(g,d),"handleTriggerLeave"),y=Pt(g=>p(g,c),"handleContentLeave");return c.addEventListener("pointerleave",m),d.addEventListener("pointerleave",y),()=>{c.removeEventListener("pointerleave",m),d.removeEventListener("pointerleave",y)}}},[c,d,p,h]),ie.useEffect(()=>{if(l){let m=Pt(y=>{let g=y.target,v={x:y.clientX,y:y.clientY},b=c?.contains(g)||d?.contains(g),w=!S2(v,l);b?h():w&&(h(),u())},"handleTrackPointerGrace");return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[c,d,l,u,h]),(0,Jt.jsx)(y2,{...e,ref:s})},"TooltipContentHoverable")),x7=p_("TooltipContent"),y2=ie.forwardRef(Pt(function(e,n){let{__scopeTooltip:r,children:o,"aria-label":i,id:s,onEscapeKeyDown:l,onPointerDownOutside:a,...c}=e,u=Pf(_f,r),d=dx(r),{onClose:f}=u,[h,p]=ie.useState(null),m=Je(n,p);ex(h),ie.useEffect(()=>(document.addEventListener(_S,f),()=>document.removeEventListener(_S,f)),[f]),ie.useEffect(()=>{if(u.trigger){let g=Pt(v=>{v.target instanceof Node&&v.target.contains(u.trigger)&&f()},"handleScroll");return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[u.trigger,f]);let{setContentId:y}=u;return pn(()=>(y(s),()=>{y(void 0)}),[s,y]),(0,Jt.jsx)(kg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:g=>g.preventDefault(),onDismiss:f,children:(0,Jt.jsxs)(t2,{"data-state":u.stateAttribute,role:i?void 0:"tooltip",id:i?void 0:u.contentId,...d,...c,ref:m,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[(0,Jt.jsx)(x7,{children:o}),i?(0,Jt.jsx)(cx,{id:u.contentId,role:"tooltip",children:i}):null]})})},"TooltipContentImpl"));function v2(t,e){let n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),o=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}Pt(v2,"getExitSideFromRect");function b2(t,e,n=5){let r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}Pt(b2,"getPaddedExitPoints");function w2(t){let{top:e,right:n,bottom:r,left:o}=t;return[{x:o,y:e},{x:n,y:e},{x:n,y:r},{x:o,y:r}]}Pt(w2,"getPointsFromRect");function S2(t,e){let{x:n,y:r}=t,o=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){let l=e[i],a=e[s],c=l.x,u=l.y,d=a.x,f=a.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(o=!o)}return o}Pt(S2,"isPointInPolygon");function x2(t){let e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),C2(e)}Pt(x2,"getHull");function C2(t){if(t.length<=1)return t.slice();let e=[];for(let r=0;r<t.length;r++){let o=t[r];for(;e.length>=2;){let i=e[e.length-1],s=e[e.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))e.pop();else break}e.push(o)}e.pop();let n=[];for(let r=t.length-1;r>=0;r--){let o=t[r];for(;n.length>=2;){let i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}Pt(C2,"getHullPresorted");function E2(...t){let e=new Set;for(let n of t)if(typeof n=="string")for(let r of String(n).trim().split(/\s+/))r&&e.add(r);return e.size>0?Array.from(e).join(" "):void 0}Pt(E2,"concatAriaDescribedby");var T2=(0,zg.createContext)(!1);function hx({children:t,delayDuration:e=300}){return(0,Ti.jsx)(T2.Provider,{value:!0,children:(0,Ti.jsx)(h7,{delayDuration:e,skipDelayDuration:150,children:t})})}function C7({content:t,children:e,side:n="top"}){let r=(0,zg.useContext)(T2),o=(0,Ti.jsxs)(m7,{children:[(0,Ti.jsx)(g7,{asChild:!0,children:e}),(0,Ti.jsx)(b7,{children:(0,Ti.jsx)(w7,{className:"ad-tooltip",side:n,sideOffset:6,children:t})})]});return r?o:(0,Ti.jsx)(hx,{children:o})}var kt=(0,Eg.forwardRef)(function({variant:e="secondary",size:n="md",loading:r=!1,type:o="button",className:i,children:s,onClick:l,...a},c){return(0,qs.jsxs)("button",{ref:c,type:o,className:qo("ad-button",`ad-button--${e}`,`ad-button--${n}`,i),onClick:u=>r?u.preventDefault():l?.(u),...a,"aria-busy":r||void 0,"aria-disabled":r||a["aria-disabled"],children:[r&&(0,qs.jsx)("span",{className:"ad-spinner","aria-hidden":"true"}),s,r&&(0,qs.jsx)("span",{className:"ad-sr-only",children:", loading"})]})}),E7=(0,Eg.forwardRef)(function(e,n){let r=e["aria-describedby"]?.split(" ").filter(o=>!o.startsWith("radix-")).join(" ");return(0,qs.jsx)(kt,{ref:n,...e,"aria-describedby":r||void 0})}),sa=(0,Eg.forwardRef)(function({label:e,icon:n,tooltip:r=!0,variant:o="ghost",className:i,...s},l){if(e.trim()==="")throw new Error("IconButton needs a non-empty label.");let a=(0,qs.jsx)(E7,{ref:l,variant:o,className:qo("ad-icon-button",i),...s,"aria-label":s.loading?`${e}, loading`:e,children:s.loading?null:n});return r?(0,qs.jsx)(C7,{content:e,children:a}):a});function yo(t){let{d:e,...n}=t;return(0,er.jsx)("svg",{viewBox:"0 0 20 20",width:"1.25em",height:"1.25em",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...n,children:(0,er.jsx)("path",{d:e})})}var k2=t=>(0,er.jsx)(yo,{d:"M5 5l10 10M15 5L5 15",...t}),A2=t=>(0,er.jsx)(yo,{d:"M10 6v5M10 14h.01M10 2.5l8 14H2z",...t}),T7=t=>(0,er.jsx)(yo,{d:"M4 10.5l4 4 8-9",...t}),M2=t=>(0,er.jsx)(yo,{d:"M10 4v12M4 10h12",...t}),R2=t=>(0,er.jsx)(yo,{d:"M4.5 10h.01M10 10h.01M15.5 10h.01",strokeWidth:"3",...t}),k7=t=>(0,er.jsx)(yo,{d:"M10 9v5M10 6h.01M10 2.5a7.5 7.5 0 100 15 7.5 7.5 0 000-15z",...t}),A7=t=>(0,er.jsx)(yo,{d:"M3.5 5.5h13M3.5 10h13M3.5 14.5h13",...t}),M7=t=>(0,er.jsx)(yo,{d:"M5 2.5h6l4 4v11H5zM11 2.5v4h4",...t}),R7=t=>(0,er.jsx)(yo,{d:"M2.5 5.5h5l1.5 2h8.5v8h-15z",...t}),O7=t=>(0,er.jsx)(yo,{d:"M4 7.5h12v8a1 1 0 01-1 1H5a1 1 0 01-1-1zM10 7.5v-3M7.5 11.5h.01M12.5 11.5h.01",...t}),D7=t=>(0,er.jsx)(yo,{d:"M7.5 7.5l5 5M12.5 7.5l-5 5M10 2.5a7.5 7.5 0 100 15 7.5 7.5 0 000-15z",...t});function Ug(t,{label:e,hint:n,error:r}){if(e==null||e===!1||typeof e=="string"&&e.trim()==="")throw new Error("A field needs a non-empty label.");let o=(0,Xs.useId)(),i=t||o,s=n?`${i}-hint`:void 0,l=r?`${i}-error`:void 0;return{id:i,hintId:s,errorId:l,control:{id:i,"aria-describedby":[s,l].filter(Boolean).join(" ")||void 0,"aria-invalid":r?!0:void 0}}}function Bf(t,e){return[t,e].filter(Boolean).join(" ")||void 0}function N7({hintId:t,errorId:e,hint:n,error:r}){return(0,_e.jsxs)(_e.Fragment,{children:[n&&(0,_e.jsx)("p",{id:t,className:"ad-field__hint",children:n}),r&&(0,_e.jsxs)("p",{id:e,className:"ad-field__error",role:"alert",children:[(0,_e.jsx)(A2,{}),r]})]})}function px({id:t,label:e,hideLabel:n,required:r,children:o,...i}){return(0,_e.jsxs)("div",{className:"ad-field",children:[(0,_e.jsxs)("label",{className:qo("ad-field__label",n&&"ad-sr-only"),htmlFor:t,children:[e,r&&(0,_e.jsx)("span",{"aria-hidden":"true",children:" *"})]}),o,(0,_e.jsx)(N7,{...i})]})}var Ws=(0,Xs.forwardRef)(function({label:e,hint:n,error:r,className:o,id:i,...s},l){let a=Ug(i,{label:e,hint:n,error:r});return(0,_e.jsx)(px,{...a,label:e,hint:n,error:r,required:s.required,children:(0,_e.jsx)("input",{ref:l,className:qo("ad-input",o),...s,...a.control,"aria-describedby":Bf(a.control["aria-describedby"],s["aria-describedby"]),"aria-invalid":a.control["aria-invalid"]??s["aria-invalid"]})})}),Soe=(0,Xs.forwardRef)(function({label:e,hint:n,error:r,className:o,id:i,...s},l){let a=Ug(i,{label:e,hint:n,error:r});return(0,_e.jsx)(px,{...a,label:e,hint:n,error:r,required:s.required,children:(0,_e.jsx)("textarea",{ref:l,className:qo("ad-input ad-textarea",o),...s,...a.control,"aria-describedby":Bf(a.control["aria-describedby"],s["aria-describedby"]),"aria-invalid":a.control["aria-invalid"]??s["aria-invalid"]})})}),O2=(0,Xs.forwardRef)(function({label:e,hideLabel:n,hint:r,error:o,className:i,id:s,children:l,...a},c){let u=Ug(s,{label:e,hint:r,error:o});return(0,_e.jsx)(px,{...u,label:e,hideLabel:n,hint:r,error:o,required:a.required,children:(0,_e.jsx)("span",{className:"ad-select",children:(0,_e.jsx)("select",{ref:c,className:qo("ad-input",i),...a,...u.control,"aria-describedby":Bf(u.control["aria-describedby"],a["aria-describedby"]),"aria-invalid":u.control["aria-invalid"]??a["aria-invalid"],children:l})})})});function D2(t,e,n){let{id:r,hintId:o,control:i}=Ug(t,{label:e,hint:n});return{id:r,hintId:o,describedBy:i["aria-describedby"]}}var xoe=(0,Xs.forwardRef)(function({label:e,hint:n,className:r,id:o,...i},s){let{id:l,hintId:a,describedBy:c}=D2(o,e,n);return(0,_e.jsxs)("div",{className:"ad-toggle",children:[(0,_e.jsxs)("label",{className:"ad-toggle__row",htmlFor:l,children:[(0,_e.jsx)("input",{ref:s,id:l,type:"checkbox",className:qo("ad-checkbox",r),...i,"aria-describedby":Bf(c,i["aria-describedby"])}),(0,_e.jsx)("span",{children:e})]}),n&&(0,_e.jsx)("p",{id:a,className:"ad-field__hint",children:n})]})}),Coe=(0,Xs.forwardRef)(function({label:e,hint:n,className:r,id:o,...i},s){let{id:l,hintId:a,describedBy:c}=D2(o,e,n);return(0,_e.jsxs)("div",{className:"ad-toggle",children:[(0,_e.jsxs)("label",{className:"ad-toggle__row",htmlFor:l,children:[(0,_e.jsx)("input",{ref:s,id:l,type:"checkbox",role:"switch",className:qo("ad-switch",r),...i,"aria-describedby":Bf(c,i["aria-describedby"])}),(0,_e.jsx)("span",{children:e})]}),n&&(0,_e.jsx)("p",{id:a,className:"ad-field__hint",children:n})]})}),_7=Object.defineProperty,mx=(t,e)=>_7(t,"name",{value:e,configurable:!0}),ig=0,Wc=null;function I7(t){return Pg(),t.children}mx(I7,"FocusGuards");function Pg(){N2.useEffect(()=>{Wc||(Wc={start:LS(),end:LS()});let{start:t,end:e}=Wc;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),ig++,()=>{ig===1&&(Wc?.start.remove(),Wc?.end.remove(),Wc=null),ig=Math.max(0,ig-1)}},[])}mx(Pg,"useFocusGuards");function LS(){let t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}mx(LS,"createFocusGuard");var Vo=function(){return Vo=Object.assign||function(e){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Vo.apply(this,arguments)};function _2(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n}function L7(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var dg="right-scroll-bar-position",fg="width-before-scroll-bar",z7="with-scroll-bars-hidden",U7="--removed-body-scroll-bar-size";function gS(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function P7(t,e){var n=(0,I2.useState)(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=e,n.facade}var B7=typeof window<"u"?Hg.useLayoutEffect:Hg.useEffect,UN=new WeakMap;function H7(t,e){var n=P7(e||null,function(r){return t.forEach(function(o){return gS(o,r)})});return B7(function(){var r=UN.get(n);if(r){var o=new Set(r),i=new Set(t),s=n.current;o.forEach(function(l){i.has(l)||gS(l,null)}),i.forEach(function(l){o.has(l)||gS(l,s)})}UN.set(n,t)},[t]),n}function j7(t){return t}function V7(t,e){e===void 0&&(e=j7);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(i){var s=e(i,r);return n.push(s),function(){n=n.filter(function(l){return l!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var l=n;n=[],l.forEach(i),s=n}var a=function(){var u=s;s=[],u.forEach(i)},c=function(){return Promise.resolve().then(a)};c(),n={push:function(u){s.push(u),c()},filter:function(u){return s=s.filter(u),n}}}};return o}function F7(t){t===void 0&&(t={});var e=V7(null);return e.options=Vo({async:!0,ssr:!1},t),e}var z2=function(t){var e=t.sideCar,n=_2(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return L2.createElement(r,Vo({},n))};z2.isSideCarExport=!0;function $7(t,e){return t.useMedium(e),z2}var U2=F7(),yS=function(){},jg=An.forwardRef(function(t,e){var n=An.useRef(null),r=An.useState({onScrollCapture:yS,onWheelCapture:yS,onTouchMoveCapture:yS}),o=r[0],i=r[1],s=t.forwardProps,l=t.children,a=t.className,c=t.removeScrollBar,u=t.enabled,d=t.shards,f=t.sideCar,h=t.noRelative,p=t.noIsolation,m=t.inert,y=t.allowPinchZoom,g=t.as,v=g===void 0?"div":g,b=t.gapMode,w=_2(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,C=H7([n,e]),x=Vo(Vo({},w),o);return An.createElement(An.Fragment,null,u&&An.createElement(S,{sideCar:U2,removeScrollBar:c,shards:d,noRelative:h,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:b}),s?An.cloneElement(An.Children.only(l),Vo(Vo({},x),{ref:C})):An.createElement(v,Vo({},x,{className:a,ref:C}),l))});jg.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};jg.classNames={fullWidth:fg,zeroRight:dg};var PN,Y7=function(){if(PN)return PN;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function q7(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Y7();return e&&t.setAttribute("nonce",e),t}function K7(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function G7(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var X7=function(){var t=0,e=null;return{add:function(n){t==0&&(e=q7())&&(K7(e,n),G7(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},W7=function(){var t=X7();return function(e,n){P2.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},B2=function(){var t=W7(),e=function(n){var r=n.styles,o=n.dynamic;return t(r,o),null};return e},J7={left:0,top:0,right:0,gap:0},vS=function(t){return parseInt(t||"",10)||0},Q7=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],o=e[t==="padding"?"paddingRight":"marginRight"];return[vS(n),vS(r),vS(o)]},Z7=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return J7;var e=Q7(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},e$=B2(),ru="data-scroll-locked",t$=function(t,e,n,r){var o=t.left,i=t.top,s=t.right,l=t.gap;return n===void 0&&(n="margin"),`
|
|
10
|
+
.`.concat(z7,` {
|
|
11
|
+
overflow: hidden `).concat(r,`;
|
|
12
|
+
padding-right: `).concat(l,"px ").concat(r,`;
|
|
13
|
+
}
|
|
14
|
+
body[`).concat(ru,`] {
|
|
15
|
+
overflow: hidden `).concat(r,`;
|
|
16
|
+
overscroll-behavior: contain;
|
|
17
|
+
`).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
18
|
+
padding-left: `.concat(o,`px;
|
|
19
|
+
padding-top: `).concat(i,`px;
|
|
20
|
+
padding-right: `).concat(s,`px;
|
|
21
|
+
margin-left:0;
|
|
22
|
+
margin-top:0;
|
|
23
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
24
|
+
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.`).concat(dg,` {
|
|
28
|
+
right: `).concat(l,"px ").concat(r,`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.`).concat(fg,` {
|
|
32
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.`).concat(dg," .").concat(dg,` {
|
|
36
|
+
right: 0 `).concat(r,`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.`).concat(fg," .").concat(fg,` {
|
|
40
|
+
margin-right: 0 `).concat(r,`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
body[`).concat(ru,`] {
|
|
44
|
+
`).concat(U7,": ").concat(l,`px;
|
|
45
|
+
}
|
|
46
|
+
`)},BN=function(){var t=parseInt(document.body.getAttribute(ru)||"0",10);return isFinite(t)?t:0},n$=function(){uu.useEffect(function(){return document.body.setAttribute(ru,(BN()+1).toString()),function(){var t=BN()-1;t<=0?document.body.removeAttribute(ru):document.body.setAttribute(ru,t.toString())}},[])},r$=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,o=r===void 0?"margin":r;n$();var i=uu.useMemo(function(){return Z7(o)},[o]);return uu.createElement(e$,{styles:t$(i,!e,o,n?"":"!important")})},zS=!1;if(typeof window<"u")try{Rf=Object.defineProperty({},"passive",{get:function(){return zS=!0,!0}}),window.addEventListener("test",Rf,Rf),window.removeEventListener("test",Rf,Rf)}catch{zS=!1}var Rf,Jc=zS?{passive:!1}:!1,o$=function(t){return t.tagName==="TEXTAREA"},H2=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!o$(t)&&n[e]==="visible")},i$=function(t){return H2(t,"overflowY")},s$=function(t){return H2(t,"overflowX")},HN=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=j2(t,r);if(o){var i=V2(t,r),s=i[1],l=i[2];if(s>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},l$=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},a$=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},j2=function(t,e){return t==="v"?i$(e):s$(e)},V2=function(t,e){return t==="v"?l$(e):a$(e)},c$=function(t,e){return t==="h"&&e==="rtl"?-1:1},u$=function(t,e,n,r,o){var i=c$(t,window.getComputedStyle(e).direction),s=i*r,l=n.target,a=e.contains(l),c=!1,u=s>0,d=0,f=0;do{if(!l)break;var h=V2(t,l),p=h[0],m=h[1],y=h[2],g=m-y-i*p;(p||g)&&j2(t,l)&&(d+=g,f+=p);var v=l.parentNode;l=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!a&&l!==document.body||a&&(e.contains(l)||e===l));return(u&&(o&&Math.abs(d)<1||!o&&s>d)||!u&&(o&&Math.abs(f)<1||!o&&-s>f))&&(c=!0),c},sg=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},jN=function(t){return[t.deltaX,t.deltaY]},VN=function(t){return t&&"current"in t?t.current:t},d$=function(t,e){return t[0]===e[0]&&t[1]===e[1]},f$=function(t){return`
|
|
47
|
+
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
48
|
+
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
49
|
+
`)},h$=0,Qc=[];function p$(t){var e=Qe.useRef([]),n=Qe.useRef([0,0]),r=Qe.useRef(),o=Qe.useState(h$++)[0],i=Qe.useState(B2)[0],s=Qe.useRef(t);Qe.useEffect(function(){s.current=t},[t]),Qe.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=L7([t.lockRef.current],(t.shards||[]).map(VN),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var l=Qe.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var g=sg(m),v=n.current,b="deltaX"in m?m.deltaX:v[0]-g[0],w="deltaY"in m?m.deltaY:v[1]-g[1],S,C=m.target,x=Math.abs(b)>Math.abs(w)?"h":"v";if("touches"in m&&x==="h"&&C.type==="range")return!1;var E=window.getSelection(),k=E&&E.anchorNode,T=k?k===C||k.contains(C):!1;if(T)return!1;var _=HN(x,C);if(!_)return!0;if(_?S=x:(S=x==="v"?"h":"v",_=HN(x,C)),!_)return!1;if(!r.current&&"changedTouches"in m&&(b||w)&&(r.current=S),!S)return!0;var z=r.current||S;return u$(z,y,m,z==="h"?b:w,!0)},[]),a=Qe.useCallback(function(m){var y=m;if(!(!Qc.length||Qc[Qc.length-1]!==i)){var g="deltaY"in y?jN(y):sg(y),v=e.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&d$(S.delta,g)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var b=(s.current.shards||[]).map(VN).filter(Boolean).filter(function(S){return S.contains(y.target)}),w=b.length>0?l(y,b[0]):!s.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),c=Qe.useCallback(function(m,y,g,v){var b={name:m,delta:y,target:g,should:v,shadowParent:m$(g)};e.current.push(b),setTimeout(function(){e.current=e.current.filter(function(w){return w!==b})},1)},[]),u=Qe.useCallback(function(m){n.current=sg(m),r.current=void 0},[]),d=Qe.useCallback(function(m){c(m.type,jN(m),m.target,l(m,t.lockRef.current))},[]),f=Qe.useCallback(function(m){c(m.type,sg(m),m.target,l(m,t.lockRef.current))},[]);Qe.useEffect(function(){return Qc.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",a,Jc),document.addEventListener("touchmove",a,Jc),document.addEventListener("touchstart",u,Jc),function(){Qc=Qc.filter(function(m){return m!==i}),document.removeEventListener("wheel",a,Jc),document.removeEventListener("touchmove",a,Jc),document.removeEventListener("touchstart",u,Jc)}},[]);var h=t.removeScrollBar,p=t.inert;return Qe.createElement(Qe.Fragment,null,p?Qe.createElement(i,{styles:f$(o)}):null,h?Qe.createElement(r$,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function m$(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var g$=$7(U2,p$),F2=Bg.forwardRef(function(t,e){return Bg.createElement(jg,Vo({},t,{ref:e,sideCar:g$}))});F2.classNames=jg.classNames;var $2=F2,y$=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Zc=new WeakMap,lg=new WeakMap,ag={},bS=0,Y2=function(t){return t&&(t.host||Y2(t.parentNode))},v$=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Y2(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},b$=function(t,e,n,r){var o=v$(e,Array.isArray(t)?t:[t]);ag[n]||(ag[n]=new WeakMap);var i=ag[n],s=[],l=new Set,a=new Set(o),c=function(d){!d||l.has(d)||(l.add(d),c(d.parentNode))};o.forEach(c);var u=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(f){if(l.has(f))u(f);else try{var h=f.getAttribute(r),p=h!==null&&h!=="false",m=(Zc.get(f)||0)+1,y=(i.get(f)||0)+1;Zc.set(f,m),i.set(f,y),s.push(f),m===1&&p&&lg.set(f,!0),y===1&&f.setAttribute(n,"true"),p||f.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return u(e),l.clear(),bS++,function(){s.forEach(function(d){var f=Zc.get(d)-1,h=i.get(d)-1;Zc.set(d,f),i.set(d,h),f||(lg.has(d)||d.removeAttribute(r),lg.delete(d)),h||d.removeAttribute(n)}),bS--,bS||(Zc=new WeakMap,Zc=new WeakMap,lg=new WeakMap,ag={})}},q2=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),o=e||y$(t);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),b$(r,o,n,"aria-hidden")):function(){return null}},w$=Object.defineProperty,nr=(t,e)=>w$(t,"name",{value:e,configurable:!0}),gx="Dialog",[K2,Eoe]=Ar(gx),[S$,vo]=K2(gx),x$=nr(t=>{let{__scopeDialog:e,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=t,l=ze.useRef(null),a=ze.useRef(null),{nodes:c,registry:u}=ZS(),[d,f]=cu({prop:r,defaultProp:o??!1,onChange:i,caller:gx}),[h,p]=ze.useState(0),[m,y]=ze.useState(0);return(0,vt.jsx)(S$,{scope:e,triggerRef:l,contentRef:a,contentId:Bs(),titleId:Bs(),descriptionId:Bs(),titlePresent:h>0,descriptionPresent:m>0,setTitleCount:p,setDescriptionCount:y,open:d,onOpenChange:f,onOpenToggle:ze.useCallback(()=>f(g=>!g),[f]),modal:s,branchNodes:c,branchRegistry:u,children:n})},"Dialog"),C$="DialogTrigger",E$=ze.forwardRef(nr(function(e,n){let{__scopeDialog:r,...o}=e,i=vo(C$,r),s=Je(n,i.triggerRef);return(0,vt.jsx)(Ve.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Vg(i.open),...o,ref:s,onClick:Z(e.onClick,i.onOpenToggle)})},"DialogTrigger")),G2="DialogPortal",[T$,X2]=K2(G2,{forceMount:void 0}),k$=nr(t=>{let{__scopeDialog:e,forceMount:n,children:r,container:o}=t,i=vo(G2,e);return(0,vt.jsx)(T$,{scope:e,forceMount:n,children:ze.Children.map(r,s=>(0,vt.jsx)(Gs,{present:n||i.open,children:(0,vt.jsx)(Lg,{asChild:!0,container:o,children:s})}))})},"DialogPortal"),US="DialogOverlay",A$=ze.forwardRef(nr(function(e,n){let r=X2(US,e.__scopeDialog),{forceMount:o=r.forceMount,...i}=e,s=vo(US,e.__scopeDialog);return s.modal?(0,vt.jsx)(Gs,{present:o||s.open,children:(0,vt.jsx)(R$,{...i,ref:n})}):null},"DialogOverlay")),M$=Fs("DialogOverlay.RemoveScroll"),R$=ze.forwardRef(nr(function(e,n){let{__scopeDialog:r,...o}=e,i=vo(US,r),s=C_(),l=Je(n,s);return(0,vt.jsx)($2,{as:M$,allowPinchZoom:!0,shards:ze.useMemo(()=>[i.contentRef,...i.branchNodes.map(a=>({current:a}))],[i.contentRef,i.branchNodes]),children:(0,vt.jsx)(Ve.div,{"data-state":Vg(i.open),...o,ref:l,style:{pointerEvents:"auto",...o.style}})})},"DialogOverlayImpl")),If="DialogContent",O$=ze.forwardRef(nr(function(e,n){let r=X2(If,e.__scopeDialog),{forceMount:o=r.forceMount,...i}=e,s=vo(If,e.__scopeDialog);return(0,vt.jsx)(Gs,{present:o||s.open,children:s.modal?(0,vt.jsx)(D$,{...i,ref:n}):(0,vt.jsx)(N$,{...i,ref:n})})},"DialogContent")),D$=ze.forwardRef(nr(function(e,n){let r=vo(If,e.__scopeDialog),o=ze.useRef(null),i=Je(n,r.contentRef,o);return ze.useEffect(()=>{let s=o.current;if(s)return q2(s)},[]),(0,vt.jsx)(W2,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Z(e.onCloseAutoFocus,s=>{s.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Z(e.onPointerDownOutside,s=>{let l=s.detail.originalEvent,a=l.button===0&&l.ctrlKey===!0;(l.button===2||a)&&s.preventDefault()}),onFocusOutside:Z(e.onFocusOutside,s=>s.preventDefault())})},"DialogContentModal")),N$=ze.forwardRef(nr(function(e,n){let r=vo(If,e.__scopeDialog),o=ze.useRef(!1),i=ze.useRef(!1);return(0,vt.jsx)(W2,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(o.current||r.triggerRef.current?.focus(),s.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));let l=s.target;r.triggerRef.current?.contains(l)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})},"DialogContentNonModal")),W2=ze.forwardRef(nr(function(e,n){let{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,"aria-describedby":l,children:a,...c}=e,u=vo(If,r);return Pg(),(0,vt.jsx)(QS,{registry:u.branchRegistry,children:(0,vt.jsx)(k_,{asChild:!0,loop:!0,trapped:o,branches:u.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:s,children:(0,vt.jsx)(kg,{role:"dialog",id:u.contentId,"aria-labelledby":u.titlePresent?u.titleId:void 0,"aria-describedby":u.descriptionPresent?Q2(l,u.descriptionId):l,"data-state":Vg(u.open),...c,ref:n,deferPointerDownOutside:!0,onDismiss:()=>u.onOpenChange(!1),children:a})})})},"DialogContentImpl")),_$=ze.forwardRef(nr(function(e,n){let{__scopeDialog:r,...o}=e,i=vo("DialogTitle",r),{setTitleCount:s}=i;return pn(()=>(s(l=>l+1),()=>s(l=>l-1)),[s]),(0,vt.jsx)(Ve.h2,{id:i.titleId,...o,ref:n})},"DialogTitle")),I$=ze.forwardRef(nr(function(e,n){let{__scopeDialog:r,...o}=e,i=vo("DialogDescription",r),{setDescriptionCount:s}=i;return pn(()=>(s(l=>l+1),()=>s(l=>l-1)),[s]),(0,vt.jsx)(Ve.p,{id:i.descriptionId,...o,ref:n})},"DialogDescription")),L$="DialogClose",J2=ze.forwardRef(nr(function(e,n){let{__scopeDialog:r,...o}=e,i=vo(L$,r);return(0,vt.jsx)(Ve.button,{type:"button",...o,ref:n,onClick:Z(e.onClick,()=>i.onOpenChange(!1))})},"DialogClose"));function Q2(...t){let e=new Set;for(let n of t)if(typeof n=="string")for(let r of String(n).trim().split(/\s+/))r&&e.add(r);return e.size>0?Array.from(e).join(" "):void 0}nr(Q2,"concatAriaDescribedby");function Vg(t){return t?"open":"closed"}nr(Vg,"getState");var z$=Object.defineProperty,zt=(t,e)=>z$(t,"name",{value:e,configurable:!0});function Fg(t){let e=t+"CollectionProvider",[n,r]=Ar(e),[o,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=zt(m=>{let{scope:y,children:g}=m,v=go.useRef(null),b=go.useRef(new Map).current;return(0,hg.jsx)(o,{scope:y,itemMap:b,collectionRef:v,children:g})},"CollectionProvider");s.displayName=e;let l=t+"CollectionSlot",a=Fs(l),c=go.forwardRef((m,y)=>{let{scope:g,children:v}=m,b=i(l,g),w=Je(y,b.collectionRef);return(0,hg.jsx)(a,{ref:w,children:v})});c.displayName=l;let u=t+"CollectionItemSlot",d="data-radix-collection-item",f=Fs(u),h=go.forwardRef((m,y)=>{let{scope:g,children:v,...b}=m,w=go.useRef(null),S=Je(y,w),C=i(u,g);return go.useEffect(()=>(C.itemMap.set(w,{ref:w,...b}),()=>{C.itemMap.delete(w)})),(0,hg.jsx)(f,{[d]:"",ref:S,children:v})});h.displayName=u;function p(m){let y=i(t+"CollectionConsumer",m);return go.useCallback(()=>{let v=y.collectionRef.current;if(!v)return[];let b=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((C,x)=>b.indexOf(C.ref.current)-b.indexOf(x.ref.current))},[y.collectionRef,y.itemMap])}return zt(p,"useCollection"),[{Provider:s,Slot:c,ItemSlot:h},p,r]}zt(Fg,"createCollection");var FN=new WeakMap,cg=class Ps extends Map{static{zt(this,"OrderedDict")}#e;constructor(e){super(e),this.#e=[...super.keys()],FN.set(this,!0)}set(e,n){return FN.get(this)&&!this.has(e)&&this.#e.push(e),super.set(e,n),this}insert(e,n,r){let o=this.has(n),i=o?this.size:this.size+1,s=yx(e),l=s>=0?Math.min(s,i-1):Math.max(i+s,0);if(o?this.#e.indexOf(n)===l:l===this.size)return this.set(n,r),this;let a=this.#e.filter(u=>u!==n);a.splice(l,0,n);let c=a.map(u=>[u,u===n?r:this.get(u)]);this.clear();for(let[u,d]of c)this.set(u,d);return this}with(e,n,r){let o=new Ps(this);return o.insert(e,n,r),o}before(e){let n=this.#e.indexOf(e)-1;if(!(n<0))return this.entryAt(n)}setBefore(e,n,r){let o=this.#e.indexOf(e);if(o===-1)return this;let i=this.#e.indexOf(n),s=i!==-1&&i<o?o-1:o;return this.insert(s,n,r)}after(e){let n=this.#e.indexOf(e);if(n=n===-1||n===this.size-1?-1:n+1,n!==-1)return this.entryAt(n)}setAfter(e,n,r){let o=this.#e.indexOf(e);if(o===-1)return this;let i=this.#e.indexOf(n),s=i!==-1&&i<=o?o:o+1;return this.insert(s,n,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let n=super.delete(e);return n&&this.#e.splice(this.#e.indexOf(e),1),n}deleteAt(e){let n=this.keyAt(e);return n!==void 0?this.delete(n):!1}at(e){let n=pg(this.#e,e);if(n!==void 0)return this.get(n)}entryAt(e){let n=pg(this.#e,e);if(n!==void 0)return[n,this.get(n)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return pg(this.#e,e)}from(e,n){let r=this.indexOf(e);if(r===-1)return;let o=r+n;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.at(o)}keyFrom(e,n){let r=this.indexOf(e);if(r===-1)return;let o=r+n;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.keyAt(o)}find(e,n){let r=0;for(let o of this){if(Reflect.apply(e,n,[o,r,this]))return o;r++}}findIndex(e,n){let r=0;for(let o of this){if(Reflect.apply(e,n,[o,r,this]))return r;r++}return-1}filter(e,n){let r=[],o=0;for(let i of this)Reflect.apply(e,n,[i,o,this])&&r.push(i),o++;return new Ps(r)}map(e,n){let r=[],o=0;for(let i of this)r.push([i[0],Reflect.apply(e,n,[i,o,this])]),o++;return new Ps(r)}reduce(...e){let[n,r]=e,o=e.length>1;if(!o&&this.size===0)throw new TypeError("Reduce of empty OrderedDict with no initial value");let i=0,s=r;for(let l of this)i===0&&!o?s=l:s=Reflect.apply(n,this,[s,l,i,this]),i++;return s}reduceRight(...e){let[n,r]=e,o=e.length>1;if(!o&&this.size===0)throw new TypeError("Reduce of empty OrderedDict with no initial value");let i=r;for(let s=this.size-1;s>=0;s--){let l=this.entryAt(s);s===this.size-1&&!o?i=l:i=Reflect.apply(n,this,[i,l,s,this])}return i}sort(e){if(typeof e!="function")throw new TypeError("OrderedDict.sort requires a compare function");let n=[...this.entries()].sort(e);this.clear();for(let[r,o]of n)this.set(r,o);return this}toSorted(e){if(typeof e!="function")throw new TypeError("OrderedDict.toSorted requires a compare function");let n=[...this.entries()].sort(e);return new Ps(n)}toReversed(){let e=new Ps;for(let n=this.size-1;n>=0;n--){let r=this.keyAt(n),o=this.get(r);e.set(r,o)}return e}toSpliced(...e){let n=[...this.entries()];return n.splice(...e),new Ps(n)}slice(e,n){let r=new Ps;for(let o of this.#e.slice(e,n))r.set(o,this.get(o));return r}every(e,n){let r=0;for(let o of this){if(!Reflect.apply(e,n,[o,r,this]))return!1;r++}return!0}some(e,n){let r=0;for(let o of this){if(Reflect.apply(e,n,[o,r,this]))return!0;r++}return!1}};function pg(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);let n=Z2(t,e);return n===-1?void 0:t[n]}zt(pg,"at");function Z2(t,e){let n=t.length,r=yx(e),o=r>=0?r:n+r;return o<0||o>=n?-1:o}zt(Z2,"toSafeIndex");function yx(t){return t!==t||t===0?0:Math.trunc(t)}zt(yx,"toSafeInteger");function U$(t){let e=t+"CollectionProvider",[n,r]=Ar(e),[o,i]=n(e);o.displayName=t+"CollectionStableContextProvider";let[s,l]=n(e);s.displayName=t+"CollectionStatefulContextProvider";let a=zt(({state:C,...x})=>C?(0,Us.jsx)(u,{...x,state:C}):(0,Us.jsx)(c,{...x}),"CollectionProvider");a.displayName=e;let c=zt(C=>{let x=v();return(0,Us.jsx)(u,{...C,state:x})},"CollectionInit");c.displayName=t+"CollectionInit";let u=zt(C=>{let{scope:x,children:E,state:k}=C,T=Ut.useRef(null),[_,z]=Ut.useState(null),$=Je(T,z),[I,V]=k,D=Ut.useRef(new cg),q=Ut.useCallback(()=>{let U=D.current;return nI(U)||U.sort(mg),U},[]);return Ut.useEffect(()=>{if(!_)return;let U=rI(()=>{V(re=>{let Y=re.toSorted(mg);return Y.some(([rn],ct)=>re.keyAt(ct)!==rn)?Y:re})});return U.observe(_,{childList:!0,subtree:!0}),()=>{U.disconnect()}},[_,V]),(0,Us.jsx)(o,{scope:x,collectionElementRef:$,collectionElementRefObject:T,getCollection:q,setCollection:V,registryRef:D,children:(0,Us.jsx)(s,{scope:x,collectionElement:_,collection:I,children:E})})},"CollectionProviderImpl");u.displayName=t+"CollectionProviderImpl";let d=t+"CollectionSlot",f=Fs(d),h=Ut.forwardRef((C,x)=>{let{scope:E,children:k}=C,T=i(d,E),_=Je(x,T.collectionElementRef);return(0,Us.jsx)(f,{ref:_,children:k})});h.displayName=d;let p=t+"CollectionItemSlot",m="data-radix-collection-item",y=Fs(p),g=Ut.forwardRef((C,x)=>{let{scope:E,children:k,...T}=C,_=Ut.useRef(null),z=i(p,E),{setCollection:$,registryRef:I}=z,V=Ut.useRef(T);eI(V.current,T)||(V.current=T);let D=V.current,q=Ut.useCallback(Y=>{let Te=I.current;Y?Te.set(Y,{...V.current,element:Y}):_.current&&Te.delete(_.current)},[I]),U=Je(x,q,_);pn(()=>{let Y=_.current,Te=I.current;Y&&Te.has(Y)&&Te.set(Y,{...D,element:Y})},[D,I]);let re=Ut.useRef(null);return Ut.useEffect(()=>{let Y=_.current,Te=re.current;(Te?.element??null)===Y&&(!Y||Te?.itemData===D)||(re.current=Y?{element:Y,itemData:D}:null,$(rn=>{let ct=new cg(rn);return Te&&Te.element!==Y&&ct.delete(Te.element),Y&&ct.set(Y,{...D,element:Y}),ct.sort(mg)}))}),Ut.useEffect(()=>()=>{let Y=re.current;re.current=null,Y&&$(Te=>{if(!Te.has(Y.element))return Te;let rn=new cg(Te);return rn.delete(Y.element),rn})},[$]),(0,Us.jsx)(y,{[m]:"",ref:U,children:k})});g.displayName=p;function v(){return Ut.useState(new cg)}zt(v,"useInitCollection");function b(C){let{collection:x}=l(t+"CollectionConsumer",C);return x}zt(b,"useCollection");function w(C){let{getCollection:x}=i(t+"CollectionConsumer",C);return x}return zt(w,"useGetCollection"),[{Provider:a,Slot:h,ItemSlot:g},{createCollectionScope:r,useCollection:b,useGetCollection:w,useInitCollection:v}]}zt(U$,"createCollection");function eI(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;let n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||t[o]!==e[o])return!1;return!0}zt(eI,"shallowEqual");function tI(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}zt(tI,"isElementPreceding");function nI(t){let e;for(let n of t.keys()){if(e){let r=e.compareDocumentPosition(n);if(!(r&Node.DOCUMENT_POSITION_DISCONNECTED)&&r&Node.DOCUMENT_POSITION_PRECEDING)return!1}e=n}return!0}zt(nI,"isInDocumentOrder");function mg(t,e){return!t[1].element||!e[1].element?0:tI(t[1].element,e[1].element)?-1:1}zt(mg,"sortByDocumentPosition");function rI(t){return new MutationObserver(n=>{for(let r of n)if(r.type==="childList"){t();return}})}zt(rI,"getChildListObserver");var P$=Object.defineProperty,B$=(t,e)=>P$(t,"name",{value:e,configurable:!0}),H$={LTR:"ltr",RTL:"rtl"},j$=$g.createContext(void 0);function Yg(t){let e=$g.useContext(j$);return t||e||H$.LTR}B$(Yg,"useDirection");var F$=Object.defineProperty,vx=(t,e)=>F$(t,"name",{value:e,configurable:!0}),wS=!1;function oI(){let[t,e]=qg.useState(wS);return qg.useEffect(()=>{wS||(wS=!0,e(!0))},[]),t}vx(oI,"useIsHydrated");var iI=V$[" useSyncExternalStore ".trim().toString()];function sI(){return()=>{}}vx(sI,"subscribe");function lI(){return iI(sI,()=>!0,()=>!1)}vx(lI,"useIsHydratedModern");var $$=typeof iI=="function"?lI:oI,Y$=Object.defineProperty,la=(t,e)=>Y$(t,"name",{value:e,configurable:!0}),SS="rovingFocusGroup.onEntryFocus",q$={bubbles:!1,cancelable:!0},Kg="RovingFocusGroup",[PS,aI,K$]=Fg(Kg),[G$,Js]=Ar(Kg,[K$]),$N={Vertical:"vertical",Horizontal:"horizontal"},X$={LTR:"ltr",RTL:"rtl"},[W$,J$]=G$(Kg),cI=Wt.forwardRef(la(function(e,n){return(0,js.jsx)(PS.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,js.jsx)(PS.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,js.jsx)(Q$,{...e,ref:n})})})},"RovingFocusGroup")),Q$=Wt.forwardRef(la(function(e,n){let{__scopeRovingFocusGroup:r,orientation:o,loop:i=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=Wt.useRef(null),p=Je(n,h),m=Yg(s),[y,g]=cu({prop:l,defaultProp:a??null,onChange:c,caller:Kg}),[v,b]=Wt.useState(!1),w=kr(u),S=aI(r),C=Wt.useRef(!1),[x,E]=Wt.useState(0);return Wt.useEffect(()=>{let k=h.current;if(k)return k.addEventListener(SS,w),()=>k.removeEventListener(SS,w)},[w]),(0,js.jsx)(W$,{scope:r,orientation:o,dir:m,loop:i,currentTabStopId:y,onItemFocus:Wt.useCallback(k=>g(k),[g]),onItemShiftTab:Wt.useCallback(()=>b(!0),[]),onFocusableItemAdd:Wt.useCallback(()=>E(k=>k+1),[]),onFocusableItemRemove:Wt.useCallback(()=>E(k=>k-1),[]),children:(0,js.jsx)(Ve.div,{tabIndex:v||x===0?-1:0,"data-orientation":o,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:Z(e.onMouseDown,()=>{C.current=!0}),onFocus:Z(e.onFocus,k=>{let T=!C.current;if(k.target===k.currentTarget&&T&&!v){let _=new CustomEvent(SS,q$);if(k.currentTarget.dispatchEvent(_),!_.defaultPrevented){let z=S().filter(q=>q.focusable),$=z.find(q=>q.active),I=z.find(q=>q.id===y),D=[$,I,...z].filter(Boolean).map(q=>q.ref.current);bx(D,d)}}C.current=!1}),onBlur:Z(e.onBlur,()=>b(!1))})})},"RovingFocusGroupImpl")),Z$="RovingFocusGroupItem",uI=Wt.forwardRef(la(function(e,n){let{__scopeRovingFocusGroup:r,focusable:o=!0,active:i=!1,tabStopId:s,children:l,...a}=e,c=Bs(),u=s||c,d=J$(Z$,r),f=d.currentTabStopId===u,h=aI(r),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:y}=d,g=$$();return pn(()=>{if(!(!g||!o))return p(),()=>m()},[g,o,p,m]),Wt.useEffect(()=>{if(!(g||!o))return p(),()=>m()},[g,o,p,m]),(0,js.jsx)(PS.ItemSlot,{scope:r,id:u,focusable:o,active:i,children:(0,js.jsx)(Ve.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...a,ref:n,onMouseDown:Z(e.onMouseDown,v=>{o?d.onItemFocus(u):v.preventDefault()}),onFocus:Z(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:Z(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;let b=fI(v,d.orientation,d.dir);if(b!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let S=h().filter(C=>C.focusable).map(C=>C.ref.current);if(b==="last")S.reverse();else if(b==="prev"||b==="next"){b==="prev"&&S.reverse();let C=S.indexOf(v.currentTarget);S=d.loop?hI(S,C+1):S.slice(C+1)}setTimeout(()=>bx(S))}}),children:typeof l=="function"?l({isCurrentTabStop:f,hasTabStop:y!=null}):l})})},"RovingFocusGroupItem")),e9={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function dI(t,e){return e!==X$.RTL?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}la(dI,"getDirectionAwareKey");function fI(t,e,n){let r=dI(t.key,n);if(!(e===$N.Vertical&&["ArrowLeft","ArrowRight"].includes(r))&&!(e===$N.Horizontal&&["ArrowUp","ArrowDown"].includes(r)))return e9[r]}la(fI,"getFocusIntent");function bx(t,e=!1){let n=document.activeElement;for(let r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}la(bx,"focusFirst");function hI(t,e){return t.map((n,r)=>t[(e+r)%t.length])}la(hI,"wrapArray");var t9=Object.defineProperty,We=(t,e)=>t9(t,"name",{value:e,configurable:!0}),BS=["Enter"," "],n9=["ArrowDown","PageUp","Home"],pI=["ArrowUp","PageDown","End"],r9=[...n9,...pI],Aoe={ltr:[...BS,"ArrowRight"],rtl:[...BS,"ArrowLeft"]},Gg="Menu",[HS,o9,i9]=Fg(Gg),[aa,mI]=Ar(Gg,[i9,Ng,Js]),wx=Ng(),gI=Js(),[s9,Hf]=aa(Gg),[l9,Sx]=aa(Gg),a9=We(t=>{let{__scopeMenu:e,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=t,l=wx(e),[a,c]=ne.useState(null),u=ne.useRef(!1),d=kr(i),f=Yg(o);return ne.useEffect(()=>{let h=We(()=>{u.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},"handleKeyDown"),p=We(()=>u.current=!1,"handlePointer");return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),ne.useEffect(()=>{if(!n)return;let h=We(()=>d(!1),"handleBlur");return window.addEventListener("blur",h),()=>window.removeEventListener("blur",h)},[n,d]),(0,He.jsx)(Q_,{...l,children:(0,He.jsx)(s9,{scope:e,open:n,onOpenChange:d,content:a,onContentChange:c,children:(0,He.jsx)(l9,{scope:e,onClose:ne.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:s,children:r})})})},"Menu"),c9=ne.forwardRef(We(function(e,n){let{__scopeMenu:r,...o}=e,i=wx(r);return(0,He.jsx)(Z_,{...i,...o,ref:n})},"MenuAnchor")),yI="MenuPortal",[u9,d9]=aa(yI,{forceMount:void 0}),f9=We(t=>{let{__scopeMenu:e,forceMount:n,children:r,container:o}=t,i=Hf(yI,e);return(0,He.jsx)(u9,{scope:e,forceMount:n,children:(0,He.jsx)(Gs,{present:n||i.open,children:(0,He.jsx)(Lg,{asChild:!0,container:o,children:r})})})},"MenuPortal"),Vs="MenuContent",[h9,vI]=aa(Vs),p9=ne.forwardRef(We(function(e,n){let r=d9(Vs,e.__scopeMenu),{forceMount:o=r.forceMount,...i}=e,s=Hf(Vs,e.__scopeMenu),l=Sx(Vs,e.__scopeMenu);return(0,He.jsx)(HS.Provider,{scope:e.__scopeMenu,children:(0,He.jsx)(Gs,{present:o||s.open,children:(0,He.jsx)(HS.Slot,{scope:e.__scopeMenu,children:l.modal?(0,He.jsx)(m9,{...i,ref:n}):(0,He.jsx)(g9,{...i,ref:n})})})})},"MenuContent")),m9=ne.forwardRef(We(function(e,n){let r=Hf(Vs,e.__scopeMenu),o=ne.useRef(null),i=Je(n,o);return ne.useEffect(()=>{let s=o.current;if(s)return q2(s)},[]),(0,He.jsx)(bI,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Z(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),g9=ne.forwardRef(We(function(e,n){let r=Hf(Vs,e.__scopeMenu);return(0,He.jsx)(bI,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),y9=Fs("MenuContent.ScrollLock"),bI=ne.forwardRef(We(function(e,n){let{__scopeMenu:r,loop:o=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:m,...y}=e,g=Hf(Vs,r),v=Sx(Vs,r),b=wx(r),w=gI(r),S=o9(r),[C,x]=ne.useState(null),E=ne.useRef(null),[k,T]=ne.useState(null);ex(k);let{nodes:_,registry:z}=ZS(),$=!!(i||m),I=Je(n,E,g.onContentChange,T),V=ne.useRef(0),D=ne.useRef(""),q=ne.useRef(0),U=ne.useRef(null),re=ne.useRef("right"),Y=ne.useRef(0),Te=ne.useMemo(()=>m?[E,..._.map(X=>({current:X}))]:[],[E,_,m]),rn=m?$2:ne.Fragment,ct=m?{as:y9,allowPinchZoom:!0,shards:Te}:void 0,Br=We(X=>{let To=D.current+X,ii=S().filter(zn=>!zn.disabled),si=document.activeElement,Wa=ii.find(zn=>zn.ref.current===si)?.textValue,Td=ii.map(zn=>zn.textValue),gp=EI(Td,To,Wa),Ol=ii.find(zn=>zn.textValue===gp)?.ref.current;function li(zn){D.current=zn,window.clearTimeout(V.current),zn!==""&&(V.current=window.setTimeout(()=>li(""),1e3))}We(li,"updateSearch"),li(To),Ol&&setTimeout(()=>Ol.focus())},"handleTypeaheadSearch");ne.useEffect(()=>()=>window.clearTimeout(V.current),[]),Pg();let Sn=ne.useCallback(X=>re.current===U.current?.side&&kI(X,U.current?.area),[]);return(0,He.jsx)(h9,{scope:r,searchRef:D,onItemEnter:ne.useCallback(X=>{Sn(X)&&X.preventDefault()},[Sn]),onItemLeave:ne.useCallback(X=>{Sn(X)||(E.current?.focus(),x(null))},[Sn]),onTriggerLeave:ne.useCallback(X=>{Sn(X)&&X.preventDefault()},[Sn]),pointerGraceTimerRef:q,onPointerGraceIntentChange:ne.useCallback(X=>{U.current=X},[]),children:(0,He.jsx)(QS,{registry:$?z:null,children:(0,He.jsx)(rn,{...ct,children:(0,He.jsx)(k_,{asChild:!0,trapped:i,branches:_,onMountAutoFocus:Z(s,X=>{X.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:(0,He.jsx)(kg,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:(0,He.jsx)(cI,{asChild:!0,...w,dir:v.dir,orientation:"vertical",loop:o,currentTabStopId:C,onCurrentTabStopIdChange:x,onEntryFocus:Z(c,X=>{v.isUsingKeyboardRef.current||X.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,He.jsx)(t2,{role:"menu","aria-orientation":"vertical","data-state":wI(g.open),"data-radix-menu-content":"",dir:v.dir,...b,...y,ref:I,style:{outline:"none",...y.style},onKeyDown:Z(y.onKeyDown,X=>{let ii=X.target.closest("[data-radix-menu-content]")===X.currentTarget,si=X.ctrlKey||X.altKey||X.metaKey,Wa=X.key.length===1;ii&&(X.key==="Tab"&&X.preventDefault(),!si&&Wa&&Br(X.key));let Td=E.current;if(X.target!==Td||!r9.includes(X.key))return;X.preventDefault();let Ol=S().filter(li=>!li.disabled).map(li=>li.ref.current);pI.includes(X.key)&&Ol.reverse(),xI(Ol)}),onBlur:Z(e.onBlur,X=>{X.currentTarget.contains(X.target)||(window.clearTimeout(V.current),D.current="")}),onPointerMove:Z(e.onPointerMove,Cg(X=>{let To=X.target,ii=Y.current!==X.clientX;if(X.currentTarget.contains(To)&&ii){let si=X.clientX>Y.current?"right":"left";re.current=si,Y.current=X.clientX}}))})})})})})})})},"MenuContentImpl")),jS="MenuItem",YN="menu.itemSelect",v9=ne.forwardRef(We(function(e,n){let{disabled:r=!1,onSelect:o,...i}=e,s=ne.useRef(null),l=Sx(jS,e.__scopeMenu),a=vI(jS,e.__scopeMenu),c=Je(n,s),u=ne.useRef(!1),d=We(()=>{let f=s.current;if(!r&&f){let h=new CustomEvent(YN,{bubbles:!0,cancelable:!0});f.addEventListener(YN,p=>o?.(p),{once:!0}),Tg(f,h),h.defaultPrevented?u.current=!1:l.onClose()}},"handleSelect");return(0,He.jsx)(b9,{...i,ref:c,disabled:r,onClick:Z(e.onClick,d),onPointerDown:f=>{e.onPointerDown?.(f),u.current=!0},onPointerUp:Z(e.onPointerUp,f=>{u.current||f.currentTarget?.click()}),onKeyDown:Z(e.onKeyDown,f=>{r||f.target!==f.currentTarget||a.searchRef.current!==""&&f.key===" "||BS.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})},"MenuItem")),b9=ne.forwardRef(We(function(e,n){let{__scopeMenu:r,disabled:o=!1,textValue:i,...s}=e,l=vI(jS,r),a=gI(r),c=ne.useRef(null),u=Je(n,c),[d,f]=ne.useState(!1),[h,p]=ne.useState("");return ne.useEffect(()=>{let m=c.current;m&&p((m.textContent??"").trim())},[s.children]),(0,He.jsx)(HS.ItemSlot,{scope:r,disabled:o,textValue:i??h,children:(0,He.jsx)(uI,{asChild:!0,...a,focusable:!o,children:(0,He.jsx)(Ve.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:u,onPointerMove:Z(e.onPointerMove,Cg(m=>{o?l.onItemLeave(m):(l.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Z(e.onPointerLeave,Cg(m=>l.onItemLeave(m))),onFocus:Z(e.onFocus,()=>f(!0)),onBlur:Z(e.onBlur,()=>f(!1))})})})},"MenuItemImpl")),w9="MenuRadioGroup",[Moe,Roe]=aa(w9,{value:void 0,onValueChange:We(()=>{},"onValueChange")}),S9="MenuItemIndicator",[Ooe,Doe]=aa(S9,{checked:!1}),x9=ne.forwardRef(We(function(e,n){let{__scopeMenu:r,...o}=e;return(0,He.jsx)(Ve.div,{role:"separator","aria-orientation":"horizontal",...o,ref:n})},"MenuSeparator")),C9="MenuSub",[Noe,_oe]=aa(C9);function wI(t){return t?"open":"closed"}We(wI,"getOpenState");function SI(t){return t==="indeterminate"}We(SI,"isIndeterminate");function E9(t){return SI(t)?"indeterminate":t?"checked":"unchecked"}We(E9,"getCheckedState");function xI(t){let e=document.activeElement;for(let n of t)if(n===e||(n.focus(),document.activeElement!==e))return}We(xI,"focusFirst");function CI(t,e){return t.map((n,r)=>t[(e+r)%t.length])}We(CI,"wrapArray");function EI(t,e,n){let o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1,s=CI(t,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));let a=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return a!==n?a:void 0}We(EI,"getNextMatch");function TI(t,e){let{x:n,y:r}=t,o=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){let l=e[i],a=e[s],c=l.x,u=l.y,d=a.x,f=a.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(o=!o)}return o}We(TI,"isPointInPolygon");function kI(t,e){if(!e)return!1;let n={x:t.clientX,y:t.clientY};return TI(n,e)}We(kI,"isPointerInGraceArea");function Cg(t){return e=>e.pointerType==="mouse"?t(e):void 0}We(Cg,"whenMouse");var T9=Object.defineProperty,du=(t,e)=>T9(t,"name",{value:e,configurable:!0}),xx="DropdownMenu",[k9,Ioe]=Ar(xx,[mI]),fu=mI(),[A9,AI]=k9(xx),M9=du(t=>{let{__scopeDropdownMenu:e,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:l=!0}=t,a=fu(e),c=Ko.useRef(null),[u,d]=cu({prop:o,defaultProp:i??!1,onChange:s,caller:xx});return(0,Oi.jsx)(A9,{scope:e,triggerId:Bs(),triggerRef:c,contentId:Bs(),open:u,onOpenChange:d,onOpenToggle:Ko.useCallback(()=>d(f=>!f),[d]),modal:l,children:(0,Oi.jsx)(a9,{...a,open:u,onOpenChange:d,dir:r,modal:l,children:n})})},"DropdownMenu"),R9="DropdownMenuTrigger",O9=Ko.forwardRef(du(function(e,n){let{__scopeDropdownMenu:r,disabled:o=!1,...i}=e,s=AI(R9,r),l=fu(r),a=Je(n,s.triggerRef);return(0,Oi.jsx)(c9,{asChild:!0,...l,children:(0,Oi.jsx)(Ve.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...i,ref:a,onPointerDown:Z(e.onPointerDown,c=>{!o&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:Z(e.onKeyDown,c=>{o||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})},"DropdownMenuTrigger")),D9=du(t=>{let{__scopeDropdownMenu:e,...n}=t,r=fu(e);return(0,Oi.jsx)(f9,{...r,...n})},"DropdownMenuPortal"),N9="DropdownMenuContent",_9=Ko.forwardRef(du(function(e,n){let{__scopeDropdownMenu:r,...o}=e,i=AI(N9,r),s=fu(r),l=Ko.useRef(!1);return(0,Oi.jsx)(p9,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...o,ref:n,onCloseAutoFocus:Z(e.onCloseAutoFocus,a=>{l.current||i.triggerRef.current?.focus(),l.current=!1,a.preventDefault()}),onInteractOutside:Z(e.onInteractOutside,a=>{let c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!i.modal||d)&&(l.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),I9=Ko.forwardRef(du(function(e,n){let{__scopeDropdownMenu:r,...o}=e,i=fu(r);return(0,Oi.jsx)(v9,{...i,...o,ref:n})},"DropdownMenuItem")),L9=Ko.forwardRef(du(function(e,n){let{__scopeDropdownMenu:r,...o}=e,i=fu(r);return(0,Oi.jsx)(x9,{...i,...o,ref:n})},"DropdownMenuSeparator")),U9=Object.defineProperty,MI=(t,e)=>U9(t,"name",{value:e,configurable:!0});var RI="Tabs",[P9,Loe]=Ar(RI,[Js]),zoe=Js(),[Uoe,Poe]=P9(RI);function B9(t,e){return`${t}-trigger-${e}`}MI(B9,"makeTriggerId");function H9(t,e){return`${t}-content-${e}`}MI(H9,"makeContentId");var j9=Object.defineProperty,je=(t,e)=>j9(t,"name",{value:e,configurable:!0}),qN=oe[" startTransition ".trim().toString()]||(()=>{}),DI="ToastProvider",[Ex,NI,V9]=Fg("Toast"),VS={Up:"up",Down:"down",Left:"left",Right:"right"},KN={Foreground:"foreground",Background:"background"},[_I,Boe]=Ar("Toast",[V9]),[F9,Xg]=_I(DI);function gg(t){typeof qN=="function"?qN(t):t()}je(gg,"scheduleUpdate");var $9=je(t=>{let{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:o=VS.Right,swipeThreshold:i=50,announcerContainer:s,children:l}=t,[a,c]=oe.useState(null),[u,d]=oe.useState(0),f=oe.useRef(!1),h=oe.useCallback(y=>{gg(()=>c(y))},[]),p=oe.useCallback(()=>{gg(()=>d(y=>y+1))},[]),m=oe.useCallback(()=>{gg(()=>d(y=>y-1))},[]);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${DI}\`. Expected non-empty \`string\`.`),(0,Ne.jsx)(Ex.Provider,{scope:e,children:(0,Ne.jsx)(F9,{scope:e,label:n,duration:r,swipeDirection:o,swipeThreshold:i,toastCount:u,viewport:a,onViewportChange:h,onToastAdd:p,onToastRemove:m,isClosePausedRef:f,announcerContainer:s,children:l})})},"ToastProvider"),Y9="ToastViewport",q9=["F8"],FS="toast.viewportPause",$S="toast.viewportResume",K9=oe.forwardRef(je(function(e,n){let{__scopeToast:r,hotkey:o=q9,label:i="Notifications ({hotkey})",...s}=e,l=Xg(Y9,r),a=NI(r),c=oe.useRef(null),u=oe.useRef(null),d=oe.useRef(null),f=oe.useRef(null),h=Je(n,f,l.onViewportChange),p=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),m=l.toastCount>0;oe.useEffect(()=>{let g=je(v=>{o.length!==0&&o.every(w=>v[w]||v.code===w)&&f.current?.focus()},"handleKeyDown");return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]),oe.useEffect(()=>{let g=c.current,v=f.current;if(m&&g&&v){let b=je(()=>{if(!l.isClosePausedRef.current){let x=new CustomEvent(FS);v.dispatchEvent(x),l.isClosePausedRef.current=!0}},"handlePause"),w=je(()=>{if(l.isClosePausedRef.current){let x=new CustomEvent($S);v.dispatchEvent(x),l.isClosePausedRef.current=!1}},"handleResume"),S=je(x=>{!g.contains(x.relatedTarget)&&w()},"handleFocusOutResume"),C=je(()=>{g.contains(document.activeElement)||w()},"handlePointerLeaveResume");return g.addEventListener("focusin",b),g.addEventListener("focusout",S),g.addEventListener("pointermove",b),g.addEventListener("pointerleave",C),window.addEventListener("blur",b),window.addEventListener("focus",w),()=>{g.removeEventListener("focusin",b),g.removeEventListener("focusout",S),g.removeEventListener("pointermove",b),g.removeEventListener("pointerleave",C),window.removeEventListener("blur",b),window.removeEventListener("focus",w)}}},[m,l.isClosePausedRef]);let y=oe.useCallback(({tabbingDirection:g})=>{let b=a().map(w=>{let S=w.ref.current,C=[S,...zI(S)];return g==="forwards"?C:C.reverse()});return(g==="forwards"?b.reverse():b).flat()},[a]);return oe.useEffect(()=>{let g=f.current;if(g){let v=je(b=>{let w=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!w){let C=document.activeElement,x=b.shiftKey;if(b.target===g&&x){u.current?.focus();return}let T=y({tabbingDirection:x?"backwards":"forwards"}),_=T.findIndex(z=>z===C);yg(T.slice(_+1))?b.preventDefault():x?u.current?.focus():d.current?.focus()}},"handleKeyDown");return g.addEventListener("keydown",v),()=>g.removeEventListener("keydown",v)}},[a,y]),(0,Ne.jsxs)(_6,{ref:c,role:"region","aria-label":i.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:m?void 0:"none"},children:[m&&(0,Ne.jsx)(GN,{ref:u,onFocusFromOutsideViewport:()=>{let g=y({tabbingDirection:"forwards"});yg(g)}}),(0,Ne.jsx)(Ex.Slot,{scope:r,children:(0,Ne.jsx)(Ve.ol,{tabIndex:-1,...s,ref:h})}),m&&(0,Ne.jsx)(GN,{ref:d,onFocusFromOutsideViewport:()=>{let g=y({tabbingDirection:"backwards"});yg(g)}})]})},"ToastViewport")),G9="ToastFocusProxy",GN=oe.forwardRef(je(function(e,n){let{__scopeToast:r,onFocusFromOutsideViewport:o,...i}=e,s=Xg(G9,r);return(0,Ne.jsx)(cx,{tabIndex:0,...i,ref:n,style:{position:"fixed"},onFocus:l=>{let a=l.relatedTarget;!s.viewport?.contains(a)&&o()}})},"ToastFocusProxy")),Wg="Toast",X9="toast.swipeStart",W9="toast.swipeMove",J9="toast.swipeCancel",Q9="toast.swipeEnd",Z9=oe.forwardRef(je(function(e,n){let{forceMount:r,open:o,defaultOpen:i,onOpenChange:s,...l}=e,[a,c]=cu({prop:o,defaultProp:i??!0,onChange:s,caller:Wg});return(0,Ne.jsx)(Gs,{present:r||a,children:(0,Ne.jsx)(nY,{open:a,...l,ref:n,onClose:()=>c(!1),onPause:kr(e.onPause),onResume:kr(e.onResume),onSwipeStart:Z(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Z(e.onSwipeMove,u=>{let{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:Z(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Z(e.onSwipeEnd,u=>{let{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})},"Toast")),[eY,tY]=_I(Wg,{onClose(){}}),nY=oe.forwardRef(je(function(e,n){let{__scopeToast:r,type:o=KN.Foreground,duration:i,open:s,onClose:l,onEscapeKeyDown:a,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:h,onSwipeEnd:p,...m}=e,y=Xg(Wg,r),g=NI(r),[v,b]=oe.useState(null),w=Je(n,b),S=oe.useRef(null),C=oe.useRef(null),x=i||y.duration,E=oe.useRef(0),k=oe.useRef(x),T=oe.useRef(0),{onToastAdd:_,onToastRemove:z}=y,$=kr(()=>{v?.contains(document.activeElement)&&y.viewport?.focus(),l()}),I=oe.useCallback(D=>{!D||D===1/0||(window.clearTimeout(T.current),E.current=new Date().getTime(),T.current=window.setTimeout($,D))},[$]);oe.useEffect(()=>{let D=y.viewport;if(D){let q=je(()=>{I(k.current),u?.()},"handleResume"),U=je(()=>{let re=new Date().getTime()-E.current;k.current=k.current-re,window.clearTimeout(T.current),c?.()},"handlePause");return D.addEventListener(FS,U),D.addEventListener($S,q),()=>{D.removeEventListener(FS,U),D.removeEventListener($S,q)}}},[y.viewport,x,c,u,I]),oe.useEffect(()=>{k.current=x,s&&!y.isClosePausedRef.current&&I(x)},[s,x,y.isClosePausedRef,I]),oe.useEffect(()=>()=>{window.clearTimeout(T.current)},[]),oe.useEffect(()=>(_(),()=>z()),[_,z]);let V=oe.useMemo(()=>v?Tx(v):null,[v]);return y.viewport?(0,Ne.jsxs)(Ne.Fragment,{children:[V&&(0,Ne.jsx)(rY,{__scopeToast:r,role:"status","aria-live":o===KN.Foreground?"assertive":"polite",children:V}),(0,Ne.jsx)(eY,{scope:r,onClose:$,children:OI.createPortal((0,Ne.jsx)(Ex.ItemSlot,{scope:r,children:(0,Ne.jsx)(kg,{asChild:!0,onEscapeKeyDown:Z(a,D=>{g().some(U=>U.ref.current?.contains(D.target))||$()}),children:(0,Ne.jsx)(Ve.li,{tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":y.swipeDirection,...m,ref:w,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Z(e.onKeyDown,D=>{D.key==="Escape"&&(a?.(D.nativeEvent),D.nativeEvent.defaultPrevented||$())}),onPointerDown:Z(e.onPointerDown,D=>{D.button===0&&(S.current={x:D.clientX,y:D.clientY})}),onPointerMove:Z(e.onPointerMove,D=>{if(!S.current)return;let q=D.clientX-S.current.x,U=D.clientY-S.current.y,re=!!C.current,Y=["left","right"].includes(y.swipeDirection),Te=["left","up"].includes(y.swipeDirection)?Math.min:Math.max,rn=Y?Te(0,q):0,ct=Y?0:Te(0,U),Br=D.pointerType==="touch"?10:2,Sn={x:rn,y:ct},X={originalEvent:D,delta:Sn};re?(C.current=Sn,Of(W9,f,X,{discrete:!1})):XN(Sn,y.swipeDirection,Br)?(C.current=Sn,Of(X9,d,X,{discrete:!1}),D.target.setPointerCapture(D.pointerId)):(Math.abs(q)>Br||Math.abs(U)>Br)&&(S.current=null)}),onPointerUp:Z(e.onPointerUp,D=>{let q=C.current,U=D.target;if(U.hasPointerCapture(D.pointerId)&&U.releasePointerCapture(D.pointerId),C.current=null,S.current=null,q){let re=D.currentTarget,Y={originalEvent:D,delta:q};XN(q,y.swipeDirection,y.swipeThreshold)?Of(Q9,p,Y,{discrete:!0}):Of(J9,h,Y,{discrete:!0}),re.addEventListener("click",Te=>Te.preventDefault(),{once:!0})}})})})}),y.viewport)})]}):null},"ToastImpl")),rY=je(t=>{let{__scopeToast:e,children:n,...r}=t,o=Xg(Wg,e),[i,s]=oe.useState(!1),[l,a]=oe.useState(!1);return II(()=>s(!0)),oe.useEffect(()=>{let c=window.setTimeout(()=>a(!0),1e3);return()=>window.clearTimeout(c)},[]),l?null:(0,Ne.jsx)(Lg,{asChild:!0,container:o.announcerContainer||void 0,children:(0,Ne.jsx)(cx,{...r,children:i&&(0,Ne.jsxs)(Ne.Fragment,{children:[o.label," ",n]})})})},"ToastAnnounce"),oY=oe.forwardRef(je(function(e,n){let{__scopeToast:r,...o}=e;return(0,Ne.jsx)(Ve.div,{...o,ref:n})},"ToastTitle")),iY=oe.forwardRef(je(function(e,n){let{__scopeToast:r,...o}=e;return(0,Ne.jsx)(Ve.div,{...o,ref:n})},"ToastDescription")),sY="ToastClose",lY=oe.forwardRef(je(function(e,n){let{__scopeToast:r,...o}=e,i=tY(sY,r);return(0,Ne.jsx)(aY,{asChild:!0,children:(0,Ne.jsx)(Ve.button,{type:"button",...o,ref:n,onClick:Z(e.onClick,i.onClose)})})},"ToastClose")),aY=oe.forwardRef(je(function(e,n){let{__scopeToast:r,altText:o,...i}=e;return(0,Ne.jsx)(Ve.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0,...i,ref:n})},"ToastAnnounceExclude"));function Tx(t){let e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),LI(r)){let o=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!o)if(i){let s=r.dataset.radixToastAnnounceAlt;s&&e.push(s)}else e.push(...Tx(r))}}),e}je(Tx,"getAnnounceTextContent");function Of(t,e,n,{discrete:r}){let o=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?Tg(o,i):o.dispatchEvent(i)}je(Of,"handleAndDispatchCustomEvent");var XN=je((t,e,n=0)=>{let r=Math.abs(t.x),o=Math.abs(t.y),i=r>o;return e===VS.Left||e===VS.Right?i&&r>n:!i&&o>n},"isDeltaInDirection");function II(t=()=>{}){let e=kr(t);pn(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}je(II,"useNextFrame");function LI(t){return t.nodeType===t.ELEMENT_NODE}je(LI,"isHTMLElement");function zI(t){let e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:je(r=>{let o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)e.push(n.currentNode);return e}je(zI,"getTabbableCandidates");function yg(t){let e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}je(yg,"focusFirst");function jf({open:t,onOpenChange:e,trigger:n,title:r,description:o,children:i,footer:s}){if(r.trim()==="")throw new Error("A dialog needs a non-empty title.");let l=(0,tr.useRef)(null),a=(0,tr.useRef)(!1);if(t&&!a.current&&typeof document<"u"){let c=document.activeElement,u=c?.closest('[role="menu"]')?.getAttribute("aria-labelledby");l.current=u&&document.getElementById(u)||c}return a.current=!!t,(0,me.jsxs)(x$,{open:t,onOpenChange:e,children:[n&&(0,me.jsx)(E$,{asChild:!0,children:n}),(0,me.jsxs)(k$,{children:[(0,me.jsx)(A$,{className:"ad-overlay"}),(0,me.jsxs)(O$,{className:"ad-dialog",...o?{}:{"aria-describedby":void 0},onCloseAutoFocus:c=>{!n&&l.current instanceof HTMLElement&&l.current.isConnected&&(c.preventDefault(),l.current.focus())},onOpenAutoFocus:c=>{let u=c.currentTarget.querySelector("[data-autofocus]");u&&(c.preventDefault(),u.focus())},children:[(0,me.jsx)(_$,{className:"ad-dialog__title",children:r}),(0,me.jsx)(J2,{asChild:!0,children:(0,me.jsx)(sa,{label:"Close",icon:(0,me.jsx)(k2,{}),size:"sm",className:"ad-dialog__close",tooltip:!1})}),o&&(0,me.jsx)(I$,{className:"ad-dialog__description",children:o}),i&&(0,me.jsx)("div",{className:"ad-dialog__body",children:i}),s&&(0,me.jsx)("div",{className:"ad-dialog__footer",children:s})]})]})]})}var Jg=J2;function UI({trigger:t,items:e,align:n="end"}){for(let o of e)if(o!=="separator"&&o.label.trim()==="")throw new Error("A menu item needs a non-empty label.");let r=(0,tr.isValidElement)(t)&&t.type===sa?(0,tr.cloneElement)(t,{tooltip:!1}):t;return(0,me.jsxs)(M9,{modal:!1,children:[(0,me.jsx)(O9,{asChild:!0,children:r}),(0,me.jsx)(D9,{children:(0,me.jsx)(_9,{className:"ad-menu",align:n,sideOffset:6,children:e.map((o,i)=>o==="separator"?(0,me.jsx)(L9,{className:"ad-menu__separator"},`sep-${i}`):(0,me.jsxs)(I9,{className:o.danger?"ad-menu__item ad-menu__item--danger":"ad-menu__item",disabled:o.disabled,onSelect:o.onSelect,children:[o.icon,(0,me.jsx)("span",{children:o.label}),o.shortcut&&(0,me.jsx)("kbd",{className:"ad-menu__shortcut",children:o.shortcut})]},`${i}-${o.label}`))})})]})}var cY=(0,tr.createContext)(null),WN={info:k7,success:T7,warning:A2,danger:D7},uY={info:"Notice",success:"Success",warning:"Warning",danger:"Error"};function PI({children:t}){let[e,n]=(0,tr.useState)([]),r=(0,tr.useCallback)(i=>{if(typeof i.title!="string"||i.title.trim()==="")throw new Error("A toast needs a non-empty title.");let s=i.tone===void 0?"info":Object.hasOwn(WN,i.tone)?i.tone:"danger";n(l=>[...l,{...i,tone:s,id:Date.now()+Math.random()}])},[]),o=i=>n(s=>s.filter(l=>l.id!==i));return(0,me.jsx)(cY.Provider,{value:r,children:(0,me.jsxs)($9,{swipeDirection:"right",children:[t,e.map(({id:i,title:s,description:l,tone:a="info"})=>{let c=WN[a];return(0,me.jsxs)(Z9,{className:`ad-toast ad-toast--${a}`,type:a==="danger"?"foreground":"background",duration:a==="danger"?1/0:8e3,onOpenChange:u=>!u&&o(i),children:[(0,me.jsx)(c,{className:"ad-toast__icon"}),(0,me.jsxs)("div",{children:[(0,me.jsxs)(oY,{className:"ad-toast__title",children:[(0,me.jsxs)("span",{className:"ad-sr-only",children:[uY[a],": "]}),s]}),l&&(0,me.jsx)(iY,{className:"ad-toast__description",children:l})]}),(0,me.jsx)(lY,{asChild:!0,children:(0,me.jsx)(sa,{label:"Dismiss",icon:(0,me.jsx)(k2,{}),size:"sm",tooltip:!1})})]},i)}),(0,me.jsx)(K9,{className:"ad-toast-viewport",label:"Notifications ({hotkey})"})]})})}var BI="(max-width: 47.99rem)",dY=t=>{let e=window.matchMedia(BI);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)};function HI({brand:t,sidebar:e,topbar:n,children:r}){let[o,i]=(0,Gt.useState)(!1),s=(0,Gt.useRef)(null),l=(0,Gt.useRef)(null),a=(0,Gt.useRef)(!1),c=(0,Gt.useId)(),u=(0,Gt.useId)(),d=(0,Gt.useSyncExternalStore)(dY,()=>window.matchMedia(BI).matches,()=>!1),f=(0,Gt.useRef)(d),h=(0,Gt.useRef)(null),p=(0,Gt.useRef)(null);if(d!==f.current){let v=document.activeElement,b=h.current;p.current=h.current??v,h.current=null,f.current=d,a.current=!1,i(d&&(!!b||!!s.current?.contains(v)))}(0,Gt.useLayoutEffect)(()=>{let v=p.current;p.current=null,v instanceof HTMLElement&&v.isConnected&&v!==document.activeElement&&v!==document.body&&v.focus()},[d]),(0,Gt.useEffect)(()=>{o&&a.current&&s.current?.querySelector("a")?.focus()},[o]);let m=v=>{if(v.key!=="Escape"||!o)return;let b=v.target;!s.current?.contains(b)&&!l.current?.contains(b)||(i(!1),l.current?.focus())},y=(0,Vn.jsxs)("header",{className:"ad-shell__topbar",children:[(0,Vn.jsx)(sa,{ref:l,className:"ad-shell__menu",label:"Navigation",icon:(0,Vn.jsx)(A7,{}),"aria-expanded":o,"aria-controls":c,onClick:()=>{a.current=!o,i(v=>!v)}}),(0,Vn.jsx)("div",{className:"ad-shell__actions",children:n})]},"topbar"),g=(0,Vn.jsxs)("div",{id:c,ref:s,className:"ad-shell__sidebar","data-open":o,onBlur:v=>{!f.current&&!v.relatedTarget&&s.current&&getComputedStyle(s.current).display==="none"&&(h.current=v.target)},onFocus:()=>{h.current=null},children:[(0,Vn.jsx)("p",{className:"ad-shell__brand",children:t}),e]},"sidebar");return(0,Vn.jsxs)("div",{className:"ad-shell",onKeyDown:m,children:[(0,Vn.jsx)("a",{className:"ad-skip-link",href:`#${u}`,children:"Skip to content"}),d?[y,g]:[g,y],(0,Vn.jsx)("main",{id:u,className:"ad-shell__content",tabIndex:-1,children:r})]})}function jI({label:t,items:e}){return(0,Vn.jsx)("nav",{"aria-label":t,children:(0,Vn.jsx)("ul",{className:"ad-sidebar-nav",children:e.map(n=>(0,Vn.jsx)("li",{children:(0,Vn.jsxs)("a",{className:"ad-sidebar-nav__link",href:n.href,"aria-current":n.current?"page":void 0,children:[n.icon,n.label]})},n.href))})})}var fY=Object.defineProperty,$I=(t,e)=>fY(t,"name",{value:e,configurable:!0}),kx={Horizontal:"horizontal",Vertical:"vertical"},JN=kx.Horizontal,hY=Object.values(kx),pY=VI.forwardRef($I(function(e,n){let{decorative:r,orientation:o=JN,...i}=e,s=YI(o)?o:JN,l=s===kx.Vertical?s:void 0,a=r?{role:"none"}:{"aria-orientation":l,role:"separator"};return(0,FI.jsx)(Ve.div,{"data-orientation":s,...a,...i,ref:n})},"Separator"));function YI(t){return hY.includes(t)}$I(YI,"isValidOrientation");var Ax="ToggleGroup",[qI,KI]=Ar(Ax,[Js]),Foe=Js(),[$oe,Yoe]=qI(Ax),[qoe,Koe]=qI(Ax),mY=Object.defineProperty,Mx=(t,e)=>mY(t,"name",{value:e,configurable:!0}),GI="Toolbar",[gY,Goe]=Ar(GI,[Js,KI]),XI=Js(),Xoe=KI(),[yY,vY]=gY(GI),bY=Qg.forwardRef(Mx(function(e,n){let{__scopeToolbar:r,orientation:o="horizontal",dir:i,loop:s=!0,...l}=e,a=XI(r),c=Yg(i);return(0,ra.jsx)(yY,{scope:r,orientation:o,dir:c,children:(0,ra.jsx)(cI,{asChild:!0,...a,orientation:o,dir:c,loop:s,children:(0,ra.jsx)(Ve.div,{role:"toolbar","aria-orientation":o,dir:c,...l,ref:n})})})},"Toolbar")),wY="ToolbarSeparator",SY=Qg.forwardRef(Mx(function(e,n){let{__scopeToolbar:r,...o}=e,i=vY(wY,r);return(0,ra.jsx)(pY,{orientation:i.orientation==="horizontal"?"vertical":"horizontal",...o,ref:n})},"ToolbarSeparator")),xY=Qg.forwardRef(Mx(function(e,n){let{__scopeToolbar:r,...o}=e,i=XI(r);return(0,ra.jsx)(uI,{asChild:!0,...i,focusable:!e.disabled,children:(0,ra.jsx)(Ve.button,{type:"button",...o,ref:n})})},"ToolbarButton"));function WI({label:t,children:e,dir:n}){let r=n??(typeof document<"u"&&document.documentElement.dir==="rtl"?"rtl":"ltr");return(0,Lf.jsx)(bY,{className:"ad-toolbar","aria-label":t,dir:r,children:e})}function JI({pressed:t,...e}){return(0,Lf.jsx)(xY,{asChild:!0,children:(0,Lf.jsx)(sa,{size:"sm","aria-pressed":t,...e})})}function Zg(){return(0,Lf.jsx)(SY,{className:"ad-toolbar__separator"})}var CY=40,EY=/^[\p{L}\p{M}\p{N}\p{P}\p{S}\p{Zs}\u200C\u200D]*$/u,TY=/(?![\p{Default_Ignorable_Code_Point}\u2800])[\p{L}\p{N}\p{P}\p{S}]/u,QN="[\\p{Script=Arabic}\\p{Script=Devanagari}\\p{Script=Bengali}\\p{Script=Gujarati}\\p{Script=Gurmukhi}\\p{Script=Tamil}\\p{Script=Telugu}\\p{Script=Kannada}\\p{Script=Malayalam}\\p{Script=Sinhala}\\p{Extended_Pictographic}\\p{Emoji_Modifier}]",kY=new RegExp(`(?<=${QN}\\p{M}*)[\\u200C\\u200D](?=${QN})`,"gu"),AY=/[\p{Default_Ignorable_Code_Point}\u2800]/u,MY=/^[\p{M}\u200C-\u200F]/u,RY=/\p{M}{5,}/u;function hu(t){return QI(t,CY)}function QI(t,e){if(typeof t!="string"||t.length>e)return null;let n=t.replace(kY,"");return/[\u200C-\u200F]/.test(n)||!EY.test(t)||!TY.test(t)||RY.test(n)||AY.test(n)||MY.test(t)||/^\s|\s$|\s{2,}|(?! )\p{Zs}|[\u200C-\u200F]$|[\u200C-\u200F]{2,}/u.test(t)?null:t}var ZN={active:"",away:"Away",paused:"Paused"},ou=t=>t.kind==="person"?"person":"agent",ZI=t=>typeof t.status=="string"&&Object.hasOwn(ZN,t.status)?ZN[t.status]:"";function Rx(t){return hu(t.name)??(ou(t)==="agent"?"Unnamed agent":"Unnamed person")}function OY(t){let e=t.trim().split(/\s+/).filter(Boolean);return(e.length>1?[e[0],e[e.length-1]]:[e[0]??""]).map(r=>Array.from(r).find(o=>/[\p{L}\p{N}]/u.test(o))?.toUpperCase()??"").join("")}function e3({entry:t,label:e}){return(0,Xt.jsx)("span",{className:qo("ad-avatar",`ad-avatar--${ou(t)}`),role:e?"img":void 0,"aria-label":e,"aria-hidden":e?void 0:!0,children:ou(t)==="agent"?(0,Xt.jsx)(O7,{"aria-hidden":"true"}):OY(Rx(t))})}function t3(t){let e=ou(t)==="agent",n=t.actingFor===void 0?null:hu(t.actingFor)??"Unnamed person";return[Rx(t),e?"agent":"person",e&&`acting for ${n??"an unknown person"}`,ZI(t).toLowerCase()].filter(Boolean).join(", ")}function Ox({entry:t,className:e}){let n=Rx(t),r=ZI(t),o=ou(t)==="agent",i=t.actingFor===void 0?null:hu(t.actingFor)??"Unnamed person";return(0,Xt.jsxs)("span",{className:qo("ad-chip",e),children:[(0,Xt.jsx)(e3,{entry:t}),(0,Xt.jsx)("span",{className:"ad-chip__name",title:n,"aria-hidden":"true",children:n}),o&&(0,Xt.jsx)("span",{className:"ad-pill","aria-hidden":"true",title:i?`An agent acting for ${i}.`:"An agent, not a person.",children:"Agent"}),o&&(0,Xt.jsxs)("span",{className:"ad-chip__meta","aria-hidden":"true",children:["for ",i??"unknown"]}),r&&(0,Xt.jsx)("span",{className:"ad-chip__meta","aria-hidden":"true",children:r}),(0,Xt.jsx)("span",{className:"ad-sr-only",children:t3(t)})]})}function DY(t){let e=t.filter(o=>ou(o)==="agent").length,n=t.length-e,r=(o,i,s)=>o===0?[]:[`${o} ${o===1?i:s}`];return[...r(n,"person","people"),...r(e,"agent","agents")].join(", ")}function n3({entries:t,max:e=4,label:n="Here now"}){let r=t.slice(0,e),o=t.length-r.length;return(0,Xt.jsxs)("div",{className:"ad-stack",children:[(0,Xt.jsxs)("ul",{className:"ad-stack__list","aria-label":n,children:[r.map(i=>{let s=t3(i);return(0,Xt.jsx)("li",{title:s,children:(0,Xt.jsx)(e3,{entry:i,label:s})},i.id)}),o>0&&(0,Xt.jsx)("li",{children:(0,Xt.jsxs)("span",{className:"ad-avatar ad-avatar--more",role:"img","aria-label":`${o} more`,children:["+",o]})})]}),t.length>0&&(0,Xt.jsx)("span",{className:"ad-stack__summary",children:DY(t)})]})}function ca({title:t,description:e,action:n}){return(0,Tn.jsxs)("div",{className:"ad-empty",children:[(0,Tn.jsx)("h2",{className:"ad-empty__title",children:t}),e&&(0,Tn.jsx)("p",{className:"ad-empty__description",children:e}),n]})}function r3({label:t,children:e}){return(0,Tn.jsx)("ul",{className:"ad-files","aria-label":t,children:e})}var NY=200;function o3({name:t,href:e,kind:n="file",modified:r,editedBy:o,actions:i}){let s=QI(t,NY)??"Untitled",l=r instanceof Date&&!Number.isNaN(r.getTime());return(0,Tn.jsxs)("li",{className:"ad-file-row",children:[(0,Tn.jsx)("span",{className:"ad-file-row__icon","aria-hidden":"true",children:n==="folder"?(0,Tn.jsx)(R7,{}):(0,Tn.jsx)(M7,{})}),(0,Tn.jsx)("a",{className:"ad-file-row__name",href:e,title:s,children:s}),(0,Tn.jsxs)("span",{className:"ad-file-row__meta",children:["Edited by ",(0,Tn.jsx)(Ox,{entry:o})]}),l?(0,Tn.jsx)("time",{className:"ad-file-row__time",dateTime:r.toISOString(),children:r.toLocaleDateString("en",{day:"numeric",month:"short",year:"numeric"})}):(0,Tn.jsx)("span",{className:"ad-file-row__time",children:"Date unknown"}),i&&(0,Tn.jsx)("span",{className:"ad-file-row__actions",children:i})]})}var ey=R(P(),1);var Qs=class extends Error{constructor(n,r,o,i=[]){super(r);this.code=n;this.status=o;this.matches=i;this.name="DocsApiError"}code;status;matches},_Y=encodeURIComponent;function s3(t){if(!t.token)throw new TypeError("createClient needs a token");let e=t.baseUrl.replace(/\/+$/,""),n=t.fetch??((...y)=>globalThis.fetch(...y)),r=(y,g)=>new Qs("BAD_RESPONSE",`the server sent a reply that is not valid: ${g}`,y),o=y=>typeof y=="object"&&y!==null&&!Array.isArray(y),i=y=>o(y)&&typeof y.occurrence=="number"&&typeof y.context=="string";async function s(y,g,v={},b="application/json"){let w=new URLSearchParams;for(let[T,_]of Object.entries(g.query??{}))_!==void 0&&w.set(T,String(_));let S=w.toString(),C=`${e}${y}${S?`?${S}`:""}`,x={authorization:`Bearer ${t.token}`};g.json&&(x["content-type"]="application/json");let E=await n(C,{method:g.method,headers:x,body:g.body,signal:v.signal});if(E.ok){let T=(E.headers.get("content-type")??"").toLowerCase();if(!T.startsWith(b))throw r(E.status,`unexpected content type "${T}"`);return E}let k;try{let T=await E.json();o(T.error)&&(k=T.error)}catch{}throw new Qs(typeof k?.code=="string"?k.code:"HTTP_ERROR",typeof k?.message=="string"?k.message:`the server answered ${E.status}`,E.status,Array.isArray(k?.matches)?k.matches.filter(i):[])}async function l(y,g,v){let b;try{b=await y.json()}catch{throw r(y.status,"the body is not JSON")}if(!g(b))throw r(y.status,`expected ${v}`);return b}let a=y=>`/api/v1/docs/${_Y(y)}`,c=y=>o(y)&&y.ok===!0,u=y=>Array.isArray(y)&&y.every(o),d=async(y,g,v,b,w)=>await l(await s(y,{method:"GET",query:g},w),v,b),f=async(y,g,v,b,w)=>await l(await s(y,{method:"POST",json:!0,body:JSON.stringify(g)},w),v,b),h=(y,g,v)=>f(y,g,c,"{ ok: true }",v),p=(y,g,v)=>d(y,g,u,"a list",v),m=(y,g,v,b)=>f(y,g,w=>o(w)&&typeof w[v]=="string",`{ ${v}: string }`,b);return{async health(y){return await l(await s("/health",{method:"GET"},y),g=>o(g)&&g.ok===!0&&typeof g.pack=="string","{ ok, pack }")},me:y=>d("/api/v1/me",{},g=>o(g)&&typeof g.kind=="string"&&typeof g.name=="string"&&Array.isArray(g.scopes)&&(g.role==="editor"||g.role==="viewer"),"the token identity",y),create:(y,g)=>m("/api/v1/docs",y,"id",g),list:y=>p("/api/v1/docs",{},y),rename:(y,g,v)=>h(`${a(y)}/rename`,g,v),remove:(y,g)=>h(`${a(y)}/remove`,{},g),async read(y,g={},v){return(await s(`${a(y)}/read`,{method:"GET",query:g},v,"text/markdown")).text()},outline:(y,g)=>p(`${a(y)}/outline`,{},g),edits:(y,g)=>p(`${a(y)}/edits`,{},g),insert:(y,g,v)=>h(`${a(y)}/insert`,g,v),replace:(y,g,v)=>h(`${a(y)}/replace`,g,v),delete:(y,g,v)=>h(`${a(y)}/delete`,g,v),append:(y,g,v)=>h(`${a(y)}/append`,g,v),suggest:(y,g,v)=>m(`${a(y)}/suggest`,g,"suggestion",v),suggestions:(y,g={},v)=>p(`${a(y)}/suggestions`,g,v),accept:(y,g,v)=>h(`${a(y)}/accept`,g,v),reject:(y,g,v)=>h(`${a(y)}/reject`,g,v),comment:(y,g,v)=>m(`${a(y)}/comment`,g,"thread",v),reply:(y,g,v)=>h(`${a(y)}/reply`,g,v),resolve:(y,g,v)=>h(`${a(y)}/resolve`,g,v),reopen:(y,g,v)=>h(`${a(y)}/reopen`,g,v),threads:(y,g={},v)=>p(`${a(y)}/threads`,g,v),export:(async(y,g,v)=>{let b=await s(`${a(y)}/export`,{method:"GET",query:g},v,{md:"text/markdown",html:"text/html",odt:"application/vnd.oasis.opendocument.text"}[g.format]);return g.format==="odt"?new Uint8Array(await b.arrayBuffer()):b.text()}),room:(y,g)=>d(`${a(y)}/room`,{},v=>o(v)&&Array.isArray(v.contributors),"{ contributors }",g),async state(y,g){return new Uint8Array(await(await s(`${a(y)}/state`,{method:"GET"},g,"application/octet-stream")).arrayBuffer())},async checkpoint(y,g,v){let b=v?.create===!1?{create:!1}:void 0;return await l(await s(`${a(y)}/checkpoint`,{method:"POST",body:g,query:b},v),c,"{ ok: true }")}}}var Zs=t=>t!=="human";var Nx="agentic-documents.token",_x=()=>sessionStorage.getItem(Nx),l3=t=>sessionStorage.setItem(Nx,t),Ix=()=>sessionStorage.removeItem(Nx),ty=t=>s3({baseUrl:location.origin,token:t}),Lx=(0,ey.createContext)(null);function Ni(){let t=(0,ey.useContext)(Lx);if(!t)throw new Error("no session");return t}function _i(t){return t instanceof Qs?t.code==="UNAUTHENTICATED"?"The server did not accept this token.":t.code==="FORBIDDEN"?"This token may not do that.":t.code==="NO_DOCUMENT"?"This document does not exist. It may have been removed.":t.message:t instanceof Error?`Could not reach the server: ${t.message}`:"Something went wrong."}var Rl=R(P(),1);var Xa=R(P(),1),Xre=R(uS(),1);var Bt=Math.floor;var ua=Math.abs;var Rr=(t,e)=>t<e?t:e,rr=(t,e)=>t>e?t:e,nie=Number.isNaN;var ny=t=>t!==0?t<0:1/t<0;var pu=Number.MAX_SAFE_INTEGER,zx=Number.MIN_SAFE_INTEGER,rie=1<<31;var a3=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&Bt(t)===t),oie=Number.isNaN,iie=Number.parseInt;var Zr=()=>new Set;var oy=t=>t[t.length-1];var c3=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},bo=Array.from,iy=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},Vf=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1};var u3=(t,e)=>{let n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n};var Ii=Array.isArray;var $f=String.fromCharCode,IY=String.fromCodePoint,sie=$f(65535),LY=t=>t.toLowerCase(),zY=/^\s*/g,UY=t=>t.replace(zY,""),PY=/([A-Z])/g,Px=(t,e)=>UY(t.replace(PY,n=>`${e}${LY(n)}`));var BY=t=>{let e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=e.codePointAt(o);return r},gu=typeof TextEncoder<"u"?new TextEncoder:null,HY=t=>gu.encode(t),d3=gu?HY:BY;var mu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});mu&&mu.decode(new Uint8Array).length===1&&(mu=null);var f3=(t,e)=>u3(e,()=>t).join("");var Or=t=>new Error(t),Fn=()=>{throw Or("Method unimplemented")},ft=()=>{throw Or("Unexpected case")};var da=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},eo=()=>new da,y3=t=>{let e=eo();return t(e),Zt(e)},Hx=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e};var Zt=t=>{let e=new Uint8Array(Hx(t)),n=0;for(let r=0;r<t.bufs.length;r++){let o=t.bufs[r];e.set(o,n),n+=o.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},jY=(t,e)=>{let n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(rr(n,e)*2),t.cpos=0)},Qt=(t,e)=>{let 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};var ay=Qt;var W=(t,e)=>{for(;e>127;)Qt(t,128|127&e),e=Bt(e/128);Qt(t,127&e)},cy=(t,e)=>{let n=ny(e);for(n&&(e=-e),Qt(t,(e>63?128:0)|(n?64:0)|63&e),e=Bt(e/64);e>0;)Qt(t,(e>127?128:0)|127&e),e=Bt(e/128)},Bx=new Uint8Array(3e4),VY=Bx.length/3,FY=(t,e)=>{if(e.length<VY){let n=gu.encodeInto(e,Bx).written||0;W(t,n);for(let r=0;r<n;r++)Qt(t,Bx[r])}else At(t,d3(e))},$Y=(t,e)=>{let n=unescape(encodeURIComponent(e)),r=n.length;W(t,r);for(let o=0;o<r;o++)Qt(t,n.codePointAt(o))},Li=gu&&gu.encodeInto?FY:$Y;var Kf=(t,e)=>{let n=t.cbuf.length,r=t.cpos,o=Rr(n-r,e.length),i=e.length-o;t.cbuf.set(e.subarray(0,o),r),t.cpos+=o,i>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(rr(n*2,i)),t.cbuf.set(e.subarray(o)),t.cpos=i)},At=(t,e)=>{W(t,e.byteLength),Kf(t,e)},jx=(t,e)=>{jY(t,e);let n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},YY=(t,e)=>jx(t,4).setFloat32(0,e,!1),qY=(t,e)=>jx(t,8).setFloat64(0,e,!1),KY=(t,e)=>jx(t,8).setBigInt64(0,e,!1);var p3=new DataView(new ArrayBuffer(4)),GY=t=>(p3.setFloat32(0,t),p3.getFloat32(0)===t),tl=(t,e)=>{switch(typeof e){case"string":Qt(t,119),Li(t,e);break;case"number":a3(e)&&ua(e)<=2147483647?(Qt(t,125),cy(t,e)):GY(e)?(Qt(t,124),YY(t,e)):(Qt(t,123),qY(t,e));break;case"bigint":Qt(t,122),KY(t,e);break;case"object":if(e===null)Qt(t,126);else if(Ii(e)){Qt(t,117),W(t,e.length);for(let n=0;n<e.length;n++)tl(t,e[n])}else if(e instanceof Uint8Array)Qt(t,116),At(t,e);else{Qt(t,118);let n=Object.keys(e);W(t,n.length);for(let r=0;r<n.length;r++){let o=n[r];Li(t,o),tl(t,e[o])}}break;case"boolean":Qt(t,e?120:121);break;default:Qt(t,127)}},qf=class extends da{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&W(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}};var m3=t=>{t.count>0&&(cy(t.encoder,t.count===1?t.s:-t.s),t.count>1&&W(t.encoder,t.count-2))},fa=class{constructor(){this.encoder=new da,this.s=0,this.count=0}write(e){this.s===e?this.count++:(m3(this),this.count=1,this.s=e)}toUint8Array(){return m3(this),Zt(this.encoder)}};var g3=t=>{if(t.count>0){let e=t.diff*2+(t.count===1?0:1);cy(t.encoder,e),t.count>1&&W(t.encoder,t.count-2)}},vu=class{constructor(){this.encoder=new da,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(g3(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return g3(this),Zt(this.encoder)}},ly=class{constructor(){this.sarr=[],this.s="",this.lensE=new fa}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){let e=new da;return this.sarr.push(this.s),this.s="",Li(e,this.sarr.join("")),Kf(e,this.lensE.toUint8Array()),Zt(e)}};var dy=Or("Unexpected end of array"),v3=Or("Integer out of Range"),XY=(t,e,n)=>{if(e<0||n<0||e+n>t.length)throw dy;return new Uint8Array(t.buffer,t.byteOffset+e,n)},WY=(t,e,n)=>{if(e<0||n<0||e+n>t.length)throw dy;return new DataView(t.buffer,t.byteOffset+e,n)},wu=class{constructor(e){this.arr=e,this.pos=0}},So=t=>new wu(t),b3=t=>t.pos!==t.arr.length;var JY=(t,e)=>{let n=XY(t.arr,t.pos,e);return t.pos+=e,n},Ht=t=>JY(t,J(t));var ha=t=>t.arr[t.pos++];var J=t=>{let e=0,n=1,r=t.arr.length;for(;t.pos<r;){let o=t.arr[t.pos++];if(e=e+(o&127)*n,n*=128,o<128)return e;if(e>pu)throw v3}throw dy},fy=t=>{let e=t.arr[t.pos++],n=e&63,r=64,o=(e&64)>0?-1:1;if((e&128)===0)return o*n;let i=t.arr.length;for(;t.pos<i;){if(e=t.arr[t.pos++],n=n+(e&127)*r,r*=128,e<128)return o*n;if(n>pu)throw v3}throw dy};var QY=t=>{let e=J(t);if(e===0)return"";{let n=String.fromCodePoint(ha(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(ha(t));else for(;e>0;){let r=e<1e4?e:1e4,o=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,o),e-=r}return decodeURIComponent(escape(n))}},ZY=t=>mu.decode(Ht(t)),wo=mu?ZY:QY;var Vx=(t,e)=>{let n=WY(t.arr,t.pos,e);return t.pos+=e,n},eq=t=>Vx(t,4).getFloat32(0,!1),tq=t=>Vx(t,8).getFloat64(0,!1),nq=t=>Vx(t,8).getBigInt64(0,!1);var rq=[t=>{},t=>null,fy,eq,tq,nq,t=>!1,t=>!0,wo,t=>{let e=J(t),n={};for(let r=0;r<e;r++){let o=wo(t);n[o]=Su(t)}return n},t=>{let e=J(t),n=[];for(let r=0;r<e;r++)n.push(Su(t));return n},Ht],Su=t=>rq[127-ha(t)](t),Gf=class extends wu{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),b3(this)?this.count=J(this)+1:this.count=-1),this.count--,this.s}};var pa=class extends wu{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=fy(this);let e=ny(this.s);this.count=1,e&&(this.s=-this.s,this.count=J(this)+2)}return this.count--,this.s}};var xu=class extends wu{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let e=fy(this),n=e&1;this.diff=Bt(e/2),this.count=1,n&&(this.count=J(this)+2)}return this.s+=this.diff,this.count--,this.s}},uy=class{constructor(e){this.decoder=new pa(e),this.str=wo(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}};var en=()=>new Map,hy=t=>{let e=en();return t.forEach((n,r)=>{e.set(r,n)}),e},Dr=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},w3=(t,e)=>{let n=[];for(let[r,o]of t)n.push(e(o,r));return n},S3=(t,e)=>{for(let[n,r]of t)if(e(r,n))return!0;return!1};var Wf=class{constructor(){this._observers=en()}on(e,n){return Dr(this._observers,e,Zr).add(n),n}once(e,n){let r=(...o)=>{this.off(e,r),n(...o)};this.on(e,r)}off(e,n){let r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return bo((this._observers.get(e)||en()).values()).forEach(r=>r(...n))}destroy(){this._observers=en()}},py=class{constructor(){this._observers=en()}on(e,n){Dr(this._observers,e,Zr).add(n)}once(e,n){let r=(...o)=>{this.off(e,r),n(...o)};this.on(e,r)}off(e,n){let r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return bo((this._observers.get(e)||en()).values()).forEach(r=>r(...n))}destroy(){this._observers=en()}};var uie=crypto.subtle,x3=crypto.getRandomValues.bind(crypto);var oq=Math.random,Fx=()=>x3(new Uint32Array(1))[0];var C3=t=>t[Bt(oq()*t.length)],iq="10000000-1000-4000-8000"+-1e11,E3=()=>iq.replace(/[018]/g,t=>(t^Fx()&15>>t/4).toString(16));var zi=Date.now;var Yx=t=>new Promise(t);var hie=Promise.all.bind(Promise);var qx=t=>t===void 0?null:t;var Kx=class{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}},k3=new Kx,aq=!0;try{typeof localStorage<"u"&&localStorage&&(k3=localStorage,aq=!1)}catch{}var A3=k3;var ma=Symbol("Equality"),my=(t,e)=>t===e||!!t?.[ma]?.(e)||!1;var M3=t=>typeof t=="object",R3=Object.assign,Xx=Object.keys;var O3=(t,e)=>{for(let n in t)e(t[n],n)};var Jf=t=>Xx(t).length;var D3=t=>{for(let e in t)return!1;return!0},Eu=(t,e)=>{for(let n in t)if(!e(t[n],n))return!1;return!0},Qf=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Wx=(t,e)=>t===e||Jf(t)===Jf(e)&&Eu(t,(n,r)=>(n!==void 0||Qf(e,r))&&my(e[r],n)),uq=Object.freeze,Jx=t=>{for(let e in t){let n=t[e];(typeof n=="object"||typeof n=="function")&&Jx(t[e])}return uq(t)};var Zf=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&Zf(t,e,n+1)}};var N3=t=>t;var rl=(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[ma]!=null)return t[ma](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(let n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(let n of t.keys())if(!e.has(n)||!rl(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(Jf(t)!==Jf(e))return!1;for(let n in t)if(!Qf(t,n)||!rl(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(!rl(t[n],e[n]))return!1;break;default:return!1}return!0},_3=(t,e)=>e.includes(t);var Tu=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",th=typeof window<"u"&&typeof document<"u"&&!Tu,pie=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,Go,dq=[],fq=()=>{if(Go===void 0)if(Tu){Go=en();let t=process.argv,e=null;for(let n=0;n<t.length;n++){let r=t[n];r[0]==="-"?(e!==null&&Go.set(e,""),e=r):e!==null?(Go.set(e,r),e=null):dq.push(r)}e!==null&&Go.set(e,"")}else typeof location=="object"?(Go=en(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){let[e,n]=t.split("=");Go.set(`--${Px(e,"-")}`,n),Go.set(`-${Px(e,"-")}`,n)}})):Go=en();return Go},Qx=t=>fq().has(t);var eh=t=>Tu?qx(process.env[t.toUpperCase().replaceAll("-","_")]):qx(A3.getItem(t));var I3=t=>Qx("--"+t)||eh(t)!==null,L3=I3("production"),hq=Tu&&_3(process.env.FORCE_COLOR,["true","1","2"]),z3=hq||!Qx("--no-colors")&&!I3("no-color")&&(!Tu||process.stdout.isTTY)&&(!Tu||Qx("--color")||eh("COLORTERM")!==null||(eh("TERM")||"").includes("color"));var pq=t=>new Uint8Array(t);var mq=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=$f(t[n]);return btoa(e)},gq=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64");var U3=th?mq:gq;var P3=t=>{let e=pq(t.byteLength);return e.set(t),e},B3=t=>y3(e=>tl(e,t));var Zx=class{constructor(e,n){this.left=e,this.right=n}},Xo=(t,e)=>new Zx(t,e);var eC=t=>t.next()>=.5,vy=(t,e,n)=>Bt(t.next()*(n+1-e)+e);var tC=(t,e,n)=>Bt(t.next()*(n+1-e)+e);var nC=(t,e,n)=>tC(t,e,n);var vq=t=>$f(nC(t,97,122)),j3=(t,e=0,n=20)=>{let r=nC(t,e,n),o="";for(let i=0;i<r;i++)o+=vq(t);return o};var by=(t,e)=>e[nC(t,0,e.length-1)];var wq=Symbol("0schema"),rC=class{constructor(){this._rerrs=[]}extend(e,n,r,o=null){this._rerrs.push({path:e,expected:n,has:r,message:o})}toString(){let e=[];for(let n=this._rerrs.length-1;n>0;n--){let r=this._rerrs[n];e.push(f3(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
|
|
50
|
+
`)}},oC=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[ma]?my(t,e):Ii(t)?iy(t,n=>Vf(e,r=>oC(n,r))):M3(t)?Eu(t,(n,r)=>oC(n,e[r])):!1,gn=class{static _dilutes=!1;extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),oC(n,r)}equals(e){return this.constructor===e.constructor&&rl(this.shape,e.shape)}[wq](){return!0}[ma](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){Fn()}get nullable(){return Ou(this,Dy)}get optional(){return new wy(this)}cast(e){return V3(e,this),e}expect(e){return V3(e,this),e}},rh=class extends gn{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n=void 0){let r=e?.constructor===this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),r}},Mt=(t,e=null)=>new rh(t,e),gie=Mt(rh),oh=class extends gn{constructor(e){super(),this.shape=e}check(e,n){let r=this.shape(e);return!r&&n?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),r}},jt=t=>new oh(t),yie=Mt(oh),Mu=class extends gn{constructor(e){super(),this.shape=e}check(e,n){let r=this.shape.some(o=>o===e);return!r&&n?.extend(null,this.shape.join(" | "),e.toString()),r}},Ry=(...t)=>new Mu(t),F3=Mt(Mu),Sq=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),$3=t=>{if(Ru.check(t))return[Sq(t)];if(F3.check(t))return t.shape.map(e=>e+"");if(X3.check(t))return["[+-]?\\d+.?\\d*"];if(W3.check(t))return[".*"];if(Ay.check(t))return t.shape.map($3).flat(1);ft()},iC=class extends gn{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map($3).map(n=>`(${n.join("|")})`).join("")+"$")}check(e,n){let r=this._r.exec(e)!=null;return!r&&n?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),r}};var vie=Mt(iC),xq=Symbol("optional"),wy=class extends gn{constructor(e){super(),this.shape=e}check(e,n){let r=e===void 0||this.shape.check(e);return!r&&n?.extend(null,"undefined (optional)","()"),r}get[xq](){return!0}},Cq=Mt(wy),Sy=class extends gn{check(e,n){return n?.extend(null,"never",typeof e),!1}},bie=new Sy,wie=Mt(Sy),xy=class t extends gn{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}static _dilutes=!0;get partial(){return new t(this.shape,!0)}check(e,n){return e==null?(n?.extend(null,"object","null"),!1):Eu(this.shape,(r,o)=>{let i=this._isPartial&&!Qf(e,o)||r.check(e[o],n);return!i&&n?.extend(o.toString(),r.toString(),typeof e[o],"Object property does not match"),i})}},Eq=t=>new xy(t),Tq=Mt(xy),kq=jt(t=>t!=null&&(t.constructor===Object||t.constructor==null)),Cy=class extends gn{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&Eu(e,(r,o)=>{let i=this.shape.keys.check(o,n);return!i&&n?.extend(o+"","Record",typeof e,i?"Key doesn't match schema":"Value doesn't match value"),i&&this.shape.values.check(r,n)})}},Y3=(t,e)=>new Cy(t,e),Aq=Mt(Cy),Ey=class extends gn{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&Eu(this.shape,(r,o)=>{let i=r.check(e[o],n);return!i&&n?.extend(o.toString(),"Tuple",typeof r),i})}},Mq=(...t)=>new Ey(t),Sie=Mt(Ey),Ty=class extends gn{constructor(e){super(),this.shape=e.length===1?e[0]:new ih(e)}check(e,n){let r=Ii(e)&&iy(e,o=>this.shape.check(o));return!r&&n?.extend(null,"Array",""),r}},q3=(...t)=>new Ty(t),Rq=Mt(Ty),Oq=jt(t=>Ii(t)),ky=class extends gn{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n){let r=e instanceof this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name),r}},Dq=(t,e=null)=>new ky(t,e),xie=Mt(ky),Nq=Dq(gn),sC=class extends gn{constructor(e){super(),this.len=e.length-1,this.args=Mq(...e.slice(-1)),this.res=e[this.len]}check(e,n){let r=e.constructor===Function&&e.length<=this.len;return!r&&n?.extend(null,"function",typeof e),r}};var _q=Mt(sC),Iq=jt(t=>typeof t=="function"),lC=class extends gn{constructor(e){super(),this.shape=e}check(e,n){let r=iy(this.shape,o=>o.check(e,n));return!r&&n?.extend(null,"Intersectinon",typeof e),r}};var Cie=Mt(lC,t=>t.shape.length>0),ih=class extends gn{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,n){let r=Vf(this.shape,o=>o.check(e,n));return n?.extend(null,"Union",typeof e),r}},Ou=(...t)=>t.findIndex(e=>Ay.check(e))>=0?Ou(...t.map(e=>sh(e)).map(e=>Ay.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new ih(t),Ay=Mt(ih),K3=()=>!0,My=jt(K3),Lq=Mt(oh,t=>t.shape===K3),cC=jt(t=>typeof t=="bigint"),zq=jt(t=>t===cC),G3=jt(t=>typeof t=="symbol"),Eie=jt(t=>t===G3),Au=jt(t=>typeof t=="number"),X3=jt(t=>t===Au),Ru=jt(t=>typeof t=="string"),W3=jt(t=>t===Ru),Oy=jt(t=>typeof t=="boolean"),Uq=jt(t=>t===Oy),J3=Ry(void 0),Tie=Mt(Mu,t=>t.shape.length===1&&t.shape[0]===void 0),kie=Ry(void 0);var Dy=Ry(null),Pq=Mt(Mu,t=>t.shape.length===1&&t.shape[0]===null),Aie=Mt(Uint8Array),Mie=Mt(rh,t=>t.shape===Uint8Array),Bq=Ou(Au,Ru,Dy,J3,cC,Oy,G3),Rie=(()=>{let t=q3(My),e=Y3(Ru,My),n=Ou(Au,Ru,Dy,Oy,t,e);return t.shape=n,e.shape.values=n,n})(),sh=t=>{if(Nq.check(t))return t;if(kq.check(t)){let e={};for(let n in t)e[n]=sh(t[n]);return Eq(e)}else{if(Oq.check(t))return Ou(...t.map(sh));if(Bq.check(t))return Ry(t);if(Iq.check(t))return Mt(t)}ft()},V3=L3?()=>{}:(t,e)=>{let n=new rC;if(!e.check(t,n))throw Or(`Expected value to be of type ${e.constructor.name}.
|
|
51
|
+
${n.toString()}`)},aC=class{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:sh(e),h:n}),this}else(e){return this.if(My,e)}done(){return(e,n)=>{for(let r=0;r<this.patterns.length;r++){let o=this.patterns[r];if(o.if.check(e))return o.h(e,n)}throw Or("Unhandled pattern")}}},Hq=t=>new aC(t),Q3=Hq(My).if(X3,(t,e)=>vy(e,zx,pu)).if(W3,(t,e)=>j3(e)).if(Uq,(t,e)=>eC(e)).if(zq,(t,e)=>BigInt(vy(e,zx,pu))).if(Ay,(t,e)=>ku(e,by(e,t.shape))).if(Tq,(t,e)=>{let n={};for(let r in t.shape){let o=t.shape[r];if(Cq.check(o)){if(eC(e))continue;o=o.shape}n[r]=Q3(o,e)}return n}).if(Rq,(t,e)=>{let n=[],r=tC(e,0,42);for(let o=0;o<r;o++)n.push(ku(e,t.shape));return n}).if(F3,(t,e)=>by(e,t.shape)).if(Pq,(t,e)=>null).if(_q,(t,e)=>{let n=ku(e,t.res);return()=>n}).if(Lq,(t,e)=>ku(e,by(e,[Au,Ru,Dy,J3,cC,Oy,q3(Au),Y3(Ou("a","b","c"),Au)]))).if(Aq,(t,e)=>{let n={},r=vy(e,0,3);for(let o=0;o<r;o++){let i=ku(e,t.shape.keys),s=ku(e,t.shape.values);n[i]=s}return n}).done(),ku=(t,e)=>Q3(sh(e),t);var Ui=typeof document<"u"?document:{};var Oie=jt(t=>t.nodeType===Yq);var Die=typeof DOMParser<"u"?new DOMParser:null;var Nie=jt(t=>t.nodeType===Vq);var _ie=jt(t=>t.nodeType===Fq);var Z3=t=>w3(t,(e,n)=>`${n}:${e};`).join("");var Vq=Ui.ELEMENT_NODE,Fq=Ui.TEXT_NODE,Iie=Ui.CDATA_SECTION_NODE,Lie=Ui.COMMENT_NODE,$q=Ui.DOCUMENT_NODE,zie=Ui.DOCUMENT_TYPE_NODE,Yq=Ui.DOCUMENT_FRAGMENT_NODE,Uie=jt(t=>t.nodeType===$q);var Ny=t=>class{constructor(n){this._=n}destroy(){t(this._)}},qq=Ny(clearTimeout),Du=(t,e)=>new qq(setTimeout(e,t)),Bie=Ny(clearInterval);var Hie=Ny(t=>typeof requestAnimationFrame<"u"&&cancelAnimationFrame(t));var jie=Ny(t=>typeof cancelIdleCallback<"u"&&cancelIdleCallback(t));var Wo=Symbol;var lh=Wo(),ah=Wo(),uC=Wo(),dC=Wo(),fC=Wo(),ch=Wo(),hC=Wo(),Nu=Wo(),pC=Wo(),tL=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());let e=[],n=[],r=0;for(;r<t.length;r++){let o=t[r];if(o===void 0)break;if(o.constructor===String||o.constructor===Number)e.push(o);else if(o.constructor===Object)break}for(r>0&&n.push(e.join(""));r<t.length;r++){let o=t[r];o instanceof Symbol||n.push(o)}return n};var Vie=zi();var Wq={[lh]:Xo("font-weight","bold"),[ah]:Xo("font-weight","normal"),[uC]:Xo("color","blue"),[fC]:Xo("color","green"),[dC]:Xo("color","grey"),[ch]:Xo("color","red"),[hC]:Xo("color","purple"),[Nu]:Xo("color","orange"),[pC]:Xo("color","black")},Jq=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());let e=[],n=[],r=en(),o=[],i=0;for(;i<t.length;i++){let s=t[i],l=Wq[s];if(l!==void 0)r.set(l.left,l.right);else{if(s===void 0)break;if(s.constructor===String||s.constructor===Number){let a=Z3(r);i>0||a.length>0?(e.push("%c"+s),n.push(a)):e.push(s)}else break}}for(i>0&&(o=n,o.unshift(e.join("")));i<t.length;i++){let s=t[i];s instanceof Symbol||o.push(s)}return o},nL=z3?Jq:tL,rL=(...t)=>{console.log(...nL(t)),oL.forEach(e=>e.print(t))},mC=(...t)=>{console.warn(...nL(t)),t.unshift(Nu),oL.forEach(e=>e.print(t))};var oL=Zr();var iL=t=>({[Symbol.iterator](){return this},next:t}),sL=(t,e)=>iL(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),_y=(t,e)=>iL(()=>{let{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});var _u=class{constructor(e,n){this.clock=e,this.len=n}},al=class{constructor(){this.clients=new Map}},Pi=(t,e,n)=>e.clients.forEach((r,o)=>{let i=t.doc.store.clients.get(o);if(i!=null){let s=i[i.length-1],l=s.id.clock+s.length;for(let a=0,c=r[a];a<r.length&&c.clock<l;c=r[++a])RL(t,i,c.clock,c.len,n)}}),nK=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){let o=Bt((n+r)/2),i=t[o],s=i.clock;if(s<=e){if(e<s+i.len)return o;n=o+1}else r=o-1}return null},wa=(t,e)=>{let n=t.clients.get(e.client);return n!==void 0&&nK(n,e.clock)!==null},_C=t=>{t.clients.forEach(e=>{e.sort((o,i)=>o.clock-i.clock);let n,r;for(n=1,r=1;n<e.length;n++){let o=e[r-1],i=e[n];o.clock+o.len>=i.clock?e[r-1]=new _u(o.clock,rr(o.len,i.clock+i.len-o.clock)):(r<n&&(e[r]=i),r++)}e.length=r})},yC=t=>{let e=new al;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,o)=>{if(!e.clients.has(o)){let i=r.slice();for(let s=n+1;s<t.length;s++)c3(i,t[s].clients.get(o)||[]);e.clients.set(o,i)}});return _C(e),e},dh=(t,e,n,r)=>{Dr(t.clients,e,()=>[]).push(new _u(n,r))},Xy=()=>new al,CL=t=>{let e=Xy();return t.clients.forEach((n,r)=>{let o=[];for(let i=0;i<n.length;i++){let s=n[i];if(s.deleted){let l=s.id.clock,a=s.length;if(i+1<n.length)for(let c=n[i+1];i+1<n.length&&c.deleted;c=n[++i+1])a+=c.length;o.push(new _u(l,a))}}o.length>0&&e.clients.set(r,o)}),e},Hu=(t,e)=>{W(t.restEncoder,e.clients.size),bo(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),W(t.restEncoder,n);let o=r.length;W(t.restEncoder,o);for(let i=0;i<o;i++){let s=r[i];t.writeDsClock(s.clock),t.writeDsLen(s.len)}})},IC=t=>{let e=new al,n=J(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();let o=J(t.restDecoder),i=J(t.restDecoder);if(i>0){let s=Dr(e.clients,o,()=>[]);for(let l=0;l<i;l++)s.push(new _u(t.readDsClock(),t.readDsLen()))}}return e},cL=(t,e,n)=>{let r=new al,o=J(t.restDecoder);for(let i=0;i<o;i++){t.resetDsCurVal();let s=J(t.restDecoder),l=J(t.restDecoder),a=n.clients.get(s)||[],c=lt(n,s);for(let u=0;u<l;u++){let d=t.readDsClock(),f=d+t.readDsLen();if(d<c){c<f&&dh(r,s,c,f-c);let h=to(a,d),p=a[h];for(!p.deleted&&p.id.clock<d&&(a.splice(h+1,0,Gy(e,p,d-p.id.clock)),h++);h<a.length&&(p=a[h++],p.id.clock<f);)p.deleted||(f<p.id.clock+p.length&&a.splice(h,0,Gy(e,p,f-p.id.clock)),p.delete(e))}else dh(r,s,d,f-d)}}if(r.clients.size>0){let i=new Bi;return W(i.restEncoder,0),Hu(i,r),i.toUint8Array()}return null};var EL=Fx,cr=class t extends Wf{constructor({guid:e=E3(),collectionid:n=null,gc:r=!0,gcFilter:o=()=>!0,meta:i=null,autoLoad:s=!1,shouldLoad:l=!0}={}){super(),this.gc=r,this.gcFilter=o,this.clientID=EL(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new Fy,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=l,this.autoLoad=s,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=Yx(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});let a=()=>Yx(c=>{let u=d=>{(d===void 0||d===!0)&&(this.off("sync",u),c())};this.on("sync",u)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=a()}load(){let e=this._item;e!==null&&!this.shouldLoad&&Fe(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(bo(this.subdocs).map(e=>e.guid))}transact(e,n=null){return Fe(this,e,n)}get(e,n=Ze){let r=Dr(this.share,e,()=>{let i=new n;return i._integrate(this,null),i}),o=r.constructor;if(n!==Ze&&o!==n)if(o===Ze){let i=new n;i._map=r._map,r._map.forEach(s=>{for(;s!==null;s=s.left)s.parent=i}),i._start=r._start;for(let s=i._start;s!==null;s=s.right)s.parent=i;return i._length=r._length,this.share.set(e,i),i._integrate(this,null),i}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,Pu)}getText(e=""){return this.get(e,Nr)}getMap(e=""){return this.get(e,va)}getXmlElement(e=""){return this.get(e,Ce)}getXmlFragment(e=""){return this.get(e,ur)}toJSON(){let e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,bo(this.subdocs).forEach(n=>n.destroy());let e=this._item;if(e!==null){this._item=null;let n=e.content;n.doc=new t({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,Fe(e.parent.doc,r=>{let o=n.doc;e.deleted||r.subdocsAdded.add(o),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}},By=class{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return J(this.restDecoder)}readDsLen(){return J(this.restDecoder)}},Hy=class extends By{readLeftID(){return K(J(this.restDecoder),J(this.restDecoder))}readRightID(){return K(J(this.restDecoder),J(this.restDecoder))}readClient(){return J(this.restDecoder)}readInfo(){return ha(this.restDecoder)}readString(){return wo(this.restDecoder)}readParentInfo(){return J(this.restDecoder)===1}readTypeRef(){return J(this.restDecoder)}readLen(){return J(this.restDecoder)}readAny(){return Su(this.restDecoder)}readBuf(){return P3(Ht(this.restDecoder))}readJSON(){return JSON.parse(wo(this.restDecoder))}readKey(){return wo(this.restDecoder)}},vC=class{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=J(this.restDecoder),this.dsCurrVal}readDsLen(){let e=J(this.restDecoder)+1;return this.dsCurrVal+=e,e}},cl=class extends vC{constructor(e){super(e),this.keys=[],J(e),this.keyClockDecoder=new xu(Ht(e)),this.clientDecoder=new pa(Ht(e)),this.leftClockDecoder=new xu(Ht(e)),this.rightClockDecoder=new xu(Ht(e)),this.infoDecoder=new Gf(Ht(e),ha),this.stringDecoder=new uy(Ht(e)),this.parentInfoDecoder=new Gf(Ht(e),ha),this.typeRefDecoder=new pa(Ht(e)),this.lenDecoder=new pa(Ht(e))}readLeftID(){return new sl(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new sl(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 Su(this.restDecoder)}readBuf(){return Ht(this.restDecoder)}readJSON(){return Su(this.restDecoder)}readKey(){let e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{let n=this.stringDecoder.read();return this.keys.push(n),n}}},jy=class{constructor(){this.restEncoder=eo()}toUint8Array(){return Zt(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){W(this.restEncoder,e)}writeDsLen(e){W(this.restEncoder,e)}},ya=class extends jy{writeLeftID(e){W(this.restEncoder,e.client),W(this.restEncoder,e.clock)}writeRightID(e){W(this.restEncoder,e.client),W(this.restEncoder,e.clock)}writeClient(e){W(this.restEncoder,e)}writeInfo(e){ay(this.restEncoder,e)}writeString(e){Li(this.restEncoder,e)}writeParentInfo(e){W(this.restEncoder,e?1:0)}writeTypeRef(e){W(this.restEncoder,e)}writeLen(e){W(this.restEncoder,e)}writeAny(e){tl(this.restEncoder,e)}writeBuf(e){At(this.restEncoder,e)}writeJSON(e){Li(this.restEncoder,JSON.stringify(e))}writeKey(e){Li(this.restEncoder,e)}},Vy=class{constructor(){this.restEncoder=eo(),this.dsCurrVal=0}toUint8Array(){return Zt(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){let n=e-this.dsCurrVal;this.dsCurrVal=e,W(this.restEncoder,n)}writeDsLen(e){e===0&&ft(),W(this.restEncoder,e-1),this.dsCurrVal+=e}},Bi=class extends Vy{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new vu,this.clientEncoder=new fa,this.leftClockEncoder=new vu,this.rightClockEncoder=new vu,this.infoEncoder=new qf(ay),this.stringEncoder=new ly,this.parentInfoEncoder=new qf(ay),this.typeRefEncoder=new fa,this.lenEncoder=new fa}toUint8Array(){let e=eo();return W(e,0),At(e,this.keyClockEncoder.toUint8Array()),At(e,this.clientEncoder.toUint8Array()),At(e,this.leftClockEncoder.toUint8Array()),At(e,this.rightClockEncoder.toUint8Array()),At(e,Zt(this.infoEncoder)),At(e,this.stringEncoder.toUint8Array()),At(e,Zt(this.parentInfoEncoder)),At(e,this.typeRefEncoder.toUint8Array()),At(e,this.lenEncoder.toUint8Array()),Kf(e,Zt(this.restEncoder)),Zt(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){tl(this.restEncoder,e)}writeBuf(e){At(this.restEncoder,e)}writeJSON(e){tl(this.restEncoder,e)}writeKey(e){let n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}},rK=(t,e,n,r)=>{r=rr(r,e[0].id.clock);let o=to(e,r);W(t.restEncoder,e.length-o),t.writeClient(n),W(t.restEncoder,r);let i=e[o];i.write(t,r-i.id.clock);for(let s=o+1;s<e.length;s++)e[s].write(t,0)},LC=(t,e,n)=>{let r=new Map;n.forEach((o,i)=>{lt(e,i)>o&&r.set(i,o)}),Sh(e).forEach((o,i)=>{n.has(i)||r.set(i,0)}),W(t.restEncoder,r.size),bo(r.entries()).sort((o,i)=>i[0]-o[0]).forEach(([o,i])=>{rK(t,e.clients.get(o),o,i)})},oK=(t,e)=>{let n=en(),r=J(t.restDecoder);for(let o=0;o<r;o++){let i=J(t.restDecoder),s=new Array(i),l=t.readClient(),a=J(t.restDecoder);n.set(l,{i:0,refs:s});for(let c=0;c<i;c++){let u=t.readInfo();switch(31&u){case 0:{let d=t.readLen();s[c]=new sr(K(l,a),d),a+=d;break}case 10:{let d=J(t.restDecoder);s[c]=new lr(K(l,a),d),a+=d;break}default:{let d=(u&192)===0,f=new xe(K(l,a),null,(u&128)===128?t.readLeftID():null,null,(u&64)===64?t.readRightID():null,d?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,d&&(u&32)===32?t.readString():null,XL(t,u));s[c]=f,a+=f.length}}}}return n},iK=(t,e,n)=>{let r=[],o=bo(n.keys()).sort((h,p)=>h-p);if(o.length===0)return null;let i=()=>{if(o.length===0)return null;let h=n.get(o[o.length-1]);for(;h.refs.length===h.i;)if(o.pop(),o.length>0)h=n.get(o[o.length-1]);else return null;return h},s=i();if(s===null)return null;let l=new Fy,a=new Map,c=(h,p)=>{let m=a.get(h);(m==null||m>p)&&a.set(h,p)},u=s.refs[s.i++],d=new Map,f=()=>{for(let h of r){let p=h.id.client,m=n.get(p);m?(m.i--,l.clients.set(p,m.refs.slice(m.i)),n.delete(p),m.i=0,m.refs=[]):l.clients.set(p,[h]),o=o.filter(y=>y!==p)}r.length=0};for(;;){if(u.constructor!==lr){let p=Dr(d,u.id.client,()=>lt(e,u.id.client))-u.id.clock;if(p<0)r.push(u),c(u.id.client,u.id.clock-1),f();else{let m=u.getMissing(t,e);if(m!==null){r.push(u);let y=n.get(m)||{refs:[],i:0};if(y.refs.length===y.i)c(m,lt(e,m)),f();else{u=y.refs[y.i++];continue}}else(p===0||p<u.length)&&(u.integrate(t,p),d.set(u.id.client,u.id.clock+u.length))}}if(r.length>0)u=r.pop();else if(s!==null&&s.i<s.refs.length)u=s.refs[s.i++];else{if(s=i(),s===null)break;u=s.refs[s.i++]}}if(l.clients.size>0){let h=new Bi;return LC(h,l,new Map),W(h.restEncoder,0),{missing:a,update:h.toUint8Array()}}return null},sK=(t,e)=>LC(t,e.doc.store,e.beforeState),lK=(t,e,n,r=new cl(t))=>Fe(e,o=>{o.local=!1;let i=!1,s=o.doc,l=s.store,a=oK(r,s),c=iK(o,l,a),u=l.pendingStructs;if(u){for(let[f,h]of u.missing)if(h<lt(l,f)){i=!0;break}if(c){for(let[f,h]of c.missing){let p=u.missing.get(f);(p==null||p>h)&&u.missing.set(f,h)}u.update=$y([u.update,c.update])}}else l.pendingStructs=c;let d=cL(r,o,l);if(l.pendingDs){let f=new cl(So(l.pendingDs));J(f.restDecoder);let h=cL(f,o,l);d&&h?l.pendingDs=$y([d,h]):l.pendingDs=d||h}else l.pendingDs=d;if(i){let f=l.pendingStructs.update;l.pendingStructs=null,wh(o.doc,f)}},n,!1);var wh=(t,e,n,r=cl)=>{let o=So(e);lK(o,t,n,new r(o))},ju=(t,e,n)=>wh(t,e,n,Hy),aK=(t,e,n=new Map)=>{LC(t,e.store,n),Hu(t,CL(e.store))},cK=(t,e=new Uint8Array([0]),n=new Bi)=>{let r=Jy(e);aK(n,t,r);let o=[n.toUint8Array()];if(t.store.pendingDs&&o.push(t.store.pendingDs),t.store.pendingStructs&&o.push(xK(t.store.pendingStructs.update,e)),o.length>1){if(n.constructor===ya)return wK(o.map((i,s)=>s===0?i:EK(i)));if(n.constructor===Bi)return $y(o)}return o[0]},Wy=(t,e)=>cK(t,e,new ya),uK=t=>{let e=new Map,n=J(t.restDecoder);for(let r=0;r<n;r++){let o=J(t.restDecoder),i=J(t.restDecoder);e.set(o,i)}return e},Jy=t=>uK(new By(So(t))),TL=(t,e)=>(W(t.restEncoder,e.size),bo(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{W(t.restEncoder,n),W(t.restEncoder,r)}),t),dK=(t,e)=>TL(t,Sh(e.store)),fK=(t,e=new Vy)=>(t instanceof Map?TL(e,t):dK(e,t),e.toUint8Array()),Qy=t=>fK(t,new jy),bC=class{constructor(){this.l=[]}},uL=()=>new bC,dL=(t,e)=>t.l.push(e),fL=(t,e)=>{let n=t.l,r=n.length;t.l=n.filter(o=>e!==o),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},kL=(t,e,n)=>Zf(t.l,[e,n]),sl=class{constructor(e,n){this.client=e,this.clock=n}},ar=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,K=(t,e)=>new sl(t,e);var ji=t=>{for(let[e,n]of t.doc.share.entries())if(n===t)return e;throw ft()},Iu=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};var Hi=class{constructor(e,n,r,o=0){this.type=e,this.tname=n,this.item=r,this.assoc=o}};var Vu=t=>new Hi(t.type==null?null:K(t.type.client,t.type.clock),t.tname??null,t.item==null?null:K(t.item.client,t.item.clock),t.assoc==null?0:t.assoc),wC=class{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}},hK=(t,e,n=0)=>new wC(t,e,n),Iy=(t,e,n)=>{let r=null,o=null;return t._item===null?o=ji(t):r=K(t._item.id.client,t._item.id.clock),new Hi(r,o,e,n)},Sa=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return Iy(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Iy(t,K(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return Iy(t,r.lastId,n);r=r.right}return Iy(t,null,n)};var pK=(t,e)=>{let n=ll(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},zC=(t,e,n=!0)=>{let r=e.store,o=t.item,i=t.type,s=t.tname,l=t.assoc,a=null,c=0;if(o!==null){if(lt(r,o.client)<=o.clock)return null;let u=n?DC(r,o):pK(r,o),d=u.item;if(!(d instanceof xe))return null;if(a=d.parent,a._item===null||!a._item.deleted){c=d.deleted||!d.countable?0:u.diff+(l>=0?0:1);let f=d.left;for(;f!==null;)!f.deleted&&f.countable&&(c+=f.length),f=f.left}}else{if(s!==null)a=e.get(s);else if(i!==null){if(lt(r,i.client)<=i.clock)return null;let{item:u}=n?DC(r,i):{item:ll(r,i)};if(u instanceof xe&&u.content instanceof tn)a=u.content.type;else return null}else throw ft();l>=0?c=a._length:c=0}return hK(a,c,t.assoc)},Zy=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&ar(t.item,e.item)&&ar(t.type,e.type)&&t.assoc===e.assoc,Lu=class{constructor(e,n){this.ds=e,this.sv=n}};var e0=(t,e)=>new Lu(t,e),AL=e0(Xy(),new Map),t0=t=>e0(CL(t.store),Sh(t.store)),ga=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!wa(e.ds,t.id),SC=(t,e)=>{let n=Dr(t.meta,SC,Zr),r=t.doc.store;n.has(e)||(e.sv.forEach((o,i)=>{o<lt(r,i)&&ir(t,K(i,o))}),Pi(t,e.ds,o=>{}),n.add(e))};var Fy=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},Sh=t=>{let e=new Map;return t.clients.forEach((n,r)=>{let o=n[n.length-1];e.set(r,o.id.clock+o.length)}),e},lt=(t,e)=>{let n=t.clients.get(e);if(n===void 0)return 0;let r=n[n.length-1];return r.id.clock+r.length},ML=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{let r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw ft()}n.push(e)},to=(t,e)=>{let n=0,r=t.length-1,o=t[r],i=o.id.clock;if(i===e)return r;let s=Bt(e/(i+o.length-1)*r);for(;n<=r;){if(o=t[s],i=o.id.clock,i<=e){if(e<i+o.length)return s;n=s+1}else r=s-1;s=Bt((n+r)/2)}throw ft()},mK=(t,e)=>{let n=t.clients.get(e.client);return n[to(n,e.clock)]},ll=mK,xC=(t,e,n)=>{let r=to(e,n),o=e[r];return o.id.clock<n&&o instanceof xe?(e.splice(r+1,0,Gy(t,o,n-o.id.clock)),r+1):r},ir=(t,e)=>{let n=t.doc.store.clients.get(e.client);return n[xC(t,n,e.clock)]},hL=(t,e,n)=>{let r=e.clients.get(n.client),o=to(r,n.clock),i=r[o];return n.clock!==i.id.clock+i.length-1&&i.constructor!==sr&&r.splice(o+1,0,Gy(t,i,n.clock-i.id.clock+1)),i},gK=(t,e,n)=>{let r=t.clients.get(e.id.client);r[to(r,e.id.clock)]=n},RL=(t,e,n,r,o)=>{if(r===0)return;let i=n+r,s=xC(t,e,n),l;do l=e[s++],i<l.id.clock+l.length&&xC(t,e,i),o(l);while(s<e.length&&e[s].id.clock<i)},CC=class{constructor(e,n,r){this.doc=e,this.deleteSet=new al,this.beforeState=Sh(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}},pL=(t,e)=>e.deleteSet.clients.size===0&&!S3(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(_C(e.deleteSet),sK(t,e),Hu(t,e.deleteSet),!0),mL=(t,e,n)=>{let r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&Dr(t.changed,e,Zr).add(n)},Uy=(t,e)=>{let n=t[e],r=t[e-1],o=e;for(;o>0;n=r,r=t[--o-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof xe&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}let i=e-o;return i&&t.splice(e+1-i,i),i},yK=(t,e,n)=>{for(let[r,o]of t.clients.entries()){let i=e.clients.get(r);for(let s=o.length-1;s>=0;s--){let l=o[s],a=l.clock+l.len;for(let c=to(i,l.clock),u=i[c];c<i.length&&u.id.clock<a;u=i[++c]){let d=i[c];if(l.clock+l.len<=d.id.clock)break;d instanceof xe&&d.deleted&&!d.keep&&n(d)&&d.gc(e,!1)}}}},vK=(t,e)=>{t.clients.forEach((n,r)=>{let o=e.clients.get(r);for(let i=n.length-1;i>=0;i--){let s=n[i],l=Rr(o.length-1,1+to(o,s.clock+s.len-1));for(let a=l,c=o[a];a>0&&c.id.clock>=s.clock;c=o[a])a-=1+Uy(o,a)}})};var OL=(t,e)=>{if(e<t.length){let n=t[e],r=n.doc,o=r.store,i=n.deleteSet,s=n._mergeStructs;try{_C(i),n.afterState=Sh(n.doc.store),r.emit("beforeObserverCalls",[n,r]);let l=[];n.changed.forEach((a,c)=>l.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(n,a)})),l.push(()=>{n.changedParentTypes.forEach((a,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&l.push(()=>{a=a.filter(u=>u.target._item===null||!u.target._item.deleted),a.forEach(u=>{u.currentTarget=c,u._path=null}),a.sort((u,d)=>u.path.length-d.path.length),kL(c._dEH,a,n)})}),l.push(()=>r.emit("afterTransaction",[n,r])),l.push(()=>{n._needFormattingCleanup&&LK(n)})}),Zf(l,[])}finally{r.gc&&yK(i,o,r.gcFilter),vK(i,o),n.afterState.forEach((u,d)=>{let f=n.beforeState.get(d)||0;if(f!==u){let h=o.clients.get(d),p=rr(to(h,f),1);for(let m=h.length-1;m>=p;)m-=1+Uy(h,m)}});for(let u=s.length-1;u>=0;u--){let{client:d,clock:f}=s[u].id,h=o.clients.get(d),p=to(h,f);p+1<h.length&&Uy(h,p+1)>1||p>0&&Uy(h,p)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(rL(Nu,lh,"[yjs] ",ah,ch,"Changed the client-id because another client seems to be using it."),r.clientID=EL()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){let u=new ya;pL(u,n)&&r.emit("update",[u.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){let u=new Bi;pL(u,n)&&r.emit("updateV2",[u.toUint8Array(),n.origin,r,n])}let{subdocsAdded:l,subdocsLoaded:a,subdocsRemoved:c}=n;(l.size>0||c.size>0||a.size>0)&&(l.forEach(u=>{u.clientID=r.clientID,u.collectionid==null&&(u.collectionid=r.collectionid),r.subdocs.add(u)}),c.forEach(u=>r.subdocs.delete(u)),r.emit("subdocs",[{loaded:a,added:l,removed:c},r,n]),c.forEach(u=>u.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):OL(t,e+1)}}},Fe=(t,e,n=null,r=!0)=>{let o=t._transactionCleanups,i=!1,s=null;t._transaction===null&&(i=!0,t._transaction=new CC(t,n,r),o.push(t._transaction),o.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{s=e(t._transaction)}finally{if(i){let l=t._transaction===o[0];t._transaction=null,l&&OL(o,0)}}return s},EC=class{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}},gL=(t,e,n)=>{Pi(t,n.deletions,r=>{r instanceof xe&&e.scope.some(o=>o===t.doc||Iu(o,r))&&VC(r,!1)})},yL=(t,e,n)=>{let r=null,o=t.doc,i=t.scope;Fe(o,l=>{for(;e.length>0&&t.currStackItem===null;){let a=o.store,c=e.pop(),u=new Set,d=[],f=!1;Pi(l,c.insertions,h=>{if(h instanceof xe){if(h.redone!==null){let{item:p,diff:m}=DC(a,h.id);m>0&&(p=ir(l,K(p.id.client,p.id.clock+m))),h=p}!h.deleted&&i.some(p=>p===l.doc||Iu(p,h))&&d.push(h)}}),Pi(l,c.deletions,h=>{h instanceof xe&&i.some(p=>p===l.doc||Iu(p,h))&&!wa(c.insertions,h.id)&&u.add(h)}),u.forEach(h=>{f=GL(l,h,u,c.insertions,t.ignoreRemoteMapChanges,t)!==null||f});for(let h=d.length-1;h>=0;h--){let p=d[h];t.deleteFilter(p)&&(p.delete(l),f=!0)}t.currStackItem=f?c:null}l.changed.forEach((a,c)=>{a.has(null)&&c._searchMarker&&(c._searchMarker.length=0)}),r=l},t);let s=t.currStackItem;if(s!=null){let l=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:s,type:n,changedParentTypes:l,origin:t},t]),t.currStackItem=null}return s},zu=class extends Wf{constructor(e,{captureTimeout:n=500,captureTransaction:r=a=>!0,deleteFilter:o=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:s=!1,doc:l=Ii(e)?e[0].doc:e instanceof cr?e:e.doc}={}){super(),this.scope=[],this.doc=l,this.addToScope(e),this.deleteFilter=o,i.add(this),this.trackedOrigins=i,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=s,this.captureTimeout=n,this.afterTransactionHandler=a=>{if(!this.captureTransaction(a)||!this.scope.some(y=>a.changedParentTypes.has(y)||y===this.doc)||!this.trackedOrigins.has(a.origin)&&(!a.origin||!this.trackedOrigins.has(a.origin.constructor)))return;let c=this.undoing,u=this.redoing,d=c?this.redoStack:this.undoStack;c?this.stopCapturing():u||this.clear(!1,!0);let f=new al;a.afterState.forEach((y,g)=>{let v=a.beforeState.get(g)||0,b=y-v;b>0&&dh(f,g,v,b)});let h=zi(),p=!1;if(this.lastChange>0&&h-this.lastChange<this.captureTimeout&&d.length>0&&!c&&!u){let y=d[d.length-1];y.deletions=yC([y.deletions,a.deleteSet]),y.insertions=yC([y.insertions,f])}else d.push(new EC(a.deleteSet,f)),p=!0;!c&&!u&&(this.lastChange=h),Pi(a,a.deleteSet,y=>{y instanceof xe&&this.scope.some(g=>g===a.doc||Iu(g,y))&&VC(y,!0)});let m=[{stackItem:d[d.length-1],origin:a.origin,type:c?"redo":"undo",changedParentTypes:a.changedParentTypes},this];p?this.emit("stack-item-added",m):this.emit("stack-item-updated",m)},this.destroy=this.destroy.bind(this),this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",this.destroy)}addToScope(e){let n=new Set(this.scope);e=Ii(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof Ze?r.doc!==this.doc:r!==this.doc)&&mC("[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(o=>gL(r,this,o)),this.undoStack=[]),n&&(this.redoStack.forEach(o=>gL(r,this,o)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=yL(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=yL(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),this.doc.off("destroy",this.destroy),super.destroy()}};function*bK(t){let e=J(t.restDecoder);for(let n=0;n<e;n++){let r=J(t.restDecoder),o=t.readClient(),i=J(t.restDecoder);for(let s=0;s<r;s++){let l=t.readInfo();if(l===10){let a=J(t.restDecoder);yield new lr(K(o,i),a),i+=a}else if((31&l)!==0){let a=(l&192)===0,c=new xe(K(o,i),null,(l&128)===128?t.readLeftID():null,null,(l&64)===64?t.readRightID():null,a?t.readParentInfo()?t.readString():t.readLeftID():null,a&&(l&32)===32?t.readString():null,XL(t,l));yield c,i+=c.length}else{let a=t.readLen();yield new sr(K(o,i),a),i+=a}}}}var fh=class{constructor(e,n){this.gen=bK(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===lr);return this.curr}};var hh=class{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}},wK=t=>$y(t,Hy,ya);var SK=(t,e)=>{if(t.constructor===sr){let{client:n,clock:r}=t.id;return new sr(K(n,r+e),t.length-e)}else if(t.constructor===lr){let{client:n,clock:r}=t.id;return new lr(K(n,r+e),t.length-e)}else{let n=t,{client:r,clock:o}=n.id;return new xe(K(r,o+e),null,K(r,o+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},$y=(t,e=cl,n=Bi)=>{if(t.length===1)return t[0];let r=t.map(u=>new e(So(u))),o=r.map(u=>new fh(u,!0)),i=null,s=new n,l=new hh(s);for(;o=o.filter(f=>f.curr!==null),o.sort((f,h)=>{if(f.curr.id.client===h.curr.id.client){let p=f.curr.id.clock-h.curr.id.clock;return p===0?f.curr.constructor===h.curr.constructor?0:f.curr.constructor===lr?1:-1:p}else return h.curr.id.client-f.curr.id.client}),o.length!==0;){let u=o[0],d=u.curr.id.client;if(i!==null){let f=u.curr,h=!1;for(;f!==null&&f.id.clock+f.length<=i.struct.id.clock+i.struct.length&&f.id.client>=i.struct.id.client;)f=u.next(),h=!0;if(f===null||f.id.client!==d||h&&f.id.clock>i.struct.id.clock+i.struct.length)continue;if(d!==i.struct.id.client)ol(l,i.struct,i.offset),i={struct:f,offset:0},u.next();else if(i.struct.id.clock+i.struct.length<f.id.clock)if(i.struct.constructor===lr)i.struct.length=f.id.clock+f.length-i.struct.id.clock;else{ol(l,i.struct,i.offset);let p=f.id.clock-i.struct.id.clock-i.struct.length;i={struct:new lr(K(d,i.struct.id.clock+i.struct.length),p),offset:0}}else{let p=i.struct.id.clock+i.struct.length-f.id.clock;p>0&&(i.struct.constructor===lr?i.struct.length-=p:f=SK(f,p)),i.struct.mergeWith(f)||(ol(l,i.struct,i.offset),i={struct:f,offset:0},u.next())}}else i={struct:u.curr,offset:0},u.next();for(let f=u.curr;f!==null&&f.id.client===d&&f.id.clock===i.struct.id.clock+i.struct.length&&f.constructor!==lr;f=u.next())ol(l,i.struct,i.offset),i={struct:f,offset:0}}i!==null&&(ol(l,i.struct,i.offset),i=null),UC(l);let a=r.map(u=>IC(u)),c=yC(a);return Hu(s,c),s.toUint8Array()},xK=(t,e,n=cl,r=Bi)=>{let o=Jy(e),i=new r,s=new hh(i),l=new n(So(t)),a=new fh(l,!1);for(;a.curr;){let u=a.curr,d=u.id.client,f=o.get(d)||0;if(a.curr.constructor===lr){a.next();continue}if(u.id.clock+u.length>f)for(ol(s,u,rr(f-u.id.clock,0)),a.next();a.curr&&a.curr.id.client===d;)ol(s,a.curr,0),a.next();else for(;a.curr&&a.curr.id.client===d&&a.curr.id.clock+a.curr.length<=f;)a.next()}UC(s);let c=IC(l);return Hu(i,c),i.toUint8Array()};var DL=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:Zt(t.encoder.restEncoder)}),t.encoder.restEncoder=eo(),t.written=0)},ol=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&DL(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),W(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},UC=t=>{DL(t);let e=t.encoder.restEncoder;W(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){let r=t.clientStructs[n];W(e,r.written),Kf(e,r.restEncoder)}},CK=(t,e,n,r)=>{let o=new n(So(t)),i=new fh(o,!1),s=new r,l=new hh(s);for(let c=i.curr;c!==null;c=i.next())ol(l,e(c),0);UC(l);let a=IC(o);return Hu(s,a),s.toUint8Array()};var EK=t=>CK(t,N3,cl,ya),vL="You must not compute changes after the event-handler fired.",Uu=class{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=TK(this.currentTarget,this.target))}deletes(e){return wa(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Or(vL);let e=new Map,n=this.target;this.transaction.changed.get(n).forEach(o=>{if(o!==null){let i=n._map.get(o),s,l;if(this.adds(i)){let a=i.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(i))if(a!==null&&this.deletes(a))s="delete",l=oy(a.content.getContent());else return;else a!==null&&this.deletes(a)?(s="update",l=oy(a.content.getContent())):(s="add",l=void 0)}else if(this.deletes(i))s="delete",l=oy(i.content.getContent());else return;e.set(o,{action:s,oldValue:l})}}),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 Or(vL);let n=this.target,r=Zr(),o=Zr(),i=[];if(e={added:r,deleted:o,delta:i,keys:this.keys},this.transaction.changed.get(n).has(null)){let l=null,a=()=>{l&&i.push(l)};for(let c=n._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((l===null||l.delete===void 0)&&(a(),l={delete:0}),l.delete+=c.length,o.add(c)):this.adds(c)?((l===null||l.insert===void 0)&&(a(),l={insert:[]}),l.insert=l.insert.concat(c.content.getContent()),r.add(c)):((l===null||l.retain===void 0)&&(a(),l={retain:0}),l.retain+=c.length);l!==null&&l.retain===void 0&&a()}this._changes=e}return e}},TK=(t,e)=>{let n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,o=e._item.parent._start;for(;o!==e._item&&o!==null;)!o.deleted&&o.countable&&(r+=o.length),o=o.right;n.unshift(r)}e=e._item.parent}return n},Mn=()=>{mC("Invalid access: Add Yjs type to a document before reading data.")},NL=80,PC=0,TC=class{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=PC++}},kK=t=>{t.timestamp=PC++},_L=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=PC++},AK=(t,e,n)=>{if(t.length>=NL){let r=t.reduce((o,i)=>o.timestamp<i.timestamp?o:i);return _L(r,e,n),r}else{let r=new TC(e,n);return t.push(r),r}},n0=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;let n=t._searchMarker.length===0?null:t._searchMarker.reduce((i,s)=>ua(e-i.index)<ua(e-s.index)?i:s),r=t._start,o=0;for(n!==null&&(r=n.p,o=n.index,kK(n));r.right!==null&&o<e;){if(!r.deleted&&r.countable){if(e<o+r.length)break;o+=r.length}r=r.right}for(;r.left!==null&&o>e;)r=r.left,!r.deleted&&r.countable&&(o-=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&&(o-=r.length);return n!==null&&ua(n.index-o)<r.parent.length/NL?(_L(n,r,o),n):AK(t._searchMarker,r,o)},ph=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){let o=t[r];if(n>0){let i=o.p;for(i.marker=!1;i&&(i.deleted||!i.countable);)i=i.left,i&&!i.deleted&&i.countable&&(o.index-=i.length);if(i===null||i.marker===!0){t.splice(r,1);continue}o.p=i,i.marker=!0}(e<o.index||n>0&&e===o.index)&&(o.index=rr(e,o.index+n))}};var r0=(t,e,n)=>{let r=t,o=e.changedParentTypes;for(;Dr(o,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;kL(r._eH,n,e)},Ze=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=uL(),this._dEH=uL(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw Fn()}clone(){throw Fn()}_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){dL(this._eH,e)}observeDeep(e){dL(this._dEH,e)}unobserve(e){fL(this._eH,e)}unobserveDeep(e){fL(this._dEH,e)}toJSON(){}},IL=(t,e,n)=>{t.doc??Mn(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e,o=[],i=t._start;for(;i!==null&&r>0;){if(i.countable&&!i.deleted){let s=i.content.getContent();if(s.length<=e)e-=s.length;else{for(let l=e;l<s.length&&r>0;l++)o.push(s[l]),r--;e=0}}i=i.right}return o},LL=t=>{t.doc??Mn();let e=[],n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){let r=n.content.getContent();for(let o=0;o<r.length;o++)e.push(r[o])}n=n.right}return e},BC=(t,e)=>{let n=[],r=t._start;for(;r!==null;){if(r.countable&&ga(r,e)){let o=r.content.getContent();for(let i=0;i<o.length;i++)n.push(o[i])}r=r.right}return n},mh=(t,e)=>{let n=0,r=t._start;for(t.doc??Mn();r!==null;){if(r.countable&&!r.deleted){let o=r.content.getContent();for(let i=0;i<o.length;i++)e(o[i],n++,t)}r=r.right}},zL=(t,e)=>{let n=[];return mh(t,(r,o)=>{n.push(e(r,o,t))}),n},MK=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}let o=n[r++];return n.length<=r&&(n=null),{done:!1,value:o}}}},UL=(t,e)=>{t.doc??Mn();let n=n0(t,e),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}},Yy=(t,e,n,r)=>{let o=n,i=t.doc,s=i.clientID,l=i.store,a=n===null?e._start:n.right,c=[],u=()=>{c.length>0&&(o=new xe(K(s,lt(l,s)),o,o&&o.lastId,a,a&&a.id,e,null,new Bu(c)),o.integrate(t,0),c=[])};r.forEach(d=>{if(d===null)c.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(d);break;default:switch(u(),d.constructor){case Uint8Array:case ArrayBuffer:o=new xe(K(s,lt(l,s)),o,o&&o.lastId,a,a&&a.id,e,null,new vh(new Uint8Array(d))),o.integrate(t,0);break;case cr:o=new xe(K(s,lt(l,s)),o,o&&o.lastId,a,a&&a.id,e,null,new bh(d)),o.integrate(t,0);break;default:if(d instanceof Ze)o=new xe(K(s,lt(l,s)),o,o&&o.lastId,a,a&&a.id,e,null,new tn(d)),o.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},PL=()=>Or("Length exceeded!"),BL=(t,e,n,r)=>{if(n>e._length)throw PL();if(n===0)return e._searchMarker&&ph(e._searchMarker,n,r.length),Yy(t,e,null,r);let o=n,i=n0(e,n),s=e._start;for(i!==null&&(s=i.p,n-=i.index,n===0&&(s=s.prev,n+=s&&s.countable&&!s.deleted?s.length:0));s!==null;s=s.right)if(!s.deleted&&s.countable){if(n<=s.length){n<s.length&&ir(t,K(s.id.client,s.id.clock+n));break}n-=s.length}return e._searchMarker&&ph(e._searchMarker,o,r.length),Yy(t,e,s,r)},RK=(t,e,n)=>{let o=(e._searchMarker||[]).reduce((i,s)=>s.index>i.index?s:i,{index:0,p:e._start}).p;if(o)for(;o.right;)o=o.right;return Yy(t,e,o,n)},HL=(t,e,n,r)=>{if(r===0)return;let o=n,i=r,s=n0(e,n),l=e._start;for(s!==null&&(l=s.p,n-=s.index);l!==null&&n>0;l=l.right)!l.deleted&&l.countable&&(n<l.length&&ir(t,K(l.id.client,l.id.clock+n)),n-=l.length);for(;r>0&&l!==null;)l.deleted||(r<l.length&&ir(t,K(l.id.client,l.id.clock+r)),l.delete(t),r-=l.length),l=l.right;if(r>0)throw PL();e._searchMarker&&ph(e._searchMarker,o,-i+r)},qy=(t,e,n)=>{let r=e._map.get(n);r!==void 0&&r.delete(t)},HC=(t,e,n,r)=>{let o=e._map.get(n)||null,i=t.doc,s=i.clientID,l;if(r==null)l=new Bu([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:l=new Bu([r]);break;case Uint8Array:l=new vh(r);break;case cr:l=new bh(r);break;default:if(r instanceof Ze)l=new tn(r);else throw new Error("Unexpected content type")}new xe(K(s,lt(i.store,s)),o,o&&o.lastId,null,null,e,n,l).integrate(t,0)},jC=(t,e)=>{t.doc??Mn();let n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},jL=t=>{let e={};return t.doc??Mn(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},VL=(t,e)=>{t.doc??Mn();let n=t._map.get(e);return n!==void 0&&!n.deleted};var OK=(t,e)=>{let n={};return t._map.forEach((r,o)=>{let i=r;for(;i!==null&&(!e.sv.has(i.id.client)||i.id.clock>=(e.sv.get(i.id.client)||0));)i=i.left;i!==null&&ga(i,e)&&(n[o]=i.content.getContent()[i.length-1])}),n},Ly=t=>(t.doc??Mn(),sL(t._map.entries(),e=>!e[1].deleted)),kC=class extends Uu{},Pu=class t extends Ze{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){let n=new t;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new t}clone(){let e=new t;return e.insert(0,this.toArray().map(n=>n instanceof Ze?n.clone():n)),e}get length(){return this.doc??Mn(),this._length}_callObserver(e,n){super._callObserver(e,n),r0(this,e,new kC(this,e))}insert(e,n){this.doc!==null?Fe(this.doc,r=>{BL(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?Fe(this.doc,n=>{RK(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?Fe(this.doc,r=>{HL(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return UL(this,e)}toArray(){return LL(this)}slice(e=0,n=this.length){return IL(this,e,n)}toJSON(){return this.map(e=>e instanceof Ze?e.toJSON():e)}map(e){return zL(this,e)}forEach(e){mh(this,e)}[Symbol.iterator](){return MK(this)}_write(e){e.writeTypeRef(QK)}},DK=t=>new Pu,AC=class extends Uu{constructor(e,n,r){super(e,n),this.keysChanged=r}},va=class t extends Ze{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,o)=>{this.set(o,r)}),this._prelimContent=null}_copy(){return new t}clone(){let e=new t;return this.forEach((n,r)=>{e.set(r,n instanceof Ze?n.clone():n)}),e}_callObserver(e,n){r0(this,e,new AC(this,e,n))}toJSON(){this.doc??Mn();let e={};return this._map.forEach((n,r)=>{if(!n.deleted){let o=n.content.getContent()[n.length-1];e[r]=o instanceof Ze?o.toJSON():o}}),e}get size(){return[...Ly(this)].length}keys(){return _y(Ly(this),e=>e[0])}values(){return _y(Ly(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return _y(Ly(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?Fe(this.doc,n=>{qy(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?Fe(this.doc,r=>{HC(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return jC(this,e)}has(e){return VL(this,e)}clear(){this.doc!==null?Fe(this.doc,e=>{this.forEach(function(n,r,o){qy(e,o,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(ZK)}},NK=t=>new va,il=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&Wx(t,e),gh=class{constructor(e,n,r,o){this.left=e,this.right=n,this.index=r,this.currentAttributes=o}forward(){this.right===null&&ft(),this.right.content.constructor===bt?this.right.deleted||Fu(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}},bL=(t,e,n)=>{for(;e.right!==null&&n>0;)e.right.content.constructor===bt?e.right.deleted||Fu(e.currentAttributes,e.right.content):e.right.deleted||(n<e.right.length&&ir(t,K(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length),e.left=e.right,e.right=e.right.right;return e},zy=(t,e,n,r)=>{let o=new Map,i=r?n0(e,n):null;if(i){let s=new gh(i.p.left,i.p,i.index,o);return bL(t,s,n-i.index)}else{let s=new gh(null,e._start,0,o);return bL(t,s,n)}},FL=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===bt&&il(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();let o=t.doc,i=o.clientID;r.forEach((s,l)=>{let a=n.left,c=n.right,u=new xe(K(i,lt(o.store,i)),a,a&&a.lastId,c,c&&c.id,e,null,new bt(l,s));u.integrate(t,0),n.right=u,n.forward()})},Fu=(t,e)=>{let{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},$L=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===bt&&il(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},YL=(t,e,n,r)=>{let o=t.doc,i=o.clientID,s=new Map;for(let l in r){let a=r[l],c=n.currentAttributes.get(l)??null;if(!il(c,a)){s.set(l,c);let{left:u,right:d}=n;n.right=new xe(K(i,lt(o.store,i)),u,u&&u.lastId,d,d&&d.id,e,null,new bt(l,a)),n.right.integrate(t,0),n.forward()}}return s},gC=(t,e,n,r,o)=>{n.currentAttributes.forEach((f,h)=>{o[h]===void 0&&(o[h]=null)});let i=t.doc,s=i.clientID;$L(n,o);let l=YL(t,e,n,o),a=r.constructor===String?new _r(r):r instanceof Ze?new tn(r):new ba(r),{left:c,right:u,index:d}=n;e._searchMarker&&ph(e._searchMarker,n.index,a.getLength()),u=new xe(K(s,lt(i.store,s)),c,c&&c.lastId,u,u&&u.id,e,null,a),u.integrate(t,0),n.right=u,n.index=d,n.forward(),FL(t,e,n,l)},wL=(t,e,n,r,o)=>{let i=t.doc,s=i.clientID;$L(n,o);let l=YL(t,e,n,o);e:for(;n.right!==null&&(r>0||l.size>0&&(n.right.deleted||n.right.content.constructor===bt));){if(!n.right.deleted)switch(n.right.content.constructor){case bt:{let{key:a,value:c}=n.right.content,u=o[a];if(u!==void 0){if(il(u,c))l.delete(a);else{if(r===0)break e;l.set(a,c)}n.right.delete(t)}else n.currentAttributes.set(a,c);break}default:r<n.right.length&&ir(t,K(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let a="";for(;r>0;r--)a+=`
|
|
52
|
+
`;n.right=new xe(K(s,lt(i.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new _r(a)),n.right.integrate(t,0),n.forward()}FL(t,e,n,l)},qL=(t,e,n,r,o)=>{let i=e,s=en();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===bt){let c=i.content;s.set(c.key,c)}i=i.right}let l=0,a=!1;for(;e!==i;){if(n===e&&(a=!0),!e.deleted){let c=e.content;if(c.constructor===bt){let{key:u,value:d}=c,f=r.get(u)??null;(s.get(u)!==c||f===d)&&(e.delete(t),l++,!a&&(o.get(u)??null)===d&&f!==d&&(f===null?o.delete(u):o.set(u,f))),!a&&!e.deleted&&Fu(o,c)}}e=e.right}return l},_K=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;let n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===bt){let r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},IK=t=>{let e=0;return Fe(t.doc,n=>{let r=t._start,o=t._start,i=en(),s=hy(i);for(;o;)o.deleted===!1&&(o.content.constructor===bt?Fu(s,o.content):(e+=qL(n,r,o,i,s),i=hy(s),r=o)),o=o.right}),e},LK=t=>{let e=new Set,n=t.doc;for(let[r,o]of t.afterState.entries()){let i=t.beforeState.get(r)||0;o!==i&&RL(t,n.store.clients.get(r),i,o,s=>{!s.deleted&&s.content.constructor===bt&&s.constructor!==sr&&e.add(s.parent)})}Fe(n,r=>{Pi(t,t.deleteSet,o=>{if(o instanceof sr||!o.parent._hasFormatting||e.has(o.parent))return;let i=o.parent;o.content.constructor===bt?e.add(i):_K(r,o)});for(let o of e)IK(o)})},SL=(t,e,n)=>{let r=n,o=hy(e.currentAttributes),i=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case tn:case ba:case _r:n<e.right.length&&ir(t,K(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}i&&qL(t,i,e.right,o,e.currentAttributes);let s=(e.left||e.right).parent;return s._searchMarker&&ph(s._searchMarker,e.index,-r+n),e},MC=class extends Uu{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(o=>{o===null?this.childListChanged=!0:this.keysChanged.add(o)})}get changes(){if(this._changes===null){let 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){let e=this.target.doc,n=[];Fe(e,r=>{let o=new Map,i=new Map,s=this.target._start,l=null,a={},c="",u=0,d=0,f=()=>{if(l!==null){let h=null;switch(l){case"delete":d>0&&(h={delete:d}),d=0;break;case"insert":(typeof c=="object"||c.length>0)&&(h={insert:c},o.size>0&&(h.attributes={},o.forEach((p,m)=>{p!==null&&(h.attributes[m]=p)}))),c="";break;case"retain":u>0&&(h={retain:u},D3(a)||(h.attributes=R3({},a))),u=0;break}h&&n.push(h),l=null}};for(;s!==null;){switch(s.content.constructor){case tn:case ba:this.adds(s)?this.deletes(s)||(f(),l="insert",c=s.content.getContent()[0],f()):this.deletes(s)?(l!=="delete"&&(f(),l="delete"),d+=1):s.deleted||(l!=="retain"&&(f(),l="retain"),u+=1);break;case _r:this.adds(s)?this.deletes(s)||(l!=="insert"&&(f(),l="insert"),c+=s.content.str):this.deletes(s)?(l!=="delete"&&(f(),l="delete"),d+=s.length):s.deleted||(l!=="retain"&&(f(),l="retain"),u+=s.length);break;case bt:{let{key:h,value:p}=s.content;if(this.adds(s)){if(!this.deletes(s)){let m=o.get(h)??null;il(m,p)?p!==null&&s.delete(r):(l==="retain"&&f(),il(p,i.get(h)??null)?delete a[h]:a[h]=p)}}else if(this.deletes(s)){i.set(h,p);let m=o.get(h)??null;il(m,p)||(l==="retain"&&f(),a[h]=m)}else if(!s.deleted){i.set(h,p);let m=a[h];m!==void 0&&(il(m,p)?m!==null&&s.delete(r):(l==="retain"&&f(),p===null?delete a[h]:a[h]=p))}s.deleted||(l==="insert"&&f(),Fu(o,s.content));break}}s=s.right}for(f();n.length>0;){let h=n[n.length-1];if(h.retain!==void 0&&h.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}},Nr=class t extends Ze{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 t}clone(){let e=new t;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);let r=new MC(this,e,n);r0(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===_r&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?Fe(this.doc,r=>{let o=new gh(null,this._start,0,new Map);for(let i=0;i<e.length;i++){let s=e[i];if(s.insert!==void 0){let l=!n&&typeof s.insert=="string"&&i===e.length-1&&o.right===null&&s.insert.slice(-1)===`
|
|
53
|
+
`?s.insert.slice(0,-1):s.insert;(typeof l!="string"||l.length>0)&&gC(r,this,o,l,s.attributes||{})}else s.retain!==void 0?wL(r,this,o,s.retain,s.attributes||{}):s.delete!==void 0&&SL(r,o,s.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??Mn();let o=[],i=new Map,s=this.doc,l="",a=this._start;function c(){if(l.length>0){let d={},f=!1;i.forEach((p,m)=>{f=!0,d[m]=p});let h={insert:l};f&&(h.attributes=d),o.push(h),l=""}}let u=()=>{for(;a!==null;){if(ga(a,e)||n!==void 0&&ga(a,n))switch(a.content.constructor){case _r:{let d=i.get("ychange");e!==void 0&&!ga(a,e)?(d===void 0||d.user!==a.id.client||d.type!=="removed")&&(c(),i.set("ychange",r?r("removed",a.id):{type:"removed"})):n!==void 0&&!ga(a,n)?(d===void 0||d.user!==a.id.client||d.type!=="added")&&(c(),i.set("ychange",r?r("added",a.id):{type:"added"})):d!==void 0&&(c(),i.delete("ychange")),l+=a.content.str;break}case tn:case ba:{c();let d={insert:a.content.getContent()[0]};if(i.size>0){let f={};d.attributes=f,i.forEach((h,p)=>{f[p]=h})}o.push(d);break}case bt:ga(a,e)&&(c(),Fu(i,a.content));break}a=a.right}c()};return e||n?Fe(s,d=>{e&&SC(d,e),n&&SC(d,n),u()},"cleanup"):u(),o}insert(e,n,r){if(n.length<=0)return;let o=this.doc;o!==null?Fe(o,i=>{let s=zy(i,this,e,!r);r||(r={},s.currentAttributes.forEach((l,a)=>{r[a]=l})),gC(i,this,s,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){let o=this.doc;o!==null?Fe(o,i=>{let s=zy(i,this,e,!r);gC(i,this,s,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;let r=this.doc;r!==null?Fe(r,o=>{SL(o,zy(o,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;let o=this.doc;o!==null?Fe(o,i=>{let s=zy(i,this,e,!1);s.right!==null&&wL(i,this,s,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?Fe(this.doc,n=>{qy(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?Fe(this.doc,r=>{HC(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return jC(this,e)}getAttributes(){return jL(this)}_write(e){e.writeTypeRef(eG)}},zK=t=>new Nr,uh=class{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===Ce||n.constructor===ur)&&n._start!==null)e=n._start;else for(;e!==null;){let 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})}},ur=class t extends Ze{constructor(){super(),this._prelimContent=[]}get firstChild(){let 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 t}clone(){let e=new t;return e.insert(0,this.toArray().map(n=>n instanceof Ze?n.clone():n)),e}get length(){return this.doc??Mn(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new uh(this,e)}querySelector(e){e=e.toUpperCase();let r=new uh(this,o=>o.nodeName&&o.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),bo(new uh(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){r0(this,e,new RC(this,n,e))}toString(){return zL(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){let o=e.createDocumentFragment();return r!==void 0&&r._createAssociation(o,this),mh(this,i=>{o.insertBefore(i.toDOM(e,n,r),null)}),o}insert(e,n){this.doc!==null?Fe(this.doc,r=>{BL(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)Fe(this.doc,r=>{let o=e&&e instanceof Ze?e._item:e;Yy(r,this,o,n)});else{let r=this._prelimContent,o=e===null?0:r.findIndex(i=>i===e)+1;if(o===0&&e!==null)throw Or("Reference item not found");r.splice(o,0,...n)}}delete(e,n=1){this.doc!==null?Fe(this.doc,r=>{HL(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return LL(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return UL(this,e)}slice(e=0,n=this.length){return IL(this,e,n)}forEach(e){mh(this,e)}_write(e){e.writeTypeRef(nG)}},UK=t=>new ur,Ce=class t extends ur{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,o)=>{this.setAttribute(o,r)}),this._prelimAttrs=null}_copy(){return new t(this.nodeName)}clone(){let e=new t(this.nodeName),n=this.getAttributes();return O3(n,(r,o)=>{e.setAttribute(o,r)}),e.insert(0,this.toArray().map(r=>r instanceof Ze?r.clone():r)),e}toString(){let e=this.getAttributes(),n=[],r=[];for(let l in e)r.push(l);r.sort();let o=r.length;for(let l=0;l<o;l++){let a=r[l];n.push(a+'="'+e[a]+'"')}let i=this.nodeName.toLocaleLowerCase(),s=n.length>0?" "+n.join(" "):"";return`<${i}${s}>${super.toString()}</${i}>`}removeAttribute(e){this.doc!==null?Fe(this.doc,n=>{qy(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?Fe(this.doc,r=>{HC(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return jC(this,e)}hasAttribute(e){return VL(this,e)}getAttributes(e){return e?OK(this,e):jL(this)}toDOM(e=document,n={},r){let o=e.createElement(this.nodeName),i=this.getAttributes();for(let s in i){let l=i[s];typeof l=="string"&&o.setAttribute(s,l)}return mh(this,s=>{o.appendChild(s.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(o,this),o}_write(e){e.writeTypeRef(tG),e.writeKey(this.nodeName)}},PK=t=>new Ce(t.readKey()),RC=class extends Uu{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(o=>{o===null?this.childListChanged=!0:this.attributesChanged.add(o)})}},ul=class t extends va{constructor(e){super(),this.hookName=e}_copy(){return new t(this.hookName)}clone(){let e=new t(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){let o=n[this.hookName],i;return o!==void 0?i=o.createDom(this):i=document.createElement(this.hookName),i.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(rG),e.writeKey(this.hookName)}},BK=t=>new ul(t.readKey()),et=class t extends Nr{get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new t}clone(){let e=new t;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){let o=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(o,this),o}toString(){return this.toDelta().map(e=>{let n=[];for(let o in e.attributes){let i=[];for(let s in e.attributes[o])i.push({key:s,value:e.attributes[o][s]});i.sort((s,l)=>s.key<l.key?-1:1),n.push({nodeName:o,attrs:i})}n.sort((o,i)=>o.nodeName<i.nodeName?-1:1);let r="";for(let o=0;o<n.length;o++){let i=n[o];r+=`<${i.nodeName}`;for(let s=0;s<i.attrs.length;s++){let l=i.attrs[s];r+=` ${l.key}="${l.value}"`}r+=">"}r+=e.insert;for(let o=n.length-1;o>=0;o--)r+=`</${n[o].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(oG)}},HK=t=>new et,yh=class{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Fn()}mergeWith(e){return!1}write(e,n,r){throw Fn()}integrate(e,n){throw Fn()}},jK=0,sr=class extends yh{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),ML(e.doc.store,this)}write(e,n){e.writeInfo(jK),e.writeLen(this.length-n)}getMissing(e,n){return null}},vh=class t{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new t(this.content)}splice(e){throw Fn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}},VK=t=>new vh(t.readBuf()),Ky=class t{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new t(this.len)}splice(e){let n=new t(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){dh(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}},FK=t=>new Ky(t.readLen()),KL=(t,e)=>new cr({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1}),bh=class t{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;let 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 t(KL(this.doc.guid,this.opts))}splice(e){throw Fn()}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}},$K=t=>new bh(KL(t.readString(),t.readAny())),ba=class t{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new t(this.embed)}splice(e){throw Fn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}},YK=t=>new ba(t.readJSON()),bt=class t{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new t(this.key,this.value)}splice(e){throw Fn()}mergeWith(e){return!1}integrate(e,n){let 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}},qK=t=>new bt(t.readKey(),t.readJSON()),OC=class t{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new t(this.arr)}splice(e){let n=new t(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){let r=this.arr.length;e.writeLen(r-n);for(let o=n;o<r;o++){let i=this.arr[o];e.writeString(i===void 0?"undefined":JSON.stringify(i))}}getRef(){return 2}},KK=t=>{let e=t.readLen(),n=[];for(let r=0;r<e;r++){let o=t.readString();o==="undefined"?n.push(void 0):n.push(JSON.parse(o))}return new OC(n)},GK=eh("node_env")==="development",Bu=class t{constructor(e){this.arr=e,GK&&Jx(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new t(this.arr)}splice(e){let n=new t(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){let r=this.arr.length;e.writeLen(r-n);for(let o=n;o<r;o++){let i=this.arr[o];e.writeAny(i)}}getRef(){return 8}},XK=t=>{let e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new Bu(n)},_r=class t{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new t(this.str)}splice(e){let n=new t(this.str.slice(e));this.str=this.str.slice(0,e);let r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"\uFFFD",n.str="\uFFFD"+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}},WK=t=>new _r(t.readString()),JK=[DK,NK,zK,PK,UK,BK,HK],QK=0,ZK=1,eG=2,tG=3,nG=4,rG=5,oG=6,tn=class t{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new t(this.type._copy())}splice(e){throw Fn()}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}},iG=t=>new tn(JK[t.readTypeRef()](t)),DC=(t,e)=>{let n=e,r=0,o;do r>0&&(n=K(n.client,n.clock+r)),o=ll(t,n),r=n.clock-o.id.clock,n=o.redone;while(n!==null&&o instanceof xe);return{item:o,diff:r}},VC=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},Gy=(t,e,n)=>{let{client:r,clock:o}=e.id,i=new xe(K(r,o+n),e,K(r,o+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&i.markDeleted(),e.keep&&(i.keep=!0),e.redone!==null&&(i.redone=K(e.redone.client,e.redone.clock+n)),e.right=i,i.right!==null&&(i.right.left=i),t._mergeStructs.push(i),i.parentSub!==null&&i.right===null&&i.parent._map.set(i.parentSub,i),e.length=n,i},xL=(t,e)=>Vf(t,n=>wa(n.deletions,e)),GL=(t,e,n,r,o,i)=>{let s=t.doc,l=s.store,a=s.clientID,c=e.redone;if(c!==null)return ir(t,c);let u=e.parent._item,d=null,f;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!n.has(u)||GL(t,u,n,r,o,i)===null))return null;for(;u.redone!==null;)u=ir(t,u.redone)}let h=u===null?e.parent:u.content.type;if(e.parentSub===null){for(d=e.left,f=e;d!==null;){let g=d;for(;g!==null&&g.parent._item!==u;)g=g.redone===null?null:ir(t,g.redone);if(g!==null&&g.parent._item===u){d=g;break}d=d.left}for(;f!==null;){let g=f;for(;g!==null&&g.parent._item!==u;)g=g.redone===null?null:ir(t,g.redone);if(g!==null&&g.parent._item===u){f=g;break}f=f.right}}else{if(f=null,e.right&&!o){for(d=e;d!==null&&d.right!==null&&(d.right.redone||wa(r,d.right.id)||xL(i.undoStack,d.right.id)||xL(i.redoStack,d.right.id));)for(d=d.right;d.redone;)d=ir(t,d.redone);if(d&&d.right!==null)return null}else d=h._map.get(e.parentSub)||null;d!==null&&d.parent._item!==u&&(d=h._map.get(e.parentSub)||null)}let p=lt(l,a),m=K(a,p),y=new xe(m,d,d&&d.lastId,f,f&&f.id,h,e.parentSub,e.content.copy());return e.redone=m,VC(y,!0),y.integrate(t,0),y},xe=class t extends yh{constructor(e,n,r,o,i,s,l,a){super(e,a.getLength()),this.origin=r,this.left=n,this.right=o,this.rightOrigin=i,this.parent=s,this.parentSub=l,this.redone=null,this.content=a,this.info=this.content.isCountable()?2:0}set marker(e){(this.info&8)>0!==e&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(e){this.keep!==e&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(e){this.deleted!==e&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=lt(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=lt(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===sl&&this.id.client!==this.parent.client&&this.parent.clock>=lt(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=hL(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=ir(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===sr||this.right&&this.right.constructor===sr)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===t?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===t&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===sl){let r=ll(n,this.parent);r.constructor===sr?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=hL(e,e.doc.store,K(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,o;if(r!==null)o=r.right;else if(this.parentSub!==null)for(o=this.parent._map.get(this.parentSub)||null;o!==null&&o.left!==null;)o=o.left;else o=this.parent._start;let i=new Set,s=new Set;for(;o!==null&&o!==this.right;){if(s.add(o),i.add(o),ar(this.origin,o.origin)){if(o.id.client<this.id.client)r=o,i.clear();else if(ar(this.rightOrigin,o.rightOrigin))break}else if(o.origin!==null&&s.has(ll(e.doc.store,o.origin)))i.has(ll(e.doc.store,o.origin))||(r=o,i.clear());else break;o=o.right}this.left=r}if(this.left!==null){let 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),ML(e.doc.store,this),this.content.integrate(e,this),mL(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new sr(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:K(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&ar(e.origin,this.lastId)&&this.right===e&&ar(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)){let 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){let n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),dh(e.deleteSet,this.id.client,this.id.clock,this.length),mL(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw ft();this.content.gc(e),n?gK(e,this,new sr(this.id,this.length)):this.content=new Ky(this.length)}write(e,n){let r=n>0?K(this.id.client,this.id.clock+n-1):this.origin,o=this.rightOrigin,i=this.parentSub,s=this.content.getRef()&31|(r===null?0:128)|(o===null?0:64)|(i===null?0:32);if(e.writeInfo(s),r!==null&&e.writeLeftID(r),o!==null&&e.writeRightID(o),r===null&&o===null){let l=this.parent;if(l._item!==void 0){let a=l._item;if(a===null){let c=ji(l);e.writeParentInfo(!0),e.writeString(c)}else e.writeParentInfo(!1),e.writeLeftID(a.id)}else l.constructor===String?(e.writeParentInfo(!0),e.writeString(l)):l.constructor===sl?(e.writeParentInfo(!1),e.writeLeftID(l)):ft();i!==null&&e.writeString(i)}this.content.write(e,n)}},XL=(t,e)=>sG[e&31](t),sG=[()=>{ft()},FK,KK,VK,WK,YK,qK,iG,XK,$K,()=>{ft()}],lG=10,lr=class extends yh{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){ft()}write(e,n){e.writeInfo(lG),W(e.restEncoder,this.length-n)}getMissing(e,n){return null}},WL=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},JL="__ $YJS$ __";WL[JL]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");WL[JL]=!0;var aG=0;var QL=(t,e,n)=>{J(t)===aG&&n(e,wo(t))};var FC=0,xh=1,$C=2,ez=(t,e)=>{W(t,FC);let n=Qy(e);At(t,n)},cG=(t,e,n)=>{W(t,xh),At(t,Wy(e,n))},tz=(t,e,n)=>cG(e,n,Ht(t)),nz=(t,e,n,r)=>{try{ju(e,Ht(t),n)}catch(o){r?.(o),console.error("Caught error while handling a Yjs update",o)}},rz=(t,e)=>{W(t,$C),At(t,e)},uG=nz,oz=(t,e,n,r,o)=>{let i=J(t);switch(i){case FC:tz(t,e,n);break;case xh:nz(t,n,r,o);break;case $C:uG(t,n,r,o);break;default:throw new Error("Unknown message type")}return i};var Ch=0,YC=1,lz=2;function qC(t,e){let n=eo();return W(n,t),e(n),Zt(n)}var az=t=>qC(Ch,e=>ez(e,t)),cz=t=>qC(Ch,e=>rz(e,t)),uz=t=>qC(YC,e=>At(e,t));var dG=[4,5,6];function fG(t){if(t instanceof ur)return"xml";if(t instanceof Nr)return"text";if(t instanceof va)return"map";if(t instanceof Pu)return"array";if(t._start===null)return t._map.size>0?"map":"array";let e=t._start;for(;e?.deleted;)e=e.right;if(e===null)return"array";if(dG.includes(e.content.getRef()))return"text";let n=e.content.type;return n instanceof Ce||n instanceof et?"xml":"array"}var sz=t=>t instanceof Ze?t.clone():t;function dz(t,e,n){let r=new cr;ju(r,e),t.transact(()=>{for(let o of new Set([...t.share.keys(),...r.share.keys()])){let i=t.share.get(o),s=fG(i&&i.constructor!==Ze?i:r.share.get(o)??i);if(s==="text"){let l=t.getText(o);l.delete(0,l.length),l.applyDelta(r.getText(o).toDelta())}else if(s==="map"){let l=t.getMap(o),a=r.getMap(o);for(let c of[...l.keys()])a.has(c)||l.delete(c);for(let[c,u]of a)l.set(c,sz(u))}else if(s==="array"){let l=t.getArray(o);l.delete(0,l.length),l.insert(0,r.getArray(o).toArray().map(sz))}else{let l=t.getXmlFragment(o);l.delete(0,l.length),l.insert(0,r.getXmlFragment(o).toArray().map(a=>a.clone()))}}},n)}function fz(t){return t!=="human"}var KC=3e4,o0=class extends py{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let n=zi();this.getLocalState()!==null&&KC/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());let r=[];this.meta.forEach((o,i)=>{i!==this.clientID&&KC<=n-o.lastUpdated&&this.states.has(i)&&r.push(i)}),r.length>0&&GC(this,r,"timeout")},Bt(KC/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){let n=this.clientID,r=this.meta.get(n),o=r===void 0?0:r.clock+1,i=this.states.get(n);e===null?this.states.delete(n):this.states.set(n,e),this.meta.set(n,{clock:o,lastUpdated:zi()});let s=[],l=[],a=[],c=[];e===null?c.push(n):i==null?e!=null&&s.push(n):(l.push(n),rl(i,e)||a.push(n)),(s.length>0||a.length>0||c.length>0)&&this.emit("change",[{added:s,updated:a,removed:c},"local"]),this.emit("update",[{added:s,updated:l,removed:c},"local"])}setLocalStateField(e,n){let r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:n})}getStates(){return this.states}},GC=(t,e,n)=>{let r=[];for(let o=0;o<e.length;o++){let i=e[o];if(t.states.has(i)){if(t.states.delete(i),i===t.clientID){let s=t.meta.get(i);t.meta.set(i,{clock:s.clock+1,lastUpdated:zi()})}r.push(i)}}r.length>0&&(t.emit("change",[{added:[],updated:[],removed:r},n]),t.emit("update",[{added:[],updated:[],removed:r},n]))},hz=(t,e,n=t.states)=>{let r=e.length,o=eo();W(o,r);for(let i=0;i<r;i++){let s=e[i],l=n.get(s)||null,a=t.meta.get(s).clock;W(o,s),W(o,a),Li(o,JSON.stringify(l))}return Zt(o)};var pz=(t,e,n)=>{let r=So(e),o=zi(),i=[],s=[],l=[],a=[],c=J(r);for(let u=0;u<c;u++){let d=J(r),f=J(r),h=JSON.parse(wo(r)),p=t.meta.get(d),m=t.states.get(d),y=p===void 0?0:p.clock;(y<f||y===f&&h===null&&t.states.has(d))&&(h===null?d===t.clientID&&t.getLocalState()!=null?f++:t.states.delete(d):t.states.set(d,h),t.meta.set(d,{clock:f,lastUpdated:o}),p===void 0&&h!==null?i.push(d):p!==void 0&&h===null?a.push(d):h!==null&&(rl(h,m)||l.push(d),s.push(d)))}(i.length>0||l.length>0||a.length>0)&&t.emit("change",[{added:i,updated:l,removed:a},n]),(i.length>0||s.length>0||a.length>0)&&t.emit("update",[{added:i,updated:s,removed:a},n])};function pG(t){let e=0;for(let n of t)e=(e*31+n.charCodeAt(0))%360;return`hsl(${e} 70% 45%)`}var WC=class XC{doc;awareness;denied=[];socket;options;barriers=[];waiting=[];timeoutMs;synced=!1;stopped=!1;delayMs;retry;resolveClosed;closed=new Promise(e=>this.resolveClosed=e);opened;constructor(e){if(this.options=e,this.doc=e.doc??new cr,this.timeoutMs=e.timeoutMs??1e4,this.delayMs=e.reconnect?.initialMs??500,this.awareness=new o0(this.doc),this.doc.on("update",(n,r)=>{r!==this&&this.send(cz(n))}),this.awareness.on("update",({added:n,updated:r,removed:o},i)=>{i!==this&&this.sendPresence([...n,...r,...o])}),e.presence){let{name:n,color:r=pG(n),cursor:o=null}=e.presence;this.awareness.setLocalState({name:n,color:r,cursor:o})}this.open()}open(){let e=this.options.WebSocket??WebSocket,n=this.options.headers?new e(this.options.url,{headers:this.options.headers}):new e(this.options.url);this.socket=n,n.binaryType="arraybuffer",this.options.onStatus?.("connecting"),this.opened=new Promise((i,s)=>{n.onopen=()=>{this.delayMs=this.options.reconnect?.initialMs??500,this.options.onStatus?.("connected"),this.awareness.getLocalState()!==null&&this.sendPresence([this.doc.clientID]),this.flush().then(()=>{this.synced=!0,this.waiting.splice(0).forEach(l=>l.resolve())},l=>{n.readyState===1&&this.waiting.splice(0).forEach(a=>a.reject(l))}),i()},n.onerror=()=>{s(new Error("could not connect")),o()}}),this.opened.catch(()=>{}),n.onmessage=i=>this.receive(new Uint8Array(i.data));let r=!1,o=()=>{if(!r){if(r=!0,n.close(),this.synced=!1,this.barriers.splice(0).forEach(i=>i.reject(new Error("connection closed"))),this.options.onStatus?.("disconnected"),this.stopped||!this.options.reconnect){this.waiting.splice(0).forEach(i=>i.reject(new Error("connection closed"))),this.resolveClosed();return}this.retry=setTimeout(()=>this.open(),this.delayMs),this.delayMs=Math.min(this.delayMs*2,this.options.reconnect.maxMs??3e4)}};n.onclose=o}static open(e){return new XC(e)}static async connect(e){let n=new XC(e);try{await n.opened,await n.whenSynced()}catch(r){throw n.disconnect(),r}return n}whenSynced(){return this.synced?Promise.resolve():new Promise((e,n)=>this.waiting.push({resolve:e,reject:n}))}sendPresence(e){this.send(uz(hz(this.awareness,e)))}send(e){this.socket?.readyState===1&&this.socket.send(e)}receive(e){let n=So(e);switch(J(n)){case Ch:{let r=eo();W(r,Ch);let o=oz(n,r,this.doc,this);Hx(r)>1&&this.send(Zt(r)),o===xh&&this.barriers.shift()?.resolve();break}case lz:QL(n,this.doc,(r,o)=>this.denied.push(o));break;case YC:pz(this.awareness,Ht(n),this);break}}flush(){return new Promise((e,n)=>{let r=setTimeout(()=>n(new Error(`no answer from the server in ${this.timeoutMs} ms`)),this.timeoutMs);this.barriers.push({resolve:()=>(clearTimeout(r),e()),reject:o=>(clearTimeout(r),n(o))}),this.send(az(this.doc))})}async edit(e){this.doc.transact(()=>e(this.doc)),await this.flush()}get peers(){return[...this.awareness.getStates()].filter(([e])=>e!==this.doc.clientID).map(([e,n])=>{let r=n;return{clientId:e,...r,machine:fz(r.kind)}})}onPeers(e){let n=()=>e(this.peers);return this.awareness.on("change",n),()=>this.awareness.off("change",n)}setPresence(e){this.awareness.setLocalState({...this.awareness.getLocalState(),...e})}async api(e,n={}){let r=new URL(this.options.url);r.protocol=r.protocol==="wss:"?"https:":"http:",r.pathname=r.pathname.replace(/\/ws$/,"")+e;let o={...this.options.headers,...n.body?{"content-type":"application/json"}:{}},i=await fetch(r,{...n,headers:o});if(!i.ok)throw new Error(`request failed: ${i.status}`);return i}async snapshot(e){await this.flush();let n=JSON.stringify({name:e});return await(await this.api("/snapshots",{method:"POST",body:n})).json()}async snapshots(){return await(await this.api("/snapshots")).json()}async restore(e){let n=await this.api(`/snapshots/${encodeURIComponent(e)}`);dz(this.doc,new Uint8Array(await n.arrayBuffer())),await this.flush()}async disconnect(){this.stopped=!0,clearTimeout(this.retry),GC(this.awareness,[this.doc.clientID],"disconnect"),this.awareness.destroy(),this.socket.readyState===3?this.resolveClosed():this.socket.close(1e3),await this.closed}};var mG=t=>btoa(String.fromCharCode(...new TextEncoder().encode(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),JC=class extends WebSocket{constructor(e,n){let r=/^Bearer (.+)$/.exec(n?.headers?.authorization??"")?.[1];super(e,r?["agentic-docs",`agentic-docs.bearer.${mG(r)}`]:void 0)}};async function mz(t,e,n,r){let o=r?"connecting":"connected",i=new Set,s=new cr;ju(s,await t.state(e));let l=r?await WC.connect({url:r.url,headers:r.token?{authorization:`Bearer ${r.token}`}:void 0,WebSocket:r.WebSocket??JC,doc:s,presence:{name:n},reconnect:{},onStatus:d=>{o=d;for(let f of i)f(d)}}):void 0;await l?.whenSynced().catch(()=>{});let a=0,c=0;return{sync:l,doc:s,status:()=>o,onStatus:d=>(i.add(d),()=>{i.delete(d)}),get dirty(){return a!==c},touch:()=>{a++},async save(){let d=a;await l?.flush(),await t.checkpoint(e,Wy(s),{create:!1}),c=d},close:async()=>await l?.disconnect()}}var gz=Object.defineProperty,yz=(t,e)=>{let n={};for(var r in t)gz(n,r,{get:t[r],enumerable:!0});return e||gz(n,Symbol.toStringTag,{value:"Module"}),n};function Rn(t){this.content=t}Rn.prototype={constructor:Rn,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,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new Rn(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Rn(n)},addToStart:function(t,e){return new Rn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Rn(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new Rn(o)},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=Rn.from(t),t.size?new Rn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Rn.from(t),t.size?new Rn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Rn.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}};Rn.from=function(t){if(t instanceof Rn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Rn(e)};var QC=Rn;function Mz(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){let s=o.text,l=i.text,a=0;for(;s[a]==l[a];a++)n++;return a&&a<s.length&&a<l.length&&Dz(s.charCodeAt(a-1))&&Oz(s.charCodeAt(a))&&n--,n}if(o.content.size||i.content.size){let s=Mz(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function Rz(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let c=s.text,u=l.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,n--,r--;return d&&f&&d<c.length&&Dz(c.charCodeAt(d-1))&&Oz(c.charCodeAt(d))&&(n++,r++),{a:n,b:r}}if(s.content.size||l.content.size){let c=Rz(s.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}function Oz(t){return t>=56320&&t<57344}function Dz(t){return t>=55296&&t<56320}var M=class t{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,o=0,i){for(let s=0,l=0;l<n;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new t(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),o+=l.nodeSize),s=a}return new t(r,o)}cutByIndex(e,n){return e==n?t.empty:e==0&&n==this.content.length?this:new t(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new t(o,i)}addToStart(e){return new t([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new t(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 o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return Mz(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Rz(this,e,n,r)}findIndex(e){if(e==0)return i0(0,e);if(e==this.size)return i0(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 o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?i0(n+1,i):i0(n,r);r=i}}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 t.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return t.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return t.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new t(n||e,r)}static from(e){if(!e)return t.empty;if(e instanceof t)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new t([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};M.empty=new M([],0);var ZC={index:0,offset:0};function i0(t,e){return ZC.index=t,ZC.offset=e,ZC}function a0(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(!a0(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!a0(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}var ye=class t{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}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&&a0(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`);return r.create(n.attrs)}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 t.none;if(e instanceof t)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};ye.none=[];var dl=class extends Error{},N=class t{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=_z(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new t(Nz(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 t.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new t(M.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new t(e,r,o)}};N.empty=new N(M.empty,0,0);function Nz(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(o==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Nz(i.content,e-o-1,n-o-1)))}function _z(t,e,n,r,o,i){let{index:s,offset:l}=t.findIndex(e),a=t.maybeChild(s);if(l==e||a.isText)return i&&r<=0&&o<=0&&!i.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=_z(a.content,e-l-1,n,s==0?r-1:0,s==t.childCount-1?o-1:0,a);return c&&t.replaceChild(s,a.copy(c))}function gG(t,e,n){if(n.openStart>t.depth)throw new dl("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new dl("Inconsistent open depths");return Iz(t,e,n,0)}function Iz(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=Iz(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,l=s.content;return Ca(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=yG(n,t);return Ca(i,zz(t,s,l,e,r))}else return Ca(i,c0(t,e,r))}function Lz(t,e){if(!e.type.compatibleContent(t.type))throw new dl("Cannot join "+e.type.name+" onto "+t.type.name)}function eE(t,e,n){let r=t.node(n);return Lz(r,e.node(n)),r}function xa(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 Eh(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(xa(t.nodeAfter,r),i++));for(let l=i;l<s;l++)xa(o.child(l),r);e&&e.depth==n&&e.textOffset&&xa(e.nodeBefore,r)}function Ca(t,e){if(!t.type.validContent(e))throw new dl("Invalid content for node "+t.type.name);return t.copy(e)}function zz(t,e,n,r,o){let i=t.depth>o&&eE(t,e,o+1),s=r.depth>o&&eE(n,r,o+1),l=[];return Eh(null,t,o,l),i&&s&&e.index(o)==n.index(o)?(Lz(i,s),xa(Ca(i,zz(t,e,n,r,o+1)),l)):(i&&xa(Ca(i,c0(t,e,o+1)),l),Eh(e,n,o,l),s&&xa(Ca(s,c0(n,r,o+1)),l)),Eh(r,null,o,l),new M(l)}function c0(t,e,n){let r=[];if(Eh(null,t,n,r),t.depth>n){let o=eE(t,e,n+1);xa(Ca(o,c0(t,e,n+1)),r)}return Eh(e,null,n,r),new M(r)}function yG(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(M.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}var u0=class t{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],o=e.child(n);return r?e.child(n).cut(r):o}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],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ye.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(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 Ea(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=[],o=0,i=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new t(n,r,i)}static resolveCached(e,n){let r=vz.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else vz.set(e,r=new tE);let o=r.elts[r.i]=t.resolve(e,n);return r.i=(r.i+1)%vG,o}},tE=class{constructor(){this.elts=[],this.i=0}},vG=12,vz=new WeakMap,Ea=class{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)}},bG=Object.create(null),dr=class t{constructor(e,n,r,o=ye.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||M.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,o=0){this.content.nodesBetween(e,n,r,o,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,o){return this.content.textBetween(e,n,r,o)}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&&a0(this.attrs,n||e.defaultAttrs||bG)&&ye.sameSet(this.marks,r||ye.none)}copy(e=null){return e==this.content?this:new t(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new t(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 N.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new N(c,o.depth-s,i.depth-s)}replace(e,n,r){return gG(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+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 o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return u0.resolveCached(this,e)}resolveNoCache(e){return u0.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Uz(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=M.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.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),bz(this.type.attrs,this.attrs,"node",this.type.name);let e=ye.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];bz(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!ye.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 o=M.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,o,r)}};dr.prototype.text=void 0;var nE=class t extends dr{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Uz(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 t(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new t(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 Uz(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}function bz(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${r}`);for(let o in t)t[o].validate&&t[o].validate(e[o])}var Ta=class t{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new rE(e,n);if(r.next==null)return t.empty;let o=Pz(r);r.next&&r.err("Unexpected trailing text");let i=kG(TG(o));return AG(i,r),i}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 o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}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 o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!n||a.validEnd))return M.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(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 o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(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 o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
54
|
+
`)}};Ta.empty=new Ta(!0);var rE=class{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 Pz(t){let e=[];do e.push(wG(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function wG(t){let e=[];do e.push(SG(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function SG(t){let e=EG(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=xG(t,e);else break;return e}function wz(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function xG(t,e){let n=wz(t),r=n;return t.eat(",")&&(t.next!="}"?r=wz(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function CG(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function EG(t){if(t.eat("(")){let e=Pz(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=CG(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 TG(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=n())}else if(s.type=="star"){let a=n();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,a),u),a=u}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=n();r(a,u),o(i(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Bz(t,e){return e-t}function Sz(t,e){let n=[];return r(e),n.sort(Bz);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&n.indexOf(a)==-1&&r(a)}}}function kG(t){let e=Object.create(null);return n(Sz(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<o.length;u++)o[u][0]==l&&(c=o[u][1]);Sz(t,a).forEach(u=>{c||o.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new Ta(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(Bz);i.next.push({type:o[s][0],next:e[l.join(",")]||n(l)})}return i}}function AG(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Hz(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 jz(t,e){let n=Object.create(null);for(let r in t){let o=t[r],i=e&&e[r];if(i===void 0)if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r);else o.validate&&o.validate(i);n[r]=i}return n}function Vz(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new oE(t,r,e[r]);return n}var d0=class t{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=Vz(e,r.attrs),this.defaultAttrs=Hz(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==Ta.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:jz(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new dr(this,this.computeAttrs(e),M.from(n),ye.setFrom(r))}createChecked(e=null,n,r){return n=M.from(n),this.checkContent(n),new dr(this,this.computeAttrs(e),n,ye.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=M.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(M.empty,!0);return i?new dr(this,e,n.append(i),ye.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){}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:ye.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new t(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function MG(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}var oE=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?MG(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}},kh=class t{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=Vz(e,o.attrs),this.excluded=null;let i=Hz(this.attrs);this.instance=i?new ye(this,i):null}create(e=null){return!e&&this.instance?this.instance:new ye(this,jz(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new t(i,o++,n,s)),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]}excludes(e){return this.excluded.indexOf(e)>-1}},ka=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=QC.from(e.nodes),n.marks=QC.from(e.marks||{}),this.nodes=d0.compile(this.spec.nodes,this),this.marks=kh.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=Ta.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?xz(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:xz(this,s.split(" "))}this.nodeFromJSON=o=>dr.fromJSON(this,o),this.markFromJSON=o=>ye.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof d0){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,o)}text(e,n){let r=this.nodes.text;return new nE(r,r.defaultAttrs,e,ye.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 xz(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let l in t.marks){let a=t.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function RG(t){return t.tag!=null}function OG(t){return t.style!=null}var Vi=class t{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(RG(o))this.tags.push(o);else if(OG(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new f0(this,n,!1);return r.addAll(e,ye.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new f0(this,n,!0);return r.addAll(e,ye.none,n.from,n.to),N.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(_G(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Ez(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Ez(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new t(e,t.schemaRules(e)))}},Fz={address:!0,article:!0,aside:!0,blockquote:!0,body:!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},DG={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},$z={ol:!0,ul:!0},Ah=1,iE=2,Th=4;function Cz(t,e,n){return e!=null?(e?Ah:0)|(e==="full"?iE:0):t&&t.whitespace=="pre"?Ah|iE:n&~Th}var Yu=class{constructor(e,n,r,o,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=ye.none,this.match=i||(s&Th?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(M.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ah)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=M.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(M.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&&!Fz.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},f0=class{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=Cz(null,n.preserveWhitespace,0)|(r?Th:0);o?i=new Yu(o.type,o.attrs,ye.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new Yu(null,null,ye.none,!0,null,s):i=new Yu(e.schema.topNodeType,null,ye.none,!0,null,s),this.nodes=[i],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,o=this.top,i=o.options&iE?"full":this.localPreserveWS||(o.options&Ah)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
55
|
+
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(s.text(l[a]),n,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=o.content[o.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;$z.hasOwnProperty(s)&&this.parser.normalizeLists&&NG(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:DG.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(Fz.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=a&&a.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
56
|
+
`),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 o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(s,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let o,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],c=a.findWrapping(e);if(c&&(!o||o.length>c.length+l)&&(o=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=ye.none;for(let l of o.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Tz(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=Cz(e,i,s.options);s.options&Th&&s.content.length==0&&(l|=Th);let a=ye.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Tz(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Yu(e,n,a,o,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Ah)}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 o=r.length-1;o>=0;o--)e+=r[o].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 o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].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,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return s(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 NG(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&$z.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function _G(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Ez(t){let e={};for(let n in t)e[n]=t[n];return e}function Tz(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}var Fi=class t{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=s0(n).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){if(e.isText)return s0(n).createTextNode(e.text);let{dom:r,contentDOM:o}=l0(s0(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&l0(s0(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return typeof n=="string"?{dom:e.createTextNode(n)}:l0(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new t(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=kz(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return kz(e.marks)}};function kz(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function s0(t){return t.document||window.document}var Az=new WeakMap;function IG(t){let e=Az.get(t);return e===void 0&&Az.set(t,e=LG(t)),e}function LG(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 o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function l0(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=IG(r))&&i.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 s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let l,a=n?t.createElementNS(n,o):t.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof f=="string")a.appendChild(t.createTextNode(f));else{let{dom:h,contentDOM:p}=l0(t,f,n,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}var Xz=65535,Wz=Math.pow(2,16);function UG(t,e){return t+e*Wz}function Yz(t){return t&Xz}function PG(t){return(t-(t&Xz))/Wz}var Jz=1,Qz=2,h0=4,Zz=8,Oh=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Zz)>0}get deletedBefore(){return(this.delInfo&(Jz|h0))>0}get deletedAfter(){return(this.delInfo&(Qz|h0))>0}get deletedAcross(){return(this.delInfo&h0)>0}},$i=class t{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&t.empty)return t.empty}recover(e){let n=0,r=Yz(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+PG(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 o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,h=a+o+(f<0?0:u);if(r)return h;let p=e==(n<0?a:d)?null:UG(l/3,e-a),m=0;return c&&(m|=e==a?Qz:e==d?Jz:h0,(n<0?e!=a:e!=d)&&(m|=Zz)),new Oh(h,m,p)}o+=u-c}return r?e+o:new Oh(e+o,0,null)}touches(e,n){let r=0,o=Yz(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new t(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?t.empty:new t(e<0?[0,-e,0]:[0,0,e])}};$i.empty=new $i([]);var Dh=class t{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new t(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 o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o: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 o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new t;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 o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new Oh(e,o,null)}},sE=Object.create(null),wt=class{getMap(){return $i.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=sE[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 sE)throw new RangeError("Duplicate use of step JSON ID "+e);return sE[e]=n,n.prototype.jsonID=e,n}},nn=class t{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new t(e,null)}static fail(e){return new t(null,e)}static fromReplace(e,n,r,o){try{return t.ok(e.replace(n,r,o))}catch(i){if(i instanceof dl)return t.fail(i.message);throw i}}};function uE(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(uE(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return M.fromArray(r)}var Nh=class t extends wt{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),o=r.node(r.sharedDepth(this.to)),i=new N(uE(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return nn.fromReplace(e,this.from,this.to,i)}invert(e){let n=[];return e.nodesBetween(this.from,this.to,(r,o)=>{if(r.isInline&&r.isAtom){let i=this.mark.addToSet(r.marks);if(!ye.sameSet(i,r.marks)){let s=Math.max(this.from,o),l=Math.min(this.to,o+r.nodeSize);p0(fl,s,l,this.mark,n);for(let a of r.marks)a.isInSet(i)||p0(t,s,l,a,n)}}}),n.length==1?n[0]:new _h(n)}map(e){let n=e.map(this.from,1),r=e.map(this.to,-1);return n>=r?null:new t(n,r,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(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 t(n.from,n.to,e.markFromJSON(n.mark))}};wt.jsonID("addMark",Nh);var fl=class t extends wt{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 N(uE(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return nn.fromReplace(e,this.from,this.to,r)}invert(e){let n=[];return e.nodesBetween(this.from,this.to,(r,o)=>{r.isInline&&r.isAtom&&this.mark.isInSet(r.marks)&&p0(Nh,Math.max(this.from,o),Math.min(this.to,o+r.nodeSize),this.mark,n)}),n.length==1?n[0]:new _h(n)}map(e){let n=e.map(this.from,1),r=e.map(this.to,-1);return n>=r?null:new t(n,r,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(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 t(n.from,n.to,e.markFromJSON(n.mark))}};wt.jsonID("removeMark",fl);function p0(t,e,n,r,o){let i=o.length?o[o.length-1]:null;i&&i instanceof t&&i.to==e&&i.mark.eq(r)?o[o.length-1]=new t(i.from,n,r):o.push(new t(e,n,r))}var _h=class t extends wt{constructor(e){super(),this.steps=e}apply(e){for(let n of this.steps){let r=n.apply(e);if(!r.doc)return r;e=r.doc}return new nn(e,null)}invert(e){return new t(this.steps.map(n=>n.invert(e)))}map(e){let n=[];for(let r of this.steps){let o=r.map(e);o&&n.push(o)}return n.length?new t(n):null}toJSON(){return{stepType:"markSet",steps:this.steps.map(e=>e.toJSON())}}static fromJSON(e,n){if(!Array.isArray(n.steps)||!n.steps.every(r=>r.stepType=="addMark"||r.stepType=="removeMark"))throw new RangeError("Invalid JSON for MarkSetStep");return new t(n.steps.map(r=>wt.fromJSON(e,r)))}};wt.jsonID("markSet",_h);var Ih=class t extends wt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return nn.fromReplace(e,this.pos,this.pos+1,new N(M.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 o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new t(this.pos,n.marks[o]);return new t(this.pos,this.mark)}}return new qu(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(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 t(n.pos,e.markFromJSON(n.mark))}};wt.jsonID("addNodeMark",Ih);var qu=class t extends wt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return nn.fromReplace(e,this.pos,this.pos+1,new N(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Ih(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(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 t(n.pos,e.markFromJSON(n.mark))}};wt.jsonID("removeNodeMark",qu);var ht=class t extends wt{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&aE(e,this.from,this.to)?nn.fail("Structure replace would overwrite content"):nn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new $i([this.from,this.to-this.from,this.slice.size])}invert(e){return new t(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&t.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new t(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof t)||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?N.empty:new N(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new t(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?N.empty:new N(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new t(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 t(n.from,n.to,N.fromJSON(e,n.slice),!!n.structure)}};ht.MAP_BIAS=1;wt.jsonID("replace",ht);var Rt=class t extends wt{constructor(e,n,r,o,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(aE(e,this.from,this.gapFrom)||aE(e,this.gapTo,this.to)))return nn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return nn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?nn.fromReplace(e,this.from,this.to,r):nn.fail("Content does not fit in gap")}getMap(){return new $i([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 t(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),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new t(n.pos,r.pos,o,i,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 t(n.from,n.to,n.gapFrom,n.gapTo,N.fromJSON(e,n.slice),n.insert,!!n.structure)}};wt.jsonID("replaceAround",Rt);function aE(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function BG(t,e,n,r){let o=[];t.doc.nodesBetween(e,n,(i,s,l)=>{if(!i.isInline)return;let a=i.marks;if(!r.isInSet(a)&&l.type.allowsMarkType(r.type)){let c=Math.max(s,e),u=Math.min(s+i.nodeSize,n);p0(Nh,c,u,r,o)}}),o.forEach(i=>t.step(i))}function HG(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline||!s.isAtom)return;i++;let a=null;if(r instanceof kh){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<o.length;h++){let p=o[h];p.step==i-1&&d.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(s=>t.step(new fl(s.from,s.to,s.style)))}function dE(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new ht(l,u,N.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new fl(l,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new N(M.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new ht(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(M.empty,!0);t.replace(l,l,new N(a,0,0))}for(let a=s.length-1;a>=0;a--)t.step(s[a])}function jG(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Yi(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,o=0,i=0;;--r){let s=t.$from.node(r),l=t.$from.index(r)+o,a=t.$to.indexAfter(r)-i;if(r<t.depth&&s.canReplace(l,a,n))return r;if(r==0||s.type.spec.isolating||!jG(s,l,a))break;l&&(o=1),a<s.childCount&&(i=1)}return null}function VG(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),l=o.after(i+1),a=s,c=l,u=M.empty,d=0;for(let p=i,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,u=M.from(r.node(p).copy(u)),d++):a--;let f=M.empty,h=0;for(let p=i,m=!1;p>n;p--)m||o.after(p+1)<o.end(p)?(m=!0,f=M.from(o.node(p).copy(f)),h++):c++;t.step(new Rt(a,c,s,l,new N(u.append(f),d,h),u.size-d,!0))}function Gu(t,e,n=null,r=t){let o=FG(t,e),i=o&&$G(r,e);return i?o.map(qz).concat({type:e,attrs:n}).concat(i.map(qz)):null}function qz(t){return{type:t,attrs:null}}function FG(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function $G(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:s}function YG(t,e,n){let r=M.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let l=n[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=M.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new Rt(o,i,o,i,new N(r,0,0),n.length,!0))}function qG(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let a=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,a)&&KG(t.doc,t.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&tU(t,s,l,i),dE(t,t.mapping.slice(i).map(l,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(l,1),f=u.map(l+s.nodeSize,1);return t.step(new Rt(d,f,d+1,f-1,new N(M.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&eU(t,s,l,i),!1}})}function eU(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(o.text);){let a=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function tU(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
|
|
57
|
+
`))}})}function KG(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function GG(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Rt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new N(M.from(s),0,0),1,!0))}function no(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function XG(t,e,n=1,r){let o=t.doc.resolve(e),i=M.empty,s=M.empty;for(let l=o.depth,a=o.depth-n,c=n-1;l>a;l--,c--){i=M.from(o.node(l).copy(i));let u=r&&r[c];s=M.from(u?u.type.create(u.attrs,s):o.node(l).copy(s))}t.step(new ht(e,e,new N(i.append(s),n,n),!0))}function xo(t,e){let n=t.resolve(e),r=n.index();return nU(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function WG(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function nU(t,e){return!!(t&&e&&!t.isLeaf&&WG(t,e))}function Xu(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,l=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),l++,s=r.node(o).maybeChild(l)):(i=r.node(o).maybeChild(l-1),s=r.node(o+1)),i&&!i.isTextblock&&nU(i,s)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function JG(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let l=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);tU(t,u.node(),u.before(),l)}s.inlineContent&&dE(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new ht(c,a.map(e+n,-1),N.empty,!0)),r===!0){let u=t.doc.resolve(c);eU(t,u.node(),u.before(),t.steps.length)}return t}function QG(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 o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function y0(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),u=!1;if(i==1)u=c.canReplace(a,a,o);else{let d=c.contentMatchAt(a).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Aa(t,e,n=e,r=N.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return rU(o,i,r)?new ht(e,n,r):new cE(o,i,r).fit()}function rU(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}var cE=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=M.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=M.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new N(i,s,l);return e>-1?new Rt(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new ht(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Kz(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(M.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced;return Gz(e,-1)<=n?!1:(this.unplaced.size>1&&Gz(e,1)>r&&r++,this.unplaced=new N(e,n+1,r),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Kz(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new N(Mh(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new N(Mh(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let h=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let m=l.child(c),y=d.matchType(m.type);if(!y)break;c++,(c>1||a==0||m.content.size)&&(d=y,u.push(oU(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=Rh(this.placed,n,M.from(u)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,y=l;m<h;m++){let g=y.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),y=g.content}this.unplaced=p?e==0?N.empty:new N(Mh(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new N(Mh(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!lE(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,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=lE(e,n,o,r,i);if(s){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=lE(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?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=Rh(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Rh(this.placed,this.depth,M.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(M.empty,!0);n.childCount&&(this.placed=Rh(this.placed,this.frontier.length,n))}};function Mh(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Mh(t.firstChild.content,e-1,n)))}function Rh(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Rh(t.lastChild.content,e-1,n)))}function Kz(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function oU(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,oU(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(M.empty,!0)))),t.copy(r)}function lE(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!ZG(n,i.content,s)?l:null}function ZG(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function eX(t){return t.spec.defining||t.spec.definingForContent}function Gz(t,e){for(let n=0;;n++){let r=e<0?t.firstChild:t.lastChild;if(!r||r.isAtom)return n;t=r.content}}function tX(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(rU(o,i,r))return t.step(new ht(e,n,r));let s=sU(o,i);s[s.length-1]==0&&s.pop();let l=-(o.depth+1);s.unshift(l);for(let f=o.depth,h=o.pos-1;f>0;f--,h--){let p=o.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(f)>-1?l=f:o.before(f)==h&&s.splice(1,0,-f)}let a=s.indexOf(l),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=eX(h.type);if(p&&!h.sameMarkup(o.node(Math.abs(l)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m<s.length;m++){let y=s[(m+a)%s.length],g=!0;y<0&&(g=!1,y=-y);let v=o.node(y-1),b=o.index(y-1);if(v.canReplaceWith(b,b,p.type,p.marks))return t.replace(o.before(y),g?i.after(y):n,new N(iU(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=s[f];h<0||(e=o.before(h),n=i.after(h))}}function iU(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(iU(i.content,e+1,n,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(M.empty,!0))}return t}function nX(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=QG(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new N(M.from(r),0,0))}function rX(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n);if(r.parent.isTextblock&&o.parent.isTextblock&&r.start()!=o.start()&&r.parentOffset==0&&o.parentOffset==0){let s=r.sharedDepth(n),l=!1;for(let a=r.depth;a>s;a--)r.node(a).type.spec.isolating&&(l=!0);for(let a=o.depth;a>s;a--)o.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=r.depth;a>0&&e==r.start(a);a--)e=r.before(a);for(let a=o.depth;a>0&&n==o.start(a);a--)n=o.before(a);r=t.doc.resolve(e),o=t.doc.resolve(n)}}let i=sU(r,o);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return t.delete(r.before(l),o.after(l))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function sU(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(i<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}var m0=class t extends wt{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 nn.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return nn.fromReplace(e,this.pos,this.pos+1,new N(M.from(o),0,n.isLeaf?0:1))}getMap(){return $i.empty}invert(e){return new t(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 t(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 t(n.pos,n.attr,n.value)}};wt.jsonID("attr",m0);var g0=class t extends wt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return nn.ok(r)}getMap(){return $i.empty}invert(e){return new t(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 t(n.attr,n.value)}};wt.jsonID("docAttr",g0);var Ku=class extends Error{};Ku=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Ku.prototype=Object.create(Error.prototype);Ku.prototype.constructor=Ku;Ku.prototype.name="TransformError";var hl=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Dh}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Ku(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 o=this.mapping.maps[r];r&&(e=o.map(e,1),n=o.map(n,-1)),o.forEach((i,s,l,a)=>{e=Math.min(e,l),n=Math.max(n,a)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=N.empty){let o=Aa(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new N(M.from(r),0,0))}delete(e,n){return this.replace(e,n,N.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return tX(this,e,n,r),this}replaceRangeWith(e,n,r){return nX(this,e,n,r),this}deleteRange(e,n){return rX(this,e,n),this}lift(e,n){return VG(this,e,n),this}join(e,n=1){return JG(this,e,n),this}wrap(e,n){return YG(this,e,n),this}setBlockType(e,n=e,r,o=null){return qG(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return GG(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new m0(e,n,r)),this}setDocAttribute(e,n){return this.step(new g0(e,n)),this}addNodeMark(e,n){return this.step(new Ih(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 ye)n.isInSet(r.marks)&&this.step(new qu(e,n));else{let o=r.marks,i,s=[];for(;i=n.isInSet(o);)s.push(new qu(e,i)),o=i.removeFromSet(o);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,n=1,r){return XG(this,e,n,r),this}addMark(e,n,r){return BG(this,e,n,r),this}removeMark(e,n,r){return HG(this,e,n,r),this}clearIncompatible(e,n,r){return dE(this,e,n,r),this}};var fE=Object.create(null),H=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Ju(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=N.empty){let r=n.content.lastChild,o=null;for(let l=0;l<n.openEnd;l++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?N.empty:n),l==0&&cU(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:l}=o[i],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),cU(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new L(e):Wu(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=n<0?Wu(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Wu(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new yn(e.node(0))}static atStart(e){return Wu(e,e,0,0,1)||new yn(e)}static atEnd(e){return Wu(e,e,e.content.size,e.childCount,-1)||new yn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=fE[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 fE)throw new RangeError("Duplicate use of selection JSON ID "+e);return fE[e]=n,n.prototype.jsonID=e,n}getBookmark(){return L.between(this.$anchor,this.$head).getBookmark()}};H.prototype.visible=!0;var Ju=class{constructor(e,n){this.$from=e,this.$to=n}},lU=!1;function aU(t){!lU&&!t.parent.inlineContent&&(lU=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}var L=class t extends H{constructor(e,n=e){aU(e),aU(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 H.near(r);let o=e.resolve(n.map(this.anchor));return new t(o.parent.inlineContent?o:r,r)}replace(e,n=N.empty){if(super.replace(e,n),n==N.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof t&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new b0(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 t(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=H.findFrom(n,r,!0)||H.findFrom(n,-r,!0);if(i)n=i.$head;else return H.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(H.findFrom(e,-r,!0)||H.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new t(e,n)}};H.jsonID("text",L);var b0=class t{constructor(e,n){this.anchor=e,this.head=n}map(e){return new t(e.map(this.anchor),e.map(this.head))}resolve(e){return L.between(e.resolve(this.anchor),e.resolve(this.head))}},j=class t extends H{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:o}=n.mapResult(this.anchor),i=e.resolve(o);return r?H.near(i):new t(i)}content(){return new N(M.from(this.node),0,0)}eq(e){return e instanceof t&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new pE(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new t(e.resolve(n.anchor))}static create(e,n){return new t(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};j.prototype.visible=!1;H.jsonID("node",j);var pE=class t{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new b0(r,r):new t(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&j.isSelectable(r)?new j(n):H.near(n)}},yn=class t extends H{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=N.empty){if(n==N.empty){e.delete(0,e.doc.content.size);let r=H.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new t(e)}map(e){return new t(e)}eq(e){return e instanceof t}getBookmark(){return oX}};H.jsonID("all",yn);var oX={map(){return this},resolve(t){return new yn(t)}};function Wu(t,e,n,r,o,i=!1){if(e.inlineContent)return L.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let l=e.child(s);if(l.isAtom){if(!i&&j.isSelectable(l))return j.create(t,n-(o<0?l.nodeSize:0))}else{let a=Wu(t,l,n+o,o<0?l.childCount:0,o,i);if(a)return a}n+=l.nodeSize*o}return null}function cU(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof ht||o instanceof Rt))return;let i=t.mapping.maps[r],s;i.forEach((l,a,c,u)=>{s==null&&(s=u)}),t.setSelection(H.near(t.doc.resolve(s),n))}var uU=1,v0=2,dU=4,mE=class extends hl{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|uU)&~v0,this.storedMarks=null,this}get selectionSet(){return(this.updated&uU)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=v0,this}ensureMarks(e){return ye.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&v0)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~v0,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)||ye.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(H.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|=dU,this}get scrolledIntoView(){return(this.updated&dU)>0}};function fU(t,e){return!e||!t?t:t.bind(e)}var Ma=class{constructor(e,n,r){this.name=e,this.init=fU(n.init,r),this.apply=fU(n.apply,r)}},iX=[new Ma("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ma("selection",{init(t,e){return t.selection||H.atStart(e.doc)},apply(t){return t.selection}}),new Ma("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Ma("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})],Lh=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=iX.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 Ma(r.key,r.spec.state,r))})}},Ra=class t{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 o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=o?o[s].n:0,c=o?o[s].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new t(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new mE(this)}static create(e){let n=new Lh(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new t(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new Lh(this.schema,e.plugins),r=n.fields,o=new t(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}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 o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.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 o=new Lh(e.schema,e.plugins),i=new t(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=dr.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=H.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[s.name]=c.fromJSON.call(a,e,n[l],i);return}}i[s.name]=s.init(e,i)}}),i}};function hU(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=hU(o,e,{})),n[r]=o}return n}var G=class{constructor(e){this.spec=e,this.props={},e.props&&hU(e.props,this,this.props),this.key=e.key?e.key.key:pU("plugin")}getState(e){return e[this.key]}},hE=Object.create(null);function pU(t){return t in hE?t+"$"+ ++hE[t]:(hE[t]=0,t+"$")}var le=class{constructor(e="key"){this.key=pU(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var gU=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function yU(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}var yE=(t,e,n)=>{let r=yU(t,n);if(!r)return!1;let o=bE(r);if(!o){let s=r.blockRange(),l=s&&Yi(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(EU(t,o,e,-1))return!0;if(r.parent.content.size==0&&(Qu(i,"end")||j.isSelectable(i)))for(let s=r.depth;;s--){let l=Aa(t.doc,r.before(s),r.after(s),N.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(Qu(i,"end")?H.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):j.create(a.doc,o.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},w0=(t,e,n)=>{let r=yU(t,n);if(!r)return!1;let o=bE(r);return o?vU(t,o,e):!1},S0=(t,e,n)=>{let r=bU(t,n);if(!r)return!1;let o=xE(r);return o?vU(t,o,e):!1};function vU(t,e,n){let r=e.nodeBefore,o=r,i=e.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=u}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=Aa(t.doc,i,a,N.empty);if(!c||c.from!=i||c instanceof ht&&c.slice.size>=a-i)return!1;if(n){let u=t.tr.step(c);u.setSelection(L.create(u.doc,i)),n(u.scrollIntoView())}return!0}function Qu(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}var vE=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=bE(r)}let s=i&&i.nodeBefore;return!s||!j.isSelectable(s)?!1:(e&&e(t.tr.setSelection(j.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function bE(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 bU(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}var wE=(t,e,n)=>{let r=bU(t,n);if(!r)return!1;let o=xE(r);if(!o)return!1;let i=o.nodeAfter;if(EU(t,o,e,1))return!0;if(r.parent.content.size==0&&(Qu(i,"start")||j.isSelectable(i))){let s=Aa(t.doc,r.before(),r.after(),N.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(Qu(i,"start")?H.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):j.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},SE=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=xE(r)}let s=i&&i.nodeAfter;return!s||!j.isSelectable(s)?!1:(e&&e(t.tr.setSelection(j.create(t.doc,i.pos)).scrollIntoView()),!0)};function xE(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}var wU=(t,e)=>{let n=t.selection,r=n instanceof j,o;if(r){if(n.node.isTextblock||!xo(t.doc,n.from))return!1;o=n.from}else if(o=Xu(t.doc,n.from,-1),o==null)return!1;if(e){let i=t.tr.join(o);r&&i.setSelection(j.create(i.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},SU=(t,e)=>{let n=t.selection,r;if(n instanceof j){if(n.node.isTextblock||!xo(t.doc,n.to))return!1;r=n.to}else if(r=Xu(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},xU=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),i=o&&Yi(o);return i==null?!1:(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)},CE=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
58
|
+
`).scrollIntoView()),!0)};function EE(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var TE=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=EE(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,s.createAndFill());a.setSelection(H.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},kE=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof yn||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=EE(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=t.tr.insert(s,i.createAndFill());l.setSelection(L.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},AE=(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 i=n.before();if(no(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Yi(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function sX(t){return(e,n)=>{if(e.selection instanceof j&&e.selection.node.isBlock){let{$from:h}=e.selection;return!h.parentOffset||!no(e.doc,h.pos)?!1:(n&&n(e.tr.split(h.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof L||e.selection instanceof yn)&&r.deleteSelection();let{$from:o}=r.selection,i=r.steps.length,s=[],l,a,c=!1,u=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){c=o.end(h)==o.pos+(o.depth-h),u=o.start(h)==o.pos-(o.depth-h),a=EE(o.node(h-1).contentMatchAt(o.indexAfter(h-1)));let m=t&&t(o.parent,c,o);s.unshift(m||(c&&a?{type:a}:null)),l=h;break}else{if(h==1)return!1;s.unshift(null)}let d=o.pos,f=no(r.doc,d,s.length,s);if(f||(s[0]=a?{type:a}:null,f=no(r.doc,d,s.length,s)),!f)return!1;if(r.split(d,s.length,s),!c&&u&&o.node(l).type!=a){let h=r.mapping.slice(i),p=h.map(o.before(l)),m=r.doc.resolve(p);a&&o.node(l-1).canReplaceWith(m.index(),m.index()+1,a)&&r.setNodeMarkup(h.map(o.before(l)),a)}return n&&n(r.scrollIntoView()),!0}}var lX=sX();var CU=(t,e)=>{let{$from:n,to:r}=t.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),e&&e(t.tr.setSelection(j.create(t.doc,o))),!0)},aX=(t,e)=>(e&&e(t.tr.setSelection(new yn(t.doc))),!0);function cX(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||xo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function EU(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,s,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&cX(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,p=M.empty;for(let g=s.length-1;g>=0;g--)p=M.from(s[g].create(null,p));p=M.from(o.copy(p));let m=t.tr.step(new Rt(e.pos-1,h,e.pos,h,new N(p,1,0),s.length,!0)),y=m.doc.resolve(h+2*s.length);y.nodeAfter&&y.nodeAfter.type==o.type&&xo(m.doc,y.pos)&&m.join(y.pos),n(m.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&a?null:H.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Yi(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&Qu(i,"start",!0)&&Qu(o,"end")){let h=o,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=i,y=1;for(;!m.isTextblock;m=m.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let g=M.empty;for(let b=p.length-1;b>=0;b--)g=M.from(p[b].copy(g));let v=t.tr.step(new Rt(e.pos-p.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new N(g,p.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function TU(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(L.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}var ME=TU(-1),RE=TU(1);function kU(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),l=s&&Gu(s,t,e);return l?(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function OE(t,e=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[s];i.setBlockType(l,a,t,e)}r(i.scrollIntoView())}return!0}}function DE(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}var gE=DE(gU,yE,vE),mU=DE(gU,wE,SE),pl={Enter:DE(CE,kE,AE,lX),"Mod-Enter":TE,Backspace:gE,"Mod-Backspace":gE,"Shift-Backspace":gE,Delete:mU,"Mod-Delete":mU,"Mod-a":aX},uX={"Ctrl-h":pl.Backspace,"Alt-Backspace":pl["Mod-Backspace"],"Ctrl-d":pl.Delete,"Ctrl-Alt-Backspace":pl["Mod-Delete"],"Alt-Delete":pl["Mod-Delete"],"Alt-d":pl["Mod-Delete"],"Ctrl-a":ME,"Ctrl-e":RE};for(let t in pl)uX[t]=pl[t];var xse=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1;function AU(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let l=r?n.tr:null;return dX(l,s,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function dX(t,e,n,r=null){let o=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);i=new Ea(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Ea(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let l=Gu(i,n,r,e);return l?(t&&fX(t,e,l,o,n),!0):!1}function fX(t,e,n,r,o){let i=M.empty;for(let u=n.length-1;u>=0;u--)i=M.from(n[u].type.create(n[u].attrs,i));t.step(new Rt(e.start-(r?2:0),e.end,e.start,e.end,new N(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let l=n.length-s,a=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&no(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function MU(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?hX(e,n,t,i):pX(e,n,i):!0:!1}}function hX(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Rt(i-1,s,i,s,new N(M.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ea(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));let l=Yi(r);if(l==null)return!1;o.lift(r,l);let a=o.doc.resolve(o.mapping.map(i,-1)-1);return xo(o.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&o.join(a.pos),e(o.scrollIntoView()),!0}function pX(t,e,n){let r=t.tr,o=n.parent;for(let h=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)h-=o.child(p).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?M.empty:M.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new Rt(d-(l?1:0),f+(a?1:0),d+1,f-1,new N((l?M.empty:M.from(o.copy(M.empty))).append(a?M.empty:M.from(o.copy(M.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function RU(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=M.from(c?t.create():null),d=new N(M.from(t.create(null,M.from(l.type.create(null,u)))),c?3:1,0),f=i.start,h=i.end;n(e.tr.step(new Rt(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}var vn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},nd=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e},zE=null,Ki=function(t,e,n){let r=zE||(zE=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},mX=function(){zE=null},Ua=function(t,e,n,r){return n&&(OU(t,e,n,r,-1)||OU(t,e,n,r,1))},gX=/^(img|br|input|textarea|hr)$/i;function OU(t,e,n,r,o){for(var i;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Dn(t))){let s=t.parentNode;if(!s||!F(s)||Yh(t)||gX.test(t.nodeName)||t.contentEditable=="false")return!1;e=vn(t)+(o<0?0:1),t=s}else if(F(t)){let s=t.childNodes[e+(o<0?-1:0)];if(F(s)&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=o;else return!1;else t=s,e=o<0?Dn(t):0}else return!1}}function Dn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function F(t){return t.nodeType==1}function Vt(t){return t.nodeType==3}function Pa(t,e){return e?t.contains(F(e)?e:e.parentNode):!1}function yX(t,e){for(;;){if(Vt(t)&&e)return t;if(F(t)&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Dn(t)}else if(t.parentNode&&!Yh(t))e=vn(t),t=t.parentNode;else return null}}function vX(t,e){for(;;){if(Vt(t)&&e<t.nodeValue.length)return t;if(F(t)&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Yh(t))e=vn(t)+1,t=t.parentNode;else return null}}function bX(t,e,n){for(let r=e==0,o=e==Dn(t);r||o;){if(t==n)return!0;let i=vn(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,o=o&&i==Dn(t)}}function Yh(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)}var N0=function(t){return t.focusNode&&Ua(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Oa(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function wX(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function SX(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Dn(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Dn(r.startContainer),r.startOffset)}}}var Jo=typeof navigator<"u"?navigator:null,DU=typeof document<"u"?document:null,bl=Jo&&Jo.userAgent||"",UE=/Edge\/(\d+)/.exec(bl),sP=/MSIE \d/.exec(bl),PE=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(bl),fr=!!(sP||PE||UE),yl=sP?document.documentMode:PE?+PE[1]:UE?+UE[1]:0,Ir=!fr&&/gecko\/(\d+)/i.test(bl);Ir&&+(/Firefox\/(\d+)/.exec(bl)||[0,0])[1];var BE=!fr&&/Chrome\/(\d+)/.exec(bl),bn=!!BE,lP=BE?+BE[1]:0,Nn=!fr&&!!Jo&&/Apple Computer/.test(Jo.vendor),rd=Nn&&(/Mobile\/\w+/.test(bl)||!!Jo&&Jo.maxTouchPoints>2),ro=rd||(Jo?/Mac/.test(Jo.platform):!1),aP=Jo?/Win/.test(Jo.platform):!1,Gi=/Android \d/.test(bl),_0=!!DU&&"webkitFontSmoothing"in DU.documentElement.style,xX=_0?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function CX(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 qi(t,e){return typeof t=="number"?t:t[e]}function EX(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 NU(t,e,n){if(!HE(e)&&e.left==0)return;let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(!F(s)){s=nd(s);continue}let l=s==i.body,a=l?CX(i):EX(s),c=0,u=0;if(e.top<a.top+qi(r,"top")?u=-(a.top-e.top+qi(o,"top")):e.bottom>a.bottom-qi(r,"bottom")&&(u=e.bottom-e.top>a.bottom-a.top?e.top+qi(o,"top")-a.top:e.bottom-a.bottom+qi(o,"bottom")),e.left<a.left+qi(r,"left")?c=-(a.left-e.left+qi(o,"left")):e.right>a.right-qi(r,"right")&&(c=e.right-a.right+qi(o,"right")),c||u)if(l)i.defaultView.scrollBy(c,u);else{let f=s.scrollLeft,h=s.scrollTop;u&&(s.scrollTop+=u),c&&(s.scrollLeft+=c);let p=s.scrollLeft-f,m=s.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}let d=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s=d=="absolute"?s.offsetParent:nd(s)}}function TX(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(i,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:cP(t.dom)}}function cP(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=nd(r));return e}function kX({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;uP(n,r==0?0:r-e)}function uP(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:i}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}var Zu=null;function AX(t){if(t.setActive)return t.setActive();if(Zu)return t.focus(Zu);let e=cP(t);t.focus(Zu==null?{get preventScroll(){return Zu={preventScroll:!0},!0}}:void 0),Zu||(Zu=!1,uP(e,0))}function dP(t,e){let n,r=2e8,o,i=0,s=e.top,l=e.top,a,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(F(u))f=u.getClientRects();else if(Vt(u))f=Ki(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=s&&p.bottom>=l){s=Math.max(p.bottom,s),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=u,r=m,o=m&&Vt(n)?{left:p.right<e.left?p.right:p.left,top:e.top}:e,F(u)&&m&&(i=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=d+1)}}return!n&&a&&(n=a,o=c,r=0),n&&Vt(n)?MX(n,o):!n||r?{node:t,offset:i}:dP(n,o)}function MX(t,e){let n=t.nodeValue.length,r=document.createRange(),o;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let s=ml(r,1);if(s.top!=s.bottom&&nT(e,s)){o={node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),o||{node:t,offset:0}}function nT(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function RX(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function OX(t,e,n){let{node:r,offset:o}=dP(e,n),i=-1;if(F(r)&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,o,i)}function DX(t,e,n,r){let o=-1;for(let i=e,s=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0),a;if(!l)return null;if(F(l.dom)&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>r.left||a.top>r.top?o=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(o=l.posAfter),s=!0),!l.contentDOM&&o<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function fP(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=t.childNodes[i];if(F(s)){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(nT(e,c))return fP(s,e,c)}}if((i=(i+1)%r)==o)break}return t}function NX(t,e){let n=t.dom.ownerDocument,r,o=0,i=SX(n,e.left,e.top);i&&({node:r,offset:o}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s)){let c=t.dom.getBoundingClientRect();if(!nT(e,c)||(s=fP(t.dom,e,c),!s))return null}if(Nn)for(let c=s;r&&c;c=nd(c))c.draggable&&(r=void 0);if(s=RX(s,e),r){if(Ir&&F(r)&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;_0&&o&&F(r)&&F(c=r.childNodes[o-1])&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&F(r.lastChild)&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(o==0||!F(r)||r.childNodes[o-1].nodeName!="BR")&&(l=DX(t,r,o,e))}l==null&&(l=OX(t,s,e));let a=t.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function HE(t){return t.top<t.bottom||t.left<t.right}function ml(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(HE(r))return r}return Array.prototype.find.call(n,HE)||t.getBoundingClientRect()}var _X=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function hP(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=_0||Ir;if(Vt(r))if(s&&(_X.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let a=ml(Ki(r,o,o),n);if(Ir&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=ml(Ki(r,o-1,o-1),-1);if(c.top==a.top){let u=ml(Ki(r,o,o+1),-1);if(u.top!=a.top)return zh(u,u.left<c.left)}}return a}else{let a=o,c=o,u=n<0?1:-1;return n<0&&!o?(c++,u=-1):n>=0&&o==r.nodeValue.length?(a--,u=1):n<0?a--:c++,zh(ml(Ki(r,a,c),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==Dn(r))){let a=r.childNodes[o-1];if(F(a))return NE(a.getBoundingClientRect(),!1)}if(i==null&&o<Dn(r)){let a=r.childNodes[o];if(F(a))return NE(a.getBoundingClientRect(),!0)}return NE(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==Dn(r))){let a=r.childNodes[o-1],c=Vt(a)?Ki(a,Dn(a)-(s?0:1)):F(a)&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return zh(ml(c,1),!1)}if(i==null&&o<Dn(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?Vt(a)?Ki(a,0,s?0:1):F(a)?a:null:null;if(c)return zh(ml(c,-1),!0)}return zh(ml(Vt(r)?Ki(r):r,-n),n>=0)}function zh(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 NE(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 pP(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function IX(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return pP(t,e,()=>{let{node:i}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=hP(t,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(F(l))a=l.getClientRects();else if(Vt(l))a=Ki(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}var LX=/[\u0590-\u08ac]/;function zX(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=t.domSelection();return l?!LX.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:pP(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),y=p&&!Pa(h,p)||a==p&&c==m;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}var _U=null,IU=null,LU=!1;function UX(t,e,n){return _U==e&&IU==n?LU:(_U=e,IU=n,LU=n=="up"||n=="down"?IX(t,e,n):zX(t,e,n))}var oo=0,zU=1,Da=2,Co=3,Ba=class{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=oo,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(e){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 o=this.children[n];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&Pa(this.contentDOM,e))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>vn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM)){let i=e.compareDocumentPosition(this.contentDOM);i&16?o=n>Array.from(e.childNodes).findIndex(s=>s.contains(this.contentDOM)):o=!(i&4)}else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(F(s)?Pa(s,e):s==e))r=!1;else return i}}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 o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let l=o.children[s];if(l.size){o=l;break}}return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],l=i+s.size;if(l>e){o=e-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(;r>0;r--){let i=this.children[r-1];if(i.size||!(i instanceof E0||i instanceof x0&&i.side>=0))break}if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?vn(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?vn(i.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 o=-1,i=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(o==-1&&e<=c){let u=s+a.border;if(e>=u&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,u);e=s;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=vn(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>n||l==this.children.length-1)){n=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=vn(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:i}}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(!F(n)||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,o=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],y=p+m.size;if(i>p&&s<y)return m.setSelection(e-p-m.border,n-p-m.border,r,o);p=y}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Ir||Nn)&&e==n){let{node:h,offset:p}=l;if(Vt(h)){if(d=!!(p&&h.nodeValue[p-1]==`
|
|
59
|
+
`),d&&p==h.nodeValue.length)for(let m=h,y;m;m=m.parentNode){if(y=m.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:vn(y)+1});break}let g=m.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Ir&&u.focusNode&&u.focusNode!=a.node&&F(u.focusNode)){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||d&&Nn)&&Ua(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Ua(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&Ir)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let l=r+i.border,a=s-i.border;if(e>=l&&n<=a){this.dirty=e==r||n==s?Da:zU,e==l&&n==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Co:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Da:Co}r=s}this.dirty=Da}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Da:zU;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},x0=class extends Ba{constructor(e,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){let l=F(s)?s:document.createElement("span");l!=s&&(l.appendChild(s),s=l),l.hasAttribute("contenteditable")||(l.contentEditable="false"),l.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==oo&&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}},jE=class extends Ba{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}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}},_a=class t extends Ba{constructor(e,n,r,o,i){super(e,[],r,o),this.mark=n,this.spec=i}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=Fi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new t(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Co||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Co&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=oo){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=oo}}slice(e,n,r){let o=t.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=YE(i,n,s,r)),e>0&&(i=YE(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},vl=class t extends Ba{constructor(e,n,r,o,i,s,l){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,n,r,o,i,s){let l=i.nodeViews[n.type.name],a,c=l&&l(n,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(!Vt(u))throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=Fi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=yP(u,r,n),c?a=new VE(e,n,r,o,u,d||null,f,c):n.isText?new C0(e,n,r,o,u,f):new t(e,n,r,o,u,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let o=this.children[r];if(this.dom.contains(o.dom.parentNode)){n.contentElement=o.dom.parentNode;break}}if(!n.contentElement){let r=e&&e.find(o=>F(o)&&e.indexOf(o.parentNode)<0&&this.dom.contains(o));r?n.contentElement=r:n.getContent=()=>M.empty}}return n}matchesNode(e,n,r){return this.dirty==oo&&e.eq(this.node)&&T0(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,o=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new $E(this,s&&s.node,e),c=this.node.inlineContent,u=c&&this.node.isBlock;jX(this.node,this.innerDeco,(d,f,h)=>{d.spec.marks?a.syncToMarks(d.spec.marks,r,e,f):d.type.side>=0&&!h&&a.syncToMarks(f==this.node.childCount?ye.none:this.node.child(f).marks,r,e,f),a.placeWidget(d,e,o)},(d,f,h,p)=>{a.syncToMarks(d.marks,r,e,p),u&&d.isAtom&&!d.isText&&a.addHackNode("IMG",a.top);let m;a.findNodeMatch(d,f,h,p)||l&&e.state.selection.from>o&&e.state.selection.to<o+d.nodeSize&&(m=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(d,f,h,m,e)||a.updateNextNode(d,f,h,e,p,o)||a.addNode(d,f,h,e,o),o+=d.nodeSize,c&&(u=d.isAtom&&!d.isText)}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Da)&&(s&&this.protectLocalComposition(e,s),mP(this.contentDOM,this.children,e),rd&&VX(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof L)||r<n||o>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=FX(this.node.content,s,r-n,o-n);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new jE(this,i,n,o);e.input.compositionNodes.push(s),this.children=YE(this.children,r,r+o.length,e,s)}update(e,n,r,o){return this.dirty==Co||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=oo}updateOuterDeco(e){if(T0(e,this.outerDeco))return;let n=!F(this.nodeDOM),r=this.dom;this.dom=gP(this.dom,this.nodeDOM,FE(this.outerDeco,this.node,n),FE(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){F(this.nodeDOM)&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){F(this.nodeDOM)&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function UU(t,e,n,r,o){yP(r,e,t);let i=new vl(void 0,t,e,n,r,r,r);return i.contentDOM&&i.updateChildren(o,0),i}var C0=class t extends vl{constructor(e,n,r,o,i,s){super(e,n,r,o,i,null,s)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==Co||this.dirty!=oo&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=oo||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=oo,!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 o=this.node.cut(e,n),i=document.createTextNode(o.text);return new t(this.parent,o,this.outerDeco,this.innerDeco,i,i)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Co)}get domAtom(){return!1}isText(e){return this.node.text==e}},E0=class extends Ba{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==oo&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},VE=class extends vl{constructor(e,n,r,o,i,s,l,a){super(e,n,r,o,i,s,l),this.spec=a}update(e,n,r,o){if(this.dirty==Co)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}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 mP(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==t){for(;l!=r;)r=PU(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(l,r);if(s instanceof _a){let a=r?r.previousSibling:t.lastChild;mP(s.contentDOM,s.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=PU(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}var Ph=function(t){t&&(this.nodeName=t)};Ph.prototype=Object.create(null);var Na=[new Ph];function FE(t,e,n){if(t.length==0)return Na;let r=n?Na[0]:new Ph,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new Ph(s.nodeName));for(let l in s){let a=s[l];a!=null&&(n&&o.length==1&&o.push(r=new Ph(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return o}function gP(t,e,n,r){if(n==Na&&r==Na)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],l=n[i];if(i){let a;l&&l.nodeName==s.nodeName&&o!=t&&(a=o.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=Na[0]),o=a}PX(o,l||Na[0],s)}return o}function PX(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):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.add(o[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function yP(t,e,n){return gP(t,t,Na,FE(e,n,!F(t)))}function T0(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 PU(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}var $E=class{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=BX(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,o){let i=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;i<l&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=oo,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1,c=this.top.children.length;o<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[s])&&!this.isLocked(d.dom)){a=u;break}}if(a<0&&this.index<this.top.children.length){let u=this.top.children[this.index];u instanceof _a&&u.dirty!=Co&&u.mark.type==e[s].type&&u.spec.update&&!this.isLocked(u.dom)&&u.spec.update(e[s])&&(u.mark=e[s],a=this.index,this.changed=!0)}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=_a.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,o,i){let s=this.top.children[o];return s.dirty==Co&&s.dom==s.contentDOM&&(s.dirty=Da),s.update(e,n,r,i)?(this.destroyBetween(this.index,o),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 o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,i,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof vl){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;let u=a.dom,d,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Co&&T0(n,a.outerDeco));if(!f&&a.update(e,n,r,o))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,n,r,o,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Da,d.updateChildren(o,s+1),d.dirty=oo),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!T0(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=vl.create(this.top,n,r,o,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,o,i){let s=vl.create(this.top,e,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new x0(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof _a;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof C0)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Nn||bn)&&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 o=new E0(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||F(e)&&e.contains(this.lock.parentNode))}};function BX(t,e){let n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];e:for(;o>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof _a)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(o-1))break;--o,i.set(l,o),s.push(l)}}return{index:o,matched:i,matches:s.reverse()}}function HX(t,e){return t.type.side-e.type.side}function jX(t,e,n,r){let o=e.locals(t),i=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,o,e.forChild(i,u),c),i+=u.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let y=o[s++];y.widget&&(u?(d||(d=[u])).push(y):u=y)}if(u)if(d){d.sort(HX);for(let y=0;y<d.length;y++)n(d[y],c,!!a)}else n(u,c,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let y=0;y<l.length;y++)l[y].to<=i&&l.splice(y--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)l.push(o[s++]);let p=i+f.nodeSize;if(f.isText){let y=p;s<o.length&&o[s].from<y&&(y=o[s].from);for(let g=0;g<l.length;g++)l[g].to<y&&(y=l[g].to);y<p&&(a=f.cut(y-i),f=f.cut(0,y-i),p=y,h=-1)}else for(;s<o.length&&o[s].to<p;)s++;let m=f.isInline&&!f.isLeaf?l.filter(y=>!y.inline):l.slice();r(f,m,e.forChild(i,f),h),i=p}}function VX(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 FX(t,e,n,r){for(let o=0,i=0;o<t.childCount&&i<=r;){let s=t.child(o++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;o<t.childCount;){let c=t.child(o++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=n){if(i>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function YE(t,e,n,r,o){let i=[];for(let s=0,l=0;s<t.length;s++){let a=t[s],c=l,u=l+=a.size;c>=n||u<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(a.slice(n-c,a.size,r)))}return i}function rT(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(N0(n)){for(a=s;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&j.isSelectable(o.node)&&o.parent&&!(o.node.isInline&&bX(n.focusNode,n.focusOffset,o.dom))){let d=o.posBefore;c=new j(s==d?l:r.resolve(d))}else if(Ir&&e=="key"&&s>t.state.selection.to&&F(n.focusNode)&&n.focusOffset==n.focusNode.childNodes.length&&o&&o.posAtStart>t.state.selection.to)for(let d=n.focusNode;;d=d.parentNode){if(getComputedStyle(d).overflow!="visible"){c=H.findFrom(r.resolve(o.posAtStart),1);break}if(d==o.dom||d.nextSibling||!d.parentNode||!F(d.parentNode))break}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,f=s;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,s]=f==t.state.selection.anchor?[f,d]:[d,f],l=r.resolve(s)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;c=oT(t,u,l,d)}return c}function vP(t){return t.editable?t.hasFocus():wP(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Wi(t,e=!1){let n=t.state.selection;if(bP(t,n),!vP(t))return;let r=t.input.mouseDown;if(!e&&bn&&r){let o=t.domSelectionRange(),i=t.domObserver.currentSelection;if(o.anchorNode&&i.anchorNode&&Ua(o.anchorNode,o.anchorOffset,i.anchorNode,i.anchorOffset)&&r.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)YX(t);else{let{anchor:o,head:i}=n,s,l;BU&&!(n instanceof L)&&(n.$from.parent.inlineContent||(s=HU(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=HU(t,n.to))),t.docView.setSelection(o,i,t,e),BU&&(s&&jU(s),l&&jU(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&$X(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}var BU=Nn||bn&&lP<63;function HU(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Nn&&o&&o.contentEditable=="false")return _E(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return _E(o);if(i)return _E(i)}}function _E(t){return t.contentEditable="true",Nn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function jU(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function $X(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!vP(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function YX(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,vn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&fr&&yl<=11&&(n.disabled=!0,n.disabled=!1)}function bP(t,e){if(e instanceof j){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(VU(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else VU(t)}function VU(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function oT(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||L.between(e,n,r)}function FU(t){return t.editable&&!t.hasFocus()?!1:wP(t)}function wP(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return Pa(t.dom,e.anchorNode)&&(t.editable||Pa(t.dom,e.focusNode))}catch{return!1}}function qX(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Ua(e.node,e.offset,n.anchorNode,n.anchorOffset)}function qE(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&H.findFrom(i,e)}function gl(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function $U(t,e,n){let r=t.state.selection;if(r instanceof L)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return gl(t,new L(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=qE(t.state,e);return o&&o instanceof j?gl(t,o):!1}else if(!ro||n.indexOf("m")<0){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?j.isSelectable(i)?gl(t,new j(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):gl(t,new L(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1}}else return!1;else{if(r instanceof j&&r.node.isInline)return gl(t,new L(e>0?r.$to:r.$from));{let o=qE(t.state,e);return o?gl(t,o):!1}}}function Bh(t,e){let n=t.pmViewDesc;return n?n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR"):F(t)&&t.contentEditable=="false"}function ed(t,e){return e<0?KX(t):GX(t)}function KX(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(Ir&&F(n)&&r<Dn(n)&&Bh(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(!F(n))break;let l=n.childNodes[r-1];if(Bh(l,-1))o=n,i=--r;else if(Vt(l))n=l,r=n.nodeValue.length;else break}else{if(SP(n))break;{let l=n.previousSibling;for(;l&&Bh(l,-1);)o=n.parentNode,i=vn(l),l=l.previousSibling;if(l)n=l,r=Dn(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?KE(t,n,r):o&&KE(t,o,i)}function GX(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=Dn(n),i,s;for(;;)if(r<o){if(!F(n))break;let l=n.childNodes[r];if(Bh(l,1))i=n,s=++r;else break}else{if(SP(n))break;{let l=n.nextSibling;for(;l&&Bh(l,1);)i=l.parentNode,s=vn(l)+1,l=l.nextSibling;if(l)n=l,r=0,o=Dn(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}i&&KE(t,i,s)}function SP(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function XX(t,e){for(;t&&e==t.childNodes.length&&!Yh(t);)e=vn(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(Vt(n))return n;if(F(n)&&n.contentEditable=="false")break;t=n,e=0}}function WX(t,e){for(;t&&!e&&!Yh(t);)e=vn(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(Vt(n))return n;if(F(n)&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function KE(t,e,n){if(!Vt(e)){let s,l;(l=XX(e,n))?(e=l,n=0):(s=WX(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection(),o=t.domSelectionRange();if(!r)return;N0(o)?r.collapse(e,n):r.extend&&(r.collapse(o.anchorNode,o.anchorOffset),r.extend(e,n)),t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Wi(t)},50)}function YU(t,e){let n=t.state.doc.resolve(e);if(!(bn||aP)&&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"}}let r=t.dom;for(let i=n.depth;i>0;i--)if(n.node(i).isBlock){r=t.nodeDOM(n.before(i))||r;break}return getComputedStyle(r).direction=="rtl"?"rtl":"ltr"}function qU(t,e,n){let r=t.state.selection;if(r instanceof L&&!r.empty||n.indexOf("s")>-1||ro&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=qE(t.state,e);if(s&&s instanceof j)return gl(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,l=r instanceof yn?H.near(s,e):H.findFrom(s,e);return l?gl(t,l):!1}return!1}function KU(t,e){if(!(t.state.selection instanceof L))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function GU(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function JX(t){if(!Nn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&F(e)&&n==0&&e.firstChild&&F(e.firstChild)&&e.firstChild.contentEditable=="false"){let r=e.firstChild;GU(t,r,"true"),setTimeout(()=>GU(t,r,"false"),20)}return!1}function QX(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function ZX(t,e){let n=e.keyCode,r=QX(e);if(n==8||ro&&n==72&&r=="c")return KU(t,-1)||ed(t,-1);if(n==46&&!e.shiftKey||ro&&n==68&&r=="c")return KU(t,1)||ed(t,1);if(n==13||n==27)return!0;if(n==37||ro&&n==66&&r=="c"){let o=n==37?YU(t,t.state.selection.from)=="ltr"?-1:1:-1;return $U(t,o,r)||ed(t,o)}else if(n==39||ro&&n==70&&r=="c"){let o=n==39?YU(t,t.state.selection.from)=="ltr"?1:-1:1;return $U(t,o,r)||ed(t,o)}else{if(n==38||ro&&n==80&&r=="c")return qU(t,-1,r)||ed(t,-1);if(n==40||ro&&n==78&&r=="c")return JX(t)||qU(t,1,r)||ed(t,1);if(r==(ro?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function iT(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=t.someProp("clipboardSerializer")||Fi.fromSchema(t.state.schema),l=AP(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&F(c)&&(u=kP[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&F(c)&&c.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
|
|
60
|
+
|
|
61
|
+
`);return{dom:a,text:f,slice:e}}function xP(t,e,n,r,o){let i=o.parent.type.spec.code,s,l;if(!n&&!e)return null;let a=!!e&&(r||i||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return l=new N(M.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
62
|
+
`))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)l=d;else{let f=o.marks(),{schema:h}=t.state,p=Fi.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let y=s.appendChild(document.createElement("p"));m&&y.appendChild(p.serializeNode(h.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=rW(n),_0&&oW(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&!F(f);)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Vi.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!eW.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=iW(XU(l,+u[1],+u[2]),u[4]);else if(l=N.maxOpen(tW(l.content,o),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=XU(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}var eW=/^(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 tW(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(l=>{if(!s)return;let a=o.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&i.length&&EP(a,i,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=TP(s[s.length-1],i.length));let u=CP(l,a);s.push(u),o=o.matchType(u.type),i=a}}),s)return M.from(s)}return t}function CP(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,M.from(t));return t}function EP(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=EP(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(M.from(CP(n,t,o+1))))}}function TP(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,TP(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(M.empty,!0);return t.copy(n.append(r))}function GE(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(i=0),o<r-1&&(l=GE(l,e,n,r,o+1,i)),o>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(M.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function XU(t,e,n){return e<t.openStart&&(t=new N(GE(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new N(GE(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}var kP={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function AP(){return document.implementation.createHTMLDocument("title")}var Uh=null;function nW(t){let e=window.trustedTypes;if(!e)return t;if(!Uh){if(Uh=e.defaultPolicy)try{return Uh.createHTML(t)}catch{}Uh=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})}return Uh.createHTML(t)}function rW(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=AP(),r=n.body,o=/<([a-z][^>\s]+)/i.exec(t),i;if((i=o&&kP[o[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),r.innerHTML=nW(t),i)for(let s=0;s<i.length;s++)r=r.querySelector(i[s])||r;for(let s=0;s<n.styleSheets.length;s++){let l=n.styleSheets[s];for(let a=0;a<l.rules.length;a++){let c=l.rules[a];if(c instanceof CSSStyleRule){let u=r.querySelectorAll(c.selectorText);for(let d=0;d<u.length;d++)u[d].style.cssText+=c.style.cssText}}}return r}function oW(t){let e=t.querySelectorAll(bn?"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=="\xA0"&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function iW(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:o,openStart:i,openEnd:s}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;try{o=M.from(a.create(r[l+1],o))}catch{break}i++,s++}return new N(o,i,s)}var $n={},Yn={},sW={touchstart:!0,touchmove:!0},XE=class{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 lW(t){for(let e in $n){let n=$n[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{cW(t,r)&&!sT(t,r)&&(t.editable||!(r.type in Yn))&&n(t,r)},sW[e]?{passive:!0}:void 0)}Nn&&t.dom.addEventListener("input",()=>null),WE(t)}function Xi(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function aW(t){t.input.mouseDown&&t.input.mouseDown.done(),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 WE(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>sT(t,r))})}function sT(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function cW(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 uW(t,e){!sT(t,e)&&$n[e.type]&&(t.editable||!(e.type in Yn))&&$n[e.type](t,e)}Yn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!OP(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Gi&&bn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),rd&&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",o=>o(t,Oa(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||ZX(t,n)?n.preventDefault():Xi(t,"key")};Yn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Yn.keypress=(t,e)=>{let n=e;if(OP(t)||!n.charCode||n.ctrlKey&&!n.altKey||ro&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof L)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,o,i))&&t.dispatch(i()),n.preventDefault()}};function qh(t){return{left:t.clientX,top:t.clientY}}function dW(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function lT(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,l=>s>i.depth?l(t,n,i.nodeAfter,i.before(s),o,!0):l(t,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function Kh(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 fW(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&j.isSelectable(r)?(Kh(t,new j(n)),!0):!1}function hW(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof j&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(j.isSelectable(l)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(Kh(t,j.create(t.state.doc,o)),!0):!1}function pW(t,e,n,r,o){return lT(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?hW(t,n):fW(t,n))}function mW(t,e,n,r){return lT(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function gW(t,e,n,r){return lT(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||yW(t,n,r)}function yW(t,e,n){if(n.button!=0)return!1;let r=MP(t,e,!0),o=t.state.doc;return r?(Kh(t,r),r instanceof L&&o.eq(t.state.doc)&&(t.input.mouseDown=new QE(t,r)),!0):!1}function MP(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?L.create(r,0,r.content.size):null;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),l=o.before(i);if(s.inlineContent)return L.create(r,l+1,l+1+s.content.size);if(n&&j.isSelectable(s))return j.create(r,l)}return null}function aT(t){return A0(t)}var RP=ro?"metaKey":"ctrlKey";$n.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=aT(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&dW(n,t.input.lastClick)&&!n[RP]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let s=t.posAtCoords(qh(n));s&&(i=="singleClick"?t.input.mouseDown=new JE(t,s,n,!!r):(i=="doubleClick"?mW:gW)(t,s.pos,s.inside,n)?n.preventDefault():Xi(t,"pointer"))};var k0=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},JE=class extends k0{constructor(e,n,r,o){super(e),this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[RP],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}let l=o?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&F(a.nodeDOM)?a.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof j&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ir&&!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()),Xi(e,"pointer")}done(){super.done(),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(()=>{this.view.isDestroyed||Wi(this.view)})}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(qh(e))),this.updateAllowDefault(e),this.allowDefault||!n?Xi(this.view,"pointer"):pW(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Nn&&this.mightDrag&&!this.mightDrag.node.isAtom||bn&&!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)?(Kh(this.view,H.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Xi(this.view,"pointer")}move(e){this.updateAllowDefault(e),Xi(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},QE=class extends k0{constructor(e,n){super(e),this.startSelection=n,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),Xi(this.view,"pointer");let n=this.view.posAtCoords(qh(e)),r=n&&MP(this.view,n.inside,!1);if(!r)return;let{doc:o}=this.view.state,i=this.startSelection,[s,l]=r.from<i.from?[i.to,r.from]:[i.from,r.to];Kh(this.view,L.create(o,s,l))}};$n.touchstart=t=>{t.input.lastTouch=Date.now(),aT(t),Xi(t,"pointer")};$n.touchmove=t=>{t.input.lastTouch=Date.now(),Xi(t,"pointer")};$n.contextmenu=t=>aT(t);function OP(t,e){return t.composing?!0:Nn&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}var vW=Gi?5e3:-1;Yn.compositionstart=Yn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof L&&e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||bn&&aP&&bW(t)))t.markCursor=t.state.storedMarks||n.marks(),A0(t,!0),t.markCursor=null;else if(A0(t,!e.selection.empty),Ir&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&F(o)&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(Vt(s)){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}t.input.composing=!0}DP(t,vW)};function bW(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||!F(e)||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return F(r)&&r.contentEditable=="false"}Yn.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),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++,DP(t,20))};function DP(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>A0(t),e))}function NP(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function wW(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=yX(e.focusNode,e.focusOffset),r=vX(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function A0(t,e=!1){if(!(Gi&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),NP(t),e||t.docView&&t.docView.dirty){let n=rT(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 SW(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(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}var Hh=fr&&yl<15||rd&&xX<604;$n.copy=Yn.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=Hh?null:n.clipboardData,s=r.content(),{dom:l,text:a}=iT(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):SW(t,l),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function xW(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function CW(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 o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?jh(t,r.value,null,o,e):jh(t,r.textContent,r.innerHTML,o,e)},50)}function jh(t,e,n,r,o){let i=xP(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,o,i||N.empty)))return!0;if(!i)return!1;let s=xW(i),l=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function _P(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," "):""}Yn.paste=(t,e)=>{let n=e;if(t.composing&&!Gi)return;let r=Hh?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&jh(t,_P(r),r.getData("text/html"),o,n)?n.preventDefault():CW(t,n)};var M0=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}},EW=ro?"altKey":"ctrlKey";function IP(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[EW]}$n.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(qh(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof j?o.to-1:o.to))){if(r&&r.mightDrag)s=j.create(t.state.doc,r.mightDrag.pos);else if(n.target&&F(n.target)){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=j.create(t.state.doc,d.posBefore))}}let l=(s||t.state.selection).content(),{dom:a,text:c,slice:u}=iT(t,l);(!n.dataTransfer.files.length||!bn||lP>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Hh?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Hh||n.dataTransfer.setData("text/plain",c),t.dragging=new M0(u,IP(t,n),s)};$n.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Yn.dragover=Yn.dragenter=(t,e)=>e.preventDefault();Yn.drop=(t,e)=>{try{TW(t,e,t.dragging)}finally{t.dragging=null}};function TW(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(qh(e));if(!r)return;let o=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",h=>{i=h(i,t,!1)}):i=xP(t,_P(e.dataTransfer),Hh?null:e.dataTransfer.getData("text/html"),!1,o);let s=!!(n&&IP(t,e));if(t.someProp("handleDrop",h=>h(t,e,i||N.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?y0(t.state.doc,o.pos,i):o.pos;l==null&&(l=o.pos);let a=t.state.tr;if(s){let{node:h}=n;h?h.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(d))return;let f=a.doc.resolve(c);if(u&&j.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new j(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,m,y,g)=>h=g),a.setSelection(oT(t,f,a.doc.resolve(h)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}$n.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())&&Wi(t)},20))};$n.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)};$n.beforeinput=(t,e)=>{if(Gi&&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",i=>i(t,Oa(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in Yn)$n[t]=Yn[t];function Vh(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}var Fh=class{constructor(e){this.frag=e,this.index=0,this.off=0}nodeAt(e){for(;this.off<=e&&this.index<this.frag.childCount;){let n=this.frag.child(this.index);if(this.off==e)return n;this.off+=n.nodeSize,this.index++}return null}},R0=class t{constructor(e,n){this.toDOM=e,this.spec=n||La,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new ot(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof t&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Vh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},Ia=class t{constructor(e,n){this.attrs=e,this.spec=n||La}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new ot(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof t&&Vh(this.attrs,e.attrs)&&Vh(this.spec,e.spec)}static is(e){return e.type instanceof t}destroy(){}},ZE=class t{constructor(e,n){this.attrs=e,this.spec=n||La}map(e,n,r,o){let i=e.mapResult(n.from+o,1);if(i.deleted)return null;let s=e.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new ot(i.pos-r,s.pos-r,this)}valid(e,n,r){let o=r.nodeAt(n.from);return!!o&&!o.isText&&n.from+o.nodeSize==n.to}eq(e){return this==e||e instanceof t&&Vh(this.attrs,e.attrs)&&Vh(this.spec,e.spec)}destroy(){}},ot=class t{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new t(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new t(e,e,new R0(n,r))}static inline(e,n,r,o){return new t(e,n,new Ia(r,o))}static node(e,n,r,o){return new t(e,n,new ZE(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ia}get widget(){return this.type instanceof R0}},td=[],La={},ae=class t{constructor(e,n){this.local=e.length?e:td,this.children=n.length?n:td}static create(e,n){return n.length?D0(n,e,0,La):On}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,r,o+l,i)}}map(e,n,r){return this==On||e.maps.length==0?this:this.mapInner(e,n,0,0,r||La)}mapInner(e,n,r,o,i){let s;if(this.local.length){let l=new Fh(n.content);for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,r,o);c&&c.type.valid(n,c,l)?(s||(s=[])).push(c):i.onRemove&&i.onRemove(this.local[a].spec)}}return this.children.length?kW(this.children,s||[],e,n,r,o,i):s?new t(s.sort(za),td):On}add(e,n){return n.length?this==On?t.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=zP(n,l,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<a;)i+=3;o[i]==a?o[i+2]=o[i+2].addInner(l,u,c+1):o.splice(i,0,a,a+l.nodeSize,D0(u,l,c+1,La)),i+=3}});let s=LP(i?UP(n):n,-r);if(s.length){let l=new Fh(e.content);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a],l)||s.splice(a--,1)}return new t(s.length?this.local.concat(s).sort(za):this.local,o||this.children)}remove(e){return e.length==0||this==On?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,l=r[i]+n,a=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,l+1);c!=On?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<o.length;l++)o[l].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new t(o,r):On}forChild(e,n){if(this==On)return this;if(n.isLeaf)return t.empty;let r,o;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,s=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof Ia){let c=Math.max(i,a.from)-i,u=Math.min(s,a.to)-i;c<u&&(o||(o=[])).push(a.copy(c,u))}}if(o){let l=new t(o.sort(za),td);return r?new O0([l,r]):l}return r||On}eq(e){if(this==e)return!0;if(!(e instanceof t)||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 cT(this.localsInner(e))}localsInner(e){if(this==On)return td;if(e.inlineContent||!this.local.some(Ia.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Ia||n.push(this.local[r]);return n}forEachSet(e){e(this)}};ae.empty=new ae([],[]);ae.removeOverlap=cT;var On=ae.empty,O0=class t{constructor(e){this.members=e}map(e,n){let r=this.members.map(o=>o.map(e,n,La));return t.from(r)}forChild(e,n){if(n.isLeaf)return ae.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=On&&(i instanceof t?r=r.concat(i.members):r.push(i))}return t.from(r)}eq(e){if(!(e instanceof t)||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 o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?cT(r?n:n.sort(za)):td}static from(e){switch(e.length){case 0:return On;case 1:return e[0];default:return new t(e.every(n=>n instanceof ae)?e:e.reduce((n,r)=>n.concat(r instanceof ae?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function kW(t,e,n,r,o,i,s){let l=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,m)=>{let y=m-p-(h-f);for(let g=0;g<l.length;g+=3){let v=l[g+1];if(v<0||f>v+u-d)continue;let b=l[g]+u-d;h>=b?l[g+1]=f<=b?-2:-1:f>=u&&y&&(l[g]+=y,l[g+1]+=y)}d+=y}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(t[c]+i),d=u-o;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+i,-1),h=f-o,{index:p,offset:m}=r.content.findIndex(d),y=r.maybeChild(p);if(y&&m==d&&m+y.nodeSize==h){let g=l[c+2].mapInner(n,y,u+1,t[c]+i+1,s);g!=On?(l[c]=d,l[c+1]=h,l[c+2]=g):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=AW(l,t,e,n,o,i,s),u=D0(c,r,0,s);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new ae(e.sort(za),l)}function LP(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new ot(o.from+e,o.to+e,o.type))}return n}function AW(t,e,n,r,o,i,s){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,o,c);d?n.push(d):s.onRemove&&s.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+i+1);return n}function zP(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function UP(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function D0(t,e,n,r){let o=[],i=!1;e.forEach((l,a)=>{let c=zP(t,l,a+n);if(c){i=!0;let u=D0(c,l,n+a+1,r);u!=On&&o.push(a,a+l.nodeSize,u)}});let s=LP(i?UP(t):t,-n).sort(za);if(s.length){let l=new Fh(e.content);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a],l)||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1))}return s.length||o.length?new ae(s,o):On}function za(t,e){return t.from-e.from||t.to-e.to}function cT(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),WU(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),WU(e,o,r.copy(i.from,r.to)));break}}}return e}function WU(t,e,n){for(;e<t.length&&za(n,t[e])>0;)e++;t.splice(e,0,n)}function IE(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=On&&e.push(r)}),t.cursorWrapper&&e.push(ae.create(t.state.doc,[t.cursorWrapper.deco])),O0.from(e)}var MW={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},RW=fr&&yl<=11,eT=class{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}},tT=class{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new eT,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);fr&&yl<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():Nn&&e.composing&&r.some(o=>o.type=="childList"&&o.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),RW&&(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,MW)),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(FU(this.view)){if(this.suppressingSelectionUpdates)return Wi(this.view);if(fr&&yl<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ua(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 i=e.focusNode;i;i=nd(i))n.add(i);for(let i=e.anchorNode;i;i=nd(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:Vt(r)?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,o=!1;!this.suppressingSelectionUpdates&&FU(e)&&(r=e.domSelectionRange(),o=!this.currentSelection.eq(r)&&!this.ignoreSelectionChange(r));let i=-1,s=-1,l=!1,a=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],a);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||bn&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&n.some(u=>u.type=="childList"&&u.removedNodes.length))){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&F(d);){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Ir&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||NW(e,d)!=h)&&f.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&N0(r)&&(c=rT(e))&&c.eq(H.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Wi(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),OW(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,_W(e,a)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):r&&!this.currentSelection.eq(r)&&Wi(e),r&&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 u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),Vt(d)&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,i=e.nextSibling;if(fr&&yl<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==e.target?vn(o)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?vn(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}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})}},JU=new WeakMap,QU=!1;function OW(t){if(!JU.has(t)&&(JU.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Ir,QU)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."),QU=!0}}function ZU(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return Ua(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function DW(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return ZU(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?ZU(t,n):null}function NW(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 _W(t,e){var n;let{focusNode:r,focusOffset:o}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let a=l.firstChild;if(!a||!F(a)||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(i,l.firstChild),r==i&&t.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}function IW(t,e,n,r){let{node:o,fromOffset:i,toOffset:s,from:l,to:a}=t.docView.parseRange(e,n),c=t.domSelectionRange(),u,d=c.anchorNode;if(d&&Pa(t.dom,d)&&(u=[{node:d,offset:c.anchorOffset}],N0(c)||u.push({node:c.focusNode,offset:c.focusOffset})),bn&&t.input.lastKeyCode===8)for(let g=s;g>i;g--){let v=o.childNodes[g-1],b=v.pmViewDesc;if(v.nodeName=="BR"&&!b){s=g;break}if(!b||b.size)break}let f=t.state.doc,h=t.someProp("domParser")||Vi.fromSchema(t.state.schema),p=f.resolve(l),m=null,y=h.parse(o,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:LW(r),context:p});if(u&&u[0].pos!=null){let g=u[0].pos,v=u[1]&&u[1].pos;v==null&&(v=g),m={anchor:g+l,head:v+l}}return{doc:y,sel:m,from:l,to:a}}var LW=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if(Nn&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||Nn&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},zW=/^(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 UW(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let x=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,E=rT(t,x);if(E&&!t.state.selection.eq(E)){if(bn&&Gi&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",T=>T(t,Oa(13,"Enter"))))return;let k=t.state.tr.setSelection(E);x=="pointer"?k.setMeta("pointer",!0):x=="key"&&k.scrollIntoView(),i&&k.setMeta("composition",i),t.dispatch(k)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=IW(t,e,n,o),u=t.state.doc,d=u.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=jW(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(rd&&t.input.lastIOSEnter>Date.now()-225||Gi)&&o.some(x=>F(x)&&!zW.test(x.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",x=>x(t,Oa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof L&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let x=eP(t,t.state.doc,c.sel);if(x&&!x.eq(t.state.selection)){let E=t.state.tr.setSelection(x);i&&E.setMeta("composition",i),t.dispatch(E)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof L&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),fr&&yl<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" \xA0"&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),y=c.doc.resolveNoCache(p.endB-c.from),g=u.resolve(p.start),v=m.sameParent(y)&&m.parent.inlineContent&&g.end()>=p.endA;if((rd&&t.input.lastIOSEnter>Date.now()-225&&(!v||o.some(x=>x.nodeName=="DIV"||x.nodeName=="P"))||!v&&HW(c.doc,m.pos,y.pos))&&t.someProp("handleKeyDown",x=>x(t,Oa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&(v?p.endA>p.start&&p.endB==p.start:BW(u,p.start,p.endA,m,y))&&t.someProp("handleKeyDown",x=>x(t,Oa(8,"Backspace")))){Gi&&bn&&t.domObserver.suppressSelectionUpdates();return}bn&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),Gi&&!v&&m.start()!=y.start()&&y.parentOffset==0&&m.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,y=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(x){return x(t,Oa(13,"Enter"))})},20));let b=p.start,w=p.endA,S=x=>{let E=x||t.state.tr.replace(b,w,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let k=eP(t,E.doc,c.sel);k&&!(bn&&t.composing&&k.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(k.head==b||k.head==E.mapping.map(w)-1)||fr&&k.empty&&k.head==b)&&E.setSelection(k)}return i&&E.setMeta("composition",i),E.scrollIntoView()},C;if(v)if(m.pos==y.pos){fr&&yl<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Wi(t),20));let x=S(t.state.tr.delete(b,w)),E=u.resolve(p.start).marksAcross(u.resolve(p.endA));E&&x.ensureMarks(E),t.dispatch(x)}else if(p.endA==p.endB&&(C=PW(m.parent.content.cut(m.parentOffset,y.parentOffset),g.parent.content.cut(g.parentOffset,p.endA-g.start())))){let x=S(t.state.tr);C.type=="add"?x.addMark(b,w,C.mark):x.removeMark(b,w,C.mark),t.dispatch(x)}else if(m.parent.child(m.index()).isText&&m.index()==y.index()-(y.textOffset?0:1)){let x=m.parent.textBetween(m.parentOffset,y.parentOffset),E=()=>S(t.state.tr.insertText(x,b,w));t.someProp("handleTextInput",k=>k(t,b,w,x,E))||t.dispatch(E())}else t.dispatch(S());else t.dispatch(S())}function eP(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:oT(t,e.resolve(n.anchor),e.resolve(n.head))}function PW(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,l,a;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)l=o[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(o.length==0&&i.length==1)l=i[0],s="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(M.from(c).eq(t))return{mark:l,type:s}}function BW(t,e,n,r,o){if(n-e<=o.pos-r.pos||LE(r,!0,!1)<o.pos)return!1;let i=t.resolve(e);if(!r.parent.inlineContent){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(LE(i,!0,!0));return!s.parent.isTextblock||s.pos>n||LE(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function HW(t,e,n){let r=0,o=0;return t.nodesBetween(e,n,(i,s)=>{i.isTextblock&&s>=e&&s<n?r++:(i.isText?/\S/.test(i.text.slice(Math.max(0,e-s),Math.min(i.nodeSize,n-s))):i.isLeaf)&&o++}),o==0&&r==1}function LE(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function jW(t,e,n,r,o){let i=t.findDiffStart(e,n),s=n+t.size,l=n+e.size;if(i==null)return null;let{a,b:c}=t.findDiffEnd(e,s,l);if(o=="end"){let u=Math.max(0,i-Math.min(a,c));r-=a+u-i}if(a<i&&s<l){let u=r<=i&&r>=a?i-r:0;i-=u,c=i+(c-a),a=i}else if(c<i){let u=r<=i&&r>=c?i-r:0;i-=u,a=i+(a-c),c=i}return{start:i,endA:a,endB:c}}var $h=class{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 XE,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(iP),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=rP(this),nP(this),this.nodeViews=oP(this),this.docView=UU(this.state.doc,tP(this),IE(this),this.dom,this),this.domObserver=new tT(this,(r,o,i,s)=>UW(this,r,o,i,s)),this.domObserver.start(),lW(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&&WE(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(iP),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 o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(NP(this),s=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=oP(this);FW(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&WE(this),this.editable=rP(this),nP(this);let a=IE(this),c=tP(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(o.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&TX(this);if(s){this.domObserver.stop();let h=d&&(fr||bn)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&VW(o.selection,e.selection);if(d){let m=bn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=wW(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=UU(e.doc,c,a,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}let p=this.input.mouseDown;h||!(p&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&qX(this)&&p.delaySelUpdate())?Wi(this,h):(bP(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&kX(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!Pa(this.dom,e))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof j){let n=this.docView.domAfterPos(this.state.selection.from);F(n)&&NU(this,n.getBoundingClientRect(),e)}else NU(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,o=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new M0(e.slice,e.move,o<0?void 0:j.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(o=n?n(l):l))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(o=n?n(l):l))return o}}hasFocus(){if(fr){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&&AX(this.dom),Wi(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 NX(this,e)}coordsAtPos(e,n=1){return hP(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 o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return UX(this,n||this.state,e)}pasteHTML(e,n){return jh(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return jh(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return iT(this,e)}destroy(){this.docView&&(aW(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],IE(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,mX())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return uW(this,e)}domSelectionRange(){let e=this.dom.isConnected!==!1&&this.domSelection();return e?Nn&&this.root.nodeType===11&&wX(this.dom.ownerDocument)==this.dom&&DW(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};$h.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function tP(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"),[ot.node(0,t.state.doc.content.size,e)]}function nP(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:ot.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function rP(t){return!t.someProp("editable",e=>e(t.state)===!1)}function VW(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 oP(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function FW(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function iP(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 Ji={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:"'"},L0={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},$W=typeof navigator<"u"&&/Mac/.test(navigator.platform),YW=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Ot=0;Ot<10;Ot++)Ji[48+Ot]=Ji[96+Ot]=String(Ot);var Ot;for(Ot=1;Ot<=24;Ot++)Ji[Ot+111]="F"+Ot;var Ot;for(Ot=65;Ot<=90;Ot++)Ji[Ot]=String.fromCharCode(Ot+32),L0[Ot]=String.fromCharCode(Ot);var Ot;for(I0 in Ji)L0.hasOwnProperty(I0)||(L0[I0]=Ji[I0]);var I0;function PP(t){var e=$W&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||YW&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?L0:Ji)[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}var qW=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),KW=typeof navigator<"u"&&/Win/.test(navigator.platform);function GW(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))qW?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function XW(t){let e=Object.create(null);for(let n in t)e[GW(n)]=t[n];return e}function uT(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 BP(t){return new G({props:{handleKeyDown:Gh(t)}})}function Gh(t){let e=XW(t);return function(n,r){let o=PP(r),i,s=e[uT(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[uT(o,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(KW&&r.ctrlKey&&r.altKey)&&(i=Ji[r.keyCode])&&i!=o){let l=e[uT(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var z0=200,wn=function(){};wn.prototype.append=function(e){return e.length?(e=wn.from(e),!this.length&&e||e.length<z0&&this.leafAppend(e)||this.length<z0&&e.leafPrepend(this)||this.appendInner(e)):this};wn.prototype.prepend=function(e){return e.length?wn.from(e).append(this):this};wn.prototype.appendInner=function(e){return new WW(this,e)};wn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?wn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};wn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};wn.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)};wn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},n,r),o};wn.from=function(e){return e instanceof wn?e:e&&e.length?new HP(e):wn.empty};var HP=(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(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,l){for(var a=i;a<s;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,l){for(var a=i-1;a>=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=z0)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=z0)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(wn);wn.empty=new HP([]);var WW=(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,o,i,s){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(o,l),i,s)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,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})(wn),dT=wn;var JW=500,Ha=class t{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 o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new Qo(d.map));let h=d.step.map(o.slice(i)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new Qo(p,void 0,void 0,c.length+u.length))),i--,p&&o.appendMap(p,i)}else s.maybeStep(d.step);if(d.selection)return l=o?d.selection.map(o.slice(i)):d.selection,a=new t(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,n,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new Qo(e.mapping.maps[u],d,n),h;(h=a&&a.merge(f))&&(f=h,u?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(s++,n=void 0),o||(a=f)}let c=s-r.depth;return c>ZW&&(l=QW(l,c),s-=c),new t(l.append(i),s)}remapping(e,n){let r=new Dh;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new t(this.items.append(e.map(n=>new Qo(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;n=Math.min(this.items.length,n);let r=[],o=this.items.length-n,i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=n;this.items.forEach(f=>{let h=i.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=i.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(i.slice(a+1,h));y&&l++,r.push(new Qo(p,m,y))}else r.push(new Qo(p))},o);let c=[];for(let f=n;f<s;f++)c.push(new Qo(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new t(u,l);return d.emptyItemCount()>JW&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new Qo(c.invert(),a,u),f,h=o.length-1;(f=o.length&&o[h].merge(d))?o[h]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new t(dT.from(o.reverse()),i)}};Ha.empty=new Ha(dT.empty,0);function QW(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}var Qo=class t{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new t(n.getMap().invert(),n,this.selection)}}},Zo=class{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}},ZW=20;function eJ(t,e,n,r){let o=n.getMeta(wl),i;if(o)return o.historyState;n.getMeta($P)&&(t=new Zo(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(wl))return s.getMeta(wl).redo?new Zo(t.done.addTransform(n,void 0,r,U0(e)),t.undone,jP(n.mapping.maps),t.prevTime,t.prevComposition):new Zo(t.done,t.undone.addTransform(n,void 0,r,U0(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!tJ(n,t.prevRanges)),c=s?fT(t.prevRanges,n.mapping):jP(n.mapping.maps);return new Zo(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,U0(e)),Ha.empty,c,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Zo(t.done.rebased(n,i),t.undone.rebased(n,i),fT(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Zo(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),fT(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function tJ(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function jP(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,i,s)=>e.push(i,s));return e}function fT(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function nJ(t,e,n){let r=U0(e),o=wl.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),a=new Zo(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(wl,{redo:n,historyState:a})}var hT=!1,VP=null;function U0(t){let e=t.plugins;if(VP!=e){hT=!1,VP=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){hT=!0;break}}return hT}function FP(t){return t.setMeta($P,!0)}var wl=new le("history"),$P=new le("closeHistory");function YP(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new G({key:wl,state:{init(){return new Zo(Ha.empty,Ha.empty,null,0,-1)},apply(e,n,r){return eJ(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?pT:r=="historyRedo"?mT:null;return!o||!e.editable?!1:(n.preventDefault(),o(e.state,e.dispatch))}}}})}function P0(t,e){return(n,r)=>{let o=wl.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let i=nJ(o,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}var pT=P0(!1,!0),mT=P0(!0,!0),Jse=P0(!1,!1),Qse=P0(!0,!1);function qP(t){return t.getMeta(wl)!=null}function K0(t){let{state:e,transaction:n}=t,{selection:r}=n,{doc:o}=n,{storedMarks:i}=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 i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var ad=class hB{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(){let{rawCommands:e,editor:n,state:r}=this,{view:o}=n,{tr:i}=r,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{let d=a(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){let{rawCommands:r,editor:o,state:i}=this,{view:s}=o,l=[],a=!!e,c=e||i.tr,u=()=>(!a&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),l.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...m)=>{let y=this.buildProps(c,n),g=h(...m)(y);return l.push(g),d}])),run:u};return d}static createFakeChain(){let e=new Proxy({},{get:(n,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>e}});return e}createCan(e){let{rawCommands:n,state:r}=this,o=!1,i=e||r.tr,s=this.buildProps(i,o);return{...Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...c)=>a(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,o)}}static createFallbackCan(){let e=hB.createFakeChain();return new Proxy({chain:()=>e},{get:(n,r)=>{if(r!=="then")return r==="chain"?n.chain:()=>!1}})}buildProps(e,n=!0){let{rawCommands:r,editor:o,state:i}=this,{view:s}=o,l={tr:e,editor:o,view:s,state:K0({state:i,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...u)=>c(...u)(l)]))}};return l}},rJ=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{if(!t.isDestroyed){var n;e.dom.blur(),(n=window)===null||n===void 0||(n=n.getSelection())===null||n===void 0||n.removeAllRanges()}}),!0),oJ=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),iJ=()=>({state:t,tr:e,dispatch:n})=>{let{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;let{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;let p=Yi(h);if(l.type.isTextblock){let{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},sJ=t=>e=>t(e),lJ=()=>({state:t,dispatch:e})=>kE(t,e),aJ=(t,e)=>({editor:n,tr:r})=>{let{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);let s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new L(r.doc.resolve(Math.max(s-1,0)))),!0},cJ=()=>({tr:t,dispatch:e})=>{let{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;let o=t.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){let s=o.before(i),l=o.after(i);t.delete(s,l).scrollIntoView()}return!0}return!1};function Dt(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}var uJ=t=>({tr:e,state:n,dispatch:r})=>{let o=Dt(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){let l=i.before(s),a=i.after(s);e.delete(l,a).scrollIntoView()}return!0}return!1},dJ=t=>({tr:e,dispatch:n})=>{let{from:r,to:o}=t;return n&&e.delete(r,o),!0},fJ=t=>t.content?/^text(\*|\+)/.test(t.content):!1,KP=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;let r=e.nodes[t.parent.type.name].spec;return fJ(r)?n==="left"?t.start()-1:t.end()+1:t.pos},hJ=(t,e,n)=>({from:KP(t,n,"left"),to:KP(e,n,"right")}),pJ=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){let n=t.tr,{ranges:r}=t.selection,o=t.selection instanceof L?t.selection.$from.marksAcross(t.selection.$to):null,i=n.steps.length;r.forEach(s=>{let l=n.mapping.slice(i),a=n.doc.resolve(l.map(s.$from.pos)),c=n.doc.resolve(l.map(s.$to.pos)),{from:u,to:d}=hJ(a,c,t.schema);n.deleteRange(u,d)}),n.selection.empty||n.setSelection(L.near(n.doc.resolve(n.selection.from))),o&&n.ensureMarks(o),n.scrollIntoView(),e(n)}return!0},mJ=()=>({commands:t})=>t.keyboardShortcut("Enter"),gJ=()=>({state:t,dispatch:e})=>TE(t,e);function wT(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Y0(t,e,n={strict:!0}){let r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:wT(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function pB(t,e,n={}){return t.find(r=>r.type===e&&Y0(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function GP(t,e,n={}){return!!pB(t,e,n)}function ST(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(a=>a.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(a=>a.type===e))return;if(!n){let a=r.node.marks.find(c=>c.type===e);a&&(n=a.attrs)}if(!pB([...r.node.marks],e,n))return;let o=r.index,i=t.start()+r.offset,s=o+1,l=i+r.node.nodeSize;for(;o>0&&GP([...t.parent.child(o-1).marks],e,n);)o-=1,i-=t.parent.child(o).nodeSize;for(;s<t.parent.childCount&&GP([...t.parent.child(s).marks],e,n);)l+=t.parent.child(s).nodeSize,s+=1;return{from:i,to:l}}function Qi(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}var yJ=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=Qi(t,r.schema),{doc:s,selection:l}=n,{$from:a,from:c,to:u}=l;if(o){let d=ST(a,i,e);if(d&&d.from<=c&&d.to>=u){let f=L.create(s,d.from,d.to);n.setSelection(f)}}return!0},vJ=t=>e=>{let 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 mB(t){return t instanceof L}function ja(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function gT(t,e=null){if(!e)return null;let n=H.atStart(t),r=H.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;let o=n.from,i=r.to;return e==="all"?L.create(t,ja(0,o,i),ja(t.content.size,o,i)):L.create(t,ja(e,o,i),ja(e,o,i))}function XP(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function q0(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function bJ(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var wJ=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};let s=()=>{(q0()||XP())&&r.dom.focus(),bJ()&&!q0()&&!XP()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!mB(n.state.selection))return s(),!0;let l=gT(o.doc,t)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},SJ=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),xJ=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),gB=t=>{let e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){let r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&gB(r)}return t};function B0(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");let e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return gB(n)}function yB(t){return typeof t?.nodesBetween=="function"}function cd(t,e,n){if(yB(t))return t;let r=typeof t=="object"&&t!==null;n={slice:!0,parseOptions:{},...n};let o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return M.fromArray(t.map(s=>e.nodeFromJSON(s)));let i=e.nodeFromJSON(t);return n.errorOnInvalidContent&&i.check(),i}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),cd("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,l="",a=new ka({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:c=>(s=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Vi.fromSchema(a).parseSlice(B0(t),n.parseOptions):Vi.fromSchema(a).parse(B0(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}let i=Vi.fromSchema(e);return n.slice?i.parseSlice(B0(t),n.parseOptions).content:i.parse(B0(t),n.parseOptions)}return cd("",e,n)}function vB(t){return!("type"in t)}function bB(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof ht||o instanceof Rt))return;let i=t.mapping.maps[r],s=0;i.forEach((l,a,c,u)=>{s===0&&(s=u)}),t.setSelection(H.near(t.doc.resolve(s),n))}var CJ=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{if(o){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l,a=y=>{i.emit("contentError",{editor:i,error:y,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{cd(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(y){a(y)}try{var s;l=cd(e,i.schema,{parseOptions:c,errorOnInvalidContent:(s=n.errorOnInvalidContent)!==null&&s!==void 0?s:i.options.enableContentCheck})}catch(y){return a(y),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0,p=vB(l)?l.content:[l];if(p.forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),u===d&&h){let{parent:y}=r.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,d+=1)}let m;if(f)Array.isArray(e)?m=e.map(y=>y.text||"").join(""):yB(e)?m=p.map(y=>{var g;return(g=y.text)!==null&&g!==void 0?g:""}).join(""):typeof e=="object"&&e&&e.text?m=e.text:m=e,r.insertText(m,u,d);else{m=M.from(p);let y=r.doc.resolve(u),g=y.node(),v=y.parentOffset===0,b=g.isText||g.isTextblock,w=g.content.size>0;v&&b&&w&&h&&(u=Math.max(0,u-1)),r.replaceWith(u,d,p)}n.updateSelection&&bB(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0};function wB(t){for(let e=0;e<t.edgeCount;e+=1){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var EJ=(t={})=>({tr:e,dispatch:n,editor:r})=>{let{pos:o,attrs:i,content:s,updateSelection:l=!0}=t,a;typeof o=="number"?a=e.doc.resolve(o):o?a=o:a=e.selection.$from;let c=wB(a.parent.contentMatchAt(a.index()));if(!c)return!1;let u=Object.keys(c.spec.attrs||{}),d=i?Object.fromEntries(Object.entries(i).filter(([h])=>u.includes(h))):{},f;if(s){let h=cd(s,r.schema);f=c.createAndFill(d,h)}else f=c.createAndFill(d);return f?(n&&(e.insert(a.pos,f),l&&bB(e,e.steps.length-1,-1)),!0):!1},TJ=()=>({state:t,dispatch:e})=>wU(t,e),kJ=()=>({state:t,dispatch:e})=>SU(t,e),AJ=()=>({state:t,dispatch:e})=>yE(t,e),MJ=()=>({state:t,dispatch:e})=>wE(t,e),SB=(t,e)=>{let n=t.resolve(e),r=n.nodeBefore,o=n.nodeAfter;return!r||!o?!1:!r.type.spec.isolating&&!o.type.spec.isolating},RJ=()=>({state:t,dispatch:e,tr:n})=>{try{let r=Xu(t.doc,t.selection.$from.pos,-1);return r==null||!SB(t.doc,r)?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},OJ=()=>({state:t,dispatch:e,tr:n})=>{try{let r=Xu(t.doc,t.selection.$from.pos,1);return r==null||!SB(t.doc,r)?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},DJ=()=>({state:t,dispatch:e})=>w0(t,e),NJ=()=>({state:t,dispatch:e})=>S0(t,e);function xB(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function _J(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n==="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<e.length-1;l+=1){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))q0()||xB()?s=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var IJ=t=>({editor:e,view:n,tr:r,dispatch:o})=>{let i=_J(t).split(/-(?!$)/),s=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a?.steps.forEach(c=>{let u=c.map(r.mapping);u&&o&&r.maybeStep(u)}),!0};function ei(t,e,n={}){let{from:r,to:o,empty:i}=t.selection,s=e?Dt(e,t.schema):null,l=[];t.doc.nodesBetween(r,o,(u,d)=>{if(u.isText)return;let f=Math.max(r,d),h=Math.min(o,d+u.nodeSize);l.push({node:u,from:f,to:h})});let a=o-r,c=l.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>Y0(u.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((u,d)=>u+d.to-d.from,0)>=a}var LJ=(t,e={})=>({state:n,dispatch:r})=>ei(n,Dt(t,n.schema),e)?xU(n,r):!1,zJ=()=>({state:t,dispatch:e})=>AE(t,e),UJ=t=>({state:e,dispatch:n})=>{let r=Dt(t,e.schema);return MU(r)(e,n)},PJ=()=>({state:t,dispatch:e})=>CE(t,e);function G0(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function WP(t,e){let n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var BJ=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null,l=G0(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(i=Dt(t,r.schema)),l==="mark"&&(s=Qi(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{i&&i===u.type&&(a=!0,o&&n.setNodeMarkup(d,void 0,WP(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(f=>{s===f.type&&(a=!0,o&&n.addMark(d,d+u.nodeSize,s.create(WP(f.attrs,e))))})})}),a},HJ=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),jJ=()=>({tr:t,dispatch:e})=>{if(e){let n=new yn(t.doc);t.setSelection(n)}return!0},VJ=()=>({state:t,dispatch:e})=>vE(t,e),FJ=()=>({state:t,dispatch:e})=>SE(t,e),$J=()=>({state:t,dispatch:e})=>CU(t,e),YJ=()=>({state:t,dispatch:e})=>RE(t,e),qJ=()=>({state:t,dispatch:e})=>ME(t,e);function yT(t,e,n={},r={}){return cd(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var KJ=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:l})=>{let{doc:a}=i;if(r.preserveWhitespace!=="full"){let c=yT(t,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});if(s){let u=vB(c)?c.content:[c];i.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!n)}return!0}return s&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function CB(t,e){let n=Qi(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,a=>{s.push(...a.marks)});let l=s.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function xT(t,e){let n=new hl(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function EB(t,e,n){let r=[];return t.nodesBetween(e.from,e.to,(o,i)=>{n(o)&&r.push({node:o,pos:i})}),r}function dd(t,e){for(let n=t.depth;n>0;n-=1){let r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function X0(t){return e=>dd(e.$from,t)}function B(t,e,n){return t.config[e]===void 0&&t.parent?B(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?B(t.parent,e,n):null}):t.config[e]}function CT(t){return t.map(e=>{let n=B(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return n?[e,...CT(n())]:e}).flat(10)}function ET(t,e){let n=Fi.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function TB(t,e){let n=new Map;for(let o of t){var r;let i=(r=n.get(o.type))!==null&&r!==void 0?r:new Map;i.set(o.name,o),n.set(o.type,i)}return[...Object.values(e.nodes),...Object.values(e.marks)].flatMap(o=>{var i;return Object.entries((i=o.spec.attrs)!==null&&i!==void 0?i:{}).map(([s,l])=>{var a;let c=(a=n.get(o.name))===null||a===void 0?void 0:a.get(s),u=Object.hasOwn(l,"default");return{type:o.name,name:s,attribute:{rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,...c?.attribute,default:l.default,isRequired:!u,validate:l.validate}}})})}var GJ={content:"string",marks:"string",group:"string",inline:"boolean",atom:"boolean",selectable:"boolean",draggable:"boolean",code:"boolean",whitespace:["pre","normal"],definingAsContext:"boolean",definingForContent:"boolean",defining:"boolean",isolating:"boolean",linebreakReplacement:"boolean"},XJ={inclusive:"boolean",excludes:"string",group:"string",spanning:"boolean",code:"boolean"};function WJ(t,e,n){return Object.fromEntries(Object.entries(e).flatMap(([r,o])=>{let i=t[r];if(i===void 0)return[];if(!(typeof o=="string"?typeof i===o:typeof i=="string"&&o.includes(i)))throw new RangeError(`Invalid schemaSpec field '${n}.${r}'`);return[[r,i]]}))}function JP(t,e,n,r){return{...Object.fromEntries(Object.entries(e).filter(([o])=>o!=="attrs"&&!Object.hasOwn(r,o))),...WJ(n,r,t),attrs:n.attrs}}function QP(t,e,n){for(let r of Object.keys(e))if(!Object.hasOwn(t,r))throw new RangeError(`schemaSpec requires a local ${n} extension named '${r}'`);for(let r of Object.keys(t))if(!Object.hasOwn(e,r))throw new RangeError(`Local ${n} extension '${r}' is not in schemaSpec`)}function JJ(t,e){QP(t.nodes,e.nodes,"node"),QP(t.marks,e.marks,"mark");let n=e.spec.nodes,r=e.spec.marks;return e.spec.nodes.forEach((o,i)=>{n=n.update(o,JP(o,t.nodes[o],i,GJ))}),e.spec.marks.forEach((o,i)=>{r=r.update(o,JP(o,t.marks[o],i,XJ))}),{topNode:e.topNodeType.name,nodes:n,marks:r}}function kB(t){let e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function ud(t){return{baseExtensions:t.filter(e=>e.type==="extension"),nodeExtensions:t.filter(e=>e.type==="node"),markExtensions:t.filter(e=>e.type==="mark")}}function TT(t){let e=[],{nodeExtensions:n,markExtensions:r}=ud(t),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(c=>c.name!=="text").map(c=>c.name),l=r.map(c=>c.name),a=[...s,...l];return t.forEach(c=>{let u=B(c,"addGlobalAttributes",{name:c.name,options:c.options,storage:c.storage,extensions:o});u&&u().forEach(d=>{let f;Array.isArray(d.types)?f=d.types:d.types==="*"?f=a:d.types==="nodes"?f=s:d.types==="marks"?f=l:f=[],f.forEach(h=>{Object.entries(d.attributes).forEach(([p,m])=>{e.push({type:h,name:p,attribute:{...i,...m}})})})})}),o.forEach(c=>{let u=B(c,"addAttributes",{name:c.name,options:c.options,storage:c.storage});if(!u)return;let d=u();Object.entries(d).forEach(([f,h])=>{let p={...i,...h};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:c.name,name:f,attribute:p})})}),e}function vT(t){return typeof t=="function"}function ve(t,e=void 0,...n){return vT(t)?e?t.bind(e)(...n):t(...n):t}function QJ(t={}){return Object.keys(t).length===0&&t.constructor===Object}function ZJ(t){let e=[],n="",r=!1,o=!1,i=0,s=t.length;for(let l=0;l<s;l+=1){let a=t[l];if(a==="'"&&!o){r=!r,n+=a;continue}if(a==='"'&&!r){o=!o,n+=a;continue}if(!r&&!o){if(a==="("){i+=1,n+=a;continue}if(a===")"&&i>0){i-=1,n+=a;continue}if(a===";"&&i===0){e.push(n),n="";continue}}n+=a}return n&&e.push(n),e}function ZP(t){let e=[],n=ZJ(t||""),r=n.length;for(let o=0;o<r;o+=1){let i=n[o],s=i.indexOf(":");if(s===-1)continue;let l=i.slice(0,s).trim(),a=i.slice(s+1).trim();l&&a&&e.push([l,a])}return e}function ce(...t){return t.filter(e=>!!e).reduce((e,n)=>{let r={...e};return Object.entries(n).forEach(([o,i])=>{if(o==="__proto__"){Object.defineProperty(r,o,{configurable:!0,enumerable:!0,value:i,writable:!0});return}if(!r[o]){r[o]=i;return}if(o==="class"){let s=i?String(i).split(" "):[],l=r[o]?r[o].split(" "):[],a=s.filter(c=>!l.includes(c));r[o]=[...l,...a].join(" ")}else if(o==="style"){let s=new Map([...ZP(r[o]),...ZP(i)]);r[o]=Array.from(s.entries()).map(([l,a])=>`${l}: ${a}`).join("; ")}else r[o]=i}),r},{})}function Sl(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)=>ce(n,r),{})}function eQ(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function eB(t,e){return"style"in t?t:{...t,getAttrs:n=>{let r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;let o=e.reduce((i,s)=>{let l=s.attribute.parseHTML?s.attribute.parseHTML(n):eQ(n.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...r,...o}}}}function tB(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&QJ(n)?!1:n!=null))}function nB(t){var e,n;let r={};return!(!(t==null||(e=t.attribute)===null||e===void 0)&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),(t==null||(n=t.attribute)===null||n===void 0?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function rB(t,e,n=TT(t)){var r;let{nodeExtensions:o,markExtensions:i}=ud(t);return{topNode:(r=o.find(s=>B(s,"topNode")))===null||r===void 0?void 0:r.name,nodes:Object.fromEntries(o.map(s=>{let l=n.filter(h=>h.type===s.name),a={name:s.name,options:s.options,storage:s.storage,editor:e},c=tB({...t.reduce((h,p)=>{let m=B(p,"extendNodeSchema",a);return{...h,...m?m(s):{}}},{}),content:ve(B(s,"content",a)),marks:ve(B(s,"marks",a)),group:ve(B(s,"group",a)),inline:ve(B(s,"inline",a)),atom:ve(B(s,"atom",a)),selectable:ve(B(s,"selectable",a)),draggable:ve(B(s,"draggable",a)),code:ve(B(s,"code",a)),whitespace:ve(B(s,"whitespace",a)),linebreakReplacement:ve(B(s,"linebreakReplacement",a)),defining:ve(B(s,"defining",a)),isolating:ve(B(s,"isolating",a)),attrs:Object.fromEntries(l.map(nB))}),u=ve(B(s,"parseHTML",a));u&&(c.parseDOM=u.map(h=>eB(h,l)));let d=B(s,"renderHTML",a);d&&(c.toDOM=h=>d({node:h,HTMLAttributes:Sl(h,l)}));let f=B(s,"renderText",a);return f&&(c.toText=f),[s.name,c]})),marks:Object.fromEntries(i.map(s=>{let l=n.filter(f=>f.type===s.name),a={name:s.name,options:s.options,storage:s.storage,editor:e},c=tB({...t.reduce((f,h)=>{let p=B(h,"extendMarkSchema",a);return{...f,...p?p(s):{}}},{}),inclusive:ve(B(s,"inclusive",a)),excludes:ve(B(s,"excludes",a)),group:ve(B(s,"group",a)),spanning:ve(B(s,"spanning",a)),code:ve(B(s,"code",a)),attrs:Object.fromEntries(l.map(nB))}),u=ve(B(s,"parseHTML",a));u&&(c.parseDOM=u.map(f=>eB(f,l)));let d=B(s,"renderHTML",a);return d&&(c.toDOM=f=>d({mark:f,HTMLAttributes:Sl(f,l)})),[s.name,c]}))}}function tQ(t,e,n){if(n===void 0)return new ka(rB(t,e));let r=kB(t.filter(s=>s.type!=="extension").map(s=>s.name));if(r.length)throw new RangeError(`Duplicate local schema types: ${r.join(", ")}`);let o=new ka(n),i=rB(t,e,TB(TT(t),o));return new ka(JJ(i,o))}function Jh(t){return t.sort((n,r)=>{let o=B(n,"priority")||100,i=B(r,"priority")||100;return o>i?-1:o<i?1:0})}function AB(t){let e=Jh(CT(t)),n=kB(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function MB(t,e,n){let{from:r,to:o}=e,{blockSeparator:i=`
|
|
63
|
+
|
|
64
|
+
`,textSerializers:s={}}=n||{},l="";return t.nodesBetween(r,o,(a,c,u,d)=>{a.isBlock&&c>r&&(l+=i);let f=s?.[a.type.name];if(f)return u&&(l+=f({node:a,pos:c,parent:u,index:d,range:e})),!1;if(a.isText){var h;l+=a==null||(h=a.text)===null||h===void 0?void 0:h.slice(Math.max(r,c)-c,o-c)}}),l}function nQ(t,e){return MB(t,{from:0,to:t.content.size},e)}function RB(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function rQ(t,e){let n=Dt(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,l=>{i.push(l)});let s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function kT(t,e){let n=G0(typeof e=="string"?e:e.name,t.schema);return n==="node"?rQ(t,e):n==="mark"?CB(t,e):{}}function oQ(t,e=JSON.stringify){let n={};return t.filter(r=>{let o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function iQ(t){let e=oQ(t);return e.length===1?e:e.filter((n,r)=>!e.filter((o,i)=>i!==r).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function fd(t){let{mapping:e,steps:n}=t,r=[],o=e.invert();return e.maps.forEach((i,s)=>{let l=[];if(i.ranges.length)i.forEach((c,u)=>{l.push({from:c,to:u})});else{let{from:c,to:u}=n[s];if(c===void 0||u===void 0)return;l.push({from:c,to:u})}let a=e.slice(s);l.forEach(({from:c,to:u})=>{let d=a.map(c,-1),f=a.map(u),h=o.map(d,-1),p=o.map(f);r.push({oldRange:{from:h,to:p},newRange:{from:d,to:f}})})}),iQ(r)}function Qh(t,e,n){let r=[];return t===e?n.resolve(t).marks().forEach(o=>{let i=ST(n.resolve(t),o.type);i&&r.push({mark:o,...i})}):n.nodesBetween(t,e,(o,i)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}var OB=(t,e,n,r=20)=>{let o=t.doc.resolve(n),i=r,s=null;for(;i>0&&s===null;){let l=o.node(i);l?.type.name===e?s=l:i-=1}return[s,i]},DB=t=>{let e=t.depth-1;if(e<0)return null;let n=t.index(e);return n===0?null:t.node(e).child(n-1)};function od(t,e){return e.nodes[t]||e.marks[t]||null}function $0(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{let o=t.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}var sQ=(t,e=500)=>{let n="",r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,l)=>{var a,c;let u=((a=(c=o.type.spec).toText)===null||a===void 0?void 0:a.call(c,{node:o,pos:i,parent:s,index:l}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-i))}),n};function bT(t,e,n={}){let{empty:r,ranges:o}=t.selection,i=e?Qi(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>Y0(u.attrs,n,{strict:!1}));let s=0,l=[];if(o.forEach(({$from:u,$to:d})=>{let f=u.pos,h=d.pos;t.doc.nodesBetween(f,h,(p,m)=>{if(i&&p.inlineContent&&!p.type.allowsMarkType(i))return!1;if(!p.isText&&!p.marks.length)return;let y=Math.max(f,m),g=Math.min(h,m+p.nodeSize),v=g-y;s+=v,l.push(...p.marks.map(b=>({mark:b,from:y,to:g})))})}),s===0)return!1;let a=l.filter(u=>i?i.name===u.mark.type.name:!0).filter(u=>Y0(u.mark.attrs,n,{strict:!1})).reduce((u,d)=>u+d.to-d.from,0),c=l.filter(u=>i?u.mark.type!==i&&u.mark.type.excludes(i):!0).reduce((u,d)=>u+d.to-d.from,0);return(a>0?a+c:a)>=s}function lQ(t,e,n={}){if(!e)return ei(t,null,n)||bT(t,null,n);let r=G0(e,t.schema);return r==="node"?ei(t,e,n):r==="mark"?bT(t,e,n):!1}var NB=(t,e)=>{let{$from:n,$to:r,$anchor:o}=t.selection;if(e){let i=X0(l=>l.type.name===e)(t.selection);if(!i)return!1;let s=t.doc.resolve(i.pos+1);return o.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},_B=t=>{let{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function oB(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Xh(t,e){let{nodeExtensions:n}=ud(e),r=n.find(i=>i.name===t);if(!r)return!1;let o=ve(B(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof o!="string"?!1:o.split(" ").includes("list")}function hd(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){if(n){if(t.type.name==="hardBreak")return!0;if(t.isText){var r;return!/\S/.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 o=!0;return t.content.forEach(i=>{o!==!1&&(hd(i,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function W0(t){return t instanceof j}function aQ(t){if(t===null||typeof t!="object")return!1;let e=t;return!(typeof e.apply!="function"||typeof e.getMap!="function"||typeof e.invert!="function"||typeof e.map!="function"||typeof e.merge!="function"||typeof e.toJSON!="function")}function cQ(t){if(t===null||typeof t!="object")return!1;let e=t;if(!aQ(e))return!1;let n=e.toJSON();return!(n===null||typeof n!="object"||n.stepType!=="replace")}var J0=class IB{constructor(e){this.position=e}static fromJSON(e){return new IB(e.position)}toJSON(){return{position:this.position}}};function AT(t,e){let n=e.mapping.mapResult(t.position);return{position:new J0(n.pos),mapResult:n}}function uQ(t){return new J0(t)}function dQ(t,e,n){let{selection:r}=e,o=null;if(mB(r)&&(o=r.$cursor),o){var i;let l=(i=t.storedMarks)!==null&&i!==void 0?i:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(a=>a.type.excludes(n)))}let{ranges:s}=r;return s.some(({$from:l,$to:a})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){let h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(n));c=h&&p}return!c}),c})}var fQ=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let{selection:i}=n,{empty:s,ranges:l}=i,a=Qi(t,r.schema);if(o)if(s){let c=CB(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{let u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{let p=Math.max(h,u),m=Math.min(h+f.nodeSize,d);f.marks.find(y=>y.type===a)?f.marks.forEach(y=>{a===y.type&&n.addMark(p,m,a.create({...y.attrs,...e}))}):n.addMark(p,m,a.create(e))})});return dQ(r,n,a)},hQ=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),pQ=(t,e={})=>({state:n,dispatch:r,chain:o})=>{let i=Dt(t,n.schema),s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:l})=>OE(i,{...s,...e})(n)?!0:l.clearNodes()).command(({state:l})=>OE(i,{...s,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},mQ=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,o=ja(t,0,r.content.size),i=j.create(r,o);e.setSelection(i)}return!0},gQ=(t,e)=>({tr:n,state:r,dispatch:o})=>{let{selection:i}=r,s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=i.from,l=i.to),o&&n.doc.nodesBetween(s,l,(a,c)=>{a.isText||n.setNodeMarkup(c,void 0,{...a.attrs,dir:t})}),!0},yQ=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,{from:o,to:i}=typeof t=="number"?{from:t,to:t}:t,s=L.atStart(r).from,l=L.atEnd(r).to,a=ja(o,s,l),c=ja(i,s,l),u=L.create(r,a,c);e.setSelection(u)}return!0},vQ=t=>({state:e,dispatch:n})=>{let r=Dt(t,e.schema);return RU(r)(e,n)};function iB(t,e){let n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){let r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r)}}var bQ=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{let{selection:i,doc:s}=e,{$from:l,$to:a}=i,c=o.extensionManager.attributes,u=$0(c,l.node().type.name,l.node().attrs);if(i instanceof j&&i.node.isBlock)return!l.parentOffset||!no(s,l.pos)?!1:(r&&(t&&iB(n,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;let d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:wB(l.node(-1).contentMatchAt(l.indexAfter(-1))),h=d&&f?[{type:f,attrs:u}]:void 0,p=i instanceof L&&!i.empty?Ra.create({doc:e.doc,selection:i}).tr.deleteSelection():null,m=p?p.doc:e.doc,y=p?p.mapping.map(l.pos):l.pos,g=no(m,y,1,h);if(!h&&!g&&no(m,y,1,f?[{type:f}]:void 0)&&(g=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(g){let v=e.steps.length;if(i instanceof L&&e.deleteSelection(),e.split(e.mapping.slice(v).map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f){let b=e.mapping.slice(v).map(l.before()),w=e.doc.resolve(b);l.node(-1).canReplaceWith(w.index(),w.index()+1,f)&&e.setNodeMarkup(e.mapping.slice(v).map(l.before()),f)}}t&&iB(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return g},wQ=(t,e={})=>({tr:n,state:r,dispatch:o,editor:i})=>{let s=Dt(t,r.schema),{$from:l,$to:a}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(a))return!1;let u=l.node(-1);if(u.type!==s)return!1;let d=i.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return!1;if(o){var f;let w=M.empty,S=l.index(-1)?1:l.index(-2)?2:3;for(let _=l.depth-S;_>=l.depth-3;_-=1)w=M.from(l.node(_).copy(w));let C=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,x={...$0(d,l.node().type.name,l.node().attrs),...e},E=((f=s.contentMatch.defaultType)===null||f===void 0?void 0:f.createAndFill(x))||void 0;w=w.append(M.from(s.createAndFill(null,E)||void 0));let k=l.before(l.depth-(S-1));n.replace(k,l.after(-C),new N(w,4-S,0));let T=-1;n.doc.nodesBetween(k,n.doc.content.size,(_,z)=>{if(T>-1)return!1;_.isTextblock&&_.content.size===0&&(T=z+1)}),T>-1&&n.setSelection(L.near(n.doc.resolve(T))),n.scrollIntoView()}return!0}let h=a.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...$0(d,u.type.name,u.attrs),...e},m={...$0(d,l.node().type.name,l.node().attrs),...e},y=l.parentOffset===0&&l.index(-1)===0,g=l.before(-1);n.delete(l.pos,a.pos);let v=y?u.attrs:p,b=h?[{type:s,attrs:v},{type:h,attrs:m}]:[{type:s,attrs:v}];if(!no(n.doc,l.pos,2))return!1;if(o){let{selection:w,storedMarks:S}=r,{splittableMarks:C}=i.extensionManager,x=S||w.$to.parentOffset&&w.$from.marks();if(n.split(l.pos,2,b).scrollIntoView(),y&&n.setNodeMarkup(g,void 0,p),!x||!o)return!0;let E=x.filter(k=>C.includes(k.type.name));n.ensureMarks(E)}return!0};function LB(t,e,n){if(!t.validContent(e))return null;try{return t.create(n,e)}catch{return null}}function MT(t,e){if(t.pendingContent.length===0)return!0;let n=LB(e,M.from(t.pendingContent));return n?(t.items.push(n),t.pendingContent=[],!0):!1}function SQ(t,e,n){return n.validContent(M.from([...e.pendingContent,t]))?(e.pendingContent.push(t),!0):!MT(e,n)||!n.validContent(M.from(t))?!1:(e.pendingContent.push(t),!0)}function xQ(t,e,n,r){let o=r(t,n);if(!o)return!1;let i=LB(n.listType,M.from(o),t.attrs);return i?n.itemType.validContent(M.from([...e.pendingContent,i]))?(e.pendingContent.push(i),!0):MT(e,n.itemType)?(e.items.push(...o),!0):!1:!1}function CQ(t,e,n){let r={items:[],pendingContent:[]};for(let o=0;o<t.childCount;o+=1){let i=t.child(o);if(!(e.isListNode(i)?xQ(i,r,e,n):SQ(i,r,e.itemType)))return null}return MT(r,e.itemType)?r.items:null}function zB(t,e){let n=[];for(let r=0;r<t.childCount;r+=1){let o=CQ(t.child(r),e,zB);if(!o)return null;n.push(...o)}return n}function sB(t,e){let n=null;return t.descendants((r,o)=>r!==e?!0:(n=o,!1)),n}function lB(t){return!t||t==="1"?null:t}function UB(t,e){return lB(t)===lB(e)}var H0=(t,e)=>{let n=X0(i=>i.type===e)(t.selection);if(!n)return!0;let r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let o=t.doc.nodeAt(r);return!(n.node.type===o?.type&&xo(t.doc,n.pos))||!UB(n.node.attrs.type,o?.attrs.type)||t.join(n.pos),!0},j0=(t,e)=>{let n=X0(i=>i.type===e)(t.selection);if(!n)return!0;let r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let o=t.doc.nodeAt(r);return!(n.node.type===o?.type&&xo(t.doc,r))||!UB(n.node.attrs.type,o?.attrs.type)||t.join(r),!0};function EQ(t){let e=t.doc,n=e.firstChild;if(!n)return null;let r=e.resolve(1),o=e.resolve(n.nodeSize-1);return L.between(r,o)}var TQ=(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:l,chain:a,commands:c,can:u})=>{let{extensions:d,splittableMarks:f}=o.extensionManager,h=Dt(t,s.schema),p=Dt(e,s.schema),{selection:m,storedMarks:y}=s,{$from:g,$to:v}=m,b=g.blockRange(v),w=y||m.$to.parentOffset&&m.$from.marks();if(!b)return!1;let S=X0(I=>Xh(I.type.name,d))(m),C=m.from===0&&m.to===s.doc.content.size,x=s.doc.content.content,E=x.length===1?x[0]:null,k=C&&E&&Xh(E.type.name,d)?{node:E,pos:0,depth:0}:null,T=S??k,_=!!S&&b.depth>=1&&b.depth-S.depth<=1,z=!!k;if((_||z)&&T){if(T.node.type===h)return C&&z?a().command(({tr:I,dispatch:V})=>{let D=EQ(I);return D?(I.setSelection(D),V&&V(I),!0):!1}).liftListItem(p).run():c.liftListItem(p);if(Xh(T.node.type.name,d)&&h.validContent(T.node.content))return a().command(()=>(i.setNodeMarkup(T.pos,h),!0)).command(()=>H0(i,h)).command(()=>j0(i,h)).run();if(Xh(T.node.type.name,d)){var $;let I=($=T.node.firstChild)===null||$===void 0?void 0:$.type;if(I&&I!==p){let V=zB(T.node,{listType:h,itemType:p,isListNode:q=>Xh(q.type.name,d)}),D=V?M.from(V):null;return!D||!h.validContent(D)?!1:a().command(()=>{let{$anchor:q,$head:U}=i.selection,re=q.parent,Y=U.parent,Te=q.parentOffset,rn=U.parentOffset,ct;try{ct=h.create(r,D)}catch{return!1}if(i.replaceWith(T.pos,T.pos+T.node.nodeSize,ct),re.inlineContent&&Y.inlineContent){let Br=sB(ct,re),Sn=sB(ct,Y);if(Br!==null&&Sn!==null){let X=T.pos+Br+2+Te,To=T.pos+Sn+2+rn;i.setSelection(L.create(i.doc,X,To))}}return!0}).command(()=>H0(i,h)).command(()=>j0(i,h)).run()}}}return!n||!w||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>H0(i,h)).command(()=>j0(i,h)).run():a().command(()=>{let I=u().wrapInList(h,r),V=w.filter(D=>f.includes(D.type.name));return i.ensureMarks(V),I?!0:c.clearNodes()}).wrapInList(h,r).command(()=>H0(i,h)).command(()=>j0(i,h)).run()},kQ=(t,e={},n={})=>({state:r,commands:o})=>{let{extendEmptyMarkRange:i=!1}=n,s=Qi(t,r.schema);return bT(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},AQ=(t,e,n={})=>({state:r,commands:o})=>{let i=Dt(t,r.schema),s=Dt(e,r.schema),l=ei(r,i,n),a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?o.setNode(s,a):o.setNode(i,{...a,...n})},MQ=(t,e={})=>({state:n,commands:r})=>{let o=Dt(t,n.schema);return ei(n,o,e)?r.lift(o):r.wrapIn(o,e)},RQ=()=>({state:t,dispatch:e})=>{let n=t.plugins;for(let r=0;r<n.length;r+=1){let o=n[r],i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){let s=t.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){let a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},OQ=(t={})=>({tr:e,dispatch:n,editor:r})=>{let{ignoreClearable:o=!1}=t,{selection:i}=e,{empty:s,ranges:l}=i;if(s)return!0;let{nonClearableMarks:a}=r.extensionManager;if(n){let c=Object.values(r.schema.marks).filter(u=>o||!a.includes(u.name));l.forEach(u=>{for(let d of c)e.removeMark(u.$from.pos,u.$to.pos,d)})}return!0},DQ=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let{extendEmptyMarkRange:i=!1}=e,{selection:s}=n,l=Qi(t,r.schema),{$from:a,empty:c,ranges:u}=s;if(!o)return!0;if(c&&i){var d;let{from:f,to:h}=s,p=ST(a,l,(d=a.marks().find(m=>m.type===l))===null||d===void 0?void 0:d.attrs);p&&(f=p.from,h=p.to),n.removeMark(f,h,l)}else u.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},NQ=t=>({tr:e,state:n,dispatch:r})=>{let{selection:o}=n,i,s;return typeof t=="number"?(i=t,s=t):t&&"from"in t&&"to"in t?(i=t.from,s=t.to):(i=o.from,s=o.to),r&&e.doc.nodesBetween(i,s,(l,a)=>{if(l.isText)return;let c={...l.attrs};delete c.dir,e.setNodeMarkup(a,void 0,c)}),!0},_Q=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null,l=G0(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(i=Dt(t,r.schema)),l==="mark"&&(s=Qi(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{let u=c.$from.pos,d=c.$to.pos,f,h,p,m;n.selection.empty?r.doc.nodesBetween(u,d,(y,g)=>{i&&i===y.type&&(a=!0,p=Math.max(g,u),m=Math.min(g+y.nodeSize,d),f=g,h=y)}):r.doc.nodesBetween(u,d,(y,g)=>{g<u&&i&&i===y.type&&(a=!0,p=Math.max(g,u),m=Math.min(g+y.nodeSize,d),f=g,h=y),g>=u&&g<=d&&(i&&i===y.type&&(a=!0,o&&n.setNodeMarkup(g,void 0,{...y.attrs,...e})),s&&y.marks.length&&y.marks.forEach(v=>{if(s===v.type&&(a=!0,o)){let b=Math.max(g,u),w=Math.min(g+y.nodeSize,d);n.addMark(b,w,s.create({...v.attrs,...e}))}}))}),h&&(f!==void 0&&o&&n.setNodeMarkup(f,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(y=>{s===y.type&&o&&n.addMark(p,m,s.create({...y.attrs,...e}))}))}),a},sd=new le("__tiptap_decorations__"),IQ=t=>({tr:e,dispatch:n})=>(n&&e.setMeta(sd,{type:"force",name:t}),!0),LQ=(t,e={})=>({state:n,dispatch:r})=>{let o=Dt(t,n.schema);return kU(o,e)(n,r)},zQ=(t,e={})=>({state:n,dispatch:r})=>{let o=Dt(t,n.schema);return AU(o,e)(n,r)},UQ=yz({blur:()=>rJ,clearContent:()=>oJ,clearNodes:()=>iJ,command:()=>sJ,createParagraphNear:()=>lJ,cut:()=>aJ,deleteCurrentNode:()=>cJ,deleteNode:()=>uJ,deleteRange:()=>dJ,deleteSelection:()=>pJ,enter:()=>mJ,exitCode:()=>gJ,extendMarkRange:()=>yJ,first:()=>vJ,focus:()=>wJ,forEach:()=>SJ,insertContent:()=>xJ,insertContentAt:()=>CJ,insertDefaultBlock:()=>EJ,joinBackward:()=>AJ,joinDown:()=>kJ,joinForward:()=>MJ,joinItemBackward:()=>RJ,joinItemForward:()=>OJ,joinTextblockBackward:()=>DJ,joinTextblockForward:()=>NJ,joinUp:()=>TJ,keyboardShortcut:()=>IJ,lift:()=>LJ,liftEmptyBlock:()=>zJ,liftListItem:()=>UJ,newlineInCode:()=>PJ,resetAttributes:()=>BJ,scrollIntoView:()=>HJ,selectAll:()=>jJ,selectNodeBackward:()=>VJ,selectNodeForward:()=>FJ,selectParentNode:()=>$J,selectTextblockEnd:()=>YJ,selectTextblockStart:()=>qJ,setContent:()=>KJ,setMark:()=>fQ,setMeta:()=>hQ,setNode:()=>pQ,setNodeSelection:()=>mQ,setTextDirection:()=>gQ,setTextSelection:()=>yQ,sinkListItem:()=>vQ,splitBlock:()=>bQ,splitListItem:()=>wQ,toggleList:()=>TQ,toggleMark:()=>kQ,toggleNode:()=>AQ,toggleWrap:()=>MQ,undoInputRule:()=>RQ,unsetAllMarks:()=>OQ,unsetMark:()=>DQ,unsetTextDirection:()=>NQ,updateAttributes:()=>_Q,updateDecorations:()=>IQ,wrapIn:()=>LQ,wrapInList:()=>zQ}),ld=new WeakMap;function PQ(t,e){var n;ld.set(t,((n=ld.get(t))!==null&&n!==void 0?n:0)+1);try{return e()}finally{var r;let o=((r=ld.get(t))!==null&&r!==void 0?r:1)-1;o>0?ld.set(t,o):ld.delete(t)}}function BQ(t){return ld.has(t)}var HQ=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){let n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){let n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){let n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},PB=typeof process<"u"&&!1;function jQ(t){return t.kind==="widget"}function BB(t,e){let n=[],r=new Set;for(let o of t)o.kind==="widget"&&jQ(o)&&r.add(o.key),n.push(o.toPMDecoration(e));return{decorations:n,widgetKeys:r}}function VQ(t,e,n){let{decorations:r,widgetKeys:o}=BB(e,n);return{set:ae.create(t,r),widgetKeys:o}}function HB({position:t,from:e,to:n,docSize:r}){return t<e?!1:t<n?!0:t===n&&n===r}function FQ({decorations:t,from:e,to:n,docSize:r,extensionName:o,warnedExtensions:i}){return t.filter(s=>HB({position:s.anchor,from:e,to:n,docSize:r})?!0:(s.anchor===n||i.has(o)||(i.add(o),console.warn(`[tiptap warn]: Extension "${o}" returned a decoration outside the requested range [${e}, ${n}). It was ignored.`)),!1))}function jB(t){var e;let n=(e=t.spec)===null||e===void 0?void 0:e.key;return typeof n=="string"?n:void 0}function $Q(t){let e=new Map,n=new Map;for(let s of t.find()){var r,o,i;let l=jB(s);if(!l)continue;let a=(r=s.spec.extensionName)!==null&&r!==void 0?r:"unknown",c=(o=e.get(l))!==null&&o!==void 0?o:new Set;c.add(a),e.set(l,c),n.set(l,((i=n.get(l))!==null&&i!==void 0?i:0)+1)}return Array.from(e,([s,l])=>({key:s,extensions:l})).filter(({key:s})=>{var l;return((l=n.get(s))!==null&&l!==void 0?l:0)>1})}function VB(t){return t.jsonID==="attr"}function YQ(t){let e=!1;if(t.getMap().forEach(()=>{e=!0}),e||VB(t))return!0;let n=t;return typeof n.from=="number"&&typeof n.to=="number"}function qQ(t,e){let n=null,r=0,o=0;for(let i=0;i<t.childCount&&!(o>e.to);i+=1){let s=o+t.child(i).nodeSize;s>=e.from&&(n===null&&(n=o),r=s),o=s}return n===null?null:{from:n,to:r}}function KQ(t,e){if(t.steps.some(i=>!YQ(i)))return{type:"full"};let n=fd(t).map(({newRange:i})=>i);t.steps.forEach((i,s)=>{if(!VB(i))return;let l=t.mapping.slice(s);n.push({from:l.map(i.pos,-1),to:l.map(i.pos+1)})});let r=[];for(let i of n){let s=qQ(e,i);s&&r.push(s)}r.sort((i,s)=>i.from-s.from);let o=[];for(let i of r){let s=o[o.length-1];s&&i.from<=s.to?s.to=Math.max(s.to,i.to):o.push({...i})}return{type:"ranges",ranges:o}}function FB(t,e,n,r){return t.map(e,n,{onRemove:o=>{let i=o?.key;typeof i=="string"&&r.delete(i)}})}function GQ(t,e,n){var r,o;let i=(r=e.decorationSetsByExtension[t])!==null&&r!==void 0?r:ae.empty,s=new Set((o=e.widgetKeysByExtension[t])!==null&&o!==void 0?o:[]);return{set:FB(i,n.mapping,n.doc,s),widgetKeys:s}}function aB(t,e){let n=Object.values(e).flatMap(r=>r.find());return ae.create(t,n)}function cB(t){let e=new Set;for(let n of Object.values(t))for(let r of n)e.add(r);return e}function XQ(t,e){var n;switch((n=e.update)!==null&&n!==void 0?n:"document"){case"document":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(e.shouldUpdate)throw new Error(`[tiptap error]: Extension "${t}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${t}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function WQ(t,e,n){return n?!0:t.update==="manual"?!1:t.shouldUpdate?t.shouldUpdate(e):e.tr.docChanged}var JQ=new Set;var QQ=class{constructor(t){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{let n=sd.getState(e);n&&this.warnDuplicateWidgetKeys(n)},this.editor=t.editor,this.entries=this.resolveEntries(t.entries),this.entries.forEach(({name:e,spec:n})=>XQ(e,n)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var t,e;return(t=(e=sd.getState(this.editor.state))===null||e===void 0?void 0:e.widgetKeys)!==null&&t!==void 0?t:JQ}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(t){let e=[];for(let{name:n,addDecorations:r}of t){let o=r();o&&e.push({name:n,spec:o})}return e}createPlugin(){let{editor:t,entries:e}=this;return new G({key:sd,state:{init:(n,r)=>{let o={},i={};for(let{name:l,spec:a}of e){let{set:c,widgetKeys:u}=this.buildFullSet(l,a,r);o[l]=c,i[l]=u}let s={decorationSetsByExtension:o,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(r.doc,o),widgetKeys:cB(i)};return this.warnDuplicateWidgetKeys(s),s},apply:(n,r,o,i)=>{let s=n.getMeta(sd),l=s?.type==="force"&&!s.name,a=s?.type==="force"?s.name:void 0,c={},u={},d=new Set;return PQ(t,()=>{for(let{name:f,spec:h}of e){let p=l||a===f;if(WQ(h,{editor:t,tr:n,oldState:o,newState:i},p))if(h.update==="changedRanges"&&n.docChanged&&!p){let m=this.applyChangedRangesRecompute(f,h,r,n,i);c[f]=m.set,u[f]=m.widgetKeys,d.add(f)}else{let{set:m,widgetKeys:y}=this.buildFullSet(f,h,i);c[f]=m,u[f]=y,d.add(f)}else{let m=GQ(f,r,n);c[f]=m.set,u[f]=m.widgetKeys}}}),d.size===0&&!n.docChanged?r:{decorationSetsByExtension:c,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:e,previous:r,tr:n,decorationSetsByExtension:c,recomputedNames:d}),widgetKeys:cB(u)}}},props:{decorations(n){var r,o;return(r=(o=sd.getState(n))===null||o===void 0?void 0:o.mergedDecorationSet)!==null&&r!==void 0?r:ae.empty}}})}applyChangedRangesRecompute(t,e,n,r,o){let i=KQ(r,o.doc);return i.type==="full"?this.buildFullSet(t,e,o):this.rebuildRanges(t,e,n,r,o,i.ranges)}rebuildRanges(t,e,n,r,o,i){var s,l;let a=(s=n.decorationSetsByExtension[t])!==null&&s!==void 0?s:ae.empty,c=new Set((l=n.widgetKeysByExtension[t])!==null&&l!==void 0?l:[]),u=FB(a,r.mapping,r.doc,c),d=o.doc.content.size;for(let{from:f,to:h}of i){let p=u.find(f,h).filter(g=>HB({position:g.from,from:f,to:h,docSize:d}));for(let g of p){let v=jB(g);v&&c.delete(v)}u=u.remove(p);let{decorations:m,widgetKeys:y}=BB(FQ({decorations:this.runCreate(t,"createInRange",()=>e.createInRange({editor:this.editor,state:o,view:this.mountedView,from:f,to:h})),from:f,to:h,docSize:d,extensionName:t,warnedExtensions:this.warnedOutOfRangeExtensions}),t);u=u.add(o.doc,m);for(let g of y)c.add(g)}return{set:u,widgetKeys:c}}buildFullSet(t,e,n){let r=this.runCreate(t,"create",()=>e.create({editor:this.editor,state:n,view:this.mountedView}));return VQ(n.doc,r,t)}runCreate(t,e,n){try{return n()}catch(r){return console.error(`[tiptap error]: Extension "${t}" threw in \`addDecorations().${e}()\`. Its decorations were dropped for this update.`,r),[]}}warnDuplicateWidgetKeys(t){if(!PB)return;if(t.widgetKeys.size===0){this.warnedWidgetKeys.clear();return}let e=$Q(t.mergedDecorationSet),n=new Set(e.map(({key:r})=>r));for(let{key:r,extensions:o}of e){if(this.warnedWidgetKeys.has(r))continue;let i=Array.from(o).map(s=>`"${s}"`).join(", ");console.warn(`[tiptap warn]: Duplicate widget decoration key "${r}" in extension${o.size===1?"":"s"} ${i}. Widget decoration keys must be globally unique, otherwise ProseMirror misplaces the widget DOM. Use a stable, unique key (e.g. \`comment-\${id}\`).`)}this.warnedWidgetKeys=n}buildMergedSet(t,e){let n=Object.keys(e);return n.length===1?e[n[0]]:aB(t,e)}mergeAfterApply({entries:t,previous:e,tr:n,decorationSetsByExtension:r,recomputedNames:o}){return t.length===1?r[t[0].name]:o.size===0?e.mergedDecorationSet.map(n.mapping,n.doc):aB(n.doc,r)}};function $B(t,e){let{selection:n}=t,{$from:r}=n;if(n instanceof j){let i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let o=r.depth;for(;o>=0;){let i=r.index(o);if(r.node(o).contentMatchAt(i).matchType(e))return!0;o-=1}return!1}function ZQ(t,e,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(r!==null)return r;let o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute(`data-tiptap-style${n?`-${n}`:""}`,""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}function eZ(t){return typeof t=="number"}function tZ(t){return Object.prototype.toString.call(t).slice(8,-1)}function V0(t){return tZ(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function YB(t){return typeof t=="string"&&t.trim().length>0&&!/[;{}]/.test(t)}function nZ(t,e){return t.replace(/^[ \t]*/,n=>{let o=0;for(let i of n)o+=i===" "?4-o%4:1;return" ".repeat(Math.max(0,o-e))})}function rZ(t,e){let n=`text
|
|
65
|
+
${t}
|
|
66
|
+
`,r=e(n)[0];return(r?.type==="paragraph"||r?.type==="text")&&r.raw===n}function oZ(t,e,n){var r;let o=e.split(`
|
|
67
|
+
`),i=(r=n.isParagraphContinuation)!==null&&r!==void 0?r:(l=>rZ(l,n.blockTokens)),s=0;for(let l of o){if(!l.trim()||!i(l))break;s+=1}return{mainContent:[t,...o.slice(0,s).map(l=>l.trimStart())].join(`
|
|
68
|
+
`),nestedContent:o.slice(s).join(`
|
|
69
|
+
`)}}function RT(t,e,n){let r=t.split(`
|
|
70
|
+
`),o=[],i="",s=0,l=e.baseIndentSize||2;for(;s<r.length;){let u=r[s],d=u.match(e.itemPattern);if(!d){if(o.length>0)break;if(u.trim()===""){s+=1,i=`${i}${u}
|
|
71
|
+
`;continue}else return}let f=e.extractItemData(d),{indentLevel:h,mainContent:p}=f;i=`${i}${u}
|
|
72
|
+
`;let m=[p];for(s+=1;s<r.length;){var a;let b=r[s];if(b.trim()===""){var c;let w=r.slice(s+1).findIndex(S=>S.trim()!=="");if(w===-1)break;if((((c=r[s+1+w].match(/^(\s*)/))===null||c===void 0||(c=c[1])===null||c===void 0?void 0:c.length)||0)>h){m.push(b),i=`${i}${b}
|
|
73
|
+
`,s+=1;continue}else break}if((((a=b.match(/^(\s*)/))===null||a===void 0||(a=a[1])===null||a===void 0?void 0:a.length)||0)>h)m.push(b),i=`${i}${b}
|
|
74
|
+
`,s+=1;else break}let y,g=m.slice(1);if(g.length>0){let b=oZ(p,g.map(S=>nZ(S,h+l)).join(`
|
|
75
|
+
`),n);f.mainContent=b.mainContent;let w=b.nestedContent;w.trim()&&(e.customNestedParser?y=e.customNestedParser(w):y=n.blockTokens(w))}let v=e.createToken(f,y);o.push(v)}if(o.length!==0)return{items:o,raw:i.slice(0,t.length)}}var uB=4;function dB(t){let e=0;for(let n of t)e=n===" "?e+uB-e%uB:e+1;return e}function OT(t,e,n,r,o){if(!t||!Array.isArray(t.content))return"";let i=typeof n=="function"?n(r):n,[s,...l]=t.content,a=e.renderChildren([s]),c=`${i}${o?.indentMainContent?a.split(`
|
|
76
|
+
`).map((u,d)=>d===0?u:e.indent(u)).join(`
|
|
77
|
+
`):a}`;return l&&l.length>0&&l.forEach((u,d)=>{var f,h;let p=(f=(h=e.renderChild)===null||h===void 0?void 0:h.call(e,u,d+1))!==null&&f!==void 0?f:e.renderChildren([u]);if(p!=null){let m=g=>{if(!o?.alignNestedToPrefix)return e.indent(g);let v=e.indent(""),b=dB(i);return(dB(v)>=b?v:" ".repeat(b))+g},y=p.split(`
|
|
78
|
+
`).map(g=>m(g||"")).join(`
|
|
79
|
+
`);c+=u.type==="paragraph"?`
|
|
80
|
+
|
|
81
|
+
${y}`:`
|
|
82
|
+
${y}`}}),c}function qB(t,e){let n={...t};return V0(t)&&V0(e)&&Object.keys(e).forEach(r=>{V0(e[r])&&V0(t[r])?n[r]=qB(t[r],e[r]):n[r]=e[r]}),n}function iZ(t,e,n={}){let{state:r}=e,{doc:o,tr:i}=r,s=t;o.descendants((l,a)=>{let c=i.mapping.map(a),u=i.mapping.map(a)+l.nodeSize,d=null;if(l.marks.forEach(h=>{if(h!==s)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){let h=t.type.create({...t.attrs,...n});i.removeMark(c,u,t.type),i.addMark(c,u,h)}}),i.docChanged&&e.view.dispatch(i)}var pd=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!==null&&e!==void 0?e:!0}},sZ=(t,e)=>{if(wT(e))return e.exec(t);let n=e(t);if(!n)return null;let 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 lZ(t){let{editor:e,from:n,to:r,text:o,insertText:i}=t;if(!i)return{inputTransaction:null,tr:e.view.state.tr};let s=e.view.state.tr.insertText(o,n,r);return{inputTransaction:s,tr:Ra.create({doc:s.doc,selection:s.selection,storedMarks:s.storedMarks}).tr}}function aZ(t){let{editor:e,from:n,to:r,text:o,rule:i,match:s,plugin:l,insertText:a}=t,{view:c}=e,{inputTransaction:u,tr:d}=lZ({editor:e,from:n,to:r,text:o,insertText:a}),f=u?n+o.length:r,h=K0({state:c.state,transaction:d}),p={from:n-(s[0].length-o.length),to:f},{commands:m,chain:y,can:g}=new ad({editor:e,state:h});return i.handler({state:h,range:p,match:s,commands:m,chain:y,can:g})===null||!d.steps.length?!1:(u&&(c.dispatch(u),!c.state.doc.eq(u.doc))||(FP(d),d.setMeta("inputRule",!0),i.undoable&&d.setMeta(l,{transform:d,from:n,to:f,text:o}),c.dispatch(d)),!0)}function cZ(t,e,n){let r=e[0].length-n.length;if(r<=0)return!0;let o=t.parentOffset-r;return o>=0&&t.parent.textBetween(o,t.parentOffset)===e[0].slice(0,r)}function F0(t){var e;let{editor:n,from:r,to:o,text:i,rules:s,plugin:l,insertText:a}=t,{view:c}=n;if(c.composing)return!1;let u=c.state.doc.resolve(r);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let d=sQ(u)+i;for(let f of s){let h=sZ(d,f.find);if(!(!h||!cZ(u,h,i))&&aZ({editor:n,from:r,to:o,text:i,rule:f,match:h,plugin:l,insertText:a}))return!0}return!1}function uZ(t){let{editor:e,rules:n}=t,r=new G({state:{init(){return null},apply(o,i,s){let l=o.getMeta(r);if(l)return l;let a=o.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:c}=a;typeof c=="string"?c=c:c=ET(M.from(c),s.schema);let{from:u}=a,d=u+c.length;F0({editor:e,from:u,to:d,text:c,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,l){return F0({editor:e,from:i,to:s,text:l,rules:n,plugin:r,insertText:!0})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{let{$cursor:i}=o.state.selection;i&&F0({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;let{$cursor:s}=o.state.selection;return s?F0({editor:e,from:s.pos,to:s.pos,text:`
|
|
83
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var DT=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...ve(B(this,"addOptions",{name:this.name}))}}get storage(){return{...ve(B(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){let e=this.extend({...this.config,addOptions:()=>qB(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){let e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Lr=class KB extends DT{constructor(...e){super(...e),this.type="mark"}static create(e={}){let n=typeof e=="function"?e():e;return new KB(n)}static handleExit({editor:e,mark:n}){let{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){let i=o.marks();if(!i.find(l=>l?.type.name===n.name))return!1;let s=i.find(l=>l?.type.name===n.name);return s&&r.removeStoredMark(s),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){let n=typeof e=="function"?e():e;return super.extend(n)}},NT=class{constructor(t){this.find=t.find,this.handler=t.handler}},dZ=(t,e,n)=>{if(wT(e))return[...t.matchAll(e)];let r=e(t,n);return r?r.map(o=>{let i=[o.text];return i.index=o.index,i.input=t,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function fZ(t){let{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:a,chain:c,can:u}=new ad({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,o,(f,h)=>{var p,m,y,g;if(!((p=f.type)===null||p===void 0||(p=p.spec)===null||p===void 0)&&p.code||!(f.isText||f.isTextblock||f.isInline))return;let v=(m=(y=(g=f.content)===null||g===void 0?void 0:g.size)!==null&&y!==void 0?y:f.nodeSize)!==null&&m!==void 0?m:0,b=Math.max(r,h),w=Math.min(o,h+v);if(b>=w)return;let S=f.isText?f.text||"":f.textBetween(b-h,w-h,void 0,"\uFFFC");dZ(S,i.find,s).forEach(C=>{if(C.index===void 0)return;let x=b+C.index+1,E=x+C[0].length,k={from:n.tr.mapping.map(x),to:n.tr.mapping.map(E)},T=i.handler({state:n,range:k,match:C,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});d.push(T)})}),d.every(f=>f!==null)}var id=null,hZ=t=>{var e;let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function pZ(t){let{editor:e,rules:n}=t,r=null,o=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}let a=({state:c,from:u,to:d,rule:f,pasteEvt:h})=>{let p=c.tr,m=K0({state:c,transaction:p});if(!(!fZ({editor:e,state:m,from:Math.max(u-1,0),to:d.b-1,rule:f,pasteEvent:h,dropEvent:l})||!p.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,p}};return e.on("destroy",()=>{id===e&&(id=null)}),n.map(c=>new G({view(u){let d=h=>{var p;r=!((p=u.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?u.dom.parentElement:null,r&&(id=e)},f=()=>{id&&(id=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(u,d)=>{if(i=r===u.dom.parentElement,l=d,!i){let f=id;f?.isEditable&&setTimeout(()=>{if(f.isDestroyed)return;let h=f.state.selection;h&&f.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(u,d)=>{var f;let h=(f=d.clipboardData)===null||f===void 0?void 0:f.getData("text/html");return s=d,o=!!h?.includes("data-pm-slice"),!1}}},appendTransaction:(u,d,f)=>{let h=u[0],p=h.getMeta("uiEvent")==="paste"&&!o,m=h.getMeta("uiEvent")==="drop"&&!i,y=h.getMeta("applyPasteRules"),g=!!y;if(!p&&!m&&!g)return;if(g){let{text:w}=y;typeof w=="string"?w=w:w=ET(M.from(w),f.schema);let{from:S}=y,C=S+w.length,x=hZ(w);return a({rule:c,state:f,from:S,to:{b:C},pasteEvt:x})}let v=d.doc.content.findDiffStart(f.doc.content),b=d.doc.content.findDiffEnd(f.doc.content);if(!(!eZ(v)||!b||v===b.b))return a({rule:c,state:f,from:v,to:b,pasteEvt:s})}}))}var Q0=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=e,this.baseExtensions=t,this.extensions=AB(t),this.hasSchemaSpec=e.options.schemaSpec!==void 0,this.schema=tQ(this.extensions,e,e.options.schemaSpec),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{let n=B(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:od(e.name,this.schema)});return n?{...t,...n()}:t},{})}get plugins(){let{editor:t}=this,e=Jh([...this.extensions].reverse()).flatMap(r=>{let o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:od(r.name,this.schema)},i=[],s=B(r,"addKeyboardShortcuts",o),l={};if(r.type==="mark"&&B(r,"exitable",o)&&(l.ArrowRight=()=>Lr.handleExit({editor:t,mark:r})),s){let f=Object.fromEntries(Object.entries(s()).map(([h,p])=>[h,()=>p({editor:t})]));l={...l,...f}}let a=BP(l);i.push(a);let c=B(r,"addInputRules",o);if(oB(r,t.options.enableInputRules)&&c){let f=c();if(f&&f.length){let h=uZ({editor:t,rules:f}),p=Array.isArray(h)?h:[h];i.push(...p)}}let u=B(r,"addPasteRules",o);if(oB(r,t.options.enablePasteRules)&&u){let f=u();if(f&&f.length){let h=pZ({editor:t,rules:f});i.push(...h)}}let d=B(r,"addProseMirrorPlugins",o);if(d){let f=d();i.push(...f)}return i}),n=this.createDecorationPlugin();return n&&e.push(n),e}createDecorationPlugin(){var t;let{editor:e}=this;(t=this.decorationManager)===null||t===void 0||t.destroy();let n=[];return this.extensions.forEach(r=>{let o=B(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:od(r.name,this.schema)});o&&n.push({name:r.name,addDecorations:o})}),this.decorationManager=new QQ({editor:e,entries:n}),this.decorationManager.plugin}get attributes(){let t=TT(this.extensions);return this.hasSchemaSpec?TB(t,this.schema):t}get nodeViews(){let{editor:t}=this,{nodeExtensions:e}=ud(this.extensions);return Object.fromEntries(e.filter(n=>!!B(n,"addNodeView")).map(n=>{let r=this.attributes.filter(l=>l.type===n.name),o=B(n,"addNodeView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Dt(n.name,this.schema)});if(!o)return[];let i=o();if(!i)return[];let s=(l,a,c,u,d)=>{let f=Sl(l,r);return i({node:l,view:a,getPos:c,decorations:u,innerDecorations:d,editor:t,extension:n,HTMLAttributes:f})};return[n.name,s]}))}dispatchTransaction(t){let{editor:e}=this;return Jh([...this.extensions].reverse()).reduceRight((n,r)=>{let o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:od(r.name,this.schema)},i=B(r,"dispatchTransaction",o);return i?s=>{i.call(o,{transaction:s,next:n})}:n},t)}transformPastedHTML(t){let{editor:e}=this;return Jh([...this.extensions]).reduce((n,r)=>{let o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:od(r.name,this.schema)},i=B(r,"transformPastedHTML",o);return i?(s,l)=>{let a=n(s,l);return i.call(o,a)}:n},t||(n=>n))}get markViews(){let{editor:t}=this,{markExtensions:e}=ud(this.extensions);return Object.fromEntries(e.filter(n=>!!B(n,"addMarkView")).map(n=>{let r=this.attributes.filter(s=>s.type===n.name),o=B(n,"addMarkView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Qi(n.name,this.schema)});if(!o)return[];let i=(s,l,a)=>{let c=Sl(s,r);return o()({mark:s,view:l,inline:a,editor:t,extension:n,HTMLAttributes:c,updateAttributes:u=>{iZ(s,t,u)}})};return[n.name,i]}))}destroy(){var t;(t=this.decorationManager)===null||t===void 0||t.destroy(),this.extensions.forEach(e=>{let n=e;for(;n.parent;){let r=n.parent;r.child===n&&(r.child=null),n=r}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){let t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{let n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:od(e.name,this.schema)};if(e.type==="mark"){var r,o;(!((r=ve(B(e,"keepOnSplit",n)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(e.name),!((o=ve(B(e,"clearable",n)))!==null&&o!==void 0)||o||this.nonClearableMarks.push(e.name)}let i=B(e,"onBeforeCreate",n),s=B(e,"onCreate",n),l=B(e,"onUpdate",n),a=B(e,"onSelectionUpdate",n),c=B(e,"onTransaction",n),u=B(e,"onFocus",n),d=B(e,"onBlur",n),f=B(e,"onDestroy",n);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};Q0.resolve=AB;Q0.sort=Jh;Q0.flatten=CT;var be=class GB extends DT{constructor(...e){super(...e),this.type="extension"}static create(e={}){let n=typeof e=="function"?e():e;return new GB(n)}configure(e){return super.configure(e)}extend(e){let n=typeof e=="function"?e():e;return super.extend(n)}},mZ=be.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new G({key:new le("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,i=RB(n),{blockSeparator:s}=this.options,l={...s!==void 0?{blockSeparator:s}:{},textSerializers:i};return[...o.ranges].sort((a,c)=>a.$from.pos-c.$from.pos).map(({$from:a,$to:c})=>MB(r,{from:a.pos,to:c.pos},l)).join(s??`
|
|
84
|
+
|
|
85
|
+
`)}}})]}}),gZ=be.create({name:"commands",addCommands(){return{...UQ}}}),yZ=be.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r;let o=()=>{var i,s,l;if((i=(s=this.editor.options.coreExtensionOptions)===null||s===void 0||(s=s.delete)===null||s===void 0||(l=s.filterTransaction)===null||l===void 0?void 0:l.call(s,t))!==null&&i!==void 0?i:t.getMeta("y-sync$"))return;let a=xT(t.before,[t,...e]);fd(a).forEach(u=>{a.mapping.mapResult(u.oldRange.from).deletedAfter&&a.mapping.mapResult(u.oldRange.to).deletedBefore&&a.before.nodesBetween(u.oldRange.from,u.oldRange.to,(d,f)=>{let h=f+d.nodeSize-2,p=u.oldRange.from<=f&&h<=u.oldRange.to;this.editor.emit("delete",{type:"node",node:d,from:f,to:h,newFrom:a.mapping.map(f),newTo:a.mapping.map(h),deletedRange:u.oldRange,newRange:u.newRange,partial:!p,editor:this.editor,transaction:t,combinedTransform:a})})});let c=a.mapping;a.steps.forEach((u,d)=>{if(u instanceof fl){var f,h;let p=c.slice(d).map(u.from,-1),m=c.slice(d).map(u.to),y=c.invert().map(p,-1),g=c.invert().map(m),v=p>0?(f=a.doc.nodeAt(p-1))===null||f===void 0?void 0:f.marks.some(w=>w.eq(u.mark)):!1,b=(h=a.doc.nodeAt(m))===null||h===void 0?void 0:h.marks.some(w=>w.eq(u.mark));this.editor.emit("delete",{type:"mark",mark:u.mark,from:u.from,to:u.to,deletedRange:{from:y,to:g},newRange:{from:p,to:m},partial:!!(b||v),editor:this.editor,transaction:t,combinedTransform:a})}})};!((n=(r=this.editor.options.coreExtensionOptions)===null||r===void 0||(r=r.delete)===null||r===void 0?void 0:r.async)!==null&&n!==void 0)||n?setTimeout(o,0):o()}}),vZ=be.create({name:"drop",addProseMirrorPlugins(){return[new G({key:new le("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),bZ=be.create({name:"editable",addProseMirrorPlugins(){return[new G({key:new le("editable"),props:{editable:()=>this.editor.options.editable}})]}}),wZ=new le("focusEvents"),SZ=be.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:t}=this;return[new G({key:wZ,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;let r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;let r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),xZ=be.create({name:"keymap",addKeyboardShortcuts(){let t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{let{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,y=d.pos-d.parentOffset,g=m&&p.parent.childCount===1?y===d.pos:H.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!g||g&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},i={...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 q0()||xB()?i:o},addProseMirrorPlugins(){return[new G({key:new le("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(h=>h.getMeta("composition")))return;let r=t.some(h=>h.docChanged)&&!e.doc.eq(n.doc),o=t.some(h=>h.getMeta("preventClearDocument"));if(!r||o)return;let{empty:i,from:s,to:l}=e.selection,a=H.atStart(e.doc).from,c=H.atEnd(e.doc).to;if(i||!(s===a&&l===c)||!hd(n.doc))return;let u=n.tr,d=K0({state:n,transaction:u}),{commands:f}=new ad({editor:this.editor,state:d});if(f.clearNodes(),!!u.steps.length)return u}})]}}),CZ=be.create({name:"paste",addProseMirrorPlugins(){return[new G({key:new le("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),EZ=be.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new G({key:new le("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!==null&&t!==void 0?t:"0"}}}})]}}),TZ=be.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:t}=ud(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new G({key:new le("textDirection"),props:{attributes:()=>{let t=this.options.direction;return t?{dir:t}:{}}}})]}});var fB=!1;function kZ(t){if(fB)return;fB=!0;let e;try{let n=ht.fromJSON(t,{from:0,to:0});if(!cQ(n))return;e=n.slice.content}catch{return}e instanceof M||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}var AZ=class Wh{get name(){return this.node.type.name}constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o}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\u2019t 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;let e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Wh(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 Wh(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 Wh(e,this.editor)}get children(){let e=[];return this.node.content.forEach((n,r)=>{let o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=n.isInline,l=this.pos+r+(i?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;let a=this.resolvedPos.doc.resolve(l);if(!o&&!s&&a.depth<=this.depth)return;let c=new Wh(a,this.editor,o,o||s?n:null);o&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){let i=o.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){let a=s[l];if(i[a]!==n[a])break}}else r=o;o=o.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;let i=Object.keys(n);return this.children.forEach(s=>{r&&o.length>0||(s.node.type.name===e&&i.every(l=>n[l]===s.node.attrs[l])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(e,n,r))))}),o}setAttribute(e){let{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},MZ=`.ProseMirror {
|
|
86
|
+
position: relative;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.ProseMirror {
|
|
90
|
+
word-wrap: break-word;
|
|
91
|
+
white-space: pre-wrap;
|
|
92
|
+
white-space: break-spaces;
|
|
93
|
+
-webkit-font-variant-ligatures: none;
|
|
94
|
+
font-variant-ligatures: none;
|
|
95
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.ProseMirror [contenteditable="false"] {
|
|
99
|
+
white-space: normal;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
103
|
+
white-space: pre-wrap;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.ProseMirror pre {
|
|
107
|
+
white-space: pre-wrap;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
img.ProseMirror-separator {
|
|
111
|
+
display: inline !important;
|
|
112
|
+
border: none !important;
|
|
113
|
+
margin: 0 !important;
|
|
114
|
+
width: 0 !important;
|
|
115
|
+
height: 0 !important;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.ProseMirror-gapcursor {
|
|
119
|
+
display: none;
|
|
120
|
+
pointer-events: none;
|
|
121
|
+
position: absolute;
|
|
122
|
+
margin: 0;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.ProseMirror-gapcursor:after {
|
|
126
|
+
content: "";
|
|
127
|
+
display: block;
|
|
128
|
+
position: absolute;
|
|
129
|
+
top: -2px;
|
|
130
|
+
width: 20px;
|
|
131
|
+
border-top: 1px solid black;
|
|
132
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@keyframes ProseMirror-cursor-blink {
|
|
136
|
+
to {
|
|
137
|
+
visibility: hidden;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.ProseMirror-hideselection *::selection {
|
|
142
|
+
background: transparent;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
146
|
+
background: transparent;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.ProseMirror-hideselection * {
|
|
150
|
+
caret-color: transparent;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
154
|
+
display: block;
|
|
155
|
+
}`,XB=class extends HQ{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:AT,createMappablePosition:uQ},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:o})=>this.options.onDrop(n,r,o)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),this.on("delete",this.options.onDelete);let e=this.createDoc();if(!this.editorState){let n=gT(e,this.options.autofocus);this.editorState=Ra.create({doc:e,schema:this.schema,selection:n||void 0})}kZ(this.schema),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;let t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():ad.createFakeChain()}can(){return this.commandManager?this.commandManager.can():ad.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=ZQ(MZ,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps({...this.options.editorProps,attributes:this.getEditorViewAttributes()}),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return PB&&!this.hasWarnedStaleDecorationRead&&BQ(this)&&(this.hasWarnedStaleDecorationRead=!0,console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")),this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){let n=vT(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;let e=this.state.plugins,n=e;if([].concat(t).forEach(o=>{let i=typeof o=="string"?`${o}$`:o.key;n=n.filter(s=>!s.key.startsWith(i))}),e.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;let n=[...this.options.enableCoreExtensions?[bZ,mZ.configure({blockSeparator:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),gZ,SZ,xZ,EZ.configure({value:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.tabindex)===null||e===void 0?void 0:e.value}),vZ,CZ,yZ,TZ.configure({direction:this.options.textDirection})].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new Q0(n,this)}createCommandManager(){this.commandManager=new ad({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=yT(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;let n=yT(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=Ra.create({doc:n,schema:this.schema,selection:gT(n,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return t}getEditorViewAttributes(){var t;let e=(t=this.options.editorProps)===null||t===void 0?void 0:t.attributes;return vT(e)?n=>({role:"textbox",...e(n)}):{role:"textbox",...e}}createView(t){let{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),o=n?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,s=this.extensionManager.transformPastedHTML(i);this.editorView=new $h(t,{...e,attributes:this.getEditorViewAttributes(),dispatchTransaction:o,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS();let a=this.view.dom;a.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;let e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)===null||u===void 0?void 0:u.step(c)});return}let{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),o=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!o)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});let s=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=s?.getMeta("focus"),a=s?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:s}),a&&this.emit("blur",{editor:this,event:a.event,transaction:s}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return kT(this.state,t)}isActive(t,e){let n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return lQ(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return ET(this.state.doc.content,this.schema)}getText(t){let{blockSeparator:e=`
|
|
156
|
+
|
|
157
|
+
`,textSerializers:n={}}=t||{};return nQ(this.state.doc,{blockSeparator:e,textSerializers:{...RB(this.schema),...n}})}get isEmpty(){return hd(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(t=(e=this.editorView)===null||e===void 0?void 0:e.isDestroyed)!==null&&t!==void 0?t:!0}$node(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(t,e))||null}$pos(t){let e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new AZ(e,this,!1,n)}get $doc(){return this.$pos(0)}};function io(t){return new pd({find:t.find,handler:({state:e,range:n,match:r})=>{let o=ve(t.getAttributes,void 0,r);if(o===!1||o===null)return null;let{tr:i}=e,s=r[r.length-1],l=r[0];if(s){let a=l.search(/\S/),c=n.from+l.indexOf(s),u=c+s.length;if(Qh(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(h=>h===t.type&&h!==f.mark.type)).filter(f=>f.to>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+a,c);let d=n.from+a+s.length;i.addMark(n.from+a,d,t.type.create(o||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function Z0(t){return new pd({find:t.find,handler:({state:e,range:n,match:r})=>{let o=ve(t.getAttributes,void 0,r)||{},{tr:i}=e,s=n.from,l=n.to,a=t.type.create(o);if(r[1]){let c=s+r[0].lastIndexOf(r[1]);c>l?c=l:l=c+r[1].length;let u=r[0][r[0].length-1];i.insertText(u,s+r[0].length-1),i.replaceWith(c,l,a)}else if(r[0]){let c=t.type.isInline?s:s-1;i.insert(c,t.type.create(o)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()},undoable:t.undoable})}function Zh(t){return new pd({find:t.find,handler:({state:e,range:n,match:r})=>{let o=e.doc.resolve(n.from),i=ve(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function xl(t){return new pd({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{let i=ve(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),a=l&&Gu(l,t.type,i);if(!a)return null;if(s.wrap(l,a),t.keepMarks&&t.editor){let{selection:u,storedMarks:d}=e,{splittableMarks:f}=t.editor.extensionManager,h=d||u.$to.parentOffset&&u.$from.marks();if(h){let p=h.filter(m=>f.includes(m.type.name));s.ensureMarks(p)}}if(t.keepAttributes){let u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(u,i).run()}let c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&xo(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)},undoable:t.undoable})}var RZ=t=>"touches"in t,WB=class{constructor(t){var e,n,r,o,i,s;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=l=>{if(!this.isResizing||!this.activeHandle)return;let a=l.clientX-this.startX,c=l.clientY-this.startY;this.handleResize(a,c)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;let a=l.touches[0];if(!a)return;let c=a.clientX-this.startX,u=a.clientY-this.startY;this.handleResize(c,u)},this.handleMouseUp=()=>{if(!this.isResizing)return;let l=this.element.offsetWidth,a=this.element.offsetHeight;this.onCommit(l,a),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!1)},this.node=t.node,this.editor=t.editor,this.element=t.element,this.element.draggable=!1,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,!((e=t.options)===null||e===void 0)&&e.min&&(this.minSize={...this.minSize,...t.options.min}),!((n=t.options)===null||n===void 0)&&n.max&&(this.maxSize=t.options.max),!(t==null||(r=t.options)===null||r===void 0)&&r.directions&&(this.directions=t.options.directions),!((o=t.options)===null||o===void 0)&&o.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),!((i=t.options)===null||i===void 0)&&i.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),!((s=t.options)===null||s===void 0)&&s.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!==null&&t!==void 0?t:null}handleEditorUpdate(){let t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){let t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){let e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){let n=e.includes("top"),r=e.includes("bottom"),o=e.includes("left"),i=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),o&&(t.style.left="0"),i&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){let t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,RZ(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:o}=this.calculateNewDimensions(this.activeHandle,t,e),i=this.applyConstraints(r,o,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,o=this.startHeight,i=t.includes("right"),s=t.includes("left"),l=t.includes("bottom"),a=t.includes("top");return i?r=this.startWidth+e:s&&(r=this.startWidth-e),l?o=this.startHeight+n:a&&(o=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(i?e:-e)),(t==="top"||t==="bottom")&&(o=this.startHeight+(l?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,o,t):{width:r,height:o}}applyConstraints(t,e,n){var r,o;if(!n){var i,s;let c=Math.max(this.minSize.width,t),u=Math.max(this.minSize.height,e);return!((i=this.maxSize)===null||i===void 0)&&i.width&&(c=Math.min(this.maxSize.width,c)),!((s=this.maxSize)===null||s===void 0)&&s.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let l=t,a=e;return l<this.minSize.width&&(l=this.minSize.width,a=l/this.aspectRatio),a<this.minSize.height&&(a=this.minSize.height,l=a*this.aspectRatio),!((r=this.maxSize)===null||r===void 0)&&r.width&&l>this.maxSize.width&&(l=this.maxSize.width,a=l/this.aspectRatio),!((o=this.maxSize)===null||o===void 0)&&o.height&&a>this.maxSize.height&&(a=this.maxSize.height,l=a*this.aspectRatio),{width:l,height:a}}applyAspectRatio(t,e,n){let r=n==="left"||n==="right",o=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:o?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};var Ie=class JB extends DT{constructor(...e){super(...e),this.type="node"}static create(e={}){let n=typeof e=="function"?e():e;return new JB(n)}configure(e){return super.configure(e)}extend(e){let n=typeof e=="function"?e():e;return super.extend(n)}};function zr(t){return new NT({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{let i=ve(t.getAttributes,void 0,r,o);if(i===!1||i===null)return null;let{tr:s}=e,l=r[r.length-1],a=r[0],c=n.to;if(l){let u=a.search(/\S/),d=n.from+a.indexOf(l),f=d+l.length;if(Qh(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(p=>p===t.type&&p!==h.mark.type)).filter(h=>h.to>d).length)return null;f<n.to&&s.delete(f,n.to),d>n.from&&s.delete(n.from+u,d),c=n.from+u+l.length,s.addMark(n.from+u,c,t.type.create(i||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||s.removeStoredMark(t.type)}}})}var QB=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}};var ti=(t,e)=>t>>>e|t<<32-e,OZ=t=>ti(t,2)^ti(t,13)^ti(t,22),DZ=t=>ti(t,6)^ti(t,11)^ti(t,25),NZ=t=>ti(t,7)^ti(t,18)^t>>>3,_Z=t=>ti(t,17)^ti(t,19)^t>>>10,IZ=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]),LZ=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),_T=class{constructor(){let e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(LZ),this._W=new Uint32Array(e,64,64)}_updateHash(){let e=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=_Z(n[d-2])+n[d-7]+NZ(n[d-15])+n[d-16];let r=e[0],o=e[1],i=e[2],s=e[3],l=e[4],a=e[5],c=e[6],u=e[7];for(let d=0,f,h;d<64;d++)f=u+DZ(l)+(l&a^~l&c)+IZ[d]+n[d]>>>0,h=OZ(r)+(r&o^r&i^o&i)>>>0,u=c,c=a,a=l,l=s+f>>>0,s=i,i=o,o=r,r=f+h>>>0;e[0]+=r,e[1]+=o,e[2]+=i,e[3]+=s,e[4]+=l,e[5]+=a,e[6]+=c,e[7]+=u}digest(e){let n=0;for(;n+56<=e.length;){let s=0;for(;s<16&&n+3<e.length;s++)this._W[s]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,s,16);n<e.length;)this._W[s]|=e[n]<<(3-n%4)*8,n++;this._W[s]|=128<<(3-n%4)*8}this._updateHash()}let r=n%64!==0;this._W.fill(0,0,16);let o=0;for(;n<e.length;o++)for(let s=3;s>=0&&n<e.length;s--)this._W[o]|=e[n++]<<s*8;r||(this._W[o-(n%4===0?0:1)]|=128<<(3-n%4)*8),this._W[14]=e.byteLength/536870912,this._W[15]=e.byteLength*8,this._updateHash();let i=new Uint8Array(32);for(let s=0;s<this._H.length;s++)for(let l=0;l<4;l++)i[s*4+l]=this._H[s]>>>(3-l)*8;return i}},ZB=t=>new _T().digest(t);var UZ=/[\uD800-\uDBFF]/,PZ=/[\uDC00-\uDFFF]/,BZ=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&UZ.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&&PZ.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},e4=BZ;function Cl(t){if(!t||!(t.content instanceof tn))return null;let e=t.content.type;if(!(e instanceof ur||e instanceof Nr||e instanceof ul))throw new Error("Expected a Yjs XML type");return e}function ep(t){if(t===null)return null;if(!(t.parent instanceof Ze))throw new Error("Expected an integrated Yjs parent");let e=t.parent;if(!(e instanceof ur||e instanceof Nr||e instanceof ul))throw new Error("Expected a Yjs XML type");return e}var HZ=(t,e)=>{let n=null,r=null;return t._item===null?r=ji(t):n=K(t._item.id.client,t._item.id.clock),new Hi(n,r,e.id)},gd=(t,e,n)=>{if(t===0)return Sa(e,0,-1);let r=Cl(e._first);for(;r!==null&&e!==r;){if(r instanceof et){if(r._length>=t)return Sa(r,t,-1);if(t-=r._length,r._item!==null&&r._item.next!==null)r=Cl(r._item.next);else{do r=ep(r._item),t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:Cl(r._item.next))}}else{let s=n.get(r),l=s instanceof dr?s.nodeSize:0;if(r._first!==null&&t<l)r=Cl(r._first),t--;else{if(t===1&&r._length===0&&l>1)return new Hi(r._item===null?null:r._item.id,r._item===null?ji(r):null,null);if(t-=l,r._item!==null&&r._item.next!==null)r=Cl(r._item.next);else{var o;if(t===0){if(r=r._item===null?r:ep(r._item),r===null)throw ft();return new Hi(r._item===null?null:r._item.id,r._item===null?ji(r):null,null)}do{if(r=ep(r._item),r===null)throw ft();t--}while(r!==e&&((o=r._item)===null||o===void 0?void 0:o.next)===null);if(r!==e){var i;r=Cl((i=r._item)===null||i===void 0?void 0:i.next)}}}}if(r===null)throw ft();if(t===0&&r.constructor!==et&&r!==e){let s=r._item,l=ep(s);if(s===null||l===null)throw ft();return HZ(l,s)}}return Sa(e,e._length,-1)},jZ=(t,e)=>{if(!t.docChanged)return!1;if(t.doc.childCount!==e.childCount)return!0;for(let n of t.steps)if(n instanceof ht){if(n.from===0&&n.to===e.content.size)return!0;if(n.slice.content.size>0){let r=!1;if(n.slice.content.forEach(o=>{o.isBlock&&(r=!0)}),r)return!0}else if(n.to>n.from){let r=e.resolve(n.from),o=e.resolve(n.to);if(r.depth===0&&o.depth===0&&r.index()!==o.index())return!0}}return!1};function f4(t,e){if(t instanceof et)return t._length;let n=e.get(t);return n instanceof dr?n.nodeSize:null}function VZ(t,e,n){let r=0,o=t._first;for(;o!==null;){let i=Cl(o);if(i===e)break;let s=o.deleted;if(o=o.right,s)continue;if(i===null)return null;let l=f4(i,n);if(l===null)return null;r+=l}return r}function FZ(t,e,n){let r=0,o=0,i=t._first;for(;o<t._length&&o<e&&i!==null;){let s=i;if(i=i.right,s.deleted)continue;let l=Cl(s);if(l===null)return null;let a=f4(l,n);if(a===null)return null;o++,r+=a}return r}var $Z=(t,e,n)=>{var r;if(n===null)return!1;let o=zC(e,t);return o!==null&&o.type instanceof et&&e.item!==null&&((r=o.type._item)===null||r===void 0?void 0:r.deleted)===!0},BT=t=>{if(!t.doc)throw new Error("The Yjs fragment must belong to a document");let e=t._item?`item:${t._item.id.client}:${t._item.id.clock}`:`root:${ji(t)}`;return t.doc.getMap(`__tiptap_position_migrations:${e}`)},t4=new WeakMap,YZ=(t,e)=>{var n,r;let o=(n=e.item)!==null&&n!==void 0?n:e.type;if(!o)return[];let i;e.item||(i=e.assoc<0?"start":"end");let s=t4.get(t);if(!s||s.size!==t.size){let a=new Map;t.forEach(c=>c.transfers.forEach(u=>{var d;let f=(d=a.get(u.source.client))!==null&&d!==void 0?d:[];f.push({migration:c,transfer:u}),a.set(u.source.client,f)})),s={size:t.size,clients:a},t4.set(t,s)}let l=((r=s.clients.get(o.client))!==null&&r!==void 0?r:[]).filter(({transfer:a})=>a.source.boundary===i&&a.source.clock<=o.clock&&o.clock<a.source.clock+a.source.length);return l.filter(a=>!l.some(c=>c.migration!==a.migration&&c.migration.seen.some(([u,d])=>u===a.migration.client&&d>a.migration.clock)))},n4=(t,e,n)=>{var r,o;let{source:i,target:s}=t.transfer;return s?new Hi(s.boundary?K(s.client,s.clock):s.type,(r=s.tname)!==null&&r!==void 0?r:null,s.boundary?null:K(s.client,s.clock+e.clock-i.clock),(o=s.assoc)!==null&&o!==void 0?o:n):null},qZ=(t,e,n)=>{let r=n4(t[0],e,n);return!r||t.some(o=>{let i=n4(o,e,n);return!i||!Zy(r,i)})?null:r},r4=t=>{var e;let n=(e=t.item)!==null&&e!==void 0?e:t.type;if(!n)return null;let r=t.assoc<0?"start":"end";return t.item&&(r="item"),`${n.client}:${n.clock}:${r}`},LT=(t,e)=>{var n;let r=BT(t),o=new Set,i=e,s=(n=i.item)!==null&&n!==void 0?n:i.type;for(;s;){var l;let a=r4(i);if(o.has(a))return null;o.add(a);let c=YZ(r,i);if(c.length===0)return i;let u=qZ(c,s,i.assoc);if(!u)return null;if(r4(u)===a)return u;i=u,s=(l=u.item)!==null&&l!==void 0?l:u.type}return i},Ur=(t,e,n,r)=>{var o;let i=LT(e,n);if(!i)return null;n=i;let s=zC(n,t);if(s===null||s.type!==e&&!Iu(e,s.type._item))return null;let l=s.type,a=0;if(l.constructor===et)a=s.index;else if(!(!((o=l._item)===null||o===void 0)&&o.deleted)){let d=FZ(l,s.index,r);if(d===null)return null;a=d+1}for(;l!==e&&l._item!==null;){var c;let d=ep(l._item);if(d===null)return null;if(!((c=d._item)===null||c===void 0)&&c.deleted){l=d;continue}let f=VZ(d,l,r);if(f===null)return null;a+=f+1,l=d}let u=a-1;return $Z(t,n,u)?null:u},Ue=new le("y-sync"),rp=new le("y-undo"),ev=new le("yjs-cursor"),md=null;function KZ(){let t=md;md=null;let e=[];return t?.forEach((n,r)=>{n.forEach((o,i)=>e.push({view:r,key:i,value:o}))}),e}function h4(t=KZ(),e=!1){let n=!0;for(;t.length>0;){let{view:r,key:o,value:i}=t[0];try{let s=Ue.getState(r.state);s&&s.binding.prosemirrorView!==null&&r.dispatch(r.state.tr.setMeta(o,i))}catch(s){if(!(s instanceof RangeError))throw s;e&&n&&t.shift(),t.length>0&&Du(0,()=>h4(t,!0));return}n=!1,t.shift()}}function GZ(t,e,n){md===null&&(md=new Map,Du(0,h4));let r=md.get(t);r||(r=new Map,md.set(t,r)),r.set(e,n)}var XZ=(t,e,n)=>t!==e,WZ=t=>{let e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);let n=document.createElement("div");n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null);let r=document.createTextNode("\u2060"),o=document.createTextNode("\u2060");return e.insertBefore(r,null),e.insertBefore(n,null),e.insertBefore(o,null),e},JZ=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),QZ=/^#[0-9a-fA-F]{6}$/,ZZ=t=>typeof t.name=="string"&&typeof t.color=="string",o4=(t,e,n,r,o)=>{let i=Ue.getState(t);if(i==null||i.doc==null||i.binding==null)return ae.create(t.doc,[]);let s=i.doc,l=[];return i.snapshot!=null||i.prevSnapshot!=null||i.binding.mapping.size===0?ae.create(t.doc,[]):(e.getStates().forEach((a,c)=>{if(n(s.clientID,c,a)&&a&&a.cursor!=null){let u={...a.user};if(u.color==null?u.color="#ffa500":QZ.test(u.color)||console.warn("A user uses an unsupported color format",u),u.name==null&&(u.name=`User: ${c}`),!ZZ(u))return;let d=Ur(s,i.type,Vu(a.cursor.anchor),i.binding.mapping),f=Ur(s,i.type,Vu(a.cursor.head),i.binding.mapping);if(d!==null&&f!==null){let h=rr(t.doc.content.size-1,0);d=Rr(d,h),f=Rr(f,h),l.push(ot.widget(f,()=>r(u,c),{key:c+"",side:10}));let p=Rr(d,f),m=rr(d,f);l.push(ot.inline(p,m,o(u,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),ae.create(t.doc,l))},p4=(t,{awarenessStateFilter:e=XZ,cursorBuilder:n=WZ,selectionBuilder:r=JZ,getSelection:o=s=>s.selection}={},i="cursor")=>new G({key:ev,state:{init(s,l){return o4(l,t,e,n,r)},apply(s,l,a,c){let u=Ue.getState(c),d=s.getMeta(ev),f=u&&u.isChangeOrigin;return s.docChanged&&!f&&jZ(s,a.doc)?ae.empty:f||d&&d.awarenessUpdated?o4(c,t,e,n,r):s.docChanged?l.map(s.mapping,s.doc):l}},props:{decorations:s=>{var l;return(l=ev.getState(s))!==null&&l!==void 0?l:ae.empty}},view:s=>{let l=()=>{s.isDestroyed||GZ(s,ev,{awarenessUpdated:!0})},a=u=>{let d=Ue.getState(u.state);if(!d||!d.binding||d.binding.projectionError!==null)return;let f=t.getLocalState()||{};if(u.hasFocus()){let h=o(u.state),p=gd(h.anchor,d.type,d.binding.mapping),m=gd(h.head,d.type,d.binding.mapping);(f.cursor==null||!Zy(Vu(f.cursor.anchor),p)||!Zy(Vu(f.cursor.head),m))&&t.setLocalStateField(i,{anchor:p,head:m})}else f.cursor!=null&&Ur(d.doc,d.type,Vu(f.cursor.anchor),d.binding.mapping)!==null&&t.setLocalStateField(i,null)},c=()=>a(s);return t.on("change",l),s.dom.addEventListener("focusin",c),s.dom.addEventListener("focusout",c),{update:a,destroy:()=>{s.dom.removeEventListener("focusin",c),s.dom.removeEventListener("focusout",c),t.off("change",l),t.setLocalStateField(i,null)}}}});function Tl(t){let e=Ue.getState(t);if(!e)throw new Error("The editor requires ySyncPlugin");return e}var nv=(t,e)=>{var n;return e===void 0?!t.deleted:e.sv.has(t.id.client)&&((n=e.sv.get(t.id.client))!==null&&n!==void 0?n:0)>t.id.clock&&!wa(e.ds,t.id)},eee=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){let o=Zr();t.forEach(i=>o.add(i)),e=e.filter(i=>!o.has(i))}t.set(n,C3(e))}let r=t.get(n);if(!r)throw new Error("At least one snapshot color is required");return r},m4=(t,e)=>{if(t===e)return!0;let n=Object.keys(t);return n.length===Object.keys(e).length&&n.every(r=>t[r]===e[r])},tee=t=>{let e=t.type.spec.attrs||{};return Object.keys(t.attrs).some(n=>{let r=e[n];return r==null||!Object.prototype.hasOwnProperty.call(r,"default")||r.default!==t.attrs[n]})},HT=(t,e,n)=>{let r=0,o=0;for(;o<t.childCount;o++){let h=t.child(o);if(r+h.nodeSize>n)break;r+=h.nodeSize}if(o>=t.childCount)return null;let i=t.child(o),s=t.resolve(n),l=(h,p)=>{if(s.depth===0){let m=h+(n-r),y=h+1,g=h+p.nodeSize-1;return Math.max(y,Math.min(m,g))}if(s.depth>1){let m=HT(s.node(1),p,s.pos-s.start(1));return m===null?null:h+1+m}return p.isTextblock?h+1+Math.min(s.parentOffset,p.content.size):null},a=(h,p=!1)=>{let m=0;for(let w=0;w<=o;w++)h(t.child(w))&&m++;let y=0,g=-1,v=null,b=0;for(let w=0;w<e.childCount;w++){let S=e.child(w);h(S)&&(y++,y===m&&(g=b,v=S)),b+=S.nodeSize}return v===null||p&&(m!==1||y!==1)?null:l(g,v)},c=h=>h.type===i.type&&m4(h.attrs,i.attrs),u=i.textContent,d=a(h=>c(h)&&h.textContent===u);if(d!==null)return d;let f=a(h=>h.type===i.type&&h.textContent===u);if(f!==null)return f;if(!i.isTextblock||tee(i)){let h=a(c,!0);if(h!==null)return h}return a(h=>c(h)&&u!==""&&h.textContent!==""&&(u.startsWith(h.textContent)||h.textContent.startsWith(u)),!0)},nee=(t,e,n,r)=>{if(r===null)return!1;let o=t.resolve(n),i=e.resolve(r);if(!o.parent.isTextblock)return!1;if(!i.parent.isTextblock||o.parent.textContent!==i.parent.textContent||o.parentOffset!==0&&i.parentOffset===0)return!0;let s=o.parentOffset===0&&i.parentOffset===0,l=o.parentOffset!==i.parentOffset||o.parent.type!==i.parent.type||!m4(o.parent.attrs,i.parent.attrs);if(s||l){let a=HT(t,e,n);return a!==null&&a!==r}return!1},i4=(t,e,n,r)=>{if(n==null||n<0||n>e.content.size||!(r===null||n>1&&r<=1||nee(e,t,n,r)))return r;let o=HT(e,t,n);return o!==null?o:r},ree=(t,e,n,r)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new yn(t.doc));else if(e.type==="node"){let o=Ur(n.doc,n.type,e.anchor,n.mapping);o!==null&&t.setSelection(oee(t,o))}else if(e.type==="nodeRange"){let o=Ur(n.doc,n.type,e.anchor,n.mapping),i=Ur(n.doc,n.type,e.head,n.mapping),s=iee(t,o,i,e.depth);s!==null&&t.setSelection(s)}else{let o=Ur(n.doc,n.type,e.anchor,n.mapping),i=Ur(n.doc,n.type,e.head,n.mapping);r!=null&&(LT(n.type,e.anchor)===e.anchor&&(o=i4(t.doc,r,e.absAnchor,o)),LT(n.type,e.head)===e.head&&(i=i4(t.doc,r,e.absHead,i))),o===null&&(o=i),i===null&&(i=o),o!==null&&i!==null&&t.setSelection(L.between(t.doc.resolve(o),t.doc.resolve(i)))}},oee=(t,e)=>{let n=t.doc.resolve(e);return n.nodeAfter?j.create(t.doc,e):L.near(n)},iee=(t,e,n,r)=>{if(e===null||n===null)return null;let o=Math.min(Math.max(e,0),t.doc.content.size),i=Math.min(Math.max(n,0),t.doc.content.size);try{let s=H.fromJSON(t.doc,{type:"nodeRange",anchor:o,head:i,depth:r});return s.ranges.length?s:L.near(t.doc.resolve(o))}catch{return L.near(t.doc.resolve(o))}},zT=(t,e)=>{let n=e.selection,r=n.toJSON(),o=typeof r.type=="string"?r.type:"text";return{type:o,depth:o==="nodeRange"&&"depth"in n&&typeof n.depth=="number"?n.depth:void 0,anchor:gd(e.selection.anchor,t.type,t.mapping),head:gd(e.selection.head,t.type,t.mapping),absAnchor:e.selection.anchor,absHead:e.selection.head}},El=new WeakMap,see=/(.*)(--[a-zA-Z0-9+/=]{8})$/,g4=t=>{var e,n;return(e=(n=see.exec(t))===null||n===void 0?void 0:n[1])!==null&&e!==void 0?e:t},lee=(t,e)=>{let n=[];for(let r in t)n.push(e.mark(g4(r),t[r]));return n},aee=(t,e,n,r,o,i)=>t.toDelta(r,o,i).map(s=>e.text(s.insert,lee(s.attributes,e))),UT=(t,e,n,r,o,i)=>{var s;let l=n.mapping.get(t);if(l!==void 0&&!Array.isArray(l)&&((s=El.get(n.mapping))===null||s===void 0?void 0:s.get(t))===l)return l;let a=[],c=h=>{if(h instanceof Ce)a.push(UT(h,e,n,r,o,i));else if(h instanceof et)a.push(...aee(h,e,n,r,o,i));else throw new Error("Cannot project a Yjs XML hook")};r===void 0||o===void 0?t.toArray().forEach(c):BC(t,new Lu(o.ds,r.sv)).forEach(c);let u=t.getAttributes(r);r!==void 0&&t._item&&(nv(t._item,r)?nv(t._item,o)||(u.ychange=i?i("added",t._item.id):{type:"added"}):u.ychange=i?i("removed",t._item.id):{type:"removed"});let d=e.node(t.nodeName,u,a);l!==void 0&&!Array.isArray(l)&&l.eq(d)&&(d=l),n.mapping.set(t,d);let f=El.get(n.mapping);return f===void 0&&(f=new WeakMap,El.set(n.mapping,f)),f.set(t,d),d},s4=(t,e)=>{if(t.childCount>0&&!e.topNodeType.validContent(t))throw new RangeError("Shared content does not fit the document schema")},cee=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},uee=t=>U3(cee(ZB(B3(t)))),y4=(t,e)=>{let n={};return t.forEach(r=>{if(r.type.name!=="ychange"){let o=Dr(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[o?`${r.type.name}--${uee(r.toJSON())}`:r.type.name]=r.attrs}}),n},dee=(t,e)=>{let n=new et,r=t.map(o=>{var i;return{insert:(i=o.text)!==null&&i!==void 0?i:"",attributes:y4(o.marks,e)}});return n.applyDelta(r),e.mapping.set(n,t),n},vd=t=>{let e=t.content.content,n=[];for(let r=0;r<e.length;r++){let o=e[r];if(o.isText){let i=[];for(let s=e[r];r<e.length&&s.isText;s=e[++r])i.push(s);r--,n.push(i)}else n.push(o)}return n},tp=(t,e)=>t instanceof Array?dee(t,e):fee(t,e),fee=(t,e)=>{let n=new Ce(t.type.name);for(let r in t.attrs){let o=t.attrs[r];o!==null&&r!=="ychange"&&n.setAttribute(r,o)}return n.insert(0,vd(t).map(r=>tp(r,e))),e.mapping.set(n,t),n},l4=t=>typeof t=="object"&&t!==null,jT=(t,e)=>{let n=Object.keys(t).filter(o=>t[o]!==null),r=n.length===Object.keys(e).filter(o=>e[o]!==null).length;for(let o=0;o<n.length&&r;o++){let i=n[o],s=t[i],l=e[i];r=i==="ychange"||s===l||l4(s)&&l4(l)&&jT(s,l)}return r},VT=(t,e)=>{let n=t.toDelta();return n.length===e.length&&n.every((r,o)=>{var i;return r.insert===e[o].text&&Xx(r.attributes||{}).length===e[o].marks.length&&Object.entries((i=r.attributes)!==null&&i!==void 0?i:{}).every(([s,l])=>{let a=g4(s),c=e[o].marks.find(u=>u.type.name===a);return c?jT(l,c.attrs):!1})})},rv=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name,yd=(t,e)=>{if(t instanceof Ce&&!(e instanceof Array)&&rv(t,e)){let n=vd(e);return t._length===n.length&&jT(t.getAttributes(),e.attrs)&&t.toArray().every((r,o)=>yd(r,n[o]))}return t instanceof et&&e instanceof Array&&VT(t,e)},np=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),hee=(t,e,n)=>{let r=new Map;e.forEach((a,c)=>{r.has(a)||r.set(a,c)});let o=[];if(t.forEach((a,c)=>{let u=n.mapping.get(a),d=u===void 0?void 0:r.get(u);d!==void 0&&np(u,e[d])&&o.push({yIndex:c,pIndex:d,yChild:a})}),o.length===0)return[];let i=[],s=[];for(let a=0;a<o.length;a++){let c=0,u=s.length;for(;c<u;){let d=c+u>>1;o[s[d]].pIndex<o[a].pIndex?c=d+1:u=d}i[a]=c>0?s[c-1]:-1,s[c]=a}let l=[];for(let a=s[s.length-1];a!==-1;a=i[a])l.push(o[a]);return l.reverse()},pee=t=>{let e="",n=t._start,r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof _r?e+=n.content.str:n.content instanceof bt&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},FT=(t,e,n)=>{n.mapping.set(t,e);let{nAttrs:r,str:o}=pee(t),i=e.map(c=>{var u;return{insert:(u=c.text)!==null&&u!==void 0?u:"",attributes:Object.assign({},r,y4(c.marks,n))}}),{insert:s,remove:l,index:a}=e4(o,i.map(c=>c.insert).join(""));t.delete(a,l),t.insert(a,s),t.applyDelta(i.map(c=>({retain:c.insert.length,attributes:c.attributes})))},v4=(t,e,n,r,o)=>e instanceof et&&n instanceof Array?(VT(e,n)?r.mapping.set(e,n):FT(e,n,r),!0):e instanceof Ce&&!(n instanceof Array)&&rv(e,n)?(yd(e,n)?r.mapping.set(e,n):o(t,e,n,r),!0):!1,Va=(t,e)=>{var n;(e instanceof ur||e instanceof Nr||e instanceof ul)&&(t.delete(e),(n=El.get(t))===null||n===void 0||n.delete(e))},a4=(t,e,n,r)=>{n>0&&(t.slice(e,e+n).forEach(o=>Va(r.mapping,o)),t.delete(e,n))},c4=(t,e,n,r,o,i)=>{if(r<o){let s=[];for(let l=r;l<o;l++)s.push(tp(n[l],i));t.insert(e,s)}},u4=(t,e,n,r,o,i,s,l,a,c)=>{let u=Rr(i-o,l-s);for(let d=0;d<u;d++){let f=r[o+d],h=n[s+d];v4(t,f,h,a,c)||(a4(e,s+d,1,a),c4(e,s+d,n,s+d,s+d+1,a))}a4(e,s+u,i-o-u,a),c4(e,s+u,n,s+u,l,a)},mee=(t,e,n,r,o,i)=>{let s=hee(r,n,o);if(s.length<2||!s.some(c=>c.yIndex!==c.pIndex)||s.some(c=>{let u=n[c.pIndex];return!(c.yChild instanceof et&&u instanceof Array||c.yChild instanceof Ce&&!(u instanceof Array))}))return!1;let l=0,a=0;for(let c of s){u4(t,e,n,r,l,c.yIndex,a,c.pIndex,o,i);let u=n[c.pIndex];v4(t,c.yChild,u,o,i),l=c.yIndex+1,a=c.pIndex+1}return u4(t,e,n,r,l,r.length,a,n.length,o,i),!0},d4=(t,e,n)=>{let r=t.toArray(),o=vd(e),i=o.length,s=r.length,l=Rr(s,i),a=0,c=0,u=!1;for(;a<l;a++){let d=r[a],f=o[a];if(np(n.mapping.get(d),f))u=!0;else if(!yd(d,f))break}for(;a+c<l;c++){let d=r[s-c-1],f=o[i-c-1];if(np(n.mapping.get(d),f))u=!0;else if(!yd(d,f))break}return{equalityFactor:a+c,foundMappedChild:u}},tv=(t,e,n,r)=>{if(e instanceof Ce&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof Ce){let f=e.getAttributes(),h=n.attrs;for(let p in h){if(h[p]===null){e.removeAttribute(p);continue}f[p]!==h[p]&&p!=="ychange"&&e.setAttribute(p,h[p])}for(let p in f)h[p]===void 0&&e.removeAttribute(p)}let o=vd(n),i=o.length,s=e.toArray(),l=s.length,a=Rr(i,l),c=!1;if(t.transact(()=>{c=mee(t,e,o,s,r,tv)},Ue),c)return;let u=0,d=0;for(;u<a;u++){let f=s[u],h=o[u];if(!np(r.mapping.get(f),h)){if(!yd(f,h))break;r.mapping.set(f,h)}}for(;d+u+1<a;d++){let f=s[l-d-1],h=o[i-d-1];if(!np(r.mapping.get(f),h)){if(!yd(f,h))break;r.mapping.set(f,h)}}t.transact(()=>{for(;l-u-d>0&&i-u-d>0;){let p=s[u],m=o[u],y=s[l-d-1],g=o[i-d-1];if(p instanceof et&&m instanceof Array){VT(p,m)||FT(p,m,r),u+=1;continue}let v=p instanceof Ce&&rv(p,m),b=y instanceof Ce&&rv(y,g);if(v&&b&&p instanceof Ce&&y instanceof Ce&&!Array.isArray(m)&&!Array.isArray(g)){let w=d4(p,m,r),S=d4(y,g,r);w.foundMappedChild&&!S.foundMappedChild?b=!1:!w.foundMappedChild&&S.foundMappedChild||w.equalityFactor<S.equalityFactor?v=!1:b=!1}if(v&&p instanceof Ce&&!Array.isArray(m)){tv(t,p,m,r),u+=1;continue}if(b&&y instanceof Ce&&!Array.isArray(g)){tv(t,y,g,r),d+=1;continue}Va(r.mapping,e.get(u)),e.delete(u,1),e.insert(u,[tp(m,r)]),u+=1}let f=l-u-d;if(l===1&&i===0&&s[0]instanceof et?(Va(r.mapping,s[0]),s[0].delete(0,s[0].length)):f>0&&(e.slice(u,u+f).forEach(p=>Va(r.mapping,p)),e.delete(u,f)),u+d>=i)return;let h=[];for(let p=u;p<i-d;p++)h.push(tp(o[p],r));e.insert(u,h)},Ue)},ov=(t,e=0)=>{let n=[];if(!t._item)throw new Error("Position tracking requires integrated text");for(let r=t._start;r;r=r.right)if(!(r.deleted||!r.countable)){if(!(r.content instanceof _r))throw new Error("Position tracking requires string text content");for(let o=0;o<r.length;o+=1)n.push({client:r.id.client,clock:r.id.clock+o,text:r.content.str[o],type:t._item.id,position:e+n.length})}return n},gee=(t,e,n)=>{let r=[{current:-1,target:-1}];return t.forEach((o,i)=>{let s=e.get(`${o.client}:${o.clock}`);s!==void 0&&s>r[r.length-1].target&&r.push({current:i,target:s})}),r.push({current:t.length,target:n}),r},yee=(t,e,n,r,o)=>{let i=ov(t),s=new Map;for(let a=0;a<e.length;a+=1){let c=r.get(n+a);c&&s.set(`${c.client}:${c.clock}`,a)}let l=gee(i,s,e.length);for(let a=l.length-1;a>0;a-=1){let c=l[a-1],u=l[a],d=i.slice(c.current+1,u.current),f=e.slice(c.target+1,u.target);!d.some(h=>o.has(`${h.client}:${h.clock}`))&&d.map(h=>h.text).join("")===f||(t.delete(c.current+1,d.length),t.insert(c.current+1,f))}return ov(t,n)},vee=(t,e)=>!t.target||!e.target?t.target===e.target:t.target.client===e.target.client&&t.target.assoc===e.target.assoc&&t.target.boundary===e.target.boundary&&t.target.tname===e.target.tname&&t.target.clock+t.source.length===e.target.clock&&ar(t.target.type,e.target.type),bee=t=>{let e=[];return t.forEach(n=>{let r=e[e.length-1];if(r&&r.source.client===n.source.client&&r.source.boundary===n.source.boundary&&r.source.clock+r.source.length===n.source.clock&&vee(r,n)){r.source.length+=n.source.length;return}e.push({...n,source:{...n.source}})}),e},b4=(t,e)=>{let n=t.doc;if(!n||e.length===0)return;let r=lt(n.store,n.clientID);t.set(`${n.clientID}:${r}`,{version:1,client:n.clientID,clock:r,seen:[...Jy(Qy(n))],transfers:bee(e)})},wee=(t,e)=>{let n=new Map;t.forEach(o=>{var i;let s=`${o.type.client}:${o.type.clock}`,l=(i=n.get(s))!==null&&i!==void 0?i:[];l.push(o),n.set(s,l)});let r=[];return n.forEach(o=>{let i=o[0],s=o[o.length-1],l=i.position===null?void 0:e.get(i.position),a=s.position===null?void 0:e.get(s.position);(!l||!ar(i.type,l.type))&&r.push({source:{...i.type,length:1,boundary:"start"},target:l?{...l,assoc:0}:null}),(!a||!ar(s.type,a.type))&&r.push({source:{...i.type,length:1,boundary:"end"},target:a?{...a,assoc:-1}:null})}),r},See=(t,e,n,r)=>{let o=[];t.forEach(s=>{var l;let a=s.position===null?null:(l=e.get(s.position))!==null&&l!==void 0?l:null;a&&ar(s.id,a)||o.push({source:{...s.id,length:1},target:a})});let i=[...t,...r];for(let s of["start","end"]){let l=s==="start"?e:n;i.forEach(a=>{var c;let u=s==="start"?a.position:a.end,d=u===null?null:(c=l.get(u))!==null&&c!==void 0?c:null;d&&ar(a.id,d)||o.push({source:{...a.id,length:1,boundary:s},target:d?{client:d.client,clock:d.clock,type:null,boundary:s}:null})})}return o},xee=(t,e,n,r,o,i)=>{let s=t.get(e);if(!(s instanceof Ce)||!s._item)throw new Error("Position migration requires synchronized elements");let l=o.get(`${s._item.id.client}:${s._item.id.clock}`);if(l&&l.position!==r&&(Va(i.mapping,s),t.delete(e,1),s=tp(n,i),t.insert(e,[s])),!(s instanceof Ce)||!s._item)throw new Error("Position migration requires integrated elements");return s},Cee=(t,e,n,r)=>{let o=new Map(e.characters.map(f=>[f.position,f])),i=new Set(e.characters.map(f=>`${f.client}:${f.clock}`)),s=new Map,l=new Map(e.nodes.map(f=>[`${f.id.client}:${f.id.clock}`,f])),a=new Map,c=new Map,u=(f,h,p)=>{let m=f.toArray(),y=p;vd(h).forEach((g,v)=>{var b,w;let S=m[v];if(Array.isArray(g)){if(!(S instanceof et)||!S._item)throw new Error("Position migration requires integrated text");let k=g.map(z=>{var $;return($=z.text)!==null&&$!==void 0?$:""}).join(""),T=yee(S,k,y,o,i),_=S._item.id;T.forEach(z=>s.set(z.position,{client:z.client,clock:z.clock,type:_})),FT(S,g,n),y+=k.length;return}let C=xee(f,v,g,y,l,n),x=C._item.id,E={client:x.client,clock:x.clock,type:(b=(w=f._item)===null||w===void 0?void 0:w.id)!==null&&b!==void 0?b:null,...f._item?{}:{tname:ji(f)}};a.set(y,E),c.set(y+g.nodeSize-1,E),g.isLeaf||u(C,g,y+1),y+=g.nodeSize})};u(t,e.doc,0);let d=[];e.characters.forEach(f=>{var h;let p=f.position===null?null:(h=s.get(f.position))!==null&&h!==void 0?h:null;p&&ar(f,p)&&ar(f.type,p.type)||d.push({source:{client:f.client,clock:f.clock,length:1},target:p})}),d.push(...wee(e.characters,s)),d.push(...See(e.nodes,a,c,e.emptyTexts)),b4(r,d)},Eee=(t,e)=>{var n;let r=t.doc.content,o=0,i=0;for(;o<r.childCount&&o<e.childCount&&r.child(o)===e.child(o);)i+=r.child(o).nodeSize,o++;let s=r.childCount,l=e.childCount,a=0;for(;s>o&&l>o&&r.child(s-1)===e.child(l-1);)a+=r.child(s-1).nodeSize,s--,l--;if(o===s&&o===l)return t;let c=new N(e.cut(i,e.size-a),0,0),u=Aa(t.doc,i,r.size-a,c);return u!==null&&(!((n=u.apply(t.doc).doc)===null||n===void 0)&&n.content.eq(e))?t.step(u):t.replace(0,r.size,new N(e,0,0))},Tee=class{get projectionError(){return this._projectionError}constructor(t,e=new Map){if(this.prosemirrorView=null,this.mux=QB(),this.isOMark=new Map,this.beforeTransactionSelection=null,this._domSelectionInView=null,this.syncedDoc=null,this._projectionError=null,this.type=t,this.mapping=e,this._observeFunction=this._typeChanged.bind(this),t.doc===null)throw new Error("The Yjs fragment must belong to a document");this.doc=t.doc,this.beforeAllTransactions=()=>{this.projectionError===null&&this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=zT(this,this.view.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null}}get view(){if(!this.prosemirrorView)throw new Error("The binding has no editor view");return this.prosemirrorView}get _tr(){return this.view.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.view.hasFocus()?(th&&this._domSelectionInView===null&&(Du(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){let t=this.view.root,e="getSelection"in t&&typeof t.getSelection=="function"?t.getSelection():this.view.dom.ownerDocument.getSelection();if(e==null||e.anchorNode==null||e.focusNode==null)return!1;let n=this.view.dom.ownerDocument.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);let r=n.getBoundingClientRect(),o=Ui.documentElement;return r.bottom>=0&&r.right>=0&&r.left<=(window.innerWidth||o.clientWidth||0)&&r.top<=(window.innerHeight||o.clientHeight||0)}renderSnapshot(t,e){e||(e=e0(Xy(),new Map)),this.view.dispatch(this._tr.setMeta(Ue,{snapshot:t,prevSnapshot:e}))}createDocumentFragment(){try{let t=this.type.toArray().map(n=>{if(!(n instanceof Ce))throw Fn();return UT(n,this.view.state.schema,this)}),e=M.from(t);return s4(e,this.view.state.schema),this._projectionError=null,e}catch(t){return this.handleProjectionError(t),null}}handleProjectionError(t){this._projectionError=t instanceof Error?t:new Error("Cannot project shared content"),this.mapping.clear(),El.delete(this.mapping),this.beforeTransactionSelection=null,this.view.dispatch(this._tr.setMeta(Ue,{isChangeOrigin:!0}))}createDocumentTransaction(){let t=this.createDocumentFragment();return t===null?null:this._tr.replace(0,this.view.state.doc.content.size,new N(t,0,0))}unrenderSnapshot(){this.mapping.clear(),El.delete(this.mapping),this.mux(()=>{let t=this.createDocumentTransaction();t!==null&&(t.setMeta(Ue,{snapshot:null,prevSnapshot:null}),this.view.dispatch(t))})}_forceRerender(){this.mapping.clear(),El.delete(this.mapping),this.mux(()=>{let t=this.beforeTransactionSelection!==null?null:this.view.state.selection,e=this.createDocumentTransaction();if(e!==null){if(t){let n=Rr(rr(t.anchor,0),e.doc.content.size),r=Rr(rr(t.head,0),e.doc.content.size);e.setSelection(L.create(e.doc,n,r))}this.view.dispatch(e.setMeta(Ue,{isChangeOrigin:!0,binding:this}))}})}_renderSnapshot(t,e,n){var r;let o=this.doc,i=this.type;if(t||(t=t0(this.doc)),t instanceof Uint8Array||e instanceof Uint8Array){if(!(t instanceof Uint8Array)||!(e instanceof Uint8Array))throw ft();if(o=new cr({gc:!1}),wh(o,e),e=t0(o),wh(o,t),t=t0(o),i._item===null){let c=Array.from(this.doc.share.keys()).find(u=>Object.is(this.doc.share.get(u),i));i=o.getXmlFragment(c)}else{var s;let c=(s=o.store.clients.get(i._item.id.client))!==null&&s!==void 0?s:[],u=c[to(c,i._item.id.clock)];if(!(u instanceof xe&&u.content instanceof tn&&u.content.type instanceof ur))throw ft();i=u.content.type}}let l=t,a=(r=e)!==null&&r!==void 0?r:AL;this.mapping.clear(),El.delete(this.mapping),this.mux(()=>{try{o.transact(c=>{let u=n.permanentUserData;u&&u.dss.forEach(m=>{Pi(c,m,y=>{})});let d=(m,y)=>{let g=u?m==="added"?u.getUserByClientId(y.client):u.getUserByDeletedId(y):null;return{user:g,type:m,color:eee(n.colorMapping,n.colors,g)}},f=BC(i,new Lu(a.ds,l.sv)).map(m=>!(m instanceof Ce)||!m._item?null:!m._item.deleted||nv(m._item,l)||nv(m._item,a)?UT(m,this.view.state.schema,{mapping:new Map,isOMark:new Map},l,a,d):null).filter(m=>m!==null),h=M.from(f);s4(h,this.view.state.schema);let p=this._tr.replace(0,this.view.state.doc.content.size,new N(h,0,0));this._projectionError=null,this.view.dispatch(p.setMeta(Ue,{isChangeOrigin:!0}))},Ue)}catch(c){this.handleProjectionError(c)}})}_typeChanged(t,e){var n;if(this.prosemirrorView==null)return;let r=Tl(this.view.state);if(t.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}let o=e.origin instanceof zu,i=o?(n=e.origin.currStackItem)===null||n===void 0?void 0:n.meta.get(this):void 0,s=i||this.beforeTransactionSelection,l=i?void 0:this.view.state.doc;this.mux(()=>{let a=(d,f)=>Va(this.mapping,f);Pi(e,e.deleteSet,d=>{d instanceof xe&&d.content instanceof tn&&Va(this.mapping,d.content.type)}),e.changed.forEach(a),e.changedParentTypes.forEach(a);let c=this.createDocumentFragment();if(c===null)return;let u=Eee(this._tr,c);ree(u,s,this,l),u=u.setMeta(Ue,{isChangeOrigin:!0,isUndoRedoOperation:o}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&u.scrollIntoView(),this.view.dispatch(u)})}_prosemirrorChanged(t,e=null){let n=Tl(this.view.state);this.projectionError!==null||n.snapshot!=null||n.prevSnapshot!=null||this.doc.transact(()=>{tv(this.doc,this.type,t,this),e?.doc===t&&Cee(this.type,e,this,BT(this.type)),this.syncedDoc=t,this.beforeTransactionSelection=zT(this,this.view.state)},Ue)}initView(t){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=t,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))}},kee=(t,e)=>{let n=[],r=[],o=[];if(t.length===0)return{characters:n,nodes:r,emptyTexts:o};let i=(s,l,a)=>{let c=s.toArray(),u=vd(l),d=a;l.content.size===0&&c.forEach(f=>{f instanceof et&&f._item&&o.push({id:f._item.id,position:a-1,end:a})}),u.forEach((f,h)=>{let p=c[h];if(!Array.isArray(f)){if(!(p instanceof Ce)||!p._item)throw new Error("Position tracking requires synchronized editor content");r.push({id:p._item.id,position:d,end:d+f.nodeSize-1}),f.isLeaf||i(p,f,d+1),d+=f.nodeSize;return}if(!(p instanceof et))throw new Error("Position tracking requires synchronized editor text");let m=ov(p,d);n.push(...m),d+=m.length})};return i(t,e,0),{characters:n,nodes:r,emptyTexts:o}},Aee=(t,e,n,r)=>{let o=t.toJSON();if(o.stepType!=="replace"&&o.stepType!=="replaceAround"||r!==o.from&&r!==o.to-1)return!1;let i=e.nodeAt(o.from),s=n.nodeAt(o.from);return!i||!s||i.nodeSize!==o.to-o.from?!1:Mee(i,s)},Mee=(t,e)=>t.type===e.type&&t.content.eq(e.content)&&!t.sameMarkup(e),Ree=(t,e)=>{var n;let r=t.toJSON(),o=(n=r.slice)!==null&&n!==void 0?n:{content:[]};if(r.stepType!=="replace"||o.openStart>0||o.openEnd>0)return!1;let i=e.resolve(r.from),s=e.resolve(r.to);return o.content.every(l=>l.type==="text")&&i.parent.isTextblock&&i.sameParent(s)},Oee=t=>{let e=new Map;return t.descendants((n,r)=>{var o;let i=(o=e.get(n))!==null&&o!==void 0?o:[];i.push(r),e.set(n,i)}),e},Dee=(t,e,n,r)=>{var o;if(((o=r[n].get(t))===null||o===void 0?void 0:o.length)!==1)return null;for(let i=n+1;i<r.length;i+=1){let s=r[i].get(t);if(s?.length===1)return{position:s[0]+e,step:i}}return null},Nee=(t,e,n,r)=>{let o=n[e].resolve(t),i=[],s=n[e].nodeAt(t);s&&!s.isText&&i.push({node:s,offset:0});for(let l=o.depth;l>0;l-=1)i.push({node:o.node(l),offset:t-o.before(l)});for(let l of i){let a=Dee(l.node,l.offset,e,r);if(a)return a}return null},IT=(t,e,n,r)=>{for(let o=0;o<e.mapping.maps.length;o+=1){let i=e.mapping.maps[o],s=i.mapResult(t,1),l=i.mapResult(t+1,-1);if(!s.deleted&&!l.deleted&&l.pos===s.pos+1){t=s.pos;continue}if(Aee(e.steps[o],n[o],n[o+1],t))continue;let a=Nee(t,o,n,r);if(!a)return null;t=a.position,o=a.step-1}return t},_ee=(t,e,n)=>{let r=n?.doc===t.before&&n.doc!==e.syncedDoc?n:null;if(!t.docChanged||!e.prosemirrorView||!r&&t.steps.every((c,u)=>Ree(c,t.docs[u])))return r;let o=r??kee(e.type,t.before),i=[...t.docs,t.doc],s=i.map(Oee),l=o.characters.map(c=>({...c,position:c.position===null?null:IT(c.position,t,i,s)})),a=c=>({...c,position:c.position===null?null:IT(c.position,t,i,s),end:c.end===null?null:IT(c.end,t,i,s)});return{doc:t.doc,characters:l,nodes:o.nodes.map(a),emptyTexts:o.emptyTexts.map(a)}},Iee=[{light:"#ecd44433",dark:"#ecd444"}],w4=(t,{colors:e=Iee,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:o=()=>{},mapping:i}={})=>{let s=!1,l=new Tee(t,i);return new G({filterTransaction:a=>l.projectionError===null||!a.docChanged,props:{editable:a=>{let c=Tl(a);return l.projectionError===null&&c.snapshot==null&&c.prevSnapshot==null}},key:Ue,state:{init:(a,c)=>({type:t,doc:l.doc,binding:l,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r,positionMigration:null}),apply:(a,c)=>{var u;let d=a.getMeta(Ue);return d!==void 0&&(c=Object.assign({},c,d)),a.docChanged&&(c.addToHistory=a.getMeta("addToHistory")!==!1),c.isChangeOrigin=d!==void 0&&!!d.isChangeOrigin,c.isUndoRedoOperation=d!==void 0&&!!d.isChangeOrigin&&!!d.isUndoRedoOperation,c={...c,positionMigration:l.projectionError||c.isChangeOrigin||c.snapshot||c.prevSnapshot||d?.snapshot!==void 0||d?.prevSnapshot!==void 0?null:_ee(a,l,(u=c.positionMigration)!==null&&u!==void 0?u:null)},l.prosemirrorView===null||d===void 0||d.snapshot==null&&d.prevSnapshot==null||Du(0,()=>{if(l.prosemirrorView!=null){if(d.restore==null){l._renderSnapshot(d.snapshot,d.prevSnapshot,c);return}l._renderSnapshot(d.snapshot,d.snapshot,c),l.projectionError===null&&l.mux(()=>{let f=l.prosemirrorView;f&&(f.dispatch(l._tr.setMeta(Ue,{restore:!1,snapshot:null,prevSnapshot:null,isChangeOrigin:!0})),l._prosemirrorChanged(f.state.doc))})}}),c}},view:a=>(l.initView(a),i==null&&l._forceRerender(),o(),{update:()=>{let c=Tl(a.state);if(l.projectionError===null&&c.snapshot==null&&c.prevSnapshot==null){let u=a.state.doc.type.createAndFill();if(!u)throw new Error("The schema cannot create an empty document");if(s||a.state.doc.content.findDiffStart(u.content)!==null){if(s=!0,c.addToHistory===!1&&!c.isChangeOrigin){let d=rp.getState(a.state),f=d&&d.undoManager;f&&f.stopCapturing()}l.mux(()=>{c.doc.transact(d=>{var f;d.meta.set("addToHistory",c.addToHistory),l._prosemirrorChanged(a.state.doc,(f=c.positionMigration)!==null&&f!==void 0?f:null)},Ue)})}}},destroy:()=>{l.destroy()}})})};function PT(t){let e=rp.getState(t);if(!e)throw new Error("The editor requires yUndoPlugin");return e}var Lee=t=>{let e=new Map,n=r=>{r.toArray().forEach(o=>{if(o instanceof Ce){var i,s;let a=o._item.id;e.set(`${a.client}:${a.clock}`,{client:a.client,clock:a.clock,type:(i=(s=r._item)===null||s===void 0?void 0:s.id)!==null&&i!==void 0?i:null,...r._item?{}:{tname:ji(r)}}),n(o);return}if(!(o instanceof et)||!o._item)return;let l=o._item.id;ov(o).forEach(a=>{e.set(`${a.client}:${a.clock}`,{client:a.client,clock:a.clock,type:l})})})};return n(t),e},zee=(t,e)=>{let n=t.doc;if(!n)return;let r=Lee(t),o=new Map,i=new Map,s=(c,u)=>{var d,f;let h=`${c.client}:${c.clock}`,p=`${u.client}:${u.clock}`;o.set(h,c),o.set(p,u);let m=(d=i.get(h))!==null&&d!==void 0?d:new Set,y=(f=i.get(p))!==null&&f!==void 0?f:new Set;m.add(p),y.add(h),i.set(h,m),i.set(p,y)};e.forEach(c=>c.transfers.forEach(({source:u,target:d})=>{if(!(!d||u.boundary))for(let f=0;f<u.length;f+=1)s(K(u.client,u.clock+f),K(d.client,d.clock+f))})),n.store.clients.forEach(c=>c.forEach(u=>{if(!(!(u instanceof xe)||!u.redone)&&!(!(u.content instanceof _r)&&!(u.content instanceof tn)))for(let d=0;d<u.length;d+=1)s(K(u.id.client,u.id.clock+d),K(u.redone.client,u.redone.clock+d))}));let l=[],a=new Set;i.forEach((c,u)=>{if(a.has(u))return;let d=[u],f=[],h=[];for(;d.length>0;){var p;let m=d.pop();if(a.has(m))continue;a.add(m),f.push(m);let y=r.get(m);y&&h.push(y),d.push(...(p=i.get(m))!==null&&p!==void 0?p:[])}h.length===1&&f.forEach(m=>{if(r.has(m))return;let y=o.get(m);l.push({source:{client:y.client,clock:y.clock,length:1},target:h[0]});let g=ll(n.store,y);if(g.content instanceof tn&&g.content.type instanceof Ce)for(let v of["start","end"])l.push({source:{client:y.client,clock:y.clock,length:1,boundary:v},target:{client:h[0].client,clock:h[0].clock,type:null,boundary:v}})})}),b4(e,l)},Uee=(t,e,n)=>{let r=BT(t);if(r.size===0)return e[n]();let o=n==="undo"?"undoing":"redoing",i=null,s=({stackItem:l})=>{i=l};e.on("stack-item-popped",s);try{e.doc.transact(()=>{e[n](),e[o]=!0,e.currStackItem=i,i&&zee(t,r)},e)}finally{e.off("stack-item-popped",s),e[o]=!1,e.currStackItem=null}return i},S4=(t,e)=>{let n=Tl(t);if(n.binding.projectionError!==null||n.snapshot!=null||n.prevSnapshot!=null)return!1;let r=PT(t).undoManager;if(r!=null)return Uee(n.type,r,e),!0},x4=t=>S4(t,"undo"),C4=t=>S4(t,"redo"),Pee=new Set(["paragraph"]),Bee=(t,e)=>!(t instanceof xe)||!(t.content instanceof tn)||!(t.content.type instanceof Nr||t.content.type instanceof Ce&&e.has(t.content.type.nodeName))||t.content.type._length===0,E4=({protectedNodes:t=Pee,trackedOrigins:e=[],undoManager:n=null}={})=>new G({key:rp,state:{init:(r,o)=>{let i=Tl(o),s=new Set,l=n;if(!l){var a;let c=new Set(i.doc._observers.get("destroy"));l=new zu(i.type,{trackedOrigins:new Set([Ue,...e]),deleteFilter:u=>Bee(u,t),captureTransaction:u=>u.meta.get("addToHistory")!==!1}),((a=i.doc._observers.get("destroy"))!==null&&a!==void 0?a:new Set).forEach(u=>{c.has(u)||s.add(u)})}return{undoManager:l,prevSel:null,hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0,destroyListeners:s}},apply:(r,o,i,s)=>{let l=Tl(s).binding;return{...o,prevSel:l?zT(l,i):o.prevSel,hasUndoOps:o.undoManager.undoStack.length>0,hasRedoOps:o.undoManager.redoStack.length>0}}},view:r=>{let o=Tl(r.state),{undoManager:i,destroyListeners:s}=PT(r.state);return i.on("stack-item-added",({stackItem:l})=>{let a=o.binding;if(a){let c=i.undoing||i.redoing?a.beforeTransactionSelection:PT(r.state).prevSel;l.meta.set(a,c)}}),{destroy:()=>{i.destroy(),s.forEach(l=>i.doc.off("destroy",l)),s.clear()}}}});function T4(t){return!!t.getMeta(Ue)}function Hee(t,e){if(e===null)return 0;let n=A4(t);return Ur(n.doc,n.type,e,n.binding.mapping)||0}function k4(t,e){let n=A4(t);return gd(e,n.type,n.binding.mapping)}function A4(t){let e=Ue.getState(t);if(!e)throw new Error("Collaboration requires the Yjs sync plugin");return e}var sv=class M4 extends J0{constructor(e,n){super(e),this.yRelativePosition=n}static fromJSON(e){return new M4(e.position,e.yRelativePosition)}toJSON(){return{position:this.position,yRelativePosition:this.yRelativePosition}}};function jee(t,e){return new sv(t,k4(e,t))}function Vee(t,e,n){let r=t instanceof sv?t.yRelativePosition:null;if(T4(e)&&r)return{position:new sv(Hee(n,r),r),mapResult:null};let o=AT(t,e),i=o.position.position;return{position:new sv(i,r??k4(n,i)),mapResult:o.mapResult}}function iv(t){let e=rp.getState(t);if(!e)throw new Error("Collaboration requires the Yjs undo plugin");return e.undoManager}var Fee=be.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null,provider:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(t=>t.name==="undoRedo")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-undo-redo".')},onBeforeCreate(){this.editor.utils.getUpdatedPosition=(t,e)=>Vee(t,e,this.editor.state),this.editor.utils.createMappablePosition=t=>jee(t,this.editor.state)},addCommands(){return{undo:()=>({tr:t,state:e,dispatch:n})=>{var r;return t.setMeta("preventDispatch",!0),iv(e).undoStack.length===0?!1:n?(r=x4(e))!==null&&r!==void 0?r:!1:!0},redo:()=>({tr:t,state:e,dispatch:n})=>{var r;return t.setMeta("preventDispatch",!0),iv(e).redoStack.length===0?!1:n?(r=C4(e))!==null&&r!==void 0?r:!1:!0}}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){let t=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),e=E4(this.options.yUndoOptions),n=e.spec.view;e.spec.view=o=>{let i=iv(o.state);i.restore&&(i.restore(),i.restore=()=>{});let s=n?n(o):void 0;return{destroy:()=>{let l=i.trackedOrigins.has(i),a=i._observers;i.restore=()=>{l&&i.trackedOrigins.add(i),i.doc.on("afterTransaction",i.afterTransactionHandler),i._observers=a},s?.destroy&&s.destroy()}}};let r={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender};return[w4(t,r),e,new G({filterTransaction:(o,i)=>(o.getMeta("inputRule")&&iv(i).stopCapturing(),!0)}),this.editor.options.enableContentCheck&&new G({key:new le("filterInvalidContent"),filterTransaction:o=>{if(!T4(o))return!0;if(this.storage.isDisabled)return!1;if(!o.docChanged)return!0;try{return o.doc.check(),!0}catch(i){return this.storage.isDisabled=!0,this.editor.emit("contentError",{error:i,editor:this.editor,disableCollaboration:()=>{var s;(s=t.doc)===null||s===void 0||s.destroy()}}),!0}}})].filter(o=>o!==!1)}}),R4=Fee;var $ee=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Yee=Ie.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",ce(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,o,i,s;let l=(e=(n=t.attrs)===null||n===void 0?void 0:n.src)!==null&&e!==void 0?e:"",a=(r=(o=t.attrs)===null||o===void 0?void 0:o.alt)!==null&&r!==void 0?r:"",c=(i=(s=t.attrs)===null||s===void 0?void 0:s.title)!==null&&i!==void 0?i:"";return c?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;let{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,o=new Set(["src","width","height"]);return({node:i,getPos:s,HTMLAttributes:l,editor:a})=>{let c=document.createElement("img");c.draggable=!1;let u=ce(this.options.HTMLAttributes,l);Object.entries(u).forEach(([g,v])=>{if(v!=null)switch(g){case"src":case"width":case"height":break;default:c.setAttribute(g,v)}}),u.src!==null&&(c.src=u.src);let d={...l},f=g=>{if(typeof g=="string"&&g!==""){c.getAttribute("src")!==g&&(c.src=g);return}c.hasAttribute("src")&&c.removeAttribute("src"),c.src!==""&&(c.src="")};f(l.src);let h=g=>{if(g.type!==i.type)return!1;let v=a.extensionManager.attributes.filter(w=>w.type===g.type.name),b=Sl(g,v);return Object.keys(d).forEach(w=>{!o.has(w)&&!(w in b)&&c.removeAttribute(w)}),Object.entries(b).forEach(([w,S])=>{o.has(w)||(S!=null?c.setAttribute(w,S):c.removeAttribute(w))}),f(b.src),d=b,!0},p=new WB({element:c,editor:a,node:i,getPos:s,onResize:(g,v)=>{c.style.width=`${g}px`,c.style.height=`${v}px`},onCommit:(g,v)=>{let b=s();b!==void 0&&this.editor.chain().setNodeSelection(b).updateAttributes(this.name,{width:g,height:v}).run()},onUpdate:h,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),m=p.dom,y=()=>{m.style.visibility="",m.style.pointerEvents=""};return m.style.visibility="hidden",m.style.pointerEvents="none",c.complete&&c.naturalWidth>0?y():(c.onload=y,c.onerror=y),p}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[Z0({find:$ee,type:this.type,getAttributes:t=>{let[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),O4=Yee;var qee="listItem",D4="textStyle",N4=/^\s*([-+*])\s$/,$T=Ie.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",ce(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
158
|
+
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(qee,this.editor.getAttributes(D4)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=xl({find:N4,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=xl({find:N4,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(D4),editor:this.editor})),[t]}}),Kee=(t,e,n)=>{let{selection:r}=t;if(!r.empty)return null;let{$from:o}=r;if(!o.parent.isTextblock||o.parentOffset!==o.parent.content.size)return null;let i=-1;for(let h=o.depth;h>0;h-=1)if(o.node(h).type.name===e){i=h;break}if(i<0)return null;let s=o.node(i),l=o.index(i);if(l+1>=s.childCount)return null;let a=s.child(l+1);if(!n.includes(a.type.name))return null;let c=t.schema.nodes[e],u=!1;if(a.forEach(h=>{h.type===c&&h.childCount>1&&(u=!0)}),!u)return null;let d=t.doc.resolve(o.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(h=>{f.push(h)}),f.length===0?null:{listItemDepth:i,nestedList:d,nestedListPos:o.after(),insertPos:o.after(i),items:f}},Gee=(t,e,n,r)=>{let o=Kee(t,n,r);if(!o)return!1;let{selection:i}=t,{nestedList:s,nestedListPos:l,insertPos:a,items:c}=o,u=t.tr;u.delete(l,l+s.nodeSize);let d=u.mapping.map(a);return u.insert(d,M.from(c)),u.setSelection(i.map(u.doc,u.mapping)),e&&e(u),!0},Xee=(t,e,n)=>Gee(t.state,t.view.dispatch,e,n),j4=(t,e)=>be.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>Xee(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}}),V4=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],lv="abcdefghijklmnopqrstuvwxyz",F4=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function uv(t){let e=t,n="";for(let[r,o]of V4)for(;e>=r;)n+=o,e-=r;return n}function YT(t){return uv(t).toUpperCase()}function $4(t){let e=t.toLowerCase(),n=0,r=0;for(;n<e.length;){let o=!1;for(let[i,s]of V4)if(e.startsWith(s,n)){r+=i,n+=s.length,o=!0;break}if(!o)return 0}return r}function Wee(t){if(!/^[ivxlcdmIVXLCDM]+$/.test(t))return!1;let e=$4(t);return e<=0?!1:(t===t.toLowerCase()?uv(e):YT(e))===t}function Jee(t){let e=t.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){let n=e.charCodeAt(0)-97,r=e.charCodeAt(1)-97;return(n+1)*26+r+1}return 0}function av(t){if(t<=26)return lv[t-1];let e=Math.floor((t-1)/26)-1,n=(t-1)%26;return e<0?lv[n]:lv[e]+lv[n]}function dv(t){if(!(!t||/^\d+$/.test(t))){if(Wee(t))return t===t.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(t))return"a";if(/^[A-Z]{1,2}$/.test(t))return"A"}}function qT(t){if(/^\d+$/.test(t))return parseInt(t,10);let e=dv(t);if(e==="i"||e==="I")return $4(t);if(e==="a"||e==="A"){let r=Jee(t);return r>0?r:1}let n=parseInt(t,10);return Number.isNaN(n)?1:n}function Qee(t,e){if(t==="numeric")return String(e);switch(t){case"a":return av(e);case"A":return av(e).toUpperCase();case"i":return uv(e);case"I":return YT(e);default:return String(e)}}function Zee(t){var e;if(t.length===0)return!1;let n=(e=dv(t[0]))!==null&&e!==void 0?e:"numeric",r=qT(t[0]);if(r<1)return!1;for(let o=0;o<t.length;o++){let i=Qee(n,r+o);if(t[o]!==i)return!1}return!0}function ete(t){return{type:dv(t),start:qT(t)}}function tte(t){let{type:e,start:n}=ete(t),r={};return e&&(r.type=e),n!==1&&(r.start=n),r}function nte(t,e,n=". "){let r=e+1;if(!t||t==="1")return`${r}${n}`;switch(t){case"a":return`${av(r)}${n}`;case"A":return`${av(r).toUpperCase()}${n}`;case"i":return`${uv(r)}${n}`;case"I":return`${YT(r)}${n}`;default:return`${r}${n}`}}function rte(t){return!t[0]||t[0].type==="paragraph"?t:[{type:"paragraph",content:[]},...t]}function ote(t){var e,n;let r=(e=t.content)===null||e===void 0?void 0:e[0];return r?.type==="paragraph"&&!(!((n=r.content)===null||n===void 0)&&n.length)}var ite=" ",_4=1,ste=t=>{var e;return((e=t?.level)!==null&&e!==void 0?e:_4)>_4};function lte(t){var e,n;let r=(e=t.tokens)===null||e===void 0?void 0:e[0];return!!(t.text&&((n=t.tokens)===null||n===void 0?void 0:n.length)===1&&r?.type==="list"&&r.ordered&&r.raw===t.text)}function ate(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var KT=Ie.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",ce(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];let r=(n=e.parseBlockChildren)!==null&&n!==void 0?n:e.parseChildren,o=[];if(t.tokens&&t.tokens.length>0){if(lte(t))return{type:"listItem",content:[{type:"paragraph",content:ate(t.text||"",e)}]};let[s,...l]=t.tokens;if(s.type==="heading"){var i;return{type:"listItem",content:[{type:"paragraph",content:e.parseInline((i=s.tokens)!==null&&i!==void 0?i:[])},...l.length>0?r(l):[]]}}if(t.tokens.some(a=>a.type==="paragraph"))o=r(t.tokens);else if(s.type==="text"&&s.tokens&&s.tokens.length>0){if(o=[{type:"paragraph",content:e.parseInline(s.tokens)}],t.tokens.length>1){let a=r(t.tokens.slice(1));o.push(...a)}}else o=r(t.tokens)}return o.length===0&&(o=[{type:"paragraph",content:[]}]),{type:"listItem",content:rte(o)}},renderMarkdown:(t,e,n)=>{let r=s=>{if(s.parentType==="bulletList")return"- ";if(s.parentType==="orderedList"){var l,a;let c=((l=s.meta)===null||l===void 0||(l=l.parentAttrs)===null||l===void 0?void 0:l.start)||1;return nte((a=s.meta)===null||a===void 0||(a=a.parentAttrs)===null||a===void 0?void 0:a.type,c-1+(s.index||0),". ")}return"- "},o=OT(t,e,r,n,{alignNestedToPrefix:n?.parentType==="orderedList"});if(!ote(t)||!ste(n))return o;let i=r(n);return`${i}${ite}${o.slice(i.length)}`},addExtensions(){return[j4(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),GT=(t,e)=>{let{$from:n}=e.selection,r=Dt(t,e.schema),o=null,i=n.depth,s=n.pos,l=null;for(;i>0&&l===null;)o=n.node(i),o.type===r?l=i:(i-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},Y4=(t,e)=>{let n=GT(t,e);if(!n)return!1;let[,r]=OB(e,t,n.$pos.pos+4);return r},cte=(t,e,n)=>{let{$anchor:r}=t.selection,o=Math.max(0,r.pos-2),i=t.doc.resolve(o).node();return!(!i||!n.includes(i.type.name))},I4=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!ei(t.state,e)&&cte(t.state,e,n)){let{$anchor:i}=t.state.selection,s=t.state.doc.resolve(i.before()-1),l=[];s.node().descendants((u,d)=>{u.type.name===e&&l.push({node:u,pos:d})});let a=l.at(-1);if(!a)return!1;let c=t.state.doc.resolve(s.start()+a.pos+1);return t.chain().command(({tr:u})=>{let d=c.end();return u.delete(i.before(),i.after()).insert(d,i.parent),u.setSelection(L.create(u.doc,d+1)),!0}).command(({state:u,dispatch:d})=>(w0(u,d),!0)).run()}if(!ei(t.state,e)||!_B(t.state))return!1;let{$from:r}=t.state.selection,o=r.depth-1;return r.node(o).type!==t.schema.nodes[e]||r.index(o)!==0?!1:t.chain().liftListItem(e).run()},ute=(t,e)=>{let n=Y4(t,e),r=GT(t,e);return!r||!n?!1:n>r.depth},dte=(t,e)=>{let n=Y4(t,e),r=GT(t,e);return!r||!n?!1:n<r.depth},L4=(t,e)=>!ei(t.state,e)||!NB(t.state,e)||!t.state.selection.empty?!1:ute(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():dte(e,t.state)?t.commands.command(({state:n,dispatch:r})=>S0(n,r)):t.commands.joinItemForward(),fte=(t,e,n)=>{let{state:r}=t,{selection:o}=r;if(!o.empty)return!1;let{$from:i}=o;if(i.parentOffset!==0||!i.parent.isTextblock||ei(r,e))return!1;let s=DB(i);if(!s||!n.includes(s.type.name))return!1;let l=s.lastChild;if(!l||l.type.name!==e)return!1;let a=i.parent;if(!l.canReplace(l.childCount,l.childCount,M.from(a)))return!1;let c=i.before(),u=i.after(),d=c-2;return t.commands.command(({tr:f,dispatch:h})=>(h&&(f.delete(c,u).insert(d,M.from(a)),f.setSelection(L.create(f.doc,d+1)),f.scrollIntoView()),!0))};var XT=be.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&L4(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&L4(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&I4(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&I4(t,n,r)&&(e=!0)}),e},Tab:({editor:t})=>{for(let{itemName:e,wrapperNames:n}of this.options.listTypes)if(t.state.schema.nodes[e]!==void 0&&fte(t,e,n))return!0;return!1}}}}),cv=new RegExp(`^(\\s*)(${F4})([.)])\\s+(.*)$`),hte=/^\s/,bd={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function pte(t){return cv.test(t.trimStart())}function mte(t){let e=t.trimStart();return bd.bulletItem.test(e)||pte(e)||bd.heading.test(e)||bd.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||bd.codeFence.test(e)||bd.blockMath.test(e)}function gte(t){return Object.values(bd).some(e=>e.test(t))}function yte(t){let e=[],n=[],r=!1;return t.forEach(o=>{if(r){n.push(o);return}if(o.trim()===""){r=!0,n.push(o);return}if(e.length>0&&mte(o)){r=!0,n.push(o);return}e.push(o)}),{paragraphLines:e,blockLines:n}}function z4(t){let e=[],n=0,r=0;for(;n<t.length;){let o=t[n],i=o.match(cv);if(!i)break;let[,s,l,a,c]=i,u=s.length,d=parseInt(l,10),f=isNaN(d)?dv(l):void 0,h=isNaN(d)?qT(l):d,p=[c],m=n+1,y=[o],g=!1;for(;m<t.length;){let v=t[m];if(v.match(cv))break;if(v.trim()==="")y.push(v),p.push(""),g=!0,m+=1;else if(v.match(hte)){let b=v.length-v.trimStart().length,w=u+l.length+1;y.push(v),p.push(v.slice(Math.min(b,w))),m+=1}else{if(g||gte(v))break;y.push(v),p.push(v),m+=1}}e.push({indent:u,number:h,type:f,content:p.join(`
|
|
159
|
+
`).trim(),contentLines:p,raw:y.join(`
|
|
160
|
+
`)}),r=m,n=m}return[e,r]}var vte=new RegExp(`^(${F4})([.)])\\s+(.+)$`);function bte(t){let e=t.split(`
|
|
161
|
+
`).filter(r=>r.trim().length>0);if(e.length===0)return null;let n=[];for(let r of e){let o=r.trim().match(vte);if(!o)return null;n.push({marker:o[1],content:o[3]})}return Zee(n.map(r=>r.marker))?{type:"orderedList",attrs:tte(n[0].marker),content:n.map(r=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:r.content}]}]}))}:null}function q4(t,e,n){let r=[],o=0;for(;o<t.length;){let i=t[o];if(i.indent===e){let{paragraphLines:s,blockLines:l}=yte(i.contentLines),a=s.join(`
|
|
162
|
+
`).trim(),c=[];a&&c.push({type:"paragraph",raw:a,tokens:n.inlineTokens(a)});let u=l.join(`
|
|
163
|
+
`).trim();if(u){let h=n.blockTokens(u);c.push(...h)}let d=o+1,f=[];for(;d<t.length&&t[d].indent>e;)f.push(t[d]),d+=1;if(f.length>0){let h=q4(f,Math.min(...f.map(p=>p.indent)),n);c.push({type:"list",ordered:!0,start:f[0].number,typeMarker:f[0].type,items:h,raw:f.map(p=>p.raw).join(`
|
|
164
|
+
`)})}r.push({type:"list_item",raw:i.raw,tokens:c}),o=d}else o+=1}return r}function wte(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];let r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(o=>{if(o.type==="paragraph"||o.type==="list"||o.type==="blockquote"||o.type==="code")r.push(...e.parseChildren([o]));else if(o.type==="text"&&o.tokens){let i=e.parseChildren([o]);r.push({type:"paragraph",content:i})}else{let i=e.parseChildren([o]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var Ste=64;function U4(t,e){let n=[],r=0;for(;n.length<e;){let o=t.indexOf(`
|
|
165
|
+
`,r);if(o===-1)return n.push(t.slice(r)),n;n.push(t.slice(r,o)),r=o+1}return n}function xte(t){let e=t.indexOf(`
|
|
166
|
+
`),n=e===-1?t:t.slice(0,e);if(!cv.test(n))return[[],0,[]];let r=Ste,o=U4(t,r),i=z4(o);for(;i[1]===o.length&&o.length===r;)r*=2,o=U4(t,r),i=z4(o);return[i[0],i[1],o]}var Cte="listItem",P4="textStyle",B4=/^(\d+)\.\s$/;function H4(t){let e=t.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}var WT=Ie.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=>{let e=t.getAttribute("type");if(e)return e;let n=t.getAttribute("style");if(n){let o=H4(n);if(o)return o}let r=t.querySelector("li");if(r){let o=r.getAttribute("style");if(o){let i=H4(o);if(i)return i}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){let{start:e,type:n,...r}=t,o=ce(this.options.HTMLAttributes,r);return e!==1&&(o.start=e),n&&n!=="1"&&(o.type=n),["ol",o,0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];let n=t.start||1,r=t.typeMarker,o=t.items?wte(t.items,e):[],i={};return n!==1&&(i.start=n),r&&(i.type=r),Object.keys(i).length>0?{type:"orderedList",attrs:i,content:o}:{type:"orderedList",content:o}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
167
|
+
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(t,e,n)=>{var r,o;let[i,s,l]=xte(t);if(i.length===0)return;let a=q4(i,i[0].indent,n);if(a.length!==0)return{type:"list",ordered:!0,start:((r=i[0])===null||r===void 0?void 0:r.number)||1,typeMarker:(o=i[0])===null||o===void 0?void 0:o.type,items:a,raw:l.slice(0,s).join(`
|
|
168
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Cte,this.editor.getAttributes(P4)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new G({props:{handlePaste:(t,e)=>{var n,r;let o=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/html");if(o?.trim())return!1;let i=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!i)return!1;let s=bte(i);if(!s)return!1;try{let l=t.state.schema.nodeFromJSON(s),a=t.state.tr.replaceSelectionWith(l);return t.dispatch(a),!0}catch{return!1}}}})]},addInputRules(){let t=(n,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+n[1],e=xl({find:B4,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=xl({find:B4,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(P4)}),joinPredicate:t,editor:this.editor})),[e]}}),Ete=/^\s*(\[([( |x])?\])\s$/,Tte="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",kte=(t,e,n)=>{var r;return(n==null||(r=n.checkboxLabel)===null||r===void 0?void 0:r.call(n,t,e))||`Task item checkbox for ${t.textContent||"empty task item"}`},JT=Ie.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{let e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:t=>{var e;return(e=t.querySelector("div"))!==null&&e!==void 0?e:t}}]},renderHTML({node:t,HTMLAttributes:e}){return["li",ce(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{let n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){let r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;let r=`- [${!((n=t.attrs)===null||n===void 0)&&n.checked?"x":" "}] `;return OT(t,e,r,void 0,{indentMainContent:!0})},addExtensions(){return this.options.nested?[j4(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{let o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div");s.style.cssText=Tte;let c=d=>{let f=kte(d,d.attrs.checked,this.options.a11y);l.setAttribute("aria-label",f),s.textContent=f};c(t),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}let{checked:f}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{let p=n();if(typeof p!="number")return!1;let m=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...m?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{o.setAttribute(d,f)}),o.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,s),o.append(i,a),Object.entries(e).forEach(([d,f])=>{o.setAttribute(d,f)});let u=new Set(Object.keys(e));return{dom:o,contentDOM:a,update:d=>{if(d.type!==this.type)return!1;o.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,c(d);let f=r.extensionManager.attributes,h=Sl(d,f),p=new Set(Object.keys(h)),m=this.options.HTMLAttributes;return u.forEach(y=>{p.has(y)||(y in m?o.setAttribute(y,m[y]):o.removeAttribute(y))}),Object.entries(h).forEach(([y,g])=>{g==null?y in m?o.setAttribute(y,m[y]):o.removeAttribute(y):o.setAttribute(y,g)}),u=p,!0}}}},addInputRules(){return[xl({find:Ete,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),QT=Ie.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",ce(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
169
|
+
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;let n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))===null||e===void 0?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){let r=i=>{let s=RT(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);if(s){let l={type:"taskList",raw:s.raw,items:s.items},a=i.slice(s.raw.length);return a.trim()?[l,...n.blockTokens(a)]:[l]}return n.blockTokens(i)},o=RT(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),qle=be.create({name:"listKit",addExtensions(){let t=[];return this.options.bulletList!==!1&&t.push($T.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(KT.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(XT.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(WT.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(JT.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(QT.configure(this.options.taskList)),t}});var ek,tk;if(typeof WeakMap<"u"){let t=new WeakMap;ek=e=>t.get(e),tk=(e,n)=>(t.set(e,n),n)}else{let t=[],n=0;ek=r=>{for(let o=0;o<t.length;o+=2)if(t[o]==r)return t[o+1]},tk=(r,o)=>(n==10&&(n=0),t[n++]=r,t[n++]=o)}var pt=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){let n=this.map[e];if(n!=t)continue;let r=e%this.width,o=e/this.width|0,i=r+1,s=o+1;for(let l=1;i<this.width&&this.map[e+l]==n;l++)i++;for(let l=1;s<this.height&&this.map[e+this.width*l]==n;l++)s++;return{left:r,top:o,right:i,bottom:s}}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){let{left:r,right:o,top:i,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?r==0:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?i==0:s==this.height)?null:this.map[r+this.width*(n<0?i-1:s)]}rectBetween(t,e){let{left:n,right:r,top:o,bottom:i}=this.findCell(t),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(o,a),right:Math.max(r,l),bottom:Math.max(i,c)}}cellsInRect(t){let e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let o=t.left;o<t.right;o++){let i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,!(o==t.left&&o&&this.map[i-1]==s||r==t.top&&r&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let r=0,o=0;;r++){let i=o+n.child(r).nodeSize;if(r==t){let s=e+t*this.width,l=(t+1)*this.width;for(;s<l&&this.map[s]<o;)s++;return s==l?i-1:this.map[s]}o=i}}static get(t){return ek(t)||tk(t,Ate(t))}};function Ate(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);let e=Mte(t),n=t.childCount,r=[],o=0,i=null,s=[];for(let c=0,u=e*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){let d=t.child(c);u++;for(let p=0;;p++){for(;o<r.length&&r[o]!=0;)o++;if(p==d.childCount)break;let m=d.child(p),{colspan:y,rowspan:g,colwidth:v}=m.attrs;for(let b=0;b<g;b++){if(b+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:g-b});break}let w=o+b*e;for(let S=0;S<y;S++){r[w+S]==0?r[w+S]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:y-S});let C=v&&v[S];if(C){let x=(w+S)%e*2,E=s[x];E==null||E!=C&&s[x+1]==1?(s[x]=C,s[x+1]=1):E==C&&s[x+1]++}}}o+=y,u+=m.nodeSize}let f=(c+1)*e,h=0;for(;o<f;)r[o++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:c,n:h}),u++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});let l=new pt(e,n,r,i),a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<n&&(a=!0);return a&&Rte(l,s,t),l}function Mte(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){let o=t.child(r),i=0;if(n)for(let s=0;s<r;s++){let l=t.child(s);for(let a=0;a<l.childCount;a++){let c=l.child(a);s+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let s=0;s<o.childCount;s++){let l=o.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function Rte(t,e,n){t.problems||(t.problems=[]);let r={};for(let o=0;o<t.map.length;o++){let i=t.map[o];if(r[i])continue;r[i]=!0;let s=n.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null,a=s.attrs;for(let c=0;c<a.colspan;c++){let u=e[(o+c)%t.width*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=Ote(a)))[c]=u)}l&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function Ote(t){if(t.colwidth)return t.colwidth.slice();let e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function _n(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(let n in t.nodes){let r=t.nodes[n],o=r.spec.tableRole;o&&(e[o]=r)}}return e}var kl=new le("selectingCells");function Fa(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 Dte(t){for(let e=t.depth;e>0;e--){let n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function Eo(t){let 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 yv(t){let 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;let n=Fa(e.$head)||Nte(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Nte(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){let 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--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function nk(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function _te(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function ik(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function n5(t,e,n){let r=t.node(-1),o=pt.get(r),i=t.start(-1),s=o.nextCell(t.pos-i,e,n);return s==null?null:t.node(0).resolve(i+s)}function $a(t,e,n=1){let r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function r5(t,e,n=1){let r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<n;o++)r.colwidth.splice(e,0,0)}return r}function Ite(t,e,n){let r=_n(e.type.schema).header_cell;for(let o=0;o<t.height;o++)if(e.nodeAt(t.map[n+o*t.width]).type!=r)return!1;return!0}var $e=class Zi extends H{constructor(e,n=e){let r=e.node(-1),o=pt.get(r),i=e.start(-1),s=o.rectBetween(e.pos-i,n.pos-i),l=e.node(0),a=o.cellsInRect(s).filter(u=>u!=n.pos-i);a.unshift(n.pos-i);let c=a.map(u=>{let d=r.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);let f=i+u+1;return new Ju(l.resolve(f),l.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){let r=e.resolve(n.map(this.$anchorCell.pos)),o=e.resolve(n.map(this.$headCell.pos));if(nk(r)&&nk(o)&&ik(r,o)){let i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?Zi.rowSelection(r,o):i&&this.isColSelection()?Zi.colSelection(r,o):new Zi(r,o)}return L.between(r,o)}content(){let e=this.$anchorCell.node(-1),n=pt.get(e),r=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let a=o.top;a<o.bottom;a++){let c=[];for(let u=a*n.width+o.left,d=o.left;d<o.right;d++,u++){let f=n.map[u];if(i[f])continue;i[f]=!0;let h=n.findCell(f),p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);let m=o.left-h.left,y=h.right-o.right;if(m>0||y>0){let g=p.attrs;if(m>0&&(g=$a(g,0,m)),y>0&&(g=$a(g,g.colspan-y,y)),h.left<o.left){if(p=p.type.createAndFill(g),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(g)}`)}else p=p.type.create(g,p.content)}if(h.top<o.top||h.bottom>o.bottom){let g={...p.attrs,rowspan:Math.min(h.bottom,o.bottom)-Math.max(h.top,o.top)};h.top<o.top?p=p.type.createAndFill(g):p=p.type.create(g,p.content)}c.push(p)}s.push(e.child(a).copy(M.from(c)))}let l=this.isColSelection()&&this.isRowSelection()?e:s;return new N(M.from(l),1,1)}replace(e,n=N.empty){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:a}=o[s],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),s?N.empty:n)}let i=H.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new N(M.from(n),0,0))}forEachCell(e){let n=this.$anchorCell.node(-1),r=pt.get(n),o=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let s=0;s<i.length;s++)e(n.nodeAt(i[s]),o+i[s])}isColSelection(){let e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){let r=e.node(-1),o=pt.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(n.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+o.map[s.left])),l.bottom<o.height&&(n=a.resolve(i+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(i+o.map[l.left])),s.bottom<o.height&&(e=a.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new Zi(e,n)}isRowSelection(){let e=this.$anchorCell.node(-1),n=pt.get(e),r=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(o,i)>0)return!1;let s=o+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==n.width}eq(e){return e instanceof Zi&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){let r=e.node(-1),o=pt.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(n.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+o.map[s.top*o.width])),l.right<o.width&&(n=a.resolve(i+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(i+o.map[l.top*o.width])),s.right<o.width&&(e=a.resolve(i+o.map[o.width*(s.top+1)-1]))),new Zi(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Zi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Zi(e.resolve(n),e.resolve(r))}getBookmark(){return new Lte(this.$anchorCell.pos,this.$headCell.pos)}};$e.prototype.visible=!1;H.jsonID("cell",$e);var Lte=class o5{constructor(e,n){this.anchor=e,this.head=n}map(e){return new o5(e.map(this.anchor),e.map(this.head))}resolve(e){let 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&&ik(n,r)?new $e(n,r):H.near(r,1)}};function zte(t){if(!(t.selection instanceof $e))return null;let e=[];return t.selection.forEachCell((n,r)=>{e.push(ot.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ae.create(t.doc,e)}function Ute({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,o=t.depth;for(;o>=0&&!(t.after(o+1)<t.end(o));o--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(o).type.spec.tableRole)}function Pte({$from:t,$to:e}){let n,r;for(let o=t.depth;o>0;o--){let i=t.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let o=e.depth;o>0;o--){let i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function Bte(t,e,n){let r=(e||t).selection,o=(e||t).doc,i,s;if(r instanceof j&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=$e.create(o,r.from);else if(s=="row"){let l=o.resolve(r.from+1);i=$e.rowSelection(l,l)}else if(!n){let l=pt.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];i=$e.create(o,a+1,c)}}else r instanceof L&&Ute(r)?i=L.create(o,r.from):r instanceof L&&Pte(r)&&(i=L.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}var Hte=new le("fix-tables");function i5(t,e,n,r){let o=t.childCount,i=e.childCount;e:for(let s=0,l=0;s<i;s++){let a=e.child(s);for(let c=l,u=Math.min(o,s+3);c<u;c++)if(t.child(c)==a){l=c+1,n+=a.nodeSize;continue e}r(a,n),l<o&&t.child(l).sameMarkup(a)?i5(t.child(l),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function sk(t,e){let n,r=(o,i)=>{o.type.spec.tableRole=="table"&&(n=jte(t,o,i,n))};return e?e.doc!=t.doc&&i5(e.doc,t.doc,0,r):t.doc.descendants(r),n}function jte(t,e,n,r){let o=pt.get(e);if(!o.problems)return r;r||(r=t.tr);let i=[];for(let a=0;a<o.height;a++)i.push(0);for(let a=0;a<o.problems.length;a++){let c=o.problems[a];if(c.type=="collision"){let u=e.nodeAt(c.pos);if(!u)continue;let d=u.attrs;for(let f=0;f<d.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,$a(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){let u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){let u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){let u=r.mapping.map(n);r.delete(u,u+e.nodeSize)}}let s,l;for(let a=0;a<i.length;a++)i[a]&&(s==null&&(s=a),l=a);for(let a=0,c=n+1;a<o.height;a++){let u=e.child(a),d=c+u.nodeSize,f=i[a];if(f>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);let p=[];for(let y=0;y<f;y++){let g=_n(t.schema)[h].createAndFill();g&&p.push(g)}let m=(a==0||s==a-1)&&l==a?c+1:d-1;r.insert(r.mapping.map(m),p)}c=d}return r.setMeta(Hte,{fixTables:!0})}function ni(t){let e=t.selection,n=yv(t),r=n.node(-1),o=n.start(-1),i=pt.get(r);return{...e instanceof $e?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function s5(t,{map:e,tableStart:n,table:r},o){let i=o>0?-1:0;Ite(e,r,o+i)&&(i=o==0||o==e.width?null:0);for(let s=0;s<e.height;s++){let l=s*e.width+o;if(o>0&&o<e.width&&e.map[l-1]==e.map[l]){let a=e.map[l],c=r.nodeAt(a);t.setNodeMarkup(t.mapping.map(n+a),null,r5(c.attrs,o-e.colCount(a))),s+=c.attrs.rowspan-1}else{let a=i==null?_n(r.type.schema).cell:r.nodeAt(e.map[l+i]).type,c=e.positionAt(s,o,r);t.insert(t.mapping.map(n+c),a.createAndFill())}}return t}function l5(t,e){if(!Eo(t))return!1;if(e){let n=ni(t);e(s5(t.tr,n,n.left))}return!0}function a5(t,e){if(!Eo(t))return!1;if(e){let n=ni(t);e(s5(t.tr,n,n.right))}return!0}function Vte(t,{map:e,table:n,tableStart:r},o){let i=t.mapping.maps.length;for(let s=0;s<e.height;){let l=s*e.width+o,a=e.map[l],c=n.nodeAt(a),u=c.attrs;if(o>0&&e.map[l-1]==a||o<e.width-1&&e.map[l+1]==a)t.setNodeMarkup(t.mapping.slice(i).map(r+a),null,$a(u,o-e.colCount(a)));else{let d=t.mapping.slice(i).map(r+a);t.delete(d,d+c.nodeSize)}s+=u.rowspan}}function c5(t,e){if(!Eo(t))return!1;if(e){let n=ni(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let o=n.right-1;Vte(r,n,o),o!=n.left;o--){let i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=pt.get(i)}e(r)}return!0}function Fte(t,e,n){var r;let o=_n(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if(((r=e.nodeAt(t.map[i+n*t.width]))===null||r===void 0?void 0:r.type)!=o)return!1;return!0}function u5(t,{map:e,tableStart:n,table:r},o){let i=n;for(let c=0;c<o;c++)i+=r.child(c).nodeSize;let s=[],l=o>0?-1:0;Fte(e,r,o+l)&&(l=o==0||o==e.height?null:0);for(let c=0,u=e.width*o;c<e.width;c++,u++)if(o>0&&o<e.height&&e.map[u]==e.map[u-e.width]){let d=e.map[u],f=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{var a;let d=l==null?_n(r.type.schema).cell:(a=r.nodeAt(e.map[u+l*e.width]))===null||a===void 0?void 0:a.type,f=d?.createAndFill();f&&s.push(f)}return t.insert(i,_n(r.type.schema).row.create(null,s)),t}function d5(t,e){if(!Eo(t))return!1;if(e){let n=ni(t);e(u5(t.tr,n,n.top))}return!0}function f5(t,e){if(!Eo(t))return!1;if(e){let n=ni(t);e(u5(t.tr,n,n.bottom))}return!0}function $te(t,{map:e,table:n,tableStart:r},o){let i=0;for(let c=0;c<o;c++)i+=n.child(c).nodeSize;let s=i+n.child(o).nodeSize,l=t.mapping.maps.length;t.delete(i+r,s+r);let a=new Set;for(let c=0,u=o*e.width;c<e.width;c++,u++){let d=e.map[u];if(!a.has(d)){if(a.add(d),o>0&&d==e.map[u-e.width]){let f=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(o<e.height&&d==e.map[u+e.width]){let f=n.nodeAt(d),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(o+1,c,n);t.insert(t.mapping.slice(l).map(r+m),p),c+=h.colspan-1}}}}function h5(t,e){if(!Eo(t))return!1;if(e){let n=ni(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let o=n.bottom-1;$te(r,n,o),o!=n.top;o--){let i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=pt.get(n.table)}e(r)}return!0}function K4(t){let e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function Yte({width:t,height:e,map:n},r){let o=r.top*t+r.left,i=o,s=(r.bottom-1)*t+r.left,l=o+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&n[i]==n[i-1]||r.right<t&&n[l]==n[l+1])return!0;i+=t,l+=t}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[o]==n[o-t]||r.bottom<e&&n[s]==n[s+t])return!0;o++,s++}return!1}function lk(t,e){let n=t.selection;if(!(n instanceof $e)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=ni(t),{map:o}=r;if(Yte(o,r))return!1;if(e){let i=t.tr,s={},l=M.empty,a,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){let f=o.map[u*o.width+d],h=r.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,a==null)a=f,c=h;else{K4(h)||(l=l.append(h.content));let p=i.mapping.map(f+r.tableStart);i.delete(p,p+h.nodeSize)}}if(a==null||c==null)return!0;if(i.setNodeMarkup(a+r.tableStart,null,{...r5(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){let u=a+1+c.content.size,d=K4(c)?a+1:u;i.replaceWith(d+r.tableStart,u+r.tableStart,l)}i.setSelection(new $e(i.doc.resolve(a+r.tableStart))),e(i)}return!0}function ak(t,e){let n=_n(t.schema);return qte(({node:r})=>n[r.type.spec.tableRole])(t,e)}function qte(t){return(e,n)=>{let r=e.selection,o,i;if(r instanceof $e){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;o=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var s;if(o=Dte(r.$from),!o)return!1;i=(s=Fa(r.$from))===null||s===void 0?void 0:s.pos}if(o==null||i==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(n){let l=o.attrs,a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});let u=ni(e),d=e.tr;for(let h=0;h<u.right-u.left;h++)a.push(c?{...l,colwidth:c&&c[h]?[c[h]]:null}:l);let f;for(let h=u.top;h<u.bottom;h++){let p=u.map.positionAt(h,u.left,u.table);h==u.top&&(p+=o.nodeSize);for(let m=u.left,y=0;m<u.right;m++,y++)m==u.left&&h==u.top||d.insert(f=d.mapping.map(p+u.tableStart,1),t({node:o,row:h,col:m}).createAndFill(a[y]))}d.setNodeMarkup(i,t({node:o,row:u.top,col:u.left}),a[0]),r instanceof $e&&d.setSelection(new $e(d.doc.resolve(r.$anchorCell.pos),f?d.doc.resolve(f):void 0)),n(d)}return!0}}function p5(t,e){return function(n,r){if(!Eo(n))return!1;let o=yv(n);if(o.nodeAfter.attrs[t]===e)return!1;if(r){let i=n.tr;n.selection instanceof $e?n.selection.forEachCell((s,l)=>{s.attrs[t]!==e&&i.setNodeMarkup(l,null,{...s.attrs,[t]:e})}):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[t]:e}),r(i)}return!0}}function Kte(t){return function(e,n){if(!Eo(e))return!1;if(n){let r=_n(e.schema),o=ni(e),i=e.tr,s=o.map.cellsInRect(t=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:t=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=s.map(a=>o.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[a],r.cell,l[a].attrs);if(i.steps.length===0)for(let a=0;a<s.length;a++)i.setNodeMarkup(o.tableStart+s[a],r.header_cell,l[a].attrs);n(i)}return!0}}function G4(t,e,n){let r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let o=0;o<r.length;o++){let i=e.table.nodeAt(r[o]);if(i&&i.type!==n.header_cell)return!1}return!0}function wd(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Kte(t):function(n,r){if(!Eo(n))return!1;if(r){let o=_n(n.schema),i=ni(n),s=n.tr,l=G4("row",i,o),a=G4("column",i,o),c=(t==="column"?l:t==="row"&&a)?1:0,u=t=="column"?{left:0,top:c,right:1,bottom:i.map.height}:t=="row"?{left:c,top:0,right:i.map.width,bottom:1}:i,d=t=="column"?a?o.cell:o.header_cell:t=="row"?l?o.cell:o.header_cell:o.cell;i.map.cellsInRect(u).forEach(f=>{let h=f+i.tableStart,p=s.doc.nodeAt(h);p&&s.setNodeMarkup(h,d,p.attrs)}),r(s)}return!0}}var Zle=wd("row",{useDeprecatedLogic:!0}),eae=wd("column",{useDeprecatedLogic:!0}),m5=wd("cell",{useDeprecatedLogic:!0});function Gte(t,e){if(e<0){let n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,o=t.before();r>=0;r--){let i=t.node(-1).child(r),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;let n=t.node(-1);for(let r=t.indexAfter(-1),o=t.after();r<n.childCount;r++){let i=n.child(r);if(i.childCount)return o+1;o+=i.nodeSize}}return null}function ck(t){return function(e,n){if(!Eo(e))return!1;let r=Gte(yv(e),t);if(r==null)return!1;if(n){let o=e.doc.resolve(r);n(e.tr.setSelection(L.between(o,_te(o))).scrollIntoView())}return!0}}function g5(t,e){let 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 fv(t,e){let n=t.selection;if(!(n instanceof $e))return!1;if(e){let r=t.tr,o=_n(t.schema).cell.createAndFill().content;n.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new N(o,0,0))}),r.docChanged&&e(r)}return!0}function Xte(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;let o=e.child(0),i=o.type.spec.tableRole,s=o.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content,u=a?0:Math.max(0,n-1),d=a<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=rk(_n(s).row,new N(c,u,d)).content),l.push(c)}else if(i=="cell"||i=="header_cell")l.push(n||r?rk(_n(s).row,new N(e,n,r)).content:e);else return null;return Wte(s,l)}function Wte(t,e){let n=[];for(let o=0;o<e.length;o++){let i=e[o];for(let s=i.childCount-1;s>=0;s--){let{rowspan:l,colspan:a}=i.child(s).attrs;for(let c=o;c<o+l;c++)n[c]=(n[c]||0)+a}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=e.length&&e.push(M.empty),n[o]<r){let i=_n(t).cell.createAndFill(),s=[];for(let l=n[o];l<r;l++)s.push(i);e[o]=e[o].append(M.from(s))}return{height:e.length,width:r,rows:e}}function rk(t,e){let n=t.createAndFill();return new hl(n).replace(0,n.content.size,e).doc}function Jte({width:t,height:e,rows:n},r,o){if(t!=r){let i=[],s=[];for(let l=0;l<n.length;l++){let a=n[l],c=[];for(let u=i[l]||0,d=0;u<r;d++){let f=a.child(d%a.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked($a(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)i[l+h]=(i[l+h]||0)+f.attrs.colspan}s.push(M.from(c))}n=s,t=r}if(e!=o){let i=[];for(let s=0,l=0;s<o;s++,l++){let a=[],c=n[l%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);s+d.attrs.rowspan>o&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,o-d.attrs.rowspan)},d.content)),a.push(d)}i.push(M.from(a))}n=i,e=o}return{width:t,height:e,rows:n}}function Qte(t,e,n,r,o,i,s){let l=t.doc.type.schema,a=_n(l),c,u;if(o>e.width)for(let d=0,f=0;d<e.height;d++){let h=n.child(d);f+=h.nodeSize;let p=[],m;h.lastChild==null||h.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=u||(u=a.header_cell.createAndFill());for(let y=e.width;y<o;y++)p.push(m);t.insert(t.mapping.slice(s).map(f-1+r),p)}if(i>e.height){let d=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,o);p++){let y=p>=e.width?!1:n.nodeAt(e.map[m+p]).type==a.header_cell;d.push(y?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}let f=a.row.create(null,M.from(d)),h=[];for(let p=e.height;p<i;p++)h.push(f);t.insert(t.mapping.slice(s).map(r+n.nodeSize-2),h)}return!!(c||u)}function X4(t,e,n,r,o,i,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=o;c<i;c++){let u=s*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){a=!0;let f=n.nodeAt(d),{top:h,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:s-h}),t.insert(t.mapping.slice(l).map(e.positionAt(s,p,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),c+=f.attrs.colspan-1}}return a}function W4(t,e,n,r,o,i,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=o;c<i;c++){let u=c*e.width+s,d=e.map[u];if(e.map[u-1]==d){a=!0;let f=n.nodeAt(d),h=e.colCount(d),p=t.mapping.slice(l).map(d+r);t.setNodeMarkup(p,null,$a(f.attrs,s-h,f.attrs.colspan-(s-h))),t.insert(p+f.nodeSize,f.type.createAndFill($a(f.attrs,0,s-h))),c+=f.attrs.rowspan-1}}return a}function J4(t,e,n,r,o){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let s=pt.get(i),{top:l,left:a}=r,c=a+o.width,u=l+o.height,d=t.tr,f=0;function h(){if(i=n?d.doc.nodeAt(n-1):d.doc,!i)throw new Error("No table found");s=pt.get(i),f=d.mapping.maps.length}Qte(d,s,i,n,c,u,f)&&h(),X4(d,s,i,n,a,c,l,f)&&h(),X4(d,s,i,n,a,c,u,f)&&h(),W4(d,s,i,n,l,u,a,f)&&h(),W4(d,s,i,n,l,u,c,f)&&h();for(let p=l;p<u;p++){let m=s.positionAt(p,a,i),y=s.positionAt(p,c,i);d.replace(d.mapping.slice(f).map(m+n),d.mapping.slice(f).map(y+n),new N(o.rows[p-l],0,0))}h(),d.setSelection(new $e(d.doc.resolve(n+s.positionAt(l,a,i)),d.doc.resolve(n+s.positionAt(u-1,c-1,i)))),e(d)}var Zte=Gh({ArrowLeft:hv("horiz",-1),ArrowRight:hv("horiz",1),ArrowUp:hv("vert",-1),ArrowDown:hv("vert",1),"Shift-ArrowLeft":pv("horiz",-1),"Shift-ArrowRight":pv("horiz",1),"Shift-ArrowUp":pv("vert",-1),"Shift-ArrowDown":pv("vert",1),Backspace:fv,"Mod-Backspace":fv,Delete:fv,"Mod-Delete":fv});function mv(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function hv(t,e){return(n,r,o)=>{if(!o)return!1;let i=n.selection;if(i instanceof $e)return mv(n,r,H.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;let s=y5(o,t,e);if(s==null)return!1;if(t=="horiz")return mv(n,r,H.near(n.doc.resolve(i.head+e),e));{let l=n.doc.resolve(s),a=n5(l,t,e),c;return a?c=H.near(a,1):e<0?c=H.near(n.doc.resolve(l.before(-1)),-1):c=H.near(n.doc.resolve(l.after(-1)),1),mv(n,r,c)}}}function pv(t,e){return(n,r,o)=>{if(!o)return!1;let i=n.selection,s;if(i instanceof $e)s=i;else{let a=y5(o,t,e);if(a==null)return!1;s=new $e(n.doc.resolve(a))}let l=n5(s.$headCell,t,e);return l?mv(n,r,new $e(s.$anchorCell,l)):!1}}function ene(t,e){let n=t.state.doc,r=Fa(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new $e(r))),!0):!1}function tne(t,e,n){if(!Eo(t.state))return!1;let r=Xte(n),o=t.state.selection;if(o instanceof $e){r||(r={width:1,height:1,rows:[M.from(rk(_n(t.state.schema).cell,n))]});let i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),l=pt.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=Jte(r,l.right-l.left,l.bottom-l.top),J4(t.state,t.dispatch,s,l,r),!0}else if(r){let i=yv(t.state),s=i.start(-1);return J4(t.state,t.dispatch,s,pt.get(i.node(-1)).findCell(i.pos-s),r),!0}else return!1}function nne(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;let r=Q4(t,e.target),o;if(e.shiftKey&&t.state.selection instanceof $e)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Fa(t.state.selection.$anchor))!=null&&((n=ZT(t,e))===null||n===void 0?void 0:n.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(a,c){let u=ZT(t,c),d=kl.getState(t.state)==null;if(!u||!ik(a,u))if(d)u=a;else return;let f=new $e(a,u);if(d||!t.state.selection.eq(f)){let h=t.state.tr.setSelection(f);d&&h.setMeta(kl,a.pos),t.dispatch(h)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",l),kl.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(kl,-1))}function l(a){let c=a,u=kl.getState(t.state),d;if(u!=null)d=t.state.doc.resolve(u);else if(Q4(t,c.target)!=r&&(d=ZT(t,e),!d))return s();d&&i(d,c)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",l)}function y5(t,e,n){if(!(t.state.selection instanceof L))return null;let{$head:r}=t.state.selection;for(let o=r.depth-1;o>=0;o--){let i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let s=r.before(o),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?s:null}}return null}function Q4(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ZT(t,e){let n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:o}=n;return r>=0&&Fa(t.state.doc.resolve(r))||Fa(t.state.doc.resolve(o))}var rne=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,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",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ok(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,ok(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function ok(t,e,n,r,o,i){let s=0,l=!0,a=e.firstChild,c=t.firstChild;if(c){for(let d=0,f=0;d<c.childCount;d++){let{colspan:h,colwidth:p}=c.child(d).attrs;for(let m=0;m<h;m++,f++){let y=o==f?i:p&&p[m],g=y?y+"px":"";if(s+=y||r,y||(l=!1),a)a.style.width!=g&&(a.style.width=g),a=a.nextSibling;else{let v=document.createElement("col");v.style.width=g,e.appendChild(v)}}}for(;a;){var u;let d=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=d}l?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}var Pr=new le("tableColumnResizing");function v5({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=rne,lastColumnResizable:o=!0}={}){let i=new G({key:Pr,state:{init(s,l){var a;let c=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=_n(l.schema).table.name;return r&&c&&(c[u]=(d,f)=>new r(d,n,f)),new one(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{let l=Pr.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{ine(s,l,t,o)},mouseleave:s=>{sne(s)},mousedown:(s,l)=>{lne(s,l,e,n)}},decorations:s=>{let l=Pr.getState(s);if(l&&l.activeHandle>-1)return fne(s,l.activeHandle)},nodeViews:{}}});return i}var one=class gv{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){let n=this,r=e.getMeta(Pr);if(r&&r.setHandle!=null)return new gv(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new gv(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let o=e.mapping.map(n.activeHandle,-1);return nk(e.doc.resolve(o))||(o=-1),new gv(o,n.dragging)}return n}};function ine(t,e,n,r){if(!t.editable)return;let o=Pr.getState(t.state);if(o&&!o.dragging){let i=cne(e.target),s=-1;if(i){let{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=n?s=Z4(t,e,"left",n):a-e.clientX<=n&&(s=Z4(t,e,"right",n))}if(s!=o.activeHandle){if(!r&&s!==-1){let l=t.state.doc.resolve(s),a=l.node(-1),c=pt.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}b5(t,s)}}}function sne(t){if(!t.editable)return;let e=Pr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&b5(t,-1)}function lne(t,e,n,r){var o;if(!t.editable)return!1;let i=(o=t.dom.ownerDocument.defaultView)!==null&&o!==void 0?o:window,s=Pr.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let l=t.state.doc.nodeAt(s.activeHandle),a=ane(t,s.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Pr,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);let f=Pr.getState(t.state);f?.dragging&&(une(t,f.activeHandle,e5(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(Pr,{setDragging:null})))}function u(d){if(!d.which)return c(d);let f=Pr.getState(t.state);if(f&&f.dragging){let h=e5(f.dragging,d,n);t5(t,f.activeHandle,h,r)}}return t5(t,s.activeHandle,a,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),e.preventDefault(),!0}function ane(t,e,{colspan:n,colwidth:r}){let o=r&&r[r.length-1];if(o)return o;let i=t.domAtPos(e),s=i.node.childNodes[i.offset].offsetWidth,l=n;if(r)for(let a=0;a<n;a++)r[a]&&(s-=r[a],l--);return s/l}function cne(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Z4(t,e,n,r){let o=n=="right"?-r:r,i=t.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return-1;let{pos:s}=i,l=Fa(t.state.doc.resolve(s));if(!l)return-1;if(n=="right")return l.pos;let a=pt.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function e5(t,e,n){let r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function b5(t,e){t.dispatch(t.state.tr.setMeta(Pr,{setHandle:e}))}function une(t,e,n){let r=t.state.doc.resolve(e),o=r.node(-1),i=pt.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=t.state.tr;for(let c=0;c<i.height;c++){let u=c*i.width+l;if(c&&i.map[u]==i.map[u-i.width])continue;let d=i.map[u],f=o.nodeAt(d).attrs,h=f.colspan==1?0:l-i.colCount(d);if(f.colwidth&&f.colwidth[h]==n)continue;let p=f.colwidth?f.colwidth.slice():dne(f.colspan);p[h]=n,a.setNodeMarkup(s+d,null,{...f,colwidth:p})}a.docChanged&&t.dispatch(a)}function t5(t,e,n,r){let o=t.state.doc.resolve(e),i=o.node(-1),s=o.start(-1),l=pt.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,a=t.domAtPos(o.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&ok(i,a.firstChild,a,r,l,n)}function dne(t){return Array(t).fill(0)}function fne(t,e){let n=[],r=t.doc.resolve(e),o=r.node(-1);if(!o)return ae.empty;let i=pt.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<i.height;c++){let u=l+c*i.width;if((l==i.width-1||i.map[u]!=i.map[u+1])&&(c==0||i.map[u]!=i.map[u-i.width])){var a;let d=i.map[u],f=s+d+o.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=Pr.getState(t))===null||a===void 0)&&a.dragging&&n.push(ot.node(s+d,s+d+o.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(ot.widget(f,h))}}return ae.create(t.doc,n)}function w5({allowTableNodeSelection:t=!1}={}){return new G({key:kl,state:{init(){return null},apply(e,n){let r=e.getMeta(kl);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;let{deleted:o,pos:i}=e.mapping.mapResult(n);return o?null:i}},props:{decorations:zte,handleDOMEvents:{mousedown:nne},createSelectionBetween(e){return kl.getState(e.state)!=null?e.state.selection:null},handleTripleClick:ene,handleKeyDown:Zte,handlePaste:tne},appendTransaction(e,n,r){return Bte(r,sk(r,n),t)}})}function op(t){return t==="left"||t==="right"||t==="center"?t:null}function hne(t){let e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return op(e||n)}function pne(t){return op(t?.align)}function T5(){return{default:null,parseHTML:t=>hne(t),renderHTML:t=>{let e=op(t.align);return YB(e)?{style:`text-align: ${e}`}:{}}}}function mne(t){var e;let n=t.parentElement,r=t.closest("table");if(!n||!r)return null;let o=Array.from(n.children).indexOf(t),i=(e=r.querySelectorAll("colgroup > col")[o])===null||e===void 0?void 0:e.getAttribute("width");return i?[parseInt(i,10)]:null}function k5(t){let e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):mne(t)}var gne=/[ \t\r\n\f]+/g;function A5(t){var e;return t.children.length>0?!1:((e=t.textContent)!==null&&e!==void 0?e:"").replace(gne,"")===""}function M5(t){let e=t.createAndFill();if(!e)throw new Error(`[tiptap error]: "${t.name}" has no default content to backfill.`);return e.content}function bv(t,e,n){if(!(n in e))return;let r=e[n];(r===1||r==="1"||r===null||r===void 0)&&delete t[n]}var dk=Ie.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:k5},align:T5()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:t=>A5(t)?{}:!1,getContent:(t,e)=>M5(e.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes:t}){let e=ce(this.options.HTMLAttributes,t);return bv(e,t,"colspan"),bv(e,t,"rowspan"),["td",e,0]}}),fk=Ie.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:k5},align:T5()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:t=>A5(t)?{}:!1,getContent:(t,e)=>M5(e.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes:t}){let e=ce(this.options.HTMLAttributes,t);return bv(e,t,"colspan"),bv(e,t,"rowspan"),["th",e,0]}}),hk=Ie.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",ce(this.options.HTMLAttributes,t),0]}});function uk(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function S5(t,e,n,r,o,i){let s=0,l=!0,a=e.firstChild,c=t.firstChild;if(c!==null)for(let f=0,h=0;f<c.childCount;f+=1){let{colspan:p,colwidth:m}=c.child(f).attrs;for(let y=0;y<p;y+=1,h+=1){let g=o===h?i:m&&m[y],v=g?`${g}px`:"";if(s+=g||r,g||(l=!1),a){if(a.style.width!==v){let[b,w]=uk(r,g);a.style.setProperty(b,w)}a=a.nextSibling}else{let b=document.createElement("col"),[w,S]=uk(r,g);b.style.setProperty(w,S),e.appendChild(b)}}}for(;a;){var u;let f=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=f}let d=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);l&&!d?(n.style.width=`${s}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${s}px`)}var yne=class{constructor(t,e,n,r={}){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(let[o,i]of Object.entries(r))i!=null&&(o==="style"?this.table.style.cssText=String(i):this.table.setAttribute(o,String(i)));t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),S5(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.sameMarkup(this.node)?(this.node=t,S5(t,this.colgroup,this.table,this.cellMinWidth),!0):!1}ignoreMutation(t){let e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function vne(t,e,n,r){let o=0,i=!0,s=[],l=t.firstChild;if(!l)return{};for(let u=0,d=0;u<l.childCount;u+=1){let{colspan:f,colwidth:h}=l.child(u).attrs;for(let p=0;p<f;p+=1,d+=1){let m=n===d?r:h&&h[p];o+=m||e,m||(i=!1);let[y,g]=uk(e,m);s.push(["col",{style:`${y}: ${g}`}])}}let a=i?`${o}px`:"",c=i?"":`${o}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:c}}function x5(t,e){return e?t.createChecked(null,e):t.createAndFill()}function bne(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;let e={};return Object.keys(t.nodes).forEach(n=>{let r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function wne(t,e,n,r,o){let i=bne(t),s=[],l=[];for(let c=0;c<n;c+=1){let u=x5(i.cell,o);if(u&&l.push(u),r){let d=x5(i.header_cell,o);d&&s.push(d)}}let a=[];for(let c=0;c<e;c+=1)a.push(i.row.createChecked(null,r&&c===0?s:l));return i.table.createChecked(null,a)}function R5(t){return t instanceof $e}var vv=({editor:t})=>{let{selection:e}=t.state;if(!R5(e))return!1;let n=0,r=dd(e.ranges[0].$from,o=>o.type.name==="table");return r?.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(n+=1)}),n!==e.ranges.length?!1:(t.commands.deleteTable(),!0)};function C5(t,e){let n=t.mapping.map(e),r=dd(t.selection.$from,s=>s.type.name==="table");if(r?.pos===n)return;let o=t.doc.nodeAt(n);if(!o)return;let i=n+o.nodeSize-1;t.setSelection(L.near(t.doc.resolve(i),-1))}function Sne(t){let e="",n=0;for(;n<t.length;){if(t[n]==="\\"&&n+1<t.length){e+=t[n]+t[n+1],n+=2;continue}if(t[n]!=="`"){e+=t[n++];continue}let r=0;for(;n+r<t.length&&t[n+r]==="`";)r+=1;let o=n+r,i=!1;for(;o<t.length;){if(t[o]!=="`"){o+=1;continue}let s=0;for(;o+s<t.length&&t[o+s]==="`";)s+=1;if(s===r){let l=t.slice(n+r,o);e+=t.slice(n,n+r)+l.replace(/\\\||\|/g,a=>a==="|"?"\\|":a)+t.slice(o,o+r),n=o+r,i=!0;break}o+=s}i||(e+=t.slice(n,n+r),n+=r)}return e}function xne(t){return t.split(`
|
|
170
|
+
`).map(e=>!e.includes("|")||!e.includes("`")?e:Sne(e)).join(`
|
|
171
|
+
`)}function Cne(t){return(t||"").replaceAll(""," ").replace(/\s+/g," ").trim()}function E5(t,e){return e?t.split(e).join(`
|
|
172
|
+
`):t}function Ene(t){return t.replace(/\\.|\|/g,e=>e==="|"?"\\|":e)}function Tne(t,e,n={}){if(!t||!t.content||t.content.length===0)return"";let r=[];t.content.forEach(f=>{let h=[];f.content&&f.content.forEach(p=>{let m="";p.content&&Array.isArray(p.content)&&p.content.length>1?m=p.content.map(b=>E5(e.renderChildren(b),n.cellLineSeparator)).join(`
|
|
173
|
+
`):m=E5(p.content?e.renderChildren(p.content):"",n.cellLineSeparator);let y=Ene(Cne(m.replace(/[ \t]*\r?\n[ \t]*/g,"<br>"))),g=p.type==="tableHeader",v=pne(p.attrs);h.push({text:y,isHeader:g,align:v})}),r.push(h)});let o=r.reduce((f,h)=>Math.max(f,h.length),0);if(o===0)return"";let i=Array.from({length:o}).fill(0);r.forEach(f=>{for(let p=0;p<o;p+=1){var h;let m=(((h=f[p])===null||h===void 0?void 0:h.text)||"").length;m>i[p]&&(i[p]=m),i[p]<3&&(i[p]=3)}});let s=(f,h)=>f+" ".repeat(Math.max(0,h-f.length)),l=r[0],a=l.some(f=>f.isHeader),c=Array.from({length:o}).fill(null);r.forEach(f=>{for(let p=0;p<o;p+=1){var h;!c[p]&&(!((h=f[p])===null||h===void 0)&&h.align)&&(c[p]=f[p].align)}});let u=`
|
|
174
|
+
`,d=Array.from({length:o}).map((f,h)=>a&&l[h]&&l[h].text||"");return u+=`| ${d.map((f,h)=>s(f,i[h])).join(" | ")} |
|
|
175
|
+
`,u+=`| ${i.map((f,h)=>{let p=Math.max(3,f),m=c[h];return m==="left"?`:${"-".repeat(p)}`:m==="right"?`${"-".repeat(p)}:`:m==="center"?`:${"-".repeat(p)}:`:"-".repeat(p)}).join(" | ")} |
|
|
176
|
+
`,(a?r.slice(1):r).forEach(f=>{u+=`| ${Array.from({length:o}).fill(0).map((h,p)=>s(f[p]&&f[p].text||"",i[p])).join(" | ")} |
|
|
177
|
+
`}),u}var kne=new le("preserveCellSelectionOnContextMenu");function Ane(t,e){let n=t.posAtCoords({left:e.clientX,top:e.clientY});if(n)return n.pos;if(!(e.target instanceof Node))return null;try{return t.posAtDOM(e.target,0)}catch{return null}}function Mne(t,e){let n=!1;return t.forEachCell((r,o)=>{e>=o&&e<o+r.nodeSize&&(n=!0)}),n}function Rne(){return new G({key:kne,props:{handleDOMEvents:{mousedown(t,e){if(e.button!==2)return!1;let{selection:n}=t.state;if(!R5(n)||n.ranges.length<2)return!1;let r=Ane(t,e);return r==null||!Mne(n,r)?!1:(e.preventDefault(),!0)}}}})}var pk=Ie.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:yne,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){let{colgroup:n,tableWidth:r,tableMinWidth:o}=vne(t,this.options.cellMinWidth),i=e.style;function s(){return i||(r?`width: ${r}`:`min-width: ${o}`)}let l=["table",ce(this.options.HTMLAttributes,e,{style:s()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(t,e)=>{let n=[],r=Array.isArray(t.align)?t.align:[];if(t.header){let o=[];t.header.forEach((i,s)=>{var l;let a=op((l=r[s])!==null&&l!==void 0?l:i.align),c=a?{align:a}:{};o.push(e.createNode("tableHeader",c,[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},o))}return t.rows&&t.rows.forEach(o=>{let i=[];o.forEach((s,l)=>{var a;let c=op((a=r[l])!==null&&a!==void 0?a:s.align),u=c?{align:c}:{};i.push(e.createNode("tableCell",u,[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>Tne(t,e),markdownTokenizer:{name:"table",level:"block",start:t=>{let e=t.split(`
|
|
178
|
+
`);if(e.length<2)return-1;let n=e[1];return!/^[ \t|:]*-[ \t|:-]*$/.test(n)||!n.includes("|")?-1:e[0].includes("|")?0:-1},tokenize(t,e,n){let r=t.indexOf(`
|
|
179
|
+
|
|
180
|
+
`),o=r>=0?t.slice(0,r):t,i=o.split(`
|
|
181
|
+
`);if(i.length<2)return;let s=i[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(s)||!s.includes("|"))return;let l=xne(o);if(l===o)return;let a=n.blockTokens(l)[0];if(a?.type!=="table"||!a.raw)return;let c=a.raw.split(`
|
|
182
|
+
`).length,u=t.split(`
|
|
183
|
+
`).slice(0,c).join(`
|
|
184
|
+
`);return{...a,raw:u}}},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:o,editor:i})=>{let s=wne(i.schema,t,e,n);if(o){let l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(L.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>l5(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>a5(t,e),deleteColumn:()=>({state:t,dispatch:e})=>{let n=dd(t.selection.$from,r=>r.type.name==="table");return c5(t,e&&(r=>{n&&C5(r,n.pos),e(r)}))},addRowBefore:()=>({state:t,dispatch:e})=>d5(t,e),addRowAfter:()=>({state:t,dispatch:e})=>f5(t,e),deleteRow:()=>({state:t,dispatch:e})=>{let n=dd(t.selection.$from,r=>r.type.name==="table");return h5(t,e&&(r=>{n&&C5(r,n.pos),e(r)}))},deleteTable:()=>({state:t,dispatch:e})=>g5(t,e),mergeCells:()=>({state:t,dispatch:e})=>lk(t,e),splitCell:()=>({state:t,dispatch:e})=>ak(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>wd("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>wd("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>m5(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>lk(t,e)?!0:ak(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>p5(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>ck(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>ck(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&sk(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){let r=$e.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:vv,"Mod-Backspace":vv,Delete:vv,"Mod-Delete":vv}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[v5({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:null,lastColumnResizable:this.options.lastColumnResizable})]:[],w5({allowTableNodeSelection:this.options.allowTableNodeSelection}),Rne()]},addNodeView(){let t=this.options.View;return t?({node:e,view:n,HTMLAttributes:r})=>{let o=ce(this.options.HTMLAttributes,r);return new t(e,this.options.cellMinWidth,n,o)}:null},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return{tableRole:ve(B(t,"tableRole",e))}}}),cae=be.create({name:"tableKit",addExtensions(){let t=[];return this.options.table!==!1&&t.push(pk.configure(this.options.table)),this.options.tableCell!==!1&&t.push(dk.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(fk.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(hk.configure(this.options.tableRow)),t}});var O5=new WeakSet,D5=new WeakSet;function Ya(t){let e=t;return O5.add(e),e}function mk(t){return Array.isArray(t)&&O5.has(t)}function N5(t){return t.flatMap(e=>e==null?[]:Array.isArray(e)&&D5.has(e)&&!mk(e)?N5(e):[e])}function One(t,e){if(t==="slot")return 0;if(t instanceof Function){let o=t(e);return Array.isArray(o)&&!mk(o)&&!D5.has(o)?Ya(o):o}let{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(n)){if(mk(n))return Ya([t,r,n]);if(n.length===0)return Ya([t,r]);let o=N5(n);return o.length===0?Ya([t,r]):Ya([t,r,...o])}return n!=null?Ya([t,r,n]):Ya([t,r])}var Sd=(t,e)=>One(t,e);var Dne=(t,e)=>{var n;let{state:r}=t,{selection:o}=r;if(!o.empty)return!1;let{$from:i}=o;if(i.parentOffset!==0)return!1;let s=i.depth-1;if(s<0)return!1;let l=i.node(s),a=i.index(s);if(a===0)return!1;if(l.type===e)return t.commands.lift(e.name);let c=l.child(a-1);if(c.type!==e||!(!((n=c.lastChild)===null||n===void 0)&&n.isTextblock))return!1;let u=i.before()-1-1;return t.commands.command(({tr:d,dispatch:f})=>{if(!f)return!0;let h=i.parent.content,p=new N(h,0,0);return d.replace(u,i.after(),p),d.setSelection(L.create(d.doc,u+h.size)),d.scrollIntoView(),f(d),!0})},Nne=/^\s*>\s$/,_5=Ie.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Sd("blockquote",{...ce(this.options.HTMLAttributes,t),children:Sd("slot",{})})},parseMarkdown:(t,e)=>{var n;let r=(n=e.parseBlockChildren)!==null&&n!==void 0?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";let n=">",r=[];return t.content.forEach((o,i)=>{var s,l;let a=((s=(l=e.renderChild)===null||l===void 0?void 0:l.call(e,o,i))!==null&&s!==void 0?s:e.renderChildren([o])).split(`
|
|
185
|
+
`).map(c=>c.trim()===""?n:`${n} ${c}`);r.push(a.join(`
|
|
186
|
+
`))}),r.join(`
|
|
187
|
+
${n}
|
|
188
|
+
`)},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(),Backspace:()=>Dne(this.editor,this.type)}},addInputRules(){return[xl({find:Nne,type:this.type})]}});var _ne=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Ine=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Lne=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,zne=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,I5=Lr.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 Sd("strong",{...ce(this.options.HTMLAttributes,t),children:Sd("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,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[io({find:_ne,type:this.type}),io({find:Lne,type:this.type})]},addPasteRules(){return[zr({find:Ine,type:this.type}),zr({find:zne,type:this.type})]}});var Une=t=>{let e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},Pne=t=>{let e=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=e.exec(t))!==null;)r.index>0&&t[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n};function Bne(t){let e=new Set((t.match(/`+/g)||[]).map(r=>r.length)),n=1;for(;e.has(n);)n+=1;return n}var L5=Lr.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",ce(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e,n)=>{var r;if(!t.content)return"";let o=typeof(n==null||(r=n.meta)===null||r===void 0?void 0:r.markText)=="string"?n.meta.markText:"",i="`".repeat(Bne(o)),s=o.startsWith("`")||o.endsWith("`")?" ":"";return`${i}${s}${e.renderChildren(t.content)}${s}${i}`},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[io({find:Une,type:this.type})]},addPasteRules(){return[zr({find:Pne,type:this.type})]}});var gk=4,Hne=/^```([a-z]+)?[\s\n]$/,jne=/^~~~([a-z]+)?[\s\n]$/,z5=Ie.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:gk,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;let{languageClassPrefix:n}=this.options;if(!n)return null;let r=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",ce(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)===null||n===void 0?void 0:n.startsWith("```"))===!1&&((r=t.raw)===null||r===void 0?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="",o=((n=t.attrs)===null||n===void 0?void 0:n.language)||"";return t.content?r=[`\`\`\`${o}`,e.renderChildren(t.content),"```"].join(`
|
|
189
|
+
`):r=`\`\`\`${o}
|
|
190
|
+
|
|
191
|
+
\`\`\``,r},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:()=>{let{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},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;let n=(e=this.options.tabSize)!==null&&e!==void 0?e:gk,{state:r}=t,{selection:o}=r,{$from:i,empty:s}=o;if(i.parent.type!==this.type)return!1;let l=" ".repeat(n);return s?t.commands.insertContent(l):t.commands.command(({tr:a})=>{let{from:c,to:u}=o,d=r.doc.textBetween(c,u,`
|
|
192
|
+
`,`
|
|
193
|
+
`).split(`
|
|
194
|
+
`).map(f=>l+f).join(`
|
|
195
|
+
`);return a.replaceWith(c,u,r.schema.text(d)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;let n=(e=this.options.tabSize)!==null&&e!==void 0?e:gk,{state:r}=t,{selection:o}=r,{$from:i,empty:s}=o;return i.parent.type!==this.type?!1:s?t.commands.command(({tr:l})=>{var a;let{pos:c}=i,u=i.start(),d=i.end(),f=r.doc.textBetween(u,d,`
|
|
196
|
+
`,`
|
|
197
|
+
`).split(`
|
|
198
|
+
`),h=0,p=0,m=c-u;for(let b=0;b<f.length;b+=1){if(p+f[b].length>=m){h=b;break}p+=f[b].length+1}let y=((a=f[h].match(/^ */))===null||a===void 0?void 0:a[0])||"",g=Math.min(y.length,n);if(g===0)return!0;let v=u;for(let b=0;b<h;b+=1)v+=f[b].length+1;return l.delete(v,v+g),c-v<=g&&l.setSelection(L.create(l.doc,v)),!0}):t.commands.command(({tr:l})=>{let{from:a,to:c}=o,u=r.doc.textBetween(a,c,`
|
|
199
|
+
`,`
|
|
200
|
+
`).split(`
|
|
201
|
+
`).map(d=>{var f;let h=((f=d.match(/^ */))===null||f===void 0?void 0:f[0])||"",p=Math.min(h.length,n);return d.slice(p)}).join(`
|
|
202
|
+
`);return l.replaceWith(a,c,r.schema.text(u)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;let i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
|
|
203
|
+
|
|
204
|
+
`);return!i||!s?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:t})=>{if(!this.options.exitOnArrowUp)return!1;let{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type||r.parentOffset!==0)return!1;let i=r.before();return i>0?!1:t.commands.insertDefaultBlock({pos:i})},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;let{state:e}=t,{selection:n,doc:r}=e,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type||o.parentOffset!==o.parent.nodeSize-2)return!1;let s=o.after();return s===void 0?!1:r.nodeAt(s)?t.commands.command(({tr:l})=>(l.setSelection(H.near(r.resolve(s))),!0)):t.commands.exitCode()}}},addInputRules(){return[Zh({find:Hne,type:this.type,getAttributes:t=>({language:t[1]})}),Zh({find:jne,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new G({key:new le("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;let n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=o?.mode;if(!n||!i)return!1;let{tr:s,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
|
|
205
|
+
`));return s.replaceSelectionWith(this.type.create({language:i},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(L.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}});var U5=Ie.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
206
|
+
|
|
207
|
+
`):""});var P5=Ie.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",ce(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
208
|
+
`},renderMarkdown:()=>`
|
|
209
|
+
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{let{selection:o,storedMarks:i}=n;if(o.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=i||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&s){let d=a.filter(f=>l.includes(f.type.name));c.ensureMarks(d)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var B5=Ie.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]}`,ce(this.options.HTMLAttributes,e),0]},parseMarkdown(t,e){let n=t.depth||1;return this.options.levels.includes(n)?e.createNode("heading",{level:n},e.parseInline(t.tokens||[])):e.createNode("paragraph",void 0,e.parseInline(t.tokens||[]))},renderMarkdown:(t,e)=>{var n;let r=!((n=t.attrs)===null||n===void 0)&&n.level?parseInt(t.attrs.level,10):1,o="#".repeat(r);return t.content?`${o} ${e.renderChildren(t.content)}`:""},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=>Zh({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var H5=Ie.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",ce(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!$B(e,e.schema.nodes[this.name]))return!1;let{selection:n}=e,{$to:r}=n,o=t();return W0(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:i,tr:s,dispatch:l})=>{if(l){let{$to:a}=s.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?s.setSelection(L.create(s.doc,a.pos+1)):a.nodeAfter.isBlock?s.setSelection(j.create(s.doc,a.pos)):s.setSelection(L.create(s.doc,a.pos));else{let u=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=u?.create();d&&(s.insert(c,d),s.setSelection(L.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Z0({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var Vne=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Fne=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,$ne=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Yne=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,j5=Lr.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",ce(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)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[io({find:Vne,type:this.type}),io({find:$ne,type:this.type})]},addPasteRules(){return[zr({find:Fne,type:this.type}),zr({find:Yne,type:this.type})]}});var qne="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos6kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12b0cam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Kne="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",xk="numeric",Ck="ascii",Ek="alpha",sp="asciinumeric",ip="alphanumeric",Tk="domain",K5="emoji",Gne="scheme",Xne="slashscheme",yk="whitespace";function Wne(t,e){return t in e||(e[t]=[]),e[t]}function Ka(t,e,n){e[xk]&&(e[sp]=!0,e[ip]=!0),e[Ck]&&(e[sp]=!0,e[Ek]=!0),e[sp]&&(e[ip]=!0),e[Ek]&&(e[ip]=!0),e[ip]&&(e[Tk]=!0),e[K5]&&(e[Tk]=!0);for(let r in e){let o=Wne(r,n);o.indexOf(t)<0&&o.push(t)}}function Jne(t,e){let n={};for(let r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function hr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}hr.groups={};hr.prototype={accepts(){return!!this.t},go(t){let e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){let o=e.jr[r][0],i=e.jr[r][1];if(i&&o.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){r=r||hr.groups;let o;return e&&e.j?o=e:(o=new hr(e),n&&r&&Ka(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this,i=t.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(t[s]);return o.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||hr.groups;let o=this;if(e&&e.j)return o.j[t]=e,e;let i=e,s,l=o.go(t);if(l?(s=new hr,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new hr,i){if(r)if(s.t&&typeof s.t=="string"){let a=Object.assign(Jne(s.t,r),n);Ka(i,a,r)}else n&&Ka(i,n,r);s.t=i}return o.j[t]=s,s}};var de=(t,e,n,r,o)=>t.ta(e,n,r,o),mt=(t,e,n,r,o)=>t.tr(e,n,r,o),V5=(t,e,n,r,o)=>t.ts(e,n,r,o),O=(t,e,n,r,o)=>t.tt(e,n,r,o),ns="WORD",kk="UWORD",G5="ASCIINUMERICAL",X5="ALPHANUMERICAL",dp="LOCALHOST",Ak="TLD",Mk="UTLD",Cv="SCHEME",xd="SLASH_SCHEME",Ok="NUM",Rk="WS",Dk="NL",lp="OPENBRACE",ap="CLOSEBRACE",Tv="OPENBRACKET",kv="CLOSEBRACKET",Av="OPENPAREN",Mv="CLOSEPAREN",Rv="OPENANGLEBRACKET",Ov="CLOSEANGLEBRACKET",Dv="FULLWIDTHLEFTPAREN",Nv="FULLWIDTHRIGHTPAREN",_v="LEFTCORNERBRACKET",Iv="RIGHTCORNERBRACKET",Lv="LEFTWHITECORNERBRACKET",zv="RIGHTWHITECORNERBRACKET",Uv="FULLWIDTHLESSTHAN",Pv="FULLWIDTHGREATERTHAN",Bv="AMPERSAND",Hv="APOSTROPHE",jv="ASTERISK",Ml="AT",Vv="BACKSLASH",Fv="BACKTICK",$v="CARET",Ga="COLON",Nk="COMMA",Yv="DOLLAR",ri="DOT",qv="EQUALS",_k="EXCLAMATION",lo="HYPHEN",cp="PERCENT",Kv="PIPE",Gv="PLUS",Ed="POUND",qa="QUERY",Ik="QUOTE",W5="FULLWIDTHMIDDLEDOT",Lk="SEMI",oi="SLASH",up="TILDE",Xv="UNDERSCORE",J5="EMOJI",Wv="SYM",Q5=Object.freeze({__proto__:null,ALPHANUMERICAL:X5,AMPERSAND:Bv,APOSTROPHE:Hv,ASCIINUMERICAL:G5,ASTERISK:jv,AT:Ml,BACKSLASH:Vv,BACKTICK:Fv,CARET:$v,CLOSEANGLEBRACKET:Ov,CLOSEBRACE:ap,CLOSEBRACKET:kv,CLOSEPAREN:Mv,COLON:Ga,COMMA:Nk,DOLLAR:Yv,DOT:ri,EMOJI:J5,EQUALS:qv,EXCLAMATION:_k,FULLWIDTHGREATERTHAN:Pv,FULLWIDTHLEFTPAREN:Dv,FULLWIDTHLESSTHAN:Uv,FULLWIDTHMIDDLEDOT:W5,FULLWIDTHRIGHTPAREN:Nv,HYPHEN:lo,LEFTCORNERBRACKET:_v,LEFTWHITECORNERBRACKET:Lv,LOCALHOST:dp,NL:Dk,NUM:Ok,OPENANGLEBRACKET:Rv,OPENBRACE:lp,OPENBRACKET:Tv,OPENPAREN:Av,PERCENT:cp,PIPE:Kv,PLUS:Gv,POUND:Ed,QUERY:qa,QUOTE:Ik,RIGHTCORNERBRACKET:Iv,RIGHTWHITECORNERBRACKET:zv,SCHEME:Cv,SEMI:Lk,SLASH:oi,SLASH_SCHEME:xd,SYM:Wv,TILDE:up,TLD:Ak,UNDERSCORE:Xv,UTLD:Mk,UWORD:kk,WORD:ns,WS:Rk}),es=/[a-z]/,Cd=/[a-z]/i,Ev=/[\u{1F000}-\u{1FAFF}\u{2600}-\u{27BF}]|\u{FE0F}/u;try{Cd=new RegExp("\\p{L}","u"),Ev=new RegExp("\\p{Emoji}","u")}catch{}var ts=/\d/,vk=/\s/;var F5="\r",bk=`
|
|
210
|
+
`,Qne="\uFE0F",Zne="\u200D",wk="\uFFFC",wv=null,Sv=null;function ere(t=[]){let e={};hr.groups=e;let n=new hr;wv==null&&(wv=$5(qne)),Sv==null&&(Sv=$5(Kne)),O(n,"'",Hv),O(n,"{",lp),O(n,"}",ap),O(n,"[",Tv),O(n,"]",kv),O(n,"(",Av),O(n,")",Mv),O(n,"<",Rv),O(n,">",Ov),O(n,"\uFF08",Dv),O(n,"\uFF09",Nv),O(n,"\u300C",_v),O(n,"\u300D",Iv),O(n,"\u300E",Lv),O(n,"\u300F",zv),O(n,"\uFF1C",Uv),O(n,"\uFF1E",Pv),O(n,"&",Bv),O(n,"*",jv),O(n,"@",Ml),O(n,"`",Fv),O(n,"^",$v),O(n,":",Ga),O(n,",",Nk),O(n,"$",Yv),O(n,".",ri),O(n,"=",qv),O(n,"!",_k),O(n,"-",lo),O(n,"%",cp),O(n,"|",Kv),O(n,"+",Gv),O(n,"#",Ed),O(n,"?",qa),O(n,'"',Ik),O(n,"/",oi),O(n,";",Lk),O(n,"~",up),O(n,"_",Xv),O(n,"\\",Vv),O(n,"\u30FB",W5);let r=mt(n,ts,Ok,{[xk]:!0});mt(r,ts,r);let o=mt(r,es,G5,{[sp]:!0}),i=mt(r,Cd,X5,{[ip]:!0}),s=mt(n,es,ns,{[Ck]:!0});mt(s,ts,o),mt(s,es,s),mt(o,ts,o),mt(o,es,o);let l=mt(n,Cd,kk,{[Ek]:!0});mt(l,es),mt(l,ts,i),mt(l,Cd,l),mt(i,ts,i),mt(i,es),mt(i,Cd,i);let a=O(n,bk,Dk,{[yk]:!0}),c=O(n,F5,Rk,{[yk]:!0}),u=mt(n,vk,Rk,{[yk]:!0});O(n,wk,u),O(c,bk,a),O(c,wk,u),mt(c,vk,u),O(u,F5),O(u,bk),mt(u,vk,u),O(u,wk,u);let d=mt(n,Ev,J5,{[K5]:!0});O(d,"#"),mt(d,Ev,d),O(d,Qne,d);let f=O(d,Zne);O(f,"#"),mt(f,Ev,d);let h=[[es,s],[ts,o]],p=[[es,null],[Cd,l],[ts,i]];for(let m=0;m<wv.length;m++)Al(n,wv[m],Ak,ns,h);for(let m=0;m<Sv.length;m++)Al(n,Sv[m],Mk,kk,p);Ka(Ak,{tld:!0,ascii:!0},e),Ka(Mk,{utld:!0,alpha:!0},e),Al(n,"file",Cv,ns,h),Al(n,"mailto",Cv,ns,h),Al(n,"http",xd,ns,h),Al(n,"https",xd,ns,h),Al(n,"ftp",xd,ns,h),Al(n,"ftps",xd,ns,h),Ka(Cv,{scheme:!0,ascii:!0},e),Ka(xd,{slashscheme:!0,ascii:!0},e),t=t.sort((m,y)=>m[0]>y[0]?1:-1);for(let m=0;m<t.length;m++){let y=t[m][0],v=t[m][1]?{[Gne]:!0}:{[Xne]:!0};y.indexOf("-")>=0?v[Tk]=!0:es.test(y)?ts.test(y)?v[sp]=!0:v[Ck]=!0:v[xk]=!0,V5(n,y,y,v)}return V5(n,"localhost",dp,{ascii:!0}),n.jd=new hr(Wv),{start:n,tokens:Object.assign({groups:e},Q5)}}function Z5(t,e){let n=tre(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,o=[],i=0,s=0;for(;s<r;){let l=t,a=null,c=0,u=null,d=-1,f=-1;for(;s<r&&(a=l.go(n[s]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=n[s].length,f++),c+=n[s].length,i+=n[s].length,s++;i-=d,s-=f,c-=d,o.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return o}function tre(t){let e=[],n=t.length,r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function Al(t,e,n,r,o){let i,s=e.length;for(let l=0;l<s-1;l++){let a=e[l];t.j[a]?i=t.j[a]:(i=new hr(r),i.jr=o.slice(),t.j[a]=i),t=i}return i=new hr(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function $5(t){let e=[],n=[],r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}var fp={defaultProtocol:"http",events:null,format:Y5,formatHref:Y5,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],ignoreClasses:[],render:null};function zk(t,e=null){let n=Object.assign({},fp);t&&(n=Object.assign(n,t instanceof zk?t.o:t));let r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o,this.ignoreClasses=n.ignoreClasses.slice()}zk.prototype={o:fp,ignoreTags:[],ignoreClasses:[],isIgnoredClass(t){if(typeof t!="string"||this.ignoreClasses.length===0)return!1;let e=t.split(/\s+/);for(let n=0;n<e.length;n++)if(this.ignoreClasses.indexOf(e[n])>=0)return!0;return!1},defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){let r=e!=null,o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:fp[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){let e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function Y5(t){return t}function e8(t,e){this.t="token",this.v=t,this.tk=e}e8.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){let e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"\u2026":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=fp.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){let e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:o,attributes:s,content:i,eventListeners:d}}};function Jv(t,e){class n extends e8{constructor(o,i){super(o,i),this.t=t}}for(let r in e)n.prototype[r]=e[r];return n.t=t,n}var nre=Jv("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),q5=Jv("text"),rre=Jv("nl"),xv=Jv("url",{isLink:!0,toHref(t=fp.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){let t=this.tk;return t.length>=2&&t[0].t!==dp&&t[1].t===Ga}});var so=t=>new hr(t);function ore({groups:t}){let e=t.domain.concat([Bv,jv,Ml,Vv,Fv,$v,Yv,qv,lo,Ok,cp,Kv,Gv,Ed,oi,Wv,up,Xv]),n=[Hv,Ga,Nk,ri,_k,cp,qa,Ik,Lk,Rv,Ov,lp,ap,kv,Tv,Av,Mv,Dv,Nv,_v,Iv,Lv,zv,Uv,Pv],r=[Bv,Hv,jv,Vv,Fv,$v,Yv,qv,lo,lp,ap,cp,Kv,Gv,Ed,qa,oi,Wv,up,Xv],o=so(),i=O(o,up);de(i,r,i),de(i,t.domain,i);let s=so(),l=so(),a=so();de(o,t.domain,s),de(o,t.scheme,l),de(o,t.slashscheme,a),de(s,r,i),de(s,t.domain,s);let c=O(s,Ml);O(i,Ml,c),O(l,Ml,c),O(a,Ml,c);let u=O(i,ri);de(u,r,i),de(u,t.domain,i);let d=so();de(c,t.domain,d),de(d,t.domain,d);let f=O(d,ri);de(f,t.domain,d);let h=so(nre);de(f,t.tld,h),de(f,t.utld,h),O(c,dp,h);let p=O(d,lo);O(p,lo,p),de(p,t.domain,d),de(h,t.domain,d),O(h,ri,f),O(h,lo,p);let m=O(s,lo),y=O(s,ri);O(m,lo,m),de(m,t.domain,s),de(y,r,i),de(y,t.domain,s);let g=so(xv);de(y,t.tld,g),de(y,t.utld,g),de(g,t.domain,s),de(g,r,i),O(g,ri,y),O(g,lo,m),O(g,Ml,c);let v=O(g,Ga),b=so(xv);de(v,t.numeric,b);let w=so(xv),S=so();de(w,e,w),de(w,n,S),de(S,e,w),de(S,n,S),O(g,oi,w),O(b,oi,w),O(g,qa,S),O(g,Ed,w),O(b,qa,S),O(b,Ed,w);let C=O(l,Ga),x=O(a,Ga),E=O(x,oi),k=O(E,oi);de(l,t.domain,s),O(l,ri,y),O(l,lo,m),de(a,t.domain,s),O(a,ri,y),O(a,lo,m),de(C,t.domain,w),O(C,oi,w),O(C,qa,w),de(k,t.domain,w),de(k,e,w),O(k,oi,w);let T=[[lp,ap],[Tv,kv],[Av,Mv],[Rv,Ov],[Dv,Nv],[_v,Iv],[Lv,zv],[Uv,Pv]];for(let _=0;_<T.length;_++){let[z,$]=T[_],I=O(w,z);O(S,z,I);let V=so(xv);de(I,e,V);let D=so();de(I,n,D),O(I,$,w),de(V,e,V),de(V,n,D),de(D,e,V),de(D,n,D),O(V,$,w),O(D,$,w)}return O(o,dp,g),O(o,Dk,rre),{start:o,tokens:Q5}}function ire(t,e,n){let r=n.length,o=0,i=[],s=[],l=[];for(;o<r;){let a=t,c=null,u=null,d=0,f=null,h=-1,p=[];for(;o<r&&!(c=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(u=c||a.go(n[o].t));)if(c=null,a=u,o++,d++,a.accepts())h=0,f=a,p=[];else if(h>=0&&h++,p.push(a),l[o]&&l[o].has(a))break;for(let m=0,y=o-p.length+1;m<p.length;m++,y++)(l[y]||(l[y]=new Set)).add(p[m]);if(h<0)o-=d,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(Sk(q5,e,s)),s=[]),o-=h,d-=h;let m=f.t,y=n.slice(o-d,o);i.push(Sk(m,e,y))}}return s.length>0&&i.push(Sk(q5,e,s)),i}function Sk(t,e,n){let r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}var sre=typeof console<"u"&&console&&console.warn||(()=>{}),lre="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",tt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function t8(){return hr.groups={},tt.scanner=null,tt.parser=null,tt.tokenQueue=[],tt.pluginQueue=[],tt.customSchemes=[],tt.initialized=!1,tt}function Uk(t,e=!1){if(tt.initialized&&sre(`linkifyjs: already initialized - will not register custom scheme "${t}" ${lre}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
211
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
212
|
+
2. Cannot start or end with "-"
|
|
213
|
+
3. "-" cannot repeat`);tt.customSchemes.push([t,e])}function are(){tt.scanner=ere(tt.customSchemes);for(let t=0;t<tt.tokenQueue.length;t++)tt.tokenQueue[t][1]({scanner:tt.scanner});tt.parser=ore(tt.scanner.tokens);for(let t=0;t<tt.pluginQueue.length;t++)tt.pluginQueue[t][1]({scanner:tt.scanner,parser:tt.parser});return tt.initialized=!0,tt}function Qv(t){return tt.initialized||are(),ire(tt.parser.start,t,Z5(tt.scanner.start,t))}Qv.scan=Z5;function Pk(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}let r=new zk(n),o=Qv(t),i=[];for(let s=0;s<o.length;s++){let l=o[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}var Zv="[\0- \xA0\u1680\u180E\u2000-\u2029\u205F\u3000]",cre=new RegExp(Zv),ure=new RegExp(`${Zv}$`),dre=new RegExp(`${Zv}+$`),fre=new RegExp(Zv,"g");function hre(t,e,n){var r,o;let i=t.doc.resolve(e.to);if(!(!((r=i.nodeBefore)===null||r===void 0)&&r.isText))return;let s=(o=t.doc.textBetween(e.from,e.to,"\uFFFC","\uFFFC").match(dre))===null||o===void 0?void 0:o[0];if(!s)return;let l=e.to-s.length,a=Qh(l,e.to,t.doc).filter(d=>d.mark.type===n);if(!a.length)return;let{nodeAfter:c}=i;if(c&&a.some(d=>d.mark.isInSet(c.marks)))return;let u=t.storedMarks;t.removeMark(l,e.to,n),t.setStoredMarks(u),t.selection.empty&&t.selection.from===e.to&&t.removeStoredMark(n)}function pre(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function mre(t){return new G({key:new le("autolink"),appendTransaction:(e,n,r)=>{let o=e.some(a=>a.docChanged)&&!n.doc.eq(r.doc),i=e.some(a=>a.getMeta("preventAutolink"));if(!o||i)return;let{tr:s}=r,l=xT(n.doc,[...e]);if(!e.some(qP)){let a=[];l.steps.forEach((c,u)=>{if(!(c instanceof ht)||!c.slice.size)return;let d=l.mapping.slice(u+1),f=d.map(c.from,1),h=d.map(c.from+c.slice.size,-1);f<h&&a.push({from:f,to:h})}),a.sort((c,u)=>u.to-c.to),a.forEach(c=>hre(s,c,t.type))}if(fd(l).forEach(({newRange:a})=>{let c=EB(r.doc,a,f=>f.isTextblock),u,d;if(c.length>1)u=c[0],d=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(c.length){let f=r.doc.textBetween(a.from,a.to," "," ");if(!ure.test(f))return;u=c[0],d=r.doc.textBetween(u.pos,a.to,void 0," ")}if(u&&d){let f=d.split(cre).filter(Boolean);if(f.length<=0)return!1;let h=f[f.length-1],p=u.pos+d.lastIndexOf(h);if(!h)return!1;let m=Qv(h).map(y=>y.toObject(t.defaultProtocol));if(!pre(m))return!1;m.filter(y=>y.isLink).map(y=>({...y,from:p+y.start+1,to:p+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{Qh(y.from,y.to,r.doc).some(g=>g.mark.type===t.type)||s.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!s.steps.length)return s}})}function gre(t){return new G({key:new le("handleClickLink"),props:{handleClick:(e,n,r)=>{if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let a=r.target;if(!a)return!1;let c=t.editor.view.dom;o=a.closest("a"),o&&!c.contains(o)&&(o=null)}if(!o)return!1;let i=!1;if(t.enableClickSelection&&(i=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){var s,l;let a=kT(e.state,t.type.name),c=(s=o.href)!==null&&s!==void 0?s:a.href,u=(l=o.target)!==null&&l!==void 0?l:a.target;c&&(window.open(c,u),i=!0)}return i}}})}var yre=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,vre=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function n8(t,e){let n=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)n+=1;return n%2===1}function bre(t,e){let n=0,r=0;for(;r<e;){if(t[r]!=="`"){r+=1;continue}if(n===0&&n8(t,r)){r+=1;continue}let o=0;for(;r<e&&t[r]==="`";)o+=1,r+=1;n===0?n=o:o===n&&(n=0)}return n>0}function r8(t,e,n){var r,o;let[,i,s]=e;return(e.index?t[e.index-1]:void 0)==="!"||n8(t,(r=e.index)!==null&&r!==void 0?r:0)||bre(t,(o=e.index)!==null&&o!==void 0?o:0)?!1:!!i.trim()&&n(s)}function o8(t){var e,n;let[r,o,i,,s,l,a]=t,c=(e=s??l)!==null&&e!==void 0?e:a;return{index:(n=t.index)!==null&&n!==void 0?n:0,text:r,replaceWith:o,data:{href:i,title:c||null,markdown:!0}}}function wre(t,e){return t.index<e.index+e.text.length&&e.index<t.index+t.text.length}function i8(t){var e,n,r;return{href:(e=t.data)===null||e===void 0?void 0:e.href,title:(n=(r=t.data)===null||r===void 0?void 0:r.title)!==null&&n!==void 0?n:null}}function Sre(t){let e=io({find:n=>{let r=yre.exec(n);return!r||!r8(n,r,t.isAllowedHref)?null:o8(r)},type:t.type,getAttributes:i8});return new pd({find:e.find,handler:n=>{let r=e.handler(n);return r!==null&&n.state.tr.steps.length&&n.state.tr.setMeta("preventAutolink",!0),r}})}function xre(t){let e=zr({find:n=>{var r,o;let i=[];for(let l of n.matchAll(vre))r8(n,l,t.isAllowedHref)&&i.push(o8(l));let s=((r=(o=t.findPlainUrls)===null||o===void 0?void 0:o.call(t,n))!==null&&r!==void 0?r:[]).filter(l=>!i.some(a=>wre(a,l)));return[...i,...s]},type:t.type,getAttributes:i8});return new NT({find:e.find,handler:n=>{var r;let o=e.handler(n);return o!==null&&n.state.tr.steps.length&&(!((r=n.match.data)===null||r===void 0)&&r.markdown)&&n.state.tr.setMeta("preventAutolink",!0),o}})}function Cre(t){return new G({key:new le("handlePasteLink"),props:{handlePaste:(e,n,r)=>{let{shouldAutoLink:o}=t,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});let c=Pk(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||o!==void 0&&!o(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function rs(t,e){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{let o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(fre,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}var s8=Lr.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"){Uk(t);return}Uk(t.scheme,t.optionalSlashes)})},onDestroy(){t8()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!rs(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{let e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;let r=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){var t,e,n;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(t=this.options.HTMLAttributes.target)!==null&&t!==void 0?t:null},rel:{default:(e=this.options.HTMLAttributes.rel)!==null&&e!==void 0?e:null},class:{default:(n=this.options.HTMLAttributes.class)!==null&&n!==void 0?n:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{let e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!rs(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=>!!rs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ce(this.options.HTMLAttributes,t),0]:["a",ce(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,o,i;let s=(n=(r=t.attrs)===null||r===void 0?void 0:r.href)!==null&&n!==void 0?n:"",l=(o=(i=t.attrs)===null||i===void 0?void 0:i.title)!==null&&o!==void 0?o:"",a=e.renderChildren(t);return l?`[${a}](${s} "${l}")`:`[${a}](${s})`},addCommands(){return{setLink:t=>({chain:e})=>{let{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!rs(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})=>{let{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!rs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){return this.options.markdownLinks?[Sre({type:this.type,isAllowedHref:t=>this.options.isAllowedUri(t,{defaultValidate:e=>!!rs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){let t=e=>{let n=[];if(e){let{protocols:r,defaultProtocol:o}=this.options;Pk(e).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!rs(s,r),protocols:r,defaultProtocol:o})).forEach(i=>{this.options.shouldAutoLink(i.value)&&n.push({text:i.value,data:{href:i.href},index:i.start})})}return n};return this.options.markdownLinks?[xre({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:n=>!!rs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:t})]:[zr({find:t,type:this.type,getAttributes:e=>{var n;return{href:(n=e.data)===null||n===void 0?void 0:n.href}}})]},addProseMirrorPlugins(){let t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(mre({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!rs(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(gre({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Cre({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}});var eb=" ",Bk="\xA0",l8=Ie.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ce(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{let n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);let r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===eb||n[0].text===eb||n[0].raw===Bk||n[0].text===Bk)&&r.length===1&&r[0].type==="text"&&(r[0].text===eb||r[0].text===Bk)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{if(!t)return"";let r=Array.isArray(t.content)?t.content:[];if(r.length===0){var o,i;let s=Array.isArray(n==null||(o=n.previousNode)===null||o===void 0?void 0:o.content)?n.previousNode.content:[];return(n==null||(i=n.previousNode)===null||i===void 0?void 0:i.type)==="paragraph"&&s.length===0?eb:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var Ere=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Tre=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,a8=Lr.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",ce(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,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[io({find:Ere,type:this.type})]},addPasteRules(){return[zr({find:Tre,type:this.type})]}});var c8=Ie.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""});var u8=Lr.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",ce(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`<u>${e.renderChildren(t)}</u>`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.toLowerCase().indexOf("<u>")},tokenize(t,e,n){if(!/^<u>/i.test(t))return;let r=/\\[\s\S]|`+|<\/u>/gi;r.lastIndex=3;let o=r.exec(t);for(;o;){if(o[0].startsWith("`")){let i=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/.exec(t.slice(o.index));i&&(r.lastIndex=o.index+i[0].length)}else if(!o[0].startsWith("\\")){let i=t.slice(3,o.index);return i?{type:"underline",raw:t.slice(0,r.lastIndex),text:i,tokens:n.inlineTokens(i)}:void 0}o=r.exec(t)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function d8(t={}){return new G({view(e){return new Hk(e,t)}})}var Hk=class{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){if(this.cursorPos!=null&&n.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else 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,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,l=i.height/o.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:p.left,right:p.right,top:m-y,bottom:m+y}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(!n||i)return null;let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=y0(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}return s}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let n=this.computeTarget(e);n!=null&&(this.setCursor(n),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}};var In=class t extends H{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return t.valid(r)?new t(r):H.near(r)}content(){return N.empty}eq(e){return e instanceof t&&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 t(e.resolve(n.pos))}getBookmark(){return new jk(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!kre(e)||!Are(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&t.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(n>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=n;let a=e.doc.resolve(o);if(t.valid(a))return a}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!j.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let l=e.doc.resolve(o);if(t.valid(l))return l}return null}}};In.prototype.visible=!1;In.findFrom=In.findGapCursorFrom;H.jsonID("gapcursor",In);var jk=class t{constructor(e){this.pos=e}map(e){return new t(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return In.valid(n)?new In(n):H.near(n)}};function f8(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function kre(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 o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||f8(o.type))return!0;if(o.inlineContent)return!1}}return!0}function Are(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 o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||f8(o.type))return!0;if(o.inlineContent)return!1}}return!0}function h8(){return new G({props:{decorations:Dre,createSelectionBetween(t,e,n){return e.pos==n.pos&&In.valid(n)?new In(n):null},handleClick:Rre,handleKeyDown:Mre,handleDOMEvents:{beforeinput:Ore}}})}var Mre=Gh({ArrowLeft:tb("horiz",-1),ArrowRight:tb("horiz",1),ArrowUp:tb("vert",-1),ArrowDown:tb("vert",1)});function tb(t,e){let n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof L){if(!i.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=In.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new In(c))),!0):!1}}function Rre(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!In.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&j.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new In(r))),!0)}function Ore(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof In))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 o=M.empty;for(let s=r.length-1;s>=0;s--)o=M.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new N(o,0,0));return i.setSelection(L.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function Dre(t){if(!(t.selection instanceof In))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ae.create(t.doc,[ot.widget(t.selection.head,e,{key:"gapcursor"})])}var gce=be.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{let e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){let n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=t=>{let e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new G({key:new le("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;let o=this.options.limit,i=this.options.autoTrim;if(o==null||o===0||i===!1){t=!0;return}let s=this.storage.characters({node:r.doc});if(s>o){let l=s-o,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);let u=r.tr.deleteRange(a,c);return t=!0,u}t=!0},filterTransaction:(e,n)=>{let r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;let o=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||o>r&&i>r&&i<=o)return!0;if(o>r&&i>r&&i>o||!e.getMeta("paste"))return!1;let s=e.selection.$head.pos,l=s-(i-r),a=s;return e.deleteRange(l,a),!(this.storage.characters({node:e.doc})>r)}})]}}),g8=be.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[d8(this.options)]}}),yce=be.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new G({key:new le("focus"),props:{decorations:({doc:t,selection:e})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,i=[];if(!n||!r)return ae.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(!a.isText){if(!(o>=c&&o<=c+a.nodeSize-1))return!1;s+=1}});let l=0;return t.descendants((a,c)=>{if(a.isText||!(o>=c&&o<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(ot.node(c,c+a.nodeSize,{class:this.options.className}))}),ae.create(t,i)}}})]}}),y8=be.create({name:"gapCursor",addProseMirrorPlugins(){return[h8()]},extendNodeSchema(t){var e;let n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ve(B(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),v8="placeholder",p8=new le("tiptap__placeholder");function b8(t){let{editor:e,placeholder:n,dataAttribute:r,pos:o,node:i,isEmptyDoc:s,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=t,u=[a];return s&&u.push(c),ot.node(o,o+i.nodeSize,{class:u.join(" "),[r]:typeof n=="function"?n({editor:e,node:i,pos:o,hasAnchor:l}):n})}function w8(t,e){return typeof t=="function"?t(e):t}function S8({editor:t,options:e,dataAttribute:n,doc:r,selection:o,from:i,to:s}){let{anchor:l}=o,a=[],c=t.isEmpty;return r.nodesBetween(i,s,(u,d)=>{let f=l>=d&&l<=d+u.nodeSize,h=!u.isLeaf&&hd(u);return u.type.isTextblock&&(f||!e.showOnlyCurrent)&&h&&a.push(b8({editor:t,isEmptyDoc:c,dataAttribute:n,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:w8(e.emptyNodeClass,{editor:t,node:u,pos:d,hasAnchor:f})},node:u,pos:d})),e.includeChildren}),a}function x8({editor:t,options:e,dataAttribute:n,doc:r,selection:o}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;let{anchor:i}=o,s=[],l=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){let a=r.resolve(i),c=a.depth>0?a.node(1):a.nodeAfter,u=a.depth>0?a.before(1):i;if(c&&c.type.isTextblock&&hd(c)){let d=i>=u&&i<=u+c.nodeSize;s.push(b8({editor:t,isEmptyDoc:l,dataAttribute:n,hasAnchor:d,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:w8(e.emptyNodeClass,{editor:t,node:c,pos:u,hasAnchor:d})},node:c,pos:u}))}}else s.push(...S8({editor:t,options:e,dataAttribute:n,doc:r,selection:o,from:0,to:r.content.size}));return ae.create(r,s)}function hp(t,e){let n=t.resolve(e);if(n.depth===0){var r;let i=(r=n.nodeAfter)!==null&&r!==void 0?r:n.nodeBefore;if(!i)return{from:e,to:e};let s=n.nodeAfter?e:e-i.nodeSize;return{from:s,to:s+i.nodeSize}}let o=n.before(1);return{from:o,to:o+n.node(1).nodeSize}}function pp(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function Nre(t,e,n){let r=[];return t.forEach((o,i)=>{let s=i,l=s+o.nodeSize,a=s+1,c=l+1;a<n&&c>e&&r.push({from:s,to:l})}),r}function _re(t){if(t.length===0)return[];let e=[...t].sort((r,o)=>r.from-o.from),n=[{...e[0]}];for(let r=1;r<e.length;r+=1){let o=n[n.length-1],i=e[r];i.from<=o.to?o.to=Math.max(o.to,i.to):n.push({...i})}return n}function Ire(t,e){let n=Nre(t,e.from,e.to);return n.push(pp(t,hp(t,e.from))),e.to>e.from?n.push(pp(t,hp(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(pp(t,hp(t,Math.min(e.from+1,t.content.size)))),n}function Lre(t,e,n){let r=[];if(t.docChanged){let o=fd(t);for(let i of o)r.push(...Ire(n.doc,i.newRange))}return t.selectionSet&&(r.push(pp(n.doc,hp(n.doc,t.mapping.map(e.selection.anchor)))),r.push(pp(n.doc,hp(n.doc,n.selection.anchor)))),_re(r)}function zre(t,e,n){let r=Math.max(0,Math.min(t,n.content.size));return{from:r,to:Math.max(r,Math.min(e,n.content.size))}}function Ure({decorations:t,ranges:e,editor:n,options:r,dataAttribute:o,doc:i,selection:s}){let l=t;for(let a of e){let{from:c,to:u}=zre(a.from,a.to,i),d=l.find(c,u).filter(h=>h.from>=c&&h.to<=u);d.length&&(l=l.remove(d));let f=S8({editor:n,options:r,dataAttribute:o,doc:i,selection:s,from:c,to:u});f.length&&(l=l.add(i,f))}return l}function Pre({editor:t,options:e,dataAttribute:n}){return{init(r,o){let i=x8({editor:t,options:e,dataAttribute:n,doc:o.doc,selection:o.selection});return i??ae.empty},apply(r,o,i,s){return!r.docChanged&&!r.selectionSet?o:Ure({decorations:o.map(r.mapping,r.doc),ranges:Lre(r,i,s),editor:t,options:e,dataAttribute:n,doc:s.doc,selection:s.selection})}}}function Bre(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function Hre({editor:t,options:e}){let n=e.dataAttribute?`data-${Bre(e.dataAttribute)}`:`data-${v8}`,r=e.showOnlyCurrent&&!e.includeChildren;return new G({key:p8,...r?{}:{state:Pre({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:o,selection:i})=>x8({editor:t,options:e,dataAttribute:n,doc:o,selection:i}):o=>{var i;return e.showOnlyWhenEditable&&!t.isEditable?ae.empty:(i=p8.getState(o))!==null&&i!==void 0?i:ae.empty}}})}var vce=be.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:v8,placeholder:"Write something \u2026",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Hre({editor:this.editor,options:this.options})]}});function Vk(t,e){return!t.selection.empty&&!W0(t.selection)&&e.isEditable}function jre(t,e){return Vk(t,e)&&!e.isFocused&&!e.view.dragging}function Vre(){var t;(t=window.getSelection())===null||t===void 0||t.removeAllRanges()}function Fre(t){t.focus()}var bce=be.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){let{editor:t,options:e}=this;return[new G({key:new le("selection"),props:{decorations(n){return jre(n,t)?ae.create(n.doc,[ot.inline(n.selection.from,n.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(n){return Vk(n.state,t)&&Vre(),!1},focus(n){return Vk(n.state,t)&&requestAnimationFrame(()=>{!t.isDestroyed&&n.hasFocus()&&Fre(n)}),!1}}}})]}});function m8({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var C8=be.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;let e=new le(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)===null||t===void 0?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(n).includes(o.name));return[new G({key:e,appendTransaction:(o,i,s)=>{let{doc:l,tr:a,schema:c}=s,u=e.getState(s),d=l.content.size,f=c.nodes[n];if(!o.some(h=>h.getMeta("skipTrailingNode"))&&u)return a.insert(d,f.create())},state:{init:(o,i)=>{let s=i.tr.doc.lastChild;return!m8({node:s,types:r})},apply:(o,i)=>{if(!o.docChanged||o.getMeta("__uniqueIDTransaction"))return i;let s=o.doc.lastChild;return!m8({node:s,types:r})}}})]}}),E8=be.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>pT(t,e),redo:()=>({state:t,dispatch:e})=>mT(t,e)}},addProseMirrorPlugins(){return[YP(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var $re=be.create({name:"starterKit",addExtensions(){let t=[];if(this.options.bold!==!1&&t.push(I5.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(_5.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push($T.configure(this.options.bulletList)),this.options.code!==!1&&t.push(L5.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(z5.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(U5.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(g8.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(y8.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(P5.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(B5.configure(this.options.heading)),this.options.undoRedo!==!1&&t.push(E8.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&t.push(H5.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(j5.configure(this.options.italic)),this.options.listItem!==!1&&t.push(KT.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;t.push(XT.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var n;t.push(s8.configure((n=this.options)===null||n===void 0?void 0:n.link))}if(this.options.orderedList!==!1&&t.push(WT.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(l8.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(a8.configure(this.options.strike)),this.options.text!==!1&&t.push(c8.configure(this.options.text)),this.options.underline!==!1){var r;t.push(u8.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var o;t.push(C8.configure((o=this.options)===null||o===void 0?void 0:o.trailingNode))}return t}}),T8=$re;var Ft=R(P(),1);function Yre(t){let e=new Set;for(let o of t.getArray("edits").toArray())typeof o!="object"||o===null||typeof o.client=="number"&&o.author?.kind!==void 0&&o.author.kind!=="human"&&e.add(o.client);let n=[];if(e.size===0)return n;let r=o=>{for(let i of o.toArray())if(i instanceof Ce)r(i);else if(i instanceof et){let s=0;for(let l=i._start;l;l=l.right)l.deleted||!l.countable||(e.has(l.id.client)&&n.push({text:i,from:s,to:s+l.length}),s+=l.length)}};return r(t.getXmlFragment("default")),n}var nb=new le("agentText"),k8=be.create({name:"agentText",addProseMirrorPlugins(){return[new G({key:nb,state:{init:()=>ae.empty,apply:(t,e)=>t.getMeta(nb)??e.map(t.mapping,t.doc)},props:{decorations:t=>nb.getState(t)},view(t){let e=Ue.getState(t.state);if(!e)return{};let n,r="",o=()=>{n=void 0;try{let s=Ue.getState(t.state).binding?.mapping;if(!s)return;let l=t.state.doc.content.size,a=[];for(let{text:u,from:d,to:f}of Yre(e.doc)){let h=Ur(e.doc,e.type,Sa(u,d),s),p=Ur(e.doc,e.type,Sa(u,f),s);h!==null&&p!==null&&h<p&&p<=l&&a.push(ot.inline(h,p,{class:"agent-text",title:"Written by an agent"}))}let c=a.map(u=>`${u.from}-${u.to}`).join(",");if(c===r)return;r=c,t.dispatch(t.state.tr.setMeta(nb,ae.create(t.state.doc,a)).setMeta("addToHistory",!1))}catch{}},i=()=>{n??=setTimeout(o,60)};return e.doc.on("update",i),i(),{destroy(){e.doc.off("update",i),n&&clearTimeout(n)}}}})]}});var Ee=R(ee(),1),qre=1500,Kre=t=>({id:String(t.clientId),name:hu(t.name)??"Unnamed",kind:t.machine?"agent":"person"}),A8=t=>typeof t=="object"&&t!==null&&t.code==="NO_DOCUMENT";function Gre(t){return be.create({name:"remoteCarets",addProseMirrorPlugins:()=>[p4(t.awareness,{cursorBuilder:(e,n)=>{let r=document.createElement("span"),o=t.peers.find(s=>s.clientId===n);if(!o)return r;r.className=`caret${o.machine?" caret--agent":""}`;let i=document.createElement("span");return i.className="caret__tag",i.textContent=`${hu(o.name)??"Unnamed"}${o.machine?" \xB7 Agent":""}`,r.append(i),r},selectionBuilder:()=>({})})]})}var mp=class extends Ft.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,Ee.jsx)("div",{role:"alert",className:"adoc notice",children:(0,Ee.jsx)(ca,{title:"The editor stopped",description:"The document has content this page cannot show. Reload to try again."})}):this.props.children}};function Fk({live:t,editable:e,principal:n}){let r=(0,Ft.useRef)(null),[o,i]=(0,Ft.useState)(),[,s]=(0,Ft.useReducer)(I=>I+1,0),[l,a]=(0,Ft.useState)([]),[c,u]=(0,Ft.useState)("saved"),[d,f]=(0,Ft.useState)("connecting"),[h,p]=(0,Ft.useState)(!1),[m,y]=(0,Ft.useState)(!1),[g,v]=(0,Ft.useState)(""),[b,w]=(0,Ft.useState)(),S=(0,Ft.useRef)(!1);(0,Ft.useEffect)(()=>{let I=new XB({element:r.current,editable:e,extensions:[T8.configure({undoRedo:!1,underline:!1,link:{openOnClick:!1,autolink:!0,defaultProtocol:"https",isAllowedUri:ct=>/^(https?:\/\/|mailto:)\S+$/i.test(ct)}}),O4,QT,JT,pk,hk,dk,fk,R4.configure({document:t.doc,field:"default"}),...t.sync?[Gre(t.sync)]:[],k8],editorProps:{attributes:{role:"textbox","aria-multiline":"true","aria-label":"Document text",class:"prose"}}});i(I),I.on("transaction",()=>(p(r.current?.querySelector(".agent-text")!=null),s()));let V=t.sync?.onPeers(a);a(t.sync?.peers??[]);let D,q=!1,U=!1,re=()=>{D=void 0,u("saving"),t.save().then(()=>!q&&u("saved"),ct=>{if(!q){if(A8(ct))return U=!0,I.setEditable(!1),u("removed");u("failed"),D=setTimeout(re,5e3)}})},Y=!1,Te=(ct,Br)=>{e&&!U&&Br===Ue&&(!Y&&Zs(n.kind)&&(Y=!0,t.doc.getArray("edits").push([{op:"live",at:new Date().toISOString(),author:{kind:n.kind,name:n.name},client:t.doc.clientID,inserted:0,deleted:0}])),t.touch(),u("saving"),clearTimeout(D),D=setTimeout(re,qre))};t.doc.on("update",Te),f(t.status());let rn=t.onStatus(f);return()=>{q=!0,t.doc.off("update",Te),rn(),D&&clearTimeout(D),V?.(),I.destroy()}},[t,e,n.name,n.kind]);let C=[{id:"me",name:n.name,kind:Zs(n.kind)?"agent":"person"},...l.map(Kre)],x=(I,V)=>o?.isActive(I,V)??!1,E=()=>(o.view.focus(),o.chain().focus()),k=(I,V)=>(0,Ee.jsx)("span",{"aria-hidden":"true",className:`glyph glyph--${V??"plain"}`,children:I}),T=I=>(0,Ee.jsxs)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 20 20",width:"1.25em",height:"1.25em",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:[(0,Ee.jsx)("path",{d:"M8 5h9M8 10h9M8 15h9"}),I?(0,Ee.jsx)("path",{d:"M3 4.5l1-.5v4M3 11.5h2l-2 2.5h2.2",strokeLinejoin:"round"}):(0,Ee.jsx)("path",{d:"M3.5 5h.01M3.5 10h.01M3.5 15h.01",strokeWidth:"2.6"})]}),_=(I,V,D,q)=>(0,Ee.jsx)(JI,{label:I,icon:V,pressed:D,onClick:q,disabled:!e});function z(){v(o?.getAttributes("link").href??""),w(void 0),y(!0)}function $(){let I=g.trim();if(I==="")E().extendMarkRange("link").unsetLink().run();else if(/^(https?:\/\/|mailto:)\S+$/i.test(I))E().extendMarkRange("link").setLink({href:I}).run();else return w("Use a web address that starts with https:// or http://, or a mailto: address.");o&&!o.state.selection.empty&&o.chain().setTextSelection(o.state.selection.to).unsetMark("link").run(),S.current=!0,y(!1)}return(0,Ft.useEffect)(()=>{if(m||!S.current)return;S.current=!1;let I=0,V=setInterval(()=>{if(o?.isFocused||++I>10)return clearInterval(V);o?.view.focus()},40);return()=>clearInterval(V)},[m,o]),(0,Ee.jsxs)("section",{"aria-label":"Editor",className:"adoc",children:[(0,Ee.jsxs)("div",{className:"editor-bar",children:[(0,Ee.jsxs)(WI,{label:"Formatting",children:[_("Bold",k("B","b"),x("bold"),()=>E().toggleBold().run()),_("Italic",k("I","i"),x("italic"),()=>E().toggleItalic().run()),(0,Ee.jsx)(Zg,{}),_("H1 heading",k("H1"),x("heading",{level:1}),()=>E().toggleHeading({level:1}).run()),_("H2 heading",k("H2"),x("heading",{level:2}),()=>E().toggleHeading({level:2}).run()),(0,Ee.jsx)(Zg,{}),_("Bulleted list",T(!1),x("bulletList"),()=>E().toggleBulletList().run()),_("Numbered list",T(!0),x("orderedList"),()=>E().toggleOrderedList().run()),(0,Ee.jsx)(Zg,{}),_("Link",k("\u2197"),x("link"),z)]}),(0,Ee.jsxs)("div",{className:"editor-meta",children:[(0,Ee.jsx)(n3,{entries:C,label:"People and agents here"}),(0,Ee.jsxs)("span",{role:"status",className:"muted",children:[e?"":"Read only. ",d==="disconnected"?"Offline: changes are kept and sync when you are back. ":"",c==="saving"?"Saving\u2026":c==="failed"?"Not saved. Will try again.":c==="removed"?"This document was removed. Your changes are not saved.":"Saved"]})]})]}),(0,Ee.jsx)("div",{ref:r,className:"editor-host"}),(0,Ee.jsx)("p",{className:"muted legend",children:h?(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsx)("span",{className:"agent-text",children:"Dotted text"})," was written by an agent."]}):"Text that an agent writes shows with a dotted underline."}),(0,Ee.jsx)(jf,{open:m,onOpenChange:y,title:"Link",description:"Leave it empty to remove the link.",children:(0,Ee.jsxs)("form",{className:"adoc form",onSubmit:I=>(I.preventDefault(),$()),children:[(0,Ee.jsx)(Ws,{label:"Address",value:g,onChange:I=>v(I.target.value),error:b,placeholder:"https://",autoComplete:"off"}),(0,Ee.jsxs)("div",{className:"form-actions",children:[(0,Ee.jsx)(Jg,{asChild:!0,children:(0,Ee.jsx)(kt,{type:"button",variant:"secondary",children:"Cancel"})}),(0,Ee.jsx)(kt,{type:"submit",children:"Apply"})]})]})})]})}var Wre=R(ee(),1);function M8(t,e,n,r,o,i,s){let[l,a]=(0,Xa.useState)({state:"loading"}),c=o?JSON.stringify([o.url,o.token??""]):"",u=(0,Xa.useRef)(o);u.current=o;let d=(0,Xa.useRef)(s);return d.current=s,(0,Xa.useEffect)(()=>{let f=!1,h;return a({state:"loading"}),mz(t,e,n,u.current).then(p=>{if(h=p,f)return void p.close();a({state:"ready",live:p})},p=>!f&&a({state:"error",error:p})),()=>{f=!0;let p=h;if(!p)return;let m=(async()=>{try{r&&p.dirty&&await p.save()}finally{await p.close()}})();d.current?d.current(m):m.catch(()=>{})}},[t,e,n,r,c,o?.WebSocket,i]),l}var rb=R(P(),1),O8=R(ee(),1),$k=!1,R8=()=>{$k=!0};function ob({children:t}){let e=(0,rb.useRef)(null);return(0,rb.useEffect)(()=>{$k&&($k=!1,e.current?.focus({preventScroll:!0}))},[]),(0,O8.jsx)("h1",{ref:e,tabIndex:-1,children:t})}var pr=R(P(),1);var Ye=R(ee(),1);function Yk({title:t,description:e,submit:n,danger:r,action:o,children:i,onDone:s,...l}){let[a,c]=(0,pr.useState)(),[u,d]=(0,pr.useState)(!1);(0,pr.useEffect)(()=>{l.open&&c(void 0)},[l.open]);async function f(h){h.preventDefault(),d(!0),c(void 0);try{await o(),s()}catch(p){c(_i(p))}finally{d(!1)}}return(0,Ye.jsx)(jf,{...l,title:t,description:e,children:(0,Ye.jsxs)("form",{onSubmit:f,className:"form",children:[i,a&&(0,Ye.jsx)("p",{role:"alert",className:"form-error",children:a}),(0,Ye.jsxs)("div",{className:"form-actions",children:[(0,Ye.jsx)(Jg,{asChild:!0,children:(0,Ye.jsx)(kt,{type:"button",variant:"secondary",children:"Cancel"})}),(0,Ye.jsx)(kt,{type:"submit",variant:r?"danger":"primary",loading:u,children:n})]})]})})}var Jre=t=>`${t.toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"doc"}-${crypto.randomUUID().slice(0,6)}`;function D8({open:t,onOpenChange:e,onCreated:n}){let{api:r}=Ni(),[o,i]=(0,pr.useState)(""),s=(0,pr.useRef)(void 0);return(0,pr.useEffect)(()=>{t&&(i(""),s.current=void 0)},[t]),(0,Ye.jsx)(Yk,{open:t,onOpenChange:e,title:"New document",submit:"Create",onDone:()=>e?.(!1),action:async()=>{let l=s.current!==void 0,a=s.current??=Jre(o);await r.create({id:a}).catch(c=>{if(!(l&&c instanceof Qs&&c.code==="DOCUMENT_EXISTS"))return s.current=void 0,Promise.reject(c)}),o.trim()&&await r.rename(a,{title:o}),n(a)},children:(0,Ye.jsx)(Ws,{label:"Title",value:o,onChange:l=>i(l.target.value),maxLength:120,autoComplete:"off",hint:"You can change it later."})})}function ib({id:t,current:e,open:n,onOpenChange:r,onDone:o}){let{api:i}=Ni(),[s,l]=(0,pr.useState)(e);return(0,pr.useEffect)(()=>{n&&l(e)},[n,e]),(0,Ye.jsx)(Yk,{open:n,onOpenChange:r,title:"Rename document",submit:"Rename",onDone:()=>(r?.(!1),o()),action:()=>i.rename(t,{title:s}).then(()=>{}),children:(0,Ye.jsx)(Ws,{label:"Title",value:s,onChange:a=>l(a.target.value),maxLength:120,autoComplete:"off"})})}function sb({id:t,name:e,open:n,onOpenChange:r,onDone:o}){let{api:i}=Ni();return(0,Ye.jsx)(Yk,{open:n,onOpenChange:r,danger:!0,title:"Delete document",description:`Delete "${e}" for everyone? This cannot be undone.`,submit:"Delete",onDone:()=>(r?.(!1),o()),action:()=>i.remove(t).then(()=>{})})}function N8({id:t,open:e,onOpenChange:n}){let{api:r}=Ni(),[o,i]=(0,pr.useState)(),[s,l]=(0,pr.useState)(!1);(0,pr.useEffect)(()=>{e&&(l(!1),r.room(t).then(({contributors:c})=>i(c.map(u=>({id:`${u.kind}:${u.name}`,name:u.name,kind:Zs(u.kind)?"agent":"person"}))),()=>i([])))},[e,r,t]);let a=`${location.origin}/#/d/${encodeURIComponent(t)}`;return(0,Ye.jsx)(jf,{open:e,onOpenChange:n,title:"Share document",description:"Anyone with an access token for this server can open this link.",children:(0,Ye.jsxs)("div",{className:"form",children:[(0,Ye.jsx)(Ws,{label:"Link",readOnly:!0,value:a,onFocus:c=>c.currentTarget.select()}),(0,Ye.jsxs)("div",{className:"form-actions",children:[(0,Ye.jsx)(kt,{type:"button",onClick:()=>navigator.clipboard.writeText(a).then(()=>l(!0),()=>l(!1)),children:"Copy link"}),(0,Ye.jsx)("span",{role:"status",children:s?"Link copied.":""})]}),(0,Ye.jsx)("h3",{className:"section-title",children:"Who has changed this document"}),o===void 0?(0,Ye.jsx)("p",{role:"status",children:"Loading\u2026"}):o.length===0?(0,Ye.jsx)("p",{children:"Nobody has edited it in a live room yet."}):(0,Ye.jsx)("ul",{className:"people",children:o.map(c=>(0,Ye.jsx)("li",{children:(0,Ye.jsx)(Ox,{entry:c})},c.id))}),(0,Ye.jsx)("p",{className:"muted",children:"Roles, invites, and expiring links are not available yet."})]})})}var at=R(ee(),1);function Qre(t,e){let n=new URL(`/api/v1/docs/${encodeURIComponent(t)}/ws`,location.href);return n.protocol=n.protocol==="https:"?"wss:":"ws:",{url:n.toString(),token:e}}function _8({id:t,go:e}){let{api:n,token:r,me:o}=Ni(),[i,s]=(0,Rl.useState)(),[l,a]=(0,Rl.useState)(),[c,u]=(0,Rl.useState)(0),d=(0,Rl.useMemo)(()=>Qre(t,r),[t,r]),f=M8(n,t,o.name,o.role==="editor",d,c),h=()=>n.list().then(m=>s({id:t,title:m.find(y=>y.id===t)?.title??t}),m=>s({id:t,error:m}));(0,Rl.useEffect)(()=>{h()},[n,t,c]);let p=f.state==="error"?f.error:i&&"error"in i?i.error:void 0;return p!==void 0?(0,at.jsx)("div",{role:"alert",className:"notice",children:(0,at.jsx)(ca,{title:"Could not open this document",description:_i(p),action:(0,at.jsxs)(at.Fragment,{children:[(0,at.jsx)(kt,{onClick:()=>u(c+1),children:"Try again"})," ",(0,at.jsx)(kt,{variant:"secondary",onClick:()=>e("#/"),children:"Back to documents"})]})})}):f.state!=="ready"||!i||i.id!==t||!("title"in i)?(0,at.jsx)("p",{role:"status",className:"muted",children:"Opening document\u2026"}):(0,at.jsxs)(at.Fragment,{children:[(0,at.jsxs)("div",{className:"page-head",children:[(0,at.jsx)(ob,{children:i.title}),(0,at.jsxs)("div",{className:"page-actions",children:[o.role==="editor"&&(0,at.jsx)(kt,{variant:"secondary",onClick:()=>a("rename"),children:"Rename"}),(0,at.jsx)(kt,{onClick:()=>a("share"),children:"Share"}),o.role==="editor"&&(0,at.jsx)(kt,{variant:"danger",onClick:()=>a("delete"),children:"Delete"})]})]}),(0,at.jsx)(mp,{children:(0,at.jsx)(Fk,{live:f.live,editable:o.role==="editor",principal:o})}),(0,at.jsx)(ib,{id:t,current:i.title,open:l==="rename",onOpenChange:m=>!m&&a(void 0),onDone:()=>{h()}}),(0,at.jsx)(sb,{id:t,name:i.title,open:l==="delete",onOpenChange:m=>!m&&a(void 0),onDone:()=>e("#/")}),(0,at.jsx)(N8,{id:t,open:l==="share",onOpenChange:m=>!m&&a(void 0)})]})}var is=R(P(),1);var gt=R(ee(),1);function I8({go:t}){let{api:e,me:n}=Ni(),[r,o]=(0,is.useState)({state:"loading"}),[i,s]=(0,is.useState)(!1),[l,a]=(0,is.useState)(),[c,u]=(0,is.useState)(),d=n.role==="editor",f=(0,is.useCallback)((m=!1)=>(m||o({state:"loading"}),e.list().then(y=>o({state:"ready",docs:y.sort((g,v)=>v.updatedAt-g.updatedAt)}),y=>o({state:"error",message:_i(y)}))),[e]);(0,is.useEffect)(()=>{f()},[f]);let h=()=>{f(!0).then(()=>document.querySelector("h1")?.focus())},p=d?(0,gt.jsxs)(kt,{onClick:()=>s(!0),children:[(0,gt.jsx)(M2,{"aria-hidden":!0})," New document"]}):void 0;return(0,gt.jsxs)(gt.Fragment,{children:[(0,gt.jsxs)("div",{className:"page-head",children:[(0,gt.jsx)(ob,{children:"Documents"}),r.state==="ready"&&r.docs.length>0&&p]}),r.state==="loading"&&(0,gt.jsx)("p",{role:"status",className:"muted",children:"Loading documents\u2026"}),r.state==="error"&&(0,gt.jsx)("div",{role:"alert",className:"notice",children:(0,gt.jsx)(ca,{title:"Could not load documents",description:r.message,action:(0,gt.jsx)(kt,{onClick:()=>{f()},children:"Try again"})})}),r.state==="ready"&&r.docs.length===0&&(0,gt.jsx)(ca,{title:"No documents yet",description:d?"Make one to start writing, with people and agents.":"Nothing has been shared with this token.",action:p}),r.state==="ready"&&r.docs.length>0&&(0,gt.jsx)(r3,{label:"Documents",children:r.docs.map(m=>(0,gt.jsx)(o3,{name:m.title,href:`#/d/${encodeURIComponent(m.id)}`,modified:new Date(m.updatedAt),editedBy:{id:`${m.updatedBy.kind}:${m.updatedBy.name}`,name:m.updatedBy.name,kind:Zs(m.updatedBy.kind)?"agent":"person"},actions:d&&(0,gt.jsx)(UI,{align:"end",trigger:(0,gt.jsx)(sa,{label:`Actions for ${m.title}`,icon:(0,gt.jsx)(R2,{"aria-hidden":!0}),variant:"ghost"}),items:[{label:"Rename",onSelect:()=>a(m)},"separator",{label:"Delete",danger:!0,onSelect:()=>u(m)}]})},m.id))}),(0,gt.jsx)(D8,{open:i,onOpenChange:s,onCreated:m=>t(`#/d/${encodeURIComponent(m)}`)}),(0,gt.jsx)(ib,{id:l?.id??"",current:l?.title??"",open:l!==void 0,onOpenChange:m=>!m&&a(void 0),onDone:h}),(0,gt.jsx)(sb,{id:c?.id??"",name:c?.title??"",open:c!==void 0,onOpenChange:m=>!m&&u(void 0),onDone:h})]})}var ge=R(ee(),1),Zre=()=>{let[t,e]=(0,Ln.useState)(location.hash||"#/");return(0,Ln.useEffect)(()=>{let n=()=>(R8(),e(location.hash||"#/"));return window.addEventListener("hashchange",n),()=>window.removeEventListener("hashchange",n)},[]),[t,n=>location.hash=n]};function eoe({onSignedIn:t}){let[e,n]=(0,Ln.useState)(""),[r,o]=(0,Ln.useState)(),[i,s]=(0,Ln.useState)(!1);async function l(a){a.preventDefault(),s(!0),o(void 0);try{t(e.trim(),await ty(e.trim()).me())}catch(c){o(_i(c))}finally{s(!1)}}return(0,ge.jsxs)("main",{className:"signin",children:[(0,ge.jsx)("h1",{children:"Sign in"}),(0,ge.jsx)("p",{className:"muted",children:"Paste an access token for this server. The token stays in this tab."}),(0,ge.jsxs)("form",{onSubmit:l,className:"form",children:[(0,ge.jsx)(Ws,{label:"Access token",type:"password",value:e,onChange:a=>n(a.target.value),error:r,autoComplete:"off",required:!0}),(0,ge.jsx)(kt,{type:"submit",loading:i,children:"Sign in"})]})]})}function toe(){let{preference:t,setPreference:e}=o_();return(0,ge.jsxs)(O2,{label:"Theme",hideLabel:!0,value:t,onChange:n=>e(n.target.value),children:[(0,ge.jsx)("option",{value:"system",children:"Theme: System"}),(0,ge.jsx)("option",{value:"light",children:"Theme: Light"}),(0,ge.jsx)("option",{value:"dark",children:"Theme: Dark"})]})}function noe({session:t}){let[e,n]=Zre(),r=/^#\/d\/([^/]+)$/.exec(e),o=r?decodeURIComponent(r[1]):void 0;return(0,ge.jsx)(Lx.Provider,{value:t,children:(0,ge.jsx)(HI,{brand:"Documents",sidebar:(0,ge.jsx)(jI,{label:"Main",items:[{href:"#/",label:"Documents",current:o===void 0}]}),topbar:(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)(toe,{}),(0,ge.jsxs)("span",{className:"muted",children:[t.me.name,t.me.role==="viewer"?" (viewer)":""]}),(0,ge.jsx)(kt,{variant:"secondary",size:"sm",onClick:t.signOut,children:"Sign out"})]}),children:o===void 0?(0,ge.jsx)(I8,{go:n}):(0,ge.jsx)(_8,{id:o,go:n},o)})})}function roe(){let[t,e]=(0,Ln.useState)(_x()?"checking":null),[n,r]=(0,Ln.useState)();(0,Ln.useEffect)(()=>{let s=_x();s&&ty(s).me().then(l=>e({token:s,me:l}),l=>(Ix(),r(_i(l)),e(null)))},[]);let o=(0,Ln.useCallback)(()=>(Ix(),e(null),location.hash="#/"),[]),i=(0,Ln.useMemo)(()=>t&&t!=="checking"?{api:ty(t.token),token:t.token,me:t.me,signOut:o}:null,[t,o]);return t==="checking"?(0,ge.jsx)("p",{role:"status",className:"signin muted",children:"Checking your token\u2026"}):i?(0,ge.jsx)(noe,{session:i}):(0,ge.jsxs)(ge.Fragment,{children:[n&&(0,ge.jsx)("p",{role:"alert",className:"signin form-error",children:n}),(0,ge.jsx)(eoe,{onSignedIn:(s,l)=>(l3(s),e({token:s,me:l}))})]})}(0,L8.createRoot)(document.getElementById("root")).render((0,ge.jsx)(Ln.StrictMode,{children:(0,ge.jsx)(r_,{children:(0,ge.jsx)(hx,{children:(0,ge.jsx)(PI,{children:(0,ge.jsx)(roe,{})})})})}));
|
|
214
|
+
/*! Bundled license information:
|
|
215
|
+
|
|
216
|
+
react/cjs/react.production.js:
|
|
217
|
+
(**
|
|
218
|
+
* @license React
|
|
219
|
+
* react.production.js
|
|
220
|
+
*
|
|
221
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
222
|
+
*
|
|
223
|
+
* This source code is licensed under the MIT license found in the
|
|
224
|
+
* LICENSE file in the root directory of this source tree.
|
|
225
|
+
*)
|
|
226
|
+
|
|
227
|
+
scheduler/cjs/scheduler.production.js:
|
|
228
|
+
(**
|
|
229
|
+
* @license React
|
|
230
|
+
* scheduler.production.js
|
|
231
|
+
*
|
|
232
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
233
|
+
*
|
|
234
|
+
* This source code is licensed under the MIT license found in the
|
|
235
|
+
* LICENSE file in the root directory of this source tree.
|
|
236
|
+
*)
|
|
237
|
+
|
|
238
|
+
react-dom/cjs/react-dom.production.js:
|
|
239
|
+
(**
|
|
240
|
+
* @license React
|
|
241
|
+
* react-dom.production.js
|
|
242
|
+
*
|
|
243
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
244
|
+
*
|
|
245
|
+
* This source code is licensed under the MIT license found in the
|
|
246
|
+
* LICENSE file in the root directory of this source tree.
|
|
247
|
+
*)
|
|
248
|
+
|
|
249
|
+
react-dom/cjs/react-dom-client.production.js:
|
|
250
|
+
(**
|
|
251
|
+
* @license React
|
|
252
|
+
* react-dom-client.production.js
|
|
253
|
+
*
|
|
254
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
255
|
+
*
|
|
256
|
+
* This source code is licensed under the MIT license found in the
|
|
257
|
+
* LICENSE file in the root directory of this source tree.
|
|
258
|
+
*)
|
|
259
|
+
|
|
260
|
+
react/cjs/react-jsx-runtime.production.js:
|
|
261
|
+
(**
|
|
262
|
+
* @license React
|
|
263
|
+
* react-jsx-runtime.production.js
|
|
264
|
+
*
|
|
265
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
266
|
+
*
|
|
267
|
+
* This source code is licensed under the MIT license found in the
|
|
268
|
+
* LICENSE file in the root directory of this source tree.
|
|
269
|
+
*)
|
|
270
|
+
*/
|