@promptowl/contextnest-community 0.1.0-alpha.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,591 @@
1
+ function uj(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in t)){const s=Object.getOwnPropertyDescriptor(r,o);s&&Object.defineProperty(t,o,s.get?s:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();function Wm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var qh={exports:{}},Rl={},Gh={exports:{}},Fe={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var h0;function dj(){if(h0)return Fe;h0=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.iterator;function y(R){return R===null||typeof R!="object"?null:(R=m&&R[m]||R["@@iterator"],typeof R=="function"?R:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,k={};function C(R,U,Ne){this.props=R,this.context=U,this.refs=k,this.updater=Ne||x}C.prototype.isReactComponent={},C.prototype.setState=function(R,U){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,U,"setState")},C.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function N(){}N.prototype=C.prototype;function M(R,U,Ne){this.props=R,this.context=U,this.refs=k,this.updater=Ne||x}var T=M.prototype=new N;T.constructor=M,b(T,C.prototype),T.isPureReactComponent=!0;var j=Array.isArray,P=Object.prototype.hasOwnProperty,L={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function _(R,U,Ne){var Se,we={},he=null,oe=null;if(U!=null)for(Se in U.ref!==void 0&&(oe=U.ref),U.key!==void 0&&(he=""+U.key),U)P.call(U,Se)&&!I.hasOwnProperty(Se)&&(we[Se]=U[Se]);var pe=arguments.length-2;if(pe===1)we.children=Ne;else if(1<pe){for(var le=Array(pe),je=0;je<pe;je++)le[je]=arguments[je+2];we.children=le}if(R&&R.defaultProps)for(Se in pe=R.defaultProps,pe)we[Se]===void 0&&(we[Se]=pe[Se]);return{$$typeof:t,type:R,key:he,ref:oe,props:we,_owner:L.current}}function $(R,U){return{$$typeof:t,type:R.type,key:U,ref:R.ref,props:R.props,_owner:R._owner}}function q(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function X(R){var U={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(Ne){return U[Ne]})}var ee=/\/+/g;function K(R,U){return typeof R=="object"&&R!==null&&R.key!=null?X(""+R.key):U.toString(36)}function ie(R,U,Ne,Se,we){var he=typeof R;(he==="undefined"||he==="boolean")&&(R=null);var oe=!1;if(R===null)oe=!0;else switch(he){case"string":case"number":oe=!0;break;case"object":switch(R.$$typeof){case t:case e:oe=!0}}if(oe)return oe=R,we=we(oe),R=Se===""?"."+K(oe,0):Se,j(we)?(Ne="",R!=null&&(Ne=R.replace(ee,"$&/")+"/"),ie(we,U,Ne,"",function(je){return je})):we!=null&&(q(we)&&(we=$(we,Ne+(!we.key||oe&&oe.key===we.key?"":(""+we.key).replace(ee,"$&/")+"/")+R)),U.push(we)),1;if(oe=0,Se=Se===""?".":Se+":",j(R))for(var pe=0;pe<R.length;pe++){he=R[pe];var le=Se+K(he,pe);oe+=ie(he,U,Ne,le,we)}else if(le=y(R),typeof le=="function")for(R=le.call(R),pe=0;!(he=R.next()).done;)he=he.value,le=Se+K(he,pe++),oe+=ie(he,U,Ne,le,we);else if(he==="object")throw U=String(R),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.");return oe}function ne(R,U,Ne){if(R==null)return R;var Se=[],we=0;return ie(R,Se,"","",function(he){return U.call(Ne,he,we++)}),Se}function re(R){if(R._status===-1){var U=R._result;U=U(),U.then(function(Ne){(R._status===0||R._status===-1)&&(R._status=1,R._result=Ne)},function(Ne){(R._status===0||R._status===-1)&&(R._status=2,R._result=Ne)}),R._status===-1&&(R._status=0,R._result=U)}if(R._status===1)return R._result.default;throw R._result}var ae={current:null},H={transition:null},W={ReactCurrentDispatcher:ae,ReactCurrentBatchConfig:H,ReactCurrentOwner:L};function B(){throw Error("act(...) is not supported in production builds of React.")}return Fe.Children={map:ne,forEach:function(R,U,Ne){ne(R,function(){U.apply(this,arguments)},Ne)},count:function(R){var U=0;return ne(R,function(){U++}),U},toArray:function(R){return ne(R,function(U){return U})||[]},only:function(R){if(!q(R))throw Error("React.Children.only expected to receive a single React element child.");return R}},Fe.Component=C,Fe.Fragment=n,Fe.Profiler=o,Fe.PureComponent=M,Fe.StrictMode=r,Fe.Suspense=u,Fe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W,Fe.act=B,Fe.cloneElement=function(R,U,Ne){if(R==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+R+".");var Se=b({},R.props),we=R.key,he=R.ref,oe=R._owner;if(U!=null){if(U.ref!==void 0&&(he=U.ref,oe=L.current),U.key!==void 0&&(we=""+U.key),R.type&&R.type.defaultProps)var pe=R.type.defaultProps;for(le in U)P.call(U,le)&&!I.hasOwnProperty(le)&&(Se[le]=U[le]===void 0&&pe!==void 0?pe[le]:U[le])}var le=arguments.length-2;if(le===1)Se.children=Ne;else if(1<le){pe=Array(le);for(var je=0;je<le;je++)pe[je]=arguments[je+2];Se.children=pe}return{$$typeof:t,type:R.type,key:we,ref:he,props:Se,_owner:oe}},Fe.createContext=function(R){return R={$$typeof:l,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},R.Provider={$$typeof:s,_context:R},R.Consumer=R},Fe.createElement=_,Fe.createFactory=function(R){var U=_.bind(null,R);return U.type=R,U},Fe.createRef=function(){return{current:null}},Fe.forwardRef=function(R){return{$$typeof:c,render:R}},Fe.isValidElement=q,Fe.lazy=function(R){return{$$typeof:p,_payload:{_status:-1,_result:R},_init:re}},Fe.memo=function(R,U){return{$$typeof:h,type:R,compare:U===void 0?null:U}},Fe.startTransition=function(R){var U=H.transition;H.transition={};try{R()}finally{H.transition=U}},Fe.unstable_act=B,Fe.useCallback=function(R,U){return ae.current.useCallback(R,U)},Fe.useContext=function(R){return ae.current.useContext(R)},Fe.useDebugValue=function(){},Fe.useDeferredValue=function(R){return ae.current.useDeferredValue(R)},Fe.useEffect=function(R,U){return ae.current.useEffect(R,U)},Fe.useId=function(){return ae.current.useId()},Fe.useImperativeHandle=function(R,U,Ne){return ae.current.useImperativeHandle(R,U,Ne)},Fe.useInsertionEffect=function(R,U){return ae.current.useInsertionEffect(R,U)},Fe.useLayoutEffect=function(R,U){return ae.current.useLayoutEffect(R,U)},Fe.useMemo=function(R,U){return ae.current.useMemo(R,U)},Fe.useReducer=function(R,U,Ne){return ae.current.useReducer(R,U,Ne)},Fe.useRef=function(R){return ae.current.useRef(R)},Fe.useState=function(R){return ae.current.useState(R)},Fe.useSyncExternalStore=function(R,U,Ne){return ae.current.useSyncExternalStore(R,U,Ne)},Fe.useTransition=function(){return ae.current.useTransition()},Fe.version="18.3.1",Fe}var p0;function ga(){return p0||(p0=1,Gh.exports=dj()),Gh.exports}/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var m0;function fj(){if(m0)return Rl;m0=1;var t=ga(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function l(c,u,h){var p,m={},y=null,x=null;h!==void 0&&(y=""+h),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(x=u.ref);for(p in u)r.call(u,p)&&!s.hasOwnProperty(p)&&(m[p]=u[p]);if(c&&c.defaultProps)for(p in u=c.defaultProps,u)m[p]===void 0&&(m[p]=u[p]);return{$$typeof:e,type:c,key:y,ref:x,props:m,_owner:o.current}}return Rl.Fragment=n,Rl.jsx=l,Rl.jsxs=l,Rl}var g0;function hj(){return g0||(g0=1,qh.exports=fj()),qh.exports}var f=hj(),w=ga();const Yt=Wm(w),Um=uj({__proto__:null,default:Yt},[w]);var _c={},Jh={exports:{}},pn={},Yh={exports:{}},Qh={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var y0;function pj(){return y0||(y0=1,(function(t){function e(H,W){var B=H.length;H.push(W);e:for(;0<B;){var R=B-1>>>1,U=H[R];if(0<o(U,W))H[R]=W,H[B]=U,B=R;else break e}}function n(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var W=H[0],B=H.pop();if(B!==W){H[0]=B;e:for(var R=0,U=H.length,Ne=U>>>1;R<Ne;){var Se=2*(R+1)-1,we=H[Se],he=Se+1,oe=H[he];if(0>o(we,B))he<U&&0>o(oe,we)?(H[R]=oe,H[he]=B,R=he):(H[R]=we,H[Se]=B,R=Se);else if(he<U&&0>o(oe,B))H[R]=oe,H[he]=B,R=he;else break e}}return W}function o(H,W){var B=H.sortIndex-W.sortIndex;return B!==0?B:H.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var l=Date,c=l.now();t.unstable_now=function(){return l.now()-c}}var u=[],h=[],p=1,m=null,y=3,x=!1,b=!1,k=!1,C=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(H){for(var W=n(h);W!==null;){if(W.callback===null)r(h);else if(W.startTime<=H)r(h),W.sortIndex=W.expirationTime,e(u,W);else break;W=n(h)}}function j(H){if(k=!1,T(H),!b)if(n(u)!==null)b=!0,re(P);else{var W=n(h);W!==null&&ae(j,W.startTime-H)}}function P(H,W){b=!1,k&&(k=!1,N(_),_=-1),x=!0;var B=y;try{for(T(W),m=n(u);m!==null&&(!(m.expirationTime>W)||H&&!X());){var R=m.callback;if(typeof R=="function"){m.callback=null,y=m.priorityLevel;var U=R(m.expirationTime<=W);W=t.unstable_now(),typeof U=="function"?m.callback=U:m===n(u)&&r(u),T(W)}else r(u);m=n(u)}if(m!==null)var Ne=!0;else{var Se=n(h);Se!==null&&ae(j,Se.startTime-W),Ne=!1}return Ne}finally{m=null,y=B,x=!1}}var L=!1,I=null,_=-1,$=5,q=-1;function X(){return!(t.unstable_now()-q<$)}function ee(){if(I!==null){var H=t.unstable_now();q=H;var W=!0;try{W=I(!0,H)}finally{W?K():(L=!1,I=null)}}else L=!1}var K;if(typeof M=="function")K=function(){M(ee)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,ne=ie.port2;ie.port1.onmessage=ee,K=function(){ne.postMessage(null)}}else K=function(){C(ee,0)};function re(H){I=H,L||(L=!0,K())}function ae(H,W){_=C(function(){H(t.unstable_now())},W)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(H){H.callback=null},t.unstable_continueExecution=function(){b||x||(b=!0,re(P))},t.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<H?Math.floor(1e3/H):5},t.unstable_getCurrentPriorityLevel=function(){return y},t.unstable_getFirstCallbackNode=function(){return n(u)},t.unstable_next=function(H){switch(y){case 1:case 2:case 3:var W=3;break;default:W=y}var B=y;y=W;try{return H()}finally{y=B}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(H,W){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var B=y;y=H;try{return W()}finally{y=B}},t.unstable_scheduleCallback=function(H,W,B){var R=t.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?R+B:R):B=R,H){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=B+U,H={id:p++,callback:W,priorityLevel:H,startTime:B,expirationTime:U,sortIndex:-1},B>R?(H.sortIndex=B,e(h,H),n(u)===null&&H===n(h)&&(k?(N(_),_=-1):k=!0,ae(j,B-R))):(H.sortIndex=U,e(u,H),b||x||(b=!0,re(P))),H},t.unstable_shouldYield=X,t.unstable_wrapCallback=function(H){var W=y;return function(){var B=y;y=W;try{return H.apply(this,arguments)}finally{y=B}}}})(Qh)),Qh}var x0;function mj(){return x0||(x0=1,Yh.exports=pj()),Yh.exports}/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var v0;function gj(){if(v0)return pn;v0=1;var t=ga(),e=mj();function n(i){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+i,d=1;d<arguments.length;d++)a+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+i+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,o={};function s(i,a){l(i,a),l(i+"Capture",a)}function l(i,a){for(o[i]=a,i=0;i<a.length;i++)r.add(a[i])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[: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]*$/,p={},m={};function y(i){return u.call(m,i)?!0:u.call(p,i)?!1:h.test(i)?m[i]=!0:(p[i]=!0,!1)}function x(i,a,d,g){if(d!==null&&d.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return g?!1:d!==null?!d.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function b(i,a,d,g){if(a===null||typeof a>"u"||x(i,a,d,g))return!0;if(g)return!1;if(d!==null)switch(d.type){case 3:return!a;case 4:return a===!1;case 5:return isNaN(a);case 6:return isNaN(a)||1>a}return!1}function k(i,a,d,g,v,S,E){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=g,this.attributeNamespace=v,this.mustUseProperty=d,this.propertyName=i,this.type=a,this.sanitizeURL=S,this.removeEmptyString=E}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){C[i]=new k(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var a=i[0];C[a]=new k(a,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){C[i]=new k(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){C[i]=new k(i,2,!1,i,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(i){C[i]=new k(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){C[i]=new k(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){C[i]=new k(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){C[i]=new k(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){C[i]=new k(i,5,!1,i.toLowerCase(),null,!1,!1)});var N=/[\-:]([a-z])/g;function M(i){return i[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(i){var a=i.replace(N,M);C[a]=new k(a,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var a=i.replace(N,M);C[a]=new k(a,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var a=i.replace(N,M);C[a]=new k(a,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){C[i]=new k(i,1,!1,i.toLowerCase(),null,!1,!1)}),C.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){C[i]=new k(i,1,!1,i.toLowerCase(),null,!0,!0)});function T(i,a,d,g){var v=C.hasOwnProperty(a)?C[a]:null;(v!==null?v.type!==0:g||!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(b(a,d,v,g)&&(d=null),g||v===null?y(a)&&(d===null?i.removeAttribute(a):i.setAttribute(a,""+d)):v.mustUseProperty?i[v.propertyName]=d===null?v.type===3?!1:"":d:(a=v.attributeName,g=v.attributeNamespace,d===null?i.removeAttribute(a):(v=v.type,d=v===3||v===4&&d===!0?"":""+d,g?i.setAttributeNS(g,a,d):i.setAttribute(a,d))))}var j=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,P=Symbol.for("react.element"),L=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),$=Symbol.for("react.profiler"),q=Symbol.for("react.provider"),X=Symbol.for("react.context"),ee=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),ie=Symbol.for("react.suspense_list"),ne=Symbol.for("react.memo"),re=Symbol.for("react.lazy"),ae=Symbol.for("react.offscreen"),H=Symbol.iterator;function W(i){return i===null||typeof i!="object"?null:(i=H&&i[H]||i["@@iterator"],typeof i=="function"?i:null)}var B=Object.assign,R;function U(i){if(R===void 0)try{throw Error()}catch(d){var a=d.stack.trim().match(/\n( *(at )?)/);R=a&&a[1]||""}return`
34
+ `+R+i}var Ne=!1;function Se(i,a){if(!i||Ne)return"";Ne=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(V){var g=V}Reflect.construct(i,[],a)}else{try{a.call()}catch(V){g=V}i.call(a.prototype)}else{try{throw Error()}catch(V){g=V}i()}}catch(V){if(V&&g&&typeof V.stack=="string"){for(var v=V.stack.split(`
35
+ `),S=g.stack.split(`
36
+ `),E=v.length-1,A=S.length-1;1<=E&&0<=A&&v[E]!==S[A];)A--;for(;1<=E&&0<=A;E--,A--)if(v[E]!==S[A]){if(E!==1||A!==1)do if(E--,A--,0>A||v[E]!==S[A]){var O=`
37
+ `+v[E].replace(" at new "," at ");return i.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",i.displayName)),O}while(1<=E&&0<=A);break}}}finally{Ne=!1,Error.prepareStackTrace=d}return(i=i?i.displayName||i.name:"")?U(i):""}function we(i){switch(i.tag){case 5:return U(i.type);case 16:return U("Lazy");case 13:return U("Suspense");case 19:return U("SuspenseList");case 0:case 2:case 15:return i=Se(i.type,!1),i;case 11:return i=Se(i.type.render,!1),i;case 1:return i=Se(i.type,!0),i;default:return""}}function he(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case I:return"Fragment";case L:return"Portal";case $:return"Profiler";case _:return"StrictMode";case K:return"Suspense";case ie:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case X:return(i.displayName||"Context")+".Consumer";case q:return(i._context.displayName||"Context")+".Provider";case ee:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case ne:return a=i.displayName||null,a!==null?a:he(i.type)||"Memo";case re:a=i._payload,i=i._init;try{return he(i(a))}catch{}}return null}function oe(i){var a=i.type;switch(i.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=a.render,i=i.displayName||i.name||"",a.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return he(a);case 8:return a===_?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function pe(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function le(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function je(i){var a=le(i)?"checked":"value",d=Object.getOwnPropertyDescriptor(i.constructor.prototype,a),g=""+i[a];if(!i.hasOwnProperty(a)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var v=d.get,S=d.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return v.call(this)},set:function(E){g=""+E,S.call(this,E)}}),Object.defineProperty(i,a,{enumerable:d.enumerable}),{getValue:function(){return g},setValue:function(E){g=""+E},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function De(i){i._valueTracker||(i._valueTracker=je(i))}function _e(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var d=a.getValue(),g="";return i&&(g=le(i)?i.checked?"true":"false":i.value),i=g,i!==d?(a.setValue(i),!0):!1}function Je(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function rt(i,a){var d=a.checked;return B({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??i._wrapperState.initialChecked})}function de(i,a){var d=a.defaultValue==null?"":a.defaultValue,g=a.checked!=null?a.checked:a.defaultChecked;d=pe(a.value!=null?a.value:d),i._wrapperState={initialChecked:g,initialValue:d,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function We(i,a){a=a.checked,a!=null&&T(i,"checked",a,!1)}function ot(i,a){We(i,a);var d=pe(a.value),g=a.type;if(d!=null)g==="number"?(d===0&&i.value===""||i.value!=d)&&(i.value=""+d):i.value!==""+d&&(i.value=""+d);else if(g==="submit"||g==="reset"){i.removeAttribute("value");return}a.hasOwnProperty("value")?wn(i,a.type,d):a.hasOwnProperty("defaultValue")&&wn(i,a.type,pe(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(i.defaultChecked=!!a.defaultChecked)}function Pn(i,a,d){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var g=a.type;if(!(g!=="submit"&&g!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+i._wrapperState.initialValue,d||a===i.value||(i.value=a),i.defaultValue=a}d=i.name,d!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,d!==""&&(i.name=d)}function wn(i,a,d){(a!=="number"||Je(i.ownerDocument)!==i)&&(d==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+d&&(i.defaultValue=""+d))}var se=Array.isArray;function Be(i,a,d,g){if(i=i.options,a){a={};for(var v=0;v<d.length;v++)a["$"+d[v]]=!0;for(d=0;d<i.length;d++)v=a.hasOwnProperty("$"+i[d].value),i[d].selected!==v&&(i[d].selected=v),v&&g&&(i[d].defaultSelected=!0)}else{for(d=""+pe(d),a=null,v=0;v<i.length;v++){if(i[v].value===d){i[v].selected=!0,g&&(i[v].defaultSelected=!0);return}a!==null||i[v].disabled||(a=i[v])}a!==null&&(a.selected=!0)}}function lt(i,a){if(a.dangerouslySetInnerHTML!=null)throw Error(n(91));return B({},a,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function fr(i,a){var d=a.value;if(d==null){if(d=a.children,a=a.defaultValue,d!=null){if(a!=null)throw Error(n(92));if(se(d)){if(1<d.length)throw Error(n(93));d=d[0]}a=d}a==null&&(a=""),d=a}i._wrapperState={initialValue:pe(d)}}function Cy(i,a){var d=pe(a.value),g=pe(a.defaultValue);d!=null&&(d=""+d,d!==i.value&&(i.value=d),a.defaultValue==null&&i.defaultValue!==d&&(i.defaultValue=d)),g!=null&&(i.defaultValue=""+g)}function Ny(i){var a=i.textContent;a===i._wrapperState.initialValue&&a!==""&&a!==null&&(i.value=a)}function Ey(i){switch(i){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function rf(i,a){return i==null||i==="http://www.w3.org/1999/xhtml"?Ey(a):i==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var Ta,My=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,d,g,v){MSApp.execUnsafeLocalFunction(function(){return i(a,d,g,v)})}:i})(function(i,a){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=a;else{for(Ta=Ta||document.createElement("div"),Ta.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=Ta.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;a.firstChild;)i.appendChild(a.firstChild)}});function qi(i,a){if(a){var d=i.firstChild;if(d&&d===i.lastChild&&d.nodeType===3){d.nodeValue=a;return}}i.textContent=a}var Gi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},pT=["Webkit","ms","Moz","O"];Object.keys(Gi).forEach(function(i){pT.forEach(function(a){a=a+i.charAt(0).toUpperCase()+i.substring(1),Gi[a]=Gi[i]})});function Ty(i,a,d){return a==null||typeof a=="boolean"||a===""?"":d||typeof a!="number"||a===0||Gi.hasOwnProperty(i)&&Gi[i]?(""+a).trim():a+"px"}function jy(i,a){i=i.style;for(var d in a)if(a.hasOwnProperty(d)){var g=d.indexOf("--")===0,v=Ty(d,a[d],g);d==="float"&&(d="cssFloat"),g?i.setProperty(d,v):i[d]=v}}var mT=B({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function of(i,a){if(a){if(mT[i]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(n(137,i));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(n(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(n(61))}if(a.style!=null&&typeof a.style!="object")throw Error(n(62))}}function sf(i,a){if(i.indexOf("-")===-1)return typeof a.is=="string";switch(i){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 lf=null;function af(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var cf=null,Us=null,Ks=null;function Ay(i){if(i=gl(i)){if(typeof cf!="function")throw Error(n(280));var a=i.stateNode;a&&(a=Qa(a),cf(i.stateNode,i.type,a))}}function Ry(i){Us?Ks?Ks.push(i):Ks=[i]:Us=i}function Py(){if(Us){var i=Us,a=Ks;if(Ks=Us=null,Ay(i),a)for(i=0;i<a.length;i++)Ay(a[i])}}function Oy(i,a){return i(a)}function Iy(){}var uf=!1;function Dy(i,a,d){if(uf)return i(a,d);uf=!0;try{return Oy(i,a,d)}finally{uf=!1,(Us!==null||Ks!==null)&&(Iy(),Py())}}function Ji(i,a){var d=i.stateNode;if(d===null)return null;var g=Qa(d);if(g===null)return null;d=g[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(i=i.type,g=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!g;break e;default:i=!1}if(i)return null;if(d&&typeof d!="function")throw Error(n(231,a,typeof d));return d}var df=!1;if(c)try{var Yi={};Object.defineProperty(Yi,"passive",{get:function(){df=!0}}),window.addEventListener("test",Yi,Yi),window.removeEventListener("test",Yi,Yi)}catch{df=!1}function gT(i,a,d,g,v,S,E,A,O){var V=Array.prototype.slice.call(arguments,3);try{a.apply(d,V)}catch(J){this.onError(J)}}var Qi=!1,ja=null,Aa=!1,ff=null,yT={onError:function(i){Qi=!0,ja=i}};function xT(i,a,d,g,v,S,E,A,O){Qi=!1,ja=null,gT.apply(yT,arguments)}function vT(i,a,d,g,v,S,E,A,O){if(xT.apply(this,arguments),Qi){if(Qi){var V=ja;Qi=!1,ja=null}else throw Error(n(198));Aa||(Aa=!0,ff=V)}}function es(i){var a=i,d=i;if(i.alternate)for(;a.return;)a=a.return;else{i=a;do a=i,(a.flags&4098)!==0&&(d=a.return),i=a.return;while(i)}return a.tag===3?d:null}function _y(i){if(i.tag===13){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function Ly(i){if(es(i)!==i)throw Error(n(188))}function wT(i){var a=i.alternate;if(!a){if(a=es(i),a===null)throw Error(n(188));return a!==i?null:i}for(var d=i,g=a;;){var v=d.return;if(v===null)break;var S=v.alternate;if(S===null){if(g=v.return,g!==null){d=g;continue}break}if(v.child===S.child){for(S=v.child;S;){if(S===d)return Ly(v),i;if(S===g)return Ly(v),a;S=S.sibling}throw Error(n(188))}if(d.return!==g.return)d=v,g=S;else{for(var E=!1,A=v.child;A;){if(A===d){E=!0,d=v,g=S;break}if(A===g){E=!0,g=v,d=S;break}A=A.sibling}if(!E){for(A=S.child;A;){if(A===d){E=!0,d=S,g=v;break}if(A===g){E=!0,g=S,d=v;break}A=A.sibling}if(!E)throw Error(n(189))}}if(d.alternate!==g)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?i:a}function zy(i){return i=wT(i),i!==null?$y(i):null}function $y(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var a=$y(i);if(a!==null)return a;i=i.sibling}return null}var Fy=e.unstable_scheduleCallback,By=e.unstable_cancelCallback,bT=e.unstable_shouldYield,kT=e.unstable_requestPaint,pt=e.unstable_now,ST=e.unstable_getCurrentPriorityLevel,hf=e.unstable_ImmediatePriority,Vy=e.unstable_UserBlockingPriority,Ra=e.unstable_NormalPriority,CT=e.unstable_LowPriority,Hy=e.unstable_IdlePriority,Pa=null,hr=null;function NT(i){if(hr&&typeof hr.onCommitFiberRoot=="function")try{hr.onCommitFiberRoot(Pa,i,void 0,(i.current.flags&128)===128)}catch{}}var Jn=Math.clz32?Math.clz32:TT,ET=Math.log,MT=Math.LN2;function TT(i){return i>>>=0,i===0?32:31-(ET(i)/MT|0)|0}var Oa=64,Ia=4194304;function Xi(i){switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function Da(i,a){var d=i.pendingLanes;if(d===0)return 0;var g=0,v=i.suspendedLanes,S=i.pingedLanes,E=d&268435455;if(E!==0){var A=E&~v;A!==0?g=Xi(A):(S&=E,S!==0&&(g=Xi(S)))}else E=d&~v,E!==0?g=Xi(E):S!==0&&(g=Xi(S));if(g===0)return 0;if(a!==0&&a!==g&&(a&v)===0&&(v=g&-g,S=a&-a,v>=S||v===16&&(S&4194240)!==0))return a;if((g&4)!==0&&(g|=d&16),a=i.entangledLanes,a!==0)for(i=i.entanglements,a&=g;0<a;)d=31-Jn(a),v=1<<d,g|=i[d],a&=~v;return g}function jT(i,a){switch(i){case 1:case 2:case 4:return a+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function AT(i,a){for(var d=i.suspendedLanes,g=i.pingedLanes,v=i.expirationTimes,S=i.pendingLanes;0<S;){var E=31-Jn(S),A=1<<E,O=v[E];O===-1?((A&d)===0||(A&g)!==0)&&(v[E]=jT(A,a)):O<=a&&(i.expiredLanes|=A),S&=~A}}function pf(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function Wy(){var i=Oa;return Oa<<=1,(Oa&4194240)===0&&(Oa=64),i}function mf(i){for(var a=[],d=0;31>d;d++)a.push(i);return a}function Zi(i,a,d){i.pendingLanes|=a,a!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,a=31-Jn(a),i[a]=d}function RT(i,a){var d=i.pendingLanes&~a;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=a,i.mutableReadLanes&=a,i.entangledLanes&=a,a=i.entanglements;var g=i.eventTimes;for(i=i.expirationTimes;0<d;){var v=31-Jn(d),S=1<<v;a[v]=0,g[v]=-1,i[v]=-1,d&=~S}}function gf(i,a){var d=i.entangledLanes|=a;for(i=i.entanglements;d;){var g=31-Jn(d),v=1<<g;v&a|i[g]&a&&(i[g]|=a),d&=~v}}var qe=0;function Uy(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var Ky,yf,qy,Gy,Jy,xf=!1,_a=[],Zr=null,eo=null,to=null,el=new Map,tl=new Map,no=[],PT="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Yy(i,a){switch(i){case"focusin":case"focusout":Zr=null;break;case"dragenter":case"dragleave":eo=null;break;case"mouseover":case"mouseout":to=null;break;case"pointerover":case"pointerout":el.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":tl.delete(a.pointerId)}}function nl(i,a,d,g,v,S){return i===null||i.nativeEvent!==S?(i={blockedOn:a,domEventName:d,eventSystemFlags:g,nativeEvent:S,targetContainers:[v]},a!==null&&(a=gl(a),a!==null&&yf(a)),i):(i.eventSystemFlags|=g,a=i.targetContainers,v!==null&&a.indexOf(v)===-1&&a.push(v),i)}function OT(i,a,d,g,v){switch(a){case"focusin":return Zr=nl(Zr,i,a,d,g,v),!0;case"dragenter":return eo=nl(eo,i,a,d,g,v),!0;case"mouseover":return to=nl(to,i,a,d,g,v),!0;case"pointerover":var S=v.pointerId;return el.set(S,nl(el.get(S)||null,i,a,d,g,v)),!0;case"gotpointercapture":return S=v.pointerId,tl.set(S,nl(tl.get(S)||null,i,a,d,g,v)),!0}return!1}function Qy(i){var a=ts(i.target);if(a!==null){var d=es(a);if(d!==null){if(a=d.tag,a===13){if(a=_y(d),a!==null){i.blockedOn=a,Jy(i.priority,function(){qy(d)});return}}else if(a===3&&d.stateNode.current.memoizedState.isDehydrated){i.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}i.blockedOn=null}function La(i){if(i.blockedOn!==null)return!1;for(var a=i.targetContainers;0<a.length;){var d=wf(i.domEventName,i.eventSystemFlags,a[0],i.nativeEvent);if(d===null){d=i.nativeEvent;var g=new d.constructor(d.type,d);lf=g,d.target.dispatchEvent(g),lf=null}else return a=gl(d),a!==null&&yf(a),i.blockedOn=d,!1;a.shift()}return!0}function Xy(i,a,d){La(i)&&d.delete(a)}function IT(){xf=!1,Zr!==null&&La(Zr)&&(Zr=null),eo!==null&&La(eo)&&(eo=null),to!==null&&La(to)&&(to=null),el.forEach(Xy),tl.forEach(Xy)}function rl(i,a){i.blockedOn===a&&(i.blockedOn=null,xf||(xf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,IT)))}function ol(i){function a(v){return rl(v,i)}if(0<_a.length){rl(_a[0],i);for(var d=1;d<_a.length;d++){var g=_a[d];g.blockedOn===i&&(g.blockedOn=null)}}for(Zr!==null&&rl(Zr,i),eo!==null&&rl(eo,i),to!==null&&rl(to,i),el.forEach(a),tl.forEach(a),d=0;d<no.length;d++)g=no[d],g.blockedOn===i&&(g.blockedOn=null);for(;0<no.length&&(d=no[0],d.blockedOn===null);)Qy(d),d.blockedOn===null&&no.shift()}var qs=j.ReactCurrentBatchConfig,za=!0;function DT(i,a,d,g){var v=qe,S=qs.transition;qs.transition=null;try{qe=1,vf(i,a,d,g)}finally{qe=v,qs.transition=S}}function _T(i,a,d,g){var v=qe,S=qs.transition;qs.transition=null;try{qe=4,vf(i,a,d,g)}finally{qe=v,qs.transition=S}}function vf(i,a,d,g){if(za){var v=wf(i,a,d,g);if(v===null)Lf(i,a,g,$a,d),Yy(i,g);else if(OT(v,i,a,d,g))g.stopPropagation();else if(Yy(i,g),a&4&&-1<PT.indexOf(i)){for(;v!==null;){var S=gl(v);if(S!==null&&Ky(S),S=wf(i,a,d,g),S===null&&Lf(i,a,g,$a,d),S===v)break;v=S}v!==null&&g.stopPropagation()}else Lf(i,a,g,null,d)}}var $a=null;function wf(i,a,d,g){if($a=null,i=af(g),i=ts(i),i!==null)if(a=es(i),a===null)i=null;else if(d=a.tag,d===13){if(i=_y(a),i!==null)return i;i=null}else if(d===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null);return $a=i,null}function Zy(i){switch(i){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(ST()){case hf:return 1;case Vy:return 4;case Ra:case CT:return 16;case Hy:return 536870912;default:return 16}default:return 16}}var ro=null,bf=null,Fa=null;function ex(){if(Fa)return Fa;var i,a=bf,d=a.length,g,v="value"in ro?ro.value:ro.textContent,S=v.length;for(i=0;i<d&&a[i]===v[i];i++);var E=d-i;for(g=1;g<=E&&a[d-g]===v[S-g];g++);return Fa=v.slice(i,1<g?1-g:void 0)}function Ba(i){var a=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&a===13&&(i=13)):i=a,i===10&&(i=13),32<=i||i===13?i:0}function Va(){return!0}function tx(){return!1}function bn(i){function a(d,g,v,S,E){this._reactName=d,this._targetInst=v,this.type=g,this.nativeEvent=S,this.target=E,this.currentTarget=null;for(var A in i)i.hasOwnProperty(A)&&(d=i[A],this[A]=d?d(S):S[A]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?Va:tx,this.isPropagationStopped=tx,this}return B(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Va)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Va)},persist:function(){},isPersistent:Va}),a}var Gs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},kf=bn(Gs),sl=B({},Gs,{view:0,detail:0}),LT=bn(sl),Sf,Cf,il,Ha=B({},sl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ef,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==il&&(il&&i.type==="mousemove"?(Sf=i.screenX-il.screenX,Cf=i.screenY-il.screenY):Cf=Sf=0,il=i),Sf)},movementY:function(i){return"movementY"in i?i.movementY:Cf}}),nx=bn(Ha),zT=B({},Ha,{dataTransfer:0}),$T=bn(zT),FT=B({},sl,{relatedTarget:0}),Nf=bn(FT),BT=B({},Gs,{animationName:0,elapsedTime:0,pseudoElement:0}),VT=bn(BT),HT=B({},Gs,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),WT=bn(HT),UT=B({},Gs,{data:0}),rx=bn(UT),KT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},qT={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"},GT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function JT(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=GT[i])?!!a[i]:!1}function Ef(){return JT}var YT=B({},sl,{key:function(i){if(i.key){var a=KT[i.key]||i.key;if(a!=="Unidentified")return a}return i.type==="keypress"?(i=Ba(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?qT[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ef,charCode:function(i){return i.type==="keypress"?Ba(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Ba(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),QT=bn(YT),XT=B({},Ha,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ox=bn(XT),ZT=B({},sl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ef}),e2=bn(ZT),t2=B({},Gs,{propertyName:0,elapsedTime:0,pseudoElement:0}),n2=bn(t2),r2=B({},Ha,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),o2=bn(r2),s2=[9,13,27,32],Mf=c&&"CompositionEvent"in window,ll=null;c&&"documentMode"in document&&(ll=document.documentMode);var i2=c&&"TextEvent"in window&&!ll,sx=c&&(!Mf||ll&&8<ll&&11>=ll),ix=" ",lx=!1;function ax(i,a){switch(i){case"keyup":return s2.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cx(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Js=!1;function l2(i,a){switch(i){case"compositionend":return cx(a);case"keypress":return a.which!==32?null:(lx=!0,ix);case"textInput":return i=a.data,i===ix&&lx?null:i;default:return null}}function a2(i,a){if(Js)return i==="compositionend"||!Mf&&ax(i,a)?(i=ex(),Fa=bf=ro=null,Js=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return sx&&a.locale!=="ko"?null:a.data;default:return null}}var c2={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 ux(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!c2[i.type]:a==="textarea"}function dx(i,a,d,g){Ry(g),a=Ga(a,"onChange"),0<a.length&&(d=new kf("onChange","change",null,d,g),i.push({event:d,listeners:a}))}var al=null,cl=null;function u2(i){jx(i,0)}function Wa(i){var a=ei(i);if(_e(a))return i}function d2(i,a){if(i==="change")return a}var fx=!1;if(c){var Tf;if(c){var jf="oninput"in document;if(!jf){var hx=document.createElement("div");hx.setAttribute("oninput","return;"),jf=typeof hx.oninput=="function"}Tf=jf}else Tf=!1;fx=Tf&&(!document.documentMode||9<document.documentMode)}function px(){al&&(al.detachEvent("onpropertychange",mx),cl=al=null)}function mx(i){if(i.propertyName==="value"&&Wa(cl)){var a=[];dx(a,cl,i,af(i)),Dy(u2,a)}}function f2(i,a,d){i==="focusin"?(px(),al=a,cl=d,al.attachEvent("onpropertychange",mx)):i==="focusout"&&px()}function h2(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Wa(cl)}function p2(i,a){if(i==="click")return Wa(a)}function m2(i,a){if(i==="input"||i==="change")return Wa(a)}function g2(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var Yn=typeof Object.is=="function"?Object.is:g2;function ul(i,a){if(Yn(i,a))return!0;if(typeof i!="object"||i===null||typeof a!="object"||a===null)return!1;var d=Object.keys(i),g=Object.keys(a);if(d.length!==g.length)return!1;for(g=0;g<d.length;g++){var v=d[g];if(!u.call(a,v)||!Yn(i[v],a[v]))return!1}return!0}function gx(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function yx(i,a){var d=gx(i);i=0;for(var g;d;){if(d.nodeType===3){if(g=i+d.textContent.length,i<=a&&g>=a)return{node:d,offset:a-i};i=g}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=gx(d)}}function xx(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?xx(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function vx(){for(var i=window,a=Je();a instanceof i.HTMLIFrameElement;){try{var d=typeof a.contentWindow.location.href=="string"}catch{d=!1}if(d)i=a.contentWindow;else break;a=Je(i.document)}return a}function Af(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}function y2(i){var a=vx(),d=i.focusedElem,g=i.selectionRange;if(a!==d&&d&&d.ownerDocument&&xx(d.ownerDocument.documentElement,d)){if(g!==null&&Af(d)){if(a=g.start,i=g.end,i===void 0&&(i=a),"selectionStart"in d)d.selectionStart=a,d.selectionEnd=Math.min(i,d.value.length);else if(i=(a=d.ownerDocument||document)&&a.defaultView||window,i.getSelection){i=i.getSelection();var v=d.textContent.length,S=Math.min(g.start,v);g=g.end===void 0?S:Math.min(g.end,v),!i.extend&&S>g&&(v=g,g=S,S=v),v=yx(d,S);var E=yx(d,g);v&&E&&(i.rangeCount!==1||i.anchorNode!==v.node||i.anchorOffset!==v.offset||i.focusNode!==E.node||i.focusOffset!==E.offset)&&(a=a.createRange(),a.setStart(v.node,v.offset),i.removeAllRanges(),S>g?(i.addRange(a),i.extend(E.node,E.offset)):(a.setEnd(E.node,E.offset),i.addRange(a)))}}for(a=[],i=d;i=i.parentNode;)i.nodeType===1&&a.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<a.length;d++)i=a[d],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var x2=c&&"documentMode"in document&&11>=document.documentMode,Ys=null,Rf=null,dl=null,Pf=!1;function wx(i,a,d){var g=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Pf||Ys==null||Ys!==Je(g)||(g=Ys,"selectionStart"in g&&Af(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),dl&&ul(dl,g)||(dl=g,g=Ga(Rf,"onSelect"),0<g.length&&(a=new kf("onSelect","select",null,a,d),i.push({event:a,listeners:g}),a.target=Ys)))}function Ua(i,a){var d={};return d[i.toLowerCase()]=a.toLowerCase(),d["Webkit"+i]="webkit"+a,d["Moz"+i]="moz"+a,d}var Qs={animationend:Ua("Animation","AnimationEnd"),animationiteration:Ua("Animation","AnimationIteration"),animationstart:Ua("Animation","AnimationStart"),transitionend:Ua("Transition","TransitionEnd")},Of={},bx={};c&&(bx=document.createElement("div").style,"AnimationEvent"in window||(delete Qs.animationend.animation,delete Qs.animationiteration.animation,delete Qs.animationstart.animation),"TransitionEvent"in window||delete Qs.transitionend.transition);function Ka(i){if(Of[i])return Of[i];if(!Qs[i])return i;var a=Qs[i],d;for(d in a)if(a.hasOwnProperty(d)&&d in bx)return Of[i]=a[d];return i}var kx=Ka("animationend"),Sx=Ka("animationiteration"),Cx=Ka("animationstart"),Nx=Ka("transitionend"),Ex=new Map,Mx="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function oo(i,a){Ex.set(i,a),s(a,[i])}for(var If=0;If<Mx.length;If++){var Df=Mx[If],v2=Df.toLowerCase(),w2=Df[0].toUpperCase()+Df.slice(1);oo(v2,"on"+w2)}oo(kx,"onAnimationEnd"),oo(Sx,"onAnimationIteration"),oo(Cx,"onAnimationStart"),oo("dblclick","onDoubleClick"),oo("focusin","onFocus"),oo("focusout","onBlur"),oo(Nx,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),s("onBeforeInput",["compositionend","keypress","textInput","paste"]),s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fl="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(" "),b2=new Set("cancel close invalid load scroll toggle".split(" ").concat(fl));function Tx(i,a,d){var g=i.type||"unknown-event";i.currentTarget=d,vT(g,a,void 0,i),i.currentTarget=null}function jx(i,a){a=(a&4)!==0;for(var d=0;d<i.length;d++){var g=i[d],v=g.event;g=g.listeners;e:{var S=void 0;if(a)for(var E=g.length-1;0<=E;E--){var A=g[E],O=A.instance,V=A.currentTarget;if(A=A.listener,O!==S&&v.isPropagationStopped())break e;Tx(v,A,V),S=O}else for(E=0;E<g.length;E++){if(A=g[E],O=A.instance,V=A.currentTarget,A=A.listener,O!==S&&v.isPropagationStopped())break e;Tx(v,A,V),S=O}}}if(Aa)throw i=ff,Aa=!1,ff=null,i}function et(i,a){var d=a[Hf];d===void 0&&(d=a[Hf]=new Set);var g=i+"__bubble";d.has(g)||(Ax(a,i,2,!1),d.add(g))}function _f(i,a,d){var g=0;a&&(g|=4),Ax(d,i,g,a)}var qa="_reactListening"+Math.random().toString(36).slice(2);function hl(i){if(!i[qa]){i[qa]=!0,r.forEach(function(d){d!=="selectionchange"&&(b2.has(d)||_f(d,!1,i),_f(d,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[qa]||(a[qa]=!0,_f("selectionchange",!1,a))}}function Ax(i,a,d,g){switch(Zy(a)){case 1:var v=DT;break;case 4:v=_T;break;default:v=vf}d=v.bind(null,a,d,i),v=void 0,!df||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(v=!0),g?v!==void 0?i.addEventListener(a,d,{capture:!0,passive:v}):i.addEventListener(a,d,!0):v!==void 0?i.addEventListener(a,d,{passive:v}):i.addEventListener(a,d,!1)}function Lf(i,a,d,g,v){var S=g;if((a&1)===0&&(a&2)===0&&g!==null)e:for(;;){if(g===null)return;var E=g.tag;if(E===3||E===4){var A=g.stateNode.containerInfo;if(A===v||A.nodeType===8&&A.parentNode===v)break;if(E===4)for(E=g.return;E!==null;){var O=E.tag;if((O===3||O===4)&&(O=E.stateNode.containerInfo,O===v||O.nodeType===8&&O.parentNode===v))return;E=E.return}for(;A!==null;){if(E=ts(A),E===null)return;if(O=E.tag,O===5||O===6){g=S=E;continue e}A=A.parentNode}}g=g.return}Dy(function(){var V=S,J=af(d),Q=[];e:{var G=Ex.get(i);if(G!==void 0){var ce=kf,ge=i;switch(i){case"keypress":if(Ba(d)===0)break e;case"keydown":case"keyup":ce=QT;break;case"focusin":ge="focus",ce=Nf;break;case"focusout":ge="blur",ce=Nf;break;case"beforeblur":case"afterblur":ce=Nf;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ce=nx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ce=$T;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ce=e2;break;case kx:case Sx:case Cx:ce=VT;break;case Nx:ce=n2;break;case"scroll":ce=LT;break;case"wheel":ce=o2;break;case"copy":case"cut":case"paste":ce=WT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ce=ox}var be=(a&4)!==0,mt=!be&&i==="scroll",z=be?G!==null?G+"Capture":null:G;be=[];for(var D=V,F;D!==null;){F=D;var te=F.stateNode;if(F.tag===5&&te!==null&&(F=te,z!==null&&(te=Ji(D,z),te!=null&&be.push(pl(D,te,F)))),mt)break;D=D.return}0<be.length&&(G=new ce(G,ge,null,d,J),Q.push({event:G,listeners:be}))}}if((a&7)===0){e:{if(G=i==="mouseover"||i==="pointerover",ce=i==="mouseout"||i==="pointerout",G&&d!==lf&&(ge=d.relatedTarget||d.fromElement)&&(ts(ge)||ge[Ar]))break e;if((ce||G)&&(G=J.window===J?J:(G=J.ownerDocument)?G.defaultView||G.parentWindow:window,ce?(ge=d.relatedTarget||d.toElement,ce=V,ge=ge?ts(ge):null,ge!==null&&(mt=es(ge),ge!==mt||ge.tag!==5&&ge.tag!==6)&&(ge=null)):(ce=null,ge=V),ce!==ge)){if(be=nx,te="onMouseLeave",z="onMouseEnter",D="mouse",(i==="pointerout"||i==="pointerover")&&(be=ox,te="onPointerLeave",z="onPointerEnter",D="pointer"),mt=ce==null?G:ei(ce),F=ge==null?G:ei(ge),G=new be(te,D+"leave",ce,d,J),G.target=mt,G.relatedTarget=F,te=null,ts(J)===V&&(be=new be(z,D+"enter",ge,d,J),be.target=F,be.relatedTarget=mt,te=be),mt=te,ce&&ge)t:{for(be=ce,z=ge,D=0,F=be;F;F=Xs(F))D++;for(F=0,te=z;te;te=Xs(te))F++;for(;0<D-F;)be=Xs(be),D--;for(;0<F-D;)z=Xs(z),F--;for(;D--;){if(be===z||z!==null&&be===z.alternate)break t;be=Xs(be),z=Xs(z)}be=null}else be=null;ce!==null&&Rx(Q,G,ce,be,!1),ge!==null&&mt!==null&&Rx(Q,mt,ge,be,!0)}}e:{if(G=V?ei(V):window,ce=G.nodeName&&G.nodeName.toLowerCase(),ce==="select"||ce==="input"&&G.type==="file")var Ce=d2;else if(ux(G))if(fx)Ce=m2;else{Ce=h2;var Ae=f2}else(ce=G.nodeName)&&ce.toLowerCase()==="input"&&(G.type==="checkbox"||G.type==="radio")&&(Ce=p2);if(Ce&&(Ce=Ce(i,V))){dx(Q,Ce,d,J);break e}Ae&&Ae(i,G,V),i==="focusout"&&(Ae=G._wrapperState)&&Ae.controlled&&G.type==="number"&&wn(G,"number",G.value)}switch(Ae=V?ei(V):window,i){case"focusin":(ux(Ae)||Ae.contentEditable==="true")&&(Ys=Ae,Rf=V,dl=null);break;case"focusout":dl=Rf=Ys=null;break;case"mousedown":Pf=!0;break;case"contextmenu":case"mouseup":case"dragend":Pf=!1,wx(Q,d,J);break;case"selectionchange":if(x2)break;case"keydown":case"keyup":wx(Q,d,J)}var Re;if(Mf)e:{switch(i){case"compositionstart":var Oe="onCompositionStart";break e;case"compositionend":Oe="onCompositionEnd";break e;case"compositionupdate":Oe="onCompositionUpdate";break e}Oe=void 0}else Js?ax(i,d)&&(Oe="onCompositionEnd"):i==="keydown"&&d.keyCode===229&&(Oe="onCompositionStart");Oe&&(sx&&d.locale!=="ko"&&(Js||Oe!=="onCompositionStart"?Oe==="onCompositionEnd"&&Js&&(Re=ex()):(ro=J,bf="value"in ro?ro.value:ro.textContent,Js=!0)),Ae=Ga(V,Oe),0<Ae.length&&(Oe=new rx(Oe,i,null,d,J),Q.push({event:Oe,listeners:Ae}),Re?Oe.data=Re:(Re=cx(d),Re!==null&&(Oe.data=Re)))),(Re=i2?l2(i,d):a2(i,d))&&(V=Ga(V,"onBeforeInput"),0<V.length&&(J=new rx("onBeforeInput","beforeinput",null,d,J),Q.push({event:J,listeners:V}),J.data=Re))}jx(Q,a)})}function pl(i,a,d){return{instance:i,listener:a,currentTarget:d}}function Ga(i,a){for(var d=a+"Capture",g=[];i!==null;){var v=i,S=v.stateNode;v.tag===5&&S!==null&&(v=S,S=Ji(i,d),S!=null&&g.unshift(pl(i,S,v)),S=Ji(i,a),S!=null&&g.push(pl(i,S,v))),i=i.return}return g}function Xs(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function Rx(i,a,d,g,v){for(var S=a._reactName,E=[];d!==null&&d!==g;){var A=d,O=A.alternate,V=A.stateNode;if(O!==null&&O===g)break;A.tag===5&&V!==null&&(A=V,v?(O=Ji(d,S),O!=null&&E.unshift(pl(d,O,A))):v||(O=Ji(d,S),O!=null&&E.push(pl(d,O,A)))),d=d.return}E.length!==0&&i.push({event:a,listeners:E})}var k2=/\r\n?/g,S2=/\u0000|\uFFFD/g;function Px(i){return(typeof i=="string"?i:""+i).replace(k2,`
38
+ `).replace(S2,"")}function Ja(i,a,d){if(a=Px(a),Px(i)!==a&&d)throw Error(n(425))}function Ya(){}var zf=null,$f=null;function Ff(i,a){return i==="textarea"||i==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Bf=typeof setTimeout=="function"?setTimeout:void 0,C2=typeof clearTimeout=="function"?clearTimeout:void 0,Ox=typeof Promise=="function"?Promise:void 0,N2=typeof queueMicrotask=="function"?queueMicrotask:typeof Ox<"u"?function(i){return Ox.resolve(null).then(i).catch(E2)}:Bf;function E2(i){setTimeout(function(){throw i})}function Vf(i,a){var d=a,g=0;do{var v=d.nextSibling;if(i.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"){if(g===0){i.removeChild(v),ol(a);return}g--}else d!=="$"&&d!=="$?"&&d!=="$!"||g++;d=v}while(d);ol(a)}function so(i){for(;i!=null;i=i.nextSibling){var a=i.nodeType;if(a===1||a===3)break;if(a===8){if(a=i.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return i}function Ix(i){i=i.previousSibling;for(var a=0;i;){if(i.nodeType===8){var d=i.data;if(d==="$"||d==="$!"||d==="$?"){if(a===0)return i;a--}else d==="/$"&&a++}i=i.previousSibling}return null}var Zs=Math.random().toString(36).slice(2),pr="__reactFiber$"+Zs,ml="__reactProps$"+Zs,Ar="__reactContainer$"+Zs,Hf="__reactEvents$"+Zs,M2="__reactListeners$"+Zs,T2="__reactHandles$"+Zs;function ts(i){var a=i[pr];if(a)return a;for(var d=i.parentNode;d;){if(a=d[Ar]||d[pr]){if(d=a.alternate,a.child!==null||d!==null&&d.child!==null)for(i=Ix(i);i!==null;){if(d=i[pr])return d;i=Ix(i)}return a}i=d,d=i.parentNode}return null}function gl(i){return i=i[pr]||i[Ar],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function ei(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(n(33))}function Qa(i){return i[ml]||null}var Wf=[],ti=-1;function io(i){return{current:i}}function tt(i){0>ti||(i.current=Wf[ti],Wf[ti]=null,ti--)}function Qe(i,a){ti++,Wf[ti]=i.current,i.current=a}var lo={},Ut=io(lo),cn=io(!1),ns=lo;function ni(i,a){var d=i.type.contextTypes;if(!d)return lo;var g=i.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===a)return g.__reactInternalMemoizedMaskedChildContext;var v={},S;for(S in d)v[S]=a[S];return g&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=a,i.__reactInternalMemoizedMaskedChildContext=v),v}function un(i){return i=i.childContextTypes,i!=null}function Xa(){tt(cn),tt(Ut)}function Dx(i,a,d){if(Ut.current!==lo)throw Error(n(168));Qe(Ut,a),Qe(cn,d)}function _x(i,a,d){var g=i.stateNode;if(a=a.childContextTypes,typeof g.getChildContext!="function")return d;g=g.getChildContext();for(var v in g)if(!(v in a))throw Error(n(108,oe(i)||"Unknown",v));return B({},d,g)}function Za(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||lo,ns=Ut.current,Qe(Ut,i),Qe(cn,cn.current),!0}function Lx(i,a,d){var g=i.stateNode;if(!g)throw Error(n(169));d?(i=_x(i,a,ns),g.__reactInternalMemoizedMergedChildContext=i,tt(cn),tt(Ut),Qe(Ut,i)):tt(cn),Qe(cn,d)}var Rr=null,ec=!1,Uf=!1;function zx(i){Rr===null?Rr=[i]:Rr.push(i)}function j2(i){ec=!0,zx(i)}function ao(){if(!Uf&&Rr!==null){Uf=!0;var i=0,a=qe;try{var d=Rr;for(qe=1;i<d.length;i++){var g=d[i];do g=g(!0);while(g!==null)}Rr=null,ec=!1}catch(v){throw Rr!==null&&(Rr=Rr.slice(i+1)),Fy(hf,ao),v}finally{qe=a,Uf=!1}}return null}var ri=[],oi=0,tc=null,nc=0,On=[],In=0,rs=null,Pr=1,Or="";function ss(i,a){ri[oi++]=nc,ri[oi++]=tc,tc=i,nc=a}function $x(i,a,d){On[In++]=Pr,On[In++]=Or,On[In++]=rs,rs=i;var g=Pr;i=Or;var v=32-Jn(g)-1;g&=~(1<<v),d+=1;var S=32-Jn(a)+v;if(30<S){var E=v-v%5;S=(g&(1<<E)-1).toString(32),g>>=E,v-=E,Pr=1<<32-Jn(a)+v|d<<v|g,Or=S+i}else Pr=1<<S|d<<v|g,Or=i}function Kf(i){i.return!==null&&(ss(i,1),$x(i,1,0))}function qf(i){for(;i===tc;)tc=ri[--oi],ri[oi]=null,nc=ri[--oi],ri[oi]=null;for(;i===rs;)rs=On[--In],On[In]=null,Or=On[--In],On[In]=null,Pr=On[--In],On[In]=null}var kn=null,Sn=null,st=!1,Qn=null;function Fx(i,a){var d=zn(5,null,null,0);d.elementType="DELETED",d.stateNode=a,d.return=i,a=i.deletions,a===null?(i.deletions=[d],i.flags|=16):a.push(d)}function Bx(i,a){switch(i.tag){case 5:var d=i.type;return a=a.nodeType!==1||d.toLowerCase()!==a.nodeName.toLowerCase()?null:a,a!==null?(i.stateNode=a,kn=i,Sn=so(a.firstChild),!0):!1;case 6:return a=i.pendingProps===""||a.nodeType!==3?null:a,a!==null?(i.stateNode=a,kn=i,Sn=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(d=rs!==null?{id:Pr,overflow:Or}:null,i.memoizedState={dehydrated:a,treeContext:d,retryLane:1073741824},d=zn(18,null,null,0),d.stateNode=a,d.return=i,i.child=d,kn=i,Sn=null,!0):!1;default:return!1}}function Gf(i){return(i.mode&1)!==0&&(i.flags&128)===0}function Jf(i){if(st){var a=Sn;if(a){var d=a;if(!Bx(i,a)){if(Gf(i))throw Error(n(418));a=so(d.nextSibling);var g=kn;a&&Bx(i,a)?Fx(g,d):(i.flags=i.flags&-4097|2,st=!1,kn=i)}}else{if(Gf(i))throw Error(n(418));i.flags=i.flags&-4097|2,st=!1,kn=i}}}function Vx(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;kn=i}function rc(i){if(i!==kn)return!1;if(!st)return Vx(i),st=!0,!1;var a;if((a=i.tag!==3)&&!(a=i.tag!==5)&&(a=i.type,a=a!=="head"&&a!=="body"&&!Ff(i.type,i.memoizedProps)),a&&(a=Sn)){if(Gf(i))throw Hx(),Error(n(418));for(;a;)Fx(i,a),a=so(a.nextSibling)}if(Vx(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));e:{for(i=i.nextSibling,a=0;i;){if(i.nodeType===8){var d=i.data;if(d==="/$"){if(a===0){Sn=so(i.nextSibling);break e}a--}else d!=="$"&&d!=="$!"&&d!=="$?"||a++}i=i.nextSibling}Sn=null}}else Sn=kn?so(i.stateNode.nextSibling):null;return!0}function Hx(){for(var i=Sn;i;)i=so(i.nextSibling)}function si(){Sn=kn=null,st=!1}function Yf(i){Qn===null?Qn=[i]:Qn.push(i)}var A2=j.ReactCurrentBatchConfig;function yl(i,a,d){if(i=d.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var g=d.stateNode}if(!g)throw Error(n(147,i));var v=g,S=""+i;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===S?a.ref:(a=function(E){var A=v.refs;E===null?delete A[S]:A[S]=E},a._stringRef=S,a)}if(typeof i!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,i))}return i}function oc(i,a){throw i=Object.prototype.toString.call(a),Error(n(31,i==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":i))}function Wx(i){var a=i._init;return a(i._payload)}function Ux(i){function a(z,D){if(i){var F=z.deletions;F===null?(z.deletions=[D],z.flags|=16):F.push(D)}}function d(z,D){if(!i)return null;for(;D!==null;)a(z,D),D=D.sibling;return null}function g(z,D){for(z=new Map;D!==null;)D.key!==null?z.set(D.key,D):z.set(D.index,D),D=D.sibling;return z}function v(z,D){return z=yo(z,D),z.index=0,z.sibling=null,z}function S(z,D,F){return z.index=F,i?(F=z.alternate,F!==null?(F=F.index,F<D?(z.flags|=2,D):F):(z.flags|=2,D)):(z.flags|=1048576,D)}function E(z){return i&&z.alternate===null&&(z.flags|=2),z}function A(z,D,F,te){return D===null||D.tag!==6?(D=Bh(F,z.mode,te),D.return=z,D):(D=v(D,F),D.return=z,D)}function O(z,D,F,te){var Ce=F.type;return Ce===I?J(z,D,F.props.children,te,F.key):D!==null&&(D.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===re&&Wx(Ce)===D.type)?(te=v(D,F.props),te.ref=yl(z,D,F),te.return=z,te):(te=Tc(F.type,F.key,F.props,null,z.mode,te),te.ref=yl(z,D,F),te.return=z,te)}function V(z,D,F,te){return D===null||D.tag!==4||D.stateNode.containerInfo!==F.containerInfo||D.stateNode.implementation!==F.implementation?(D=Vh(F,z.mode,te),D.return=z,D):(D=v(D,F.children||[]),D.return=z,D)}function J(z,D,F,te,Ce){return D===null||D.tag!==7?(D=hs(F,z.mode,te,Ce),D.return=z,D):(D=v(D,F),D.return=z,D)}function Q(z,D,F){if(typeof D=="string"&&D!==""||typeof D=="number")return D=Bh(""+D,z.mode,F),D.return=z,D;if(typeof D=="object"&&D!==null){switch(D.$$typeof){case P:return F=Tc(D.type,D.key,D.props,null,z.mode,F),F.ref=yl(z,null,D),F.return=z,F;case L:return D=Vh(D,z.mode,F),D.return=z,D;case re:var te=D._init;return Q(z,te(D._payload),F)}if(se(D)||W(D))return D=hs(D,z.mode,F,null),D.return=z,D;oc(z,D)}return null}function G(z,D,F,te){var Ce=D!==null?D.key:null;if(typeof F=="string"&&F!==""||typeof F=="number")return Ce!==null?null:A(z,D,""+F,te);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case P:return F.key===Ce?O(z,D,F,te):null;case L:return F.key===Ce?V(z,D,F,te):null;case re:return Ce=F._init,G(z,D,Ce(F._payload),te)}if(se(F)||W(F))return Ce!==null?null:J(z,D,F,te,null);oc(z,F)}return null}function ce(z,D,F,te,Ce){if(typeof te=="string"&&te!==""||typeof te=="number")return z=z.get(F)||null,A(D,z,""+te,Ce);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case P:return z=z.get(te.key===null?F:te.key)||null,O(D,z,te,Ce);case L:return z=z.get(te.key===null?F:te.key)||null,V(D,z,te,Ce);case re:var Ae=te._init;return ce(z,D,F,Ae(te._payload),Ce)}if(se(te)||W(te))return z=z.get(F)||null,J(D,z,te,Ce,null);oc(D,te)}return null}function ge(z,D,F,te){for(var Ce=null,Ae=null,Re=D,Oe=D=0,Pt=null;Re!==null&&Oe<F.length;Oe++){Re.index>Oe?(Pt=Re,Re=null):Pt=Re.sibling;var Ke=G(z,Re,F[Oe],te);if(Ke===null){Re===null&&(Re=Pt);break}i&&Re&&Ke.alternate===null&&a(z,Re),D=S(Ke,D,Oe),Ae===null?Ce=Ke:Ae.sibling=Ke,Ae=Ke,Re=Pt}if(Oe===F.length)return d(z,Re),st&&ss(z,Oe),Ce;if(Re===null){for(;Oe<F.length;Oe++)Re=Q(z,F[Oe],te),Re!==null&&(D=S(Re,D,Oe),Ae===null?Ce=Re:Ae.sibling=Re,Ae=Re);return st&&ss(z,Oe),Ce}for(Re=g(z,Re);Oe<F.length;Oe++)Pt=ce(Re,z,Oe,F[Oe],te),Pt!==null&&(i&&Pt.alternate!==null&&Re.delete(Pt.key===null?Oe:Pt.key),D=S(Pt,D,Oe),Ae===null?Ce=Pt:Ae.sibling=Pt,Ae=Pt);return i&&Re.forEach(function(xo){return a(z,xo)}),st&&ss(z,Oe),Ce}function be(z,D,F,te){var Ce=W(F);if(typeof Ce!="function")throw Error(n(150));if(F=Ce.call(F),F==null)throw Error(n(151));for(var Ae=Ce=null,Re=D,Oe=D=0,Pt=null,Ke=F.next();Re!==null&&!Ke.done;Oe++,Ke=F.next()){Re.index>Oe?(Pt=Re,Re=null):Pt=Re.sibling;var xo=G(z,Re,Ke.value,te);if(xo===null){Re===null&&(Re=Pt);break}i&&Re&&xo.alternate===null&&a(z,Re),D=S(xo,D,Oe),Ae===null?Ce=xo:Ae.sibling=xo,Ae=xo,Re=Pt}if(Ke.done)return d(z,Re),st&&ss(z,Oe),Ce;if(Re===null){for(;!Ke.done;Oe++,Ke=F.next())Ke=Q(z,Ke.value,te),Ke!==null&&(D=S(Ke,D,Oe),Ae===null?Ce=Ke:Ae.sibling=Ke,Ae=Ke);return st&&ss(z,Oe),Ce}for(Re=g(z,Re);!Ke.done;Oe++,Ke=F.next())Ke=ce(Re,z,Oe,Ke.value,te),Ke!==null&&(i&&Ke.alternate!==null&&Re.delete(Ke.key===null?Oe:Ke.key),D=S(Ke,D,Oe),Ae===null?Ce=Ke:Ae.sibling=Ke,Ae=Ke);return i&&Re.forEach(function(cj){return a(z,cj)}),st&&ss(z,Oe),Ce}function mt(z,D,F,te){if(typeof F=="object"&&F!==null&&F.type===I&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case P:e:{for(var Ce=F.key,Ae=D;Ae!==null;){if(Ae.key===Ce){if(Ce=F.type,Ce===I){if(Ae.tag===7){d(z,Ae.sibling),D=v(Ae,F.props.children),D.return=z,z=D;break e}}else if(Ae.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===re&&Wx(Ce)===Ae.type){d(z,Ae.sibling),D=v(Ae,F.props),D.ref=yl(z,Ae,F),D.return=z,z=D;break e}d(z,Ae);break}else a(z,Ae);Ae=Ae.sibling}F.type===I?(D=hs(F.props.children,z.mode,te,F.key),D.return=z,z=D):(te=Tc(F.type,F.key,F.props,null,z.mode,te),te.ref=yl(z,D,F),te.return=z,z=te)}return E(z);case L:e:{for(Ae=F.key;D!==null;){if(D.key===Ae)if(D.tag===4&&D.stateNode.containerInfo===F.containerInfo&&D.stateNode.implementation===F.implementation){d(z,D.sibling),D=v(D,F.children||[]),D.return=z,z=D;break e}else{d(z,D);break}else a(z,D);D=D.sibling}D=Vh(F,z.mode,te),D.return=z,z=D}return E(z);case re:return Ae=F._init,mt(z,D,Ae(F._payload),te)}if(se(F))return ge(z,D,F,te);if(W(F))return be(z,D,F,te);oc(z,F)}return typeof F=="string"&&F!==""||typeof F=="number"?(F=""+F,D!==null&&D.tag===6?(d(z,D.sibling),D=v(D,F),D.return=z,z=D):(d(z,D),D=Bh(F,z.mode,te),D.return=z,z=D),E(z)):d(z,D)}return mt}var ii=Ux(!0),Kx=Ux(!1),sc=io(null),ic=null,li=null,Qf=null;function Xf(){Qf=li=ic=null}function Zf(i){var a=sc.current;tt(sc),i._currentValue=a}function eh(i,a,d){for(;i!==null;){var g=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,g!==null&&(g.childLanes|=a)):g!==null&&(g.childLanes&a)!==a&&(g.childLanes|=a),i===d)break;i=i.return}}function ai(i,a){ic=i,Qf=li=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&a)!==0&&(dn=!0),i.firstContext=null)}function Dn(i){var a=i._currentValue;if(Qf!==i)if(i={context:i,memoizedValue:a,next:null},li===null){if(ic===null)throw Error(n(308));li=i,ic.dependencies={lanes:0,firstContext:i}}else li=li.next=i;return a}var is=null;function th(i){is===null?is=[i]:is.push(i)}function qx(i,a,d,g){var v=a.interleaved;return v===null?(d.next=d,th(a)):(d.next=v.next,v.next=d),a.interleaved=d,Ir(i,g)}function Ir(i,a){i.lanes|=a;var d=i.alternate;for(d!==null&&(d.lanes|=a),d=i,i=i.return;i!==null;)i.childLanes|=a,d=i.alternate,d!==null&&(d.childLanes|=a),d=i,i=i.return;return d.tag===3?d.stateNode:null}var co=!1;function nh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Gx(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function Dr(i,a){return{eventTime:i,lane:a,tag:0,payload:null,callback:null,next:null}}function uo(i,a,d){var g=i.updateQueue;if(g===null)return null;if(g=g.shared,(Ue&2)!==0){var v=g.pending;return v===null?a.next=a:(a.next=v.next,v.next=a),g.pending=a,Ir(i,d)}return v=g.interleaved,v===null?(a.next=a,th(g)):(a.next=v.next,v.next=a),g.interleaved=a,Ir(i,d)}function lc(i,a,d){if(a=a.updateQueue,a!==null&&(a=a.shared,(d&4194240)!==0)){var g=a.lanes;g&=i.pendingLanes,d|=g,a.lanes=d,gf(i,d)}}function Jx(i,a){var d=i.updateQueue,g=i.alternate;if(g!==null&&(g=g.updateQueue,d===g)){var v=null,S=null;if(d=d.firstBaseUpdate,d!==null){do{var E={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};S===null?v=S=E:S=S.next=E,d=d.next}while(d!==null);S===null?v=S=a:S=S.next=a}else v=S=a;d={baseState:g.baseState,firstBaseUpdate:v,lastBaseUpdate:S,shared:g.shared,effects:g.effects},i.updateQueue=d;return}i=d.lastBaseUpdate,i===null?d.firstBaseUpdate=a:i.next=a,d.lastBaseUpdate=a}function ac(i,a,d,g){var v=i.updateQueue;co=!1;var S=v.firstBaseUpdate,E=v.lastBaseUpdate,A=v.shared.pending;if(A!==null){v.shared.pending=null;var O=A,V=O.next;O.next=null,E===null?S=V:E.next=V,E=O;var J=i.alternate;J!==null&&(J=J.updateQueue,A=J.lastBaseUpdate,A!==E&&(A===null?J.firstBaseUpdate=V:A.next=V,J.lastBaseUpdate=O))}if(S!==null){var Q=v.baseState;E=0,J=V=O=null,A=S;do{var G=A.lane,ce=A.eventTime;if((g&G)===G){J!==null&&(J=J.next={eventTime:ce,lane:0,tag:A.tag,payload:A.payload,callback:A.callback,next:null});e:{var ge=i,be=A;switch(G=a,ce=d,be.tag){case 1:if(ge=be.payload,typeof ge=="function"){Q=ge.call(ce,Q,G);break e}Q=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=be.payload,G=typeof ge=="function"?ge.call(ce,Q,G):ge,G==null)break e;Q=B({},Q,G);break e;case 2:co=!0}}A.callback!==null&&A.lane!==0&&(i.flags|=64,G=v.effects,G===null?v.effects=[A]:G.push(A))}else ce={eventTime:ce,lane:G,tag:A.tag,payload:A.payload,callback:A.callback,next:null},J===null?(V=J=ce,O=Q):J=J.next=ce,E|=G;if(A=A.next,A===null){if(A=v.shared.pending,A===null)break;G=A,A=G.next,G.next=null,v.lastBaseUpdate=G,v.shared.pending=null}}while(!0);if(J===null&&(O=Q),v.baseState=O,v.firstBaseUpdate=V,v.lastBaseUpdate=J,a=v.shared.interleaved,a!==null){v=a;do E|=v.lane,v=v.next;while(v!==a)}else S===null&&(v.shared.lanes=0);cs|=E,i.lanes=E,i.memoizedState=Q}}function Yx(i,a,d){if(i=a.effects,a.effects=null,i!==null)for(a=0;a<i.length;a++){var g=i[a],v=g.callback;if(v!==null){if(g.callback=null,g=d,typeof v!="function")throw Error(n(191,v));v.call(g)}}}var xl={},mr=io(xl),vl=io(xl),wl=io(xl);function ls(i){if(i===xl)throw Error(n(174));return i}function rh(i,a){switch(Qe(wl,a),Qe(vl,i),Qe(mr,xl),i=a.nodeType,i){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:rf(null,"");break;default:i=i===8?a.parentNode:a,a=i.namespaceURI||null,i=i.tagName,a=rf(a,i)}tt(mr),Qe(mr,a)}function ci(){tt(mr),tt(vl),tt(wl)}function Qx(i){ls(wl.current);var a=ls(mr.current),d=rf(a,i.type);a!==d&&(Qe(vl,i),Qe(mr,d))}function oh(i){vl.current===i&&(tt(mr),tt(vl))}var at=io(0);function cc(i){for(var a=i;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var sh=[];function ih(){for(var i=0;i<sh.length;i++)sh[i]._workInProgressVersionPrimary=null;sh.length=0}var uc=j.ReactCurrentDispatcher,lh=j.ReactCurrentBatchConfig,as=0,ct=null,Ct=null,At=null,dc=!1,bl=!1,kl=0,R2=0;function Kt(){throw Error(n(321))}function ah(i,a){if(a===null)return!1;for(var d=0;d<a.length&&d<i.length;d++)if(!Yn(i[d],a[d]))return!1;return!0}function ch(i,a,d,g,v,S){if(as=S,ct=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,uc.current=i===null||i.memoizedState===null?D2:_2,i=d(g,v),bl){S=0;do{if(bl=!1,kl=0,25<=S)throw Error(n(301));S+=1,At=Ct=null,a.updateQueue=null,uc.current=L2,i=d(g,v)}while(bl)}if(uc.current=pc,a=Ct!==null&&Ct.next!==null,as=0,At=Ct=ct=null,dc=!1,a)throw Error(n(300));return i}function uh(){var i=kl!==0;return kl=0,i}function gr(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return At===null?ct.memoizedState=At=i:At=At.next=i,At}function _n(){if(Ct===null){var i=ct.alternate;i=i!==null?i.memoizedState:null}else i=Ct.next;var a=At===null?ct.memoizedState:At.next;if(a!==null)At=a,Ct=i;else{if(i===null)throw Error(n(310));Ct=i,i={memoizedState:Ct.memoizedState,baseState:Ct.baseState,baseQueue:Ct.baseQueue,queue:Ct.queue,next:null},At===null?ct.memoizedState=At=i:At=At.next=i}return At}function Sl(i,a){return typeof a=="function"?a(i):a}function dh(i){var a=_n(),d=a.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=i;var g=Ct,v=g.baseQueue,S=d.pending;if(S!==null){if(v!==null){var E=v.next;v.next=S.next,S.next=E}g.baseQueue=v=S,d.pending=null}if(v!==null){S=v.next,g=g.baseState;var A=E=null,O=null,V=S;do{var J=V.lane;if((as&J)===J)O!==null&&(O=O.next={lane:0,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),g=V.hasEagerState?V.eagerState:i(g,V.action);else{var Q={lane:J,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null};O===null?(A=O=Q,E=g):O=O.next=Q,ct.lanes|=J,cs|=J}V=V.next}while(V!==null&&V!==S);O===null?E=g:O.next=A,Yn(g,a.memoizedState)||(dn=!0),a.memoizedState=g,a.baseState=E,a.baseQueue=O,d.lastRenderedState=g}if(i=d.interleaved,i!==null){v=i;do S=v.lane,ct.lanes|=S,cs|=S,v=v.next;while(v!==i)}else v===null&&(d.lanes=0);return[a.memoizedState,d.dispatch]}function fh(i){var a=_n(),d=a.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=i;var g=d.dispatch,v=d.pending,S=a.memoizedState;if(v!==null){d.pending=null;var E=v=v.next;do S=i(S,E.action),E=E.next;while(E!==v);Yn(S,a.memoizedState)||(dn=!0),a.memoizedState=S,a.baseQueue===null&&(a.baseState=S),d.lastRenderedState=S}return[S,g]}function Xx(){}function Zx(i,a){var d=ct,g=_n(),v=a(),S=!Yn(g.memoizedState,v);if(S&&(g.memoizedState=v,dn=!0),g=g.queue,hh(nv.bind(null,d,g,i),[i]),g.getSnapshot!==a||S||At!==null&&At.memoizedState.tag&1){if(d.flags|=2048,Cl(9,tv.bind(null,d,g,v,a),void 0,null),Rt===null)throw Error(n(349));(as&30)!==0||ev(d,a,v)}return v}function ev(i,a,d){i.flags|=16384,i={getSnapshot:a,value:d},a=ct.updateQueue,a===null?(a={lastEffect:null,stores:null},ct.updateQueue=a,a.stores=[i]):(d=a.stores,d===null?a.stores=[i]:d.push(i))}function tv(i,a,d,g){a.value=d,a.getSnapshot=g,rv(a)&&ov(i)}function nv(i,a,d){return d(function(){rv(a)&&ov(i)})}function rv(i){var a=i.getSnapshot;i=i.value;try{var d=a();return!Yn(i,d)}catch{return!0}}function ov(i){var a=Ir(i,1);a!==null&&tr(a,i,1,-1)}function sv(i){var a=gr();return typeof i=="function"&&(i=i()),a.memoizedState=a.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Sl,lastRenderedState:i},a.queue=i,i=i.dispatch=I2.bind(null,ct,i),[a.memoizedState,i]}function Cl(i,a,d,g){return i={tag:i,create:a,destroy:d,deps:g,next:null},a=ct.updateQueue,a===null?(a={lastEffect:null,stores:null},ct.updateQueue=a,a.lastEffect=i.next=i):(d=a.lastEffect,d===null?a.lastEffect=i.next=i:(g=d.next,d.next=i,i.next=g,a.lastEffect=i)),i}function iv(){return _n().memoizedState}function fc(i,a,d,g){var v=gr();ct.flags|=i,v.memoizedState=Cl(1|a,d,void 0,g===void 0?null:g)}function hc(i,a,d,g){var v=_n();g=g===void 0?null:g;var S=void 0;if(Ct!==null){var E=Ct.memoizedState;if(S=E.destroy,g!==null&&ah(g,E.deps)){v.memoizedState=Cl(a,d,S,g);return}}ct.flags|=i,v.memoizedState=Cl(1|a,d,S,g)}function lv(i,a){return fc(8390656,8,i,a)}function hh(i,a){return hc(2048,8,i,a)}function av(i,a){return hc(4,2,i,a)}function cv(i,a){return hc(4,4,i,a)}function uv(i,a){if(typeof a=="function")return i=i(),a(i),function(){a(null)};if(a!=null)return i=i(),a.current=i,function(){a.current=null}}function dv(i,a,d){return d=d!=null?d.concat([i]):null,hc(4,4,uv.bind(null,a,i),d)}function ph(){}function fv(i,a){var d=_n();a=a===void 0?null:a;var g=d.memoizedState;return g!==null&&a!==null&&ah(a,g[1])?g[0]:(d.memoizedState=[i,a],i)}function hv(i,a){var d=_n();a=a===void 0?null:a;var g=d.memoizedState;return g!==null&&a!==null&&ah(a,g[1])?g[0]:(i=i(),d.memoizedState=[i,a],i)}function pv(i,a,d){return(as&21)===0?(i.baseState&&(i.baseState=!1,dn=!0),i.memoizedState=d):(Yn(d,a)||(d=Wy(),ct.lanes|=d,cs|=d,i.baseState=!0),a)}function P2(i,a){var d=qe;qe=d!==0&&4>d?d:4,i(!0);var g=lh.transition;lh.transition={};try{i(!1),a()}finally{qe=d,lh.transition=g}}function mv(){return _n().memoizedState}function O2(i,a,d){var g=mo(i);if(d={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null},gv(i))yv(a,d);else if(d=qx(i,a,d,g),d!==null){var v=tn();tr(d,i,g,v),xv(d,a,g)}}function I2(i,a,d){var g=mo(i),v={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null};if(gv(i))yv(a,v);else{var S=i.alternate;if(i.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var E=a.lastRenderedState,A=S(E,d);if(v.hasEagerState=!0,v.eagerState=A,Yn(A,E)){var O=a.interleaved;O===null?(v.next=v,th(a)):(v.next=O.next,O.next=v),a.interleaved=v;return}}catch{}finally{}d=qx(i,a,v,g),d!==null&&(v=tn(),tr(d,i,g,v),xv(d,a,g))}}function gv(i){var a=i.alternate;return i===ct||a!==null&&a===ct}function yv(i,a){bl=dc=!0;var d=i.pending;d===null?a.next=a:(a.next=d.next,d.next=a),i.pending=a}function xv(i,a,d){if((d&4194240)!==0){var g=a.lanes;g&=i.pendingLanes,d|=g,a.lanes=d,gf(i,d)}}var pc={readContext:Dn,useCallback:Kt,useContext:Kt,useEffect:Kt,useImperativeHandle:Kt,useInsertionEffect:Kt,useLayoutEffect:Kt,useMemo:Kt,useReducer:Kt,useRef:Kt,useState:Kt,useDebugValue:Kt,useDeferredValue:Kt,useTransition:Kt,useMutableSource:Kt,useSyncExternalStore:Kt,useId:Kt,unstable_isNewReconciler:!1},D2={readContext:Dn,useCallback:function(i,a){return gr().memoizedState=[i,a===void 0?null:a],i},useContext:Dn,useEffect:lv,useImperativeHandle:function(i,a,d){return d=d!=null?d.concat([i]):null,fc(4194308,4,uv.bind(null,a,i),d)},useLayoutEffect:function(i,a){return fc(4194308,4,i,a)},useInsertionEffect:function(i,a){return fc(4,2,i,a)},useMemo:function(i,a){var d=gr();return a=a===void 0?null:a,i=i(),d.memoizedState=[i,a],i},useReducer:function(i,a,d){var g=gr();return a=d!==void 0?d(a):a,g.memoizedState=g.baseState=a,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:a},g.queue=i,i=i.dispatch=O2.bind(null,ct,i),[g.memoizedState,i]},useRef:function(i){var a=gr();return i={current:i},a.memoizedState=i},useState:sv,useDebugValue:ph,useDeferredValue:function(i){return gr().memoizedState=i},useTransition:function(){var i=sv(!1),a=i[0];return i=P2.bind(null,i[1]),gr().memoizedState=i,[a,i]},useMutableSource:function(){},useSyncExternalStore:function(i,a,d){var g=ct,v=gr();if(st){if(d===void 0)throw Error(n(407));d=d()}else{if(d=a(),Rt===null)throw Error(n(349));(as&30)!==0||ev(g,a,d)}v.memoizedState=d;var S={value:d,getSnapshot:a};return v.queue=S,lv(nv.bind(null,g,S,i),[i]),g.flags|=2048,Cl(9,tv.bind(null,g,S,d,a),void 0,null),d},useId:function(){var i=gr(),a=Rt.identifierPrefix;if(st){var d=Or,g=Pr;d=(g&~(1<<32-Jn(g)-1)).toString(32)+d,a=":"+a+"R"+d,d=kl++,0<d&&(a+="H"+d.toString(32)),a+=":"}else d=R2++,a=":"+a+"r"+d.toString(32)+":";return i.memoizedState=a},unstable_isNewReconciler:!1},_2={readContext:Dn,useCallback:fv,useContext:Dn,useEffect:hh,useImperativeHandle:dv,useInsertionEffect:av,useLayoutEffect:cv,useMemo:hv,useReducer:dh,useRef:iv,useState:function(){return dh(Sl)},useDebugValue:ph,useDeferredValue:function(i){var a=_n();return pv(a,Ct.memoizedState,i)},useTransition:function(){var i=dh(Sl)[0],a=_n().memoizedState;return[i,a]},useMutableSource:Xx,useSyncExternalStore:Zx,useId:mv,unstable_isNewReconciler:!1},L2={readContext:Dn,useCallback:fv,useContext:Dn,useEffect:hh,useImperativeHandle:dv,useInsertionEffect:av,useLayoutEffect:cv,useMemo:hv,useReducer:fh,useRef:iv,useState:function(){return fh(Sl)},useDebugValue:ph,useDeferredValue:function(i){var a=_n();return Ct===null?a.memoizedState=i:pv(a,Ct.memoizedState,i)},useTransition:function(){var i=fh(Sl)[0],a=_n().memoizedState;return[i,a]},useMutableSource:Xx,useSyncExternalStore:Zx,useId:mv,unstable_isNewReconciler:!1};function Xn(i,a){if(i&&i.defaultProps){a=B({},a),i=i.defaultProps;for(var d in i)a[d]===void 0&&(a[d]=i[d]);return a}return a}function mh(i,a,d,g){a=i.memoizedState,d=d(g,a),d=d==null?a:B({},a,d),i.memoizedState=d,i.lanes===0&&(i.updateQueue.baseState=d)}var mc={isMounted:function(i){return(i=i._reactInternals)?es(i)===i:!1},enqueueSetState:function(i,a,d){i=i._reactInternals;var g=tn(),v=mo(i),S=Dr(g,v);S.payload=a,d!=null&&(S.callback=d),a=uo(i,S,v),a!==null&&(tr(a,i,v,g),lc(a,i,v))},enqueueReplaceState:function(i,a,d){i=i._reactInternals;var g=tn(),v=mo(i),S=Dr(g,v);S.tag=1,S.payload=a,d!=null&&(S.callback=d),a=uo(i,S,v),a!==null&&(tr(a,i,v,g),lc(a,i,v))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var d=tn(),g=mo(i),v=Dr(d,g);v.tag=2,a!=null&&(v.callback=a),a=uo(i,v,g),a!==null&&(tr(a,i,g,d),lc(a,i,g))}};function vv(i,a,d,g,v,S,E){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(g,S,E):a.prototype&&a.prototype.isPureReactComponent?!ul(d,g)||!ul(v,S):!0}function wv(i,a,d){var g=!1,v=lo,S=a.contextType;return typeof S=="object"&&S!==null?S=Dn(S):(v=un(a)?ns:Ut.current,g=a.contextTypes,S=(g=g!=null)?ni(i,v):lo),a=new a(d,S),i.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=mc,i.stateNode=a,a._reactInternals=i,g&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=v,i.__reactInternalMemoizedMaskedChildContext=S),a}function bv(i,a,d,g){i=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(d,g),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(d,g),a.state!==i&&mc.enqueueReplaceState(a,a.state,null)}function gh(i,a,d,g){var v=i.stateNode;v.props=d,v.state=i.memoizedState,v.refs={},nh(i);var S=a.contextType;typeof S=="object"&&S!==null?v.context=Dn(S):(S=un(a)?ns:Ut.current,v.context=ni(i,S)),v.state=i.memoizedState,S=a.getDerivedStateFromProps,typeof S=="function"&&(mh(i,a,S,d),v.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(a=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),a!==v.state&&mc.enqueueReplaceState(v,v.state,null),ac(i,d,v,g),v.state=i.memoizedState),typeof v.componentDidMount=="function"&&(i.flags|=4194308)}function ui(i,a){try{var d="",g=a;do d+=we(g),g=g.return;while(g);var v=d}catch(S){v=`
39
+ Error generating stack: `+S.message+`
40
+ `+S.stack}return{value:i,source:a,stack:v,digest:null}}function yh(i,a,d){return{value:i,source:null,stack:d??null,digest:a??null}}function xh(i,a){try{console.error(a.value)}catch(d){setTimeout(function(){throw d})}}var z2=typeof WeakMap=="function"?WeakMap:Map;function kv(i,a,d){d=Dr(-1,d),d.tag=3,d.payload={element:null};var g=a.value;return d.callback=function(){kc||(kc=!0,Oh=g),xh(i,a)},d}function Sv(i,a,d){d=Dr(-1,d),d.tag=3;var g=i.type.getDerivedStateFromError;if(typeof g=="function"){var v=a.value;d.payload=function(){return g(v)},d.callback=function(){xh(i,a)}}var S=i.stateNode;return S!==null&&typeof S.componentDidCatch=="function"&&(d.callback=function(){xh(i,a),typeof g!="function"&&(ho===null?ho=new Set([this]):ho.add(this));var E=a.stack;this.componentDidCatch(a.value,{componentStack:E!==null?E:""})}),d}function Cv(i,a,d){var g=i.pingCache;if(g===null){g=i.pingCache=new z2;var v=new Set;g.set(a,v)}else v=g.get(a),v===void 0&&(v=new Set,g.set(a,v));v.has(d)||(v.add(d),i=X2.bind(null,i,a,d),a.then(i,i))}function Nv(i){do{var a;if((a=i.tag===13)&&(a=i.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return i;i=i.return}while(i!==null);return null}function Ev(i,a,d,g,v){return(i.mode&1)===0?(i===a?i.flags|=65536:(i.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(a=Dr(-1,1),a.tag=2,uo(d,a,1))),d.lanes|=1),i):(i.flags|=65536,i.lanes=v,i)}var $2=j.ReactCurrentOwner,dn=!1;function en(i,a,d,g){a.child=i===null?Kx(a,null,d,g):ii(a,i.child,d,g)}function Mv(i,a,d,g,v){d=d.render;var S=a.ref;return ai(a,v),g=ch(i,a,d,g,S,v),d=uh(),i!==null&&!dn?(a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~v,_r(i,a,v)):(st&&d&&Kf(a),a.flags|=1,en(i,a,g,v),a.child)}function Tv(i,a,d,g,v){if(i===null){var S=d.type;return typeof S=="function"&&!Fh(S)&&S.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(a.tag=15,a.type=S,jv(i,a,S,g,v)):(i=Tc(d.type,null,g,a,a.mode,v),i.ref=a.ref,i.return=a,a.child=i)}if(S=i.child,(i.lanes&v)===0){var E=S.memoizedProps;if(d=d.compare,d=d!==null?d:ul,d(E,g)&&i.ref===a.ref)return _r(i,a,v)}return a.flags|=1,i=yo(S,g),i.ref=a.ref,i.return=a,a.child=i}function jv(i,a,d,g,v){if(i!==null){var S=i.memoizedProps;if(ul(S,g)&&i.ref===a.ref)if(dn=!1,a.pendingProps=g=S,(i.lanes&v)!==0)(i.flags&131072)!==0&&(dn=!0);else return a.lanes=i.lanes,_r(i,a,v)}return vh(i,a,d,g,v)}function Av(i,a,d){var g=a.pendingProps,v=g.children,S=i!==null?i.memoizedState:null;if(g.mode==="hidden")if((a.mode&1)===0)a.memoizedState={baseLanes:0,cachePool:null,transitions:null},Qe(fi,Cn),Cn|=d;else{if((d&1073741824)===0)return i=S!==null?S.baseLanes|d:d,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:i,cachePool:null,transitions:null},a.updateQueue=null,Qe(fi,Cn),Cn|=i,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=S!==null?S.baseLanes:d,Qe(fi,Cn),Cn|=g}else S!==null?(g=S.baseLanes|d,a.memoizedState=null):g=d,Qe(fi,Cn),Cn|=g;return en(i,a,v,d),a.child}function Rv(i,a){var d=a.ref;(i===null&&d!==null||i!==null&&i.ref!==d)&&(a.flags|=512,a.flags|=2097152)}function vh(i,a,d,g,v){var S=un(d)?ns:Ut.current;return S=ni(a,S),ai(a,v),d=ch(i,a,d,g,S,v),g=uh(),i!==null&&!dn?(a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~v,_r(i,a,v)):(st&&g&&Kf(a),a.flags|=1,en(i,a,d,v),a.child)}function Pv(i,a,d,g,v){if(un(d)){var S=!0;Za(a)}else S=!1;if(ai(a,v),a.stateNode===null)yc(i,a),wv(a,d,g),gh(a,d,g,v),g=!0;else if(i===null){var E=a.stateNode,A=a.memoizedProps;E.props=A;var O=E.context,V=d.contextType;typeof V=="object"&&V!==null?V=Dn(V):(V=un(d)?ns:Ut.current,V=ni(a,V));var J=d.getDerivedStateFromProps,Q=typeof J=="function"||typeof E.getSnapshotBeforeUpdate=="function";Q||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(A!==g||O!==V)&&bv(a,E,g,V),co=!1;var G=a.memoizedState;E.state=G,ac(a,g,E,v),O=a.memoizedState,A!==g||G!==O||cn.current||co?(typeof J=="function"&&(mh(a,d,J,g),O=a.memoizedState),(A=co||vv(a,d,A,g,G,O,V))?(Q||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(a.flags|=4194308)):(typeof E.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=g,a.memoizedState=O),E.props=g,E.state=O,E.context=V,g=A):(typeof E.componentDidMount=="function"&&(a.flags|=4194308),g=!1)}else{E=a.stateNode,Gx(i,a),A=a.memoizedProps,V=a.type===a.elementType?A:Xn(a.type,A),E.props=V,Q=a.pendingProps,G=E.context,O=d.contextType,typeof O=="object"&&O!==null?O=Dn(O):(O=un(d)?ns:Ut.current,O=ni(a,O));var ce=d.getDerivedStateFromProps;(J=typeof ce=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(A!==Q||G!==O)&&bv(a,E,g,O),co=!1,G=a.memoizedState,E.state=G,ac(a,g,E,v);var ge=a.memoizedState;A!==Q||G!==ge||cn.current||co?(typeof ce=="function"&&(mh(a,d,ce,g),ge=a.memoizedState),(V=co||vv(a,d,V,g,G,ge,O)||!1)?(J||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(g,ge,O),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(g,ge,O)),typeof E.componentDidUpdate=="function"&&(a.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof E.componentDidUpdate!="function"||A===i.memoizedProps&&G===i.memoizedState||(a.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||A===i.memoizedProps&&G===i.memoizedState||(a.flags|=1024),a.memoizedProps=g,a.memoizedState=ge),E.props=g,E.state=ge,E.context=O,g=V):(typeof E.componentDidUpdate!="function"||A===i.memoizedProps&&G===i.memoizedState||(a.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||A===i.memoizedProps&&G===i.memoizedState||(a.flags|=1024),g=!1)}return wh(i,a,d,g,S,v)}function wh(i,a,d,g,v,S){Rv(i,a);var E=(a.flags&128)!==0;if(!g&&!E)return v&&Lx(a,d,!1),_r(i,a,S);g=a.stateNode,$2.current=a;var A=E&&typeof d.getDerivedStateFromError!="function"?null:g.render();return a.flags|=1,i!==null&&E?(a.child=ii(a,i.child,null,S),a.child=ii(a,null,A,S)):en(i,a,A,S),a.memoizedState=g.state,v&&Lx(a,d,!0),a.child}function Ov(i){var a=i.stateNode;a.pendingContext?Dx(i,a.pendingContext,a.pendingContext!==a.context):a.context&&Dx(i,a.context,!1),rh(i,a.containerInfo)}function Iv(i,a,d,g,v){return si(),Yf(v),a.flags|=256,en(i,a,d,g),a.child}var bh={dehydrated:null,treeContext:null,retryLane:0};function kh(i){return{baseLanes:i,cachePool:null,transitions:null}}function Dv(i,a,d){var g=a.pendingProps,v=at.current,S=!1,E=(a.flags&128)!==0,A;if((A=E)||(A=i!==null&&i.memoizedState===null?!1:(v&2)!==0),A?(S=!0,a.flags&=-129):(i===null||i.memoizedState!==null)&&(v|=1),Qe(at,v&1),i===null)return Jf(a),i=a.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((a.mode&1)===0?a.lanes=1:i.data==="$!"?a.lanes=8:a.lanes=1073741824,null):(E=g.children,i=g.fallback,S?(g=a.mode,S=a.child,E={mode:"hidden",children:E},(g&1)===0&&S!==null?(S.childLanes=0,S.pendingProps=E):S=jc(E,g,0,null),i=hs(i,g,d,null),S.return=a,i.return=a,S.sibling=i,a.child=S,a.child.memoizedState=kh(d),a.memoizedState=bh,i):Sh(a,E));if(v=i.memoizedState,v!==null&&(A=v.dehydrated,A!==null))return F2(i,a,E,g,A,v,d);if(S){S=g.fallback,E=a.mode,v=i.child,A=v.sibling;var O={mode:"hidden",children:g.children};return(E&1)===0&&a.child!==v?(g=a.child,g.childLanes=0,g.pendingProps=O,a.deletions=null):(g=yo(v,O),g.subtreeFlags=v.subtreeFlags&14680064),A!==null?S=yo(A,S):(S=hs(S,E,d,null),S.flags|=2),S.return=a,g.return=a,g.sibling=S,a.child=g,g=S,S=a.child,E=i.child.memoizedState,E=E===null?kh(d):{baseLanes:E.baseLanes|d,cachePool:null,transitions:E.transitions},S.memoizedState=E,S.childLanes=i.childLanes&~d,a.memoizedState=bh,g}return S=i.child,i=S.sibling,g=yo(S,{mode:"visible",children:g.children}),(a.mode&1)===0&&(g.lanes=d),g.return=a,g.sibling=null,i!==null&&(d=a.deletions,d===null?(a.deletions=[i],a.flags|=16):d.push(i)),a.child=g,a.memoizedState=null,g}function Sh(i,a){return a=jc({mode:"visible",children:a},i.mode,0,null),a.return=i,i.child=a}function gc(i,a,d,g){return g!==null&&Yf(g),ii(a,i.child,null,d),i=Sh(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function F2(i,a,d,g,v,S,E){if(d)return a.flags&256?(a.flags&=-257,g=yh(Error(n(422))),gc(i,a,E,g)):a.memoizedState!==null?(a.child=i.child,a.flags|=128,null):(S=g.fallback,v=a.mode,g=jc({mode:"visible",children:g.children},v,0,null),S=hs(S,v,E,null),S.flags|=2,g.return=a,S.return=a,g.sibling=S,a.child=g,(a.mode&1)!==0&&ii(a,i.child,null,E),a.child.memoizedState=kh(E),a.memoizedState=bh,S);if((a.mode&1)===0)return gc(i,a,E,null);if(v.data==="$!"){if(g=v.nextSibling&&v.nextSibling.dataset,g)var A=g.dgst;return g=A,S=Error(n(419)),g=yh(S,g,void 0),gc(i,a,E,g)}if(A=(E&i.childLanes)!==0,dn||A){if(g=Rt,g!==null){switch(E&-E){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(g.suspendedLanes|E))!==0?0:v,v!==0&&v!==S.retryLane&&(S.retryLane=v,Ir(i,v),tr(g,i,v,-1))}return $h(),g=yh(Error(n(421))),gc(i,a,E,g)}return v.data==="$?"?(a.flags|=128,a.child=i.child,a=Z2.bind(null,i),v._reactRetry=a,null):(i=S.treeContext,Sn=so(v.nextSibling),kn=a,st=!0,Qn=null,i!==null&&(On[In++]=Pr,On[In++]=Or,On[In++]=rs,Pr=i.id,Or=i.overflow,rs=a),a=Sh(a,g.children),a.flags|=4096,a)}function _v(i,a,d){i.lanes|=a;var g=i.alternate;g!==null&&(g.lanes|=a),eh(i.return,a,d)}function Ch(i,a,d,g,v){var S=i.memoizedState;S===null?i.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:g,tail:d,tailMode:v}:(S.isBackwards=a,S.rendering=null,S.renderingStartTime=0,S.last=g,S.tail=d,S.tailMode=v)}function Lv(i,a,d){var g=a.pendingProps,v=g.revealOrder,S=g.tail;if(en(i,a,g.children,d),g=at.current,(g&2)!==0)g=g&1|2,a.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&_v(i,d,a);else if(i.tag===19)_v(i,d,a);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}g&=1}if(Qe(at,g),(a.mode&1)===0)a.memoizedState=null;else switch(v){case"forwards":for(d=a.child,v=null;d!==null;)i=d.alternate,i!==null&&cc(i)===null&&(v=d),d=d.sibling;d=v,d===null?(v=a.child,a.child=null):(v=d.sibling,d.sibling=null),Ch(a,!1,v,d,S);break;case"backwards":for(d=null,v=a.child,a.child=null;v!==null;){if(i=v.alternate,i!==null&&cc(i)===null){a.child=v;break}i=v.sibling,v.sibling=d,d=v,v=i}Ch(a,!0,d,null,S);break;case"together":Ch(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function yc(i,a){(a.mode&1)===0&&i!==null&&(i.alternate=null,a.alternate=null,a.flags|=2)}function _r(i,a,d){if(i!==null&&(a.dependencies=i.dependencies),cs|=a.lanes,(d&a.childLanes)===0)return null;if(i!==null&&a.child!==i.child)throw Error(n(153));if(a.child!==null){for(i=a.child,d=yo(i,i.pendingProps),a.child=d,d.return=a;i.sibling!==null;)i=i.sibling,d=d.sibling=yo(i,i.pendingProps),d.return=a;d.sibling=null}return a.child}function B2(i,a,d){switch(a.tag){case 3:Ov(a),si();break;case 5:Qx(a);break;case 1:un(a.type)&&Za(a);break;case 4:rh(a,a.stateNode.containerInfo);break;case 10:var g=a.type._context,v=a.memoizedProps.value;Qe(sc,g._currentValue),g._currentValue=v;break;case 13:if(g=a.memoizedState,g!==null)return g.dehydrated!==null?(Qe(at,at.current&1),a.flags|=128,null):(d&a.child.childLanes)!==0?Dv(i,a,d):(Qe(at,at.current&1),i=_r(i,a,d),i!==null?i.sibling:null);Qe(at,at.current&1);break;case 19:if(g=(d&a.childLanes)!==0,(i.flags&128)!==0){if(g)return Lv(i,a,d);a.flags|=128}if(v=a.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),Qe(at,at.current),g)break;return null;case 22:case 23:return a.lanes=0,Av(i,a,d)}return _r(i,a,d)}var zv,Nh,$v,Fv;zv=function(i,a){for(var d=a.child;d!==null;){if(d.tag===5||d.tag===6)i.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===a)break;for(;d.sibling===null;){if(d.return===null||d.return===a)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},Nh=function(){},$v=function(i,a,d,g){var v=i.memoizedProps;if(v!==g){i=a.stateNode,ls(mr.current);var S=null;switch(d){case"input":v=rt(i,v),g=rt(i,g),S=[];break;case"select":v=B({},v,{value:void 0}),g=B({},g,{value:void 0}),S=[];break;case"textarea":v=lt(i,v),g=lt(i,g),S=[];break;default:typeof v.onClick!="function"&&typeof g.onClick=="function"&&(i.onclick=Ya)}of(d,g);var E;d=null;for(V in v)if(!g.hasOwnProperty(V)&&v.hasOwnProperty(V)&&v[V]!=null)if(V==="style"){var A=v[V];for(E in A)A.hasOwnProperty(E)&&(d||(d={}),d[E]="")}else V!=="dangerouslySetInnerHTML"&&V!=="children"&&V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&V!=="autoFocus"&&(o.hasOwnProperty(V)?S||(S=[]):(S=S||[]).push(V,null));for(V in g){var O=g[V];if(A=v!=null?v[V]:void 0,g.hasOwnProperty(V)&&O!==A&&(O!=null||A!=null))if(V==="style")if(A){for(E in A)!A.hasOwnProperty(E)||O&&O.hasOwnProperty(E)||(d||(d={}),d[E]="");for(E in O)O.hasOwnProperty(E)&&A[E]!==O[E]&&(d||(d={}),d[E]=O[E])}else d||(S||(S=[]),S.push(V,d)),d=O;else V==="dangerouslySetInnerHTML"?(O=O?O.__html:void 0,A=A?A.__html:void 0,O!=null&&A!==O&&(S=S||[]).push(V,O)):V==="children"?typeof O!="string"&&typeof O!="number"||(S=S||[]).push(V,""+O):V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&(o.hasOwnProperty(V)?(O!=null&&V==="onScroll"&&et("scroll",i),S||A===O||(S=[])):(S=S||[]).push(V,O))}d&&(S=S||[]).push("style",d);var V=S;(a.updateQueue=V)&&(a.flags|=4)}},Fv=function(i,a,d,g){d!==g&&(a.flags|=4)};function Nl(i,a){if(!st)switch(i.tailMode){case"hidden":a=i.tail;for(var d=null;a!==null;)a.alternate!==null&&(d=a),a=a.sibling;d===null?i.tail=null:d.sibling=null;break;case"collapsed":d=i.tail;for(var g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?a||i.tail===null?i.tail=null:i.tail.sibling=null:g.sibling=null}}function qt(i){var a=i.alternate!==null&&i.alternate.child===i.child,d=0,g=0;if(a)for(var v=i.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags&14680064,g|=v.flags&14680064,v.return=i,v=v.sibling;else for(v=i.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags,g|=v.flags,v.return=i,v=v.sibling;return i.subtreeFlags|=g,i.childLanes=d,a}function V2(i,a,d){var g=a.pendingProps;switch(qf(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qt(a),null;case 1:return un(a.type)&&Xa(),qt(a),null;case 3:return g=a.stateNode,ci(),tt(cn),tt(Ut),ih(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(i===null||i.child===null)&&(rc(a)?a.flags|=4:i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Qn!==null&&(_h(Qn),Qn=null))),Nh(i,a),qt(a),null;case 5:oh(a);var v=ls(wl.current);if(d=a.type,i!==null&&a.stateNode!=null)$v(i,a,d,g,v),i.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!g){if(a.stateNode===null)throw Error(n(166));return qt(a),null}if(i=ls(mr.current),rc(a)){g=a.stateNode,d=a.type;var S=a.memoizedProps;switch(g[pr]=a,g[ml]=S,i=(a.mode&1)!==0,d){case"dialog":et("cancel",g),et("close",g);break;case"iframe":case"object":case"embed":et("load",g);break;case"video":case"audio":for(v=0;v<fl.length;v++)et(fl[v],g);break;case"source":et("error",g);break;case"img":case"image":case"link":et("error",g),et("load",g);break;case"details":et("toggle",g);break;case"input":de(g,S),et("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!S.multiple},et("invalid",g);break;case"textarea":fr(g,S),et("invalid",g)}of(d,S),v=null;for(var E in S)if(S.hasOwnProperty(E)){var A=S[E];E==="children"?typeof A=="string"?g.textContent!==A&&(S.suppressHydrationWarning!==!0&&Ja(g.textContent,A,i),v=["children",A]):typeof A=="number"&&g.textContent!==""+A&&(S.suppressHydrationWarning!==!0&&Ja(g.textContent,A,i),v=["children",""+A]):o.hasOwnProperty(E)&&A!=null&&E==="onScroll"&&et("scroll",g)}switch(d){case"input":De(g),Pn(g,S,!0);break;case"textarea":De(g),Ny(g);break;case"select":case"option":break;default:typeof S.onClick=="function"&&(g.onclick=Ya)}g=v,a.updateQueue=g,g!==null&&(a.flags|=4)}else{E=v.nodeType===9?v:v.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=Ey(d)),i==="http://www.w3.org/1999/xhtml"?d==="script"?(i=E.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof g.is=="string"?i=E.createElement(d,{is:g.is}):(i=E.createElement(d),d==="select"&&(E=i,g.multiple?E.multiple=!0:g.size&&(E.size=g.size))):i=E.createElementNS(i,d),i[pr]=a,i[ml]=g,zv(i,a,!1,!1),a.stateNode=i;e:{switch(E=sf(d,g),d){case"dialog":et("cancel",i),et("close",i),v=g;break;case"iframe":case"object":case"embed":et("load",i),v=g;break;case"video":case"audio":for(v=0;v<fl.length;v++)et(fl[v],i);v=g;break;case"source":et("error",i),v=g;break;case"img":case"image":case"link":et("error",i),et("load",i),v=g;break;case"details":et("toggle",i),v=g;break;case"input":de(i,g),v=rt(i,g),et("invalid",i);break;case"option":v=g;break;case"select":i._wrapperState={wasMultiple:!!g.multiple},v=B({},g,{value:void 0}),et("invalid",i);break;case"textarea":fr(i,g),v=lt(i,g),et("invalid",i);break;default:v=g}of(d,v),A=v;for(S in A)if(A.hasOwnProperty(S)){var O=A[S];S==="style"?jy(i,O):S==="dangerouslySetInnerHTML"?(O=O?O.__html:void 0,O!=null&&My(i,O)):S==="children"?typeof O=="string"?(d!=="textarea"||O!=="")&&qi(i,O):typeof O=="number"&&qi(i,""+O):S!=="suppressContentEditableWarning"&&S!=="suppressHydrationWarning"&&S!=="autoFocus"&&(o.hasOwnProperty(S)?O!=null&&S==="onScroll"&&et("scroll",i):O!=null&&T(i,S,O,E))}switch(d){case"input":De(i),Pn(i,g,!1);break;case"textarea":De(i),Ny(i);break;case"option":g.value!=null&&i.setAttribute("value",""+pe(g.value));break;case"select":i.multiple=!!g.multiple,S=g.value,S!=null?Be(i,!!g.multiple,S,!1):g.defaultValue!=null&&Be(i,!!g.multiple,g.defaultValue,!0);break;default:typeof v.onClick=="function"&&(i.onclick=Ya)}switch(d){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}}g&&(a.flags|=4)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return qt(a),null;case 6:if(i&&a.stateNode!=null)Fv(i,a,i.memoizedProps,g);else{if(typeof g!="string"&&a.stateNode===null)throw Error(n(166));if(d=ls(wl.current),ls(mr.current),rc(a)){if(g=a.stateNode,d=a.memoizedProps,g[pr]=a,(S=g.nodeValue!==d)&&(i=kn,i!==null))switch(i.tag){case 3:Ja(g.nodeValue,d,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&Ja(g.nodeValue,d,(i.mode&1)!==0)}S&&(a.flags|=4)}else g=(d.nodeType===9?d:d.ownerDocument).createTextNode(g),g[pr]=a,a.stateNode=g}return qt(a),null;case 13:if(tt(at),g=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(st&&Sn!==null&&(a.mode&1)!==0&&(a.flags&128)===0)Hx(),si(),a.flags|=98560,S=!1;else if(S=rc(a),g!==null&&g.dehydrated!==null){if(i===null){if(!S)throw Error(n(318));if(S=a.memoizedState,S=S!==null?S.dehydrated:null,!S)throw Error(n(317));S[pr]=a}else si(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;qt(a),S=!1}else Qn!==null&&(_h(Qn),Qn=null),S=!0;if(!S)return a.flags&65536?a:null}return(a.flags&128)!==0?(a.lanes=d,a):(g=g!==null,g!==(i!==null&&i.memoizedState!==null)&&g&&(a.child.flags|=8192,(a.mode&1)!==0&&(i===null||(at.current&1)!==0?Nt===0&&(Nt=3):$h())),a.updateQueue!==null&&(a.flags|=4),qt(a),null);case 4:return ci(),Nh(i,a),i===null&&hl(a.stateNode.containerInfo),qt(a),null;case 10:return Zf(a.type._context),qt(a),null;case 17:return un(a.type)&&Xa(),qt(a),null;case 19:if(tt(at),S=a.memoizedState,S===null)return qt(a),null;if(g=(a.flags&128)!==0,E=S.rendering,E===null)if(g)Nl(S,!1);else{if(Nt!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(E=cc(i),E!==null){for(a.flags|=128,Nl(S,!1),g=E.updateQueue,g!==null&&(a.updateQueue=g,a.flags|=4),a.subtreeFlags=0,g=d,d=a.child;d!==null;)S=d,i=g,S.flags&=14680066,E=S.alternate,E===null?(S.childLanes=0,S.lanes=i,S.child=null,S.subtreeFlags=0,S.memoizedProps=null,S.memoizedState=null,S.updateQueue=null,S.dependencies=null,S.stateNode=null):(S.childLanes=E.childLanes,S.lanes=E.lanes,S.child=E.child,S.subtreeFlags=0,S.deletions=null,S.memoizedProps=E.memoizedProps,S.memoizedState=E.memoizedState,S.updateQueue=E.updateQueue,S.type=E.type,i=E.dependencies,S.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),d=d.sibling;return Qe(at,at.current&1|2),a.child}i=i.sibling}S.tail!==null&&pt()>hi&&(a.flags|=128,g=!0,Nl(S,!1),a.lanes=4194304)}else{if(!g)if(i=cc(E),i!==null){if(a.flags|=128,g=!0,d=i.updateQueue,d!==null&&(a.updateQueue=d,a.flags|=4),Nl(S,!0),S.tail===null&&S.tailMode==="hidden"&&!E.alternate&&!st)return qt(a),null}else 2*pt()-S.renderingStartTime>hi&&d!==1073741824&&(a.flags|=128,g=!0,Nl(S,!1),a.lanes=4194304);S.isBackwards?(E.sibling=a.child,a.child=E):(d=S.last,d!==null?d.sibling=E:a.child=E,S.last=E)}return S.tail!==null?(a=S.tail,S.rendering=a,S.tail=a.sibling,S.renderingStartTime=pt(),a.sibling=null,d=at.current,Qe(at,g?d&1|2:d&1),a):(qt(a),null);case 22:case 23:return zh(),g=a.memoizedState!==null,i!==null&&i.memoizedState!==null!==g&&(a.flags|=8192),g&&(a.mode&1)!==0?(Cn&1073741824)!==0&&(qt(a),a.subtreeFlags&6&&(a.flags|=8192)):qt(a),null;case 24:return null;case 25:return null}throw Error(n(156,a.tag))}function H2(i,a){switch(qf(a),a.tag){case 1:return un(a.type)&&Xa(),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return ci(),tt(cn),tt(Ut),ih(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 5:return oh(a),null;case 13:if(tt(at),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(n(340));si()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return tt(at),null;case 4:return ci(),null;case 10:return Zf(a.type._context),null;case 22:case 23:return zh(),null;case 24:return null;default:return null}}var xc=!1,Gt=!1,W2=typeof WeakSet=="function"?WeakSet:Set,me=null;function di(i,a){var d=i.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(g){ut(i,a,g)}else d.current=null}function Eh(i,a,d){try{d()}catch(g){ut(i,a,g)}}var Bv=!1;function U2(i,a){if(zf=za,i=vx(),Af(i)){if("selectionStart"in i)var d={start:i.selectionStart,end:i.selectionEnd};else e:{d=(d=i.ownerDocument)&&d.defaultView||window;var g=d.getSelection&&d.getSelection();if(g&&g.rangeCount!==0){d=g.anchorNode;var v=g.anchorOffset,S=g.focusNode;g=g.focusOffset;try{d.nodeType,S.nodeType}catch{d=null;break e}var E=0,A=-1,O=-1,V=0,J=0,Q=i,G=null;t:for(;;){for(var ce;Q!==d||v!==0&&Q.nodeType!==3||(A=E+v),Q!==S||g!==0&&Q.nodeType!==3||(O=E+g),Q.nodeType===3&&(E+=Q.nodeValue.length),(ce=Q.firstChild)!==null;)G=Q,Q=ce;for(;;){if(Q===i)break t;if(G===d&&++V===v&&(A=E),G===S&&++J===g&&(O=E),(ce=Q.nextSibling)!==null)break;Q=G,G=Q.parentNode}Q=ce}d=A===-1||O===-1?null:{start:A,end:O}}else d=null}d=d||{start:0,end:0}}else d=null;for($f={focusedElem:i,selectionRange:d},za=!1,me=a;me!==null;)if(a=me,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,me=i;else for(;me!==null;){a=me;try{var ge=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(ge!==null){var be=ge.memoizedProps,mt=ge.memoizedState,z=a.stateNode,D=z.getSnapshotBeforeUpdate(a.elementType===a.type?be:Xn(a.type,be),mt);z.__reactInternalSnapshotBeforeUpdate=D}break;case 3:var F=a.stateNode.containerInfo;F.nodeType===1?F.textContent="":F.nodeType===9&&F.documentElement&&F.removeChild(F.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(te){ut(a,a.return,te)}if(i=a.sibling,i!==null){i.return=a.return,me=i;break}me=a.return}return ge=Bv,Bv=!1,ge}function El(i,a,d){var g=a.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var v=g=g.next;do{if((v.tag&i)===i){var S=v.destroy;v.destroy=void 0,S!==void 0&&Eh(a,d,S)}v=v.next}while(v!==g)}}function vc(i,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var d=a=a.next;do{if((d.tag&i)===i){var g=d.create;d.destroy=g()}d=d.next}while(d!==a)}}function Mh(i){var a=i.ref;if(a!==null){var d=i.stateNode;switch(i.tag){case 5:i=d;break;default:i=d}typeof a=="function"?a(i):a.current=i}}function Vv(i){var a=i.alternate;a!==null&&(i.alternate=null,Vv(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&(delete a[pr],delete a[ml],delete a[Hf],delete a[M2],delete a[T2])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function Hv(i){return i.tag===5||i.tag===3||i.tag===4}function Wv(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Hv(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Th(i,a,d){var g=i.tag;if(g===5||g===6)i=i.stateNode,a?d.nodeType===8?d.parentNode.insertBefore(i,a):d.insertBefore(i,a):(d.nodeType===8?(a=d.parentNode,a.insertBefore(i,d)):(a=d,a.appendChild(i)),d=d._reactRootContainer,d!=null||a.onclick!==null||(a.onclick=Ya));else if(g!==4&&(i=i.child,i!==null))for(Th(i,a,d),i=i.sibling;i!==null;)Th(i,a,d),i=i.sibling}function jh(i,a,d){var g=i.tag;if(g===5||g===6)i=i.stateNode,a?d.insertBefore(i,a):d.appendChild(i);else if(g!==4&&(i=i.child,i!==null))for(jh(i,a,d),i=i.sibling;i!==null;)jh(i,a,d),i=i.sibling}var _t=null,Zn=!1;function fo(i,a,d){for(d=d.child;d!==null;)Uv(i,a,d),d=d.sibling}function Uv(i,a,d){if(hr&&typeof hr.onCommitFiberUnmount=="function")try{hr.onCommitFiberUnmount(Pa,d)}catch{}switch(d.tag){case 5:Gt||di(d,a);case 6:var g=_t,v=Zn;_t=null,fo(i,a,d),_t=g,Zn=v,_t!==null&&(Zn?(i=_t,d=d.stateNode,i.nodeType===8?i.parentNode.removeChild(d):i.removeChild(d)):_t.removeChild(d.stateNode));break;case 18:_t!==null&&(Zn?(i=_t,d=d.stateNode,i.nodeType===8?Vf(i.parentNode,d):i.nodeType===1&&Vf(i,d),ol(i)):Vf(_t,d.stateNode));break;case 4:g=_t,v=Zn,_t=d.stateNode.containerInfo,Zn=!0,fo(i,a,d),_t=g,Zn=v;break;case 0:case 11:case 14:case 15:if(!Gt&&(g=d.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){v=g=g.next;do{var S=v,E=S.destroy;S=S.tag,E!==void 0&&((S&2)!==0||(S&4)!==0)&&Eh(d,a,E),v=v.next}while(v!==g)}fo(i,a,d);break;case 1:if(!Gt&&(di(d,a),g=d.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=d.memoizedProps,g.state=d.memoizedState,g.componentWillUnmount()}catch(A){ut(d,a,A)}fo(i,a,d);break;case 21:fo(i,a,d);break;case 22:d.mode&1?(Gt=(g=Gt)||d.memoizedState!==null,fo(i,a,d),Gt=g):fo(i,a,d);break;default:fo(i,a,d)}}function Kv(i){var a=i.updateQueue;if(a!==null){i.updateQueue=null;var d=i.stateNode;d===null&&(d=i.stateNode=new W2),a.forEach(function(g){var v=ej.bind(null,i,g);d.has(g)||(d.add(g),g.then(v,v))})}}function er(i,a){var d=a.deletions;if(d!==null)for(var g=0;g<d.length;g++){var v=d[g];try{var S=i,E=a,A=E;e:for(;A!==null;){switch(A.tag){case 5:_t=A.stateNode,Zn=!1;break e;case 3:_t=A.stateNode.containerInfo,Zn=!0;break e;case 4:_t=A.stateNode.containerInfo,Zn=!0;break e}A=A.return}if(_t===null)throw Error(n(160));Uv(S,E,v),_t=null,Zn=!1;var O=v.alternate;O!==null&&(O.return=null),v.return=null}catch(V){ut(v,a,V)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)qv(a,i),a=a.sibling}function qv(i,a){var d=i.alternate,g=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(er(a,i),yr(i),g&4){try{El(3,i,i.return),vc(3,i)}catch(be){ut(i,i.return,be)}try{El(5,i,i.return)}catch(be){ut(i,i.return,be)}}break;case 1:er(a,i),yr(i),g&512&&d!==null&&di(d,d.return);break;case 5:if(er(a,i),yr(i),g&512&&d!==null&&di(d,d.return),i.flags&32){var v=i.stateNode;try{qi(v,"")}catch(be){ut(i,i.return,be)}}if(g&4&&(v=i.stateNode,v!=null)){var S=i.memoizedProps,E=d!==null?d.memoizedProps:S,A=i.type,O=i.updateQueue;if(i.updateQueue=null,O!==null)try{A==="input"&&S.type==="radio"&&S.name!=null&&We(v,S),sf(A,E);var V=sf(A,S);for(E=0;E<O.length;E+=2){var J=O[E],Q=O[E+1];J==="style"?jy(v,Q):J==="dangerouslySetInnerHTML"?My(v,Q):J==="children"?qi(v,Q):T(v,J,Q,V)}switch(A){case"input":ot(v,S);break;case"textarea":Cy(v,S);break;case"select":var G=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!S.multiple;var ce=S.value;ce!=null?Be(v,!!S.multiple,ce,!1):G!==!!S.multiple&&(S.defaultValue!=null?Be(v,!!S.multiple,S.defaultValue,!0):Be(v,!!S.multiple,S.multiple?[]:"",!1))}v[ml]=S}catch(be){ut(i,i.return,be)}}break;case 6:if(er(a,i),yr(i),g&4){if(i.stateNode===null)throw Error(n(162));v=i.stateNode,S=i.memoizedProps;try{v.nodeValue=S}catch(be){ut(i,i.return,be)}}break;case 3:if(er(a,i),yr(i),g&4&&d!==null&&d.memoizedState.isDehydrated)try{ol(a.containerInfo)}catch(be){ut(i,i.return,be)}break;case 4:er(a,i),yr(i);break;case 13:er(a,i),yr(i),v=i.child,v.flags&8192&&(S=v.memoizedState!==null,v.stateNode.isHidden=S,!S||v.alternate!==null&&v.alternate.memoizedState!==null||(Ph=pt())),g&4&&Kv(i);break;case 22:if(J=d!==null&&d.memoizedState!==null,i.mode&1?(Gt=(V=Gt)||J,er(a,i),Gt=V):er(a,i),yr(i),g&8192){if(V=i.memoizedState!==null,(i.stateNode.isHidden=V)&&!J&&(i.mode&1)!==0)for(me=i,J=i.child;J!==null;){for(Q=me=J;me!==null;){switch(G=me,ce=G.child,G.tag){case 0:case 11:case 14:case 15:El(4,G,G.return);break;case 1:di(G,G.return);var ge=G.stateNode;if(typeof ge.componentWillUnmount=="function"){g=G,d=G.return;try{a=g,ge.props=a.memoizedProps,ge.state=a.memoizedState,ge.componentWillUnmount()}catch(be){ut(g,d,be)}}break;case 5:di(G,G.return);break;case 22:if(G.memoizedState!==null){Yv(Q);continue}}ce!==null?(ce.return=G,me=ce):Yv(Q)}J=J.sibling}e:for(J=null,Q=i;;){if(Q.tag===5){if(J===null){J=Q;try{v=Q.stateNode,V?(S=v.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none"):(A=Q.stateNode,O=Q.memoizedProps.style,E=O!=null&&O.hasOwnProperty("display")?O.display:null,A.style.display=Ty("display",E))}catch(be){ut(i,i.return,be)}}}else if(Q.tag===6){if(J===null)try{Q.stateNode.nodeValue=V?"":Q.memoizedProps}catch(be){ut(i,i.return,be)}}else if((Q.tag!==22&&Q.tag!==23||Q.memoizedState===null||Q===i)&&Q.child!==null){Q.child.return=Q,Q=Q.child;continue}if(Q===i)break e;for(;Q.sibling===null;){if(Q.return===null||Q.return===i)break e;J===Q&&(J=null),Q=Q.return}J===Q&&(J=null),Q.sibling.return=Q.return,Q=Q.sibling}}break;case 19:er(a,i),yr(i),g&4&&Kv(i);break;case 21:break;default:er(a,i),yr(i)}}function yr(i){var a=i.flags;if(a&2){try{e:{for(var d=i.return;d!==null;){if(Hv(d)){var g=d;break e}d=d.return}throw Error(n(160))}switch(g.tag){case 5:var v=g.stateNode;g.flags&32&&(qi(v,""),g.flags&=-33);var S=Wv(i);jh(i,S,v);break;case 3:case 4:var E=g.stateNode.containerInfo,A=Wv(i);Th(i,A,E);break;default:throw Error(n(161))}}catch(O){ut(i,i.return,O)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function K2(i,a,d){me=i,Gv(i)}function Gv(i,a,d){for(var g=(i.mode&1)!==0;me!==null;){var v=me,S=v.child;if(v.tag===22&&g){var E=v.memoizedState!==null||xc;if(!E){var A=v.alternate,O=A!==null&&A.memoizedState!==null||Gt;A=xc;var V=Gt;if(xc=E,(Gt=O)&&!V)for(me=v;me!==null;)E=me,O=E.child,E.tag===22&&E.memoizedState!==null?Qv(v):O!==null?(O.return=E,me=O):Qv(v);for(;S!==null;)me=S,Gv(S),S=S.sibling;me=v,xc=A,Gt=V}Jv(i)}else(v.subtreeFlags&8772)!==0&&S!==null?(S.return=v,me=S):Jv(i)}}function Jv(i){for(;me!==null;){var a=me;if((a.flags&8772)!==0){var d=a.alternate;try{if((a.flags&8772)!==0)switch(a.tag){case 0:case 11:case 15:Gt||vc(5,a);break;case 1:var g=a.stateNode;if(a.flags&4&&!Gt)if(d===null)g.componentDidMount();else{var v=a.elementType===a.type?d.memoizedProps:Xn(a.type,d.memoizedProps);g.componentDidUpdate(v,d.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var S=a.updateQueue;S!==null&&Yx(a,S,g);break;case 3:var E=a.updateQueue;if(E!==null){if(d=null,a.child!==null)switch(a.child.tag){case 5:d=a.child.stateNode;break;case 1:d=a.child.stateNode}Yx(a,E,d)}break;case 5:var A=a.stateNode;if(d===null&&a.flags&4){d=A;var O=a.memoizedProps;switch(a.type){case"button":case"input":case"select":case"textarea":O.autoFocus&&d.focus();break;case"img":O.src&&(d.src=O.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(a.memoizedState===null){var V=a.alternate;if(V!==null){var J=V.memoizedState;if(J!==null){var Q=J.dehydrated;Q!==null&&ol(Q)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Gt||a.flags&512&&Mh(a)}catch(G){ut(a,a.return,G)}}if(a===i){me=null;break}if(d=a.sibling,d!==null){d.return=a.return,me=d;break}me=a.return}}function Yv(i){for(;me!==null;){var a=me;if(a===i){me=null;break}var d=a.sibling;if(d!==null){d.return=a.return,me=d;break}me=a.return}}function Qv(i){for(;me!==null;){var a=me;try{switch(a.tag){case 0:case 11:case 15:var d=a.return;try{vc(4,a)}catch(O){ut(a,d,O)}break;case 1:var g=a.stateNode;if(typeof g.componentDidMount=="function"){var v=a.return;try{g.componentDidMount()}catch(O){ut(a,v,O)}}var S=a.return;try{Mh(a)}catch(O){ut(a,S,O)}break;case 5:var E=a.return;try{Mh(a)}catch(O){ut(a,E,O)}}}catch(O){ut(a,a.return,O)}if(a===i){me=null;break}var A=a.sibling;if(A!==null){A.return=a.return,me=A;break}me=a.return}}var q2=Math.ceil,wc=j.ReactCurrentDispatcher,Ah=j.ReactCurrentOwner,Ln=j.ReactCurrentBatchConfig,Ue=0,Rt=null,gt=null,Lt=0,Cn=0,fi=io(0),Nt=0,Ml=null,cs=0,bc=0,Rh=0,Tl=null,fn=null,Ph=0,hi=1/0,Lr=null,kc=!1,Oh=null,ho=null,Sc=!1,po=null,Cc=0,jl=0,Ih=null,Nc=-1,Ec=0;function tn(){return(Ue&6)!==0?pt():Nc!==-1?Nc:Nc=pt()}function mo(i){return(i.mode&1)===0?1:(Ue&2)!==0&&Lt!==0?Lt&-Lt:A2.transition!==null?(Ec===0&&(Ec=Wy()),Ec):(i=qe,i!==0||(i=window.event,i=i===void 0?16:Zy(i.type)),i)}function tr(i,a,d,g){if(50<jl)throw jl=0,Ih=null,Error(n(185));Zi(i,d,g),((Ue&2)===0||i!==Rt)&&(i===Rt&&((Ue&2)===0&&(bc|=d),Nt===4&&go(i,Lt)),hn(i,g),d===1&&Ue===0&&(a.mode&1)===0&&(hi=pt()+500,ec&&ao()))}function hn(i,a){var d=i.callbackNode;AT(i,a);var g=Da(i,i===Rt?Lt:0);if(g===0)d!==null&&By(d),i.callbackNode=null,i.callbackPriority=0;else if(a=g&-g,i.callbackPriority!==a){if(d!=null&&By(d),a===1)i.tag===0?j2(Zv.bind(null,i)):zx(Zv.bind(null,i)),N2(function(){(Ue&6)===0&&ao()}),d=null;else{switch(Uy(g)){case 1:d=hf;break;case 4:d=Vy;break;case 16:d=Ra;break;case 536870912:d=Hy;break;default:d=Ra}d=l0(d,Xv.bind(null,i))}i.callbackPriority=a,i.callbackNode=d}}function Xv(i,a){if(Nc=-1,Ec=0,(Ue&6)!==0)throw Error(n(327));var d=i.callbackNode;if(pi()&&i.callbackNode!==d)return null;var g=Da(i,i===Rt?Lt:0);if(g===0)return null;if((g&30)!==0||(g&i.expiredLanes)!==0||a)a=Mc(i,g);else{a=g;var v=Ue;Ue|=2;var S=t0();(Rt!==i||Lt!==a)&&(Lr=null,hi=pt()+500,ds(i,a));do try{Y2();break}catch(A){e0(i,A)}while(!0);Xf(),wc.current=S,Ue=v,gt!==null?a=0:(Rt=null,Lt=0,a=Nt)}if(a!==0){if(a===2&&(v=pf(i),v!==0&&(g=v,a=Dh(i,v))),a===1)throw d=Ml,ds(i,0),go(i,g),hn(i,pt()),d;if(a===6)go(i,g);else{if(v=i.current.alternate,(g&30)===0&&!G2(v)&&(a=Mc(i,g),a===2&&(S=pf(i),S!==0&&(g=S,a=Dh(i,S))),a===1))throw d=Ml,ds(i,0),go(i,g),hn(i,pt()),d;switch(i.finishedWork=v,i.finishedLanes=g,a){case 0:case 1:throw Error(n(345));case 2:fs(i,fn,Lr);break;case 3:if(go(i,g),(g&130023424)===g&&(a=Ph+500-pt(),10<a)){if(Da(i,0)!==0)break;if(v=i.suspendedLanes,(v&g)!==g){tn(),i.pingedLanes|=i.suspendedLanes&v;break}i.timeoutHandle=Bf(fs.bind(null,i,fn,Lr),a);break}fs(i,fn,Lr);break;case 4:if(go(i,g),(g&4194240)===g)break;for(a=i.eventTimes,v=-1;0<g;){var E=31-Jn(g);S=1<<E,E=a[E],E>v&&(v=E),g&=~S}if(g=v,g=pt()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*q2(g/1960))-g,10<g){i.timeoutHandle=Bf(fs.bind(null,i,fn,Lr),g);break}fs(i,fn,Lr);break;case 5:fs(i,fn,Lr);break;default:throw Error(n(329))}}}return hn(i,pt()),i.callbackNode===d?Xv.bind(null,i):null}function Dh(i,a){var d=Tl;return i.current.memoizedState.isDehydrated&&(ds(i,a).flags|=256),i=Mc(i,a),i!==2&&(a=fn,fn=d,a!==null&&_h(a)),i}function _h(i){fn===null?fn=i:fn.push.apply(fn,i)}function G2(i){for(var a=i;;){if(a.flags&16384){var d=a.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var g=0;g<d.length;g++){var v=d[g],S=v.getSnapshot;v=v.value;try{if(!Yn(S(),v))return!1}catch{return!1}}}if(d=a.child,a.subtreeFlags&16384&&d!==null)d.return=a,a=d;else{if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function go(i,a){for(a&=~Rh,a&=~bc,i.suspendedLanes|=a,i.pingedLanes&=~a,i=i.expirationTimes;0<a;){var d=31-Jn(a),g=1<<d;i[d]=-1,a&=~g}}function Zv(i){if((Ue&6)!==0)throw Error(n(327));pi();var a=Da(i,0);if((a&1)===0)return hn(i,pt()),null;var d=Mc(i,a);if(i.tag!==0&&d===2){var g=pf(i);g!==0&&(a=g,d=Dh(i,g))}if(d===1)throw d=Ml,ds(i,0),go(i,a),hn(i,pt()),d;if(d===6)throw Error(n(345));return i.finishedWork=i.current.alternate,i.finishedLanes=a,fs(i,fn,Lr),hn(i,pt()),null}function Lh(i,a){var d=Ue;Ue|=1;try{return i(a)}finally{Ue=d,Ue===0&&(hi=pt()+500,ec&&ao())}}function us(i){po!==null&&po.tag===0&&(Ue&6)===0&&pi();var a=Ue;Ue|=1;var d=Ln.transition,g=qe;try{if(Ln.transition=null,qe=1,i)return i()}finally{qe=g,Ln.transition=d,Ue=a,(Ue&6)===0&&ao()}}function zh(){Cn=fi.current,tt(fi)}function ds(i,a){i.finishedWork=null,i.finishedLanes=0;var d=i.timeoutHandle;if(d!==-1&&(i.timeoutHandle=-1,C2(d)),gt!==null)for(d=gt.return;d!==null;){var g=d;switch(qf(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&Xa();break;case 3:ci(),tt(cn),tt(Ut),ih();break;case 5:oh(g);break;case 4:ci();break;case 13:tt(at);break;case 19:tt(at);break;case 10:Zf(g.type._context);break;case 22:case 23:zh()}d=d.return}if(Rt=i,gt=i=yo(i.current,null),Lt=Cn=a,Nt=0,Ml=null,Rh=bc=cs=0,fn=Tl=null,is!==null){for(a=0;a<is.length;a++)if(d=is[a],g=d.interleaved,g!==null){d.interleaved=null;var v=g.next,S=d.pending;if(S!==null){var E=S.next;S.next=v,g.next=E}d.pending=g}is=null}return i}function e0(i,a){do{var d=gt;try{if(Xf(),uc.current=pc,dc){for(var g=ct.memoizedState;g!==null;){var v=g.queue;v!==null&&(v.pending=null),g=g.next}dc=!1}if(as=0,At=Ct=ct=null,bl=!1,kl=0,Ah.current=null,d===null||d.return===null){Nt=1,Ml=a,gt=null;break}e:{var S=i,E=d.return,A=d,O=a;if(a=Lt,A.flags|=32768,O!==null&&typeof O=="object"&&typeof O.then=="function"){var V=O,J=A,Q=J.tag;if((J.mode&1)===0&&(Q===0||Q===11||Q===15)){var G=J.alternate;G?(J.updateQueue=G.updateQueue,J.memoizedState=G.memoizedState,J.lanes=G.lanes):(J.updateQueue=null,J.memoizedState=null)}var ce=Nv(E);if(ce!==null){ce.flags&=-257,Ev(ce,E,A,S,a),ce.mode&1&&Cv(S,V,a),a=ce,O=V;var ge=a.updateQueue;if(ge===null){var be=new Set;be.add(O),a.updateQueue=be}else ge.add(O);break e}else{if((a&1)===0){Cv(S,V,a),$h();break e}O=Error(n(426))}}else if(st&&A.mode&1){var mt=Nv(E);if(mt!==null){(mt.flags&65536)===0&&(mt.flags|=256),Ev(mt,E,A,S,a),Yf(ui(O,A));break e}}S=O=ui(O,A),Nt!==4&&(Nt=2),Tl===null?Tl=[S]:Tl.push(S),S=E;do{switch(S.tag){case 3:S.flags|=65536,a&=-a,S.lanes|=a;var z=kv(S,O,a);Jx(S,z);break e;case 1:A=O;var D=S.type,F=S.stateNode;if((S.flags&128)===0&&(typeof D.getDerivedStateFromError=="function"||F!==null&&typeof F.componentDidCatch=="function"&&(ho===null||!ho.has(F)))){S.flags|=65536,a&=-a,S.lanes|=a;var te=Sv(S,A,a);Jx(S,te);break e}}S=S.return}while(S!==null)}r0(d)}catch(Ce){a=Ce,gt===d&&d!==null&&(gt=d=d.return);continue}break}while(!0)}function t0(){var i=wc.current;return wc.current=pc,i===null?pc:i}function $h(){(Nt===0||Nt===3||Nt===2)&&(Nt=4),Rt===null||(cs&268435455)===0&&(bc&268435455)===0||go(Rt,Lt)}function Mc(i,a){var d=Ue;Ue|=2;var g=t0();(Rt!==i||Lt!==a)&&(Lr=null,ds(i,a));do try{J2();break}catch(v){e0(i,v)}while(!0);if(Xf(),Ue=d,wc.current=g,gt!==null)throw Error(n(261));return Rt=null,Lt=0,Nt}function J2(){for(;gt!==null;)n0(gt)}function Y2(){for(;gt!==null&&!bT();)n0(gt)}function n0(i){var a=i0(i.alternate,i,Cn);i.memoizedProps=i.pendingProps,a===null?r0(i):gt=a,Ah.current=null}function r0(i){var a=i;do{var d=a.alternate;if(i=a.return,(a.flags&32768)===0){if(d=V2(d,a,Cn),d!==null){gt=d;return}}else{if(d=H2(d,a),d!==null){d.flags&=32767,gt=d;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{Nt=6,gt=null;return}}if(a=a.sibling,a!==null){gt=a;return}gt=a=i}while(a!==null);Nt===0&&(Nt=5)}function fs(i,a,d){var g=qe,v=Ln.transition;try{Ln.transition=null,qe=1,Q2(i,a,d,g)}finally{Ln.transition=v,qe=g}return null}function Q2(i,a,d,g){do pi();while(po!==null);if((Ue&6)!==0)throw Error(n(327));d=i.finishedWork;var v=i.finishedLanes;if(d===null)return null;if(i.finishedWork=null,i.finishedLanes=0,d===i.current)throw Error(n(177));i.callbackNode=null,i.callbackPriority=0;var S=d.lanes|d.childLanes;if(RT(i,S),i===Rt&&(gt=Rt=null,Lt=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Sc||(Sc=!0,l0(Ra,function(){return pi(),null})),S=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||S){S=Ln.transition,Ln.transition=null;var E=qe;qe=1;var A=Ue;Ue|=4,Ah.current=null,U2(i,d),qv(d,i),y2($f),za=!!zf,$f=zf=null,i.current=d,K2(d),kT(),Ue=A,qe=E,Ln.transition=S}else i.current=d;if(Sc&&(Sc=!1,po=i,Cc=v),S=i.pendingLanes,S===0&&(ho=null),NT(d.stateNode),hn(i,pt()),a!==null)for(g=i.onRecoverableError,d=0;d<a.length;d++)v=a[d],g(v.value,{componentStack:v.stack,digest:v.digest});if(kc)throw kc=!1,i=Oh,Oh=null,i;return(Cc&1)!==0&&i.tag!==0&&pi(),S=i.pendingLanes,(S&1)!==0?i===Ih?jl++:(jl=0,Ih=i):jl=0,ao(),null}function pi(){if(po!==null){var i=Uy(Cc),a=Ln.transition,d=qe;try{if(Ln.transition=null,qe=16>i?16:i,po===null)var g=!1;else{if(i=po,po=null,Cc=0,(Ue&6)!==0)throw Error(n(331));var v=Ue;for(Ue|=4,me=i.current;me!==null;){var S=me,E=S.child;if((me.flags&16)!==0){var A=S.deletions;if(A!==null){for(var O=0;O<A.length;O++){var V=A[O];for(me=V;me!==null;){var J=me;switch(J.tag){case 0:case 11:case 15:El(8,J,S)}var Q=J.child;if(Q!==null)Q.return=J,me=Q;else for(;me!==null;){J=me;var G=J.sibling,ce=J.return;if(Vv(J),J===V){me=null;break}if(G!==null){G.return=ce,me=G;break}me=ce}}}var ge=S.alternate;if(ge!==null){var be=ge.child;if(be!==null){ge.child=null;do{var mt=be.sibling;be.sibling=null,be=mt}while(be!==null)}}me=S}}if((S.subtreeFlags&2064)!==0&&E!==null)E.return=S,me=E;else e:for(;me!==null;){if(S=me,(S.flags&2048)!==0)switch(S.tag){case 0:case 11:case 15:El(9,S,S.return)}var z=S.sibling;if(z!==null){z.return=S.return,me=z;break e}me=S.return}}var D=i.current;for(me=D;me!==null;){E=me;var F=E.child;if((E.subtreeFlags&2064)!==0&&F!==null)F.return=E,me=F;else e:for(E=D;me!==null;){if(A=me,(A.flags&2048)!==0)try{switch(A.tag){case 0:case 11:case 15:vc(9,A)}}catch(Ce){ut(A,A.return,Ce)}if(A===E){me=null;break e}var te=A.sibling;if(te!==null){te.return=A.return,me=te;break e}me=A.return}}if(Ue=v,ao(),hr&&typeof hr.onPostCommitFiberRoot=="function")try{hr.onPostCommitFiberRoot(Pa,i)}catch{}g=!0}return g}finally{qe=d,Ln.transition=a}}return!1}function o0(i,a,d){a=ui(d,a),a=kv(i,a,1),i=uo(i,a,1),a=tn(),i!==null&&(Zi(i,1,a),hn(i,a))}function ut(i,a,d){if(i.tag===3)o0(i,i,d);else for(;a!==null;){if(a.tag===3){o0(a,i,d);break}else if(a.tag===1){var g=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(ho===null||!ho.has(g))){i=ui(d,i),i=Sv(a,i,1),a=uo(a,i,1),i=tn(),a!==null&&(Zi(a,1,i),hn(a,i));break}}a=a.return}}function X2(i,a,d){var g=i.pingCache;g!==null&&g.delete(a),a=tn(),i.pingedLanes|=i.suspendedLanes&d,Rt===i&&(Lt&d)===d&&(Nt===4||Nt===3&&(Lt&130023424)===Lt&&500>pt()-Ph?ds(i,0):Rh|=d),hn(i,a)}function s0(i,a){a===0&&((i.mode&1)===0?a=1:(a=Ia,Ia<<=1,(Ia&130023424)===0&&(Ia=4194304)));var d=tn();i=Ir(i,a),i!==null&&(Zi(i,a,d),hn(i,d))}function Z2(i){var a=i.memoizedState,d=0;a!==null&&(d=a.retryLane),s0(i,d)}function ej(i,a){var d=0;switch(i.tag){case 13:var g=i.stateNode,v=i.memoizedState;v!==null&&(d=v.retryLane);break;case 19:g=i.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(a),s0(i,d)}var i0;i0=function(i,a,d){if(i!==null)if(i.memoizedProps!==a.pendingProps||cn.current)dn=!0;else{if((i.lanes&d)===0&&(a.flags&128)===0)return dn=!1,B2(i,a,d);dn=(i.flags&131072)!==0}else dn=!1,st&&(a.flags&1048576)!==0&&$x(a,nc,a.index);switch(a.lanes=0,a.tag){case 2:var g=a.type;yc(i,a),i=a.pendingProps;var v=ni(a,Ut.current);ai(a,d),v=ch(null,a,g,i,v,d);var S=uh();return a.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,un(g)?(S=!0,Za(a)):S=!1,a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,nh(a),v.updater=mc,a.stateNode=v,v._reactInternals=a,gh(a,g,i,d),a=wh(null,a,g,!0,S,d)):(a.tag=0,st&&S&&Kf(a),en(null,a,v,d),a=a.child),a;case 16:g=a.elementType;e:{switch(yc(i,a),i=a.pendingProps,v=g._init,g=v(g._payload),a.type=g,v=a.tag=nj(g),i=Xn(g,i),v){case 0:a=vh(null,a,g,i,d);break e;case 1:a=Pv(null,a,g,i,d);break e;case 11:a=Mv(null,a,g,i,d);break e;case 14:a=Tv(null,a,g,Xn(g.type,i),d);break e}throw Error(n(306,g,""))}return a;case 0:return g=a.type,v=a.pendingProps,v=a.elementType===g?v:Xn(g,v),vh(i,a,g,v,d);case 1:return g=a.type,v=a.pendingProps,v=a.elementType===g?v:Xn(g,v),Pv(i,a,g,v,d);case 3:e:{if(Ov(a),i===null)throw Error(n(387));g=a.pendingProps,S=a.memoizedState,v=S.element,Gx(i,a),ac(a,g,null,d);var E=a.memoizedState;if(g=E.element,S.isDehydrated)if(S={element:g,isDehydrated:!1,cache:E.cache,pendingSuspenseBoundaries:E.pendingSuspenseBoundaries,transitions:E.transitions},a.updateQueue.baseState=S,a.memoizedState=S,a.flags&256){v=ui(Error(n(423)),a),a=Iv(i,a,g,d,v);break e}else if(g!==v){v=ui(Error(n(424)),a),a=Iv(i,a,g,d,v);break e}else for(Sn=so(a.stateNode.containerInfo.firstChild),kn=a,st=!0,Qn=null,d=Kx(a,null,g,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(si(),g===v){a=_r(i,a,d);break e}en(i,a,g,d)}a=a.child}return a;case 5:return Qx(a),i===null&&Jf(a),g=a.type,v=a.pendingProps,S=i!==null?i.memoizedProps:null,E=v.children,Ff(g,v)?E=null:S!==null&&Ff(g,S)&&(a.flags|=32),Rv(i,a),en(i,a,E,d),a.child;case 6:return i===null&&Jf(a),null;case 13:return Dv(i,a,d);case 4:return rh(a,a.stateNode.containerInfo),g=a.pendingProps,i===null?a.child=ii(a,null,g,d):en(i,a,g,d),a.child;case 11:return g=a.type,v=a.pendingProps,v=a.elementType===g?v:Xn(g,v),Mv(i,a,g,v,d);case 7:return en(i,a,a.pendingProps,d),a.child;case 8:return en(i,a,a.pendingProps.children,d),a.child;case 12:return en(i,a,a.pendingProps.children,d),a.child;case 10:e:{if(g=a.type._context,v=a.pendingProps,S=a.memoizedProps,E=v.value,Qe(sc,g._currentValue),g._currentValue=E,S!==null)if(Yn(S.value,E)){if(S.children===v.children&&!cn.current){a=_r(i,a,d);break e}}else for(S=a.child,S!==null&&(S.return=a);S!==null;){var A=S.dependencies;if(A!==null){E=S.child;for(var O=A.firstContext;O!==null;){if(O.context===g){if(S.tag===1){O=Dr(-1,d&-d),O.tag=2;var V=S.updateQueue;if(V!==null){V=V.shared;var J=V.pending;J===null?O.next=O:(O.next=J.next,J.next=O),V.pending=O}}S.lanes|=d,O=S.alternate,O!==null&&(O.lanes|=d),eh(S.return,d,a),A.lanes|=d;break}O=O.next}}else if(S.tag===10)E=S.type===a.type?null:S.child;else if(S.tag===18){if(E=S.return,E===null)throw Error(n(341));E.lanes|=d,A=E.alternate,A!==null&&(A.lanes|=d),eh(E,d,a),E=S.sibling}else E=S.child;if(E!==null)E.return=S;else for(E=S;E!==null;){if(E===a){E=null;break}if(S=E.sibling,S!==null){S.return=E.return,E=S;break}E=E.return}S=E}en(i,a,v.children,d),a=a.child}return a;case 9:return v=a.type,g=a.pendingProps.children,ai(a,d),v=Dn(v),g=g(v),a.flags|=1,en(i,a,g,d),a.child;case 14:return g=a.type,v=Xn(g,a.pendingProps),v=Xn(g.type,v),Tv(i,a,g,v,d);case 15:return jv(i,a,a.type,a.pendingProps,d);case 17:return g=a.type,v=a.pendingProps,v=a.elementType===g?v:Xn(g,v),yc(i,a),a.tag=1,un(g)?(i=!0,Za(a)):i=!1,ai(a,d),wv(a,g,v),gh(a,g,v,d),wh(null,a,g,!0,i,d);case 19:return Lv(i,a,d);case 22:return Av(i,a,d)}throw Error(n(156,a.tag))};function l0(i,a){return Fy(i,a)}function tj(i,a,d,g){this.tag=i,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zn(i,a,d,g){return new tj(i,a,d,g)}function Fh(i){return i=i.prototype,!(!i||!i.isReactComponent)}function nj(i){if(typeof i=="function")return Fh(i)?1:0;if(i!=null){if(i=i.$$typeof,i===ee)return 11;if(i===ne)return 14}return 2}function yo(i,a){var d=i.alternate;return d===null?(d=zn(i.tag,a,i.key,i.mode),d.elementType=i.elementType,d.type=i.type,d.stateNode=i.stateNode,d.alternate=i,i.alternate=d):(d.pendingProps=a,d.type=i.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=i.flags&14680064,d.childLanes=i.childLanes,d.lanes=i.lanes,d.child=i.child,d.memoizedProps=i.memoizedProps,d.memoizedState=i.memoizedState,d.updateQueue=i.updateQueue,a=i.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=i.sibling,d.index=i.index,d.ref=i.ref,d}function Tc(i,a,d,g,v,S){var E=2;if(g=i,typeof i=="function")Fh(i)&&(E=1);else if(typeof i=="string")E=5;else e:switch(i){case I:return hs(d.children,v,S,a);case _:E=8,v|=8;break;case $:return i=zn(12,d,a,v|2),i.elementType=$,i.lanes=S,i;case K:return i=zn(13,d,a,v),i.elementType=K,i.lanes=S,i;case ie:return i=zn(19,d,a,v),i.elementType=ie,i.lanes=S,i;case ae:return jc(d,v,S,a);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case q:E=10;break e;case X:E=9;break e;case ee:E=11;break e;case ne:E=14;break e;case re:E=16,g=null;break e}throw Error(n(130,i==null?i:typeof i,""))}return a=zn(E,d,a,v),a.elementType=i,a.type=g,a.lanes=S,a}function hs(i,a,d,g){return i=zn(7,i,g,a),i.lanes=d,i}function jc(i,a,d,g){return i=zn(22,i,g,a),i.elementType=ae,i.lanes=d,i.stateNode={isHidden:!1},i}function Bh(i,a,d){return i=zn(6,i,null,a),i.lanes=d,i}function Vh(i,a,d){return a=zn(4,i.children!==null?i.children:[],i.key,a),a.lanes=d,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}function rj(i,a,d,g,v){this.tag=a,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=mf(0),this.expirationTimes=mf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mf(0),this.identifierPrefix=g,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Hh(i,a,d,g,v,S,E,A,O){return i=new rj(i,a,d,A,O),a===1?(a=1,S===!0&&(a|=8)):a=0,S=zn(3,null,null,a),i.current=S,S.stateNode=i,S.memoizedState={element:g,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},nh(S),i}function oj(i,a,d){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:L,key:g==null?null:""+g,children:i,containerInfo:a,implementation:d}}function a0(i){if(!i)return lo;i=i._reactInternals;e:{if(es(i)!==i||i.tag!==1)throw Error(n(170));var a=i;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(un(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(n(171))}if(i.tag===1){var d=i.type;if(un(d))return _x(i,d,a)}return a}function c0(i,a,d,g,v,S,E,A,O){return i=Hh(d,g,!0,i,v,S,E,A,O),i.context=a0(null),d=i.current,g=tn(),v=mo(d),S=Dr(g,v),S.callback=a??null,uo(d,S,v),i.current.lanes=v,Zi(i,v,g),hn(i,g),i}function Ac(i,a,d,g){var v=a.current,S=tn(),E=mo(v);return d=a0(d),a.context===null?a.context=d:a.pendingContext=d,a=Dr(S,E),a.payload={element:i},g=g===void 0?null:g,g!==null&&(a.callback=g),i=uo(v,a,E),i!==null&&(tr(i,v,E,S),lc(i,v,E)),E}function Rc(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return i.child.stateNode;default:return i.child.stateNode}}function u0(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var d=i.retryLane;i.retryLane=d!==0&&d<a?d:a}}function Wh(i,a){u0(i,a),(i=i.alternate)&&u0(i,a)}function sj(){return null}var d0=typeof reportError=="function"?reportError:function(i){console.error(i)};function Uh(i){this._internalRoot=i}Pc.prototype.render=Uh.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(n(409));Ac(i,a,null,null)},Pc.prototype.unmount=Uh.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;us(function(){Ac(null,i,null,null)}),a[Ar]=null}};function Pc(i){this._internalRoot=i}Pc.prototype.unstable_scheduleHydration=function(i){if(i){var a=Gy();i={blockedOn:null,target:i,priority:a};for(var d=0;d<no.length&&a!==0&&a<no[d].priority;d++);no.splice(d,0,i),d===0&&Qy(i)}};function Kh(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function Oc(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function f0(){}function ij(i,a,d,g,v){if(v){if(typeof g=="function"){var S=g;g=function(){var V=Rc(E);S.call(V)}}var E=c0(a,g,i,0,null,!1,!1,"",f0);return i._reactRootContainer=E,i[Ar]=E.current,hl(i.nodeType===8?i.parentNode:i),us(),E}for(;v=i.lastChild;)i.removeChild(v);if(typeof g=="function"){var A=g;g=function(){var V=Rc(O);A.call(V)}}var O=Hh(i,0,!1,null,null,!1,!1,"",f0);return i._reactRootContainer=O,i[Ar]=O.current,hl(i.nodeType===8?i.parentNode:i),us(function(){Ac(a,O,d,g)}),O}function Ic(i,a,d,g,v){var S=d._reactRootContainer;if(S){var E=S;if(typeof v=="function"){var A=v;v=function(){var O=Rc(E);A.call(O)}}Ac(a,E,i,v)}else E=ij(d,a,i,v,g);return Rc(E)}Ky=function(i){switch(i.tag){case 3:var a=i.stateNode;if(a.current.memoizedState.isDehydrated){var d=Xi(a.pendingLanes);d!==0&&(gf(a,d|1),hn(a,pt()),(Ue&6)===0&&(hi=pt()+500,ao()))}break;case 13:us(function(){var g=Ir(i,1);if(g!==null){var v=tn();tr(g,i,1,v)}}),Wh(i,1)}},yf=function(i){if(i.tag===13){var a=Ir(i,134217728);if(a!==null){var d=tn();tr(a,i,134217728,d)}Wh(i,134217728)}},qy=function(i){if(i.tag===13){var a=mo(i),d=Ir(i,a);if(d!==null){var g=tn();tr(d,i,a,g)}Wh(i,a)}},Gy=function(){return qe},Jy=function(i,a){var d=qe;try{return qe=i,a()}finally{qe=d}},cf=function(i,a,d){switch(a){case"input":if(ot(i,d),a=d.name,d.type==="radio"&&a!=null){for(d=i;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+a)+'][type="radio"]'),a=0;a<d.length;a++){var g=d[a];if(g!==i&&g.form===i.form){var v=Qa(g);if(!v)throw Error(n(90));_e(g),ot(g,v)}}}break;case"textarea":Cy(i,d);break;case"select":a=d.value,a!=null&&Be(i,!!d.multiple,a,!1)}},Oy=Lh,Iy=us;var lj={usingClientEntryPoint:!1,Events:[gl,ei,Qa,Ry,Py,Lh]},Al={findFiberByHostInstance:ts,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},aj={bundleType:Al.bundleType,version:Al.version,rendererPackageName:Al.rendererPackageName,rendererConfig:Al.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:j.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=zy(i),i===null?null:i.stateNode},findFiberByHostInstance:Al.findFiberByHostInstance||sj,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Dc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Dc.isDisabled&&Dc.supportsFiber)try{Pa=Dc.inject(aj),hr=Dc}catch{}}return pn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lj,pn.createPortal=function(i,a){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Kh(a))throw Error(n(200));return oj(i,a,null,d)},pn.createRoot=function(i,a){if(!Kh(i))throw Error(n(299));var d=!1,g="",v=d0;return a!=null&&(a.unstable_strictMode===!0&&(d=!0),a.identifierPrefix!==void 0&&(g=a.identifierPrefix),a.onRecoverableError!==void 0&&(v=a.onRecoverableError)),a=Hh(i,1,!1,null,null,d,!1,g,v),i[Ar]=a.current,hl(i.nodeType===8?i.parentNode:i),new Uh(a)},pn.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(n(188)):(i=Object.keys(i).join(","),Error(n(268,i)));return i=zy(a),i=i===null?null:i.stateNode,i},pn.flushSync=function(i){return us(i)},pn.hydrate=function(i,a,d){if(!Oc(a))throw Error(n(200));return Ic(null,i,a,!0,d)},pn.hydrateRoot=function(i,a,d){if(!Kh(i))throw Error(n(405));var g=d!=null&&d.hydratedSources||null,v=!1,S="",E=d0;if(d!=null&&(d.unstable_strictMode===!0&&(v=!0),d.identifierPrefix!==void 0&&(S=d.identifierPrefix),d.onRecoverableError!==void 0&&(E=d.onRecoverableError)),a=c0(a,null,i,1,d??null,v,!1,S,E),i[Ar]=a.current,hl(i),g)for(i=0;i<g.length;i++)d=g[i],v=d._getVersion,v=v(d._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[d,v]:a.mutableSourceEagerHydrationData.push(d,v);return new Pc(a)},pn.render=function(i,a,d){if(!Oc(a))throw Error(n(200));return Ic(null,i,a,!1,d)},pn.unmountComponentAtNode=function(i){if(!Oc(i))throw Error(n(40));return i._reactRootContainer?(us(function(){Ic(null,null,i,!1,function(){i._reactRootContainer=null,i[Ar]=null})}),!0):!1},pn.unstable_batchedUpdates=Lh,pn.unstable_renderSubtreeIntoContainer=function(i,a,d,g){if(!Oc(d))throw Error(n(200));if(i==null||i._reactInternals===void 0)throw Error(n(38));return Ic(i,a,d,!1,g)},pn.version="18.3.1-next-f1338f8080-20240426",pn}var w0;function W1(){if(w0)return Jh.exports;w0=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Jh.exports=gj(),Jh.exports}var b0;function yj(){if(b0)return _c;b0=1;var t=W1();return _c.createRoot=t.createRoot,_c.hydrateRoot=t.hydrateRoot,_c}var xj=yj();const vj=Wm(xj),wj="",bj="cnst_token";function U1(){try{localStorage.removeItem(bj)}catch{}}async function He(t,e={}){const n={"Content-Type":"application/json",...e.headers},r=await fetch(`${wj}${t}`,{...e,headers:n,credentials:"include"}),o=await r.text(),s=o?JSON.parse(o):{};if(!r.ok)throw r.status===401&&(U1(),typeof window<"u"&&window.dispatchEvent(new Event("auth:unauthorized"))),new Error(s.error||`Request failed: ${r.status}`);return s}async function K1(t,e){return He("/auth/login",{method:"POST",body:JSON.stringify({email:t,password:e})})}async function kj(t,e,n){return He("/auth/register",{method:"POST",body:JSON.stringify({email:t,password:e,name:n})})}async function Sj(){return He("/auth/logout",{method:"POST"})}async function q1(){return He("/auth/device",{method:"POST",body:JSON.stringify({})})}async function G1(t,e){return He(`/auth/device/poll?code=${encodeURIComponent(t)}&client_secret=${encodeURIComponent(e)}`)}async function J1(t){return He("/auth/promptowl",{method:"POST",body:JSON.stringify({token:t})})}async function Cj(){return He("/health")}async function Nj(){return He("/license/status")}async function Ej(t){return He("/license/install",{method:"POST",body:JSON.stringify({key:t})})}async function Xh(){return He("/auth/admin-status")}async function Mj(){return He("/auth/teammates")}async function Tj(t,e){return He("/auth/invite",{method:"POST",body:JSON.stringify({email:t,label:e})})}async function jj(){return He("/auth/keys")}async function Aj(t){return He("/auth/keys",{method:"POST",body:JSON.stringify(t||{})})}async function Rj(t){return He("/auth/keys/rotate",{method:"POST",body:JSON.stringify(t||{})})}async function Y1(t){return He(`/nests/${t}/settings`)}async function Pj(t,e){return He(`/nests/${t}/settings`,{method:"PATCH",body:JSON.stringify(e)})}async function Q1(){return He("/nests")}async function Oj(t,e){return He("/nests",{method:"POST",body:JSON.stringify({name:t,description:e})})}async function Km(t){return He(`/nests/${t}/nodes`)}async function Ij(t,e){return He(`/nests/${t}/nodes/${e}`)}async function Dj(t,e){return He(`/nests/${t}/nodes`,{method:"POST",body:JSON.stringify(e)})}async function _j(t,e,n,r){const o={};return r!==void 0&&(o["X-Base-Version"]=String(r)),He(`/nests/${t}/nodes/${e}`,{method:"PATCH",headers:o,body:JSON.stringify(n)})}async function Lj(t,e){return He(`/nests/${t}/nodes/${e}`,{method:"DELETE"})}async function qm(t,e){return He(`/nests/${t}/search?q=${encodeURIComponent(e)}`)}async function zj(t){return He(`/nests/${t}/stewards`)}async function $j(t){return He(`/nests/${t}/stewards/sync`,{method:"POST",body:"{}"})}async function Fj(t,e){return He(`/nests/${t}/stewards`,{method:"POST",body:JSON.stringify(e)})}async function Bj(t,e){return He(`/nests/${t}/stewards/${e}`,{method:"DELETE"})}async function Vj(t,e){return He(`/nests/${t}/nodes/${e}/stewards`)}async function Hj(t,e="pending"){return He(`/nests/${t}/review-queue?status=${encodeURIComponent(e)}`)}async function X1(t,e,n,r){return He(`/nests/${t}/nodes/${e}/submit-review`,{method:"POST",body:JSON.stringify({note:n,priority:r})})}async function Z1(t,e,n){return He(`/nests/${t}/nodes/${e}/approve`,{method:"POST",body:JSON.stringify({note:n})})}async function eb(t,e,n){return He(`/nests/${t}/nodes/${e}/reject`,{method:"POST",body:JSON.stringify({note:n})})}async function Wj(t,e){return He(`/nests/${t}/nodes/${e}/versions`)}const tb=w.createContext(null);function Uj({children:t}){var N;const[e,n]=w.useState(null),[r,o]=w.useState(null),[s,l]=w.useState(!1),[c,u]=w.useState(!0),[h,p]=w.useState(null),m=w.useRef(0),y=w.useCallback((M,T)=>M==="open"?!0:!!T,[]),x=w.useCallback(async()=>{const M=++m.current;try{const T=await Xh();if(m.current!==M)return;o(T),l(e==="open"?!0:!!T.me)}catch{}},[e]);w.useEffect(()=>{U1();let M=!1;return(async()=>{try{const T=await Cj();if(M)return;const j=T.auth_mode;n(j);const P=await Xh();if(M)return;o(P),l(y(j,P.me))}catch{M||p("Cannot connect to server")}finally{M||u(!1)}})(),()=>{M=!0}},[y]),w.useEffect(()=>{const M=()=>{++m.current,l(e==="open"),o(T=>T&&{...T,me:null})};return window.addEventListener("auth:unauthorized",M),()=>window.removeEventListener("auth:unauthorized",M)},[e]);const b=w.useCallback(M=>{const T=++m.current;if(M){const j=M.name??null;o(P=>({claimed:(P==null?void 0:P.claimed)??!0,admin:(P==null?void 0:P.admin)??{email:M.email,name:j},me:{email:M.email,name:j,is_admin:M.is_admin}})),l(!0)}(async()=>{try{const j=await Xh();m.current===T&&(o(j),l(y(e,j.me)))}catch{}})()},[e,y]),k=w.useCallback(async()=>{++m.current;try{await Sj()}catch{}l(e==="open"),o(M=>M&&{...M,me:null})},[e]),C=!!((N=r==null?void 0:r.me)!=null&&N.is_admin);return f.jsx(tb.Provider,{value:{authMode:e,adminStatus:r,authenticated:s,isAdmin:C,loading:c,error:h,refresh:x,loginSuccess:b,logout:k},children:t})}function Vi(){const t=w.useContext(tb);if(!t)throw new Error("useAuth must be used inside <AuthProvider>");return t}function Kj(){const{loginSuccess:t}=Vi(),[e,n]=w.useState("login"),[r,o]=w.useState(""),[s,l]=w.useState(""),[c,u]=w.useState(""),[h,p]=w.useState(null),[m,y]=w.useState(!1),[x,b]=w.useState(null),[k,C]=w.useState(null),[N,M]=w.useState(!1),T=async()=>{k&&(await navigator.clipboard.writeText(k),M(!0),setTimeout(()=>M(!1),1500))},j=async L=>{L.preventDefault(),p(null),y(!0);try{const I=e==="register"?await kj(r,s,c):await K1(r,s);t(I.user?{email:I.user.email,name:I.user.name,is_admin:!!I.user.is_admin}:void 0)}catch(I){p(I.message)}finally{y(!1)}},P=async()=>{p(null),y(!0);try{const L=await q1();b(L.verificationUrl),C(L.deviceCode),window.open(L.verificationUrl,"_blank","noopener,noreferrer");for(let I=0;I<180;I++){await new Promise($=>setTimeout($,2e3));const _=await G1(L.deviceCode,L.clientSecret);if(_.status==="approved"&&_.token){const $=await J1(_.token);t($.user?{email:$.user.email,name:$.user.name,is_admin:!!$.user.is_admin}:void 0);return}if(_.status==="expired"){p("Login expired. Try again."),b(null),C(null),y(!1);return}}}catch(L){p(L.message),b(null),C(null),y(!1)}};return f.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:f.jsxs("div",{className:"w-full max-w-sm space-y-6 p-6",children:[f.jsxs("div",{className:"text-center",children:[f.jsx("span",{className:"text-4xl",children:"🪺"}),f.jsx("h1",{className:"text-xl font-semibold mt-2",children:"ContextNest"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Community Server"})]}),f.jsx("button",{onClick:P,disabled:m,className:"w-full flex items-center justify-center gap-2 py-2.5 px-4 rounded-lg border border-border bg-card hover:bg-secondary text-sm font-medium transition-colors",children:m&&x?"Waiting for approval...":"Login with PromptOwl"}),x&&f.jsxs("div",{className:"rounded-md border bg-muted/40 p-3 space-y-2",children:[f.jsxs("p",{className:"text-xs text-muted-foreground",children:["A new tab opened at"," ",f.jsx("a",{href:x,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"PromptOwl"}),". If it asks for a verification code, use this:"]}),k&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("code",{className:"flex-1 bg-background border rounded px-2 py-1.5 text-xs font-mono break-all",children:k}),f.jsx("button",{type:"button",onClick:T,className:"px-2 py-1.5 rounded border text-xs hover:bg-secondary",children:N?"Copied":"Copy"})]})]}),f.jsxs("div",{className:"relative",children:[f.jsx("div",{className:"absolute inset-0 flex items-center",children:f.jsx("div",{className:"w-full border-t border-border"})}),f.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:f.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"or"})})]}),f.jsxs("form",{onSubmit:j,className:"space-y-3",children:[e==="register"&&f.jsx("input",{type:"text",placeholder:"Name",value:c,onChange:L=>u(L.target.value),className:"w-full px-3 py-2 rounded-md border border-input bg-background text-sm"}),f.jsx("input",{type:"email",placeholder:"Email",value:r,onChange:L=>o(L.target.value),required:!0,className:"w-full px-3 py-2 rounded-md border border-input bg-background text-sm"}),f.jsx("input",{type:"password",placeholder:"Password",value:s,onChange:L=>l(L.target.value),required:!0,className:"w-full px-3 py-2 rounded-md border border-input bg-background text-sm"}),f.jsx("button",{type:"submit",disabled:m,className:"w-full py-2.5 px-4 rounded-lg bg-primary text-primary-foreground text-sm font-medium hover:opacity-90 disabled:opacity-50",children:m?"...":e==="register"?"Create Account":"Login"})]}),h&&f.jsx("p",{className:"text-sm text-destructive text-center",children:h}),f.jsx("p",{className:"text-xs text-center text-muted-foreground",children:e==="login"?f.jsxs(f.Fragment,{children:["No account?"," ",f.jsx("button",{onClick:()=>n("register"),className:"text-primary underline",children:"Register"})]}):f.jsxs(f.Fragment,{children:["Have an account?"," ",f.jsx("button",{onClick:()=>n("login"),className:"text-primary underline",children:"Login"})]})})]})})}/**
41
+ * @license lucide-react v0.577.0 - ISC
42
+ *
43
+ * This source code is licensed under the ISC license.
44
+ * See the LICENSE file in the root directory of this source tree.
45
+ */const nb=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/**
46
+ * @license lucide-react v0.577.0 - ISC
47
+ *
48
+ * This source code is licensed under the ISC license.
49
+ * See the LICENSE file in the root directory of this source tree.
50
+ */const qj=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
51
+ * @license lucide-react v0.577.0 - ISC
52
+ *
53
+ * This source code is licensed under the ISC license.
54
+ * See the LICENSE file in the root directory of this source tree.
55
+ */const Gj=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
56
+ * @license lucide-react v0.577.0 - ISC
57
+ *
58
+ * This source code is licensed under the ISC license.
59
+ * See the LICENSE file in the root directory of this source tree.
60
+ */const k0=t=>{const e=Gj(t);return e.charAt(0).toUpperCase()+e.slice(1)};/**
61
+ * @license lucide-react v0.577.0 - ISC
62
+ *
63
+ * This source code is licensed under the ISC license.
64
+ * See the LICENSE file in the root directory of this source tree.
65
+ */var Jj={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
66
+ * @license lucide-react v0.577.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */const Yj=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};/**
71
+ * @license lucide-react v0.577.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */const Qj=w.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:l,...c},u)=>w.createElement("svg",{ref:u,...Jj,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:nb("lucide",o),...!s&&!Yj(c)&&{"aria-hidden":"true"},...c},[...l.map(([h,p])=>w.createElement(h,p)),...Array.isArray(s)?s:[s]]));/**
76
+ * @license lucide-react v0.577.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const ke=(t,e)=>{const n=w.forwardRef(({className:r,...o},s)=>w.createElement(Qj,{ref:s,iconNode:e,className:nb(`lucide-${qj(k0(t))}`,`lucide-${t}`,r),...o}));return n.displayName=k0(t),n};/**
81
+ * @license lucide-react v0.577.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */const Xj=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Gm=ke("arrow-left",Xj);/**
86
+ * @license lucide-react v0.577.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */const Zj=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],eA=ke("bold",Zj);/**
91
+ * @license lucide-react v0.577.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const tA=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],rb=ke("bot",tA);/**
96
+ * @license lucide-react v0.577.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const nA=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],ob=ke("building-2",nA);/**
101
+ * @license lucide-react v0.577.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const rA=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],qo=ke("check",rA);/**
106
+ * @license lucide-react v0.577.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const oA=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Jm=ke("chevron-down",oA);/**
111
+ * @license lucide-react v0.577.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const sA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],sb=ke("chevron-right",sA);/**
116
+ * @license lucide-react v0.577.0 - ISC
117
+ *
118
+ * This source code is licensed under the ISC license.
119
+ * See the LICENSE file in the root directory of this source tree.
120
+ */const iA=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],lA=ke("chevron-up",iA);/**
121
+ * @license lucide-react v0.577.0 - ISC
122
+ *
123
+ * This source code is licensed under the ISC license.
124
+ * See the LICENSE file in the root directory of this source tree.
125
+ */const aA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Hn=ke("circle-alert",aA);/**
126
+ * @license lucide-react v0.577.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const cA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Pi=ke("circle-check",cA);/**
131
+ * @license lucide-react v0.577.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */const uA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Kp=ke("circle-x",uA);/**
136
+ * @license lucide-react v0.577.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */const dA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],fA=ke("circle",dA);/**
141
+ * @license lucide-react v0.577.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */const hA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],Ym=ke("clock",hA);/**
146
+ * @license lucide-react v0.577.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */const pA=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],mA=ke("code",pA);/**
151
+ * @license lucide-react v0.577.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */const gA=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],ya=ke("copy",gA);/**
156
+ * @license lucide-react v0.577.0 - ISC
157
+ *
158
+ * This source code is licensed under the ISC license.
159
+ * See the LICENSE file in the root directory of this source tree.
160
+ */const yA=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],xA=ke("database",yA);/**
161
+ * @license lucide-react v0.577.0 - ISC
162
+ *
163
+ * This source code is licensed under the ISC license.
164
+ * See the LICENSE file in the root directory of this source tree.
165
+ */const vA=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],wA=ke("ellipsis-vertical",vA);/**
166
+ * @license lucide-react v0.577.0 - ISC
167
+ *
168
+ * This source code is licensed under the ISC license.
169
+ * See the LICENSE file in the root directory of this source tree.
170
+ */const bA=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],qp=ke("external-link",bA);/**
171
+ * @license lucide-react v0.577.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */const kA=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ib=ke("eye",kA);/**
176
+ * @license lucide-react v0.577.0 - ISC
177
+ *
178
+ * This source code is licensed under the ISC license.
179
+ * See the LICENSE file in the root directory of this source tree.
180
+ */const SA=[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]],CA=ke("file-pen",SA);/**
181
+ * @license lucide-react v0.577.0 - ISC
182
+ *
183
+ * This source code is licensed under the ISC license.
184
+ * See the LICENSE file in the root directory of this source tree.
185
+ */const NA=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],$o=ke("file-text",NA);/**
186
+ * @license lucide-react v0.577.0 - ISC
187
+ *
188
+ * This source code is licensed under the ISC license.
189
+ * See the LICENSE file in the root directory of this source tree.
190
+ */const EA=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],lb=ke("folder",EA);/**
191
+ * @license lucide-react v0.577.0 - ISC
192
+ *
193
+ * This source code is licensed under the ISC license.
194
+ * See the LICENSE file in the root directory of this source tree.
195
+ */const MA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],TA=ke("globe",MA);/**
196
+ * @license lucide-react v0.577.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */const jA=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],AA=ke("heading-1",jA);/**
201
+ * @license lucide-react v0.577.0 - ISC
202
+ *
203
+ * This source code is licensed under the ISC license.
204
+ * See the LICENSE file in the root directory of this source tree.
205
+ */const RA=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],PA=ke("heading-2",RA);/**
206
+ * @license lucide-react v0.577.0 - ISC
207
+ *
208
+ * This source code is licensed under the ISC license.
209
+ * See the LICENSE file in the root directory of this source tree.
210
+ */const OA=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],IA=ke("heading-3",OA);/**
211
+ * @license lucide-react v0.577.0 - ISC
212
+ *
213
+ * This source code is licensed under the ISC license.
214
+ * See the LICENSE file in the root directory of this source tree.
215
+ */const DA=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Gp=ke("history",DA);/**
216
+ * @license lucide-react v0.577.0 - ISC
217
+ *
218
+ * This source code is licensed under the ISC license.
219
+ * See the LICENSE file in the root directory of this source tree.
220
+ */const _A=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Jp=ke("info",_A);/**
221
+ * @license lucide-react v0.577.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */const LA=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],zA=ke("italic",LA);/**
226
+ * @license lucide-react v0.577.0 - ISC
227
+ *
228
+ * This source code is licensed under the ISC license.
229
+ * See the LICENSE file in the root directory of this source tree.
230
+ */const $A=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],ab=ke("key-round",$A);/**
231
+ * @license lucide-react v0.577.0 - ISC
232
+ *
233
+ * This source code is licensed under the ISC license.
234
+ * See the LICENSE file in the root directory of this source tree.
235
+ */const FA=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],BA=ke("key",FA);/**
236
+ * @license lucide-react v0.577.0 - ISC
237
+ *
238
+ * This source code is licensed under the ISC license.
239
+ * See the LICENSE file in the root directory of this source tree.
240
+ */const VA=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],HA=ke("link-2",VA);/**
241
+ * @license lucide-react v0.577.0 - ISC
242
+ *
243
+ * This source code is licensed under the ISC license.
244
+ * See the LICENSE file in the root directory of this source tree.
245
+ */const WA=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],UA=ke("link",WA);/**
246
+ * @license lucide-react v0.577.0 - ISC
247
+ *
248
+ * This source code is licensed under the ISC license.
249
+ * See the LICENSE file in the root directory of this source tree.
250
+ */const KA=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],qA=ke("list-ordered",KA);/**
251
+ * @license lucide-react v0.577.0 - ISC
252
+ *
253
+ * This source code is licensed under the ISC license.
254
+ * See the LICENSE file in the root directory of this source tree.
255
+ */const GA=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],JA=ke("list",GA);/**
256
+ * @license lucide-react v0.577.0 - ISC
257
+ *
258
+ * This source code is licensed under the ISC license.
259
+ * See the LICENSE file in the root directory of this source tree.
260
+ */const YA=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],jt=ke("loader-circle",YA);/**
261
+ * @license lucide-react v0.577.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */const QA=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],XA=ke("log-out",QA);/**
266
+ * @license lucide-react v0.577.0 - ISC
267
+ *
268
+ * This source code is licensed under the ISC license.
269
+ * See the LICENSE file in the root directory of this source tree.
270
+ */const ZA=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],eR=ke("message-square",ZA);/**
271
+ * @license lucide-react v0.577.0 - ISC
272
+ *
273
+ * This source code is licensed under the ISC license.
274
+ * See the LICENSE file in the root directory of this source tree.
275
+ */const tR=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],cb=ke("monitor",tR);/**
276
+ * @license lucide-react v0.577.0 - ISC
277
+ *
278
+ * This source code is licensed under the ISC license.
279
+ * See the LICENSE file in the root directory of this source tree.
280
+ */const nR=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],ub=ke("pencil",nR);/**
281
+ * @license lucide-react v0.577.0 - ISC
282
+ *
283
+ * This source code is licensed under the ISC license.
284
+ * See the LICENSE file in the root directory of this source tree.
285
+ */const rR=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Yp=ke("plus",rR);/**
286
+ * @license lucide-react v0.577.0 - ISC
287
+ *
288
+ * This source code is licensed under the ISC license.
289
+ * See the LICENSE file in the root directory of this source tree.
290
+ */const oR=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],sR=ke("quote",oR);/**
291
+ * @license lucide-react v0.577.0 - ISC
292
+ *
293
+ * This source code is licensed under the ISC license.
294
+ * See the LICENSE file in the root directory of this source tree.
295
+ */const iR=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],lR=ke("redo",iR);/**
296
+ * @license lucide-react v0.577.0 - ISC
297
+ *
298
+ * This source code is licensed under the ISC license.
299
+ * See the LICENSE file in the root directory of this source tree.
300
+ */const aR=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],mu=ke("refresh-cw",aR);/**
301
+ * @license lucide-react v0.577.0 - ISC
302
+ *
303
+ * This source code is licensed under the ISC license.
304
+ * See the LICENSE file in the root directory of this source tree.
305
+ */const cR=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],S0=ke("rotate-ccw",cR);/**
306
+ * @license lucide-react v0.577.0 - ISC
307
+ *
308
+ * This source code is licensed under the ISC license.
309
+ * See the LICENSE file in the root directory of this source tree.
310
+ */const uR=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],dR=ke("save",uR);/**
311
+ * @license lucide-react v0.577.0 - ISC
312
+ *
313
+ * This source code is licensed under the ISC license.
314
+ * See the LICENSE file in the root directory of this source tree.
315
+ */const fR=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],db=ke("search",fR);/**
316
+ * @license lucide-react v0.577.0 - ISC
317
+ *
318
+ * This source code is licensed under the ISC license.
319
+ * See the LICENSE file in the root directory of this source tree.
320
+ */const hR=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Qm=ke("send",hR);/**
321
+ * @license lucide-react v0.577.0 - ISC
322
+ *
323
+ * This source code is licensed under the ISC license.
324
+ * See the LICENSE file in the root directory of this source tree.
325
+ */const pR=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],C0=ke("settings",pR);/**
326
+ * @license lucide-react v0.577.0 - ISC
327
+ *
328
+ * This source code is licensed under the ISC license.
329
+ * See the LICENSE file in the root directory of this source tree.
330
+ */const mR=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],gR=ke("shield-alert",mR);/**
331
+ * @license lucide-react v0.577.0 - ISC
332
+ *
333
+ * This source code is licensed under the ISC license.
334
+ * See the LICENSE file in the root directory of this source tree.
335
+ */const yR=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],xR=ke("shield-check",yR);/**
336
+ * @license lucide-react v0.577.0 - ISC
337
+ *
338
+ * This source code is licensed under the ISC license.
339
+ * See the LICENSE file in the root directory of this source tree.
340
+ */const vR=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],En=ke("shield",vR);/**
341
+ * @license lucide-react v0.577.0 - ISC
342
+ *
343
+ * This source code is licensed under the ISC license.
344
+ * See the LICENSE file in the root directory of this source tree.
345
+ */const wR=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],bR=ke("square-check-big",wR);/**
346
+ * @license lucide-react v0.577.0 - ISC
347
+ *
348
+ * This source code is licensed under the ISC license.
349
+ * See the LICENSE file in the root directory of this source tree.
350
+ */const kR=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],SR=ke("strikethrough",kR);/**
351
+ * @license lucide-react v0.577.0 - ISC
352
+ *
353
+ * This source code is licensed under the ISC license.
354
+ * See the LICENSE file in the root directory of this source tree.
355
+ */const CR=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],fb=ke("tag",CR);/**
356
+ * @license lucide-react v0.577.0 - ISC
357
+ *
358
+ * This source code is licensed under the ISC license.
359
+ * See the LICENSE file in the root directory of this source tree.
360
+ */const NR=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],hb=ke("terminal",NR);/**
361
+ * @license lucide-react v0.577.0 - ISC
362
+ *
363
+ * This source code is licensed under the ISC license.
364
+ * See the LICENSE file in the root directory of this source tree.
365
+ */const ER=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],pb=ke("trash-2",ER);/**
366
+ * @license lucide-react v0.577.0 - ISC
367
+ *
368
+ * This source code is licensed under the ISC license.
369
+ * See the LICENSE file in the root directory of this source tree.
370
+ */const MR=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],N0=ke("triangle-alert",MR);/**
371
+ * @license lucide-react v0.577.0 - ISC
372
+ *
373
+ * This source code is licensed under the ISC license.
374
+ * See the LICENSE file in the root directory of this source tree.
375
+ */const TR=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],jR=ke("undo",TR);/**
376
+ * @license lucide-react v0.577.0 - ISC
377
+ *
378
+ * This source code is licensed under the ISC license.
379
+ * See the LICENSE file in the root directory of this source tree.
380
+ */const AR=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Mi=ke("user-plus",AR);/**
381
+ * @license lucide-react v0.577.0 - ISC
382
+ *
383
+ * This source code is licensed under the ISC license.
384
+ * See the LICENSE file in the root directory of this source tree.
385
+ */const RR=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],mb=ke("users",RR);/**
386
+ * @license lucide-react v0.577.0 - ISC
387
+ *
388
+ * This source code is licensed under the ISC license.
389
+ * See the LICENSE file in the root directory of this source tree.
390
+ */const PR=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],OR=ke("x",PR);function gb(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(n=gb(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function yb(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=gb(t))&&(r&&(r+=" "),r+=e);return r}const IR=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},DR=(t,e)=>({classGroupId:t,validator:e}),xb=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),gu="-",E0=[],_R="arbitrary..",LR=t=>{const e=$R(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return zR(l);const c=l.split(gu),u=c[0]===""&&c.length>1?1:0;return vb(c,u,e)},getConflictingClassGroupIds:(l,c)=>{if(c){const u=r[l],h=n[l];return u?h?IR(h,u):u:h||E0}return n[l]||E0}}},vb=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const o=t[e],s=n.nextPart.get(o);if(s){const h=vb(t,e+1,s);if(h)return h}const l=n.validators;if(l===null)return;const c=e===0?t.join(gu):t.slice(e).join(gu),u=l.length;for(let h=0;h<u;h++){const p=l[h];if(p.validator(c))return p.classGroupId}},zR=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?_R+r:void 0})(),$R=t=>{const{theme:e,classGroups:n}=t;return FR(n,e)},FR=(t,e)=>{const n=xb();for(const r in t){const o=t[r];Xm(o,n,r,e)}return n},Xm=(t,e,n,r)=>{const o=t.length;for(let s=0;s<o;s++){const l=t[s];BR(l,e,n,r)}},BR=(t,e,n,r)=>{if(typeof t=="string"){VR(t,e,n);return}if(typeof t=="function"){HR(t,e,n,r);return}WR(t,e,n,r)},VR=(t,e,n)=>{const r=t===""?e:wb(e,t);r.classGroupId=n},HR=(t,e,n,r)=>{if(UR(t)){Xm(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(DR(n,t))},WR=(t,e,n,r)=>{const o=Object.entries(t),s=o.length;for(let l=0;l<s;l++){const[c,u]=o[l];Xm(u,wb(e,c),n,r)}},wb=(t,e)=>{let n=t;const r=e.split(gu),o=r.length;for(let s=0;s<o;s++){const l=r[s];let c=n.nextPart.get(l);c||(c=xb(),n.nextPart.set(l,c)),n=c}return n},UR=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,KR=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const o=(s,l)=>{n[s]=l,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(s){let l=n[s];if(l!==void 0)return l;if((l=r[s])!==void 0)return o(s,l),l},set(s,l){s in n?n[s]=l:o(s,l)}}},Qp="!",M0=":",qR=[],T0=(t,e,n,r,o)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),GR=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=o=>{const s=[];let l=0,c=0,u=0,h;const p=o.length;for(let k=0;k<p;k++){const C=o[k];if(l===0&&c===0){if(C===M0){s.push(o.slice(u,k)),u=k+1;continue}if(C==="/"){h=k;continue}}C==="["?l++:C==="]"?l--:C==="("?c++:C===")"&&c--}const m=s.length===0?o:o.slice(u);let y=m,x=!1;m.endsWith(Qp)?(y=m.slice(0,-1),x=!0):m.startsWith(Qp)&&(y=m.slice(1),x=!0);const b=h&&h>u?h-u:void 0;return T0(s,x,y,b)};if(e){const o=e+M0,s=r;r=l=>l.startsWith(o)?s(l.slice(o.length)):T0(qR,!1,l,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},JR=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const l=n[s],c=l[0]==="[",u=e.has(l);c||u?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(l)):o.push(l)}return o.length>0&&(o.sort(),r.push(...o)),r}},YR=t=>({cache:KR(t.cacheSize),parseClassName:GR(t),sortModifiers:JR(t),...LR(t)}),QR=/\s+/,XR=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=e,l=[],c=t.trim().split(QR);let u="";for(let h=c.length-1;h>=0;h-=1){const p=c[h],{isExternal:m,modifiers:y,hasImportantModifier:x,baseClassName:b,maybePostfixModifierPosition:k}=n(p);if(m){u=p+(u.length>0?" "+u:u);continue}let C=!!k,N=r(C?b.substring(0,k):b);if(!N){if(!C){u=p+(u.length>0?" "+u:u);continue}if(N=r(b),!N){u=p+(u.length>0?" "+u:u);continue}C=!1}const M=y.length===0?"":y.length===1?y[0]:s(y).join(":"),T=x?M+Qp:M,j=T+N;if(l.indexOf(j)>-1)continue;l.push(j);const P=o(N,C);for(let L=0;L<P.length;++L){const I=P[L];l.push(T+I)}u=p+(u.length>0?" "+u:u)}return u},ZR=(...t)=>{let e=0,n,r,o="";for(;e<t.length;)(n=t[e++])&&(r=bb(n))&&(o&&(o+=" "),o+=r);return o},bb=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=bb(t[r]))&&(n&&(n+=" "),n+=e);return n},eP=(t,...e)=>{let n,r,o,s;const l=u=>{const h=e.reduce((p,m)=>m(p),t());return n=YR(h),r=n.cache.get,o=n.cache.set,s=c,c(u)},c=u=>{const h=r(u);if(h)return h;const p=XR(u,n);return o(u,p),p};return s=l,(...u)=>s(ZR(...u))},tP=[],Et=t=>{const e=n=>n[t]||tP;return e.isThemeGetter=!0,e},kb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Sb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,nP=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,rP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,oP=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,sP=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,iP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,lP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vo=t=>nP.test(t),$e=t=>!!t&&!Number.isNaN(Number(t)),wo=t=>!!t&&Number.isInteger(Number(t)),Zh=t=>t.endsWith("%")&&$e(t.slice(0,-1)),zr=t=>rP.test(t),Cb=()=>!0,aP=t=>oP.test(t)&&!sP.test(t),Zm=()=>!1,cP=t=>iP.test(t),uP=t=>lP.test(t),dP=t=>!ye(t)&&!ve(t),fP=t=>Go(t,Mb,Zm),ye=t=>kb.test(t),ps=t=>Go(t,Tb,aP),j0=t=>Go(t,wP,$e),hP=t=>Go(t,Ab,Cb),pP=t=>Go(t,jb,Zm),A0=t=>Go(t,Nb,Zm),mP=t=>Go(t,Eb,uP),Lc=t=>Go(t,Rb,cP),ve=t=>Sb.test(t),Pl=t=>$s(t,Tb),gP=t=>$s(t,jb),R0=t=>$s(t,Nb),yP=t=>$s(t,Mb),xP=t=>$s(t,Eb),zc=t=>$s(t,Rb,!0),vP=t=>$s(t,Ab,!0),Go=(t,e,n)=>{const r=kb.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},$s=(t,e,n=!1)=>{const r=Sb.exec(t);return r?r[1]?e(r[1]):n:!1},Nb=t=>t==="position"||t==="percentage",Eb=t=>t==="image"||t==="url",Mb=t=>t==="length"||t==="size"||t==="bg-size",Tb=t=>t==="length",wP=t=>t==="number",jb=t=>t==="family-name",Ab=t=>t==="number"||t==="weight",Rb=t=>t==="shadow",bP=()=>{const t=Et("color"),e=Et("font"),n=Et("text"),r=Et("font-weight"),o=Et("tracking"),s=Et("leading"),l=Et("breakpoint"),c=Et("container"),u=Et("spacing"),h=Et("radius"),p=Et("shadow"),m=Et("inset-shadow"),y=Et("text-shadow"),x=Et("drop-shadow"),b=Et("blur"),k=Et("perspective"),C=Et("aspect"),N=Et("ease"),M=Et("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],P=()=>[...j(),ve,ye],L=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],_=()=>[ve,ye,u],$=()=>[vo,"full","auto",..._()],q=()=>[wo,"none","subgrid",ve,ye],X=()=>["auto",{span:["full",wo,ve,ye]},wo,ve,ye],ee=()=>[wo,"auto",ve,ye],K=()=>["auto","min","max","fr",ve,ye],ie=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ne=()=>["start","end","center","stretch","center-safe","end-safe"],re=()=>["auto",..._()],ae=()=>[vo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],H=()=>[vo,"screen","full","dvw","lvw","svw","min","max","fit",..._()],W=()=>[vo,"screen","full","lh","dvh","lvh","svh","min","max","fit",..._()],B=()=>[t,ve,ye],R=()=>[...j(),R0,A0,{position:[ve,ye]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ne=()=>["auto","cover","contain",yP,fP,{size:[ve,ye]}],Se=()=>[Zh,Pl,ps],we=()=>["","none","full",h,ve,ye],he=()=>["",$e,Pl,ps],oe=()=>["solid","dashed","dotted","double"],pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],le=()=>[$e,Zh,R0,A0],je=()=>["","none",b,ve,ye],De=()=>["none",$e,ve,ye],_e=()=>["none",$e,ve,ye],Je=()=>[$e,ve,ye],rt=()=>[vo,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[zr],breakpoint:[zr],color:[Cb],container:[zr],"drop-shadow":[zr],ease:["in","out","in-out"],font:[dP],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[zr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[zr],shadow:[zr],spacing:["px",$e],text:[zr],"text-shadow":[zr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",vo,ye,ve,C]}],container:["container"],columns:[{columns:[$e,ye,ve,c]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:P()}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:$()}],"inset-x":[{"inset-x":$()}],"inset-y":[{"inset-y":$()}],start:[{"inset-s":$(),start:$()}],end:[{"inset-e":$(),end:$()}],"inset-bs":[{"inset-bs":$()}],"inset-be":[{"inset-be":$()}],top:[{top:$()}],right:[{right:$()}],bottom:[{bottom:$()}],left:[{left:$()}],visibility:["visible","invisible","collapse"],z:[{z:[wo,"auto",ve,ye]}],basis:[{basis:[vo,"full","auto",c,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[$e,vo,"auto","initial","none",ye]}],grow:[{grow:["",$e,ve,ye]}],shrink:[{shrink:["",$e,ve,ye]}],order:[{order:[wo,"first","last","none",ve,ye]}],"grid-cols":[{"grid-cols":q()}],"col-start-end":[{col:X()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":q()}],"row-start-end":[{row:X()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":K()}],"auto-rows":[{"auto-rows":K()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...ie(),"normal"]}],"justify-items":[{"justify-items":[...ne(),"normal"]}],"justify-self":[{"justify-self":["auto",...ne()]}],"align-content":[{content:["normal",...ie()]}],"align-items":[{items:[...ne(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ne(),{baseline:["","last"]}]}],"place-content":[{"place-content":ie()}],"place-items":[{"place-items":[...ne(),"baseline"]}],"place-self":[{"place-self":["auto",...ne()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pbs:[{pbs:_()}],pbe:[{pbe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:re()}],mx:[{mx:re()}],my:[{my:re()}],ms:[{ms:re()}],me:[{me:re()}],mbs:[{mbs:re()}],mbe:[{mbe:re()}],mt:[{mt:re()}],mr:[{mr:re()}],mb:[{mb:re()}],ml:[{ml:re()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:ae()}],"inline-size":[{inline:["auto",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[c,"screen",...ae()]}],"min-w":[{"min-w":[c,"screen","none",...ae()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...ae()]}],h:[{h:["screen","lh",...ae()]}],"min-h":[{"min-h":["screen","lh","none",...ae()]}],"max-h":[{"max-h":["screen","lh",...ae()]}],"font-size":[{text:["base",n,Pl,ps]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,vP,hP]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Zh,ye]}],"font-family":[{font:[gP,pP,e]}],"font-features":[{"font-features":[ye]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ve,ye]}],"line-clamp":[{"line-clamp":[$e,"none",ve,j0]}],leading:[{leading:[s,..._()]}],"list-image":[{"list-image":["none",ve,ye]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ve,ye]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[$e,"from-font","auto",ve,ps]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[$e,"auto",ve,ye]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ve,ye]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ve,ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:R()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:Ne()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},wo,ve,ye],radial:["",ve,ye],conic:[wo,ve,ye]},xP,mP]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:Se()}],"gradient-via-pos":[{via:Se()}],"gradient-to-pos":[{to:Se()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:we()}],"rounded-s":[{"rounded-s":we()}],"rounded-e":[{"rounded-e":we()}],"rounded-t":[{"rounded-t":we()}],"rounded-r":[{"rounded-r":we()}],"rounded-b":[{"rounded-b":we()}],"rounded-l":[{"rounded-l":we()}],"rounded-ss":[{"rounded-ss":we()}],"rounded-se":[{"rounded-se":we()}],"rounded-ee":[{"rounded-ee":we()}],"rounded-es":[{"rounded-es":we()}],"rounded-tl":[{"rounded-tl":we()}],"rounded-tr":[{"rounded-tr":we()}],"rounded-br":[{"rounded-br":we()}],"rounded-bl":[{"rounded-bl":we()}],"border-w":[{border:he()}],"border-w-x":[{"border-x":he()}],"border-w-y":[{"border-y":he()}],"border-w-s":[{"border-s":he()}],"border-w-e":[{"border-e":he()}],"border-w-bs":[{"border-bs":he()}],"border-w-be":[{"border-be":he()}],"border-w-t":[{"border-t":he()}],"border-w-r":[{"border-r":he()}],"border-w-b":[{"border-b":he()}],"border-w-l":[{"border-l":he()}],"divide-x":[{"divide-x":he()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":he()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-bs":[{"border-bs":B()}],"border-color-be":[{"border-be":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[$e,ve,ye]}],"outline-w":[{outline:["",$e,Pl,ps]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",p,zc,Lc]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",m,zc,Lc]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:he()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[$e,ps]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",y,zc,Lc]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[$e,ve,ye]}],"mix-blend":[{"mix-blend":[...pe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":pe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[$e]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[ve,ye]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":j()}],"mask-image-conic-pos":[{"mask-conic":[$e]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:Ne()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ve,ye]}],filter:[{filter:["","none",ve,ye]}],blur:[{blur:je()}],brightness:[{brightness:[$e,ve,ye]}],contrast:[{contrast:[$e,ve,ye]}],"drop-shadow":[{"drop-shadow":["","none",x,zc,Lc]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",$e,ve,ye]}],"hue-rotate":[{"hue-rotate":[$e,ve,ye]}],invert:[{invert:["",$e,ve,ye]}],saturate:[{saturate:[$e,ve,ye]}],sepia:[{sepia:["",$e,ve,ye]}],"backdrop-filter":[{"backdrop-filter":["","none",ve,ye]}],"backdrop-blur":[{"backdrop-blur":je()}],"backdrop-brightness":[{"backdrop-brightness":[$e,ve,ye]}],"backdrop-contrast":[{"backdrop-contrast":[$e,ve,ye]}],"backdrop-grayscale":[{"backdrop-grayscale":["",$e,ve,ye]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[$e,ve,ye]}],"backdrop-invert":[{"backdrop-invert":["",$e,ve,ye]}],"backdrop-opacity":[{"backdrop-opacity":[$e,ve,ye]}],"backdrop-saturate":[{"backdrop-saturate":[$e,ve,ye]}],"backdrop-sepia":[{"backdrop-sepia":["",$e,ve,ye]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ve,ye]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[$e,"initial",ve,ye]}],ease:[{ease:["linear","initial",N,ve,ye]}],delay:[{delay:[$e,ve,ye]}],animate:[{animate:["none",M,ve,ye]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,ve,ye]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:De()}],"rotate-x":[{"rotate-x":De()}],"rotate-y":[{"rotate-y":De()}],"rotate-z":[{"rotate-z":De()}],scale:[{scale:_e()}],"scale-x":[{"scale-x":_e()}],"scale-y":[{"scale-y":_e()}],"scale-z":[{"scale-z":_e()}],"scale-3d":["scale-3d"],skew:[{skew:Je()}],"skew-x":[{"skew-x":Je()}],"skew-y":[{"skew-y":Je()}],transform:[{transform:[ve,ye,"","none","gpu","cpu"]}],"transform-origin":[{origin:P()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:rt()}],"translate-x":[{"translate-x":rt()}],"translate-y":[{"translate-y":rt()}],"translate-z":[{"translate-z":rt()}],"translate-none":["translate-none"],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ve,ye]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mbs":[{"scroll-mbs":_()}],"scroll-mbe":[{"scroll-mbe":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pbs":[{"scroll-pbs":_()}],"scroll-pbe":[{"scroll-pbe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ve,ye]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[$e,Pl,ps,j0]}],stroke:[{stroke:["none",...B()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},kP=eP(bP);function Ee(...t){return kP(yb(t))}const Mt=w.forwardRef(({className:t,...e},n)=>f.jsx("div",{ref:n,className:Ee("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));Mt.displayName="Card";const Ft=w.forwardRef(({className:t,...e},n)=>f.jsx("div",{ref:n,className:Ee("flex flex-col space-y-1.5 p-6",t),...e}));Ft.displayName="CardHeader";const Bt=w.forwardRef(({className:t,...e},n)=>f.jsx("h3",{ref:n,className:Ee("text-2xl font-semibold leading-none tracking-tight",t),...e}));Bt.displayName="CardTitle";const rr=w.forwardRef(({className:t,...e},n)=>f.jsx("p",{ref:n,className:Ee("text-sm text-muted-foreground",t),...e}));rr.displayName="CardDescription";const Tt=w.forwardRef(({className:t,...e},n)=>f.jsx("div",{ref:n,className:Ee("p-6 pt-0",t),...e}));Tt.displayName="CardContent";const SP=w.forwardRef(({className:t,...e},n)=>f.jsx("div",{ref:n,className:Ee("flex items-center p-6 pt-0",t),...e}));SP.displayName="CardFooter";function P0(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Yr(...t){return e=>{let n=!1;const r=t.map(o=>{const s=P0(o,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():P0(t[o],null)}}}}function Ve(...t){return w.useCallback(Yr(...t),t)}var CP=Symbol.for("react.lazy"),yu=Um[" use ".trim().toString()];function NP(t){return typeof t=="object"&&t!==null&&"then"in t}function Pb(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===CP&&"_payload"in t&&NP(t._payload)}function eg(t){const e=MP(t),n=w.forwardRef((r,o)=>{let{children:s,...l}=r;Pb(s)&&typeof yu=="function"&&(s=yu(s._payload));const c=w.Children.toArray(s),u=c.find(jP);if(u){const h=u.props.children,p=c.map(m=>m===u?w.Children.count(h)>1?w.Children.only(null):w.isValidElement(h)?h.props.children:null:m);return f.jsx(e,{...l,ref:o,children:w.isValidElement(h)?w.cloneElement(h,void 0,p):null})}return f.jsx(e,{...l,ref:o,children:s})});return n.displayName=`${t}.Slot`,n}var EP=eg("Slot");function MP(t){const e=w.forwardRef((n,r)=>{let{children:o,...s}=n;if(Pb(o)&&typeof yu=="function"&&(o=yu(o._payload)),w.isValidElement(o)){const l=RP(o),c=AP(s,o.props);return o.type!==w.Fragment&&(c.ref=r?Yr(r,l):l),w.cloneElement(o,c)}return w.Children.count(o)>1?w.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var TP=Symbol("radix.slottable");function jP(t){return w.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===TP}function AP(t,e){const n={...e};for(const r in e){const o=t[r],s=e[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...c)=>{const u=s(...c);return o(...c),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...t,...n}}function RP(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}const O0=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,I0=yb,xd=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return I0(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=e,l=Object.keys(o).map(h=>{const p=n==null?void 0:n[h],m=s==null?void 0:s[h];if(p===null)return null;const y=O0(p)||O0(m);return o[h][y]}),c=n&&Object.entries(n).reduce((h,p)=>{let[m,y]=p;return y===void 0||(h[m]=y),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,p)=>{let{class:m,className:y,...x}=p;return Object.entries(x).every(b=>{let[k,C]=b;return Array.isArray(C)?C.includes({...s,...c}[k]):{...s,...c}[k]===C})?[...h,m,y]:h},[]);return I0(t,l,u,n==null?void 0:n.class,n==null?void 0:n.className)},PP=xd("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),xe=w.forwardRef(({className:t,variant:e="default",size:n="default",asChild:r=!1,...o},s)=>{const l=r?EP:"button";return f.jsx(l,{className:Ee(PP({variant:e,size:n,className:t})),ref:s,...o})});xe.displayName="Button";const yn=w.forwardRef(({className:t,type:e,...n},r)=>f.jsx("input",{type:e,className:Ee("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...n}));yn.displayName="Input";var xa=W1();const Ob=Wm(xa);var OP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],IP=OP.reduce((t,e)=>{const n=eg(`Primitive.${e}`),r=w.forwardRef((o,s)=>{const{asChild:l,...c}=o,u=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(u,{...c,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),DP="Label",Ib=w.forwardRef((t,e)=>f.jsx(IP.label,{...t,ref:e,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=t.onMouseDown)==null||o.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Ib.displayName=DP;var Db=Ib;const _P=xd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),yt=w.forwardRef(({className:t,...e},n)=>f.jsx(Db,{ref:n,className:Ee(_P(),t),...e}));yt.displayName=Db.displayName;const LP="00000000-0000-0000-0000-000000000000";function zP({onSelectNest:t}){const[e,n]=w.useState([]),[r,o]=w.useState(!0),[s,l]=w.useState(!1),[c,u]=w.useState(""),[h,p]=w.useState(""),m=typeof window<"u"?window.location.origin:"http://localhost:3838",y=async()=>{o(!0);try{const b=await Q1();n(b.nests)}catch{}finally{o(!1)}};w.useEffect(()=>{y()},[]);const x=async b=>{if(b.preventDefault(),!!c.trim())try{await Oj(c,h),u(""),p(""),l(!1),y()}catch{}};return f.jsxs("div",{className:"space-y-6",children:[f.jsxs(Mt,{className:"bg-gradient-to-br from-blue-50 to-indigo-50 border-blue-200",children:[f.jsx(Ft,{className:"pb-3",children:f.jsxs("div",{className:"flex items-start justify-between",children:[f.jsxs("div",{children:[f.jsx(Bt,{className:"text-lg",children:"Your Community Server"}),f.jsxs(rr,{children:["Running at"," ",f.jsx("code",{className:"text-xs bg-white/60 px-1.5 py-0.5 rounded font-mono",children:m}),f.jsx($P,{value:m})]})]}),f.jsx("div",{className:"flex gap-4 text-center",children:f.jsxs("div",{children:[f.jsx("div",{className:"text-2xl font-bold",children:e.length}),f.jsx("div",{className:"text-xs text-muted-foreground",children:"Nests"})]})})]})}),f.jsx(Tt,{className:"pt-0",children:f.jsxs("div",{className:"grid md:grid-cols-3 gap-3 text-xs",children:[f.jsx(ep,{icon:f.jsx(rb,{className:"h-4 w-4"}),title:"Hootie",desc:"Settings → Vault → Remote Server → paste URL"}),f.jsx(ep,{icon:f.jsx(cb,{className:"h-4 w-4"}),title:"Claude Desktop",desc:"Add MCP endpoint per nest via Connect button"}),f.jsx(ep,{icon:f.jsx(hb,{className:"h-4 w-4"}),title:"CLI",desc:`ctx --server ${m}`,mono:!0})]})})]}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("h2",{className:"text-xl font-semibold",children:"Nests"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Shared knowledge vaults for your team"})]}),f.jsxs(xe,{onClick:()=>l(!0),children:[f.jsx(Yp,{className:"h-4 w-4 mr-2"}),"New Nest"]})]}),s&&f.jsx(Mt,{children:f.jsx(Tt,{className:"pt-6",children:f.jsxs("form",{onSubmit:x,className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{children:"Name"}),f.jsx(yn,{placeholder:"Team Knowledge",value:c,onChange:b=>u(b.target.value),autoFocus:!0})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{children:"Description (optional)"}),f.jsx(yn,{placeholder:"Shared docs for the engineering team",value:h,onChange:b=>p(b.target.value)})]}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(xe,{type:"submit",children:"Create Nest"}),f.jsx(xe,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"})]})]})})}),r?f.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}):e.length===0?f.jsx(Mt,{children:f.jsxs(Tt,{className:"text-center py-12",children:[f.jsx(xA,{className:"h-12 w-12 mx-auto text-muted-foreground mb-3"}),f.jsx("p",{className:"font-medium",children:"No nests yet"}),f.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create your first nest to start sharing knowledge with your team"}),f.jsxs(xe,{onClick:()=>l(!0),children:[f.jsx(Yp,{className:"h-4 w-4 mr-2"}),"Create First Nest"]})]})}):f.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.map(b=>{const k=b.user_id===LP;return f.jsx("button",{onClick:()=>t(b.id,b.name),className:`text-left p-4 rounded-lg border bg-card hover:bg-secondary/50 transition-colors ${k?"border-dashed border-amber-300":"border-border"}`,children:f.jsxs("div",{className:"flex items-start gap-3",children:[f.jsx("div",{className:`p-2 rounded-md ${k?"bg-amber-100":"bg-primary/10"}`,children:k?f.jsx(TA,{className:"h-5 w-5 text-amber-700"}):f.jsx($o,{className:"h-5 w-5 text-primary"})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("h3",{className:"font-medium truncate",children:b.name}),b.description&&f.jsx("p",{className:"text-sm text-muted-foreground truncate mt-0.5",children:b.description}),f.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs text-muted-foreground flex-wrap",children:[k&&f.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-50 text-amber-800 border border-amber-200",title:"Owned by the anonymous admin — no stewardship applied",children:"Ungoverned"}),f.jsx("span",{className:`px-1.5 py-0.5 rounded ${b.visibility==="public"?"bg-green-100 text-green-700":"bg-secondary text-secondary-foreground"}`,children:b.visibility}),f.jsx("span",{children:new Date(b.created_at).toLocaleDateString()})]})]})]})},b.id)})})]})}function ep({icon:t,title:e,desc:n,mono:r}){return f.jsxs("div",{className:"flex items-start gap-2 p-2 rounded bg-white/40",children:[f.jsx("div",{className:"text-muted-foreground mt-0.5",children:t}),f.jsxs("div",{className:"min-w-0",children:[f.jsx("div",{className:"font-medium text-foreground",children:e}),f.jsx("div",{className:`text-muted-foreground ${r?"font-mono text-[10px]":""} truncate`,children:n})]})]})}function $P({value:t}){const[e,n]=w.useState(!1);return f.jsx("button",{onClick:async r=>{r.stopPropagation(),await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),1200)},className:"ml-1 inline-flex items-center hover:text-foreground",children:e?f.jsx(qo,{className:"h-3 w-3 text-green-600"}):f.jsx(ya,{className:"h-3 w-3"})})}function fe(t,e,{checkForDefaultPrevented:n=!0}={}){return function(o){if(t==null||t(o),n===!1||!o.defaultPrevented)return e==null?void 0:e(o)}}function FP(t,e){const n=w.createContext(e),r=s=>{const{children:l,...c}=s,u=w.useMemo(()=>c,Object.values(c));return f.jsx(n.Provider,{value:u,children:l})};r.displayName=t+"Provider";function o(s){const l=w.useContext(n);if(l)return l;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[r,o]}function ur(t,e=[]){let n=[];function r(s,l){const c=w.createContext(l),u=n.length;n=[...n,l];const h=m=>{var N;const{scope:y,children:x,...b}=m,k=((N=y==null?void 0:y[t])==null?void 0:N[u])||c,C=w.useMemo(()=>b,Object.values(b));return f.jsx(k.Provider,{value:C,children:x})};h.displayName=s+"Provider";function p(m,y){var k;const x=((k=y==null?void 0:y[t])==null?void 0:k[u])||c,b=w.useContext(x);if(b)return b;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${s}\``)}return[h,p]}const o=()=>{const s=n.map(l=>w.createContext(l));return function(c){const u=(c==null?void 0:c[t])||s;return w.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return o.scopeName=t,[r,BP(o,...e)]}function BP(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const l=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(s)[`__scope${h}`];return{...c,...m}},{});return w.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return n.scopeName=e.scopeName,n}var bt=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},VP=Um[" useId ".trim().toString()]||(()=>{}),HP=0;function Sr(t){const[e,n]=w.useState(VP());return bt(()=>{n(r=>r??String(HP++))},[t]),e?`radix-${e}`:""}var WP=Um[" useInsertionEffect ".trim().toString()]||bt;function Fo({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[o,s,l]=UP({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:o;{const p=w.useRef(t!==void 0);w.useEffect(()=>{const m=p.current;m!==c&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${c?"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.`),p.current=c},[c,r])}const h=w.useCallback(p=>{var m;if(c){const y=KP(p)?p(t):p;y!==t&&((m=l.current)==null||m.call(l,y))}else s(p)},[c,t,s,l]);return[u,h]}function UP({defaultProp:t,onChange:e}){const[n,r]=w.useState(t),o=w.useRef(n),s=w.useRef(e);return WP(()=>{s.current=e},[e]),w.useEffect(()=>{var l;o.current!==n&&((l=s.current)==null||l.call(s,n),o.current=n)},[n,o]),[n,r,s]}function KP(t){return typeof t=="function"}function qP(t){const e=GP(t),n=w.forwardRef((r,o)=>{const{children:s,...l}=r,c=w.Children.toArray(s),u=c.find(YP);if(u){const h=u.props.children,p=c.map(m=>m===u?w.Children.count(h)>1?w.Children.only(null):w.isValidElement(h)?h.props.children:null:m);return f.jsx(e,{...l,ref:o,children:w.isValidElement(h)?w.cloneElement(h,void 0,p):null})}return f.jsx(e,{...l,ref:o,children:s})});return n.displayName=`${t}.Slot`,n}function GP(t){const e=w.forwardRef((n,r)=>{const{children:o,...s}=n;if(w.isValidElement(o)){const l=XP(o),c=QP(s,o.props);return o.type!==w.Fragment&&(c.ref=r?Yr(r,l):l),w.cloneElement(o,c)}return w.Children.count(o)>1?w.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var JP=Symbol("radix.slottable");function YP(t){return w.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===JP}function QP(t,e){const n={...e};for(const r in e){const o=t[r],s=e[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...c)=>{const u=s(...c);return o(...c),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...t,...n}}function XP(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var ZP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Pe=ZP.reduce((t,e)=>{const n=qP(`Primitive.${e}`),r=w.forwardRef((o,s)=>{const{asChild:l,...c}=o,u=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(u,{...c,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function _b(t,e){t&&xa.flushSync(()=>t.dispatchEvent(e))}function Ot(t){const e=w.useRef(t);return w.useEffect(()=>{e.current=t}),w.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function eO(t,e=globalThis==null?void 0:globalThis.document){const n=Ot(t);w.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var tO="DismissableLayer",Xp="dismissableLayer.update",nO="dismissableLayer.pointerDownOutside",rO="dismissableLayer.focusOutside",D0,Lb=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),vd=w.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=t,h=w.useContext(Lb),[p,m]=w.useState(null),y=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=w.useState({}),b=Ve(e,I=>m(I)),k=Array.from(h.layers),[C]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),N=k.indexOf(C),M=p?k.indexOf(p):-1,T=h.layersWithOutsidePointerEventsDisabled.size>0,j=M>=N,P=iO(I=>{const _=I.target,$=[...h.branches].some(q=>q.contains(_));!j||$||(o==null||o(I),l==null||l(I),I.defaultPrevented||c==null||c())},y),L=lO(I=>{const _=I.target;[...h.branches].some(q=>q.contains(_))||(s==null||s(I),l==null||l(I),I.defaultPrevented||c==null||c())},y);return eO(I=>{M===h.layers.size-1&&(r==null||r(I),!I.defaultPrevented&&c&&(I.preventDefault(),c()))},y),w.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(D0=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),_0(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=D0)}},[p,y,n,h]),w.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),_0())},[p,h]),w.useEffect(()=>{const I=()=>x({});return document.addEventListener(Xp,I),()=>document.removeEventListener(Xp,I)},[]),f.jsx(Pe.div,{...u,ref:b,style:{pointerEvents:T?j?"auto":"none":void 0,...t.style},onFocusCapture:fe(t.onFocusCapture,L.onFocusCapture),onBlurCapture:fe(t.onBlurCapture,L.onBlurCapture),onPointerDownCapture:fe(t.onPointerDownCapture,P.onPointerDownCapture)})});vd.displayName=tO;var oO="DismissableLayerBranch",sO=w.forwardRef((t,e)=>{const n=w.useContext(Lb),r=w.useRef(null),o=Ve(e,r);return w.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),f.jsx(Pe.div,{...t,ref:o})});sO.displayName=oO;function iO(t,e=globalThis==null?void 0:globalThis.document){const n=Ot(t),r=w.useRef(!1),o=w.useRef(()=>{});return w.useEffect(()=>{const s=c=>{if(c.target&&!r.current){let u=function(){zb(nO,n,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=u,e.addEventListener("click",o.current,{once:!0})):u()}else e.removeEventListener("click",o.current);r.current=!1},l=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(l),e.removeEventListener("pointerdown",s),e.removeEventListener("click",o.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function lO(t,e=globalThis==null?void 0:globalThis.document){const n=Ot(t),r=w.useRef(!1);return w.useEffect(()=>{const o=s=>{s.target&&!r.current&&zb(rO,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function _0(){const t=new CustomEvent(Xp);document.dispatchEvent(t)}function zb(t,e,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?_b(o,s):o.dispatchEvent(s)}var tp="focusScope.autoFocusOnMount",np="focusScope.autoFocusOnUnmount",L0={bubbles:!1,cancelable:!0},aO="FocusScope",wd=w.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...l}=t,[c,u]=w.useState(null),h=Ot(o),p=Ot(s),m=w.useRef(null),y=Ve(e,k=>u(k)),x=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let k=function(T){if(x.paused||!c)return;const j=T.target;c.contains(j)?m.current=j:ko(m.current,{select:!0})},C=function(T){if(x.paused||!c)return;const j=T.relatedTarget;j!==null&&(c.contains(j)||ko(m.current,{select:!0}))},N=function(T){if(document.activeElement===document.body)for(const P of T)P.removedNodes.length>0&&ko(c)};document.addEventListener("focusin",k),document.addEventListener("focusout",C);const M=new MutationObserver(N);return c&&M.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",C),M.disconnect()}}},[r,c,x.paused]),w.useEffect(()=>{if(c){$0.add(x);const k=document.activeElement;if(!c.contains(k)){const N=new CustomEvent(tp,L0);c.addEventListener(tp,h),c.dispatchEvent(N),N.defaultPrevented||(cO(pO($b(c)),{select:!0}),document.activeElement===k&&ko(c))}return()=>{c.removeEventListener(tp,h),setTimeout(()=>{const N=new CustomEvent(np,L0);c.addEventListener(np,p),c.dispatchEvent(N),N.defaultPrevented||ko(k??document.body,{select:!0}),c.removeEventListener(np,p),$0.remove(x)},0)}}},[c,h,p,x]);const b=w.useCallback(k=>{if(!n&&!r||x.paused)return;const C=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,N=document.activeElement;if(C&&N){const M=k.currentTarget,[T,j]=uO(M);T&&j?!k.shiftKey&&N===j?(k.preventDefault(),n&&ko(T,{select:!0})):k.shiftKey&&N===T&&(k.preventDefault(),n&&ko(j,{select:!0})):N===M&&k.preventDefault()}},[n,r,x.paused]);return f.jsx(Pe.div,{tabIndex:-1,...l,ref:y,onKeyDown:b})});wd.displayName=aO;function cO(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(ko(r,{select:e}),document.activeElement!==n)return}function uO(t){const e=$b(t),n=z0(e,t),r=z0(e.reverse(),t);return[n,r]}function $b(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function z0(t,e){for(const n of t)if(!dO(n,{upTo:e}))return n}function dO(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}function fO(t){return t instanceof HTMLInputElement&&"select"in t}function ko(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&fO(t)&&e&&t.select()}}var $0=hO();function hO(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=F0(t,e),t.unshift(e)},remove(e){var n;t=F0(t,e),(n=t[0])==null||n.resume()}}}function F0(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function pO(t){return t.filter(e=>e.tagName!=="A")}var mO="Portal",bd=w.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[o,s]=w.useState(!1);bt(()=>s(!0),[]);const l=n||o&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?Ob.createPortal(f.jsx(Pe.div,{...r,ref:e}),l):null});bd.displayName=mO;function gO(t,e){return w.useReducer((n,r)=>e[n][r]??n,t)}var vn=t=>{const{present:e,children:n}=t,r=yO(e),o=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),s=Ve(r.ref,xO(o));return typeof n=="function"||r.isPresent?w.cloneElement(o,{ref:s}):null};vn.displayName="Presence";function yO(t){const[e,n]=w.useState(),r=w.useRef(null),o=w.useRef(t),s=w.useRef("none"),l=t?"mounted":"unmounted",[c,u]=gO(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const h=$c(r.current);s.current=c==="mounted"?h:"none"},[c]),bt(()=>{const h=r.current,p=o.current;if(p!==t){const y=s.current,x=$c(h);t?u("MOUNT"):x==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(p&&y!==x?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),bt(()=>{if(e){let h;const p=e.ownerDocument.defaultView??window,m=x=>{const k=$c(r.current).includes(CSS.escape(x.animationName));if(x.target===e&&k&&(u("ANIMATION_END"),!o.current)){const C=e.style.animationFillMode;e.style.animationFillMode="forwards",h=p.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=C)})}},y=x=>{x.target===e&&(s.current=$c(r.current))};return e.addEventListener("animationstart",y),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{p.clearTimeout(h),e.removeEventListener("animationstart",y),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:w.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function $c(t){return(t==null?void 0:t.animationName)||"none"}function xO(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var rp=0;function tg(){w.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??B0()),document.body.insertAdjacentElement("beforeend",t[1]??B0()),rp++,()=>{rp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),rp--}},[])}function B0(){const 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}var br=function(){return br=Object.assign||function(e){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},br.apply(this,arguments)};function Fb(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 vO(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,s;r<o;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var lu="right-scroll-bar-position",au="width-before-scroll-bar",wO="with-scroll-bars-hidden",bO="--removed-body-scroll-bar-size";function op(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function kO(t,e){var n=w.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 SO=typeof window<"u"?w.useLayoutEffect:w.useEffect,V0=new WeakMap;function CO(t,e){var n=kO(null,function(r){return t.forEach(function(o){return op(o,r)})});return SO(function(){var r=V0.get(n);if(r){var o=new Set(r),s=new Set(t),l=n.current;o.forEach(function(c){s.has(c)||op(c,null)}),s.forEach(function(c){o.has(c)||op(c,l)})}V0.set(n,t)},[t]),n}function NO(t){return t}function EO(t,e){e===void 0&&(e=NO);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(s){var l=e(s,r);return n.push(l),function(){n=n.filter(function(c){return c!==l})}},assignSyncMedium:function(s){for(r=!0;n.length;){var l=n;n=[],l.forEach(s)}n={push:function(c){return s(c)},filter:function(){return n}}},assignMedium:function(s){r=!0;var l=[];if(n.length){var c=n;n=[],c.forEach(s),l=n}var u=function(){var p=l;l=[],p.forEach(s)},h=function(){return Promise.resolve().then(u)};h(),n={push:function(p){l.push(p),h()},filter:function(p){return l=l.filter(p),n}}}};return o}function MO(t){t===void 0&&(t={});var e=EO(null);return e.options=br({async:!0,ssr:!1},t),e}var Bb=function(t){var e=t.sideCar,n=Fb(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 w.createElement(r,br({},n))};Bb.isSideCarExport=!0;function TO(t,e){return t.useMedium(e),Bb}var Vb=MO(),sp=function(){},kd=w.forwardRef(function(t,e){var n=w.useRef(null),r=w.useState({onScrollCapture:sp,onWheelCapture:sp,onTouchMoveCapture:sp}),o=r[0],s=r[1],l=t.forwardProps,c=t.children,u=t.className,h=t.removeScrollBar,p=t.enabled,m=t.shards,y=t.sideCar,x=t.noRelative,b=t.noIsolation,k=t.inert,C=t.allowPinchZoom,N=t.as,M=N===void 0?"div":N,T=t.gapMode,j=Fb(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=y,L=CO([n,e]),I=br(br({},j),o);return w.createElement(w.Fragment,null,p&&w.createElement(P,{sideCar:Vb,removeScrollBar:h,shards:m,noRelative:x,noIsolation:b,inert:k,setCallbacks:s,allowPinchZoom:!!C,lockRef:n,gapMode:T}),l?w.cloneElement(w.Children.only(c),br(br({},I),{ref:L})):w.createElement(M,br({},I,{className:u,ref:L}),c))});kd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};kd.classNames={fullWidth:au,zeroRight:lu};var jO=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function AO(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=jO();return e&&t.setAttribute("nonce",e),t}function RO(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function PO(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var OO=function(){var t=0,e=null;return{add:function(n){t==0&&(e=AO())&&(RO(e,n),PO(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},IO=function(){var t=OO();return function(e,n){w.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},Hb=function(){var t=IO(),e=function(n){var r=n.styles,o=n.dynamic;return t(r,o),null};return e},DO={left:0,top:0,right:0,gap:0},ip=function(t){return parseInt(t||"",10)||0},_O=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[ip(n),ip(r),ip(o)]},LO=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return DO;var e=_O(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])}},zO=Hb(),Ti="data-scroll-locked",$O=function(t,e,n,r){var o=t.left,s=t.top,l=t.right,c=t.gap;return n===void 0&&(n="margin"),`
391
+ .`.concat(wO,` {
392
+ overflow: hidden `).concat(r,`;
393
+ padding-right: `).concat(c,"px ").concat(r,`;
394
+ }
395
+ body[`).concat(Ti,`] {
396
+ overflow: hidden `).concat(r,`;
397
+ overscroll-behavior: contain;
398
+ `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
399
+ padding-left: `.concat(o,`px;
400
+ padding-top: `).concat(s,`px;
401
+ padding-right: `).concat(l,`px;
402
+ margin-left:0;
403
+ margin-top:0;
404
+ margin-right: `).concat(c,"px ").concat(r,`;
405
+ `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
406
+ }
407
+
408
+ .`).concat(lu,` {
409
+ right: `).concat(c,"px ").concat(r,`;
410
+ }
411
+
412
+ .`).concat(au,` {
413
+ margin-right: `).concat(c,"px ").concat(r,`;
414
+ }
415
+
416
+ .`).concat(lu," .").concat(lu,` {
417
+ right: 0 `).concat(r,`;
418
+ }
419
+
420
+ .`).concat(au," .").concat(au,` {
421
+ margin-right: 0 `).concat(r,`;
422
+ }
423
+
424
+ body[`).concat(Ti,`] {
425
+ `).concat(bO,": ").concat(c,`px;
426
+ }
427
+ `)},H0=function(){var t=parseInt(document.body.getAttribute(Ti)||"0",10);return isFinite(t)?t:0},FO=function(){w.useEffect(function(){return document.body.setAttribute(Ti,(H0()+1).toString()),function(){var t=H0()-1;t<=0?document.body.removeAttribute(Ti):document.body.setAttribute(Ti,t.toString())}},[])},BO=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,o=r===void 0?"margin":r;FO();var s=w.useMemo(function(){return LO(o)},[o]);return w.createElement(zO,{styles:$O(s,!e,o,n?"":"!important")})},Zp=!1;if(typeof window<"u")try{var Fc=Object.defineProperty({},"passive",{get:function(){return Zp=!0,!0}});window.addEventListener("test",Fc,Fc),window.removeEventListener("test",Fc,Fc)}catch{Zp=!1}var mi=Zp?{passive:!1}:!1,VO=function(t){return t.tagName==="TEXTAREA"},Wb=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!VO(t)&&n[e]==="visible")},HO=function(t){return Wb(t,"overflowY")},WO=function(t){return Wb(t,"overflowX")},W0=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Ub(t,r);if(o){var s=Kb(t,r),l=s[1],c=s[2];if(l>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},UO=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},KO=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Ub=function(t,e){return t==="v"?HO(e):WO(e)},Kb=function(t,e){return t==="v"?UO(e):KO(e)},qO=function(t,e){return t==="h"&&e==="rtl"?-1:1},GO=function(t,e,n,r,o){var s=qO(t,window.getComputedStyle(e).direction),l=s*r,c=n.target,u=e.contains(c),h=!1,p=l>0,m=0,y=0;do{if(!c)break;var x=Kb(t,c),b=x[0],k=x[1],C=x[2],N=k-C-s*b;(b||N)&&Ub(t,c)&&(m+=N,y+=b);var M=c.parentNode;c=M&&M.nodeType===Node.DOCUMENT_FRAGMENT_NODE?M.host:M}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(p&&Math.abs(m)<1||!p&&Math.abs(y)<1)&&(h=!0),h},Bc=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},U0=function(t){return[t.deltaX,t.deltaY]},K0=function(t){return t&&"current"in t?t.current:t},JO=function(t,e){return t[0]===e[0]&&t[1]===e[1]},YO=function(t){return`
428
+ .block-interactivity-`.concat(t,` {pointer-events: none;}
429
+ .allow-interactivity-`).concat(t,` {pointer-events: all;}
430
+ `)},QO=0,gi=[];function XO(t){var e=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),o=w.useState(QO++)[0],s=w.useState(Hb)[0],l=w.useRef(t);w.useEffect(function(){l.current=t},[t]),w.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var k=vO([t.lockRef.current],(t.shards||[]).map(K0),!0).filter(Boolean);return k.forEach(function(C){return C.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),k.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var c=w.useCallback(function(k,C){if("touches"in k&&k.touches.length===2||k.type==="wheel"&&k.ctrlKey)return!l.current.allowPinchZoom;var N=Bc(k),M=n.current,T="deltaX"in k?k.deltaX:M[0]-N[0],j="deltaY"in k?k.deltaY:M[1]-N[1],P,L=k.target,I=Math.abs(T)>Math.abs(j)?"h":"v";if("touches"in k&&I==="h"&&L.type==="range")return!1;var _=window.getSelection(),$=_&&_.anchorNode,q=$?$===L||$.contains(L):!1;if(q)return!1;var X=W0(I,L);if(!X)return!0;if(X?P=I:(P=I==="v"?"h":"v",X=W0(I,L)),!X)return!1;if(!r.current&&"changedTouches"in k&&(T||j)&&(r.current=P),!P)return!0;var ee=r.current||P;return GO(ee,C,k,ee==="h"?T:j)},[]),u=w.useCallback(function(k){var C=k;if(!(!gi.length||gi[gi.length-1]!==s)){var N="deltaY"in C?U0(C):Bc(C),M=e.current.filter(function(P){return P.name===C.type&&(P.target===C.target||C.target===P.shadowParent)&&JO(P.delta,N)})[0];if(M&&M.should){C.cancelable&&C.preventDefault();return}if(!M){var T=(l.current.shards||[]).map(K0).filter(Boolean).filter(function(P){return P.contains(C.target)}),j=T.length>0?c(C,T[0]):!l.current.noIsolation;j&&C.cancelable&&C.preventDefault()}}},[]),h=w.useCallback(function(k,C,N,M){var T={name:k,delta:C,target:N,should:M,shadowParent:ZO(N)};e.current.push(T),setTimeout(function(){e.current=e.current.filter(function(j){return j!==T})},1)},[]),p=w.useCallback(function(k){n.current=Bc(k),r.current=void 0},[]),m=w.useCallback(function(k){h(k.type,U0(k),k.target,c(k,t.lockRef.current))},[]),y=w.useCallback(function(k){h(k.type,Bc(k),k.target,c(k,t.lockRef.current))},[]);w.useEffect(function(){return gi.push(s),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:y}),document.addEventListener("wheel",u,mi),document.addEventListener("touchmove",u,mi),document.addEventListener("touchstart",p,mi),function(){gi=gi.filter(function(k){return k!==s}),document.removeEventListener("wheel",u,mi),document.removeEventListener("touchmove",u,mi),document.removeEventListener("touchstart",p,mi)}},[]);var x=t.removeScrollBar,b=t.inert;return w.createElement(w.Fragment,null,b?w.createElement(s,{styles:YO(o)}):null,x?w.createElement(BO,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function ZO(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const eI=TO(Vb,XO);var Sd=w.forwardRef(function(t,e){return w.createElement(kd,br({},t,{ref:e,sideCar:eI}))});Sd.classNames=kd.classNames;var tI=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},yi=new WeakMap,Vc=new WeakMap,Hc={},lp=0,qb=function(t){return t&&(t.host||qb(t.parentNode))},nI=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=qb(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})},rI=function(t,e,n,r){var o=nI(e,Array.isArray(t)?t:[t]);Hc[n]||(Hc[n]=new WeakMap);var s=Hc[n],l=[],c=new Set,u=new Set(o),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};o.forEach(h);var p=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(y){if(c.has(y))p(y);else try{var x=y.getAttribute(r),b=x!==null&&x!=="false",k=(yi.get(y)||0)+1,C=(s.get(y)||0)+1;yi.set(y,k),s.set(y,C),l.push(y),k===1&&b&&Vc.set(y,!0),C===1&&y.setAttribute(n,"true"),b||y.setAttribute(r,"true")}catch(N){console.error("aria-hidden: cannot operate on ",y,N)}})};return p(e),c.clear(),lp++,function(){l.forEach(function(m){var y=yi.get(m)-1,x=s.get(m)-1;yi.set(m,y),s.set(m,x),y||(Vc.has(m)||m.removeAttribute(r),Vc.delete(m)),x||m.removeAttribute(n)}),lp--,lp||(yi=new WeakMap,yi=new WeakMap,Vc=new WeakMap,Hc={})}},ng=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),o=tI(t);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),rI(r,o,n,"aria-hidden")):function(){return null}};function oI(t){const e=sI(t),n=w.forwardRef((r,o)=>{const{children:s,...l}=r,c=w.Children.toArray(s),u=c.find(lI);if(u){const h=u.props.children,p=c.map(m=>m===u?w.Children.count(h)>1?w.Children.only(null):w.isValidElement(h)?h.props.children:null:m);return f.jsx(e,{...l,ref:o,children:w.isValidElement(h)?w.cloneElement(h,void 0,p):null})}return f.jsx(e,{...l,ref:o,children:s})});return n.displayName=`${t}.Slot`,n}function sI(t){const e=w.forwardRef((n,r)=>{const{children:o,...s}=n;if(w.isValidElement(o)){const l=cI(o),c=aI(s,o.props);return o.type!==w.Fragment&&(c.ref=r?Yr(r,l):l),w.cloneElement(o,c)}return w.Children.count(o)>1?w.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var iI=Symbol("radix.slottable");function lI(t){return w.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===iI}function aI(t,e){const n={...e};for(const r in e){const o=t[r],s=e[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...c)=>{const u=s(...c);return o(...c),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...t,...n}}function cI(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Cd="Dialog",[Gb]=ur(Cd),[uI,dr]=Gb(Cd),Jb=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:l=!0}=t,c=w.useRef(null),u=w.useRef(null),[h,p]=Fo({prop:r,defaultProp:o??!1,onChange:s,caller:Cd});return f.jsx(uI,{scope:e,triggerRef:c,contentRef:u,contentId:Sr(),titleId:Sr(),descriptionId:Sr(),open:h,onOpenChange:p,onOpenToggle:w.useCallback(()=>p(m=>!m),[p]),modal:l,children:n})};Jb.displayName=Cd;var Yb="DialogTrigger",dI=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=dr(Yb,n),s=Ve(e,o.triggerRef);return f.jsx(Pe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":sg(o.open),...r,ref:s,onClick:fe(t.onClick,o.onOpenToggle)})});dI.displayName=Yb;var rg="DialogPortal",[fI,Qb]=Gb(rg,{forceMount:void 0}),Xb=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:o}=t,s=dr(rg,e);return f.jsx(fI,{scope:e,forceMount:n,children:w.Children.map(r,l=>f.jsx(vn,{present:n||s.open,children:f.jsx(bd,{asChild:!0,container:o,children:l})}))})};Xb.displayName=rg;var xu="DialogOverlay",Zb=w.forwardRef((t,e)=>{const n=Qb(xu,t.__scopeDialog),{forceMount:r=n.forceMount,...o}=t,s=dr(xu,t.__scopeDialog);return s.modal?f.jsx(vn,{present:r||s.open,children:f.jsx(pI,{...o,ref:e})}):null});Zb.displayName=xu;var hI=oI("DialogOverlay.RemoveScroll"),pI=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=dr(xu,n);return f.jsx(Sd,{as:hI,allowPinchZoom:!0,shards:[o.contentRef],children:f.jsx(Pe.div,{"data-state":sg(o.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),As="DialogContent",ek=w.forwardRef((t,e)=>{const n=Qb(As,t.__scopeDialog),{forceMount:r=n.forceMount,...o}=t,s=dr(As,t.__scopeDialog);return f.jsx(vn,{present:r||s.open,children:s.modal?f.jsx(mI,{...o,ref:e}):f.jsx(gI,{...o,ref:e})})});ek.displayName=As;var mI=w.forwardRef((t,e)=>{const n=dr(As,t.__scopeDialog),r=w.useRef(null),o=Ve(e,n.contentRef,r);return w.useEffect(()=>{const s=r.current;if(s)return ng(s)},[]),f.jsx(tk,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:fe(t.onCloseAutoFocus,s=>{var l;s.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:fe(t.onPointerDownOutside,s=>{const l=s.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&s.preventDefault()}),onFocusOutside:fe(t.onFocusOutside,s=>s.preventDefault())})}),gI=w.forwardRef((t,e)=>{const n=dr(As,t.__scopeDialog),r=w.useRef(!1),o=w.useRef(!1);return f.jsx(tk,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var l,c;(l=t.onCloseAutoFocus)==null||l.call(t,s),s.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var u,h;(u=t.onInteractOutside)==null||u.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=s.target;((h=n.triggerRef.current)==null?void 0:h.contains(l))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),tk=w.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...l}=t,c=dr(As,n),u=w.useRef(null),h=Ve(e,u);return tg(),f.jsxs(f.Fragment,{children:[f.jsx(wd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:f.jsx(vd,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":sg(c.open),...l,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(yI,{titleId:c.titleId}),f.jsx(vI,{contentRef:u,descriptionId:c.descriptionId})]})]})}),og="DialogTitle",nk=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=dr(og,n);return f.jsx(Pe.h2,{id:o.titleId,...r,ref:e})});nk.displayName=og;var rk="DialogDescription",ok=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=dr(rk,n);return f.jsx(Pe.p,{id:o.descriptionId,...r,ref:e})});ok.displayName=rk;var sk="DialogClose",ik=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=dr(sk,n);return f.jsx(Pe.button,{type:"button",...r,ref:e,onClick:fe(t.onClick,()=>o.onOpenChange(!1))})});ik.displayName=sk;function sg(t){return t?"open":"closed"}var lk="DialogTitleWarning",[gH,ak]=FP(lk,{contentName:As,titleName:og,docsSlug:"dialog"}),yI=({titleId:t})=>{const e=ak(lk),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
431
+
432
+ If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
433
+
434
+ For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return w.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},xI="DialogDescriptionWarning",vI=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ak(xI).contentName}}.`;return w.useEffect(()=>{var s;const o=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},wI=Jb,bI=Xb,ck=Zb,uk=ek,dk=nk,fk=ok,kI=ik;function SI(t,e){if(t==null)return{};var n={},r=Object.keys(t),o,s;for(s=0;s<r.length;s++)o=r[s],!(e.indexOf(o)>=0)&&(n[o]=t[o]);return n}var CI=["color"],NI=w.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,o=SI(t,CI);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:e}),w.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const xn=wI,EI=bI,hk=w.forwardRef(({className:t,...e},n)=>f.jsx(ck,{ref:n,className:Ee("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));hk.displayName=ck.displayName;const nn=w.forwardRef(({className:t,children:e,hideCloseButton:n,...r},o)=>f.jsxs(EI,{children:[f.jsx(hk,{}),f.jsxs(uk,{ref:o,className:Ee("fixed left-[50%] top-[50%] z-50 grid w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-4 sm:p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",t),...r,children:[e,!n&&f.jsxs(kI,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[f.jsx(NI,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));nn.displayName=uk.displayName;const rn=({className:t,...e})=>f.jsx("div",{className:Ee("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});rn.displayName="DialogHeader";const Nr=({className:t,...e})=>f.jsx("div",{className:Ee("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Nr.displayName="DialogFooter";const on=w.forwardRef(({className:t,...e},n)=>f.jsx(dk,{ref:n,className:Ee("text-lg font-semibold leading-none tracking-tight",t),...e}));on.displayName=dk.displayName;const An=w.forwardRef(({className:t,...e},n)=>f.jsx(fk,{ref:n,className:Ee("text-sm text-muted-foreground",t),...e}));An.displayName=fk.displayName;function q0(t){const e=MI(t),n=w.forwardRef((r,o)=>{const{children:s,...l}=r,c=w.Children.toArray(s),u=c.find(jI);if(u){const h=u.props.children,p=c.map(m=>m===u?w.Children.count(h)>1?w.Children.only(null):w.isValidElement(h)?h.props.children:null:m);return f.jsx(e,{...l,ref:o,children:w.isValidElement(h)?w.cloneElement(h,void 0,p):null})}return f.jsx(e,{...l,ref:o,children:s})});return n.displayName=`${t}.Slot`,n}function MI(t){const e=w.forwardRef((n,r)=>{const{children:o,...s}=n;if(w.isValidElement(o)){const l=RI(o),c=AI(s,o.props);return o.type!==w.Fragment&&(c.ref=r?Yr(r,l):l),w.cloneElement(o,c)}return w.Children.count(o)>1?w.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var TI=Symbol("radix.slottable");function jI(t){return w.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===TI}function AI(t,e){const n={...e};for(const r in e){const o=t[r],s=e[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...c)=>{const u=s(...c);return o(...c),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...t,...n}}function RI(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function ig(t){const e=t+"CollectionProvider",[n,r]=ur(e),[o,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),l=k=>{const{scope:C,children:N}=k,M=Yt.useRef(null),T=Yt.useRef(new Map).current;return f.jsx(o,{scope:C,itemMap:T,collectionRef:M,children:N})};l.displayName=e;const c=t+"CollectionSlot",u=q0(c),h=Yt.forwardRef((k,C)=>{const{scope:N,children:M}=k,T=s(c,N),j=Ve(C,T.collectionRef);return f.jsx(u,{ref:j,children:M})});h.displayName=c;const p=t+"CollectionItemSlot",m="data-radix-collection-item",y=q0(p),x=Yt.forwardRef((k,C)=>{const{scope:N,children:M,...T}=k,j=Yt.useRef(null),P=Ve(C,j),L=s(p,N);return Yt.useEffect(()=>(L.itemMap.set(j,{ref:j,...T}),()=>void L.itemMap.delete(j))),f.jsx(y,{[m]:"",ref:P,children:M})});x.displayName=p;function b(k){const C=s(t+"CollectionConsumer",k);return Yt.useCallback(()=>{const M=C.collectionRef.current;if(!M)return[];const T=Array.from(M.querySelectorAll(`[${m}]`));return Array.from(C.itemMap.values()).sort((L,I)=>T.indexOf(L.ref.current)-T.indexOf(I.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:l,Slot:h,ItemSlot:x},b,r]}var PI=w.createContext(void 0);function va(t){const e=w.useContext(PI);return t||e||"ltr"}var ap="rovingFocusGroup.onEntryFocus",OI={bubbles:!1,cancelable:!0},wa="RovingFocusGroup",[em,pk,II]=ig(wa),[DI,Nd]=ur(wa,[II]),[_I,LI]=DI(wa),mk=w.forwardRef((t,e)=>f.jsx(em.Provider,{scope:t.__scopeRovingFocusGroup,children:f.jsx(em.Slot,{scope:t.__scopeRovingFocusGroup,children:f.jsx(zI,{...t,ref:e})})}));mk.displayName=wa;var zI=w.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:p=!1,...m}=t,y=w.useRef(null),x=Ve(e,y),b=va(s),[k,C]=Fo({prop:l,defaultProp:c??null,onChange:u,caller:wa}),[N,M]=w.useState(!1),T=Ot(h),j=pk(n),P=w.useRef(!1),[L,I]=w.useState(0);return w.useEffect(()=>{const _=y.current;if(_)return _.addEventListener(ap,T),()=>_.removeEventListener(ap,T)},[T]),f.jsx(_I,{scope:n,orientation:r,dir:b,loop:o,currentTabStopId:k,onItemFocus:w.useCallback(_=>C(_),[C]),onItemShiftTab:w.useCallback(()=>M(!0),[]),onFocusableItemAdd:w.useCallback(()=>I(_=>_+1),[]),onFocusableItemRemove:w.useCallback(()=>I(_=>_-1),[]),children:f.jsx(Pe.div,{tabIndex:N||L===0?-1:0,"data-orientation":r,...m,ref:x,style:{outline:"none",...t.style},onMouseDown:fe(t.onMouseDown,()=>{P.current=!0}),onFocus:fe(t.onFocus,_=>{const $=!P.current;if(_.target===_.currentTarget&&$&&!N){const q=new CustomEvent(ap,OI);if(_.currentTarget.dispatchEvent(q),!q.defaultPrevented){const X=j().filter(re=>re.focusable),ee=X.find(re=>re.active),K=X.find(re=>re.id===k),ne=[ee,K,...X].filter(Boolean).map(re=>re.ref.current);xk(ne,p)}}P.current=!1}),onBlur:fe(t.onBlur,()=>M(!1))})})}),gk="RovingFocusGroupItem",yk=w.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:l,...c}=t,u=Sr(),h=s||u,p=LI(gk,n),m=p.currentTabStopId===h,y=pk(n),{onFocusableItemAdd:x,onFocusableItemRemove:b,currentTabStopId:k}=p;return w.useEffect(()=>{if(r)return x(),()=>b()},[r,x,b]),f.jsx(em.ItemSlot,{scope:n,id:h,focusable:r,active:o,children:f.jsx(Pe.span,{tabIndex:m?0:-1,"data-orientation":p.orientation,...c,ref:e,onMouseDown:fe(t.onMouseDown,C=>{r?p.onItemFocus(h):C.preventDefault()}),onFocus:fe(t.onFocus,()=>p.onItemFocus(h)),onKeyDown:fe(t.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){p.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const N=BI(C,p.orientation,p.dir);if(N!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let T=y().filter(j=>j.focusable).map(j=>j.ref.current);if(N==="last")T.reverse();else if(N==="prev"||N==="next"){N==="prev"&&T.reverse();const j=T.indexOf(C.currentTarget);T=p.loop?VI(T,j+1):T.slice(j+1)}setTimeout(()=>xk(T))}}),children:typeof l=="function"?l({isCurrentTabStop:m,hasTabStop:k!=null}):l})})});yk.displayName=gk;var $I={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function FI(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function BI(t,e,n){const r=FI(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return $I[r]}function xk(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function VI(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var vk=mk,wk=yk,Ed="Tabs",[HI]=ur(Ed,[Nd]),bk=Nd(),[WI,lg]=HI(Ed),kk=w.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:l="horizontal",dir:c,activationMode:u="automatic",...h}=t,p=va(c),[m,y]=Fo({prop:r,onChange:o,defaultProp:s??"",caller:Ed});return f.jsx(WI,{scope:n,baseId:Sr(),value:m,onValueChange:y,orientation:l,dir:p,activationMode:u,children:f.jsx(Pe.div,{dir:p,"data-orientation":l,...h,ref:e})})});kk.displayName=Ed;var Sk="TabsList",Ck=w.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...o}=t,s=lg(Sk,n),l=bk(n);return f.jsx(vk,{asChild:!0,...l,orientation:s.orientation,dir:s.dir,loop:r,children:f.jsx(Pe.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:e})})});Ck.displayName=Sk;var Nk="TabsTrigger",Ek=w.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=t,l=lg(Nk,n),c=bk(n),u=jk(l.baseId,r),h=Ak(l.baseId,r),p=r===l.value;return f.jsx(wk,{asChild:!0,...c,focusable:!o,active:p,children:f.jsx(Pe.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":h,"data-state":p?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...s,ref:e,onMouseDown:fe(t.onMouseDown,m=>{!o&&m.button===0&&m.ctrlKey===!1?l.onValueChange(r):m.preventDefault()}),onKeyDown:fe(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&l.onValueChange(r)}),onFocus:fe(t.onFocus,()=>{const m=l.activationMode!=="manual";!p&&!o&&m&&l.onValueChange(r)})})})});Ek.displayName=Nk;var Mk="TabsContent",Tk=w.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...l}=t,c=lg(Mk,n),u=jk(c.baseId,r),h=Ak(c.baseId,r),p=r===c.value,m=w.useRef(p);return w.useEffect(()=>{const y=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(y)},[]),f.jsx(vn,{present:o||p,children:({present:y})=>f.jsx(Pe.div,{"data-state":p?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!y,id:h,tabIndex:0,...l,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:y&&s})})});Tk.displayName=Mk;function jk(t,e){return`${t}-trigger-${e}`}function Ak(t,e){return`${t}-content-${e}`}var UI=kk,Rk=Ck,Pk=Ek,Ok=Tk;const Ik=UI,ag=w.forwardRef(({className:t,...e},n)=>f.jsx(Rk,{ref:n,className:Ee("inline-flex min-h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));ag.displayName=Rk.displayName;const To=w.forwardRef(({className:t,...e},n)=>f.jsx(Pk,{ref:n,className:Ee("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...e}));To.displayName=Pk.displayName;const jo=w.forwardRef(({className:t,...e},n)=>f.jsx(Ok,{ref:n,className:Ee("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));jo.displayName=Ok.displayName;const Vr="<paste-your-api-key-here>";function KI({isOpen:t,onClose:e,nestId:n,nestName:r}){const{authenticated:o,authMode:s}=Vi(),l=typeof window<"u"?window.location.origin:"http://localhost:3838",c=`${l}/nests/${n}/mcp`,[u,h]=w.useState(null),[p,m]=w.useState(null),[y,x]=w.useState(null),[b,k]=w.useState(null),[C,N]=w.useState(null),[M,T]=w.useState(null);w.useEffect(()=>{if(!t){T(null);return}if(!o||s==="open"){h(!1);return}let X=!1;return(async()=>{N("loading");try{const{keys:ee}=await jj();if(X)return;const K=ee[0];h(!!K),m((K==null?void 0:K.key_prefix)??null)}catch(ee){X||(T(ee.message),h(!1))}finally{X||N(null)}})(),()=>{X=!0}},[t,o,s]);const j=async()=>{T(null),N("mint");try{const{api_key:X,key_prefix:ee}=await Aj({nest_id:n,label:`connect:${cp(r)}`});m(ee),h(!0),k("generated"),x(X)}catch(X){T(X.message)}finally{N(null)}},P=async()=>{T(null),N("rotate");try{const{api_key:X,key_prefix:ee}=await Rj({nest_id:n,label:`connect:${cp(r)}`});m(ee),h(!0),k("rotated"),x(X)}catch(X){T(X.message)}finally{N(null)}},L=()=>{x(null),k(null)},I=JSON.stringify({mcpServers:{[cp(r)]:{type:"http",url:c,headers:{Authorization:`Bearer ${Vr}`}}}},null,2),_=`ctx --server ${l} --nest ${n} --key ${Vr} query "type:document"`,$=s==="open",q=!o&&s==="key";return f.jsxs(f.Fragment,{children:[f.jsx(xn,{open:t,onOpenChange:e,children:f.jsxs(nn,{className:"sm:max-w-[640px] max-h-[85vh] flex flex-col",children:[f.jsxs(rn,{children:[f.jsxs(on,{children:["Connect to ",r]}),f.jsx(An,{children:"Point your tools at this nest to read, write, and query context."})]}),q&&f.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 p-2 text-xs text-amber-900",children:[f.jsx(Hn,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),f.jsx("span",{children:"You're not logged in. Login from the header to generate an API key for external clients."})]}),$&&f.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 p-2 text-xs text-amber-900",children:[f.jsx(Hn,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),f.jsxs("span",{children:["Server is in ",f.jsx("strong",{children:"open"})," mode — anyone on the network can read/write without a key. The snippets below omit the Authorization header."]})]}),M&&f.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-red-200 bg-red-50 p-2 text-xs text-red-900",children:[f.jsx(Hn,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),f.jsx("span",{children:M})]}),o&&!$&&f.jsxs("div",{className:"rounded-md border bg-card p-3 space-y-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[f.jsx(BA,{className:"h-3.5 w-3.5"}),f.jsx("span",{className:"font-medium",children:"External-client API key"})]}),u?f.jsx(xe,{variant:"outline",size:"sm",onClick:P,disabled:C!==null,children:C==="rotate"?f.jsx(jt,{className:"h-3.5 w-3.5 animate-spin"}):f.jsxs(f.Fragment,{children:[f.jsx(mu,{className:"h-3.5 w-3.5 mr-1"}),"Rotate"]})}):f.jsx(xe,{size:"sm",onClick:j,disabled:C!==null,children:C==="mint"?f.jsx(jt,{className:"h-3.5 w-3.5 animate-spin"}):"Generate Key"})]}),u&&f.jsxs("p",{className:"text-xs text-muted-foreground",children:["You have a key on file (",f.jsx("code",{className:"font-mono",children:p}),"). The plaintext can't be retrieved — click ",f.jsx("strong",{children:"Rotate"})," ","to mint a fresh one (the old key is invalidated immediately)."]}),!u&&f.jsx("p",{className:"text-xs text-muted-foreground",children:"No key yet. Generate one to use the snippets below. You'll see the plaintext exactly once."})]}),f.jsx("div",{className:"flex-1 overflow-y-auto",children:f.jsxs(Ik,{defaultValue:"hootie",className:"w-full",children:[f.jsxs(ag,{className:"grid w-full grid-cols-4",children:[f.jsxs(To,{value:"hootie",children:[f.jsx(rb,{className:"h-3.5 w-3.5 mr-1"}),"Hootie"]}),f.jsxs(To,{value:"claude",children:[f.jsx(cb,{className:"h-3.5 w-3.5 mr-1"}),"Claude"]}),f.jsx(To,{value:"mcp",children:"MCP"}),f.jsxs(To,{value:"cli",children:[f.jsx(hb,{className:"h-3.5 w-3.5 mr-1"}),"CLI"]})]}),f.jsxs(jo,{value:"hootie",className:"space-y-4 pt-4",children:[f.jsxs("div",{children:[f.jsxs("p",{className:"text-sm mb-3",children:["In Hootie, open"," ",f.jsx("strong",{children:"Settings → ContextNest Vault → Remote Server"})," ","and paste:"]}),f.jsx(xi,{label:"Server URL",value:l}),!$&&f.jsx(xi,{label:"API Key (paste your generated key)",value:Vr})]}),f.jsxs("ol",{className:"text-xs text-muted-foreground space-y-1 list-decimal list-inside",children:[f.jsx("li",{children:"Open Hootie"}),f.jsx("li",{children:"Click the gear icon (Settings)"}),f.jsx("li",{children:"Scroll to ContextNest Vault"}),f.jsx("li",{children:'Switch tab to "Remote Server"'}),f.jsxs("li",{children:["Paste the URL",!$&&" + your API Key"," ","above, click Test Vault"]})]})]}),f.jsxs(jo,{value:"claude",className:"space-y-4 pt-4",children:[f.jsxs("div",{children:[f.jsxs("p",{className:"text-sm mb-3",children:["Add this to your"," ",f.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"claude_desktop_config.json"}),!$&&f.jsxs(f.Fragment,{children:[" ","(replace"," ",f.jsx("code",{className:"text-[11px] bg-muted px-1 rounded",children:Vr})," ","with your generated key):"]})]}),f.jsx(xi,{label:"Config",value:I,multiline:!0}),f.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Location:"," ",f.jsx("code",{className:"text-[10px]",children:"%APPDATA%\\Claude\\claude_desktop_config.json"})," ","(Windows) or"," ",f.jsx("code",{className:"text-[10px]",children:"~/Library/Application Support/Claude/claude_desktop_config.json"})," ","(Mac)"]})]}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"Restart Claude Desktop after editing. The nest's 16 context tools will appear in the tools panel."})]}),f.jsxs(jo,{value:"mcp",className:"space-y-4 pt-4",children:[f.jsxs("div",{children:[f.jsxs("p",{className:"text-sm mb-3",children:["Streamable HTTP MCP endpoint with 16 tools (9 content + 7 governance).",!$&&f.jsxs(f.Fragment,{children:[" ","Pass your API key in an"," ",f.jsx("code",{className:"text-[11px] bg-muted px-1 rounded",children:"Authorization"})," ","header."]})]}),f.jsx(xi,{label:"MCP Endpoint",value:c}),!$&&f.jsx(xi,{label:"Authorization header",value:`Bearer ${Vr}`})]}),f.jsxs("div",{className:"text-xs text-muted-foreground space-y-2",children:[f.jsx("p",{className:"font-medium",children:"Available tools:"}),f.jsxs("div",{className:"grid grid-cols-2 gap-x-4 font-mono text-[11px]",children:[f.jsx("span",{children:"context_init"}),f.jsx("span",{children:"context_stewards"}),f.jsx("span",{children:"context_overview"}),f.jsx("span",{children:"context_review_queue"}),f.jsx("span",{children:"context_search"}),f.jsx("span",{children:"context_submit_review"}),f.jsx("span",{children:"context_query"}),f.jsx("span",{children:"context_approve"}),f.jsx("span",{children:"context_get"}),f.jsx("span",{children:"context_reject"}),f.jsx("span",{children:"context_list"}),f.jsx("span",{children:"context_versions"}),f.jsx("span",{children:"context_resolve"}),f.jsx("span",{children:"context_assign_steward"}),f.jsx("span",{children:"context_create"}),f.jsx("span",{children:"context_update"})]})]})]}),f.jsxs(jo,{value:"cli",className:"space-y-4 pt-4",children:[f.jsxs("div",{children:[f.jsxs("p",{className:"text-sm mb-3",children:["Use"," ",f.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"ctx"})," ","pointed at this server:"]}),f.jsx(xi,{label:"Example query",value:_})]}),f.jsxs("div",{className:"text-xs text-muted-foreground space-y-2",children:[f.jsx("p",{className:"font-medium",children:"Common commands:"}),f.jsxs("div",{className:"space-y-1 font-mono text-[11px]",children:[f.jsxs("div",{children:["ctx --server ",l," --nest ",n,!$&&` --key ${Vr}`," ",'query "#architecture"']}),f.jsxs("div",{children:["ctx --server ",l," --nest ",n,!$&&` --key ${Vr}`,' add "My Doc" content.md']}),f.jsxs("div",{children:["ctx --server ",l," --nest ",n,!$&&` --key ${Vr}`," ","publish"]})]}),f.jsxs("p",{className:"pt-2",children:["Install:"," ",f.jsx("code",{className:"text-[11px] bg-muted px-1 py-0.5 rounded",children:"npm i -g @promptowl/contextnest-cli"})]})]})]})]})}),f.jsx("div",{className:"border-t pt-3",children:f.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[f.jsx("span",{children:"Nest ID:"}),f.jsx("code",{className:"flex-1 bg-muted px-2 py-1 rounded text-[11px] font-mono truncate",children:n}),f.jsx(Dk,{value:n})]})})]})}),y&&b&&f.jsx(qI,{apiKey:y,kind:b,onClose:L})]})}function qI({apiKey:t,kind:e,onClose:n}){const[r,o]=w.useState(!1),s=async()=>{try{await navigator.clipboard.writeText(t),o(!0),setTimeout(()=>o(!1),1500)}catch{}};return f.jsx(xn,{open:!0,onOpenChange:n,children:f.jsxs(nn,{className:"sm:max-w-[480px]",children:[f.jsxs(rn,{children:[f.jsxs(on,{className:"flex items-center gap-2",children:[f.jsx(gR,{className:"h-4 w-4 text-amber-700"}),e==="generated"?"API key generated":"API key rotated"]}),f.jsxs(An,{children:["This key is shown ",f.jsx("strong",{children:"only once"}),". Copy it now and store it somewhere safe (password manager, secrets vault). It cannot be retrieved again — if you lose it, rotate to mint a new one.",e==="rotated"&&f.jsxs(f.Fragment,{children:[" ","Your previous key has been invalidated and will stop working immediately."]})]})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("code",{className:"flex-1 bg-muted px-3 py-2 rounded text-xs font-mono break-all",children:t}),f.jsx(xe,{size:"sm",variant:"outline",onClick:s,children:r?f.jsx(qo,{className:"h-3.5 w-3.5 text-green-600"}):f.jsx(ya,{className:"h-3.5 w-3.5"})})]}),f.jsxs("p",{className:"text-xs text-muted-foreground",children:["Paste it into Hootie / Claude Desktop / CLI wherever the snippets in the Connect dialog show"," ",f.jsx("code",{className:"text-[11px]",children:Vr}),"."]})]}),f.jsx("div",{className:"flex justify-end pt-2",children:f.jsx(xe,{onClick:n,children:"I've saved it — close"})})]})})}function xi({label:t,value:e,multiline:n}){return f.jsxs("div",{className:"mb-3",children:[f.jsxs("div",{className:"flex items-center justify-between mb-1",children:[f.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:t}),f.jsx(Dk,{value:e})]}),f.jsx("pre",{className:`${n?"p-3":"px-3 py-2"} bg-muted rounded text-xs font-mono ${n?"whitespace-pre overflow-x-auto":"truncate"}`,children:e})]})}function Dk({value:t}){const[e,n]=w.useState(!1),r=async()=>{try{await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),1500)}catch{}};return f.jsx(xe,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:r,children:e?f.jsx(qo,{className:"h-3 w-3 text-green-600"}):f.jsx(ya,{className:"h-3 w-3"})})}function cp(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"nest"}function cg(t){const e=w.useRef({value:t,previous:t});return w.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function ug(t){const[e,n]=w.useState(void 0);return bt(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let l,c;if("borderBoxSize"in s){const u=s.borderBoxSize,h=Array.isArray(u)?u[0]:u;l=h.inlineSize,c=h.blockSize}else l=t.offsetWidth,c=t.offsetHeight;n({width:l,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var Md="Switch",[GI]=ur(Md),[JI,YI]=GI(Md),_k=w.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:s,required:l,disabled:c,value:u="on",onCheckedChange:h,form:p,...m}=t,[y,x]=w.useState(null),b=Ve(e,T=>x(T)),k=w.useRef(!1),C=y?p||!!y.closest("form"):!0,[N,M]=Fo({prop:o,defaultProp:s??!1,onChange:h,caller:Md});return f.jsxs(JI,{scope:n,checked:N,disabled:c,children:[f.jsx(Pe.button,{type:"button",role:"switch","aria-checked":N,"aria-required":l,"data-state":Fk(N),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:b,onClick:fe(t.onClick,T=>{M(j=>!j),C&&(k.current=T.isPropagationStopped(),k.current||T.stopPropagation())})}),C&&f.jsx($k,{control:y,bubbles:!k.current,name:r,value:u,checked:N,required:l,disabled:c,form:p,style:{transform:"translateX(-100%)"}})]})});_k.displayName=Md;var Lk="SwitchThumb",zk=w.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,o=YI(Lk,n);return f.jsx(Pe.span,{"data-state":Fk(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:e})});zk.displayName=Lk;var QI="SwitchBubbleInput",$k=w.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...o},s)=>{const l=w.useRef(null),c=Ve(l,s),u=cg(n),h=ug(e);return w.useEffect(()=>{const p=l.current;if(!p)return;const m=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&x){const b=new Event("click",{bubbles:r});x.call(p,n),p.dispatchEvent(b)}},[u,n,r]),f.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:c,style:{...o.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});$k.displayName=QI;function Fk(t){return t?"checked":"unchecked"}var Bk=_k,XI=zk;const Vk=w.forwardRef(({className:t,...e},n)=>f.jsx(Bk,{className:Ee("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-lg border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:f.jsx(XI,{className:Ee("pointer-events-none block h-4 w-4 rounded-lg bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Vk.displayName=Bk.displayName;const ZI=xd("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",warning:"border-warning/50 text-warning dark:border-warning [&>svg]:text-warning"}},defaultVariants:{variant:"default"}}),ir=w.forwardRef(({className:t,variant:e,...n},r)=>f.jsx("div",{ref:r,role:"alert",className:Ee(ZI({variant:e}),t),...n}));ir.displayName="Alert";const eD=w.forwardRef(({className:t,...e},n)=>f.jsx("h5",{ref:n,className:Ee("mb-1 font-medium leading-none tracking-tight",t),...e}));eD.displayName="AlertTitle";const lr=w.forwardRef(({className:t,...e},n)=>f.jsx("div",{ref:n,className:Ee("text-sm [&_p]:leading-relaxed",t),...e}));lr.displayName="AlertDescription";function tD({nestId:t,nestName:e,stewardshipEnabled:n,onClose:r,onChanged:o}){const[s,l]=w.useState(n),[c,u]=w.useState(!1),[h,p]=w.useState(null),m=async()=>{if(s===n){r();return}u(!0),p(null);try{if((await Pj(t,{stewardship_enabled:s})).stewardship_enabled!==s){p("Server did not accept the change. You may not have permission to change this setting."),u(!1);return}o()}catch(y){p(y.message),u(!1)}};return f.jsx(xn,{open:!0,onOpenChange:r,children:f.jsxs(nn,{className:"sm:max-w-[500px]",children:[f.jsxs(rn,{children:[f.jsxs(on,{children:["Settings: ",e]}),f.jsx(An,{children:"Admin controls for this nest. Changes apply to all future documents."})]}),f.jsxs("div",{className:"space-y-4 py-2",children:[h&&f.jsxs(ir,{variant:"destructive",children:[f.jsx(Hn,{className:"h-4 w-4"}),f.jsx(lr,{children:h})]}),f.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[f.jsxs("div",{className:"flex items-start justify-between gap-4",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsxs(yt,{className:"flex items-center gap-2 text-sm font-medium",children:[f.jsx(En,{className:"h-4 w-4"}),"Stewardship & Approval Workflow"]}),f.jsxs("p",{className:"text-xs text-muted-foreground",children:["Require steward approval before documents become AI-ready. New documents will start as ",f.jsx("strong",{children:"drafts"}),"."]})]}),f.jsx(Vk,{checked:s,onCheckedChange:l})]}),!s&&f.jsxs("div",{className:"flex items-start gap-2 text-xs text-muted-foreground pt-2 border-t",children:[f.jsx(Jp,{className:"h-3.5 w-3.5 mt-0.5 flex-shrink-0"}),f.jsxs("div",{children:[f.jsx("strong",{className:"text-foreground",children:"Currently off."})," New documents are auto-approved and immediately available to AI. Versioning is still on — every edit creates a new version."]})]}),s&&f.jsxs("div",{className:"flex items-start gap-2 text-xs text-muted-foreground pt-2 border-t",children:[f.jsx(Jp,{className:"h-3.5 w-3.5 mt-0.5 flex-shrink-0"}),f.jsxs("div",{children:[f.jsx("strong",{className:"text-foreground",children:"When enabled:"})," New documents start as drafts. Assigned stewards must approve before they're available to AI queries. Existing approved documents stay approved."]})]})]})]}),f.jsxs(Nr,{children:[f.jsx(xe,{variant:"outline",onClick:r,disabled:c,children:"Cancel"}),f.jsx(xe,{onClick:m,disabled:c,children:c?f.jsx(jt,{className:"h-4 w-4 animate-spin"}):"Save Settings"})]})]})})}function tm(t,[e,n]){return Math.min(n,Math.max(e,t))}const nD=["top","right","bottom","left"],Bo=Math.min,Nn=Math.max,vu=Math.round,Wc=Math.floor,Cr=t=>({x:t,y:t}),rD={left:"right",right:"left",bottom:"top",top:"bottom"};function nm(t,e,n){return Nn(t,Bo(e,n))}function Gr(t,e){return typeof t=="function"?t(e):t}function Jr(t){return t.split("-")[0]}function Hi(t){return t.split("-")[1]}function dg(t){return t==="x"?"y":"x"}function fg(t){return t==="y"?"height":"width"}function kr(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function hg(t){return dg(kr(t))}function oD(t,e,n){n===void 0&&(n=!1);const r=Hi(t),o=hg(t),s=fg(o);let l=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(l=wu(l)),[l,wu(l)]}function sD(t){const e=wu(t);return[rm(t),e,rm(e)]}function rm(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const G0=["left","right"],J0=["right","left"],iD=["top","bottom"],lD=["bottom","top"];function aD(t,e,n){switch(t){case"top":case"bottom":return n?e?J0:G0:e?G0:J0;case"left":case"right":return e?iD:lD;default:return[]}}function cD(t,e,n,r){const o=Hi(t);let s=aD(Jr(t),n==="start",r);return o&&(s=s.map(l=>l+"-"+o),e&&(s=s.concat(s.map(rm)))),s}function wu(t){const e=Jr(t);return rD[e]+t.slice(e.length)}function uD(t){return{top:0,right:0,bottom:0,left:0,...t}}function Hk(t){return typeof t!="number"?uD(t):{top:t,right:t,bottom:t,left:t}}function bu(t){const{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 Y0(t,e,n){let{reference:r,floating:o}=t;const s=kr(e),l=hg(e),c=fg(l),u=Jr(e),h=s==="y",p=r.x+r.width/2-o.width/2,m=r.y+r.height/2-o.height/2,y=r[c]/2-o[c]/2;let x;switch(u){case"top":x={x:p,y:r.y-o.height};break;case"bottom":x={x:p,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:m};break;case"left":x={x:r.x-o.width,y:m};break;default:x={x:r.x,y:r.y}}switch(Hi(e)){case"start":x[l]-=y*(n&&h?-1:1);break;case"end":x[l]+=y*(n&&h?-1:1);break}return x}async function dD(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:s,rects:l,elements:c,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:y=!1,padding:x=0}=Gr(e,t),b=Hk(x),C=c[y?m==="floating"?"reference":"floating":m],N=bu(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(C)))==null||n?C:C.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:h,rootBoundary:p,strategy:u})),M=m==="floating"?{x:r,y:o,width:l.floating.width,height:l.floating.height}:l.reference,T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),j=await(s.isElement==null?void 0:s.isElement(T))?await(s.getScale==null?void 0:s.getScale(T))||{x:1,y:1}:{x:1,y:1},P=bu(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:M,offsetParent:T,strategy:u}):M);return{top:(N.top-P.top+b.top)/j.y,bottom:(P.bottom-N.bottom+b.bottom)/j.y,left:(N.left-P.left+b.left)/j.x,right:(P.right-N.right+b.right)/j.x}}const fD=50,hD=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:l}=n,c=l.detectOverflow?l:{...l,detectOverflow:dD},u=await(l.isRTL==null?void 0:l.isRTL(e));let h=await l.getElementRects({reference:t,floating:e,strategy:o}),{x:p,y:m}=Y0(h,r,u),y=r,x=0;const b={};for(let k=0;k<s.length;k++){const C=s[k];if(!C)continue;const{name:N,fn:M}=C,{x:T,y:j,data:P,reset:L}=await M({x:p,y:m,initialPlacement:r,placement:y,strategy:o,middlewareData:b,rects:h,platform:c,elements:{reference:t,floating:e}});p=T??p,m=j??m,b[N]={...b[N],...P},L&&x<fD&&(x++,typeof L=="object"&&(L.placement&&(y=L.placement),L.rects&&(h=L.rects===!0?await l.getElementRects({reference:t,floating:e,strategy:o}):L.rects),{x:p,y:m}=Y0(h,y,u)),k=-1)}return{x:p,y:m,placement:y,strategy:o,middlewareData:b}},pD=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:o,rects:s,platform:l,elements:c,middlewareData:u}=e,{element:h,padding:p=0}=Gr(t,e)||{};if(h==null)return{};const m=Hk(p),y={x:n,y:r},x=hg(o),b=fg(x),k=await l.getDimensions(h),C=x==="y",N=C?"top":"left",M=C?"bottom":"right",T=C?"clientHeight":"clientWidth",j=s.reference[b]+s.reference[x]-y[x]-s.floating[b],P=y[x]-s.reference[x],L=await(l.getOffsetParent==null?void 0:l.getOffsetParent(h));let I=L?L[T]:0;(!I||!await(l.isElement==null?void 0:l.isElement(L)))&&(I=c.floating[T]||s.floating[b]);const _=j/2-P/2,$=I/2-k[b]/2-1,q=Bo(m[N],$),X=Bo(m[M],$),ee=q,K=I-k[b]-X,ie=I/2-k[b]/2+_,ne=nm(ee,ie,K),re=!u.arrow&&Hi(o)!=null&&ie!==ne&&s.reference[b]/2-(ie<ee?q:X)-k[b]/2<0,ae=re?ie<ee?ie-ee:ie-K:0;return{[x]:y[x]+ae,data:{[x]:ne,centerOffset:ie-ne-ae,...re&&{alignmentOffset:ae}},reset:re}}}),mD=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:s,rects:l,initialPlacement:c,platform:u,elements:h}=e,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:y,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:k=!0,...C}=Gr(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const N=Jr(o),M=kr(c),T=Jr(c)===c,j=await(u.isRTL==null?void 0:u.isRTL(h.floating)),P=y||(T||!k?[wu(c)]:sD(c)),L=b!=="none";!y&&L&&P.push(...cD(c,k,b,j));const I=[c,...P],_=await u.detectOverflow(e,C),$=[];let q=((r=s.flip)==null?void 0:r.overflows)||[];if(p&&$.push(_[N]),m){const ie=oD(o,l,j);$.push(_[ie[0]],_[ie[1]])}if(q=[...q,{placement:o,overflows:$}],!$.every(ie=>ie<=0)){var X,ee;const ie=(((X=s.flip)==null?void 0:X.index)||0)+1,ne=I[ie];if(ne&&(!(m==="alignment"?M!==kr(ne):!1)||q.every(H=>kr(H.placement)===M?H.overflows[0]>0:!0)))return{data:{index:ie,overflows:q},reset:{placement:ne}};let re=(ee=q.filter(ae=>ae.overflows[0]<=0).sort((ae,H)=>ae.overflows[1]-H.overflows[1])[0])==null?void 0:ee.placement;if(!re)switch(x){case"bestFit":{var K;const ae=(K=q.filter(H=>{if(L){const W=kr(H.placement);return W===M||W==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(W=>W>0).reduce((W,B)=>W+B,0)]).sort((H,W)=>H[1]-W[1])[0])==null?void 0:K[0];ae&&(re=ae);break}case"initialPlacement":re=c;break}if(o!==re)return{reset:{placement:re}}}return{}}}};function Q0(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function X0(t){return nD.some(e=>t[e]>=0)}const gD=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:o="referenceHidden",...s}=Gr(t,e);switch(o){case"referenceHidden":{const l=await r.detectOverflow(e,{...s,elementContext:"reference"}),c=Q0(l,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:X0(c)}}}case"escaped":{const l=await r.detectOverflow(e,{...s,altBoundary:!0}),c=Q0(l,n.floating);return{data:{escapedOffsets:c,escaped:X0(c)}}}default:return{}}}}},Wk=new Set(["left","top"]);async function yD(t,e){const{placement:n,platform:r,elements:o}=t,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),l=Jr(n),c=Hi(n),u=kr(n)==="y",h=Wk.has(l)?-1:1,p=s&&u?-1:1,m=Gr(e,t);let{mainAxis:y,crossAxis:x,alignmentAxis:b}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof b=="number"&&(x=c==="end"?b*-1:b),u?{x:x*p,y:y*h}:{x:y*h,y:x*p}}const xD=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:s,placement:l,middlewareData:c}=e,u=await yD(e,t);return l===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:s+u.y,data:{...u,placement:l}}}}},vD=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o,platform:s}=e,{mainAxis:l=!0,crossAxis:c=!1,limiter:u={fn:N=>{let{x:M,y:T}=N;return{x:M,y:T}}},...h}=Gr(t,e),p={x:n,y:r},m=await s.detectOverflow(e,h),y=kr(Jr(o)),x=dg(y);let b=p[x],k=p[y];if(l){const N=x==="y"?"top":"left",M=x==="y"?"bottom":"right",T=b+m[N],j=b-m[M];b=nm(T,b,j)}if(c){const N=y==="y"?"top":"left",M=y==="y"?"bottom":"right",T=k+m[N],j=k-m[M];k=nm(T,k,j)}const C=u.fn({...e,[x]:b,[y]:k});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[x]:l,[y]:c}}}}}},wD=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:o,rects:s,middlewareData:l}=e,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=Gr(t,e),p={x:n,y:r},m=kr(o),y=dg(m);let x=p[y],b=p[m];const k=Gr(c,e),C=typeof k=="number"?{mainAxis:k,crossAxis:0}:{mainAxis:0,crossAxis:0,...k};if(u){const T=y==="y"?"height":"width",j=s.reference[y]-s.floating[T]+C.mainAxis,P=s.reference[y]+s.reference[T]-C.mainAxis;x<j?x=j:x>P&&(x=P)}if(h){var N,M;const T=y==="y"?"width":"height",j=Wk.has(Jr(o)),P=s.reference[m]-s.floating[T]+(j&&((N=l.offset)==null?void 0:N[m])||0)+(j?0:C.crossAxis),L=s.reference[m]+s.reference[T]+(j?0:((M=l.offset)==null?void 0:M[m])||0)-(j?C.crossAxis:0);b<P?b=P:b>L&&(b=L)}return{[y]:x,[m]:b}}}},bD=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:o,rects:s,platform:l,elements:c}=e,{apply:u=()=>{},...h}=Gr(t,e),p=await l.detectOverflow(e,h),m=Jr(o),y=Hi(o),x=kr(o)==="y",{width:b,height:k}=s.floating;let C,N;m==="top"||m==="bottom"?(C=m,N=y===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(N=m,C=y==="end"?"top":"bottom");const M=k-p.top-p.bottom,T=b-p.left-p.right,j=Bo(k-p[C],M),P=Bo(b-p[N],T),L=!e.middlewareData.shift;let I=j,_=P;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(_=T),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(I=M),L&&!y){const q=Nn(p.left,0),X=Nn(p.right,0),ee=Nn(p.top,0),K=Nn(p.bottom,0);x?_=b-2*(q!==0||X!==0?q+X:Nn(p.left,p.right)):I=k-2*(ee!==0||K!==0?ee+K:Nn(p.top,p.bottom))}await u({...e,availableWidth:_,availableHeight:I});const $=await l.getDimensions(c.floating);return b!==$.width||k!==$.height?{reset:{rects:!0}}:{}}}};function Td(){return typeof window<"u"}function Wi(t){return Uk(t)?(t.nodeName||"").toLowerCase():"#document"}function Tn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Tr(t){var e;return(e=(Uk(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Uk(t){return Td()?t instanceof Node||t instanceof Tn(t).Node:!1}function ar(t){return Td()?t instanceof Element||t instanceof Tn(t).Element:!1}function Qr(t){return Td()?t instanceof HTMLElement||t instanceof Tn(t).HTMLElement:!1}function Z0(t){return!Td()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Tn(t).ShadowRoot}function ba(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=cr(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&o!=="inline"&&o!=="contents"}function kD(t){return/^(table|td|th)$/.test(Wi(t))}function jd(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const SD=/transform|translate|scale|rotate|perspective|filter/,CD=/paint|layout|strict|content/,ms=t=>!!t&&t!=="none";let up;function pg(t){const e=ar(t)?cr(t):t;return ms(e.transform)||ms(e.translate)||ms(e.scale)||ms(e.rotate)||ms(e.perspective)||!mg()&&(ms(e.backdropFilter)||ms(e.filter))||SD.test(e.willChange||"")||CD.test(e.contain||"")}function ND(t){let e=Vo(t);for(;Qr(e)&&!Oi(e);){if(pg(e))return e;if(jd(e))return null;e=Vo(e)}return null}function mg(){return up==null&&(up=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),up}function Oi(t){return/^(html|body|#document)$/.test(Wi(t))}function cr(t){return Tn(t).getComputedStyle(t)}function Ad(t){return ar(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Vo(t){if(Wi(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Z0(t)&&t.host||Tr(t);return Z0(e)?e.host:e}function Kk(t){const e=Vo(t);return Oi(e)?t.ownerDocument?t.ownerDocument.body:t.body:Qr(e)&&ba(e)?e:Kk(e)}function na(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=Kk(t),s=o===((r=t.ownerDocument)==null?void 0:r.body),l=Tn(o);if(s){const c=om(l);return e.concat(l,l.visualViewport||[],ba(o)?o:[],c&&n?na(c):[])}else return e.concat(o,na(o,[],n))}function om(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function qk(t){const e=cr(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=Qr(t),s=o?t.offsetWidth:n,l=o?t.offsetHeight:r,c=vu(n)!==s||vu(r)!==l;return c&&(n=s,r=l),{width:n,height:r,$:c}}function gg(t){return ar(t)?t:t.contextElement}function ji(t){const e=gg(t);if(!Qr(e))return Cr(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:s}=qk(e);let l=(s?vu(n.width):n.width)/r,c=(s?vu(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const ED=Cr(0);function Gk(t){const e=Tn(t);return!mg()||!e.visualViewport?ED:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function MD(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Tn(t)?!1:e}function Rs(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=gg(t);let l=Cr(1);e&&(r?ar(r)&&(l=ji(r)):l=ji(t));const c=MD(s,n,r)?Gk(s):Cr(0);let u=(o.left+c.x)/l.x,h=(o.top+c.y)/l.y,p=o.width/l.x,m=o.height/l.y;if(s){const y=Tn(s),x=r&&ar(r)?Tn(r):r;let b=y,k=om(b);for(;k&&r&&x!==b;){const C=ji(k),N=k.getBoundingClientRect(),M=cr(k),T=N.left+(k.clientLeft+parseFloat(M.paddingLeft))*C.x,j=N.top+(k.clientTop+parseFloat(M.paddingTop))*C.y;u*=C.x,h*=C.y,p*=C.x,m*=C.y,u+=T,h+=j,b=Tn(k),k=om(b)}}return bu({width:p,height:m,x:u,y:h})}function Rd(t,e){const n=Ad(t).scrollLeft;return e?e.left+n:Rs(Tr(t)).left+n}function Jk(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Rd(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function TD(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const s=o==="fixed",l=Tr(r),c=e?jd(e.floating):!1;if(r===l||c&&s)return n;let u={scrollLeft:0,scrollTop:0},h=Cr(1);const p=Cr(0),m=Qr(r);if((m||!m&&!s)&&((Wi(r)!=="body"||ba(l))&&(u=Ad(r)),m)){const x=Rs(r);h=ji(r),p.x=x.x+r.clientLeft,p.y=x.y+r.clientTop}const y=l&&!m&&!s?Jk(l,u):Cr(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-u.scrollLeft*h.x+p.x+y.x,y:n.y*h.y-u.scrollTop*h.y+p.y+y.y}}function jD(t){return Array.from(t.getClientRects())}function AD(t){const e=Tr(t),n=Ad(t),r=t.ownerDocument.body,o=Nn(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Nn(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Rd(t);const c=-n.scrollTop;return cr(r).direction==="rtl"&&(l+=Nn(e.clientWidth,r.clientWidth)-o),{width:o,height:s,x:l,y:c}}const ew=25;function RD(t,e){const n=Tn(t),r=Tr(t),o=n.visualViewport;let s=r.clientWidth,l=r.clientHeight,c=0,u=0;if(o){s=o.width,l=o.height;const p=mg();(!p||p&&e==="fixed")&&(c=o.offsetLeft,u=o.offsetTop)}const h=Rd(r);if(h<=0){const p=r.ownerDocument,m=p.body,y=getComputedStyle(m),x=p.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,b=Math.abs(r.clientWidth-m.clientWidth-x);b<=ew&&(s-=b)}else h<=ew&&(s+=h);return{width:s,height:l,x:c,y:u}}function PD(t,e){const n=Rs(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,s=Qr(t)?ji(t):Cr(1),l=t.clientWidth*s.x,c=t.clientHeight*s.y,u=o*s.x,h=r*s.y;return{width:l,height:c,x:u,y:h}}function tw(t,e,n){let r;if(e==="viewport")r=RD(t,n);else if(e==="document")r=AD(Tr(t));else if(ar(e))r=PD(e,n);else{const o=Gk(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return bu(r)}function Yk(t,e){const n=Vo(t);return n===e||!ar(n)||Oi(n)?!1:cr(n).position==="fixed"||Yk(n,e)}function OD(t,e){const n=e.get(t);if(n)return n;let r=na(t,[],!1).filter(c=>ar(c)&&Wi(c)!=="body"),o=null;const s=cr(t).position==="fixed";let l=s?Vo(t):t;for(;ar(l)&&!Oi(l);){const c=cr(l),u=pg(l);!u&&c.position==="fixed"&&(o=null),(s?!u&&!o:!u&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||ba(l)&&!u&&Yk(t,l))?r=r.filter(p=>p!==l):o=c,l=Vo(l)}return e.set(t,r),r}function ID(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const l=[...n==="clippingAncestors"?jd(e)?[]:OD(e,this._c):[].concat(n),r],c=tw(e,l[0],o);let u=c.top,h=c.right,p=c.bottom,m=c.left;for(let y=1;y<l.length;y++){const x=tw(e,l[y],o);u=Nn(x.top,u),h=Bo(x.right,h),p=Bo(x.bottom,p),m=Nn(x.left,m)}return{width:h-m,height:p-u,x:m,y:u}}function DD(t){const{width:e,height:n}=qk(t);return{width:e,height:n}}function _D(t,e,n){const r=Qr(e),o=Tr(e),s=n==="fixed",l=Rs(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const u=Cr(0);function h(){u.x=Rd(o)}if(r||!r&&!s)if((Wi(e)!=="body"||ba(o))&&(c=Ad(e)),r){const x=Rs(e,!0,s,e);u.x=x.x+e.clientLeft,u.y=x.y+e.clientTop}else o&&h();s&&!r&&o&&h();const p=o&&!r&&!s?Jk(o,c):Cr(0),m=l.left+c.scrollLeft-u.x-p.x,y=l.top+c.scrollTop-u.y-p.y;return{x:m,y,width:l.width,height:l.height}}function dp(t){return cr(t).position==="static"}function nw(t,e){if(!Qr(t)||cr(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Tr(t)===n&&(n=n.ownerDocument.body),n}function Qk(t,e){const n=Tn(t);if(jd(t))return n;if(!Qr(t)){let o=Vo(t);for(;o&&!Oi(o);){if(ar(o)&&!dp(o))return o;o=Vo(o)}return n}let r=nw(t,e);for(;r&&kD(r)&&dp(r);)r=nw(r,e);return r&&Oi(r)&&dp(r)&&!pg(r)?n:r||ND(t)||n}const LD=async function(t){const e=this.getOffsetParent||Qk,n=this.getDimensions,r=await n(t.floating);return{reference:_D(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function zD(t){return cr(t).direction==="rtl"}const $D={convertOffsetParentRelativeRectToViewportRelativeRect:TD,getDocumentElement:Tr,getClippingRect:ID,getOffsetParent:Qk,getElementRects:LD,getClientRects:jD,getDimensions:DD,getScale:ji,isElement:ar,isRTL:zD};function Xk(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function FD(t,e){let n=null,r;const o=Tr(t);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function l(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),s();const h=t.getBoundingClientRect(),{left:p,top:m,width:y,height:x}=h;if(c||e(),!y||!x)return;const b=Wc(m),k=Wc(o.clientWidth-(p+y)),C=Wc(o.clientHeight-(m+x)),N=Wc(p),T={rootMargin:-b+"px "+-k+"px "+-C+"px "+-N+"px",threshold:Nn(0,Bo(1,u))||1};let j=!0;function P(L){const I=L[0].intersectionRatio;if(I!==u){if(!j)return l();I?l(!1,I):r=setTimeout(()=>{l(!1,1e-7)},1e3)}I===1&&!Xk(h,t.getBoundingClientRect())&&l(),j=!1}try{n=new IntersectionObserver(P,{...T,root:o.ownerDocument})}catch{n=new IntersectionObserver(P,T)}n.observe(t)}return l(!0),s}function BD(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=gg(t),p=o||s?[...h?na(h):[],...e?na(e):[]]:[];p.forEach(N=>{o&&N.addEventListener("scroll",n,{passive:!0}),s&&N.addEventListener("resize",n)});const m=h&&c?FD(h,n):null;let y=-1,x=null;l&&(x=new ResizeObserver(N=>{let[M]=N;M&&M.target===h&&x&&e&&(x.unobserve(e),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var T;(T=x)==null||T.observe(e)})),n()}),h&&!u&&x.observe(h),e&&x.observe(e));let b,k=u?Rs(t):null;u&&C();function C(){const N=Rs(t);k&&!Xk(k,N)&&n(),k=N,b=requestAnimationFrame(C)}return n(),()=>{var N;p.forEach(M=>{o&&M.removeEventListener("scroll",n),s&&M.removeEventListener("resize",n)}),m==null||m(),(N=x)==null||N.disconnect(),x=null,u&&cancelAnimationFrame(b)}}const VD=xD,HD=vD,WD=mD,UD=bD,KD=gD,rw=pD,qD=wD,GD=(t,e,n)=>{const r=new Map,o={platform:$D,...n},s={...o.platform,_c:r};return hD(t,e,{...o,platform:s})};var JD=typeof document<"u",YD=function(){},cu=JD?w.useLayoutEffect:YD;function ku(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(!ku(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;){const s=o[r];if(!(s==="_owner"&&t.$$typeof)&&!ku(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function Zk(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function ow(t,e){const n=Zk(t);return Math.round(e*n)/n}function fp(t){const e=w.useRef(t);return cu(()=>{e.current=t}),e}function QD(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:l}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[p,m]=w.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[y,x]=w.useState(r);ku(y,r)||x(r);const[b,k]=w.useState(null),[C,N]=w.useState(null),M=w.useCallback(H=>{H!==L.current&&(L.current=H,k(H))},[]),T=w.useCallback(H=>{H!==I.current&&(I.current=H,N(H))},[]),j=s||b,P=l||C,L=w.useRef(null),I=w.useRef(null),_=w.useRef(p),$=u!=null,q=fp(u),X=fp(o),ee=fp(h),K=w.useCallback(()=>{if(!L.current||!I.current)return;const H={placement:e,strategy:n,middleware:y};X.current&&(H.platform=X.current),GD(L.current,I.current,H).then(W=>{const B={...W,isPositioned:ee.current!==!1};ie.current&&!ku(_.current,B)&&(_.current=B,xa.flushSync(()=>{m(B)}))})},[y,e,n,X,ee]);cu(()=>{h===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,m(H=>({...H,isPositioned:!1})))},[h]);const ie=w.useRef(!1);cu(()=>(ie.current=!0,()=>{ie.current=!1}),[]),cu(()=>{if(j&&(L.current=j),P&&(I.current=P),j&&P){if(q.current)return q.current(j,P,K);K()}},[j,P,K,q,$]);const ne=w.useMemo(()=>({reference:L,floating:I,setReference:M,setFloating:T}),[M,T]),re=w.useMemo(()=>({reference:j,floating:P}),[j,P]),ae=w.useMemo(()=>{const H={position:n,left:0,top:0};if(!re.floating)return H;const W=ow(re.floating,p.x),B=ow(re.floating,p.y);return c?{...H,transform:"translate("+W+"px, "+B+"px)",...Zk(re.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:B}},[n,c,re.floating,p.x,p.y]);return w.useMemo(()=>({...p,update:K,refs:ne,elements:re,floatingStyles:ae}),[p,K,ne,re,ae])}const XD=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:o}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?rw({element:r.current,padding:o}).fn(n):{}:r?rw({element:r,padding:o}).fn(n):{}}}},ZD=(t,e)=>{const n=VD(t);return{name:n.name,fn:n.fn,options:[t,e]}},e_=(t,e)=>{const n=HD(t);return{name:n.name,fn:n.fn,options:[t,e]}},t_=(t,e)=>({fn:qD(t).fn,options:[t,e]}),n_=(t,e)=>{const n=WD(t);return{name:n.name,fn:n.fn,options:[t,e]}},r_=(t,e)=>{const n=UD(t);return{name:n.name,fn:n.fn,options:[t,e]}},o_=(t,e)=>{const n=KD(t);return{name:n.name,fn:n.fn,options:[t,e]}},s_=(t,e)=>{const n=XD(t);return{name:n.name,fn:n.fn,options:[t,e]}};var i_="Arrow",eS=w.forwardRef((t,e)=>{const{children:n,width:r=10,height:o=5,...s}=t;return f.jsx(Pe.svg,{...s,ref:e,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});eS.displayName=i_;var l_=eS,yg="Popper",[tS,Pd]=ur(yg),[a_,nS]=tS(yg),rS=t=>{const{__scopePopper:e,children:n}=t,[r,o]=w.useState(null);return f.jsx(a_,{scope:e,anchor:r,onAnchorChange:o,children:n})};rS.displayName=yg;var oS="PopperAnchor",sS=w.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...o}=t,s=nS(oS,n),l=w.useRef(null),c=Ve(e,l),u=w.useRef(null);return w.useEffect(()=>{const h=u.current;u.current=(r==null?void 0:r.current)||l.current,h!==u.current&&s.onAnchorChange(u.current)}),r?null:f.jsx(Pe.div,{...o,ref:c})});sS.displayName=oS;var xg="PopperContent",[c_,u_]=tS(xg),iS=w.forwardRef((t,e)=>{var oe,pe,le,je,De,_e;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:y=!1,updatePositionStrategy:x="optimized",onPlaced:b,...k}=t,C=nS(xg,n),[N,M]=w.useState(null),T=Ve(e,Je=>M(Je)),[j,P]=w.useState(null),L=ug(j),I=(L==null?void 0:L.width)??0,_=(L==null?void 0:L.height)??0,$=r+(s!=="center"?"-"+s:""),q=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},X=Array.isArray(h)?h:[h],ee=X.length>0,K={padding:q,boundary:X.filter(f_),altBoundary:ee},{refs:ie,floatingStyles:ne,placement:re,isPositioned:ae,middlewareData:H}=QD({strategy:"fixed",placement:$,whileElementsMounted:(...Je)=>BD(...Je,{animationFrame:x==="always"}),elements:{reference:C.anchor},middleware:[ZD({mainAxis:o+_,alignmentAxis:l}),u&&e_({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?t_():void 0,...K}),u&&n_({...K}),r_({...K,apply:({elements:Je,rects:rt,availableWidth:de,availableHeight:We})=>{const{width:ot,height:Pn}=rt.reference,wn=Je.floating.style;wn.setProperty("--radix-popper-available-width",`${de}px`),wn.setProperty("--radix-popper-available-height",`${We}px`),wn.setProperty("--radix-popper-anchor-width",`${ot}px`),wn.setProperty("--radix-popper-anchor-height",`${Pn}px`)}}),j&&s_({element:j,padding:c}),h_({arrowWidth:I,arrowHeight:_}),y&&o_({strategy:"referenceHidden",...K})]}),[W,B]=cS(re),R=Ot(b);bt(()=>{ae&&(R==null||R())},[ae,R]);const U=(oe=H.arrow)==null?void 0:oe.x,Ne=(pe=H.arrow)==null?void 0:pe.y,Se=((le=H.arrow)==null?void 0:le.centerOffset)!==0,[we,he]=w.useState();return bt(()=>{N&&he(window.getComputedStyle(N).zIndex)},[N]),f.jsx("div",{ref:ie.setFloating,"data-radix-popper-content-wrapper":"",style:{...ne,transform:ae?ne.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:we,"--radix-popper-transform-origin":[(je=H.transformOrigin)==null?void 0:je.x,(De=H.transformOrigin)==null?void 0:De.y].join(" "),...((_e=H.hide)==null?void 0:_e.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:f.jsx(c_,{scope:n,placedSide:W,onArrowChange:P,arrowX:U,arrowY:Ne,shouldHideArrow:Se,children:f.jsx(Pe.div,{"data-side":W,"data-align":B,...k,ref:T,style:{...k.style,animation:ae?void 0:"none"}})})})});iS.displayName=xg;var lS="PopperArrow",d_={top:"bottom",right:"left",bottom:"top",left:"right"},aS=w.forwardRef(function(e,n){const{__scopePopper:r,...o}=e,s=u_(lS,r),l=d_[s.placedSide];return f.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:f.jsx(l_,{...o,ref:n,style:{...o.style,display:"block"}})})});aS.displayName=lS;function f_(t){return t!==null}var h_=t=>({name:"transformOrigin",options:t,fn(e){var C,N,M;const{placement:n,rects:r,middlewareData:o}=e,l=((C=o.arrow)==null?void 0:C.centerOffset)!==0,c=l?0:t.arrowWidth,u=l?0:t.arrowHeight,[h,p]=cS(n),m={start:"0%",center:"50%",end:"100%"}[p],y=(((N=o.arrow)==null?void 0:N.x)??0)+c/2,x=(((M=o.arrow)==null?void 0:M.y)??0)+u/2;let b="",k="";return h==="bottom"?(b=l?m:`${y}px`,k=`${-u}px`):h==="top"?(b=l?m:`${y}px`,k=`${r.floating.height+u}px`):h==="right"?(b=`${-u}px`,k=l?m:`${x}px`):h==="left"&&(b=`${r.floating.width+u}px`,k=l?m:`${x}px`),{data:{x:b,y:k}}}});function cS(t){const[e,n="center"]=t.split("-");return[e,n]}var uS=rS,dS=sS,fS=iS,hS=aS;function p_(t){const e=m_(t),n=w.forwardRef((r,o)=>{const{children:s,...l}=r,c=w.Children.toArray(s),u=c.find(y_);if(u){const h=u.props.children,p=c.map(m=>m===u?w.Children.count(h)>1?w.Children.only(null):w.isValidElement(h)?h.props.children:null:m);return f.jsx(e,{...l,ref:o,children:w.isValidElement(h)?w.cloneElement(h,void 0,p):null})}return f.jsx(e,{...l,ref:o,children:s})});return n.displayName=`${t}.Slot`,n}function m_(t){const e=w.forwardRef((n,r)=>{const{children:o,...s}=n;if(w.isValidElement(o)){const l=v_(o),c=x_(s,o.props);return o.type!==w.Fragment&&(c.ref=r?Yr(r,l):l),w.cloneElement(o,c)}return w.Children.count(o)>1?w.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var g_=Symbol("radix.slottable");function y_(t){return w.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===g_}function x_(t,e){const n={...e};for(const r in e){const o=t[r],s=e[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...c)=>{const u=s(...c);return o(...c),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...t,...n}}function v_(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var pS=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"}),w_="VisuallyHidden",b_=w.forwardRef((t,e)=>f.jsx(Pe.span,{...t,ref:e,style:{...pS,...t.style}}));b_.displayName=w_;var k_=[" ","Enter","ArrowUp","ArrowDown"],S_=[" ","Enter"],Ps="Select",[Od,Id,C_]=ig(Ps),[Ui]=ur(Ps,[C_,Pd]),Dd=Pd(),[N_,Jo]=Ui(Ps),[E_,M_]=Ui(Ps),mS=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:o,onOpenChange:s,value:l,defaultValue:c,onValueChange:u,dir:h,name:p,autoComplete:m,disabled:y,required:x,form:b}=t,k=Dd(e),[C,N]=w.useState(null),[M,T]=w.useState(null),[j,P]=w.useState(!1),L=va(h),[I,_]=Fo({prop:r,defaultProp:o??!1,onChange:s,caller:Ps}),[$,q]=Fo({prop:l,defaultProp:c,onChange:u,caller:Ps}),X=w.useRef(null),ee=C?b||!!C.closest("form"):!0,[K,ie]=w.useState(new Set),ne=Array.from(K).map(re=>re.props.value).join(";");return f.jsx(uS,{...k,children:f.jsxs(N_,{required:x,scope:e,trigger:C,onTriggerChange:N,valueNode:M,onValueNodeChange:T,valueNodeHasChildren:j,onValueNodeHasChildrenChange:P,contentId:Sr(),value:$,onValueChange:q,open:I,onOpenChange:_,dir:L,triggerPointerDownPosRef:X,disabled:y,children:[f.jsx(Od.Provider,{scope:e,children:f.jsx(E_,{scope:t.__scopeSelect,onNativeOptionAdd:w.useCallback(re=>{ie(ae=>new Set(ae).add(re))},[]),onNativeOptionRemove:w.useCallback(re=>{ie(ae=>{const H=new Set(ae);return H.delete(re),H})},[]),children:n})}),ee?f.jsxs($S,{"aria-hidden":!0,required:x,tabIndex:-1,name:p,autoComplete:m,value:$,onChange:re=>q(re.target.value),disabled:y,form:b,children:[$===void 0?f.jsx("option",{value:""}):null,Array.from(K)]},ne):null]})})};mS.displayName=Ps;var gS="SelectTrigger",yS=w.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...o}=t,s=Dd(n),l=Jo(gS,n),c=l.disabled||r,u=Ve(e,l.onTriggerChange),h=Id(n),p=w.useRef("touch"),[m,y,x]=BS(k=>{const C=h().filter(T=>!T.disabled),N=C.find(T=>T.value===l.value),M=VS(C,k,N);M!==void 0&&l.onValueChange(M.value)}),b=k=>{c||(l.onOpenChange(!0),x()),k&&(l.triggerPointerDownPosRef.current={x:Math.round(k.pageX),y:Math.round(k.pageY)})};return f.jsx(dS,{asChild:!0,...s,children:f.jsx(Pe.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":FS(l.value)?"":void 0,...o,ref:u,onClick:fe(o.onClick,k=>{k.currentTarget.focus(),p.current!=="mouse"&&b(k)}),onPointerDown:fe(o.onPointerDown,k=>{p.current=k.pointerType;const C=k.target;C.hasPointerCapture(k.pointerId)&&C.releasePointerCapture(k.pointerId),k.button===0&&k.ctrlKey===!1&&k.pointerType==="mouse"&&(b(k),k.preventDefault())}),onKeyDown:fe(o.onKeyDown,k=>{const C=m.current!=="";!(k.ctrlKey||k.altKey||k.metaKey)&&k.key.length===1&&y(k.key),!(C&&k.key===" ")&&k_.includes(k.key)&&(b(),k.preventDefault())})})})});yS.displayName=gS;var xS="SelectValue",vS=w.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:l="",...c}=t,u=Jo(xS,n),{onValueNodeHasChildrenChange:h}=u,p=s!==void 0,m=Ve(e,u.onValueNodeChange);return bt(()=>{h(p)},[h,p]),f.jsx(Pe.span,{...c,ref:m,style:{pointerEvents:"none"},children:FS(u.value)?f.jsx(f.Fragment,{children:l}):s})});vS.displayName=xS;var T_="SelectIcon",wS=w.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...o}=t;return f.jsx(Pe.span,{"aria-hidden":!0,...o,ref:e,children:r||"▼"})});wS.displayName=T_;var j_="SelectPortal",bS=t=>f.jsx(bd,{asChild:!0,...t});bS.displayName=j_;var Os="SelectContent",kS=w.forwardRef((t,e)=>{const n=Jo(Os,t.__scopeSelect),[r,o]=w.useState();if(bt(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?xa.createPortal(f.jsx(SS,{scope:t.__scopeSelect,children:f.jsx(Od.Slot,{scope:t.__scopeSelect,children:f.jsx("div",{children:t.children})})}),s):null}return f.jsx(CS,{...t,ref:e})});kS.displayName=Os;var nr=10,[SS,Yo]=Ui(Os),A_="SelectContentImpl",R_=p_("SelectContent.RemoveScroll"),CS=w.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:l,side:c,sideOffset:u,align:h,alignOffset:p,arrowPadding:m,collisionBoundary:y,collisionPadding:x,sticky:b,hideWhenDetached:k,avoidCollisions:C,...N}=t,M=Jo(Os,n),[T,j]=w.useState(null),[P,L]=w.useState(null),I=Ve(e,oe=>j(oe)),[_,$]=w.useState(null),[q,X]=w.useState(null),ee=Id(n),[K,ie]=w.useState(!1),ne=w.useRef(!1);w.useEffect(()=>{if(T)return ng(T)},[T]),tg();const re=w.useCallback(oe=>{const[pe,...le]=ee().map(_e=>_e.ref.current),[je]=le.slice(-1),De=document.activeElement;for(const _e of oe)if(_e===De||(_e==null||_e.scrollIntoView({block:"nearest"}),_e===pe&&P&&(P.scrollTop=0),_e===je&&P&&(P.scrollTop=P.scrollHeight),_e==null||_e.focus(),document.activeElement!==De))return},[ee,P]),ae=w.useCallback(()=>re([_,T]),[re,_,T]);w.useEffect(()=>{K&&ae()},[K,ae]);const{onOpenChange:H,triggerPointerDownPosRef:W}=M;w.useEffect(()=>{if(T){let oe={x:0,y:0};const pe=je=>{var De,_e;oe={x:Math.abs(Math.round(je.pageX)-(((De=W.current)==null?void 0:De.x)??0)),y:Math.abs(Math.round(je.pageY)-(((_e=W.current)==null?void 0:_e.y)??0))}},le=je=>{oe.x<=10&&oe.y<=10?je.preventDefault():T.contains(je.target)||H(!1),document.removeEventListener("pointermove",pe),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",pe),document.addEventListener("pointerup",le,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",pe),document.removeEventListener("pointerup",le,{capture:!0})}}},[T,H,W]),w.useEffect(()=>{const oe=()=>H(!1);return window.addEventListener("blur",oe),window.addEventListener("resize",oe),()=>{window.removeEventListener("blur",oe),window.removeEventListener("resize",oe)}},[H]);const[B,R]=BS(oe=>{const pe=ee().filter(De=>!De.disabled),le=pe.find(De=>De.ref.current===document.activeElement),je=VS(pe,oe,le);je&&setTimeout(()=>je.ref.current.focus())}),U=w.useCallback((oe,pe,le)=>{const je=!ne.current&&!le;(M.value!==void 0&&M.value===pe||je)&&($(oe),je&&(ne.current=!0))},[M.value]),Ne=w.useCallback(()=>T==null?void 0:T.focus(),[T]),Se=w.useCallback((oe,pe,le)=>{const je=!ne.current&&!le;(M.value!==void 0&&M.value===pe||je)&&X(oe)},[M.value]),we=r==="popper"?sm:NS,he=we===sm?{side:c,sideOffset:u,align:h,alignOffset:p,arrowPadding:m,collisionBoundary:y,collisionPadding:x,sticky:b,hideWhenDetached:k,avoidCollisions:C}:{};return f.jsx(SS,{scope:n,content:T,viewport:P,onViewportChange:L,itemRefCallback:U,selectedItem:_,onItemLeave:Ne,itemTextRefCallback:Se,focusSelectedItem:ae,selectedItemText:q,position:r,isPositioned:K,searchRef:B,children:f.jsx(Sd,{as:R_,allowPinchZoom:!0,children:f.jsx(wd,{asChild:!0,trapped:M.open,onMountAutoFocus:oe=>{oe.preventDefault()},onUnmountAutoFocus:fe(o,oe=>{var pe;(pe=M.trigger)==null||pe.focus({preventScroll:!0}),oe.preventDefault()}),children:f.jsx(vd,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:oe=>oe.preventDefault(),onDismiss:()=>M.onOpenChange(!1),children:f.jsx(we,{role:"listbox",id:M.contentId,"data-state":M.open?"open":"closed",dir:M.dir,onContextMenu:oe=>oe.preventDefault(),...N,...he,onPlaced:()=>ie(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...N.style},onKeyDown:fe(N.onKeyDown,oe=>{const pe=oe.ctrlKey||oe.altKey||oe.metaKey;if(oe.key==="Tab"&&oe.preventDefault(),!pe&&oe.key.length===1&&R(oe.key),["ArrowUp","ArrowDown","Home","End"].includes(oe.key)){let je=ee().filter(De=>!De.disabled).map(De=>De.ref.current);if(["ArrowUp","End"].includes(oe.key)&&(je=je.slice().reverse()),["ArrowUp","ArrowDown"].includes(oe.key)){const De=oe.target,_e=je.indexOf(De);je=je.slice(_e+1)}setTimeout(()=>re(je)),oe.preventDefault()}})})})})})})});CS.displayName=A_;var P_="SelectItemAlignedPosition",NS=w.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...o}=t,s=Jo(Os,n),l=Yo(Os,n),[c,u]=w.useState(null),[h,p]=w.useState(null),m=Ve(e,I=>p(I)),y=Id(n),x=w.useRef(!1),b=w.useRef(!0),{viewport:k,selectedItem:C,selectedItemText:N,focusSelectedItem:M}=l,T=w.useCallback(()=>{if(s.trigger&&s.valueNode&&c&&h&&k&&C&&N){const I=s.trigger.getBoundingClientRect(),_=h.getBoundingClientRect(),$=s.valueNode.getBoundingClientRect(),q=N.getBoundingClientRect();if(s.dir!=="rtl"){const De=q.left-_.left,_e=$.left-De,Je=I.left-_e,rt=I.width+Je,de=Math.max(rt,_.width),We=window.innerWidth-nr,ot=tm(_e,[nr,Math.max(nr,We-de)]);c.style.minWidth=rt+"px",c.style.left=ot+"px"}else{const De=_.right-q.right,_e=window.innerWidth-$.right-De,Je=window.innerWidth-I.right-_e,rt=I.width+Je,de=Math.max(rt,_.width),We=window.innerWidth-nr,ot=tm(_e,[nr,Math.max(nr,We-de)]);c.style.minWidth=rt+"px",c.style.right=ot+"px"}const X=y(),ee=window.innerHeight-nr*2,K=k.scrollHeight,ie=window.getComputedStyle(h),ne=parseInt(ie.borderTopWidth,10),re=parseInt(ie.paddingTop,10),ae=parseInt(ie.borderBottomWidth,10),H=parseInt(ie.paddingBottom,10),W=ne+re+K+H+ae,B=Math.min(C.offsetHeight*5,W),R=window.getComputedStyle(k),U=parseInt(R.paddingTop,10),Ne=parseInt(R.paddingBottom,10),Se=I.top+I.height/2-nr,we=ee-Se,he=C.offsetHeight/2,oe=C.offsetTop+he,pe=ne+re+oe,le=W-pe;if(pe<=Se){const De=X.length>0&&C===X[X.length-1].ref.current;c.style.bottom="0px";const _e=h.clientHeight-k.offsetTop-k.offsetHeight,Je=Math.max(we,he+(De?Ne:0)+_e+ae),rt=pe+Je;c.style.height=rt+"px"}else{const De=X.length>0&&C===X[0].ref.current;c.style.top="0px";const Je=Math.max(Se,ne+k.offsetTop+(De?U:0)+he)+le;c.style.height=Je+"px",k.scrollTop=pe-Se+k.offsetTop}c.style.margin=`${nr}px 0`,c.style.minHeight=B+"px",c.style.maxHeight=ee+"px",r==null||r(),requestAnimationFrame(()=>x.current=!0)}},[y,s.trigger,s.valueNode,c,h,k,C,N,s.dir,r]);bt(()=>T(),[T]);const[j,P]=w.useState();bt(()=>{h&&P(window.getComputedStyle(h).zIndex)},[h]);const L=w.useCallback(I=>{I&&b.current===!0&&(T(),M==null||M(),b.current=!1)},[T,M]);return f.jsx(I_,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:x,onScrollButtonChange:L,children:f.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:f.jsx(Pe.div,{...o,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});NS.displayName=P_;var O_="SelectPopperPosition",sm=w.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=nr,...s}=t,l=Dd(n);return f.jsx(fS,{...l,...s,ref:e,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});sm.displayName=O_;var[I_,vg]=Ui(Os,{}),im="SelectViewport",ES=w.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...o}=t,s=Yo(im,n),l=vg(im,n),c=Ve(e,s.onViewportChange),u=w.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),f.jsx(Od.Slot,{scope:n,children:f.jsx(Pe.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:fe(o.onScroll,h=>{const p=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:y}=l;if(y!=null&&y.current&&m){const x=Math.abs(u.current-p.scrollTop);if(x>0){const b=window.innerHeight-nr*2,k=parseFloat(m.style.minHeight),C=parseFloat(m.style.height),N=Math.max(k,C);if(N<b){const M=N+x,T=Math.min(b,M),j=M-T;m.style.height=T+"px",m.style.bottom==="0px"&&(p.scrollTop=j>0?j:0,m.style.justifyContent="flex-end")}}}u.current=p.scrollTop})})})]})});ES.displayName=im;var MS="SelectGroup",[D_,__]=Ui(MS),L_=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,o=Sr();return f.jsx(D_,{scope:n,id:o,children:f.jsx(Pe.div,{role:"group","aria-labelledby":o,...r,ref:e})})});L_.displayName=MS;var TS="SelectLabel",jS=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,o=__(TS,n);return f.jsx(Pe.div,{id:o.id,...r,ref:e})});jS.displayName=TS;var Su="SelectItem",[z_,AS]=Ui(Su),RS=w.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...l}=t,c=Jo(Su,n),u=Yo(Su,n),h=c.value===r,[p,m]=w.useState(s??""),[y,x]=w.useState(!1),b=Ve(e,M=>{var T;return(T=u.itemRefCallback)==null?void 0:T.call(u,M,r,o)}),k=Sr(),C=w.useRef("touch"),N=()=>{o||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return f.jsx(z_,{scope:n,value:r,disabled:o,textId:k,isSelected:h,onItemTextChange:w.useCallback(M=>{m(T=>T||((M==null?void 0:M.textContent)??"").trim())},[]),children:f.jsx(Od.ItemSlot,{scope:n,value:r,disabled:o,textValue:p,children:f.jsx(Pe.div,{role:"option","aria-labelledby":k,"data-highlighted":y?"":void 0,"aria-selected":h&&y,"data-state":h?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...l,ref:b,onFocus:fe(l.onFocus,()=>x(!0)),onBlur:fe(l.onBlur,()=>x(!1)),onClick:fe(l.onClick,()=>{C.current!=="mouse"&&N()}),onPointerUp:fe(l.onPointerUp,()=>{C.current==="mouse"&&N()}),onPointerDown:fe(l.onPointerDown,M=>{C.current=M.pointerType}),onPointerMove:fe(l.onPointerMove,M=>{var T;C.current=M.pointerType,o?(T=u.onItemLeave)==null||T.call(u):C.current==="mouse"&&M.currentTarget.focus({preventScroll:!0})}),onPointerLeave:fe(l.onPointerLeave,M=>{var T;M.currentTarget===document.activeElement&&((T=u.onItemLeave)==null||T.call(u))}),onKeyDown:fe(l.onKeyDown,M=>{var j;((j=u.searchRef)==null?void 0:j.current)!==""&&M.key===" "||(S_.includes(M.key)&&N(),M.key===" "&&M.preventDefault())})})})})});RS.displayName=Su;var zl="SelectItemText",PS=w.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:o,...s}=t,l=Jo(zl,n),c=Yo(zl,n),u=AS(zl,n),h=M_(zl,n),[p,m]=w.useState(null),y=Ve(e,N=>m(N),u.onItemTextChange,N=>{var M;return(M=c.itemTextRefCallback)==null?void 0:M.call(c,N,u.value,u.disabled)}),x=p==null?void 0:p.textContent,b=w.useMemo(()=>f.jsx("option",{value:u.value,disabled:u.disabled,children:x},u.value),[u.disabled,u.value,x]),{onNativeOptionAdd:k,onNativeOptionRemove:C}=h;return bt(()=>(k(b),()=>C(b)),[k,C,b]),f.jsxs(f.Fragment,{children:[f.jsx(Pe.span,{id:u.textId,...s,ref:y}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?xa.createPortal(s.children,l.valueNode):null]})});PS.displayName=zl;var OS="SelectItemIndicator",IS=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return AS(OS,n).isSelected?f.jsx(Pe.span,{"aria-hidden":!0,...r,ref:e}):null});IS.displayName=OS;var lm="SelectScrollUpButton",DS=w.forwardRef((t,e)=>{const n=Yo(lm,t.__scopeSelect),r=vg(lm,t.__scopeSelect),[o,s]=w.useState(!1),l=Ve(e,r.onScrollButtonChange);return bt(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollTop>0;s(h)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),o?f.jsx(LS,{...t,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});DS.displayName=lm;var am="SelectScrollDownButton",_S=w.forwardRef((t,e)=>{const n=Yo(am,t.__scopeSelect),r=vg(am,t.__scopeSelect),[o,s]=w.useState(!1),l=Ve(e,r.onScrollButtonChange);return bt(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollHeight-u.clientHeight,p=Math.ceil(u.scrollTop)<h;s(p)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),o?f.jsx(LS,{...t,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});_S.displayName=am;var LS=w.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=t,s=Yo("SelectScrollButton",n),l=w.useRef(null),c=Id(n),u=w.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return w.useEffect(()=>()=>u(),[u]),bt(()=>{var p;const h=c().find(m=>m.ref.current===document.activeElement);(p=h==null?void 0:h.ref.current)==null||p.scrollIntoView({block:"nearest"})},[c]),f.jsx(Pe.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:fe(o.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:fe(o.onPointerMove,()=>{var h;(h=s.onItemLeave)==null||h.call(s),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:fe(o.onPointerLeave,()=>{u()})})}),$_="SelectSeparator",zS=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return f.jsx(Pe.div,{"aria-hidden":!0,...r,ref:e})});zS.displayName=$_;var cm="SelectArrow",F_=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,o=Dd(n),s=Jo(cm,n),l=Yo(cm,n);return s.open&&l.position==="popper"?f.jsx(hS,{...o,...r,ref:e}):null});F_.displayName=cm;var B_="SelectBubbleInput",$S=w.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const o=w.useRef(null),s=Ve(r,o),l=cg(e);return w.useEffect(()=>{const c=o.current;if(!c)return;const u=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(u,"value").set;if(l!==e&&p){const m=new Event("change",{bubbles:!0});p.call(c,e),c.dispatchEvent(m)}},[l,e]),f.jsx(Pe.select,{...n,style:{...pS,...n.style},ref:s,defaultValue:e})});$S.displayName=B_;function FS(t){return t===""||t===void 0}function BS(t){const e=Ot(t),n=w.useRef(""),r=w.useRef(0),o=w.useCallback(l=>{const c=n.current+l;e(c),(function u(h){n.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>u(""),1e3))})(c)},[e]),s=w.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function VS(t,e,n){const o=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let l=V_(t,Math.max(s,0));o.length===1&&(l=l.filter(h=>h!==n));const u=l.find(h=>h.textValue.toLowerCase().startsWith(o.toLowerCase()));return u!==n?u:void 0}function V_(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var H_=mS,HS=yS,W_=vS,U_=wS,K_=bS,WS=kS,q_=ES,US=jS,KS=RS,G_=PS,J_=IS,qS=DS,GS=_S,JS=zS;const Ci=H_,Ni=W_,xs=w.forwardRef(({className:t,children:e,...n},r)=>f.jsxs(HS,{ref:r,className:Ee("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,f.jsx(U_,{asChild:!0,children:f.jsx(Jm,{className:"h-4 w-4 opacity-50"})})]}));xs.displayName=HS.displayName;const YS=w.forwardRef(({className:t,...e},n)=>f.jsx(qS,{ref:n,className:Ee("flex cursor-default items-center justify-center py-1",t),...e,children:f.jsx(lA,{className:"h-4 w-4"})}));YS.displayName=qS.displayName;const QS=w.forwardRef(({className:t,...e},n)=>f.jsx(GS,{ref:n,className:Ee("flex cursor-default items-center justify-center py-1",t),...e,children:f.jsx(Jm,{className:"h-4 w-4"})}));QS.displayName=GS.displayName;const vs=w.forwardRef(({className:t,children:e,position:n="popper",...r},o)=>f.jsx(K_,{children:f.jsxs(WS,{ref:o,className:Ee("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[f.jsx(YS,{}),f.jsx(q_,{className:Ee("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),f.jsx(QS,{})]})}));vs.displayName=WS.displayName;const Y_=w.forwardRef(({className:t,...e},n)=>f.jsx(US,{ref:n,className:Ee("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));Y_.displayName=US.displayName;const Qt=w.forwardRef(({className:t,children:e,...n},r)=>f.jsxs(KS,{ref:r,className:Ee("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(J_,{children:f.jsx(qo,{className:"h-4 w-4"})})}),f.jsx(G_,{children:e})]}));Qt.displayName=KS.displayName;const Q_=w.forwardRef(({className:t,...e},n)=>f.jsx(JS,{ref:n,className:Ee("-mx-1 my-1 h-px bg-muted",t),...e}));Q_.displayName=JS.displayName;const X_=xd("inline-flex items-center rounded-sm border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-muted text-foreground hover:bg-muted/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80 dark:text-destructive-foreground",outline:"text-foreground dark:text-foreground",success:"bg-green-100 text-green-700 border-green-200 dark:bg-green-900/50 dark:text-green-300 dark:border-green-700",warning:"bg-amber-100 text-amber-700 border-amber-200 dark:bg-amber-900/50 dark:text-amber-300 dark:border-amber-700",info:"bg-blue-100 text-blue-700 border-blue-200 dark:bg-blue-900/50 dark:text-blue-300 dark:border-blue-700",rejected:"bg-red-100 text-red-700 border-red-200 dark:bg-red-900/50 dark:text-red-300 dark:border-red-700",neutral:"bg-gray-100 text-gray-700 border-gray-200 dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600"}},defaultVariants:{variant:"default"}});function Wn({className:t,variant:e,...n}){return f.jsx("div",{className:Ee(X_({variant:e}),t),...n})}function Z_(t,e=[]){let n=[];function r(s,l){const c=w.createContext(l);c.displayName=s+"Context";const u=n.length;n=[...n,l];const h=m=>{var N;const{scope:y,children:x,...b}=m,k=((N=y==null?void 0:y[t])==null?void 0:N[u])||c,C=w.useMemo(()=>b,Object.values(b));return f.jsx(k.Provider,{value:C,children:x})};h.displayName=s+"Provider";function p(m,y){var k;const x=((k=y==null?void 0:y[t])==null?void 0:k[u])||c,b=w.useContext(x);if(b)return b;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${s}\``)}return[h,p]}const o=()=>{const s=n.map(l=>w.createContext(l));return function(c){const u=(c==null?void 0:c[t])||s;return w.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return o.scopeName=t,[r,eL(o,...e)]}function eL(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const l=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(s)[`__scope${h}`];return{...c,...m}},{});return w.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return n.scopeName=e.scopeName,n}var tL=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wg=tL.reduce((t,e)=>{const n=eg(`Primitive.${e}`),r=w.forwardRef((o,s)=>{const{asChild:l,...c}=o,u=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(u,{...c,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),hp={exports:{}},pp={};/**
435
+ * @license React
436
+ * use-sync-external-store-shim.production.js
437
+ *
438
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
439
+ *
440
+ * This source code is licensed under the MIT license found in the
441
+ * LICENSE file in the root directory of this source tree.
442
+ */var sw;function nL(){if(sw)return pp;sw=1;var t=ga();function e(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,o=t.useEffect,s=t.useLayoutEffect,l=t.useDebugValue;function c(m,y){var x=y(),b=r({inst:{value:x,getSnapshot:y}}),k=b[0].inst,C=b[1];return s(function(){k.value=x,k.getSnapshot=y,u(k)&&C({inst:k})},[m,x,y]),o(function(){return u(k)&&C({inst:k}),m(function(){u(k)&&C({inst:k})})},[m]),l(x),x}function u(m){var y=m.getSnapshot;m=m.value;try{var x=y();return!n(m,x)}catch{return!0}}function h(m,y){return y()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return pp.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,pp}var iw;function XS(){return iw||(iw=1,hp.exports=nL()),hp.exports}var bg=XS();function rL(){return bg.useSyncExternalStore(oL,()=>!0,()=>!1)}function oL(){return()=>{}}var kg="Avatar",[sL]=Z_(kg),[iL,ZS]=sL(kg),eC=w.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[o,s]=w.useState("idle");return f.jsx(iL,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:s,children:f.jsx(wg.span,{...r,ref:e})})});eC.displayName=kg;var tC="AvatarImage",nC=w.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:o=()=>{},...s}=t,l=ZS(tC,n),c=lL(r,s),u=Ot(h=>{o(h),l.onImageLoadingStatusChange(h)});return bt(()=>{c!=="idle"&&u(c)},[c,u]),c==="loaded"?f.jsx(wg.img,{...s,ref:e,src:r}):null});nC.displayName=tC;var rC="AvatarFallback",oC=w.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...o}=t,s=ZS(rC,n),[l,c]=w.useState(r===void 0);return w.useEffect(()=>{if(r!==void 0){const u=window.setTimeout(()=>c(!0),r);return()=>window.clearTimeout(u)}},[r]),l&&s.imageLoadingStatus!=="loaded"?f.jsx(wg.span,{...o,ref:e}):null});oC.displayName=rC;function lw(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function lL(t,{referrerPolicy:e,crossOrigin:n}){const r=rL(),o=w.useRef(null),s=r?(o.current||(o.current=new window.Image),o.current):null,[l,c]=w.useState(()=>lw(s,t));return bt(()=>{c(lw(s,t))},[s,t]),bt(()=>{const u=m=>()=>{c(m)};if(!s)return;const h=u("loaded"),p=u("error");return s.addEventListener("load",h),s.addEventListener("error",p),e&&(s.referrerPolicy=e),typeof n=="string"&&(s.crossOrigin=n),()=>{s.removeEventListener("load",h),s.removeEventListener("error",p)}},[s,n,e]),l}var sC=eC,iC=nC,lC=oC;const Ho=w.forwardRef(({className:t,...e},n)=>f.jsx(sC,{ref:n,className:Ee("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));Ho.displayName=sC.displayName;const aL=w.forwardRef(({className:t,...e},n)=>f.jsx(iC,{ref:n,className:Ee("aspect-square h-full w-full",t),...e}));aL.displayName=iC.displayName;const Wo=w.forwardRef(({className:t,...e},n)=>f.jsx(lC,{ref:n,className:Ee("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));Wo.displayName=lC.displayName;function cL(t){const e=uL(t),n=w.forwardRef((r,o)=>{const{children:s,...l}=r,c=w.Children.toArray(s),u=c.find(fL);if(u){const h=u.props.children,p=c.map(m=>m===u?w.Children.count(h)>1?w.Children.only(null):w.isValidElement(h)?h.props.children:null:m);return f.jsx(e,{...l,ref:o,children:w.isValidElement(h)?w.cloneElement(h,void 0,p):null})}return f.jsx(e,{...l,ref:o,children:s})});return n.displayName=`${t}.Slot`,n}function uL(t){const e=w.forwardRef((n,r)=>{const{children:o,...s}=n;if(w.isValidElement(o)){const l=pL(o),c=hL(s,o.props);return o.type!==w.Fragment&&(c.ref=r?Yr(r,l):l),w.cloneElement(o,c)}return w.Children.count(o)>1?w.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var dL=Symbol("radix.slottable");function fL(t){return w.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===dL}function hL(t,e){const n={...e};for(const r in e){const o=t[r],s=e[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...c)=>{const u=s(...c);return o(...c),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...t,...n}}function pL(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var um=["Enter"," "],mL=["ArrowDown","PageUp","Home"],aC=["ArrowUp","PageDown","End"],gL=[...mL,...aC],yL={ltr:[...um,"ArrowRight"],rtl:[...um,"ArrowLeft"]},xL={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ka="Menu",[ra,vL,wL]=ig(ka),[Fs,cC]=ur(ka,[wL,Pd,Nd]),_d=Pd(),uC=Nd(),[bL,Bs]=Fs(ka),[kL,Sa]=Fs(ka),dC=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:o,onOpenChange:s,modal:l=!0}=t,c=_d(e),[u,h]=w.useState(null),p=w.useRef(!1),m=Ot(s),y=va(o);return w.useEffect(()=>{const x=()=>{p.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>p.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),f.jsx(uS,{...c,children:f.jsx(bL,{scope:e,open:n,onOpenChange:m,content:u,onContentChange:h,children:f.jsx(kL,{scope:e,onClose:w.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:p,dir:y,modal:l,children:r})})})};dC.displayName=ka;var SL="MenuAnchor",Sg=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=_d(n);return f.jsx(dS,{...o,...r,ref:e})});Sg.displayName=SL;var Cg="MenuPortal",[CL,fC]=Fs(Cg,{forceMount:void 0}),hC=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:o}=t,s=Bs(Cg,e);return f.jsx(CL,{scope:e,forceMount:n,children:f.jsx(vn,{present:n||s.open,children:f.jsx(bd,{asChild:!0,container:o,children:r})})})};hC.displayName=Cg;var Un="MenuContent",[NL,Ng]=Fs(Un),pC=w.forwardRef((t,e)=>{const n=fC(Un,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,s=Bs(Un,t.__scopeMenu),l=Sa(Un,t.__scopeMenu);return f.jsx(ra.Provider,{scope:t.__scopeMenu,children:f.jsx(vn,{present:r||s.open,children:f.jsx(ra.Slot,{scope:t.__scopeMenu,children:l.modal?f.jsx(EL,{...o,ref:e}):f.jsx(ML,{...o,ref:e})})})})}),EL=w.forwardRef((t,e)=>{const n=Bs(Un,t.__scopeMenu),r=w.useRef(null),o=Ve(e,r);return w.useEffect(()=>{const s=r.current;if(s)return ng(s)},[]),f.jsx(Eg,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:fe(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ML=w.forwardRef((t,e)=>{const n=Bs(Un,t.__scopeMenu);return f.jsx(Eg,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),TL=cL("MenuContent.ScrollLock"),Eg=w.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:h,onPointerDownOutside:p,onFocusOutside:m,onInteractOutside:y,onDismiss:x,disableOutsideScroll:b,...k}=t,C=Bs(Un,n),N=Sa(Un,n),M=_d(n),T=uC(n),j=vL(n),[P,L]=w.useState(null),I=w.useRef(null),_=Ve(e,I,C.onContentChange),$=w.useRef(0),q=w.useRef(""),X=w.useRef(0),ee=w.useRef(null),K=w.useRef("right"),ie=w.useRef(0),ne=b?Sd:w.Fragment,re=b?{as:TL,allowPinchZoom:!0}:void 0,ae=W=>{var oe,pe;const B=q.current+W,R=j().filter(le=>!le.disabled),U=document.activeElement,Ne=(oe=R.find(le=>le.ref.current===U))==null?void 0:oe.textValue,Se=R.map(le=>le.textValue),we=FL(Se,B,Ne),he=(pe=R.find(le=>le.textValue===we))==null?void 0:pe.ref.current;(function le(je){q.current=je,window.clearTimeout($.current),je!==""&&($.current=window.setTimeout(()=>le(""),1e3))})(B),he&&setTimeout(()=>he.focus())};w.useEffect(()=>()=>window.clearTimeout($.current),[]),tg();const H=w.useCallback(W=>{var R,U;return K.current===((R=ee.current)==null?void 0:R.side)&&VL(W,(U=ee.current)==null?void 0:U.area)},[]);return f.jsx(NL,{scope:n,searchRef:q,onItemEnter:w.useCallback(W=>{H(W)&&W.preventDefault()},[H]),onItemLeave:w.useCallback(W=>{var B;H(W)||((B=I.current)==null||B.focus(),L(null))},[H]),onTriggerLeave:w.useCallback(W=>{H(W)&&W.preventDefault()},[H]),pointerGraceTimerRef:X,onPointerGraceIntentChange:w.useCallback(W=>{ee.current=W},[]),children:f.jsx(ne,{...re,children:f.jsx(wd,{asChild:!0,trapped:o,onMountAutoFocus:fe(s,W=>{var B;W.preventDefault(),(B=I.current)==null||B.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:f.jsx(vd,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:h,onPointerDownOutside:p,onFocusOutside:m,onInteractOutside:y,onDismiss:x,children:f.jsx(vk,{asChild:!0,...T,dir:N.dir,orientation:"vertical",loop:r,currentTabStopId:P,onCurrentTabStopIdChange:L,onEntryFocus:fe(u,W=>{N.isUsingKeyboardRef.current||W.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(fS,{role:"menu","aria-orientation":"vertical","data-state":AC(C.open),"data-radix-menu-content":"",dir:N.dir,...M,...k,ref:_,style:{outline:"none",...k.style},onKeyDown:fe(k.onKeyDown,W=>{const R=W.target.closest("[data-radix-menu-content]")===W.currentTarget,U=W.ctrlKey||W.altKey||W.metaKey,Ne=W.key.length===1;R&&(W.key==="Tab"&&W.preventDefault(),!U&&Ne&&ae(W.key));const Se=I.current;if(W.target!==Se||!gL.includes(W.key))return;W.preventDefault();const he=j().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);aC.includes(W.key)&&he.reverse(),zL(he)}),onBlur:fe(t.onBlur,W=>{W.currentTarget.contains(W.target)||(window.clearTimeout($.current),q.current="")}),onPointerMove:fe(t.onPointerMove,oa(W=>{const B=W.target,R=ie.current!==W.clientX;if(W.currentTarget.contains(B)&&R){const U=W.clientX>ie.current?"right":"left";K.current=U,ie.current=W.clientX}}))})})})})})})});pC.displayName=Un;var jL="MenuGroup",Mg=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return f.jsx(Pe.div,{role:"group",...r,ref:e})});Mg.displayName=jL;var AL="MenuLabel",mC=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return f.jsx(Pe.div,{...r,ref:e})});mC.displayName=AL;var Cu="MenuItem",aw="menu.itemSelect",Ld=w.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...o}=t,s=w.useRef(null),l=Sa(Cu,t.__scopeMenu),c=Ng(Cu,t.__scopeMenu),u=Ve(e,s),h=w.useRef(!1),p=()=>{const m=s.current;if(!n&&m){const y=new CustomEvent(aw,{bubbles:!0,cancelable:!0});m.addEventListener(aw,x=>r==null?void 0:r(x),{once:!0}),_b(m,y),y.defaultPrevented?h.current=!1:l.onClose()}};return f.jsx(gC,{...o,ref:u,disabled:n,onClick:fe(t.onClick,p),onPointerDown:m=>{var y;(y=t.onPointerDown)==null||y.call(t,m),h.current=!0},onPointerUp:fe(t.onPointerUp,m=>{var y;h.current||(y=m.currentTarget)==null||y.click()}),onKeyDown:fe(t.onKeyDown,m=>{const y=c.searchRef.current!=="";n||y&&m.key===" "||um.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});Ld.displayName=Cu;var gC=w.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=t,l=Ng(Cu,n),c=uC(n),u=w.useRef(null),h=Ve(e,u),[p,m]=w.useState(!1),[y,x]=w.useState("");return w.useEffect(()=>{const b=u.current;b&&x((b.textContent??"").trim())},[s.children]),f.jsx(ra.ItemSlot,{scope:n,disabled:r,textValue:o??y,children:f.jsx(wk,{asChild:!0,...c,focusable:!r,children:f.jsx(Pe.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:h,onPointerMove:fe(t.onPointerMove,oa(b=>{r?l.onItemLeave(b):(l.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:fe(t.onPointerLeave,oa(b=>l.onItemLeave(b))),onFocus:fe(t.onFocus,()=>m(!0)),onBlur:fe(t.onBlur,()=>m(!1))})})})}),RL="MenuCheckboxItem",yC=w.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...o}=t;return f.jsx(kC,{scope:t.__scopeMenu,checked:n,children:f.jsx(Ld,{role:"menuitemcheckbox","aria-checked":Nu(n)?"mixed":n,...o,ref:e,"data-state":jg(n),onSelect:fe(o.onSelect,()=>r==null?void 0:r(Nu(n)?!0:!n),{checkForDefaultPrevented:!1})})})});yC.displayName=RL;var xC="MenuRadioGroup",[PL,OL]=Fs(xC,{value:void 0,onValueChange:()=>{}}),vC=w.forwardRef((t,e)=>{const{value:n,onValueChange:r,...o}=t,s=Ot(r);return f.jsx(PL,{scope:t.__scopeMenu,value:n,onValueChange:s,children:f.jsx(Mg,{...o,ref:e})})});vC.displayName=xC;var wC="MenuRadioItem",bC=w.forwardRef((t,e)=>{const{value:n,...r}=t,o=OL(wC,t.__scopeMenu),s=n===o.value;return f.jsx(kC,{scope:t.__scopeMenu,checked:s,children:f.jsx(Ld,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":jg(s),onSelect:fe(r.onSelect,()=>{var l;return(l=o.onValueChange)==null?void 0:l.call(o,n)},{checkForDefaultPrevented:!1})})})});bC.displayName=wC;var Tg="MenuItemIndicator",[kC,IL]=Fs(Tg,{checked:!1}),SC=w.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...o}=t,s=IL(Tg,n);return f.jsx(vn,{present:r||Nu(s.checked)||s.checked===!0,children:f.jsx(Pe.span,{...o,ref:e,"data-state":jg(s.checked)})})});SC.displayName=Tg;var DL="MenuSeparator",CC=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return f.jsx(Pe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});CC.displayName=DL;var _L="MenuArrow",NC=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=_d(n);return f.jsx(hS,{...o,...r,ref:e})});NC.displayName=_L;var LL="MenuSub",[yH,EC]=Fs(LL),$l="MenuSubTrigger",MC=w.forwardRef((t,e)=>{const n=Bs($l,t.__scopeMenu),r=Sa($l,t.__scopeMenu),o=EC($l,t.__scopeMenu),s=Ng($l,t.__scopeMenu),l=w.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=s,h={__scopeMenu:t.__scopeMenu},p=w.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return w.useEffect(()=>p,[p]),w.useEffect(()=>{const m=c.current;return()=>{window.clearTimeout(m),u(null)}},[c,u]),f.jsx(Sg,{asChild:!0,...h,children:f.jsx(gC,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":AC(n.open),...t,ref:Yr(e,o.onTriggerChange),onClick:m=>{var y;(y=t.onClick)==null||y.call(t,m),!(t.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:fe(t.onPointerMove,oa(m=>{s.onItemEnter(m),!m.defaultPrevented&&!t.disabled&&!n.open&&!l.current&&(s.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),p()},100))})),onPointerLeave:fe(t.onPointerLeave,oa(m=>{var x,b;p();const y=(x=n.content)==null?void 0:x.getBoundingClientRect();if(y){const k=(b=n.content)==null?void 0:b.dataset.side,C=k==="right",N=C?-5:5,M=y[C?"left":"right"],T=y[C?"right":"left"];s.onPointerGraceIntentChange({area:[{x:m.clientX+N,y:m.clientY},{x:M,y:y.top},{x:T,y:y.top},{x:T,y:y.bottom},{x:M,y:y.bottom}],side:k}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(m),m.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:fe(t.onKeyDown,m=>{var x;const y=s.searchRef.current!=="";t.disabled||y&&m.key===" "||yL[r.dir].includes(m.key)&&(n.onOpenChange(!0),(x=n.content)==null||x.focus(),m.preventDefault())})})})});MC.displayName=$l;var TC="MenuSubContent",jC=w.forwardRef((t,e)=>{const n=fC(Un,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,s=Bs(Un,t.__scopeMenu),l=Sa(Un,t.__scopeMenu),c=EC(TC,t.__scopeMenu),u=w.useRef(null),h=Ve(e,u);return f.jsx(ra.Provider,{scope:t.__scopeMenu,children:f.jsx(vn,{present:r||s.open,children:f.jsx(ra.Slot,{scope:t.__scopeMenu,children:f.jsx(Eg,{id:c.contentId,"aria-labelledby":c.triggerId,...o,ref:h,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{var m;l.isUsingKeyboardRef.current&&((m=u.current)==null||m.focus()),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:fe(t.onFocusOutside,p=>{p.target!==c.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:fe(t.onEscapeKeyDown,p=>{l.onClose(),p.preventDefault()}),onKeyDown:fe(t.onKeyDown,p=>{var x;const m=p.currentTarget.contains(p.target),y=xL[l.dir].includes(p.key);m&&y&&(s.onOpenChange(!1),(x=c.trigger)==null||x.focus(),p.preventDefault())})})})})})});jC.displayName=TC;function AC(t){return t?"open":"closed"}function Nu(t){return t==="indeterminate"}function jg(t){return Nu(t)?"indeterminate":t?"checked":"unchecked"}function zL(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function $L(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function FL(t,e,n){const o=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let l=$L(t,Math.max(s,0));o.length===1&&(l=l.filter(h=>h!==n));const u=l.find(h=>h.toLowerCase().startsWith(o.toLowerCase()));return u!==n?u:void 0}function BL(t,e){const{x:n,y:r}=t;let o=!1;for(let s=0,l=e.length-1;s<e.length;l=s++){const c=e[s],u=e[l],h=c.x,p=c.y,m=u.x,y=u.y;p>r!=y>r&&n<(m-h)*(r-p)/(y-p)+h&&(o=!o)}return o}function VL(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return BL(n,e)}function oa(t){return e=>e.pointerType==="mouse"?t(e):void 0}var HL=dC,WL=Sg,UL=hC,KL=pC,qL=Mg,GL=mC,JL=Ld,YL=yC,QL=vC,XL=bC,ZL=SC,e3=CC,t3=NC,n3=MC,r3=jC,zd="DropdownMenu",[o3]=ur(zd,[cC]),an=cC(),[s3,RC]=o3(zd),PC=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:l,modal:c=!0}=t,u=an(e),h=w.useRef(null),[p,m]=Fo({prop:o,defaultProp:s??!1,onChange:l,caller:zd});return f.jsx(s3,{scope:e,triggerId:Sr(),triggerRef:h,contentId:Sr(),open:p,onOpenChange:m,onOpenToggle:w.useCallback(()=>m(y=>!y),[m]),modal:c,children:f.jsx(HL,{...u,open:p,onOpenChange:m,dir:r,modal:c,children:n})})};PC.displayName=zd;var OC="DropdownMenuTrigger",IC=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=t,s=RC(OC,n),l=an(n);return f.jsx(WL,{asChild:!0,...l,children:f.jsx(Pe.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":r?"":void 0,disabled:r,...o,ref:Yr(e,s.triggerRef),onPointerDown:fe(t.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:fe(t.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});IC.displayName=OC;var i3="DropdownMenuPortal",DC=t=>{const{__scopeDropdownMenu:e,...n}=t,r=an(e);return f.jsx(UL,{...r,...n})};DC.displayName=i3;var _C="DropdownMenuContent",LC=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=RC(_C,n),s=an(n),l=w.useRef(!1);return f.jsx(KL,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:e,onCloseAutoFocus:fe(t.onCloseAutoFocus,c=>{var u;l.current||(u=o.triggerRef.current)==null||u.focus(),l.current=!1,c.preventDefault()}),onInteractOutside:fe(t.onInteractOutside,c=>{const u=c.detail.originalEvent,h=u.button===0&&u.ctrlKey===!0,p=u.button===2||h;(!o.modal||p)&&(l.current=!0)}),style:{...t.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)"}})});LC.displayName=_C;var l3="DropdownMenuGroup",a3=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=an(n);return f.jsx(qL,{...o,...r,ref:e})});a3.displayName=l3;var c3="DropdownMenuLabel",zC=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=an(n);return f.jsx(GL,{...o,...r,ref:e})});zC.displayName=c3;var u3="DropdownMenuItem",$C=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=an(n);return f.jsx(JL,{...o,...r,ref:e})});$C.displayName=u3;var d3="DropdownMenuCheckboxItem",FC=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=an(n);return f.jsx(YL,{...o,...r,ref:e})});FC.displayName=d3;var f3="DropdownMenuRadioGroup",h3=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=an(n);return f.jsx(QL,{...o,...r,ref:e})});h3.displayName=f3;var p3="DropdownMenuRadioItem",BC=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=an(n);return f.jsx(XL,{...o,...r,ref:e})});BC.displayName=p3;var m3="DropdownMenuItemIndicator",VC=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=an(n);return f.jsx(ZL,{...o,...r,ref:e})});VC.displayName=m3;var g3="DropdownMenuSeparator",HC=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=an(n);return f.jsx(e3,{...o,...r,ref:e})});HC.displayName=g3;var y3="DropdownMenuArrow",x3=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=an(n);return f.jsx(t3,{...o,...r,ref:e})});x3.displayName=y3;var v3="DropdownMenuSubTrigger",WC=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=an(n);return f.jsx(n3,{...o,...r,ref:e})});WC.displayName=v3;var w3="DropdownMenuSubContent",UC=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=an(n);return f.jsx(r3,{...o,...r,ref:e,style:{...t.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)"}})});UC.displayName=w3;var b3=PC,k3=IC,S3=DC,KC=LC,qC=zC,GC=$C,JC=FC,YC=BC,QC=VC,XC=HC,ZC=WC,eN=UC;const tN=b3,nN=k3,C3=w.forwardRef(({className:t,inset:e,children:n,...r},o)=>f.jsxs(ZC,{ref:o,className:Ee("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",e&&"pl-8",t),...r,children:[n,f.jsx(sb,{className:"ml-auto h-4 w-4"})]}));C3.displayName=ZC.displayName;const N3=w.forwardRef(({className:t,...e},n)=>f.jsx(eN,{ref:n,className:Ee("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));N3.displayName=eN.displayName;const Ag=w.forwardRef(({className:t,sideOffset:e=4,...n},r)=>f.jsx(S3,{children:f.jsx(KC,{ref:r,sideOffset:e,className:Ee("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));Ag.displayName=KC.displayName;const Eu=w.forwardRef(({className:t,inset:e,...n},r)=>f.jsx(GC,{ref:r,className:Ee("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));Eu.displayName=GC.displayName;const E3=w.forwardRef(({className:t,children:e,checked:n,...r},o)=>f.jsxs(JC,{ref:o,className:Ee("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...r,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(QC,{children:f.jsx(qo,{className:"h-4 w-4"})})}),e]}));E3.displayName=JC.displayName;const M3=w.forwardRef(({className:t,children:e,...n},r)=>f.jsxs(YC,{ref:r,className:Ee("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(QC,{children:f.jsx(fA,{className:"h-2 w-2 fill-current"})})}),e]}));M3.displayName=YC.displayName;const T3=w.forwardRef(({className:t,inset:e,...n},r)=>f.jsx(qC,{ref:r,className:Ee("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));T3.displayName=qC.displayName;const dm=w.forwardRef(({className:t,...e},n)=>f.jsx(XC,{ref:n,className:Ee("-mx-1 my-1 h-px bg-muted",t),...e}));dm.displayName=XC.displayName;const j3={document:{label:"Document",icon:$o},folder:{label:"Folder",icon:lb},tag:{label:"Tag",icon:fb},nest:{label:"Nest",icon:ob}};function A3({stewards:t,loading:e=!1,showScope:n=!1,className:r,onAddSteward:o,onRemove:s,compact:l=!1}){const[c,u]=w.useState(null),h=async y=>{if(s){u(y);try{await s(y)}finally{u(null)}}},p=y=>{const x=j3[y.scope];let b="";return y.scope==="tag"?b=y.tagName||"":(y.scope==="document"||y.scope==="folder")&&(b=y.nodePattern||""),f.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[f.jsx(x.icon,{className:"h-3 w-3"}),f.jsx("span",{children:x.label}),b&&f.jsxs("span",{className:"opacity-75",children:[": ",b]})]})},m=y=>(y.userEmail[0]||"?").toUpperCase();return e?f.jsx("div",{className:Ee("flex items-center justify-center py-4",r),children:f.jsx(jt,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):t.length===0?f.jsxs("div",{className:Ee("text-center py-4",r),children:[f.jsx(En,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),f.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"No stewards assigned"}),o&&f.jsxs(xe,{variant:"outline",size:"sm",onClick:o,children:[f.jsx(Mi,{className:"h-4 w-4 mr-2"}),"Assign Steward"]})]}):l?f.jsxs("div",{className:Ee("flex items-center gap-1",r),children:[f.jsx(En,{className:"h-4 w-4 text-muted-foreground"}),f.jsx("div",{className:"flex -space-x-2",children:t.slice(0,3).map(y=>f.jsx(Ho,{className:"h-6 w-6 border-2 border-background",children:f.jsx(Wo,{className:"text-[10px]",children:m(y)})},y.id))}),t.length>3&&f.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",t.length-3]}),o&&f.jsx(xe,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:o,children:f.jsx(Mi,{className:"h-3 w-3"})})]}):f.jsxs("div",{className:Ee("space-y-2",r),children:[t.map(y=>f.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg border bg-card",children:[f.jsx(Ho,{className:"h-8 w-8",children:f.jsx(Wo,{children:m(y)})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("p",{className:"font-medium text-sm truncate",children:y.userEmail}),n&&p(y),f.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[f.jsx(Wn,{variant:"secondary",className:"text-[10px] px-1.5 py-0 capitalize",children:y.role}),y.canApprove&&f.jsx(Wn,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Approve"}),y.canReject&&f.jsx(Wn,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Reject"})]})]}),s&&f.jsxs(tN,{children:[f.jsx(nN,{asChild:!0,children:f.jsx(xe,{variant:"ghost",size:"icon",className:"h-8 w-8",disabled:c===y.id,children:c===y.id?f.jsx(jt,{className:"h-4 w-4 animate-spin"}):f.jsx(wA,{className:"h-4 w-4"})})}),f.jsx(Ag,{align:"end",children:f.jsxs(Eu,{className:"text-destructive",onClick:()=>h(y.id),children:[f.jsx(pb,{className:"h-4 w-4 mr-2"}),"Remove"]})})]})]},y.id)),o&&f.jsxs(xe,{variant:"outline",className:"w-full",onClick:o,children:[f.jsx(Mi,{className:"h-4 w-4 mr-2"}),"Add Steward"]})]})}var $d="Checkbox",[R3]=ur($d),[P3,Rg]=R3($d);function O3(t){const{__scopeCheckbox:e,checked:n,children:r,defaultChecked:o,disabled:s,form:l,name:c,onCheckedChange:u,required:h,value:p="on",internal_do_not_use_render:m}=t,[y,x]=Fo({prop:n,defaultProp:o??!1,onChange:u,caller:$d}),[b,k]=w.useState(null),[C,N]=w.useState(null),M=w.useRef(!1),T=b?!!l||!!b.closest("form"):!0,j={checked:y,disabled:s,setChecked:x,control:b,setControl:k,name:c,form:l,value:p,hasConsumerStoppedPropagationRef:M,required:h,defaultChecked:Oo(o)?!1:o,isFormControl:T,bubbleInput:C,setBubbleInput:N};return f.jsx(P3,{scope:e,...j,children:I3(m)?m(j):r})}var rN="CheckboxTrigger",oN=w.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:n,...r},o)=>{const{control:s,value:l,disabled:c,checked:u,required:h,setControl:p,setChecked:m,hasConsumerStoppedPropagationRef:y,isFormControl:x,bubbleInput:b}=Rg(rN,t),k=Ve(o,p),C=w.useRef(u);return w.useEffect(()=>{const N=s==null?void 0:s.form;if(N){const M=()=>m(C.current);return N.addEventListener("reset",M),()=>N.removeEventListener("reset",M)}},[s,m]),f.jsx(Pe.button,{type:"button",role:"checkbox","aria-checked":Oo(u)?"mixed":u,"aria-required":h,"data-state":cN(u),"data-disabled":c?"":void 0,disabled:c,value:l,...r,ref:k,onKeyDown:fe(e,N=>{N.key==="Enter"&&N.preventDefault()}),onClick:fe(n,N=>{m(M=>Oo(M)?!0:!M),b&&x&&(y.current=N.isPropagationStopped(),y.current||N.stopPropagation())})})});oN.displayName=rN;var Pg=w.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:s,required:l,disabled:c,value:u,onCheckedChange:h,form:p,...m}=t;return f.jsx(O3,{__scopeCheckbox:n,checked:o,defaultChecked:s,disabled:c,required:l,onCheckedChange:h,name:r,form:p,value:u,internal_do_not_use_render:({isFormControl:y})=>f.jsxs(f.Fragment,{children:[f.jsx(oN,{...m,ref:e,__scopeCheckbox:n}),y&&f.jsx(aN,{__scopeCheckbox:n})]})})});Pg.displayName=$d;var sN="CheckboxIndicator",iN=w.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:r,...o}=t,s=Rg(sN,n);return f.jsx(vn,{present:r||Oo(s.checked)||s.checked===!0,children:f.jsx(Pe.span,{"data-state":cN(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});iN.displayName=sN;var lN="CheckboxBubbleInput",aN=w.forwardRef(({__scopeCheckbox:t,...e},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:s,defaultChecked:l,required:c,disabled:u,name:h,value:p,form:m,bubbleInput:y,setBubbleInput:x}=Rg(lN,t),b=Ve(n,x),k=cg(s),C=ug(r);w.useEffect(()=>{const M=y;if(!M)return;const T=window.HTMLInputElement.prototype,P=Object.getOwnPropertyDescriptor(T,"checked").set,L=!o.current;if(k!==s&&P){const I=new Event("click",{bubbles:L});M.indeterminate=Oo(s),P.call(M,Oo(s)?!1:s),M.dispatchEvent(I)}},[y,k,s,o]);const N=w.useRef(Oo(s)?!1:s);return f.jsx(Pe.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??N.current,required:c,disabled:u,name:h,value:p,form:m,...e,tabIndex:-1,ref:b,style:{...e.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});aN.displayName=lN;function I3(t){return typeof t=="function"}function Oo(t){return t==="indeterminate"}function cN(t){return Oo(t)?"indeterminate":t?"checked":"unchecked"}const fm=w.forwardRef(({className:t,...e},n)=>f.jsx(Pg,{ref:n,className:Ee("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:f.jsx(iN,{className:Ee("flex items-center justify-center text-current"),children:f.jsx(qo,{className:"h-4 w-4"})})}));fm.displayName=Pg.displayName;const Uc={nest:{label:"Entire Nest",icon:ob,placeholder:""},tag:{label:"Tag",icon:fb,placeholder:"e.g., #architecture"},folder:{label:"Folder",icon:lb,placeholder:"e.g., nodes/api-*"},document:{label:"Document",icon:$o,placeholder:"e.g., nodes/getting-started"}};function D3({isOpen:t,onClose:e,nestId:n,onSubmit:r}){const[o,s]=w.useState(""),[l,c]=w.useState("tag"),[u,h]=w.useState(""),[p,m]=w.useState("reviewer"),[y,x]=w.useState(!0),[b,k]=w.useState(!0),[C,N]=w.useState(!1),[M,T]=w.useState(null),[j,P]=w.useState([]),[L,I]=w.useState([]),[_,$]=w.useState(!1);w.useEffect(()=>{if(!t||l!=="document"&&l!=="folder"||_)return;let K=!1;return $(!0),(l==="document"?Km(n).then(ne=>({kind:"document",res:ne})):Q1().then(ne=>({kind:"folder",res:ne}))).then(ne=>{var re,ae;if(!K)if(ne.kind==="document"){const H=Array.isArray((re=ne.res)==null?void 0:re.nodes)?ne.res.nodes:[];P(H)}else{const H=Array.isArray((ae=ne.res)==null?void 0:ae.nests)?ne.res.nests:[];I(H.map(W=>({id:W.id,name:W.name})))}}).catch(ne=>{console.error("[StewardAssignmentModal] options fetch failed",ne)}).finally(()=>{K||$(!1)}),()=>{K=!0}},[t,l,n]);const q=async()=>{if(!o.trim()){T("Please enter an email");return}if(l!=="nest"&&!u.trim()){T(`Please specify the ${l} target`);return}N(!0),T(null);try{await r({email:o.trim(),scope:l,target:l==="nest"?void 0:u.trim(),role:p,canApprove:y,canReject:b}),X()}catch(K){T(K instanceof Error?K.message:"Failed to assign steward")}finally{N(!1)}},X=()=>{C||(s(""),c("tag"),h(""),m("reviewer"),x(!0),k(!0),T(null),P([]),I([]),e())},ee=Uc[l].icon;return f.jsx(xn,{open:t,onOpenChange:X,children:f.jsxs(nn,{className:"sm:max-w-[500px]",children:[f.jsxs(rn,{children:[f.jsx(on,{children:"Assign Context Steward"}),f.jsx(An,{children:"Stewards can approve or reject documents within their assigned scope, ensuring quality context is available for AI."})]}),f.jsxs("div",{className:"space-y-4 py-4",children:[M&&f.jsxs(ir,{variant:"destructive",children:[f.jsx(Hn,{className:"h-4 w-4"}),f.jsx(lr,{children:M})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(yt,{htmlFor:"email",children:"Steward Email"}),f.jsx(yn,{id:"email",type:"email",placeholder:"reviewer@acme.com",value:o,onChange:K=>s(K.target.value),disabled:C})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(yt,{children:"Scope"}),f.jsxs(Ci,{value:l,onValueChange:K=>{c(K),h("")},disabled:C,children:[f.jsx(xs,{children:f.jsx(Ni,{})}),f.jsx(vs,{children:Object.entries(Uc).map(([K,ie])=>{const ne=ie.icon;return f.jsx(Qt,{value:K,children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(ne,{className:"h-4 w-4"}),ie.label]})},K)})})]})]}),l!=="nest"&&f.jsxs("div",{className:"space-y-2",children:[f.jsxs(yt,{htmlFor:"target",children:[f.jsx(ee,{className:"h-4 w-4 inline mr-2"}),l==="tag"?"Tag":`${Uc[l].label}`]}),l==="tag"?f.jsx(yn,{id:"target",placeholder:Uc.tag.placeholder,value:u,onChange:K=>h(K.target.value),disabled:C}):l==="document"?f.jsxs(Ci,{value:u,onValueChange:h,disabled:C||_,children:[f.jsx(xs,{id:"target",children:f.jsx(Ni,{placeholder:_?"Loading documents...":j.length===0?"No documents in this nest":"Select a document"})}),f.jsx(vs,{children:j.map(K=>f.jsx(Qt,{value:K.id,children:f.jsxs("div",{className:"flex flex-col",children:[f.jsx("span",{children:K.title}),f.jsx("span",{className:"text-xs text-muted-foreground",children:K.id})]})},K.id))})]}):f.jsxs(Ci,{value:u,onValueChange:h,disabled:C||_,children:[f.jsx(xs,{id:"target",children:f.jsx(Ni,{placeholder:_?"Loading folders...":L.length===0?"No folders available":"Select a folder"})}),f.jsx(vs,{children:L.map(K=>f.jsx(Qt,{value:K.id,children:K.name},K.id))})]}),f.jsx("p",{className:"text-xs text-muted-foreground",children:l==="tag"?"Steward approves any document with this tag.":l==="folder"?"All documents inside this folder are governed.":"Steward governs this specific document."})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(yt,{children:"Role"}),f.jsxs(Ci,{value:p,onValueChange:K=>m(K),disabled:C,children:[f.jsx(xs,{children:f.jsx(Ni,{})}),f.jsxs(vs,{children:[f.jsx(Qt,{value:"editor",children:"Editor — can edit but not approve"}),f.jsx(Qt,{value:"reviewer",children:"Reviewer — can approve/reject"}),f.jsx(Qt,{value:"viewer",children:"Viewer — read-only access"})]})]})]}),f.jsxs("div",{className:"space-y-3",children:[f.jsx(yt,{children:"Permissions"}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(fm,{id:"can-approve",checked:y,onCheckedChange:K=>x(!!K),disabled:C}),f.jsx(yt,{htmlFor:"can-approve",className:"font-normal cursor-pointer",children:"Can approve documents"})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(fm,{id:"can-reject",checked:b,onCheckedChange:K=>k(!!K),disabled:C}),f.jsx(yt,{htmlFor:"can-reject",className:"font-normal cursor-pointer",children:"Can reject/request changes"})]})]})]}),f.jsxs(Nr,{children:[f.jsx(xe,{variant:"outline",onClick:X,disabled:C,children:"Cancel"}),f.jsxs(xe,{onClick:q,disabled:C||!o.trim(),children:[C?f.jsx(jt,{className:"h-4 w-4 mr-2 animate-spin"}):f.jsx(Mi,{className:"h-4 w-4 mr-2"}),"Assign Steward"]})]})]})})}const _3={low:{label:"Low",className:"bg-gray-100 text-gray-600"},normal:{label:"Normal",className:"bg-blue-100 text-blue-600"},high:{label:"High",className:"bg-amber-100 text-amber-600",icon:N0},urgent:{label:"Urgent",className:"bg-red-100 text-red-600",icon:N0}};function L3(t){const e=new Date(t),r=new Date().getTime()-e.getTime();return r<6e4?"Just now":r<36e5?`${Math.floor(r/6e4)}m ago`:r<864e5?`${Math.floor(r/36e5)}h ago`:r<6048e5?`${Math.floor(r/864e5)}d ago`:e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function z3({requests:t,loading:e=!1,error:n=null,className:r,showHeader:o=!0,onRefresh:s,onSelect:l}){return e?f.jsxs(Mt,{className:r,children:[o&&f.jsx(Ft,{className:"pb-3",children:f.jsx(Bt,{className:"text-lg",children:"Review Queue"})}),f.jsx(Tt,{children:f.jsx("div",{className:"flex items-center justify-center py-8",children:f.jsx(jt,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):n?f.jsxs(Mt,{className:r,children:[o&&f.jsx(Ft,{className:"pb-3",children:f.jsx(Bt,{className:"text-lg",children:"Review Queue"})}),f.jsx(Tt,{children:f.jsxs("div",{className:"text-center py-4 text-sm text-destructive",children:[n,s&&f.jsx(xe,{variant:"ghost",size:"sm",onClick:s,className:"ml-2",children:f.jsx(mu,{className:"h-4 w-4"})})]})})]}):f.jsxs(Mt,{className:r,children:[o&&f.jsx(Ft,{className:"pb-3",children:f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx(Bt,{className:"text-lg",children:"Review Queue"}),f.jsx(rr,{children:"Documents awaiting your approval"})]}),s&&f.jsx(xe,{variant:"ghost",size:"icon",onClick:s,className:"h-8 w-8",children:f.jsx(mu,{className:"h-4 w-4"})})]})}),f.jsx(Tt,{children:t.length===0?f.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[f.jsx(Pi,{className:"h-10 w-10 text-green-500 mb-3"}),f.jsx("p",{className:"text-sm font-medium",children:"All caught up!"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"No documents awaiting review"})]}):f.jsx("div",{className:"space-y-2",children:t.map(c=>{var p;const u=_3[c.priority],h=u.icon;return f.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors group",onClick:()=>l==null?void 0:l(c),children:[f.jsx($o,{className:"h-5 w-5 text-blue-500 flex-shrink-0"}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"font-medium truncate",children:c.nodeId}),f.jsxs(Wn,{variant:"secondary",className:Ee("text-[10px] px-1.5 py-0",u.className),children:[h&&f.jsx(h,{className:"h-3 w-3 mr-1"}),u.label]})]}),f.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-1",children:[f.jsxs("span",{children:["v",c.version]}),f.jsx("span",{children:"•"}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(Ho,{className:"h-4 w-4",children:f.jsx(Wo,{className:"text-[8px]",children:((p=c.requestedBy[0])==null?void 0:p.toUpperCase())||"?"})}),f.jsx("span",{children:c.requestedBy})]}),f.jsx("span",{children:"•"}),f.jsx(Ym,{className:"h-3 w-3"}),f.jsx("span",{children:L3(c.requestedAt)})]}),c.requestNote&&f.jsxs("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:["“",c.requestNote,"”"]})]}),f.jsx(sb,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]},c.id)})})})]})}const Og=w.forwardRef(({className:t,...e},n)=>f.jsx("textarea",{className:Ee("flex min-h-[82px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));Og.displayName="Textarea";function uN({documentTitle:t,version:e,onApprove:n,onReject:r,className:o}){const[s,l]=w.useState(null),[c,u]=w.useState(""),[h,p]=w.useState(!1),[m,y]=w.useState(null),x=async()=>{if(s){if(s==="reject"&&!c.trim()){y("Please provide feedback explaining why this document is being rejected.");return}p(!0),y(null);try{s==="approve"?await n(c||void 0):await r(c),b()}catch(k){y(k instanceof Error?k.message:`Failed to ${s} document`)}finally{p(!1)}}},b=()=>{h||(l(null),u(""),y(null))};return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:o,children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs(xe,{variant:"outline",className:"border-green-200 text-green-700 hover:bg-green-50 hover:text-green-800",onClick:()=>l("approve"),children:[f.jsx(Pi,{className:"h-4 w-4 mr-2"})," Approve"]}),f.jsxs(xe,{variant:"outline",className:"border-red-200 text-red-700 hover:bg-red-50 hover:text-red-800",onClick:()=>l("reject"),children:[f.jsx(Kp,{className:"h-4 w-4 mr-2"})," Request Changes"]})]})}),f.jsx(xn,{open:!!s,onOpenChange:b,children:f.jsxs(nn,{className:"sm:max-w-[425px]",children:[f.jsxs(rn,{children:[f.jsx(on,{children:s==="approve"?"Approve Document":"Request Changes"}),f.jsx(An,{children:s==="approve"?`Approve "${t}" (v${e}). This version will become the official AI context for this document.`:`Request changes for "${t}" (v${e}). The author will be notified with your feedback.`})]}),f.jsxs("div",{className:"space-y-4 py-4",children:[m&&f.jsxs(ir,{variant:"destructive",children:[f.jsx(Hn,{className:"h-4 w-4"}),f.jsx(lr,{children:m})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs(yt,{htmlFor:"review-note",children:[f.jsx(eR,{className:"h-4 w-4 inline mr-2"}),s==="approve"?"Note (optional)":"Feedback (required)"]}),f.jsx(Og,{id:"review-note",placeholder:s==="approve"?"Add any notes for the author...":"Explain what changes are needed...",value:c,onChange:k=>u(k.target.value),disabled:h,className:"min-h-[100px]"}),s==="reject"&&f.jsx("p",{className:"text-xs text-muted-foreground",children:"Providing clear feedback helps authors make the right changes."})]})]}),f.jsxs(Nr,{children:[f.jsx(xe,{variant:"outline",onClick:b,disabled:h,children:"Cancel"}),f.jsxs(xe,{onClick:x,disabled:h,className:s==="approve"?"bg-green-600 hover:bg-green-700":"bg-red-600 hover:bg-red-700",children:[h?f.jsx(jt,{className:"h-4 w-4 mr-2 animate-spin"}):s==="approve"?f.jsx(Pi,{className:"h-4 w-4 mr-2"}):f.jsx(Kp,{className:"h-4 w-4 mr-2"}),s==="approve"?"Approve":"Request Changes"]})]})]})})]})}function dN({isOpen:t,onClose:e,documentTitle:n,currentVersion:r,onSubmit:o}){const[s,l]=w.useState(""),[c,u]=w.useState("normal"),[h,p]=w.useState(!1),[m,y]=w.useState(null),x=async()=>{p(!0),y(null);try{await o(s,c),b()}catch(k){y(k instanceof Error?k.message:"Failed to submit for review")}finally{p(!1)}},b=()=>{h||(l(""),u("normal"),y(null),e())};return f.jsx(xn,{open:t,onOpenChange:b,children:f.jsxs(nn,{className:"sm:max-w-[425px]",children:[f.jsxs(rn,{children:[f.jsx(on,{children:"Submit for Review"}),f.jsxs(An,{children:["Submit “",n,"” (v",r,") for steward approval. Once approved, this version will be available as AI context."]})]}),f.jsxs("div",{className:"space-y-4 py-4",children:[m&&f.jsxs(ir,{variant:"destructive",children:[f.jsx(Hn,{className:"h-4 w-4"}),f.jsx(lr,{children:m})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(yt,{htmlFor:"priority",children:"Priority"}),f.jsxs(Ci,{value:c,onValueChange:k=>u(k),disabled:h,children:[f.jsx(xs,{id:"priority",children:f.jsx(Ni,{placeholder:"Select priority"})}),f.jsxs(vs,{children:[f.jsx(Qt,{value:"low",children:"Low"}),f.jsx(Qt,{value:"normal",children:"Normal"}),f.jsx(Qt,{value:"high",children:"High"}),f.jsx(Qt,{value:"urgent",children:"Urgent"})]})]})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(yt,{htmlFor:"note",children:"Note for Reviewer (optional)"}),f.jsx(Og,{id:"note",placeholder:"Add context or specific areas to review...",value:s,onChange:k=>l(k.target.value),disabled:h,className:"min-h-[100px]"})]})]}),f.jsxs(Nr,{children:[f.jsx(xe,{variant:"outline",onClick:b,disabled:h,children:"Cancel"}),f.jsxs(xe,{onClick:x,disabled:h,children:[h?f.jsx(jt,{className:"h-4 w-4 mr-2 animate-spin"}):f.jsx(Qm,{className:"h-4 w-4 mr-2"}),"Submit for Review"]})]})]})})}function $3(t,e){return w.useReducer((n,r)=>e[n][r]??n,t)}var Ig="ScrollArea",[fN]=ur(Ig),[F3,Gn]=fN(Ig),hN=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...l}=t,[c,u]=w.useState(null),[h,p]=w.useState(null),[m,y]=w.useState(null),[x,b]=w.useState(null),[k,C]=w.useState(null),[N,M]=w.useState(0),[T,j]=w.useState(0),[P,L]=w.useState(!1),[I,_]=w.useState(!1),$=Ve(e,X=>u(X)),q=va(o);return f.jsx(F3,{scope:n,type:r,dir:q,scrollHideDelay:s,scrollArea:c,viewport:h,onViewportChange:p,content:m,onContentChange:y,scrollbarX:x,onScrollbarXChange:b,scrollbarXEnabled:P,onScrollbarXEnabledChange:L,scrollbarY:k,onScrollbarYChange:C,scrollbarYEnabled:I,onScrollbarYEnabledChange:_,onCornerWidthChange:M,onCornerHeightChange:j,children:f.jsx(Pe.div,{dir:q,...l,ref:$,style:{position:"relative","--radix-scroll-area-corner-width":N+"px","--radix-scroll-area-corner-height":T+"px",...t.style}})})});hN.displayName=Ig;var pN="ScrollAreaViewport",mN=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:o,...s}=t,l=Gn(pN,n),c=w.useRef(null),u=Ve(e,c,l.onViewportChange);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),f.jsx(Pe.div,{"data-radix-scroll-area-viewport":"",...s,ref:u,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:f.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});mN.displayName=pN;var jr="ScrollAreaScrollbar",Dg=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,o=Gn(jr,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:l}=o,c=t.orientation==="horizontal";return w.useEffect(()=>(c?s(!0):l(!0),()=>{c?s(!1):l(!1)}),[c,s,l]),o.type==="hover"?f.jsx(B3,{...r,ref:e,forceMount:n}):o.type==="scroll"?f.jsx(V3,{...r,ref:e,forceMount:n}):o.type==="auto"?f.jsx(gN,{...r,ref:e,forceMount:n}):o.type==="always"?f.jsx(_g,{...r,ref:e}):null});Dg.displayName=jr;var B3=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,o=Gn(jr,t.__scopeScrollArea),[s,l]=w.useState(!1);return w.useEffect(()=>{const c=o.scrollArea;let u=0;if(c){const h=()=>{window.clearTimeout(u),l(!0)},p=()=>{u=window.setTimeout(()=>l(!1),o.scrollHideDelay)};return c.addEventListener("pointerenter",h),c.addEventListener("pointerleave",p),()=>{window.clearTimeout(u),c.removeEventListener("pointerenter",h),c.removeEventListener("pointerleave",p)}}},[o.scrollArea,o.scrollHideDelay]),f.jsx(vn,{present:n||s,children:f.jsx(gN,{"data-state":s?"visible":"hidden",...r,ref:e})})}),V3=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,o=Gn(jr,t.__scopeScrollArea),s=t.orientation==="horizontal",l=Bd(()=>u("SCROLL_END"),100),[c,u]=$3("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return w.useEffect(()=>{if(c==="idle"){const h=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(h)}},[c,o.scrollHideDelay,u]),w.useEffect(()=>{const h=o.viewport,p=s?"scrollLeft":"scrollTop";if(h){let m=h[p];const y=()=>{const x=h[p];m!==x&&(u("SCROLL"),l()),m=x};return h.addEventListener("scroll",y),()=>h.removeEventListener("scroll",y)}},[o.viewport,s,u,l]),f.jsx(vn,{present:n||c!=="hidden",children:f.jsx(_g,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:fe(t.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:fe(t.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),gN=w.forwardRef((t,e)=>{const n=Gn(jr,t.__scopeScrollArea),{forceMount:r,...o}=t,[s,l]=w.useState(!1),c=t.orientation==="horizontal",u=Bd(()=>{if(n.viewport){const h=n.viewport.offsetWidth<n.viewport.scrollWidth,p=n.viewport.offsetHeight<n.viewport.scrollHeight;l(c?h:p)}},10);return Ii(n.viewport,u),Ii(n.content,u),f.jsx(vn,{present:r||s,children:f.jsx(_g,{"data-state":s?"visible":"hidden",...o,ref:e})})}),_g=w.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,o=Gn(jr,t.__scopeScrollArea),s=w.useRef(null),l=w.useRef(0),[c,u]=w.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=bN(c.viewport,c.content),p={...r,sizes:c,onSizesChange:u,hasThumb:h>0&&h<1,onThumbChange:y=>s.current=y,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:y=>l.current=y};function m(y,x){return G3(y,l.current,c,x)}return n==="horizontal"?f.jsx(H3,{...p,ref:e,onThumbPositionChange:()=>{if(o.viewport&&s.current){const y=o.viewport.scrollLeft,x=cw(y,c,o.dir);s.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:y=>{o.viewport&&(o.viewport.scrollLeft=y)},onDragScroll:y=>{o.viewport&&(o.viewport.scrollLeft=m(y,o.dir))}}):n==="vertical"?f.jsx(W3,{...p,ref:e,onThumbPositionChange:()=>{if(o.viewport&&s.current){const y=o.viewport.scrollTop,x=cw(y,c);s.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:y=>{o.viewport&&(o.viewport.scrollTop=y)},onDragScroll:y=>{o.viewport&&(o.viewport.scrollTop=m(y))}}):null}),H3=w.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...o}=t,s=Gn(jr,t.__scopeScrollArea),[l,c]=w.useState(),u=w.useRef(null),h=Ve(e,u,s.onScrollbarXChange);return w.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),f.jsx(xN,{"data-orientation":"horizontal",...o,ref:h,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Fd(n)+"px",...t.style},onThumbPointerDown:p=>t.onThumbPointerDown(p.x),onDragScroll:p=>t.onDragScroll(p.x),onWheelScroll:(p,m)=>{if(s.viewport){const y=s.viewport.scrollLeft+p.deltaX;t.onWheelScroll(y),SN(y,m)&&p.preventDefault()}},onResize:()=>{u.current&&s.viewport&&l&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:Tu(l.paddingLeft),paddingEnd:Tu(l.paddingRight)}})}})}),W3=w.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...o}=t,s=Gn(jr,t.__scopeScrollArea),[l,c]=w.useState(),u=w.useRef(null),h=Ve(e,u,s.onScrollbarYChange);return w.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),f.jsx(xN,{"data-orientation":"vertical",...o,ref:h,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Fd(n)+"px",...t.style},onThumbPointerDown:p=>t.onThumbPointerDown(p.y),onDragScroll:p=>t.onDragScroll(p.y),onWheelScroll:(p,m)=>{if(s.viewport){const y=s.viewport.scrollTop+p.deltaY;t.onWheelScroll(y),SN(y,m)&&p.preventDefault()}},onResize:()=>{u.current&&s.viewport&&l&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:Tu(l.paddingTop),paddingEnd:Tu(l.paddingBottom)}})}})}),[U3,yN]=fN(jr),xN=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:u,onDragScroll:h,onWheelScroll:p,onResize:m,...y}=t,x=Gn(jr,n),[b,k]=w.useState(null),C=Ve(e,$=>k($)),N=w.useRef(null),M=w.useRef(""),T=x.viewport,j=r.content-r.viewport,P=Ot(p),L=Ot(u),I=Bd(m,10);function _($){if(N.current){const q=$.clientX-N.current.left,X=$.clientY-N.current.top;h({x:q,y:X})}}return w.useEffect(()=>{const $=q=>{const X=q.target;(b==null?void 0:b.contains(X))&&P(q,j)};return document.addEventListener("wheel",$,{passive:!1}),()=>document.removeEventListener("wheel",$,{passive:!1})},[T,b,j,P]),w.useEffect(L,[r,L]),Ii(b,I),Ii(x.content,I),f.jsx(U3,{scope:n,scrollbar:b,hasThumb:o,onThumbChange:Ot(s),onThumbPointerUp:Ot(l),onThumbPositionChange:L,onThumbPointerDown:Ot(c),children:f.jsx(Pe.div,{...y,ref:C,style:{position:"absolute",...y.style},onPointerDown:fe(t.onPointerDown,$=>{$.button===0&&($.target.setPointerCapture($.pointerId),N.current=b.getBoundingClientRect(),M.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),_($))}),onPointerMove:fe(t.onPointerMove,_),onPointerUp:fe(t.onPointerUp,$=>{const q=$.target;q.hasPointerCapture($.pointerId)&&q.releasePointerCapture($.pointerId),document.body.style.webkitUserSelect=M.current,x.viewport&&(x.viewport.style.scrollBehavior=""),N.current=null})})})}),Mu="ScrollAreaThumb",vN=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,o=yN(Mu,t.__scopeScrollArea);return f.jsx(vn,{present:n||o.hasThumb,children:f.jsx(K3,{ref:e,...r})})}),K3=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...o}=t,s=Gn(Mu,n),l=yN(Mu,n),{onThumbPositionChange:c}=l,u=Ve(e,m=>l.onThumbChange(m)),h=w.useRef(void 0),p=Bd(()=>{h.current&&(h.current(),h.current=void 0)},100);return w.useEffect(()=>{const m=s.viewport;if(m){const y=()=>{if(p(),!h.current){const x=J3(m,c);h.current=x,c()}};return c(),m.addEventListener("scroll",y),()=>m.removeEventListener("scroll",y)}},[s.viewport,p,c]),f.jsx(Pe.div,{"data-state":l.hasThumb?"visible":"hidden",...o,ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:fe(t.onPointerDownCapture,m=>{const x=m.target.getBoundingClientRect(),b=m.clientX-x.left,k=m.clientY-x.top;l.onThumbPointerDown({x:b,y:k})}),onPointerUp:fe(t.onPointerUp,l.onThumbPointerUp)})});vN.displayName=Mu;var Lg="ScrollAreaCorner",wN=w.forwardRef((t,e)=>{const n=Gn(Lg,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?f.jsx(q3,{...t,ref:e}):null});wN.displayName=Lg;var q3=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,o=Gn(Lg,n),[s,l]=w.useState(0),[c,u]=w.useState(0),h=!!(s&&c);return Ii(o.scrollbarX,()=>{var m;const p=((m=o.scrollbarX)==null?void 0:m.offsetHeight)||0;o.onCornerHeightChange(p),u(p)}),Ii(o.scrollbarY,()=>{var m;const p=((m=o.scrollbarY)==null?void 0:m.offsetWidth)||0;o.onCornerWidthChange(p),l(p)}),h?f.jsx(Pe.div,{...r,ref:e,style:{width:s,height:c,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Tu(t){return t?parseInt(t,10):0}function bN(t,e){const n=t/e;return isNaN(n)?0:n}function Fd(t){const e=bN(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function G3(t,e,n,r="ltr"){const o=Fd(n),s=o/2,l=e||s,c=o-l,u=n.scrollbar.paddingStart+l,h=n.scrollbar.size-n.scrollbar.paddingEnd-c,p=n.content-n.viewport,m=r==="ltr"?[0,p]:[p*-1,0];return kN([u,h],m)(t)}function cw(t,e,n="ltr"){const r=Fd(e),o=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-o,l=e.content-e.viewport,c=s-r,u=n==="ltr"?[0,l]:[l*-1,0],h=tm(t,u);return kN([0,l],[0,c])(h)}function kN(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function SN(t,e){return t>0&&t<e}var J3=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function o(){const s={left:t.scrollLeft,top:t.scrollTop},l=n.left!==s.left,c=n.top!==s.top;(l||c)&&e(),n=s,r=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(r)};function Bd(t,e){const n=Ot(t),r=w.useRef(0);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),w.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function Ii(t,e){const n=Ot(e);bt(()=>{let r=0;if(t){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(t),()=>{window.cancelAnimationFrame(r),o.unobserve(t)}}},[t,n])}var CN=hN,Y3=mN,Q3=wN;const hm=w.forwardRef(({className:t,children:e,...n},r)=>f.jsxs(CN,{ref:r,className:Ee("relative overflow-hidden",t),...n,children:[f.jsx(Y3,{className:"h-full w-full rounded-[inherit]",children:e}),f.jsx(NN,{}),f.jsx(Q3,{})]}));hm.displayName=CN.displayName;const NN=w.forwardRef(({className:t,orientation:e="vertical",...n},r)=>f.jsx(Dg,{ref:r,orientation:e,className:Ee("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:f.jsx(vN,{className:"relative flex-1 rounded-full bg-border"})}));NN.displayName=Dg.displayName;function uw(t){return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}function X3({versions:t,currentVersion:e,approvedVersion:n,loading:r=!1,onRestore:o,className:s}){var k;const[l,c]=w.useState(null),[u,h]=w.useState(null),[p,m]=w.useState(!1),y=async()=>{if(!(!u||!o)){m(!0);try{await o(u),h(null)}finally{m(!1)}}};if(r)return f.jsxs(Mt,{className:s,children:[f.jsx(Ft,{className:"pb-3",children:f.jsxs(Bt,{className:"text-sm font-medium flex items-center gap-2",children:[f.jsx(Gp,{className:"h-4 w-4"}),"Version History"]})}),f.jsx(Tt,{children:f.jsx("div",{className:"flex items-center justify-center py-4",children:f.jsx(jt,{className:"h-5 w-5 animate-spin text-muted-foreground"})})})]});const x=(k=t.find(C=>C.version===e))==null?void 0:k.status,b=x==="approved"?"bg-green-100 text-green-800 border-green-200":x==="rejected"?"bg-red-100 text-red-800 border-red-200":x==="pending_review"?"bg-amber-100 text-amber-800 border-amber-200":"bg-muted text-muted-foreground";return f.jsxs(Mt,{className:s,children:[f.jsx(Ft,{className:"pb-3",children:f.jsxs(Bt,{className:"text-sm font-medium flex items-center gap-2",children:[f.jsx(Gp,{className:"h-4 w-4"}),"Version History",x&&f.jsx(Wn,{variant:"outline",className:`text-[10px] ${b}`,children:x.replace("_"," ")}),f.jsxs(Wn,{variant:"secondary",className:"text-[10px] ml-auto",children:["v",e]})]})}),f.jsx(Tt,{children:t.length===0?f.jsx("div",{className:"text-center py-4 text-sm text-muted-foreground",children:"No version history"}):f.jsx(hm,{className:"max-h-[240px]",children:f.jsx("div",{className:"space-y-1",children:t.map(C=>{const N=C.version===n;return f.jsxs("div",{className:`flex items-center justify-between p-2 rounded hover:bg-muted/50 group ${N?"bg-green-50 border border-green-200":""}`,children:[f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:["Version ",C.version,N&&f.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-green-700",children:[f.jsx(Pi,{className:"h-3 w-3"})," AI-active"]})]}),f.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:[uw(C.editedAt)," · ",C.editedBy,C.changeNote&&` · ${C.changeNote}`]}),C.resolvedBy&&f.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:[C.resolutionStatus==="rejected"?"Rejected by":"Approved by"," ",f.jsx("span",{className:"font-medium",children:C.resolvedBy})]})]}),f.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[C.content&&f.jsx(xe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>c(C),children:f.jsx(ib,{className:"h-3.5 w-3.5"})}),o&&C.version!==e&&f.jsx(xe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>h(C.version),children:f.jsx(S0,{className:"h-3.5 w-3.5"})})]})]},C.version)})})})}),f.jsx(xn,{open:!!l,onOpenChange:()=>c(null),children:f.jsxs(nn,{className:"max-w-2xl max-h-[80vh]",children:[f.jsxs(rn,{children:[f.jsxs(on,{children:["Version ",l==null?void 0:l.version," Preview"]}),f.jsxs(An,{children:[l&&uw(l.editedAt),(l==null?void 0:l.changeNote)&&` · ${l.changeNote}`]})]}),f.jsx(hm,{className:"max-h-[50vh]",children:f.jsx("pre",{className:"text-sm whitespace-pre-wrap font-mono p-4 bg-muted/30 rounded",children:(l==null?void 0:l.content)||"(no content)"})}),f.jsxs(Nr,{children:[f.jsx(xe,{variant:"outline",onClick:()=>c(null),children:"Close"}),o&&l&&l.version!==e&&f.jsxs(xe,{onClick:()=>{h(l.version),c(null)},children:[f.jsx(S0,{className:"h-4 w-4 mr-2"}),"Restore This Version"]})]})]})}),f.jsx(xn,{open:!!u,onOpenChange:()=>h(null),children:f.jsxs(nn,{children:[f.jsxs(rn,{children:[f.jsxs(on,{children:["Restore Version ",u,"?"]}),f.jsxs(An,{children:["This will create a new version with the content from version ",u,". Your current content will be saved in the version history."]})]}),f.jsxs(Nr,{children:[f.jsx(xe,{variant:"outline",onClick:()=>h(null),disabled:p,children:"Cancel"}),f.jsx(xe,{onClick:y,disabled:p,children:p?"Restoring...":"Restore"})]})]})})]})}const dw={draft:{label:"Draft",icon:CA,className:"bg-gray-100 text-gray-700 border-gray-200"},pending_review:{label:"Pending Review",icon:Ym,className:"bg-amber-100 text-amber-700 border-amber-200"},approved:{label:"Approved",icon:Pi,className:"bg-green-100 text-green-700 border-green-200"},rejected:{label:"Rejected",icon:Kp,className:"bg-red-100 text-red-700 border-red-200"}};function Z3({status:t,approvedVersion:e,currentVersion:n,showIcon:r=!0,size:o="default",className:s}){const l=dw[t]||dw.draft,c=l.icon,u=t==="approved"&&e&&n&&e<n;return f.jsxs(Wn,{variant:"outline",className:Ee("!rounded-sm",l.className,o==="sm"&&"text-[10px] px-1.5 py-0",s),children:[r&&f.jsx(c,{className:Ee("mr-1",o==="sm"?"h-3 w-3":"h-3.5 w-3.5")}),l.label,u&&f.jsxs("span",{className:"ml-1 text-[10px] opacity-75",children:["(v",e,")"]})]})}function $t(t){this.content=t}$t.prototype={constructor:$t,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),s=r.content.slice();return o==-1?s.push(n||t,e):(s[o+1]=e,n&&(s[o]=n)),new $t(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new $t(n)},addToStart:function(t,e){return new $t([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new $t(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),s=r.find(t);return o.splice(s==-1?o.length:s,0,e,n),new $t(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=$t.from(t),t.size?new $t(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=$t.from(t),t.size?new $t(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=$t.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}};$t.from=function(t){if(t instanceof $t)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new $t(e)};function EN(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),s=e.child(r);if(o==s){n+=o.nodeSize;continue}if(!o.sameMarkup(s))return n;if(o.isText&&o.text!=s.text){for(let l=0;o.text[l]==s.text[l];l++)n++;return n}if(o.content.size||s.content.size){let l=EN(o.content,s.content,n+1);if(l!=null)return l}n+=o.nodeSize}}function MN(t,e,n,r){for(let o=t.childCount,s=e.childCount;;){if(o==0||s==0)return o==s?null:{a:n,b:r};let l=t.child(--o),c=e.child(--s),u=l.nodeSize;if(l==c){n-=u,r-=u;continue}if(!l.sameMarkup(c))return{a:n,b:r};if(l.isText&&l.text!=c.text){let h=0,p=Math.min(l.text.length,c.text.length);for(;h<p&&l.text[l.text.length-h-1]==c.text[c.text.length-h-1];)h++,n--,r--;return{a:n,b:r}}if(l.content.size||c.content.size){let h=MN(l.content,c.content,n-1,r-1);if(h)return h}n-=u,r-=u}}class Y{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,s){for(let l=0,c=0;c<n;l++){let u=this.content[l],h=c+u.nodeSize;if(h>e&&r(u,o+c,s||null,l)!==!1&&u.content.size){let p=c+1;u.nodesBetween(Math.max(0,e-p),Math.min(u.content.size,n-p),r,o+p)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let s="",l=!0;return this.nodesBetween(e,n,(c,u)=>{let h=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?o?typeof o=="function"?o(c):o:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(l?l=!1:s+=r),s+=h},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)o.push(e.content[s]);return new Y(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 s=0,l=0;l<n;s++){let c=this.content[s],u=l+c.nodeSize;u>e&&((l<e||u>n)&&(c.isText?c=c.cut(Math.max(0,e-l),Math.min(c.text.length,n-l)):c=c.cut(Math.max(0,e-l-1),Math.min(c.content.size,n-l-1))),r.push(c),o+=c.nodeSize),l=u}return new Y(r,o)}cutByIndex(e,n){return e==n?Y.empty:e==0&&n==this.content.length?this:new Y(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new Y(o,s)}addToStart(e){return new Y([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Y(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 EN(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return MN(this,e,n,r)}findIndex(e){if(e==0)return Kc(0,e);if(e==this.size)return Kc(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),s=r+o.nodeSize;if(s>=e)return s==e?Kc(n+1,s):Kc(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Y.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Y(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Y.empty;let n,r=0;for(let o=0;o<e.length;o++){let s=e[o];r+=s.nodeSize,o&&s.isText&&e[o-1].sameMarkup(s)?(n||(n=e.slice(0,o)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new Y(n||e,r)}static from(e){if(!e)return Y.empty;if(e instanceof Y)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Y([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Y.empty=new Y([],0);const mp={index:0,offset:0};function Kc(t,e){return mp.index=t,mp.offset=e,mp}function ju(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(!ju(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!ju(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ye=class pm{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let s=e[o];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,o));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ju(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}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 pm.none;if(e instanceof pm)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Ye.none=[];class Au extends Error{}class ue{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=jN(this.content,e+this.openStart,n);return r&&new ue(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ue(TN(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 ue.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 ue(Y.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)o++;return new ue(e,r,o)}}ue.empty=new ue(Y.empty,0,0);function TN(t,e,n){let{index:r,offset:o}=t.findIndex(e),s=t.maybeChild(r),{index:l,offset:c}=t.findIndex(n);if(o==e||s.isText){if(c!=n&&!t.child(l).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=l)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(TN(s.content,e-o-1,n-o-1)))}function jN(t,e,n,r){let{index:o,offset:s}=t.findIndex(e),l=t.maybeChild(o);if(s==e||l.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=jN(l.content,e-s-1,n,l);return c&&t.replaceChild(o,l.copy(c))}function e4(t,e,n){if(n.openStart>t.depth)throw new Au("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Au("Inconsistent open depths");return AN(t,e,n,0)}function AN(t,e,n,r){let o=t.index(r),s=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let l=AN(t,e,n,r+1);return s.copy(s.content.replaceChild(o,l))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let l=t.parent,c=l.content;return Es(l,c.cut(0,t.parentOffset).append(n.content).append(c.cut(e.parentOffset)))}else{let{start:l,end:c}=t4(n,t);return Es(s,PN(t,l,c,e,r))}else return Es(s,Ru(t,e,r))}function RN(t,e){if(!e.type.compatibleContent(t.type))throw new Au("Cannot join "+e.type.name+" onto "+t.type.name)}function mm(t,e,n){let r=t.node(n);return RN(r,e.node(n)),r}function Ns(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 Ul(t,e,n,r){let o=(e||t).node(n),s=0,l=e?e.index(n):o.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Ns(t.nodeAfter,r),s++));for(let c=s;c<l;c++)Ns(o.child(c),r);e&&e.depth==n&&e.textOffset&&Ns(e.nodeBefore,r)}function Es(t,e){return t.type.checkContent(e),t.copy(e)}function PN(t,e,n,r,o){let s=t.depth>o&&mm(t,e,o+1),l=r.depth>o&&mm(n,r,o+1),c=[];return Ul(null,t,o,c),s&&l&&e.index(o)==n.index(o)?(RN(s,l),Ns(Es(s,PN(t,e,n,r,o+1)),c)):(s&&Ns(Es(s,Ru(t,e,o+1)),c),Ul(e,n,o,c),l&&Ns(Es(l,Ru(n,r,o+1)),c)),Ul(r,null,o,c),new Y(c)}function Ru(t,e,n){let r=[];if(Ul(null,t,n,r),t.depth>n){let o=mm(t,e,n+1);Ns(Es(o,Ru(t,e,n+1)),r)}return Ul(e,null,n,r),new Y(r)}function t4(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)o=e.node(s).copy(Y.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class sa{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 s=0;s<e;s++)o+=r.child(s).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 c=r;r=o,o=c}let s=r.marks;for(var l=0;l<s.length;l++)s[l].type.spec.inclusive===!1&&(!o||!s[l].isInSet(o.marks))&&(s=s[l--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!o||!r[s].isInSet(o.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Pu(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,s=n;for(let l=e;;){let{index:c,offset:u}=l.content.findIndex(s),h=s-u;if(r.push(l,c,o+u),!h||(l=l.child(c),l.isText))break;s=h-1,o+=u+1}return new sa(n,r,s)}static resolveCached(e,n){let r=fw.get(e);if(r)for(let s=0;s<r.elts.length;s++){let l=r.elts[s];if(l.pos==n)return l}else fw.set(e,r=new n4);let o=r.elts[r.i]=sa.resolve(e,n);return r.i=(r.i+1)%r4,o}}class n4{constructor(){this.elts=[],this.i=0}}const r4=12,fw=new WeakMap;class Pu{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const o4=Object.create(null);let Io=class gm{constructor(e,n,r,o=Ye.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||Y.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&&ju(this.attrs,n||e.defaultAttrs||o4)&&Ye.sameSet(this.marks,r||Ye.none)}copy(e=null){return e==this.content?this:new gm(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new gm(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 ue.empty;let o=this.resolve(e),s=this.resolve(n),l=r?0:o.sharedDepth(n),c=o.start(l),h=o.node(l).content.cut(o.pos-c,s.pos-c);return new ue(h,o.depth-l,s.depth-l)}replace(e,n,r){return e4(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 sa.resolveCached(this,e)}resolveNoCache(e){return sa.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.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()+")"),ON(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=Y.empty,o=0,s=r.childCount){let l=this.contentMatchAt(e).matchFragment(r,o,s),c=l&&l.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=o;u<s;u++)if(!this.type.allowsMarks(r.child(u).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let s=this.contentMatchAt(e).matchType(r),l=s&&s.matchFragment(this.content,n);return l?l.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ye.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!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=Y.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,o,r);return s.type.checkAttrs(s.attrs),s}};Io.prototype.text=void 0;class Ou extends Io{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):ON(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 Ou(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ou(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 ON(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Is{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new s4(e,n);if(r.next==null)return Is.empty;let o=IN(r);r.next&&r.err("Unexpected trailing text");let s=f4(d4(o));return h4(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let s=n;o&&s<r;s++)o=o.matchType(e.child(s).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 s(l,c){let u=l.matchFragment(e,r);if(u&&(!n||u.validEnd))return Y.from(c.map(h=>h.createAndFill()));for(let h=0;h<l.next.length;h++){let{type:p,next:m}=l.next[h];if(!(p.isText||p.hasRequiredAttrs())&&o.indexOf(m)==-1){o.push(m);let y=s(m,c.concat(p));if(y)return y}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),s=o.match;if(s.matchType(e)){let l=[];for(let c=o;c.type;c=c.via)l.push(c.type);return l.reverse()}for(let l=0;l<s.next.length;l++){let{type:c,next:u}=s.next[l];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in n)&&(!o.type||u.validEnd)&&(r.push({match:c.contentMatch,type:c,via:o}),n[c.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let 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 s=o+(r.validEnd?"*":" ")+" ";for(let l=0;l<r.next.length;l++)s+=(l?", ":"")+r.next[l].type.name+"->"+e.indexOf(r.next[l].next);return s}).join(`
443
+ `)}}Is.empty=new Is(!0);class s4{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 IN(t){let e=[];do e.push(i4(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function i4(t){let e=[];do e.push(l4(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function l4(t){let e=u4(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=a4(t,e);else break;return e}function hw(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function a4(t,e){let n=hw(t),r=n;return t.eat(",")&&(t.next!="}"?r=hw(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function c4(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let s in n){let l=n[s];l.isInGroup(e)&&o.push(l)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function u4(t){if(t.eat("(")){let e=IN(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=c4(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 d4(t){let e=[[]];return o(s(t,0),n()),e;function n(){return e.push([])-1}function r(l,c,u){let h={term:u,to:c};return e[l].push(h),h}function o(l,c){l.forEach(u=>u.to=c)}function s(l,c){if(l.type=="choice")return l.exprs.reduce((u,h)=>u.concat(s(h,c)),[]);if(l.type=="seq")for(let u=0;;u++){let h=s(l.exprs[u],c);if(u==l.exprs.length-1)return h;o(h,c=n())}else if(l.type=="star"){let u=n();return r(c,u),o(s(l.expr,u),u),[r(u)]}else if(l.type=="plus"){let u=n();return o(s(l.expr,c),u),o(s(l.expr,u),u),[r(u)]}else{if(l.type=="opt")return[r(c)].concat(s(l.expr,c));if(l.type=="range"){let u=c;for(let h=0;h<l.min;h++){let p=n();o(s(l.expr,u),p),u=p}if(l.max==-1)o(s(l.expr,u),u);else for(let h=l.min;h<l.max;h++){let p=n();r(u,p),o(s(l.expr,u),p),u=p}return[r(u)]}else{if(l.type=="name")return[r(c,void 0,l.value)];throw new Error("Unknown expr type")}}}}function DN(t,e){return e-t}function pw(t,e){let n=[];return r(e),n.sort(DN);function r(o){let s=t[o];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(o);for(let l=0;l<s.length;l++){let{term:c,to:u}=s[l];!c&&n.indexOf(u)==-1&&r(u)}}}function f4(t){let e=Object.create(null);return n(pw(t,0));function n(r){let o=[];r.forEach(l=>{t[l].forEach(({term:c,to:u})=>{if(!c)return;let h;for(let p=0;p<o.length;p++)o[p][0]==c&&(h=o[p][1]);pw(t,u).forEach(p=>{h||o.push([c,h=[]]),h.indexOf(p)==-1&&h.push(p)})})});let s=e[r.join(",")]=new Is(r.indexOf(t.length-1)>-1);for(let l=0;l<o.length;l++){let c=o[l][1].sort(DN);s.next.push({type:o[l][0],next:e[c.join(",")]||n(c)})}return s}}function h4(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],s=!o.validEnd,l=[];for(let c=0;c<o.next.length;c++){let{type:u,next:h}=o.next[c];l.push(u.name),s&&!(u.isText||u.hasRequiredAttrs())&&(s=!1),r.indexOf(h)==-1&&r.push(h)}s&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function _N(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 LN(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let s=t[r];if(s.hasDefault)o=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function zN(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let s=t[o];s.validate&&s.validate(e[o])}}function $N(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new m4(t,r,e[r]);return n}let mw=class FN{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=$N(e,r.attrs),this.defaultAttrs=_N(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==Is.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:LN(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Io(this,this.computeAttrs(e),Y.from(n),Ye.setFrom(r))}createChecked(e=null,n,r){return n=Y.from(n),this.checkContent(n),new Io(this,this.computeAttrs(e),n,Ye.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Y.from(n),n.size){let l=this.contentMatch.fillBefore(n);if(!l)return null;n=l.append(n)}let o=this.contentMatch.matchFragment(n),s=o&&o.fillBefore(Y.empty,!0);return s?new Io(this,e,n.append(s),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){zN(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Ye.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,l)=>r[s]=new FN(s,n,l));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 s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function p4(t,e,n){let r=n.split("|");return o=>{let s=o===null?"null":typeof o;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class m4{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?p4(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Vd{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=$N(e,o.attrs),this.excluded=null;let s=_N(this.attrs);this.instance=s?new Ye(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Ye(this,LN(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((s,l)=>r[s]=new Vd(s,o++,n,l)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){zN(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class BN{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=$t.from(e.nodes),n.marks=$t.from(e.marks||{}),this.nodes=mw.compile(this.spec.nodes,this),this.marks=Vd.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let s=this.nodes[o],l=s.spec.content||"",c=s.spec.marks;if(s.contentMatch=r[l]||(r[l]=Is.parse(l,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=c=="_"?null:c?gw(this,c.split(" ")):c==""||!s.inlineContent?[]:null}for(let o in this.marks){let s=this.marks[o],l=s.spec.excludes;s.excluded=l==null?[s]:l==""?[]:gw(this,l.split(" "))}this.nodeFromJSON=o=>Io.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 mw){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 Ou(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 gw(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],s=t.marks[o],l=s;if(s)n.push(s);else for(let c in t.marks){let u=t.marks[c];(o=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(o)>-1)&&n.push(l=u)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function g4(t){return t.tag!=null}function y4(t){return t.style!=null}class Do{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(g4(o))this.tags.push(o);else if(y4(o)){let s=/[^=]*/.exec(o.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let s=e.nodes[o.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new xw(this,n,!1);return r.addAll(e,Ye.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new xw(this,n,!0);return r.addAll(e,Ye.none,n.from,n.to),ue.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let s=this.tags[o];if(w4(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let l=s.getAttrs(e);if(l===!1)continue;s.attrs=l||void 0}return s}}}matchStyle(e,n,r,o){for(let s=o?this.styles.indexOf(o)+1:0;s<this.styles.length;s++){let l=this.styles[s],c=l.style;if(!(c.indexOf(e)!=0||l.context&&!r.matchesContext(l.context)||c.length>e.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(l.getAttrs){let u=l.getAttrs(n);if(u===!1)continue;l.attrs=u||void 0}return l}}}static schemaRules(e){let n=[];function r(o){let s=o.priority==null?50:o.priority,l=0;for(;l<n.length;l++){let c=n[l];if((c.priority==null?50:c.priority)<s)break}n.splice(l,0,o)}for(let o in e.marks){let s=e.marks[o].spec.parseDOM;s&&s.forEach(l=>{r(l=vw(l)),l.mark||l.ignore||l.clearMark||(l.mark=o)})}for(let o in e.nodes){let s=e.nodes[o].spec.parseDOM;s&&s.forEach(l=>{r(l=vw(l)),l.node||l.ignore||l.mark||(l.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Do(e,Do.schemaRules(e)))}}const VN={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},x4={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},HN={ol:!0,ul:!0},ia=1,ym=2,Kl=4;function yw(t,e,n){return e!=null?(e?ia:0)|(e==="full"?ym:0):t&&t.whitespace=="pre"?ia|ym:n&~Kl}class qc{constructor(e,n,r,o,s,l){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=l,this.content=[],this.activeMarks=Ye.none,this.match=s||(l&Kl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Y.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&ia)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-o[0].length))}}let n=Y.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Y.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&&!VN.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class xw{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,s,l=yw(null,n.preserveWhitespace,0)|(r?Kl:0);o?s=new qc(o.type,o.attrs,Ye.none,!0,n.topMatch||o.type.contentMatch,l):r?s=new qc(null,null,Ye.none,!0,null,l):s=new qc(e.schema.topNodeType,null,Ye.none,!0,null,l),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,o=this.top,s=o.options&ym?"full":this.localPreserveWS||(o.options&ia)>0,{schema:l}=this.parser;if(s==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
444
+ `);else if(l.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(l.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u<c.length;u++)u&&this.insertNode(l.linebreakReplacement.create(),n,!0),c[u]&&this.insertNode(l.text(c[u]),n,!/\S/.test(c[u]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let c=o.content[o.content.length-1],u=e.previousSibling;(!c||u&&u.nodeName=="BR"||c.isText&&/[ \t\r\n\u000c]$/.test(c.text))&&(r=r.slice(1))}r&&this.insertNode(l.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let l=e.nodeName.toLowerCase(),c;HN.hasOwnProperty(l)&&this.parser.normalizeLists&&v4(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(c=this.parser.matchTag(e,this,r));e:if(u?u.ignore:x4.hasOwnProperty(l))this.findInside(e),this.ignoreFallback(e,n);else if(!u||u.skip||u.closeParent){u&&u.closeParent?this.open=Math.max(0,this.open-1):u&&u.skip.nodeType&&(e=u.skip);let h,p=this.needsBlock;if(VN.hasOwnProperty(l))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),h=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let m=u&&u.skip?n:this.readStyles(e,n);m&&this.addAll(e,m),h&&this.sync(s),this.needsBlock=p}else{let h=this.readStyles(e,n);h&&this.addElementByRule(e,u,h,u.consuming===!1?c:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
445
+ `),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 s=this.parser.matchedStyles[o],l=r.getPropertyValue(s);if(l)for(let c=void 0;;){let u=this.parser.matchStyle(s,l,this,c);if(!u)break;if(u.ignore)return null;if(u.clearMark?n=n.filter(h=>!u.clearMark(h)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(e,n,r,o){let s,l;if(n.node)if(l=this.parser.schema.nodes[n.node],l.isLeaf)this.insertNode(l.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(l,n.attrs||null,r,n.preserveWhitespace);u&&(s=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let c=this.top;if(l&&l.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}s&&this.sync(c)&&this.open--}addAll(e,n,r,o){let s=r||0;for(let l=r?e.childNodes[r]:e.firstChild,c=o==null?null:e.childNodes[o];l!=c;l=l.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(l,n);this.findAtPoint(e,s)}findPlace(e,n,r){let o,s;for(let l=this.open,c=0;l>=0;l--){let u=this.nodes[l],h=u.findWrapping(e);if(h&&(!o||o.length>h.length+c)&&(o=h,s=u,!h.length))break;if(u.solid){if(r)break;c+=2}}if(!o)return null;this.sync(s);for(let l=0;l<o.length;l++)n=this.enterInner(o[l],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let l=Ye.none;for(let c of o.concat(e.marks))(s.type?s.type.allowsMarkType(c.type):ww(c.type,e.type))&&(l=c.addToSet(l));return s.content.push(e.mark(l)),!0}return!1}enter(e,n,r,o){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,o)),s}enterInner(e,n,r,o=!1,s){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(e);let c=yw(e,s,l.options);l.options&Kl&&l.content.length==0&&(c|=Kl);let u=Ye.none;return r=r.filter(h=>(l.type?l.type.allowsMarkType(h.type):ww(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new qc(e,n,u,o,null,c)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=ia)}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),s=-(r?r.depth+1:0)+(o?0:1),l=(c,u)=>{for(;c>=0;c--){let h=n[c];if(h==""){if(c==n.length-1||c==0)continue;for(;u>=s;u--)if(l(c-1,u))return!0;return!1}else{let p=u>0||u==0&&o?this.nodes[u].type:r&&u>=s?r.node(u-s).type:null;if(!p||p.name!=h&&!p.isInGroup(h))return!1;u--}}return!0};return l(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function v4(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&HN.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function w4(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function vw(t){let e={};for(let n in t)e[n]=t[n];return e}function ww(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let s=[],l=c=>{s.push(c);for(let u=0;u<c.edgeCount;u++){let{type:h,next:p}=c.edge(u);if(h==e||s.indexOf(p)<0&&l(p))return!0}};if(l(o.contentMatch))return!0}}class Vs{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=gp(n).createDocumentFragment());let o=r,s=[];return e.forEach(l=>{if(s.length||l.marks.length){let c=0,u=0;for(;c<s.length&&u<l.marks.length;){let h=l.marks[u];if(!this.marks[h.type.name]){u++;continue}if(!h.eq(s[c][0])||h.type.spec.spanning===!1)break;c++,u++}for(;c<s.length;)o=s.pop()[1];for(;u<l.marks.length;){let h=l.marks[u++],p=this.serializeMark(h,l.isInline,n);p&&(s.push([h,o]),o.appendChild(p.dom),o=p.contentDOM||p.dom)}}o.appendChild(this.serializeNodeInner(l,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=uu(gp(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 s=this.serializeMark(e.marks[o],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&uu(gp(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return uu(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Vs(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=bw(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return bw(e.marks)}}function bw(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function gp(t){return t.document||window.document}const kw=new WeakMap;function b4(t){let e=kw.get(t);return e===void 0&&kw.set(t,e=k4(t)),e}function k4(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 uu(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],s;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=b4(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=o.indexOf(" ");l>0&&(n=o.slice(0,l),o=o.slice(l+1));let c,u=n?t.createElementNS(n,o):t.createElement(o),h=e[1],p=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){p=2;for(let m in h)if(h[m]!=null){let y=m.indexOf(" ");y>0?u.setAttributeNS(m.slice(0,y),m.slice(y+1),h[m]):m=="style"&&u.style?u.style.cssText=h[m]:u.setAttribute(m,h[m])}}for(let m=p;m<e.length;m++){let y=e[m];if(y===0){if(m<e.length-1||m>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:x,contentDOM:b}=uu(t,y,n,r);if(u.appendChild(x),b){if(c)throw new RangeError("Multiple content holes");c=b}}}return{dom:u,contentDOM:c}}const WN=65535,UN=Math.pow(2,16);function S4(t,e){return t+e*UN}function Sw(t){return t&WN}function C4(t){return(t-(t&WN))/UN}const KN=1,qN=2,du=4,GN=8;class xm{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&GN)>0}get deletedBefore(){return(this.delInfo&(KN|du))>0}get deletedAfter(){return(this.delInfo&(qN|du))>0}get deletedAcross(){return(this.delInfo&du)>0}}class Mn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Mn.empty)return Mn.empty}recover(e){let n=0,r=Sw(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+C4(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,s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?o:0);if(u>e)break;let h=this.ranges[c+s],p=this.ranges[c+l],m=u+h;if(e<=m){let y=h?e==u?-1:e==m?1:n:n,x=u+o+(y<0?0:p);if(r)return x;let b=e==(n<0?u:m)?null:S4(c/3,e-u),k=e==u?qN:e==m?KN:du;return(n<0?e!=u:e!=m)&&(k|=GN),new xm(x,k,b)}o+=p-h}return r?e+o:new xm(e+o,0,null)}touches(e,n){let r=0,o=Sw(n),s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?r:0);if(u>e)break;let h=this.ranges[c+s],p=u+h;if(e<=p&&c==o*3)return!0;r+=this.ranges[c+l]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,s=0;o<this.ranges.length;o+=3){let l=this.ranges[o],c=l-(this.inverted?s:0),u=l+(this.inverted?0:s),h=this.ranges[o+n],p=this.ranges[o+r];e(c,c+h,u,u+p),s+=p-h}}invert(){return new Mn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Mn.empty:new Mn(e<0?[0,-e,0]:[0,0,e])}}Mn.empty=new Mn([]);class la{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 la(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 la;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 s=this.from;s<this.to;s++){let l=this._maps[s],c=l.mapResult(e,n);if(c.recover!=null){let u=this.getMirror(s);if(u!=null&&u>s&&u<this.to){s=u,e=this._maps[u].recover(c.recover);continue}}o|=c.delInfo,e=c.pos}return r?e:new xm(e,o,null)}}const yp=Object.create(null);class Zt{getMap(){return Mn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=yp[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 yp)throw new RangeError("Duplicate use of step JSON ID "+e);return yp[e]=n,n.prototype.jsonID=e,n}}class vt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new vt(e,null)}static fail(e){return new vt(null,e)}static fromReplace(e,n,r,o){try{return vt.ok(e.replace(n,r,o))}catch(s){if(s instanceof Au)return vt.fail(s.message);throw s}}}function zg(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let s=t.child(o);s.content.size&&(s=s.copy(zg(s.content,e,s))),s.isInline&&(s=e(s,n,o)),r.push(s)}return Y.fromArray(r)}class Ao extends Zt{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)),s=new ue(zg(n.content,(l,c)=>!l.isAtom||!c.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),o),n.openStart,n.openEnd);return vt.fromReplace(e,this.from,this.to,s)}invert(){return new sr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Ao(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ao&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ao(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 Ao(n.from,n.to,e.markFromJSON(n.mark))}}Zt.jsonID("addMark",Ao);class sr extends Zt{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 ue(zg(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return vt.fromReplace(e,this.from,this.to,r)}invert(){return new Ao(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new sr(n.pos,r.pos,this.mark)}merge(e){return e instanceof sr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new sr(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 sr(n.from,n.to,e.markFromJSON(n.mark))}}Zt.jsonID("removeMark",sr);class Ro extends Zt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return vt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return vt.fromReplace(e,this.pos,this.pos+1,new ue(Y.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 Ro(this.pos,n.marks[o]);return new Ro(this.pos,this.mark)}}return new Ds(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ro(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 Ro(n.pos,e.markFromJSON(n.mark))}}Zt.jsonID("addNodeMark",Ro);class Ds extends Zt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return vt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return vt.fromReplace(e,this.pos,this.pos+1,new ue(Y.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Ro(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ds(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 Ds(n.pos,e.markFromJSON(n.mark))}}Zt.jsonID("removeNodeMark",Ds);class xt extends Zt{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&vm(e,this.from,this.to)?vt.fail("Structure replace would overwrite content"):vt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Mn([this.from,this.to-this.from,this.slice.size])}invert(e){return new xt(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&&xt.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new xt(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof xt)||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?ue.empty:new ue(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new xt(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?ue.empty:new ue(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new xt(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 xt(n.from,n.to,ue.fromJSON(e,n.slice),!!n.structure)}}xt.MAP_BIAS=1;Zt.jsonID("replace",xt);class It extends Zt{constructor(e,n,r,o,s,l,c=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=s,this.insert=l,this.structure=c}apply(e){if(this.structure&&(vm(e,this.from,this.gapFrom)||vm(e,this.gapTo,this.to)))return vt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return vt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?vt.fromReplace(e,this.from,this.to,r):vt.fail("Content does not fit in gap")}getMap(){return new Mn([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 It(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),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||s>r.pos?null:new It(n.pos,r.pos,o,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new It(n.from,n.to,n.gapFrom,n.gapTo,ue.fromJSON(e,n.slice),n.insert,!!n.structure)}}Zt.jsonID("replaceAround",It);function vm(t,e,n){let r=t.resolve(e),o=n-e,s=r.depth;for(;o>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,o--;if(o>0){let l=r.node(s).maybeChild(r.indexAfter(s));for(;o>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,o--}}return!1}function N4(t,e,n,r){let o=[],s=[],l,c;t.doc.nodesBetween(e,n,(u,h,p)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&p.type.allowsMarkType(r.type)){let y=Math.max(h,e),x=Math.min(h+u.nodeSize,n),b=r.addToSet(m);for(let k=0;k<m.length;k++)m[k].isInSet(b)||(l&&l.to==y&&l.mark.eq(m[k])?l.to=x:o.push(l=new sr(y,x,m[k])));c&&c.to==y?c.to=x:s.push(c=new Ao(y,x,r))}}),o.forEach(u=>t.step(u)),s.forEach(u=>t.step(u))}function E4(t,e,n,r){let o=[],s=0;t.doc.nodesBetween(e,n,(l,c)=>{if(!l.isInline)return;s++;let u=null;if(r instanceof Vd){let h=l.marks,p;for(;p=r.isInSet(h);)(u||(u=[])).push(p),h=p.removeFromSet(h)}else r?r.isInSet(l.marks)&&(u=[r]):u=l.marks;if(u&&u.length){let h=Math.min(c+l.nodeSize,n);for(let p=0;p<u.length;p++){let m=u[p],y;for(let x=0;x<o.length;x++){let b=o[x];b.step==s-1&&m.eq(o[x].style)&&(y=b)}y?(y.to=h,y.step=s):o.push({style:m,from:Math.max(c,e),to:h,step:s})}}}),o.forEach(l=>t.step(new sr(l.from,l.to,l.style)))}function $g(t,e,n,r=n.contentMatch,o=!0){let s=t.doc.nodeAt(e),l=[],c=e+1;for(let u=0;u<s.childCount;u++){let h=s.child(u),p=c+h.nodeSize,m=r.matchType(h.type);if(!m)l.push(new xt(c,p,ue.empty));else{r=m;for(let y=0;y<h.marks.length;y++)n.allowsMarkType(h.marks[y].type)||t.step(new sr(c,p,h.marks[y]));if(o&&h.isText&&n.whitespace!="pre"){let y,x=/\r?\n|\r/g,b;for(;y=x.exec(h.text);)b||(b=new ue(Y.from(n.schema.text(" ",n.allowedMarks(h.marks))),0,0)),l.push(new xt(c+y.index,c+y.index+y[0].length,b))}}c=p}if(!r.validEnd){let u=r.fillBefore(Y.empty,!0);t.replace(c,c,new ue(u,0,0))}for(let u=l.length-1;u>=0;u--)t.step(l[u])}function M4(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ki(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,o=0,s=0;;--r){let l=t.$from.node(r),c=t.$from.index(r)+o,u=t.$to.indexAfter(r)-s;if(r<t.depth&&l.canReplace(c,u,n))return r;if(r==0||l.type.spec.isolating||!M4(l,c,u))break;c&&(o=1),u<l.childCount&&(s=1)}return null}function T4(t,e,n){let{$from:r,$to:o,depth:s}=e,l=r.before(s+1),c=o.after(s+1),u=l,h=c,p=Y.empty,m=0;for(let b=s,k=!1;b>n;b--)k||r.index(b)>0?(k=!0,p=Y.from(r.node(b).copy(p)),m++):u--;let y=Y.empty,x=0;for(let b=s,k=!1;b>n;b--)k||o.after(b+1)<o.end(b)?(k=!0,y=Y.from(o.node(b).copy(y)),x++):h++;t.step(new It(u,h,l,c,new ue(p.append(y),m,x),p.size-m,!0))}function Fg(t,e,n=null,r=t){let o=j4(t,e),s=o&&A4(r,e);return s?o.map(Cw).concat({type:e,attrs:n}).concat(s.map(Cw)):null}function Cw(t){return{type:t,attrs:null}}function j4(t,e){let{parent:n,startIndex:r,endIndex:o}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let l=s.length?s[0]:e;return n.canReplaceWith(r,o,l)?s:null}function A4(t,e){let{parent:n,startIndex:r,endIndex:o}=t,s=n.child(r),l=e.contentMatch.findWrapping(s.type);if(!l)return null;let u=(l.length?l[l.length-1]:e).contentMatch;for(let h=r;u&&h<o;h++)u=u.matchType(n.child(h).type);return!u||!u.validEnd?null:l}function R4(t,e,n){let r=Y.empty;for(let l=n.length-1;l>=0;l--){if(r.size){let c=n[l].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Y.from(n[l].type.create(n[l].attrs,r))}let o=e.start,s=e.end;t.step(new It(o,s,o,s,new ue(r,0,0),n.length,!0))}function P4(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(l,c)=>{let u=typeof o=="function"?o(l):o;if(l.isTextblock&&!l.hasMarkup(r,u)&&O4(t.doc,t.mapping.slice(s).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let x=r.whitespace=="pre",b=!!r.contentMatch.matchType(r.schema.linebreakReplacement);x&&!b?h=!1:!x&&b&&(h=!0)}h===!1&&YN(t,l,c,s),$g(t,t.mapping.slice(s).map(c,1),r,void 0,h===null);let p=t.mapping.slice(s),m=p.map(c,1),y=p.map(c+l.nodeSize,1);return t.step(new It(m,y,m+1,y-1,new ue(Y.from(r.create(u,null,l.marks)),0,0),1,!0)),h===!0&&JN(t,l,c,s),!1}})}function JN(t,e,n,r){e.forEach((o,s)=>{if(o.isText){let l,c=/\r?\n|\r/g;for(;l=c.exec(o.text);){let u=t.mapping.slice(r).map(n+1+s+l.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function YN(t,e,n,r){e.forEach((o,s)=>{if(o.type==o.type.schema.linebreakReplacement){let l=t.mapping.slice(r).map(n+1+s);t.replaceWith(l,l+1,e.type.schema.text(`
446
+ `))}})}function O4(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function I4(t,e,n,r,o){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let l=n.create(r,null,o||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,l);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new It(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new ue(Y.from(l),0,0),1,!0))}function Kr(t,e,n=1,r){let o=t.resolve(e),s=o.depth-n,l=r&&r[r.length-1]||o.parent;if(s<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!l.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let h=o.depth-1,p=n-2;h>s;h--,p--){let m=o.node(h),y=o.index(h);if(m.type.spec.isolating)return!1;let x=m.content.cutByIndex(y,m.childCount),b=r&&r[p+1];b&&(x=x.replaceChild(0,b.type.create(b.attrs)));let k=r&&r[p]||m;if(!m.canReplace(y+1,m.childCount)||!k.type.validContent(x))return!1}let c=o.indexAfter(s),u=r&&r[0];return o.node(s).canReplaceWith(c,c,u?u.type:o.node(s+1).type)}function D4(t,e,n=1,r){let o=t.doc.resolve(e),s=Y.empty,l=Y.empty;for(let c=o.depth,u=o.depth-n,h=n-1;c>u;c--,h--){s=Y.from(o.node(c).copy(s));let p=r&&r[h];l=Y.from(p?p.type.create(p.attrs,l):o.node(c).copy(l))}t.step(new xt(e,e,new ue(s.append(l),n,n),!0))}function Qo(t,e){let n=t.resolve(e),r=n.index();return QN(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function _4(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 s=e.child(o),l=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(l),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function QN(t,e){return!!(t&&e&&!t.isLeaf&&_4(t,e))}function Hd(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let s,l,c=r.index(o);if(o==r.depth?(s=r.nodeBefore,l=r.nodeAfter):n>0?(s=r.node(o+1),c++,l=r.node(o).maybeChild(c)):(s=r.node(o).maybeChild(c-1),l=r.node(o+1)),s&&!s.isTextblock&&QN(s,l)&&r.node(o).canReplace(c,c+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function L4(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,s=t.doc.resolve(e-n),l=s.node().type;if(o&&l.inlineContent){let p=l.whitespace=="pre",m=!!l.contentMatch.matchType(o);p&&!m?r=!1:!p&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let p=t.doc.resolve(e+n);YN(t,p.node(),p.before(),c)}l.inlineContent&&$g(t,e+n-1,l,s.node().contentMatchAt(s.index()),r==null);let u=t.mapping.slice(c),h=u.map(e-n);if(t.step(new xt(h,u.map(e+n,-1),ue.empty,!0)),r===!0){let p=t.doc.resolve(h);JN(t,p.node(),p.before(),t.steps.length)}return t}function z4(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 s=r.index(o);if(r.node(o).canReplaceWith(s,s,n))return r.before(o+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let s=r.indexAfter(o);if(r.node(o).canReplaceWith(s,s,n))return r.after(o+1);if(s<r.node(o).childCount)return null}return null}function XN(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let s=0;s<n.openStart;s++)o=o.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let l=r.depth;l>=0;l--){let c=l==r.depth?0:r.pos<=(r.start(l+1)+r.end(l+1))/2?-1:1,u=r.index(l)+(c>0?1:0),h=r.node(l),p=!1;if(s==1)p=h.canReplace(u,u,o);else{let m=h.contentMatchAt(u).findWrapping(o.firstChild.type);p=m&&h.canReplaceWith(u,u,m[0])}if(p)return c==0?r.pos:c<0?r.before(l+1):r.after(l+1)}return null}function Wd(t,e,n=e,r=ue.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),s=t.resolve(n);return ZN(o,s,r)?new xt(e,n,r):new $4(o,s,r).fit()}function ZN(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class $4{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Y.empty;for(let o=0;o<=e.depth;o++){let s=e.node(o);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=Y.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):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 s=this.placed,l=r.depth,c=o.depth;for(;l&&c&&s.childCount==1;)s=s.firstChild.content,l--,c--;let u=new ue(s,l,c);return e>-1?new It(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new xt(r.pos,o.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(o=0),s.type.spec.isolating&&o<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,s=null;r?(s=xp(this.unplaced.content,r-1).firstChild,o=s.content):o=this.unplaced.content;let l=o.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:h}=this.frontier[c],p,m=null;if(n==1&&(l?h.matchType(l.type)||(m=h.fillBefore(Y.from(l),!1)):s&&u.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:c,parent:s,inject:m};if(n==2&&l&&(p=h.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:c,parent:s,wrap:p};if(s&&h.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=xp(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new ue(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=xp(e,n);if(o.childCount<=1&&n>0){let s=e.size-n<=n+o.size;this.unplaced=new ue(Fl(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new ue(Fl(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let k=0;k<s.length;k++)this.openFrontierNode(s[k]);let l=this.unplaced,c=r?r.content:l.content,u=l.openStart-e,h=0,p=[],{match:m,type:y}=this.frontier[n];if(o){for(let k=0;k<o.childCount;k++)p.push(o.child(k));m=m.matchFragment(o)}let x=c.size+e-(l.content.size-l.openEnd);for(;h<c.childCount;){let k=c.child(h),C=m.matchType(k.type);if(!C)break;h++,(h>1||u==0||k.content.size)&&(m=C,p.push(eE(k.mark(y.allowedMarks(k.marks)),h==1?u:0,h==c.childCount?x:-1)))}let b=h==c.childCount;b||(x=-1),this.placed=Bl(this.placed,n,Y.from(p)),this.frontier[n].match=m,b&&x<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let k=0,C=c;k<x;k++){let N=C.lastChild;this.frontier.push({type:N.type,match:N.contentMatchAt(N.childCount)}),C=N.content}this.unplaced=b?e==0?ue.empty:new ue(Fl(l.content,e-1,1),e-1,x<0?l.openEnd:e-1):new ue(Fl(l.content,e,h),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!vp(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],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),l=vp(e,n,o,r,s);if(l){for(let c=n-1;c>=0;c--){let{match:u,type:h}=this.frontier[c],p=vp(e,c,h,u,!0);if(!p||p.childCount)continue e}return{depth:n,fit:l,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Bl(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),s=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,s)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Bl(this.placed,this.depth,Y.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Y.empty,!0);n.childCount&&(this.placed=Bl(this.placed,this.frontier.length,n))}}function Fl(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Fl(t.firstChild.content,e-1,n)))}function Bl(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Bl(t.lastChild.content,e-1,n)))}function xp(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function eE(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,eE(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(Y.empty,!0)))),t.copy(r)}function vp(t,e,n,r,o){let s=t.node(e),l=o?t.indexAfter(e):t.index(e);if(l==s.childCount&&!n.compatibleContent(s.type))return null;let c=r.fillBefore(s.content,!0,l);return c&&!F4(n,s.content,l)?c:null}function F4(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function B4(t){return t.spec.defining||t.spec.definingForContent}function V4(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),s=t.doc.resolve(n);if(ZN(o,s,r))return t.step(new xt(e,n,r));let l=nE(o,s);l[l.length-1]==0&&l.pop();let c=-(o.depth+1);l.unshift(c);for(let y=o.depth,x=o.pos-1;y>0;y--,x--){let b=o.node(y).type.spec;if(b.defining||b.definingAsContext||b.isolating)break;l.indexOf(y)>-1?c=y:o.before(y)==x&&l.splice(1,0,-y)}let u=l.indexOf(c),h=[],p=r.openStart;for(let y=r.content,x=0;;x++){let b=y.firstChild;if(h.push(b),x==r.openStart)break;y=b.content}for(let y=p-1;y>=0;y--){let x=h[y],b=B4(x.type);if(b&&!x.sameMarkup(o.node(Math.abs(c)-1)))p=y;else if(b||!x.type.isTextblock)break}for(let y=r.openStart;y>=0;y--){let x=(y+p+1)%(r.openStart+1),b=h[x];if(b)for(let k=0;k<l.length;k++){let C=l[(k+u)%l.length],N=!0;C<0&&(N=!1,C=-C);let M=o.node(C-1),T=o.index(C-1);if(M.canReplaceWith(T,T,b.type,b.marks))return t.replace(o.before(C),N?s.after(C):n,new ue(tE(r.content,0,r.openStart,x),x,r.openEnd))}}let m=t.steps.length;for(let y=l.length-1;y>=0&&(t.replace(e,n,r),!(t.steps.length>m));y--){let x=l[y];x<0||(e=o.before(x),n=s.after(x))}}function tE(t,e,n,r,o){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(tE(s.content,e+1,n,r,s)))}if(e>r){let s=o.contentMatchAt(0),l=s.fillBefore(t).append(t);t=l.append(s.matchFragment(l).fillBefore(Y.empty,!0))}return t}function H4(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=z4(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new ue(Y.from(r),0,0))}function W4(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 l=r.sharedDepth(n),c=!1;for(let u=r.depth;u>l;u--)r.node(u).type.spec.isolating&&(c=!0);for(let u=o.depth;u>l;u--)o.node(u).type.spec.isolating&&(c=!0);if(!c){for(let u=r.depth;u>0&&e==r.start(u);u--)e=r.before(u);for(let u=o.depth;u>0&&n==o.start(u);u--)n=o.before(u);r=t.doc.resolve(e),o=t.doc.resolve(n)}}let s=nE(r,o);for(let l=0;l<s.length;l++){let c=s[l],u=l==s.length-1;if(u&&c==0||r.node(c).type.contentMatch.validEnd)return t.delete(r.start(c),o.end(c));if(c>0&&(u||r.node(c-1).canReplace(r.index(c-1),o.indexAfter(c-1))))return t.delete(r.before(c),o.after(c))}for(let l=1;l<=r.depth&&l<=o.depth;l++)if(e-r.start(l)==r.depth-l&&n>r.end(l)&&o.end(l)-n!=o.depth-l&&r.start(l-1)==o.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),o.index(l-1)))return t.delete(r.before(l),n);t.delete(e,n)}function nE(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let s=t.start(o);if(s<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;(s==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==s-1)&&n.push(o)}return n}class Ai extends Zt{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 vt.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return vt.fromReplace(e,this.pos,this.pos+1,new ue(Y.from(o),0,n.isLeaf?0:1))}getMap(){return Mn.empty}invert(e){return new Ai(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 Ai(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 Ai(n.pos,n.attr,n.value)}}Zt.jsonID("attr",Ai);class aa extends Zt{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 vt.ok(r)}getMap(){return Mn.empty}invert(e){return new aa(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 aa(n.attr,n.value)}}Zt.jsonID("docAttr",aa);let Di=class extends Error{};Di=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Di.prototype=Object.create(Error.prototype);Di.prototype.constructor=Di;Di.prototype.name="TransformError";class rE{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new la}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Di(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((s,l,c,u)=>{e=Math.min(e,c),n=Math.max(n,u)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ue.empty){let o=Wd(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new ue(Y.from(r),0,0))}delete(e,n){return this.replace(e,n,ue.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return V4(this,e,n,r),this}replaceRangeWith(e,n,r){return H4(this,e,n,r),this}deleteRange(e,n){return W4(this,e,n),this}lift(e,n){return T4(this,e,n),this}join(e,n=1){return L4(this,e,n),this}wrap(e,n){return R4(this,e,n),this}setBlockType(e,n=e,r,o=null){return P4(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return I4(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Ai(e,n,r)),this}setDocAttribute(e,n){return this.step(new aa(e,n)),this}addNodeMark(e,n){return this.step(new Ro(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 Ds(e,n));else{let o=r.marks,s,l=[];for(;s=n.isInSet(o);)l.push(new Ds(e,s)),o=s.removeFromSet(o);for(let c=l.length-1;c>=0;c--)this.step(l[c])}return this}split(e,n=1,r){return D4(this,e,n,r),this}addMark(e,n,r){return N4(this,e,n,r),this}removeMark(e,n,r){return E4(this,e,n,r),this}clearIncompatible(e,n,r){return $g(this,e,n,r),this}}const wp=Object.create(null);class Le{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new U4(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=ue.empty){let r=n.content.lastChild,o=null;for(let c=0;c<n.openEnd;c++)o=r,r=r.lastChild;let s=e.steps.length,l=this.ranges;for(let c=0;c<l.length;c++){let{$from:u,$to:h}=l[c],p=e.mapping.slice(s);e.replaceRange(p.map(u.pos),p.map(h.pos),c?ue.empty:n),c==0&&Mw(e,s,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:c}=o[s],u=e.mapping.slice(r),h=u.map(l.pos),p=u.map(c.pos);s?e.deleteRange(h,p):(e.replaceRangeWith(h,p,n),Mw(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new Ie(e):bi(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let s=e.depth-1;s>=0;s--){let l=n<0?bi(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):bi(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(l)return l}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new jn(e.node(0))}static atStart(e){return bi(e,e,0,0,1)||new jn(e)}static atEnd(e){return bi(e,e,e.content.size,e.childCount,-1)||new jn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=wp[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 wp)throw new RangeError("Duplicate use of selection JSON ID "+e);return wp[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Ie.between(this.$anchor,this.$head).getBookmark()}}Le.prototype.visible=!0;class U4{constructor(e,n){this.$from=e,this.$to=n}}let Nw=!1;function Ew(t){!Nw&&!t.parent.inlineContent&&(Nw=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Ie extends Le{constructor(e,n=e){Ew(e),Ew(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 Le.near(r);let o=e.resolve(n.map(this.anchor));return new Ie(o.parent.inlineContent?o:r,r)}replace(e,n=ue.empty){if(super.replace(e,n),n==ue.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Ie&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ud(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 Ie(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 s=Le.findFrom(n,r,!0)||Le.findFrom(n,-r,!0);if(s)n=s.$head;else return Le.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(Le.findFrom(e,-r,!0)||Le.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new Ie(e,n)}}Le.jsonID("text",Ie);class Ud{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ud(e.map(this.anchor),e.map(this.head))}resolve(e){return Ie.between(e.resolve(this.anchor),e.resolve(this.head))}}class Te extends Le{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),s=e.resolve(o);return r?Le.near(s):new Te(s)}content(){return new ue(Y.from(this.node),0,0)}eq(e){return e instanceof Te&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Bg(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Te(e.resolve(n.anchor))}static create(e,n){return new Te(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Te.prototype.visible=!1;Le.jsonID("node",Te);class Bg{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Ud(r,r):new Bg(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Te.isSelectable(r)?new Te(n):Le.near(n)}}class jn extends Le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ue.empty){if(n==ue.empty){e.delete(0,e.doc.content.size);let r=Le.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new jn(e)}map(e){return new jn(e)}eq(e){return e instanceof jn}getBookmark(){return K4}}Le.jsonID("all",jn);const K4={map(){return this},resolve(t){return new jn(t)}};function bi(t,e,n,r,o,s=!1){if(e.inlineContent)return Ie.create(t,n);for(let l=r-(o>0?0:1);o>0?l<e.childCount:l>=0;l+=o){let c=e.child(l);if(c.isAtom){if(!s&&Te.isSelectable(c))return Te.create(t,n-(o<0?c.nodeSize:0))}else{let u=bi(t,c,n+o,o<0?c.childCount:0,o,s);if(u)return u}n+=c.nodeSize*o}return null}function Mw(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof xt||o instanceof It))return;let s=t.mapping.maps[r],l;s.forEach((c,u,h,p)=>{l==null&&(l=p)}),t.setSelection(Le.near(t.doc.resolve(l),n))}const Tw=1,Gc=2,jw=4;class q4 extends rE{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|Tw)&~Gc,this.storedMarks=null,this}get selectionSet(){return(this.updated&Tw)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Gc,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&Gc)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Gc,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 s=this.storedMarks;if(!s){let l=this.doc.resolve(n);s=r==n?l.marks():l.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Le.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|=jw,this}get scrolledIntoView(){return(this.updated&jw)>0}}function Aw(t,e){return!e||!t?t:t.bind(e)}class Vl{constructor(e,n,r){this.name=e,this.init=Aw(n.init,r),this.apply=Aw(n.apply,r)}}const G4=[new Vl("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Vl("selection",{init(t,e){return t.selection||Le.atStart(e.doc)},apply(t){return t.selection}}),new Vl("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Vl("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class bp{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=G4.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 Vl(r.key,r.spec.state,r))})}}class Ei{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 s=!1;for(let l=0;l<this.config.plugins.length;l++){let c=this.config.plugins[l];if(c.spec.appendTransaction){let u=o?o[l].n:0,h=o?o[l].state:this,p=u<n.length&&c.spec.appendTransaction.call(c,u?n.slice(u):n,h,r);if(p&&r.filterTransaction(p,l)){if(p.setMeta("appendedTransaction",e),!o){o=[];for(let m=0;m<this.config.plugins.length;m++)o.push(m<l?{state:r,n:n.length}:{state:this,n:0})}n.push(p),r=r.applyInner(p),s=!0}o&&(o[l]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Ei(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let s=r[o];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new q4(this)}static create(e){let n=new bp(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ei(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 bp(this.schema,e.plugins),r=n.fields,o=new Ei(n);for(let s=0;s<r.length;s++){let l=r[s].name;o[l]=this.hasOwnProperty(l)?this[l]:r[s].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],s=o.spec.state;s&&s.toJSON&&(n[r]=s.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 bp(e.schema,e.plugins),s=new Ei(o);return o.fields.forEach(l=>{if(l.name=="doc")s.doc=Io.fromJSON(e.schema,n.doc);else if(l.name=="selection")s.selection=Le.fromJSON(s.doc,n.selection);else if(l.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let u=r[c],h=u.spec.state;if(u.key==l.name&&h&&h.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){s[l.name]=h.fromJSON.call(u,e,n[c],s);return}}s[l.name]=l.init(e,s)}}),s}}function oE(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=oE(o,e,{})),n[r]=o}return n}class Ze{constructor(e){this.spec=e,this.props={},e.props&&oE(e.props,this,this.props),this.key=e.key?e.key.key:sE("plugin")}getState(e){return e[this.key]}}const kp=Object.create(null);function sE(t){return t in kp?t+"$"+ ++kp[t]:(kp[t]=0,t+"$")}class ht{constructor(e="key"){this.key=sE(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Vg=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function iE(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const lE=(t,e,n)=>{let r=iE(t,n);if(!r)return!1;let o=Hg(r);if(!o){let l=r.blockRange(),c=l&&Ki(l);return c==null?!1:(e&&e(t.tr.lift(l,c).scrollIntoView()),!0)}let s=o.nodeBefore;if(gE(t,o,e,-1))return!0;if(r.parent.content.size==0&&(_i(s,"end")||Te.isSelectable(s)))for(let l=r.depth;;l--){let c=Wd(t.doc,r.before(l),r.after(l),ue.empty);if(c&&c.slice.size<c.to-c.from){if(e){let u=t.tr.step(c);u.setSelection(_i(s,"end")?Le.findFrom(u.doc.resolve(u.mapping.map(o.pos,-1)),-1):Te.create(u.doc,o.pos-s.nodeSize)),e(u.scrollIntoView())}return!0}if(l==1||r.node(l-1).childCount>1)break}return s.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-s.nodeSize,o.pos).scrollIntoView()),!0):!1},J4=(t,e,n)=>{let r=iE(t,n);if(!r)return!1;let o=Hg(r);return o?aE(t,o,e):!1},Y4=(t,e,n)=>{let r=uE(t,n);if(!r)return!1;let o=Wg(r);return o?aE(t,o,e):!1};function aE(t,e,n){let r=e.nodeBefore,o=r,s=e.pos-1;for(;!o.isTextblock;s--){if(o.type.spec.isolating)return!1;let p=o.lastChild;if(!p)return!1;o=p}let l=e.nodeAfter,c=l,u=e.pos+1;for(;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;let p=c.firstChild;if(!p)return!1;c=p}let h=Wd(t.doc,s,u,ue.empty);if(!h||h.from!=s||h instanceof xt&&h.slice.size>=u-s)return!1;if(n){let p=t.tr.step(h);p.setSelection(Ie.create(p.doc,s)),n(p.scrollIntoView())}return!0}function _i(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const cE=(t,e,n)=>{let{$head:r,empty:o}=t.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=Hg(r)}let l=s&&s.nodeBefore;return!l||!Te.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Te.create(t.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function Hg(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 uE(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const dE=(t,e,n)=>{let r=uE(t,n);if(!r)return!1;let o=Wg(r);if(!o)return!1;let s=o.nodeAfter;if(gE(t,o,e,1))return!0;if(r.parent.content.size==0&&(_i(s,"start")||Te.isSelectable(s))){let l=Wd(t.doc,r.before(),r.after(),ue.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(_i(s,"start")?Le.findFrom(c.doc.resolve(c.mapping.map(o.pos)),1):Te.create(c.doc,c.mapping.map(o.pos))),e(c.scrollIntoView())}return!0}}return s.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+s.nodeSize).scrollIntoView()),!0):!1},fE=(t,e,n)=>{let{$head:r,empty:o}=t.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=Wg(r)}let l=s&&s.nodeAfter;return!l||!Te.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Te.create(t.doc,s.pos)).scrollIntoView()),!0)};function Wg(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Q4=(t,e)=>{let n=t.selection,r=n instanceof Te,o;if(r){if(n.node.isTextblock||!Qo(t.doc,n.from))return!1;o=n.from}else if(o=Hd(t.doc,n.from,-1),o==null)return!1;if(e){let s=t.tr.join(o);r&&s.setSelection(Te.create(s.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},X4=(t,e)=>{let n=t.selection,r;if(n instanceof Te){if(n.node.isTextblock||!Qo(t.doc,n.to))return!1;r=n.to}else if(r=Hd(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Z4=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),s=o&&Ki(o);return s==null?!1:(e&&e(t.tr.lift(o,s).scrollIntoView()),!0)},hE=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
447
+ `).scrollIntoView()),!0)};function Ug(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const e5=(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),s=n.indexAfter(-1),l=Ug(o.contentMatchAt(s));if(!l||!o.canReplaceWith(s,s,l))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,l.createAndFill());u.setSelection(Le.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},pE=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof jn||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=Ug(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let l=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,c=t.tr.insert(l,s.createAndFill());c.setSelection(Ie.create(c.doc,l+1)),e(c.scrollIntoView())}return!0},mE=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(Kr(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Ki(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function t5(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof Te&&e.selection.node.isBlock)return!r.parentOffset||!Kr(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],l,c,u=!1,h=!1;for(let x=r.depth;;x--)if(r.node(x).isBlock){u=r.end(x)==r.pos+(r.depth-x),h=r.start(x)==r.pos-(r.depth-x),c=Ug(r.node(x-1).contentMatchAt(r.indexAfter(x-1))),s.unshift(u&&c?{type:c}:null),l=x;break}else{if(x==1)return!1;s.unshift(null)}let p=e.tr;(e.selection instanceof Ie||e.selection instanceof jn)&&p.deleteSelection();let m=p.mapping.map(r.pos),y=Kr(p.doc,m,s.length,s);if(y||(s[0]=c?{type:c}:null,y=Kr(p.doc,m,s.length,s)),!y)return!1;if(p.split(m,s.length,s),!u&&h&&r.node(l).type!=c){let x=p.mapping.map(r.before(l)),b=p.doc.resolve(x);c&&r.node(l-1).canReplaceWith(b.index(),b.index()+1,c)&&p.setNodeMarkup(p.mapping.map(r.before(l)),c)}return n&&n(p.scrollIntoView()),!0}}const n5=t5(),r5=(t,e)=>{let{$from:n,to:r}=t.selection,o,s=n.sharedDepth(r);return s==0?!1:(o=n.before(s),e&&e(t.tr.setSelection(Te.create(t.doc,o))),!0)};function o5(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,s=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(o.isTextblock||Qo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function gE(t,e,n,r){let o=e.nodeBefore,s=e.nodeAfter,l,c,u=o.type.spec.isolating||s.type.spec.isolating;if(!u&&o5(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(l=(c=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&c.matchType(l[0]||s.type).validEnd){if(n){let x=e.pos+s.nodeSize,b=Y.empty;for(let N=l.length-1;N>=0;N--)b=Y.from(l[N].create(null,b));b=Y.from(o.copy(b));let k=t.tr.step(new It(e.pos-1,x,e.pos,x,new ue(b,1,0),l.length,!0)),C=k.doc.resolve(x+2*l.length);C.nodeAfter&&C.nodeAfter.type==o.type&&Qo(k.doc,C.pos)&&k.join(C.pos),n(k.scrollIntoView())}return!0}let p=s.type.spec.isolating||r>0&&u?null:Le.findFrom(e,1),m=p&&p.$from.blockRange(p.$to),y=m&&Ki(m);if(y!=null&&y>=e.depth)return n&&n(t.tr.lift(m,y).scrollIntoView()),!0;if(h&&_i(s,"start",!0)&&_i(o,"end")){let x=o,b=[];for(;b.push(x),!x.isTextblock;)x=x.lastChild;let k=s,C=1;for(;!k.isTextblock;k=k.firstChild)C++;if(x.canReplace(x.childCount,x.childCount,k.content)){if(n){let N=Y.empty;for(let T=b.length-1;T>=0;T--)N=Y.from(b[T].copy(N));let M=t.tr.step(new It(e.pos-b.length,e.pos+s.nodeSize,e.pos+C,e.pos+s.nodeSize-C,new ue(N,b.length,0),0,!0));n(M.scrollIntoView())}return!0}}return!1}function yE(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return o.node(s).isTextblock?(n&&n(e.tr.setSelection(Ie.create(e.doc,t<0?o.start(s):o.end(s)))),!0):!1}}const s5=yE(-1),i5=yE(1);function l5(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,l=o.blockRange(s),c=l&&Fg(l,t,e);return c?(r&&r(n.tr.wrap(l,c).scrollIntoView()),!0):!1}}function Rw(t,e=null){return function(n,r){let o=!1;for(let s=0;s<n.selection.ranges.length&&!o;s++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[s];n.doc.nodesBetween(l,c,(u,h)=>{if(o)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)o=!0;else{let p=n.doc.resolve(h),m=p.index();o=p.parent.canReplaceWith(m,m+1,t)}})}if(!o)return!1;if(r){let s=n.tr;for(let l=0;l<n.selection.ranges.length;l++){let{$from:{pos:c},$to:{pos:u}}=n.selection.ranges[l];s.setBlockType(c,u,t,e)}r(s.scrollIntoView())}return!0}}function Kg(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}Kg(Vg,lE,cE);Kg(Vg,dE,fE);Kg(hE,pE,mE,n5);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function a5(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,l=o.blockRange(s);if(!l)return!1;let c=r?n.tr:null;return c5(c,l,t,e)?(r&&r(c.scrollIntoView()),!0):!1}}function c5(t,e,n,r=null){let o=!1,s=e,l=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=l.resolve(e.start-2);s=new Pu(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new Pu(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let c=Fg(s,n,r,e);return c?(t&&u5(t,e,c,o,n),!0):!1}function u5(t,e,n,r,o){let s=Y.empty;for(let p=n.length-1;p>=0;p--)s=Y.from(n[p].type.create(n[p].attrs,s));t.step(new It(e.start-(r?2:0),e.end,e.start,e.end,new ue(s,0,0),n.length,!0));let l=0;for(let p=0;p<n.length;p++)n[p].type==o&&(l=p+1);let c=n.length-l,u=e.start+n.length-(r?2:0),h=e.parent;for(let p=e.startIndex,m=e.endIndex,y=!0;p<m;p++,y=!1)!y&&Kr(t.doc,u,c)&&(t.split(u,c),u+=2*c),u+=h.child(p).nodeSize;return t}function d5(t){return function(e,n){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,l=>l.childCount>0&&l.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?f5(e,n,t,s):h5(e,n,s):!0:!1}}function f5(t,e,n,r){let o=t.tr,s=r.end,l=r.$to.end(r.depth);s<l&&(o.step(new It(s-1,l,s,l,new ue(Y.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Pu(o.doc.resolve(r.$from.pos),o.doc.resolve(l),r.depth));const c=Ki(r);if(c==null)return!1;o.lift(r,c);let u=o.doc.resolve(o.mapping.map(s,-1)-1);return Qo(o.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&o.join(u.pos),e(o.scrollIntoView()),!0}function h5(t,e,n){let r=t.tr,o=n.parent;for(let x=n.end,b=n.endIndex-1,k=n.startIndex;b>k;b--)x-=o.child(b).nodeSize,r.delete(x-1,x+1);let s=r.doc.resolve(n.start),l=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==o.childCount,h=s.node(-1),p=s.index(-1);if(!h.canReplace(p+(c?0:1),p+1,l.content.append(u?Y.empty:Y.from(o))))return!1;let m=s.pos,y=m+l.nodeSize;return r.step(new It(m-(c?1:0),y+(u?1:0),m+1,y-1,new ue((c?Y.empty:Y.from(o.copy(Y.empty))).append(u?Y.empty:Y.from(o.copy(Y.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function p5(t){return function(e,n){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,h=>h.childCount>0&&h.firstChild.type==t);if(!s)return!1;let l=s.startIndex;if(l==0)return!1;let c=s.parent,u=c.child(l-1);if(u.type!=t)return!1;if(n){let h=u.lastChild&&u.lastChild.type==c.type,p=Y.from(h?t.create():null),m=new ue(Y.from(t.create(null,Y.from(c.type.create(null,p)))),h?3:1,0),y=s.start,x=s.end;n(e.tr.step(new It(y-(h?3:1),x,y,x,m,1,!0)).scrollIntoView())}return!0}}const Vt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Li=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let wm=null;const Wr=function(t,e,n){let r=wm||(wm=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},m5=function(){wm=null},_s=function(t,e,n,r){return n&&(Pw(t,e,n,r,-1)||Pw(t,e,n,r,1))},g5=/^(img|br|input|textarea|hr)$/i;function Pw(t,e,n,r,o){for(var s;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Vn(t))){let l=t.parentNode;if(!l||l.nodeType!=1||Ca(t)||g5.test(t.nodeName)||t.contentEditable=="false")return!1;e=Vt(t)+(o<0?0:1),t=l}else if(t.nodeType==1){let l=t.childNodes[e+(o<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((s=l.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=o;else return!1;else t=l,e=o<0?Vn(t):0}else return!1}}function Vn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function y5(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Vn(t)}else if(t.parentNode&&!Ca(t))e=Vt(t),t=t.parentNode;else return null}}function x5(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Ca(t))e=Vt(t)+1,t=t.parentNode;else return null}}function v5(t,e,n){for(let r=e==0,o=e==Vn(t);r||o;){if(t==n)return!0;let s=Vt(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,o=o&&s==Vn(t)}}function Ca(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Kd=function(t){return t.focusNode&&_s(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function ys(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function w5(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function b5(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Vn(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Vn(r.startContainer),r.startOffset)}}}const Er=typeof navigator<"u"?navigator:null,Ow=typeof document<"u"?document:null,Xo=Er&&Er.userAgent||"",bm=/Edge\/(\d+)/.exec(Xo),xE=/MSIE \d/.exec(Xo),km=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Xo),gn=!!(xE||km||bm),_o=xE?document.documentMode:km?+km[1]:bm?+bm[1]:0,Kn=!gn&&/gecko\/(\d+)/i.test(Xo);Kn&&+(/Firefox\/(\d+)/.exec(Xo)||[0,0])[1];const Sm=!gn&&/Chrome\/(\d+)/.exec(Xo),Wt=!!Sm,vE=Sm?+Sm[1]:0,Xt=!gn&&!!Er&&/Apple Computer/.test(Er.vendor),zi=Xt&&(/Mobile\/\w+/.test(Xo)||!!Er&&Er.maxTouchPoints>2),Bn=zi||(Er?/Mac/.test(Er.platform):!1),wE=Er?/Win/.test(Er.platform):!1,Ur=/Android \d/.test(Xo),Na=!!Ow&&"webkitFontSmoothing"in Ow.documentElement.style,k5=Na?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function S5(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 $r(t,e){return typeof t=="number"?t:t[e]}function C5(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 Iw(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let l=n||t.dom;l;){if(l.nodeType!=1){l=Li(l);continue}let c=l,u=c==s.body,h=u?S5(s):C5(c),p=0,m=0;if(e.top<h.top+$r(r,"top")?m=-(h.top-e.top+$r(o,"top")):e.bottom>h.bottom-$r(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+$r(o,"top")-h.top:e.bottom-h.bottom+$r(o,"bottom")),e.left<h.left+$r(r,"left")?p=-(h.left-e.left+$r(o,"left")):e.right>h.right-$r(r,"right")&&(p=e.right-h.right+$r(o,"right")),p||m)if(u)s.defaultView.scrollBy(p,m);else{let x=c.scrollLeft,b=c.scrollTop;m&&(c.scrollTop+=m),p&&(c.scrollLeft+=p);let k=c.scrollLeft-x,C=c.scrollTop-b;e={left:e.left-k,top:e.top-C,right:e.right-k,bottom:e.bottom-C}}let y=u?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(y))break;l=y=="absolute"?l.offsetParent:Li(l)}}function N5(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let s=(e.left+e.right)/2,l=n+1;l<Math.min(innerHeight,e.bottom);l+=5){let c=t.root.elementFromPoint(s,l);if(!c||c==t.dom||!t.dom.contains(c))continue;let u=c.getBoundingClientRect();if(u.top>=n-20){r=c,o=u.top;break}}return{refDOM:r,refTop:o,stack:bE(t.dom)}}function bE(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Li(r));return e}function E5({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;kE(n,r==0?0:r-e)}function kE(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:s}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let vi=null;function M5(t){if(t.setActive)return t.setActive();if(vi)return t.focus(vi);let e=bE(t);t.focus(vi==null?{get preventScroll(){return vi={preventScroll:!0},!0}}:void 0),vi||(vi=!1,kE(e,0))}function SE(t,e){let n,r=2e8,o,s=0,l=e.top,c=e.top,u,h;for(let p=t.firstChild,m=0;p;p=p.nextSibling,m++){let y;if(p.nodeType==1)y=p.getClientRects();else if(p.nodeType==3)y=Wr(p).getClientRects();else continue;for(let x=0;x<y.length;x++){let b=y[x];if(b.top<=l&&b.bottom>=c){l=Math.max(b.bottom,l),c=Math.min(b.top,c);let k=b.left>e.left?b.left-e.left:b.right<e.left?e.left-b.right:0;if(k<r){n=p,r=k,o=k&&n.nodeType==3?{left:b.right<e.left?b.right:b.left,top:e.top}:e,p.nodeType==1&&k&&(s=m+(e.left>=(b.left+b.right)/2?1:0));continue}}else b.top>e.top&&!u&&b.left<=e.left&&b.right>=e.left&&(u=p,h={left:Math.max(b.left,Math.min(b.right,e.left)),top:b.top});!n&&(e.left>=b.right&&e.top>=b.top||e.left>=b.left&&e.top>=b.bottom)&&(s=m+1)}}return!n&&u&&(n=u,o=h,r=0),n&&n.nodeType==3?T5(n,o):!n||r&&n.nodeType==1?{node:t,offset:s}:SE(n,o)}function T5(t,e){let n=t.nodeValue.length,r=document.createRange(),o;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let l=So(r,1);if(l.top!=l.bottom&&qg(e,l)){o={node:t,offset:s+(e.left>=(l.left+l.right)/2?1:0)};break}}return r.detach(),o||{node:t,offset:0}}function qg(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function j5(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function A5(t,e,n){let{node:r,offset:o}=SE(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let l=r.getBoundingClientRect();s=l.left!=l.right&&n.left>(l.left+l.right)/2?1:-1}return t.docView.posFromDOM(r,o,s)}function R5(t,e,n,r){let o=-1;for(let s=e,l=!1;s!=t.dom;){let c=t.docView.nearestDesc(s,!0),u;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((u=c.dom.getBoundingClientRect()).width||u.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!l&&u.left>r.left||u.top>r.top?o=c.posBefore:(!l&&u.right<r.left||u.bottom<r.top)&&(o=c.posAfter),l=!0),!c.contentDOM&&o<0&&!c.node.isText))return(c.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?c.posBefore:c.posAfter;s=c.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function CE(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)),s=o;;){let l=t.childNodes[s];if(l.nodeType==1){let c=l.getClientRects();for(let u=0;u<c.length;u++){let h=c[u];if(qg(e,h))return CE(l,e,h)}}if((s=(s+1)%r)==o)break}return t}function P5(t,e){let n=t.dom.ownerDocument,r,o=0,s=b5(n,e.left,e.top);s&&({node:r,offset:o}=s);let l=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),c;if(!l||!t.dom.contains(l.nodeType!=1?l.parentNode:l)){let h=t.dom.getBoundingClientRect();if(!qg(e,h)||(l=CE(t.dom,e,h),!l))return null}if(Xt)for(let h=l;r&&h;h=Li(h))h.draggable&&(r=void 0);if(l=j5(l,e),r){if(Kn&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let p=r.childNodes[o],m;p.nodeName=="IMG"&&(m=p.getBoundingClientRect()).right<=e.left&&m.bottom>e.top&&o++}let h;Na&&o&&r.nodeType==1&&(h=r.childNodes[o-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(c=R5(t,r,o,e))}c==null&&(c=A5(t,l,e));let u=t.docView.nearestDesc(l,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function Dw(t){return t.top<t.bottom||t.left<t.right}function So(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Dw(r))return r}return Array.prototype.find.call(n,Dw)||t.getBoundingClientRect()}const O5=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function NE(t,e,n){let{node:r,offset:o,atom:s}=t.docView.domFromPos(e,n<0?-1:1),l=Na||Kn;if(r.nodeType==3)if(l&&(O5.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let u=So(Wr(r,o,o),n);if(Kn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let h=So(Wr(r,o-1,o-1),-1);if(h.top==u.top){let p=So(Wr(r,o,o+1),-1);if(p.top!=u.top)return Ol(p,p.left<h.left)}}return u}else{let u=o,h=o,p=n<0?1:-1;return n<0&&!o?(h++,p=-1):n>=0&&o==r.nodeValue.length?(u--,p=1):n<0?u--:h++,Ol(So(Wr(r,u,h),p),p<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&o&&(n<0||o==Vn(r))){let u=r.childNodes[o-1];if(u.nodeType==1)return Sp(u.getBoundingClientRect(),!1)}if(s==null&&o<Vn(r)){let u=r.childNodes[o];if(u.nodeType==1)return Sp(u.getBoundingClientRect(),!0)}return Sp(r.getBoundingClientRect(),n>=0)}if(s==null&&o&&(n<0||o==Vn(r))){let u=r.childNodes[o-1],h=u.nodeType==3?Wr(u,Vn(u)-(l?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return Ol(So(h,1),!1)}if(s==null&&o<Vn(r)){let u=r.childNodes[o];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let h=u?u.nodeType==3?Wr(u,0,l?0:1):u.nodeType==1?u:null:null;if(h)return Ol(So(h,-1),!0)}return Ol(So(r.nodeType==3?Wr(r):r,-n),n>=0)}function Ol(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 Sp(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 EE(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 I5(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return EE(t,e,()=>{let{node:s}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(s,!0);if(!c)break;if(c.node.isBlock){s=c.contentDOM||c.dom;break}s=c.dom.parentNode}let l=NE(t,o.pos,1);for(let c=s.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=Wr(c,0,c.nodeValue.length).getClientRects();else continue;for(let h=0;h<u.length;h++){let p=u[h];if(p.bottom>p.top+1&&(n=="up"?l.top-p.top>(p.bottom-l.top)*2:p.bottom-l.bottom>(l.bottom-p.top)*2))return!1}}return!0})}const D5=/[\u0590-\u08ac]/;function _5(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,s=!o,l=o==r.parent.content.size,c=t.domSelection();return c?!D5.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?s:l:EE(t,e,()=>{let{focusNode:u,focusOffset:h,anchorNode:p,anchorOffset:m}=t.domSelectionRange(),y=c.caretBidiLevel;c.modify("move",n,"character");let x=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:b,focusOffset:k}=t.domSelectionRange(),C=b&&!x.contains(b.nodeType==1?b:b.parentNode)||u==b&&h==k;try{c.collapse(p,m),u&&(u!=p||h!=m)&&c.extend&&c.extend(u,h)}catch{}return y!=null&&(c.caretBidiLevel=y),C}):r.pos==r.start()||r.pos==r.end()}let _w=null,Lw=null,zw=!1;function L5(t,e,n){return _w==e&&Lw==n?zw:(_w=e,Lw=n,zw=n=="up"||n=="down"?I5(t,e,n):_5(t,e,n))}const qn=0,$w=1,ws=2,Mr=3;class Ea{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=qn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let 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&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,l;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(l)+l.size:this.posAtStart}else{let s,l;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(l):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>Vt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!1;break}if(s.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!0;break}if(s.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 s=this.getDesc(o),l;if(s&&(!n||s.node))if(r&&(l=s.nodeDOM)&&!(l.nodeType==1?l.contains(e.nodeType==1?e:e.parentNode):l==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let o=e;o;o=o.parentNode){let s=this.getDesc(o);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],s=r+o.size;if(r==e&&s!=r){for(;!o.border&&o.children.length;)for(let l=0;l<o.children.length;l++){let c=o.children[l];if(c.size){o=c;break}}return o}if(e<s)return o.descAt(e-r-o.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let s=0;r<this.children.length;r++){let l=this.children[r],c=s+l.size;if(c>e||l instanceof TE){o=e-s;break}s=c}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof ME&&s.side>=0;r--);if(n<=0){let s,l=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,l=!1);return s&&n&&l&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Vt(s.dom)+1:0}}else{let s,l=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,l=!1);return s&&l&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Vt(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,s=-1;for(let l=r,c=0;;c++){let u=this.children[c],h=l+u.size;if(o==-1&&e<=h){let p=l+u.border;if(e>=p&&n<=h-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,p);e=l;for(let m=c;m>0;m--){let y=this.children[m-1];if(y.size&&y.dom.parentNode==this.contentDOM&&!y.emptyChildAt(1)){o=Vt(y.dom)+1;break}e-=y.size}o==-1&&(o=0)}if(o>-1&&(h>n||c==this.children.length-1)){n=h;for(let p=c+1;p<this.children.length;p++){let m=this.children[p];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(-1)){s=Vt(m.dom);break}n+=m.size}s==-1&&(s=this.contentDOM.childNodes.length);break}l=h}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,o=!1){let s=Math.min(e,n),l=Math.max(e,n);for(let x=0,b=0;x<this.children.length;x++){let k=this.children[x],C=b+k.size;if(s>b&&l<C)return k.setSelection(e-b-k.border,n-b-k.border,r,o);b=C}let c=this.domFromPos(e,e?-1:1),u=n==e?c:this.domFromPos(n,n?-1:1),h=r.root.getSelection(),p=r.domSelectionRange(),m=!1;if((Kn||Xt)&&e==n){let{node:x,offset:b}=c;if(x.nodeType==3){if(m=!!(b&&x.nodeValue[b-1]==`
448
+ `),m&&b==x.nodeValue.length)for(let k=x,C;k;k=k.parentNode){if(C=k.nextSibling){C.nodeName=="BR"&&(c=u={node:C.parentNode,offset:Vt(C)+1});break}let N=k.pmViewDesc;if(N&&N.node&&N.node.isBlock)break}}else{let k=x.childNodes[b-1];m=k&&(k.nodeName=="BR"||k.contentEditable=="false")}}if(Kn&&p.focusNode&&p.focusNode!=u.node&&p.focusNode.nodeType==1){let x=p.focusNode.childNodes[p.focusOffset];x&&x.contentEditable=="false"&&(o=!0)}if(!(o||m&&Xt)&&_s(c.node,c.offset,p.anchorNode,p.anchorOffset)&&_s(u.node,u.offset,p.focusNode,p.focusOffset))return;let y=!1;if((h.extend||e==n)&&!(m&&Kn)){h.collapse(c.node,c.offset);try{e!=n&&h.extend(u.node,u.offset),y=!0}catch{}}if(!y){if(e>n){let b=c;c=u,u=b}let x=document.createRange();x.setEnd(u.node,u.offset),x.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(x)}}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 s=this.children[o],l=r+s.size;if(r==l?e<=l&&n>=r:e<l&&n>r){let c=r+s.border,u=l-s.border;if(e>=c&&n<=u){this.dirty=e==r||n==l?ws:$w,e==c&&n==u&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Mr:s.markDirty(e-c,n-c);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ws:Mr}r=l}this.dirty=ws}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?ws:$w;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class ME extends Ea{constructor(e,n,r,o){let s,l=n.type.toDOM;if(typeof l=="function"&&(l=l(r,()=>{if(!s)return o;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(l.nodeType!=1){let c=document.createElement("span");c.appendChild(l),l=c}l.contentEditable="false",l.classList.add("ProseMirror-widget")}super(e,[],l,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==qn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class z5 extends Ea{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}}class Ls extends Ea{constructor(e,n,r,o,s){super(e,[],r,o),this.mark=n,this.spec=s}static create(e,n,r,o){let s=o.nodeViews[n.type.name],l=s&&s(n,o,r);return(!l||!l.dom)&&(l=Vs.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Ls(e,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Mr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Mr&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=qn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=qn}}slice(e,n,r){let o=Ls.create(this.parent,this.mark,!0,r),s=this.children,l=this.size;n<l&&(s=Nm(s,n,l,r)),e>0&&(s=Nm(s,0,e,r));for(let c=0;c<s.length;c++)s[c].parent=o;return o.children=s,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Lo extends Ea{constructor(e,n,r,o,s,l,c,u,h){super(e,[],s,l),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=c}static create(e,n,r,o,s,l){let c=s.nodeViews[n.type.name],u,h=c&&c(n,s,()=>{if(!u)return l;if(u.parent)return u.parent.posBeforeChild(u)},r,o),p=h&&h.dom,m=h&&h.contentDOM;if(n.isText){if(!p)p=document.createTextNode(n.text);else if(p.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else p||({dom:p,contentDOM:m}=Vs.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&p.nodeName!="BR"&&(p.hasAttribute("contenteditable")||(p.contentEditable="false"),n.type.spec.draggable&&(p.draggable=!0));let y=p;return p=RE(p,r,n),h?u=new $5(e,n,r,o,p,m||null,y,h,s,l+1):n.isText?new qd(e,n,r,o,p,y,s):new Lo(e,n,r,o,p,m||null,y,s,l+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Y.empty)}return e}matchesNode(e,n,r){return this.dirty==qn&&e.eq(this.node)&&Iu(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,s=e.composing?this.localCompositionInfo(e,n):null,l=s&&s.pos>-1?s:null,c=s&&s.pos<0,u=new B5(this,l&&l.node,e);W5(this.node,this.innerDeco,(h,p,m)=>{h.spec.marks?u.syncToMarks(h.spec.marks,r,e,p):h.type.side>=0&&!m&&u.syncToMarks(p==this.node.childCount?Ye.none:this.node.child(p).marks,r,e,p),u.placeWidget(h,e,o)},(h,p,m,y)=>{u.syncToMarks(h.marks,r,e,y);let x;u.findNodeMatch(h,p,m,y)||c&&e.state.selection.from>o&&e.state.selection.to<o+h.nodeSize&&(x=u.findIndexWithChild(s.node))>-1&&u.updateNodeAt(h,p,m,x,e)||u.updateNextNode(h,p,m,e,y,o)||u.addNode(h,p,m,e,o),o+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==ws)&&(l&&this.protectLocalComposition(e,l),jE(this.contentDOM,this.children,e),zi&&U5(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof Ie)||r<n||o>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let l=s.nodeValue,c=K5(this.node.content,l,r-n,o-n);return c<0?null:{node:s,pos:c,text:l}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let l=new z5(this,s,n,o);e.input.compositionNodes.push(l),this.children=Nm(this.children,r,r+o.length,e,l)}update(e,n,r,o){return this.dirty==Mr||!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=qn}updateOuterDeco(e){if(Iu(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=AE(this.dom,this.nodeDOM,Cm(this.outerDeco,this.node,n),Cm(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Fw(t,e,n,r,o){RE(r,e,t);let s=new Lo(void 0,t,e,n,r,r,r,o,0);return s.contentDOM&&s.updateChildren(o,0),s}class qd extends Lo{constructor(e,n,r,o,s,l,c){super(e,n,r,o,s,null,l,c,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==Mr||this.dirty!=qn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=qn||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=qn,!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),s=document.createTextNode(o.text);return new qd(this.parent,o,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Mr)}get domAtom(){return!1}isText(e){return this.node.text==e}}class TE extends Ea{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==qn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class $5 extends Lo{constructor(e,n,r,o,s,l,c,u,h,p){super(e,n,r,o,s,l,c,h,p),this.spec=u}update(e,n,r,o){if(this.dirty==Mr)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,o),s}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 jE(t,e,n){let r=t.firstChild,o=!1;for(let s=0;s<e.length;s++){let l=e[s],c=l.dom;if(c.parentNode==t){for(;c!=r;)r=Bw(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(c,r);if(l instanceof Ls){let u=r?r.previousSibling:t.lastChild;jE(l.contentDOM,l.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=Bw(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const ql=function(t){t&&(this.nodeName=t)};ql.prototype=Object.create(null);const bs=[new ql];function Cm(t,e,n){if(t.length==0)return bs;let r=n?bs[0]:new ql,o=[r];for(let s=0;s<t.length;s++){let l=t[s].type.attrs;if(l){l.nodeName&&o.push(r=new ql(l.nodeName));for(let c in l){let u=l[c];u!=null&&(n&&o.length==1&&o.push(r=new ql(e.isInline?"span":"div")),c=="class"?r.class=(r.class?r.class+" ":"")+u:c=="style"?r.style=(r.style?r.style+";":"")+u:c!="nodeName"&&(r[c]=u))}}}return o}function AE(t,e,n,r){if(n==bs&&r==bs)return e;let o=e;for(let s=0;s<r.length;s++){let l=r[s],c=n[s];if(s){let u;c&&c.nodeName==l.nodeName&&o!=t&&(u=o.parentNode)&&u.nodeName.toLowerCase()==l.nodeName||(u=document.createElement(l.nodeName),u.pmIsDeco=!0,u.appendChild(o),c=bs[0]),o=u}F5(o,c||bs[0],l)}return o}function F5(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 s=0;s<r.length;s++)o.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<o.length;s++)r.indexOf(o[s])==-1&&t.classList.add(o[s]);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 RE(t,e,n){return AE(t,t,bs,Cm(e,n,t.nodeType!=1))}function Iu(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 Bw(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class B5{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=V5(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 s=0,l=this.stack.length>>1,c=Math.min(l,e.length);for(;s<c&&(s==l-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<l;)this.destroyRest(),this.top.dirty=qn,this.index=this.stack.pop(),this.top=this.stack.pop(),l--;for(;l<e.length;){this.stack.push(this.top,this.index+1);let u=-1,h=this.top.children.length;o<this.preMatch.index&&(h=Math.min(this.index+3,h));for(let p=this.index;p<h;p++){let m=this.top.children[p];if(m.matchesMark(e[l])&&!this.isLocked(m.dom)){u=p;break}}if(u>-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let p=Ls.create(this.top,e[l],n,r);this.top.children.splice(this.index,0,p),this.top=p,this.changed=!0}this.index=0,l++}}findNodeMatch(e,n,r,o){let s=-1,l;if(o>=this.preMatch.index&&(l=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&l.matchesNode(e,n,r))s=this.top.children.indexOf(l,this.index);else for(let c=this.index,u=Math.min(this.top.children.length,c+5);c<u;c++){let h=this.top.children[c];if(h.matchesNode(e,n,r)&&!this.preMatch.matched.has(h)){s=c;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,o,s){let l=this.top.children[o];return l.dirty==Mr&&l.dom==l.contentDOM&&(l.dirty=ws),l.update(e,n,r,s)?(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,s,l){for(let c=this.index;c<this.top.children.length;c++){let u=this.top.children[c];if(u instanceof Lo){let h=this.preMatch.matched.get(u);if(h!=null&&h!=s)return!1;let p=u.dom,m,y=this.isLocked(p)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=Mr&&Iu(n,u.outerDeco));if(!y&&u.update(e,n,r,o))return this.destroyBetween(this.index,c),u.dom!=p&&(this.changed=!0),this.index++,!0;if(!y&&(m=this.recreateWrapper(u,e,n,r,o,l)))return this.destroyBetween(this.index,c),this.top.children[this.index]=m,m.contentDOM&&(m.dirty=ws,m.updateChildren(o,l+1),m.dirty=qn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,s,l){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Iu(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let c=Lo.create(this.top,n,r,o,s,l);if(c.contentDOM){c.children=e.children,e.children=[];for(let u of c.children)u.parent=c}return e.destroy(),c}addNode(e,n,r,o,s){let l=Lo.create(this.top,e,n,r,o,s);l.contentDOM&&l.updateChildren(o,s+1),this.top.children.splice(this.index++,0,l),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 s=new ME(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Ls;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof qd)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Xt||Wt)&&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 TE(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||e.nodeType==1&&e.contains(this.lock.parentNode))}}function V5(t,e){let n=e,r=n.children.length,o=t.childCount,s=new Map,l=[];e:for(;o>0;){let c;for(;;)if(r){let h=n.children[r-1];if(h instanceof Ls)n=h,r=h.children.length;else{c=h,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=c.node;if(u){if(u!=t.child(o-1))break;--o,s.set(c,o),l.push(c)}}return{index:o,matched:s,matches:l.reverse()}}function H5(t,e){return t.type.side-e.type.side}function W5(t,e,n,r){let o=e.locals(t),s=0;if(o.length==0){for(let h=0;h<t.childCount;h++){let p=t.child(h);r(p,o,e.forChild(s,p),h),s+=p.nodeSize}return}let l=0,c=[],u=null;for(let h=0;;){let p,m;for(;l<o.length&&o[l].to==s;){let C=o[l++];C.widget&&(p?(m||(m=[p])).push(C):p=C)}if(p)if(m){m.sort(H5);for(let C=0;C<m.length;C++)n(m[C],h,!!u)}else n(p,h,!!u);let y,x;if(u)x=-1,y=u,u=null;else if(h<t.childCount)x=h,y=t.child(h++);else break;for(let C=0;C<c.length;C++)c[C].to<=s&&c.splice(C--,1);for(;l<o.length&&o[l].from<=s&&o[l].to>s;)c.push(o[l++]);let b=s+y.nodeSize;if(y.isText){let C=b;l<o.length&&o[l].from<C&&(C=o[l].from);for(let N=0;N<c.length;N++)c[N].to<C&&(C=c[N].to);C<b&&(u=y.cut(C-s),y=y.cut(0,C-s),b=C,x=-1)}else for(;l<o.length&&o[l].to<b;)l++;let k=y.isInline&&!y.isLeaf?c.filter(C=>!C.inline):c.slice();r(y,k,e.forChild(s,y),x),s=b}}function U5(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 K5(t,e,n,r){for(let o=0,s=0;o<t.childCount&&s<=r;){let l=t.child(o++),c=s;if(s+=l.nodeSize,!l.isText)continue;let u=l.text;for(;o<t.childCount;){let h=t.child(o++);if(s+=h.nodeSize,!h.isText)break;u+=h.text}if(s>=n){if(s>=r&&u.slice(r-e.length-c,r-c)==e)return r-e.length;let h=c<r?u.lastIndexOf(e,r-c-1):-1;if(h>=0&&h+e.length+c>=n)return c+h;if(n==r&&u.length>=r+e.length-c&&u.slice(r-c,r-c+e.length)==e)return r}}return-1}function Nm(t,e,n,r,o){let s=[];for(let l=0,c=0;l<t.length;l++){let u=t[l],h=c,p=c+=u.size;h>=n||p<=e?s.push(u):(h<e&&s.push(u.slice(0,e-h,r)),o&&(s.push(o),o=void 0),p>n&&s.push(u.slice(n-h,u.size,r)))}return s}function Gg(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),s=o&&o.size==0,l=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let c=r.resolve(l),u,h;if(Kd(n)){for(u=l;o&&!o.node;)o=o.parent;let m=o.node;if(o&&m.isAtom&&Te.isSelectable(m)&&o.parent&&!(m.isInline&&v5(n.focusNode,n.focusOffset,o.dom))){let y=o.posBefore;h=new Te(l==y?c:r.resolve(y))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=l,y=l;for(let x=0;x<n.rangeCount;x++){let b=n.getRangeAt(x);m=Math.min(m,t.docView.posFromDOM(b.startContainer,b.startOffset,1)),y=Math.max(y,t.docView.posFromDOM(b.endContainer,b.endOffset,-1))}if(m<0)return null;[u,l]=y==t.state.selection.anchor?[y,m]:[m,y],c=r.resolve(l)}else u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null}let p=r.resolve(u);if(!h){let m=e=="pointer"||t.state.selection.head<c.pos&&!s?1:-1;h=Jg(t,p,c,m)}return h}function PE(t){return t.editable?t.hasFocus():IE(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function qr(t,e=!1){let n=t.state.selection;if(OE(t,n),!!PE(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Wt){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&_s(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)G5(t);else{let{anchor:r,head:o}=n,s,l;Vw&&!(n instanceof Ie)&&(n.$from.parent.inlineContent||(s=Hw(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=Hw(t,n.to))),t.docView.setSelection(r,o,t,e),Vw&&(s&&Ww(s),l&&Ww(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&q5(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Vw=Xt||Wt&&vE<63;function Hw(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Xt&&o&&o.contentEditable=="false")return Cp(o);if((!o||o.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(o)return Cp(o);if(s)return Cp(s)}}function Cp(t){return t.contentEditable="true",Xt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Ww(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function q5(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(()=>{(!PE(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function G5(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Vt(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&gn&&_o<=11&&(n.disabled=!0,n.disabled=!1)}function OE(t,e){if(e instanceof Te){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Uw(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Uw(t)}function Uw(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Jg(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||Ie.between(e,n,r)}function Kw(t){return t.editable&&!t.hasFocus()?!1:IE(t)}function IE(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function J5(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return _s(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Em(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),s=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return s&&Le.findFrom(s,e)}function Co(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function qw(t,e,n){let r=t.state.selection;if(r instanceof Ie)if(n.indexOf("s")>-1){let{$head:o}=r,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let l=t.state.doc.resolve(o.pos+s.nodeSize*(e<0?-1:1));return Co(t,new Ie(r.$anchor,l))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=Em(t.state,e);return o&&o instanceof Te?Co(t,o):!1}else if(!(Bn&&n.indexOf("m")>-1)){let o=r.$head,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,l;if(!s||s.isText)return!1;let c=e<0?o.pos-s.nodeSize:o.pos;return s.isAtom||(l=t.docView.descAt(c))&&!l.contentDOM?Te.isSelectable(s)?Co(t,new Te(e<0?t.state.doc.resolve(o.pos-s.nodeSize):o)):Na?Co(t,new Ie(t.state.doc.resolve(e<0?c:c+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Te&&r.node.isInline)return Co(t,new Ie(e>0?r.$to:r.$from));{let o=Em(t.state,e);return o?Co(t,o):!1}}}function Du(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Gl(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function wi(t,e){return e<0?Y5(t):Q5(t)}function Y5(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,s,l=!1;for(Kn&&n.nodeType==1&&r<Du(n)&&Gl(n.childNodes[r],-1)&&(l=!0);;)if(r>0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(Gl(c,-1))o=n,s=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(DE(n))break;{let c=n.previousSibling;for(;c&&Gl(c,-1);)o=n.parentNode,s=Vt(c),c=c.previousSibling;if(c)n=c,r=Du(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}l?Mm(t,n,r):o&&Mm(t,o,s)}function Q5(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=Du(n),s,l;for(;;)if(r<o){if(n.nodeType!=1)break;let c=n.childNodes[r];if(Gl(c,1))s=n,l=++r;else break}else{if(DE(n))break;{let c=n.nextSibling;for(;c&&Gl(c,1);)s=c.parentNode,l=Vt(c)+1,c=c.nextSibling;if(c)n=c,r=0,o=Du(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}s&&Mm(t,s,l)}function DE(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function X5(t,e){for(;t&&e==t.childNodes.length&&!Ca(t);)e=Vt(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Z5(t,e){for(;t&&!e&&!Ca(t);)e=Vt(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Mm(t,e,n){if(e.nodeType!=3){let s,l;(l=X5(e,n))?(e=l,n=0):(s=Z5(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Kd(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&qr(t)},50)}function Gw(t,e){let n=t.state.doc.resolve(e);if(!(Wt||wE)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),l=(s.top+s.bottom)/2;if(l>o.top&&l<o.bottom&&Math.abs(s.left-o.left)>1)return s.left<o.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),l=(s.top+s.bottom)/2;if(l>o.top&&l<o.bottom&&Math.abs(s.left-o.left)>1)return s.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Jw(t,e,n){let r=t.state.selection;if(r instanceof Ie&&!r.empty||n.indexOf("s")>-1||Bn&&n.indexOf("m")>-1)return!1;let{$from:o,$to:s}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let l=Em(t.state,e);if(l&&l instanceof Te)return Co(t,l)}if(!o.parent.inlineContent){let l=e<0?o:s,c=r instanceof jn?Le.near(l,e):Le.findFrom(l,e);return c?Co(t,c):!1}return!1}function Yw(t,e){if(!(t.state.selection instanceof Ie))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 s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let l=t.state.tr;return e<0?l.delete(n.pos-s.nodeSize,n.pos):l.delete(n.pos,n.pos+s.nodeSize),t.dispatch(l),!0}return!1}function Qw(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function ez(t){if(!Xt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Qw(t,r,"true"),setTimeout(()=>Qw(t,r,"false"),20)}return!1}function tz(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function nz(t,e){let n=e.keyCode,r=tz(e);if(n==8||Bn&&n==72&&r=="c")return Yw(t,-1)||wi(t,-1);if(n==46&&!e.shiftKey||Bn&&n==68&&r=="c")return Yw(t,1)||wi(t,1);if(n==13||n==27)return!0;if(n==37||Bn&&n==66&&r=="c"){let o=n==37?Gw(t,t.state.selection.from)=="ltr"?-1:1:-1;return qw(t,o,r)||wi(t,o)}else if(n==39||Bn&&n==70&&r=="c"){let o=n==39?Gw(t,t.state.selection.from)=="ltr"?1:-1:1;return qw(t,o,r)||wi(t,o)}else{if(n==38||Bn&&n==80&&r=="c")return Jw(t,-1,r)||wi(t,-1);if(n==40||Bn&&n==78&&r=="c")return ez(t)||Jw(t,1,r)||wi(t,1);if(r==(Bn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Yg(t,e){t.someProp("transformCopied",x=>{e=x(e,t)});let n=[],{content:r,openStart:o,openEnd:s}=e;for(;o>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,s--;let x=r.firstChild;n.push(x.type.name,x.attrs!=x.type.defaultAttrs?x.attrs:null),r=x.content}let l=t.someProp("clipboardSerializer")||Vs.fromSchema(t.state.schema),c=BE(),u=c.createElement("div");u.appendChild(l.serializeFragment(r,{document:c}));let h=u.firstChild,p,m=0;for(;h&&h.nodeType==1&&(p=FE[h.nodeName.toLowerCase()]);){for(let x=p.length-1;x>=0;x--){let b=c.createElement(p[x]);for(;u.firstChild;)b.appendChild(u.firstChild);u.appendChild(b),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${o} ${s}${m?` -${m}`:""} ${JSON.stringify(n)}`);let y=t.someProp("clipboardTextSerializer",x=>x(e,t))||e.content.textBetween(0,e.content.size,`
449
+
450
+ `);return{dom:u,text:y,slice:e}}function _E(t,e,n,r,o){let s=o.parent.type.spec.code,l,c;if(!n&&!e)return null;let u=!!e&&(r||s||!n);if(u){if(t.someProp("transformPastedText",y=>{e=y(e,s||r,t)}),s)return c=new ue(Y.from(t.state.schema.text(e.replace(/\r\n?/g,`
451
+ `))),0,0),t.someProp("transformPasted",y=>{c=y(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",y=>y(e,o,r,t));if(m)c=m;else{let y=o.marks(),{schema:x}=t.state,b=Vs.fromSchema(x);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(k=>{let C=l.appendChild(document.createElement("p"));k&&C.appendChild(b.serializeNode(x.text(k,y)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),l=iz(n),Na&&lz(l);let h=l&&l.querySelector("[data-pm-slice]"),p=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let m=+p[3];m>0;m--){let y=l.firstChild;for(;y&&y.nodeType!=1;)y=y.nextSibling;if(!y)break;l=y}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||Do.fromSchema(t.state.schema)).parseSlice(l,{preserveWhitespace:!!(u||p),context:o,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!rz.test(y.parentNode.nodeName)?{ignore:!0}:null}})),p)c=az(Xw(c,+p[1],+p[2]),p[4]);else if(c=ue.maxOpen(oz(c.content,o),!0),c.openStart||c.openEnd){let m=0,y=0;for(let x=c.content.firstChild;m<c.openStart&&!x.type.spec.isolating;m++,x=x.firstChild);for(let x=c.content.lastChild;y<c.openEnd&&!x.type.spec.isolating;y++,x=x.lastChild);c=Xw(c,m,y)}return t.someProp("transformPasted",m=>{c=m(c,t,u)}),c}const rz=/^(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 oz(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)),s,l=[];if(t.forEach(c=>{if(!l)return;let u=o.findWrapping(c.type),h;if(!u)return l=null;if(h=l.length&&s.length&&zE(u,s,c,l[l.length-1],0))l[l.length-1]=h;else{l.length&&(l[l.length-1]=$E(l[l.length-1],s.length));let p=LE(c,u);l.push(p),o=o.matchType(p.type),s=u}}),l)return Y.from(l)}return t}function LE(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Y.from(t));return t}function zE(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let s=zE(t,e,n,r.lastChild,o+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(Y.from(LE(n,t,o+1))))}}function $E(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,$E(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(Y.empty,!0);return t.copy(n.append(r))}function Tm(t,e,n,r,o,s){let l=e<0?t.firstChild:t.lastChild,c=l.content;return t.childCount>1&&(s=0),o<r-1&&(c=Tm(c,e,n,r,o+1,s)),o>=n&&(c=e<0?l.contentMatchAt(0).fillBefore(c,s<=o).append(c):c.append(l.contentMatchAt(l.childCount).fillBefore(Y.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,l.copy(c))}function Xw(t,e,n){return e<t.openStart&&(t=new ue(Tm(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ue(Tm(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const FE={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Zw=null;function BE(){return Zw||(Zw=document.implementation.createHTMLDocument("title"))}let Np=null;function sz(t){let e=window.trustedTypes;return e?(Np||(Np=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Np.createHTML(t)):t}function iz(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=BE().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&FE[r[1].toLowerCase()])&&(t=o.map(s=>"<"+s+">").join("")+t+o.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=sz(t),o)for(let s=0;s<o.length;s++)n=n.querySelector(o[s])||n;return n}function lz(t){let e=t.querySelectorAll(Wt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function az(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:s,openEnd:l}=t;for(let c=r.length-2;c>=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;o=Y.from(u.create(r[c+1],o)),s++,l++}return new ue(o,s,l)}const sn={},ln={},cz={touchstart:!0,touchmove:!0};class uz{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 dz(t){for(let e in sn){let n=sn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{hz(t,r)&&!Qg(t,r)&&(t.editable||!(r.type in ln))&&n(t,r)},cz[e]?{passive:!0}:void 0)}Xt&&t.dom.addEventListener("input",()=>null),jm(t)}function Po(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function fz(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function jm(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Qg(t,r))})}function Qg(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function hz(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 pz(t,e){!Qg(t,e)&&sn[e.type]&&(t.editable||!(e.type in ln))&&sn[e.type](t,e)}ln.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!HE(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ur&&Wt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),zi&&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,ys(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||nz(t,n)?n.preventDefault():Po(t,"key")};ln.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ln.keypress=(t,e)=>{let n=e;if(HE(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Bn&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Ie)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",l=>l(t,r.$from.pos,r.$to.pos,o,s))&&t.dispatch(s()),n.preventDefault()}};function Gd(t){return{left:t.clientX,top:t.clientY}}function mz(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Xg(t,e,n,r,o){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let l=s.depth+1;l>0;l--)if(t.someProp(e,c=>l>s.depth?c(t,n,s.nodeAfter,s.before(l),o,!0):c(t,n,s.node(l),s.before(l),o,!1)))return!0;return!1}function Ri(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 gz(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Te.isSelectable(r)?(Ri(t,new Te(n)),!0):!1}function yz(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof Te&&(r=n.node);let s=t.state.doc.resolve(e);for(let l=s.depth+1;l>0;l--){let c=l>s.depth?s.nodeAfter:s.node(l);if(Te.isSelectable(c)){r&&n.$from.depth>0&&l>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?o=s.before(n.$from.depth):o=s.before(l);break}}return o!=null?(Ri(t,Te.create(t.state.doc,o)),!0):!1}function xz(t,e,n,r,o){return Xg(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(o?yz(t,n):gz(t,n))}function vz(t,e,n,r){return Xg(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function wz(t,e,n,r){return Xg(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||bz(t,n,r)}function bz(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Ri(t,Ie.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s),c=o.before(s);if(l.inlineContent)Ri(t,Ie.create(r,c+1,c+1+l.content.size));else if(Te.isSelectable(l))Ri(t,Te.create(r,c));else continue;return!0}}function Zg(t){return _u(t)}const VE=Bn?"metaKey":"ctrlKey";sn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Zg(t),o=Date.now(),s="singleClick";o-t.input.lastClick.time<500&&mz(n,t.input.lastClick)&&!n[VE]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:s,button:n.button};let l=t.posAtCoords(Gd(n));l&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new kz(t,l,n,!!r)):(s=="doubleClick"?vz:wz)(t,l.pos,l.inside,n)?n.preventDefault():Po(t,"pointer"))};class kz{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[VE],this.allowDefault=r.shiftKey;let s,l;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),l=n.inside;else{let p=e.state.doc.resolve(n.pos);s=p.parent,l=p.depth?p.before():0}const c=o?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:h}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||h instanceof Te&&h.from<=l&&h.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Kn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Po(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>qr(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Gd(e))),this.updateAllowDefault(e),this.allowDefault||!n?Po(this.view,"pointer"):xz(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Xt&&this.mightDrag&&!this.mightDrag.node.isAtom||Wt&&!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)?(Ri(this.view,Le.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Po(this.view,"pointer")}move(e){this.updateAllowDefault(e),Po(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}sn.touchstart=t=>{t.input.lastTouch=Date.now(),Zg(t),Po(t,"pointer")};sn.touchmove=t=>{t.input.lastTouch=Date.now(),Po(t,"pointer")};sn.contextmenu=t=>Zg(t);function HE(t,e){return t.composing?!0:Xt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Sz=Ur?5e3:-1;ln.compositionstart=ln.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Ie&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Wt&&wE&&Cz(t)))t.markCursor=t.state.storedMarks||n.marks(),_u(t,!0),t.markCursor=null;else if(_u(t,!e.selection.empty),Kn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,s=r.focusOffset;o&&o.nodeType==1&&s!=0;){let l=s<0?o.lastChild:o.childNodes[s-1];if(!l)break;if(l.nodeType==3){let c=t.domSelection();c&&c.collapse(l,l.nodeValue.length);break}else o=l,s=-1}}t.input.composing=!0}WE(t,Sz)};function Cz(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}ln.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,WE(t,20))};function WE(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>_u(t),e))}function UE(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Ez());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Nz(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=y5(e.focusNode,e.focusOffset),r=x5(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let l=n.pmViewDesc;if(!(!l||!l.isText(n.nodeValue)))return r}}return n||r}function Ez(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function _u(t,e=!1){if(!(Ur&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),UE(t),e||t.docView&&t.docView.dirty){let n=Gg(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 Mz(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)}const ca=gn&&_o<15||zi&&k5<604;sn.copy=ln.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let s=ca?null:n.clipboardData,l=r.content(),{dom:c,text:u}=Yg(t,l);s?(n.preventDefault(),s.clearData(),s.setData("text/html",c.innerHTML),s.setData("text/plain",u)):Mz(t,c),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Tz(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function jz(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?ua(t,r.value,null,o,e):ua(t,r.textContent,r.innerHTML,o,e)},50)}function ua(t,e,n,r,o){let s=_E(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,o,s||ue.empty)))return!0;if(!s)return!1;let l=Tz(s),c=l?t.state.tr.replaceSelectionWith(l,r):t.state.tr.replaceSelection(s);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function KE(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," "):""}ln.paste=(t,e)=>{let n=e;if(t.composing&&!Ur)return;let r=ca?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ua(t,KE(r),r.getData("text/html"),o,n)?n.preventDefault():jz(t,n)};class qE{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const Az=Bn?"altKey":"ctrlKey";function GE(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[Az]}sn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,s=o.empty?null:t.posAtCoords(Gd(n)),l;if(!(s&&s.pos>=o.from&&s.pos<=(o instanceof Te?o.to-1:o.to))){if(r&&r.mightDrag)l=Te.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(l=Te.create(t.state.doc,m.posBefore))}}let c=(l||t.state.selection).content(),{dom:u,text:h,slice:p}=Yg(t,c);(!n.dataTransfer.files.length||!Wt||vE>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ca?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",ca||n.dataTransfer.setData("text/plain",h),t.dragging=new qE(p,GE(t,n),l)};sn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};ln.dragover=ln.dragenter=(t,e)=>e.preventDefault();ln.drop=(t,e)=>{try{Rz(t,e,t.dragging)}finally{t.dragging=null}};function Rz(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Gd(e));if(!r)return;let o=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",x=>{s=x(s,t,!1)}):s=_E(t,KE(e.dataTransfer),ca?null:e.dataTransfer.getData("text/html"),!1,o);let l=!!(n&&GE(t,e));if(t.someProp("handleDrop",x=>x(t,e,s||ue.empty,l))){e.preventDefault();return}if(!s)return;e.preventDefault();let c=s?XN(t.state.doc,o.pos,s):o.pos;c==null&&(c=o.pos);let u=t.state.tr;if(l){let{node:x}=n;x?x.replace(u):u.deleteSelection()}let h=u.mapping.map(c),p=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,m=u.doc;if(p?u.replaceRangeWith(h,h,s.content.firstChild):u.replaceRange(h,h,s),u.doc.eq(m))return;let y=u.doc.resolve(h);if(p&&Te.isSelectable(s.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new Te(y));else{let x=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((b,k,C,N)=>x=N),u.setSelection(Jg(t,y,u.doc.resolve(x)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}sn.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())&&qr(t)},20))};sn.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)};sn.beforeinput=(t,e)=>{if(Wt&&Ur&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,ys(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 ln)sn[t]=ln[t];function da(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Lu{constructor(e,n){this.toDOM=e,this.spec=n||Ms,this.side=this.spec.side||0}map(e,n,r,o){let{pos:s,deleted:l}=e.mapResult(n.from+o,this.side<0?-1:1);return l?null:new wt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Lu&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&da(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class zo{constructor(e,n){this.attrs=e,this.spec=n||Ms}map(e,n,r,o){let s=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,l=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return s>=l?null:new wt(s,l,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof zo&&da(this.attrs,e.attrs)&&da(this.spec,e.spec)}static is(e){return e.type instanceof zo}destroy(){}}class ey{constructor(e,n){this.attrs=e,this.spec=n||Ms}map(e,n,r,o){let s=e.mapResult(n.from+o,1);if(s.deleted)return null;let l=e.mapResult(n.to+o,-1);return l.deleted||l.pos<=s.pos?null:new wt(s.pos-r,l.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),s;return o==n.from&&!(s=e.child(r)).isText&&o+s.nodeSize==n.to}eq(e){return this==e||e instanceof ey&&da(this.attrs,e.attrs)&&da(this.spec,e.spec)}destroy(){}}class wt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new wt(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 wt(e,e,new Lu(n,r))}static inline(e,n,r,o){return new wt(e,n,new zo(r,o))}static node(e,n,r,o){return new wt(e,n,new ey(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof zo}get widget(){return this.type instanceof Lu}}const ki=[],Ms={};class Xe{constructor(e,n){this.local=e.length?e:ki,this.children=n.length?n:ki}static create(e,n){return n.length?zu(n,e,0,Ms):Jt}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,s){for(let l=0;l<this.local.length;l++){let c=this.local[l];c.from<=n&&c.to>=e&&(!s||s(c.spec))&&r.push(c.copy(c.from+o,c.to+o))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<n&&this.children[l+1]>e){let c=this.children[l]+1;this.children[l+2].findInner(e-c,n-c,r,o+c,s)}}map(e,n,r){return this==Jt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Ms)}mapInner(e,n,r,o,s){let l;for(let c=0;c<this.local.length;c++){let u=this.local[c].map(e,r,o);u&&u.type.valid(n,u)?(l||(l=[])).push(u):s.onRemove&&s.onRemove(this.local[c].spec)}return this.children.length?Pz(this.children,l||[],e,n,r,o,s):l?new Xe(l.sort(Ts),ki):Jt}add(e,n){return n.length?this==Jt?Xe.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,s=0;e.forEach((c,u)=>{let h=u+r,p;if(p=YE(n,c,h)){for(o||(o=this.children.slice());s<o.length&&o[s]<u;)s+=3;o[s]==u?o[s+2]=o[s+2].addInner(c,p,h+1):o.splice(s,0,u,u+c.nodeSize,zu(p,c,h+1,Ms)),s+=3}});let l=JE(s?QE(n):n,-r);for(let c=0;c<l.length;c++)l[c].type.valid(e,l[c])||l.splice(c--,1);return new Xe(l.length?this.local.concat(l).sort(Ts):this.local,o||this.children)}remove(e){return e.length==0||this==Jt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let s=0;s<r.length;s+=3){let l,c=r[s]+n,u=r[s+1]+n;for(let p=0,m;p<e.length;p++)(m=e[p])&&m.from>c&&m.to<u&&(e[p]=null,(l||(l=[])).push(m));if(!l)continue;r==this.children&&(r=this.children.slice());let h=r[s+2].removeInner(l,c+1);h!=Jt?r[s+2]=h:(r.splice(s,3),s-=3)}if(o.length){for(let s=0,l;s<e.length;s++)if(l=e[s])for(let c=0;c<o.length;c++)o[c].eq(l,n)&&(o==this.local&&(o=this.local.slice()),o.splice(c--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new Xe(o,r):Jt}forChild(e,n){if(this==Jt)return this;if(n.isLeaf)return Xe.empty;let r,o;for(let c=0;c<this.children.length;c+=3)if(this.children[c]>=e){this.children[c]==e&&(r=this.children[c+2]);break}let s=e+1,l=s+n.content.size;for(let c=0;c<this.local.length;c++){let u=this.local[c];if(u.from<l&&u.to>s&&u.type instanceof zo){let h=Math.max(s,u.from)-s,p=Math.min(l,u.to)-s;h<p&&(o||(o=[])).push(u.copy(h,p))}}if(o){let c=new Xe(o.sort(Ts),ki);return r?new Mo([c,r]):c}return r||Jt}eq(e){if(this==e)return!0;if(!(e instanceof Xe)||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 ty(this.localsInner(e))}localsInner(e){if(this==Jt)return ki;if(e.inlineContent||!this.local.some(zo.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof zo||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Xe.empty=new Xe([],[]);Xe.removeOverlap=ty;const Jt=Xe.empty;class Mo{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,Ms));return Mo.from(r)}forChild(e,n){if(n.isLeaf)return Xe.empty;let r=[];for(let o=0;o<this.members.length;o++){let s=this.members[o].forChild(e,n);s!=Jt&&(s instanceof Mo?r=r.concat(s.members):r.push(s))}return Mo.from(r)}eq(e){if(!(e instanceof Mo)||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 s=this.members[o].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let l=0;l<s.length;l++)n.push(s[l])}}return n?ty(r?n:n.sort(Ts)):ki}static from(e){switch(e.length){case 0:return Jt;case 1:return e[0];default:return new Mo(e.every(n=>n instanceof Xe)?e:e.reduce((n,r)=>n.concat(r instanceof Xe?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Pz(t,e,n,r,o,s,l){let c=t.slice();for(let h=0,p=s;h<n.maps.length;h++){let m=0;n.maps[h].forEach((y,x,b,k)=>{let C=k-b-(x-y);for(let N=0;N<c.length;N+=3){let M=c[N+1];if(M<0||y>M+p-m)continue;let T=c[N]+p-m;x>=T?c[N+1]=y<=T?-2:-1:y>=p&&C&&(c[N]+=C,c[N+1]+=C)}m+=C}),p=n.maps[h].map(p,-1)}let u=!1;for(let h=0;h<c.length;h+=3)if(c[h+1]<0){if(c[h+1]==-2){u=!0,c[h+1]=-1;continue}let p=n.map(t[h]+s),m=p-o;if(m<0||m>=r.content.size){u=!0;continue}let y=n.map(t[h+1]+s,-1),x=y-o,{index:b,offset:k}=r.content.findIndex(m),C=r.maybeChild(b);if(C&&k==m&&k+C.nodeSize==x){let N=c[h+2].mapInner(n,C,p+1,t[h]+s+1,l);N!=Jt?(c[h]=m,c[h+1]=x,c[h+2]=N):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=Oz(c,t,e,n,o,s,l),p=zu(h,r,0,l);e=p.local;for(let m=0;m<c.length;m+=3)c[m+1]<0&&(c.splice(m,3),m-=3);for(let m=0,y=0;m<p.children.length;m+=3){let x=p.children[m];for(;y<c.length&&c[y]<x;)y+=3;c.splice(y,0,p.children[m],p.children[m+1],p.children[m+2])}}return new Xe(e.sort(Ts),c)}function JE(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 wt(o.from+e,o.to+e,o.type))}return n}function Oz(t,e,n,r,o,s,l){function c(u,h){for(let p=0;p<u.local.length;p++){let m=u.local[p].map(r,o,h);m?n.push(m):l.onRemove&&l.onRemove(u.local[p].spec)}for(let p=0;p<u.children.length;p+=3)c(u.children[p+2],u.children[p]+h+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&c(t[u+2],e[u]+s+1);return n}function YE(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let s=0,l;s<t.length;s++)(l=t[s])&&l.from>n&&l.to<r&&((o||(o=[])).push(l),t[s]=null);return o}function QE(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function zu(t,e,n,r){let o=[],s=!1;e.forEach((c,u)=>{let h=YE(t,c,u+n);if(h){s=!0;let p=zu(h,c,n+u+1,r);p!=Jt&&o.push(u,u+c.nodeSize,p)}});let l=JE(s?QE(t):t,-n).sort(Ts);for(let c=0;c<l.length;c++)l[c].type.valid(e,l[c])||(r.onRemove&&r.onRemove(l[c].spec),l.splice(c--,1));return l.length||o.length?new Xe(l,o):Jt}function Ts(t,e){return t.from-e.from||t.to-e.to}function ty(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 s=e[o];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[o]=s.copy(s.from,r.to),e1(e,o+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),e1(e,o,r.copy(s.from,r.to)));break}}}return e}function e1(t,e,n){for(;e<t.length&&Ts(n,t[e])>0;)e++;t.splice(e,0,n)}function Ep(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Jt&&e.push(r)}),t.cursorWrapper&&e.push(Xe.create(t.state.doc,[t.cursorWrapper.deco])),Mo.from(e)}const Iz={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Dz=gn&&_o<=11;class _z{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Lz{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new _z,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]);gn&&_o<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():Xt&&e.composing&&r.some(o=>o.type=="childList"&&o.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Dz&&(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,Iz)),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(Kw(this.view)){if(this.suppressingSelectionUpdates)return qr(this.view);if(gn&&_o<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&_s(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=Li(s))n.add(s);for(let s=e.anchorNode;s;s=Li(s))if(n.has(s)){r=s;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Kw(e)&&!this.ignoreSelectionChange(r),s=-1,l=-1,c=!1,u=[];if(e.editable)for(let p=0;p<n.length;p++){let m=this.registerMutation(n[p],u);m&&(s=s<0?m.from:Math.min(m.from,s),l=l<0?m.to:Math.max(m.to,l),m.typeOver&&(c=!0))}if(u.some(p=>p.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let p of u)if(p.nodeName=="BR"&&p.parentNode){let m=p.nextSibling;for(;m&&m.nodeType==1;){if(m.contentEditable=="false"){p.parentNode.removeChild(p);break}m=m.firstChild}}}else if(Kn&&u.length){let p=u.filter(m=>m.nodeName=="BR");if(p.length==2){let[m,y]=p;m.parentNode&&m.parentNode.parentNode==y.parentNode?y.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let y of p){let x=y.parentNode;x&&x.nodeName=="LI"&&(!m||Fz(e,m)!=x)&&y.remove()}}}let h=null;s<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Kd(r)&&(h=Gg(e))&&h.eq(Le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,qr(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||o)&&(s>-1&&(e.docView.markDirty(s,l),zz(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Bz(e,u)),this.handleDOMChange(s,l,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||qr(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let p=0;p<e.addedNodes.length;p++){let m=e.addedNodes[p];n.push(m),m.nodeType==3&&(this.lastChangedTextNode=m)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,s=e.nextSibling;if(gn&&_o<=11&&e.addedNodes.length)for(let p=0;p<e.addedNodes.length;p++){let{previousSibling:m,nextSibling:y}=e.addedNodes[p];(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(o=m),(!y||Array.prototype.indexOf.call(e.addedNodes,y)<0)&&(s=y)}let l=o&&o.parentNode==e.target?Vt(o)+1:0,c=r.localPosFromDOM(e.target,l,-1),u=s&&s.parentNode==e.target?Vt(s):e.target.childNodes.length,h=r.localPosFromDOM(e.target,u,1);return{from:c,to:h}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let t1=new WeakMap,n1=!1;function zz(t){if(!t1.has(t)&&(t1.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Kn,n1)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."),n1=!0}}function r1(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,s=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return _s(l.node,l.offset,o,s)&&([n,r,o,s]=[o,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:s}}function $z(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return r1(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?r1(t,n):null}function Fz(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 Bz(t,e){var n;let{focusNode:r,focusOffset:o}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let l=s.nextSibling;for(;l&&l.nodeName!="TD"&&l.nodeName!="TH";)l=l.nextSibling;if(l){let c=l;for(;;){let u=c.firstChild;if(!u||u.nodeType!=1||u.contentEditable=="false"||/^(BR|IMG)$/.test(u.nodeName))break;c=u}c.insertBefore(s,c.firstChild),r==s&&t.domSelection().collapse(s,o)}else s.parentNode.removeChild(s)}}function Vz(t,e,n){let{node:r,fromOffset:o,toOffset:s,from:l,to:c}=t.docView.parseRange(e,n),u=t.domSelectionRange(),h,p=u.anchorNode;if(p&&t.dom.contains(p.nodeType==1?p:p.parentNode)&&(h=[{node:p,offset:u.anchorOffset}],Kd(u)||h.push({node:u.focusNode,offset:u.focusOffset})),Wt&&t.input.lastKeyCode===8)for(let C=s;C>o;C--){let N=r.childNodes[C-1],M=N.pmViewDesc;if(N.nodeName=="BR"&&!M){s=C;break}if(!M||M.size)break}let m=t.state.doc,y=t.someProp("domParser")||Do.fromSchema(t.state.schema),x=m.resolve(l),b=null,k=y.parse(r,{topNode:x.parent,topMatch:x.parent.contentMatchAt(x.index()),topOpen:!0,from:o,to:s,preserveWhitespace:x.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:Hz,context:x});if(h&&h[0].pos!=null){let C=h[0].pos,N=h[1]&&h[1].pos;N==null&&(N=C),b={anchor:C+l,head:N+l}}return{doc:k,sel:b,from:l,to:c}}function Hz(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Xt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Xt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Wz=/^(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 Uz(t,e,n,r,o){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let I=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,_=Gg(t,I);if(_&&!t.state.selection.eq(_)){if(Wt&&Ur&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",q=>q(t,ys(13,"Enter"))))return;let $=t.state.tr.setSelection(_);I=="pointer"?$.setMeta("pointer",!0):I=="key"&&$.scrollIntoView(),s&&$.setMeta("composition",s),t.dispatch($)}return}let l=t.state.doc.resolve(e),c=l.sharedDepth(n);e=l.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,h=Vz(t,e,n),p=t.state.doc,m=p.slice(h.from,h.to),y,x;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(y=t.state.selection.to,x="end"):(y=t.state.selection.from,x="start"),t.input.lastKeyCode=null;let b=Gz(m.content,h.doc.content,h.from,y,x);if(b&&t.input.domChangeCount++,(zi&&t.input.lastIOSEnter>Date.now()-225||Ur)&&o.some(I=>I.nodeType==1&&!Wz.test(I.nodeName))&&(!b||b.endA>=b.endB)&&t.someProp("handleKeyDown",I=>I(t,ys(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!b)if(r&&u instanceof Ie&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))b={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let I=o1(t,t.state.doc,h.sel);if(I&&!I.eq(t.state.selection)){let _=t.state.tr.setSelection(I);s&&_.setMeta("composition",s),t.dispatch(_)}}return}t.state.selection.from<t.state.selection.to&&b.start==b.endB&&t.state.selection instanceof Ie&&(b.start>t.state.selection.from&&b.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?b.start=t.state.selection.from:b.endA<t.state.selection.to&&b.endA>=t.state.selection.to-2&&t.state.selection.to<=h.to&&(b.endB+=t.state.selection.to-b.endA,b.endA=t.state.selection.to)),gn&&_o<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>h.from&&h.doc.textBetween(b.start-h.from-1,b.start-h.from+1)=="  "&&(b.start--,b.endA--,b.endB--);let k=h.doc.resolveNoCache(b.start-h.from),C=h.doc.resolveNoCache(b.endB-h.from),N=p.resolve(b.start),M=k.sameParent(C)&&k.parent.inlineContent&&N.end()>=b.endA;if((zi&&t.input.lastIOSEnter>Date.now()-225&&(!M||o.some(I=>I.nodeName=="DIV"||I.nodeName=="P"))||!M&&k.pos<h.doc.content.size&&(!k.sameParent(C)||!k.parent.inlineContent)&&k.pos<C.pos&&!/\S/.test(h.doc.textBetween(k.pos,C.pos,"","")))&&t.someProp("handleKeyDown",I=>I(t,ys(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>b.start&&qz(p,b.start,b.endA,k,C)&&t.someProp("handleKeyDown",I=>I(t,ys(8,"Backspace")))){Ur&&Wt&&t.domObserver.suppressSelectionUpdates();return}Wt&&b.endB==b.start&&(t.input.lastChromeDelete=Date.now()),Ur&&!M&&k.start()!=C.start()&&C.parentOffset==0&&k.depth==C.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==b.endA&&(b.endB-=2,C=h.doc.resolveNoCache(b.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(I){return I(t,ys(13,"Enter"))})},20));let T=b.start,j=b.endA,P=I=>{let _=I||t.state.tr.replace(T,j,h.doc.slice(b.start-h.from,b.endB-h.from));if(h.sel){let $=o1(t,_.doc,h.sel);$&&!(Wt&&t.composing&&$.empty&&(b.start!=b.endB||t.input.lastChromeDelete<Date.now()-100)&&($.head==T||$.head==_.mapping.map(j)-1)||gn&&$.empty&&$.head==T)&&_.setSelection($)}return s&&_.setMeta("composition",s),_.scrollIntoView()},L;if(M)if(k.pos==C.pos){gn&&_o<=11&&k.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>qr(t),20));let I=P(t.state.tr.delete(T,j)),_=p.resolve(b.start).marksAcross(p.resolve(b.endA));_&&I.ensureMarks(_),t.dispatch(I)}else if(b.endA==b.endB&&(L=Kz(k.parent.content.cut(k.parentOffset,C.parentOffset),N.parent.content.cut(N.parentOffset,b.endA-N.start())))){let I=P(t.state.tr);L.type=="add"?I.addMark(T,j,L.mark):I.removeMark(T,j,L.mark),t.dispatch(I)}else if(k.parent.child(k.index()).isText&&k.index()==C.index()-(C.textOffset?0:1)){let I=k.parent.textBetween(k.parentOffset,C.parentOffset),_=()=>P(t.state.tr.insertText(I,T,j));t.someProp("handleTextInput",$=>$(t,T,j,I,_))||t.dispatch(_())}else t.dispatch(P());else t.dispatch(P())}function o1(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Jg(t,e.resolve(n.anchor),e.resolve(n.head))}function Kz(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,s=r,l,c,u;for(let p=0;p<r.length;p++)o=r[p].removeFromSet(o);for(let p=0;p<n.length;p++)s=n[p].removeFromSet(s);if(o.length==1&&s.length==0)c=o[0],l="add",u=p=>p.mark(c.addToSet(p.marks));else if(o.length==0&&s.length==1)c=s[0],l="remove",u=p=>p.mark(c.removeFromSet(p.marks));else return null;let h=[];for(let p=0;p<e.childCount;p++)h.push(u(e.child(p)));if(Y.from(h).eq(t))return{mark:c,type:l}}function qz(t,e,n,r,o){if(n-e<=o.pos-r.pos||Mp(r,!0,!1)<o.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let c=s.nodeAfter;return c!=null&&n==e+c.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let l=t.resolve(Mp(s,!0,!0));return!l.parent.isTextblock||l.pos>n||Mp(l,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function Mp(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 s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,o++}return o}function Gz(t,e,n,r,o){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:l,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let u=Math.max(0,s-Math.min(l,c));r-=l+u-s}if(l<s&&t.size<e.size){let u=r<=s&&r>=l?s-r:0;s-=u,s&&s<e.size&&s1(e.textBetween(s-1,s+1))&&(s+=u?1:-1),c=s+(c-l),l=s}else if(c<s){let u=r<=s&&r>=c?s-r:0;s-=u,s&&s<t.size&&s1(t.textBetween(s-1,s+1))&&(s+=u?1:-1),l=s+(l-c),c=s}return{start:s,endA:l,endB:c}}function s1(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class XE{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 uz,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(u1),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=a1(this),l1(this),this.nodeViews=c1(this),this.docView=Fw(this.state.doc,i1(this),Ep(this),this.dom,this),this.domObserver=new Lz(this,(r,o,s,l)=>Uz(this,r,o,s,l)),this.domObserver.start(),dz(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&&jm(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(u1),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,s=!1,l=!1;e.storedMarks&&this.composing&&(UE(this),l=!0),this.state=e;let c=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let x=c1(this);Yz(x,this.nodeViews)&&(this.nodeViews=x,s=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&jm(this),this.editable=a1(this),l1(this);let u=Ep(this),h=i1(this),p=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",m=s||!this.docView.matchesNode(e.doc,h,u);(m||!e.selection.eq(o.selection))&&(l=!0);let y=p=="preserve"&&l&&this.dom.style.overflowAnchor==null&&N5(this);if(l){this.domObserver.stop();let x=m&&(gn||Wt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&Jz(o.selection,e.selection);if(m){let b=Wt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Nz(this)),(s||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=Fw(e.doc,h,u,this.dom,this)),b&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(x=!0)}x||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&J5(this))?qr(this,x):(OE(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),p=="reset"?this.dom.scrollTop=0:p=="to selection"?this.scrollToSelection():y&&E5(y)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Te){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Iw(this,n.getBoundingClientRect(),e)}else Iw(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 s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(o=s)}this.dragging=new qE(e.slice,e.move,o<0?void 0:Te.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 l=0;l<this.directPlugins.length;l++){let c=this.directPlugins[l].props[e];if(c!=null&&(o=n?n(c):c))return o}let s=this.state.plugins;if(s)for(let l=0;l<s.length;l++){let c=s[l].props[e];if(c!=null&&(o=n?n(c):c))return o}}hasFocus(){if(gn){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&&M5(this.dom),qr(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 P5(this,e)}coordsAtPos(e,n=1){return NE(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 L5(this,n||this.state,e)}pasteHTML(e,n){return ua(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ua(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Yg(this,e)}destroy(){this.docView&&(fz(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ep(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,m5())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return pz(this,e)}domSelectionRange(){let e=this.domSelection();return e?Xt&&this.root.nodeType===11&&w5(this.dom.ownerDocument)==this.dom&&$z(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}XE.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function i1(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"),[wt.node(0,t.state.doc.content.size,e)]}function l1(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:wt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function a1(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Jz(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 c1(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 Yz(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 u1(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 Uo={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:"'"},$u={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Qz=typeof navigator<"u"&&/Mac/.test(navigator.platform),Xz=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ht=0;Ht<10;Ht++)Uo[48+Ht]=Uo[96+Ht]=String(Ht);for(var Ht=1;Ht<=24;Ht++)Uo[Ht+111]="F"+Ht;for(var Ht=65;Ht<=90;Ht++)Uo[Ht]=String.fromCharCode(Ht+32),$u[Ht]=String.fromCharCode(Ht);for(var Tp in Uo)$u.hasOwnProperty(Tp)||($u[Tp]=Uo[Tp]);function Zz(t){var e=Qz&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Xz&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?$u:Uo)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const e$=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),t$=typeof navigator<"u"&&/Win/.test(navigator.platform);function n$(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,s,l;for(let c=0;c<e.length-1;c++){let u=e[c];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))e$?l=!0:o=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),l&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function r$(t){let e=Object.create(null);for(let n in t)e[n$(n)]=t[n];return e}function jp(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 o$(t){return new Ze({props:{handleKeyDown:ZE(t)}})}function ZE(t){let e=r$(t);return function(n,r){let o=Zz(r),s,l=e[jp(o,r)];if(l&&l(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let c=e[jp(o,r,!1)];if(c&&c(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(t$&&r.ctrlKey&&r.altKey)&&(s=Uo[r.keyCode])&&s!=o){let c=e[jp(s,r)];if(c&&c(n.state,n.dispatch,n))return!0}}return!1}}var s$=Object.defineProperty,ny=(t,e)=>{for(var n in e)s$(t,n,{get:e[n],enumerable:!0})};function Jd(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,s=n.storedMarks,n}}}var Yd=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:o}=n,s=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([l,c])=>[l,(...h)=>{const p=c(...h)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:s}=r,l=[],c=!!t,u=t||o.tr,h=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(u),l.every(m=>m===!0)),p={...Object.fromEntries(Object.entries(n).map(([m,y])=>[m,(...b)=>{const k=this.buildProps(u,e),C=y(...b)(k);return l.push(C),p}])),run:h};return p}createCan(t){const{rawCommands:e,state:n}=this,r=!1,o=t||n.tr,s=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>u(...h)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:s}=r,l={tr:t,editor:r,view:s,state:Jd({state:o,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([c,u])=>[c,(...h)=>u(...h)(l)]))}};return l}},eM={};ny(eM,{blur:()=>i$,clearContent:()=>l$,clearNodes:()=>a$,command:()=>c$,createParagraphNear:()=>u$,cut:()=>d$,deleteCurrentNode:()=>f$,deleteNode:()=>h$,deleteRange:()=>p$,deleteSelection:()=>m$,enter:()=>g$,exitCode:()=>y$,extendMarkRange:()=>x$,first:()=>v$,focus:()=>b$,forEach:()=>k$,insertContent:()=>S$,insertContentAt:()=>E$,joinBackward:()=>j$,joinDown:()=>T$,joinForward:()=>A$,joinItemBackward:()=>R$,joinItemForward:()=>P$,joinTextblockBackward:()=>O$,joinTextblockForward:()=>I$,joinUp:()=>M$,keyboardShortcut:()=>_$,lift:()=>L$,liftEmptyBlock:()=>z$,liftListItem:()=>$$,newlineInCode:()=>F$,resetAttributes:()=>B$,scrollIntoView:()=>V$,selectAll:()=>H$,selectNodeBackward:()=>W$,selectNodeForward:()=>U$,selectParentNode:()=>K$,selectTextblockEnd:()=>q$,selectTextblockStart:()=>G$,setContent:()=>J$,setMark:()=>gF,setMeta:()=>yF,setNode:()=>xF,setNodeSelection:()=>vF,setTextDirection:()=>wF,setTextSelection:()=>bF,sinkListItem:()=>kF,splitBlock:()=>SF,splitListItem:()=>CF,toggleList:()=>EF,toggleMark:()=>MF,toggleNode:()=>TF,toggleWrap:()=>jF,undoInputRule:()=>AF,unsetAllMarks:()=>RF,unsetMark:()=>PF,unsetTextDirection:()=>OF,updateAttributes:()=>IF,wrapIn:()=>DF,wrapInList:()=>_F});var i$=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),l$=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),a$=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:s,$to:l})=>{t.doc.nodesBetween(s.pos,l.pos,(c,u)=>{if(c.type.isText)return;const{doc:h,mapping:p}=e,m=h.resolve(p.map(u)),y=h.resolve(p.map(u+c.nodeSize)),x=m.blockRange(y);if(!x)return;const b=Ki(x);if(c.type.isTextblock){const{defaultType:k}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(x.start,k)}(b||b===0)&&e.lift(x,b)})}),!0},c$=t=>e=>t(e),u$=()=>({state:t,dispatch:e})=>pE(t,e),d$=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,s=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const l=r.mapping.map(e);return r.insert(l,s.content),r.setSelection(new Ie(r.doc.resolve(Math.max(l-1,0)))),!0},f$=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===r.type){if(e){const c=o.before(s),u=o.after(s);t.delete(c,u).scrollIntoView()}return!0}return!1};function kt(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 h$=t=>({tr:e,state:n,dispatch:r})=>{const o=kt(t,n.schema),s=e.selection.$anchor;for(let l=s.depth;l>0;l-=1)if(s.node(l).type===o){if(r){const u=s.before(l),h=s.after(l);e.delete(u,h).scrollIntoView()}return!0}return!1},p$=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},m$=()=>({state:t,dispatch:e})=>Vg(t,e),g$=()=>({commands:t})=>t.keyboardShortcut("Enter"),y$=()=>({state:t,dispatch:e})=>e5(t,e);function ry(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Fu(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:ry(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function tM(t,e,n={}){return t.find(r=>r.type===e&&Fu(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function d1(t,e,n={}){return!!tM(t,e,n)}function oy(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(h=>h.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(h=>h.type===e))return;if(!n){const h=r.node.marks.find(p=>p.type===e);h&&(n=h.attrs)}if(!tM([...r.node.marks],e,n))return;let s=r.index,l=t.start()+r.offset,c=s+1,u=l+r.node.nodeSize;for(;s>0&&d1([...t.parent.child(s-1).marks],e,n);)s-=1,l-=t.parent.child(s).nodeSize;for(;c<t.parent.childCount&&d1([...t.parent.child(c).marks],e,n);)u+=t.parent.child(c).nodeSize,c+=1;return{from:l,to:u}}function Xr(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 x$=(t,e)=>({tr:n,state:r,dispatch:o})=>{const s=Xr(t,r.schema),{doc:l,selection:c}=n,{$from:u,from:h,to:p}=c;if(o){const m=oy(u,s,e);if(m&&m.from<=h&&m.to>=p){const y=Ie.create(l,m.from,m.to);n.setSelection(y)}}return!0},v$=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function nM(t){return t instanceof Ie}function ks(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function rM(t,e=null){if(!e)return null;const n=Le.atStart(t),r=Le.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,s=r.to;return e==="all"?Ie.create(t,ks(0,o,s),ks(t.content.size,o,s)):Ie.create(t,ks(e,o,s),ks(e,o,s))}function f1(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Bu(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function w$(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var b$=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:s})=>{e={scrollIntoView:!0,...e};const l=()=>{(Bu()||f1())&&r.dom.focus(),w$()&&!Bu()&&!f1()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(s&&t===null&&!nM(n.state.selection))return l(),!0;const c=rM(o.doc,t)||n.state.selection,u=n.state.selection.eq(c);return s&&(u||o.setSelection(c),u&&o.storedMarks&&o.setStoredMarks(o.storedMarks),l()),!0},k$=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),S$=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),oM=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&oM(r)}return t};function Jc(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return oM(n)}function fa(t,e,n){if(t instanceof Io||t instanceof Y)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return Y.fromArray(t.map(c=>e.nodeFromJSON(c)));const l=e.nodeFromJSON(t);return n.errorOnInvalidContent&&l.check(),l}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),fa("",e,n)}if(o){if(n.errorOnInvalidContent){let l=!1,c="";const u=new BN({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:h=>(l=!0,c=typeof h=="string"?h:h.outerHTML,null)}]}})});if(n.slice?Do.fromSchema(u).parseSlice(Jc(t),n.parseOptions):Do.fromSchema(u).parse(Jc(t),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=Do.fromSchema(e);return n.slice?s.parseSlice(Jc(t),n.parseOptions).content:s.parse(Jc(t),n.parseOptions)}return fa("",e,n)}function C$(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof xt||o instanceof It))return;const s=t.mapping.maps[r];let l=0;s.forEach((c,u,h,p)=>{l===0&&(l=p)}),t.setSelection(Le.near(t.doc.resolve(l),n))}var N$=t=>!("type"in t),E$=(t,e,n)=>({tr:r,dispatch:o,editor:s})=>{var l;if(o){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=C=>{s.emit("contentError",{editor:s,error:C,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{fa(e,s.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(C){u(C)}try{c=fa(e,s.schema,{parseOptions:h,errorOnInvalidContent:(l=n.errorOnInvalidContent)!=null?l:s.options.enableContentCheck})}catch(C){return u(C),!1}let{from:p,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},y=!0,x=!0;if((N$(c)?c:[c]).forEach(C=>{C.check(),y=y?C.isText&&C.marks.length===0:!1,x=x?C.isBlock:!1}),p===m&&x){const{parent:C}=r.doc.resolve(p);C.isTextblock&&!C.type.spec.code&&!C.childCount&&(p-=1,m+=1)}let k;if(y){if(Array.isArray(e))k=e.map(C=>C.text||"").join("");else if(e instanceof Y){let C="";e.forEach(N=>{N.text&&(C+=N.text)}),k=C}else typeof e=="object"&&e&&e.text?k=e.text:k=e;r.insertText(k,p,m)}else{k=c;const C=r.doc.resolve(p),N=C.node(),M=C.parentOffset===0,T=N.isText||N.isTextblock,j=N.content.size>0;M&&T&&j&&x&&(p=Math.max(0,p-1)),r.replaceWith(p,m,k)}n.updateSelection&&C$(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:p,text:k}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:p,text:k})}return!0},M$=()=>({state:t,dispatch:e})=>Q4(t,e),T$=()=>({state:t,dispatch:e})=>X4(t,e),j$=()=>({state:t,dispatch:e})=>lE(t,e),A$=()=>({state:t,dispatch:e})=>dE(t,e),R$=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Hd(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},P$=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Hd(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},O$=()=>({state:t,dispatch:e})=>J4(t,e),I$=()=>({state:t,dispatch:e})=>Y4(t,e);function sM(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function D$(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,s,l;for(let c=0;c<e.length-1;c+=1){const u=e[c];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))Bu()||sM()?l=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),l&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var _$=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const s=D$(t).split(/-(?!$)/),l=s.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),c=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",h=>h(n,c))});return u==null||u.steps.forEach(h=>{const p=h.map(r.mapping);p&&o&&r.maybeStep(p)}),!0};function Ko(t,e,n={}){const{from:r,to:o,empty:s}=t.selection,l=e?kt(e,t.schema):null,c=[];t.doc.nodesBetween(r,o,(m,y)=>{if(m.isText)return;const x=Math.max(r,y),b=Math.min(o,y+m.nodeSize);c.push({node:m,from:x,to:b})});const u=o-r,h=c.filter(m=>l?l.name===m.node.type.name:!0).filter(m=>Fu(m.node.attrs,n,{strict:!1}));return s?!!h.length:h.reduce((m,y)=>m+y.to-y.from,0)>=u}var L$=(t,e={})=>({state:n,dispatch:r})=>{const o=kt(t,n.schema);return Ko(n,o,e)?Z4(n,r):!1},z$=()=>({state:t,dispatch:e})=>mE(t,e),$$=t=>({state:e,dispatch:n})=>{const r=kt(t,e.schema);return d5(r)(e,n)},F$=()=>({state:t,dispatch:e})=>hE(t,e);function Qd(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function h1(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var B$=(t,e)=>({tr:n,state:r,dispatch:o})=>{let s=null,l=null;const c=Qd(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(s=kt(t,r.schema)),c==="mark"&&(l=Xr(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{r.doc.nodesBetween(h.$from.pos,h.$to.pos,(p,m)=>{s&&s===p.type&&(u=!0,o&&n.setNodeMarkup(m,void 0,h1(p.attrs,e))),l&&p.marks.length&&p.marks.forEach(y=>{l===y.type&&(u=!0,o&&n.addMark(m,m+p.nodeSize,l.create(h1(y.attrs,e))))})})}),u},V$=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),H$=()=>({tr:t,dispatch:e})=>{if(e){const n=new jn(t.doc);t.setSelection(n)}return!0},W$=()=>({state:t,dispatch:e})=>cE(t,e),U$=()=>({state:t,dispatch:e})=>fE(t,e),K$=()=>({state:t,dispatch:e})=>r5(t,e),q$=()=>({state:t,dispatch:e})=>i5(t,e),G$=()=>({state:t,dispatch:e})=>s5(t,e);function Am(t,e,n={},r={}){return fa(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var J$=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:s,dispatch:l,commands:c})=>{const{doc:u}=s;if(r.preserveWhitespace!=="full"){const h=Am(t,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return l&&s.replaceWith(0,u.content.size,h).setMeta("preventUpdate",!n),!0}return l&&s.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function iM(t,e){const n=Xr(e,t.schema),{from:r,to:o,empty:s}=t.selection,l=[];s?(t.storedMarks&&l.push(...t.storedMarks),l.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,u=>{l.push(...u.marks)});const c=l.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function lM(t,e){const n=new rE(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function Y$(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Q$(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,s)=>{n(o)&&r.push({node:o,pos:s})}),r}function X$(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Xd(t){return e=>X$(e.$from,t)}function Me(t,e,n){return t.config[e]===void 0&&t.parent?Me(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Me(t.parent,e,n):null}):t.config[e]}function sy(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Me(e,"addExtensions",n);return r?[e,...sy(r())]:e}).flat(10)}function iy(t,e){const n=Vs.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function aM(t){return typeof t=="function"}function Ge(t,e=void 0,...n){return aM(t)?e?t.bind(e)(...n):t(...n):t}function Z$(t={}){return Object.keys(t).length===0&&t.constructor===Object}function $i(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function cM(t){const e=[],{nodeExtensions:n,markExtensions:r}=$i(t),o=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},l=n.filter(h=>h.name!=="text").map(h=>h.name),c=r.map(h=>h.name),u=[...l,...c];return t.forEach(h=>{const p={name:h.name,options:h.options,storage:h.storage,extensions:o},m=Me(h,"addGlobalAttributes",p);if(!m)return;m().forEach(x=>{let b;Array.isArray(x.types)?b=x.types:x.types==="*"?b=u:x.types==="nodes"?b=l:x.types==="marks"?b=c:b=[],b.forEach(k=>{Object.entries(x.attributes).forEach(([C,N])=>{e.push({type:k,name:C,attribute:{...s,...N}})})})})}),o.forEach(h=>{const p={name:h.name,options:h.options,storage:h.storage},m=Me(h,"addAttributes",p);if(!m)return;const y=m();Object.entries(y).forEach(([x,b])=>{const k={...s,...b};typeof(k==null?void 0:k.default)=="function"&&(k.default=k.default()),k!=null&&k.isRequired&&(k==null?void 0:k.default)===void 0&&delete k.default,e.push({type:h.name,name:x,attribute:k})})}),e}function eF(t){const e=[];let n="",r=!1,o=!1,s=0;const l=t.length;for(let c=0;c<l;c+=1){const u=t[c];if(u==="'"&&!o){r=!r,n+=u;continue}if(u==='"'&&!r){o=!o,n+=u;continue}if(!r&&!o){if(u==="("){s+=1,n+=u;continue}if(u===")"&&s>0){s-=1,n+=u;continue}if(u===";"&&s===0){e.push(n),n="";continue}}n+=u}return n&&e.push(n),e}function p1(t){const e=[],n=eF(t||""),r=n.length;for(let o=0;o<r;o+=1){const s=n[o],l=s.indexOf(":");if(l===-1)continue;const c=s.slice(0,l).trim(),u=s.slice(l+1).trim();c&&u&&e.push([c,u])}return e}function St(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,s])=>{if(!r[o]){r[o]=s;return}if(o==="class"){const c=s?String(s).split(" "):[],u=r[o]?r[o].split(" "):[],h=c.filter(p=>!u.includes(p));r[o]=[...u,...h].join(" ")}else if(o==="style"){const c=new Map([...p1(r[o]),...p1(s)]);r[o]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[o]=s}),r},{})}function ha(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)=>St(n,r),{})}function tF(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function m1(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const o=e.reduce((s,l)=>{const c=l.attribute.parseHTML?l.attribute.parseHTML(n):tF(n.getAttribute(l.name));return c==null?s:{...s,[l.name]:c}},{});return{...r,...o}}}}function g1(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Z$(n)?!1:n!=null))}function y1(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function nF(t,e){var n;const r=cM(t),{nodeExtensions:o,markExtensions:s}=$i(t),l=(n=o.find(h=>Me(h,"topNode")))==null?void 0:n.name,c=Object.fromEntries(o.map(h=>{const p=r.filter(N=>N.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},y=t.reduce((N,M)=>{const T=Me(M,"extendNodeSchema",m);return{...N,...T?T(h):{}}},{}),x=g1({...y,content:Ge(Me(h,"content",m)),marks:Ge(Me(h,"marks",m)),group:Ge(Me(h,"group",m)),inline:Ge(Me(h,"inline",m)),atom:Ge(Me(h,"atom",m)),selectable:Ge(Me(h,"selectable",m)),draggable:Ge(Me(h,"draggable",m)),code:Ge(Me(h,"code",m)),whitespace:Ge(Me(h,"whitespace",m)),linebreakReplacement:Ge(Me(h,"linebreakReplacement",m)),defining:Ge(Me(h,"defining",m)),isolating:Ge(Me(h,"isolating",m)),attrs:Object.fromEntries(p.map(y1))}),b=Ge(Me(h,"parseHTML",m));b&&(x.parseDOM=b.map(N=>m1(N,p)));const k=Me(h,"renderHTML",m);k&&(x.toDOM=N=>k({node:N,HTMLAttributes:ha(N,p)}));const C=Me(h,"renderText",m);return C&&(x.toText=C),[h.name,x]})),u=Object.fromEntries(s.map(h=>{const p=r.filter(C=>C.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},y=t.reduce((C,N)=>{const M=Me(N,"extendMarkSchema",m);return{...C,...M?M(h):{}}},{}),x=g1({...y,inclusive:Ge(Me(h,"inclusive",m)),excludes:Ge(Me(h,"excludes",m)),group:Ge(Me(h,"group",m)),spanning:Ge(Me(h,"spanning",m)),code:Ge(Me(h,"code",m)),attrs:Object.fromEntries(p.map(y1))}),b=Ge(Me(h,"parseHTML",m));b&&(x.parseDOM=b.map(C=>m1(C,p)));const k=Me(h,"renderHTML",m);return k&&(x.toDOM=C=>k({mark:C,HTMLAttributes:ha(C,p)})),[h.name,x]}));return new BN({topNode:l,nodes:c,marks:u})}function rF(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Jl(t){return t.sort((n,r)=>{const o=Me(n,"priority")||100,s=Me(r,"priority")||100;return o>s?-1:o<s?1:0})}function uM(t){const e=Jl(sy(t)),n=rF(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 dM(t,e,n){const{from:r,to:o}=e,{blockSeparator:s=`
452
+
453
+ `,textSerializers:l={}}=n||{};let c="";return t.nodesBetween(r,o,(u,h,p,m)=>{var y;u.isBlock&&h>r&&(c+=s);const x=l==null?void 0:l[u.type.name];if(x)return p&&(c+=x({node:u,pos:h,parent:p,index:m,range:e})),!1;u.isText&&(c+=(y=u==null?void 0:u.text)==null?void 0:y.slice(Math.max(r,h)-h,o-h))}),c}function oF(t,e){const n={from:0,to:t.content.size};return dM(t,n,e)}function fM(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function sF(t,e){const n=kt(e,t.schema),{from:r,to:o}=t.selection,s=[];t.doc.nodesBetween(r,o,c=>{s.push(c)});const l=s.reverse().find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function hM(t,e){const n=Qd(typeof e=="string"?e:e.name,t.schema);return n==="node"?sF(t,e):n==="mark"?iM(t,e):{}}function iF(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function lF(t){const e=iF(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,l)=>l!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function pM(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,s)=>{const l=[];if(o.ranges.length)o.forEach((c,u)=>{l.push({from:c,to:u})});else{const{from:c,to:u}=n[s];if(c===void 0||u===void 0)return;l.push({from:c,to:u})}l.forEach(({from:c,to:u})=>{const h=e.slice(s).map(c,-1),p=e.slice(s).map(u),m=e.invert().map(h,-1),y=e.invert().map(p);r.push({oldRange:{from:m,to:y},newRange:{from:h,to:p}})})}),lF(r)}function ly(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const s=n.resolve(t),l=oy(s,o.type);l&&r.push({mark:o,...l})}):n.nodesBetween(t,e,(o,s)=>{!o||(o==null?void 0:o.nodeSize)===void 0||r.push(...o.marks.map(l=>({from:s,to:s+o.nodeSize,mark:l})))}),r}var aF=(t,e,n,r=20)=>{const o=t.doc.resolve(n);let s=r,l=null;for(;s>0&&l===null;){const c=o.node(s);(c==null?void 0:c.type.name)===e?l=c:s-=1}return[l,s]};function Il(t,e){return e.nodes[t]||e.marks[t]||null}function fu(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(s=>s.type===e&&s.name===r);return o?o.attribute.keepOnSplit:!1}))}var cF=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,s,l,c)=>{var u,h;const p=((h=(u=o.type.spec).toText)==null?void 0:h.call(u,{node:o,pos:s,parent:l,index:c}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?p:p.slice(0,Math.max(0,r-s))}),n};function Rm(t,e,n={}){const{empty:r,ranges:o}=t.selection,s=e?Xr(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>s?s.name===m.type.name:!0).find(m=>Fu(m.attrs,n,{strict:!1}));let l=0;const c=[];if(o.forEach(({$from:m,$to:y})=>{const x=m.pos,b=y.pos;t.doc.nodesBetween(x,b,(k,C)=>{if(s&&k.inlineContent&&!k.type.allowsMarkType(s))return!1;if(!k.isText&&!k.marks.length)return;const N=Math.max(x,C),M=Math.min(b,C+k.nodeSize),T=M-N;l+=T,c.push(...k.marks.map(j=>({mark:j,from:N,to:M})))})}),l===0)return!1;const u=c.filter(m=>s?s.name===m.mark.type.name:!0).filter(m=>Fu(m.mark.attrs,n,{strict:!1})).reduce((m,y)=>m+y.to-y.from,0),h=c.filter(m=>s?m.mark.type!==s&&m.mark.type.excludes(s):!0).reduce((m,y)=>m+y.to-y.from,0);return(u>0?u+h:u)>=l}function uF(t,e,n={}){if(!e)return Ko(t,null,n)||Rm(t,null,n);const r=Qd(e,t.schema);return r==="node"?Ko(t,e,n):r==="mark"?Rm(t,e,n):!1}var dF=(t,e)=>{const{$from:n,$to:r,$anchor:o}=t.selection;if(e){const s=Xd(c=>c.type.name===e)(t.selection);if(!s)return!1;const l=t.doc.resolve(s.pos+1);return o.pos+1===l.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},fF=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function x1(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Ap(t,e){const{nodeExtensions:n}=$i(e),r=n.find(l=>l.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},s=Ge(Me(r,"group",o));return typeof s!="string"?!1:s.split(" ").includes("list")}function Zd(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return!/\S/.test((r=t.text)!=null?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(s=>{o!==!1&&(Zd(s,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function mM(t){return t instanceof Te}var gM=class yM{constructor(e){this.position=e}static fromJSON(e){return new yM(e.position)}toJSON(){return{position:this.position}}};function hF(t,e){const n=e.mapping.mapResult(t.position);return{position:new gM(n.pos),mapResult:n}}function pF(t){return new gM(t)}function mF(t,e,n){var r;const{selection:o}=e;let s=null;if(nM(o)&&(s=o.$cursor),s){const c=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(h=>h.type.excludes(n)))}const{ranges:l}=o;return l.some(({$from:c,$to:u})=>{let h=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(p,m,y)=>{if(h)return!1;if(p.isInline){const x=!y||y.type.allowsMarkType(n),b=!!n.isInSet(p.marks)||!p.marks.some(k=>k.type.excludes(n));h=x&&b}return!h}),h})}var gF=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=n,{empty:l,ranges:c}=s,u=Xr(t,r.schema);if(o)if(l){const h=iM(r,u);n.addStoredMark(u.create({...h,...e}))}else c.forEach(h=>{const p=h.$from.pos,m=h.$to.pos;r.doc.nodesBetween(p,m,(y,x)=>{const b=Math.max(x,p),k=Math.min(x+y.nodeSize,m);y.marks.find(N=>N.type===u)?y.marks.forEach(N=>{u===N.type&&n.addMark(b,k,u.create({...N.attrs,...e}))}):n.addMark(b,k,u.create(e))})});return mF(r,n,u)},yF=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),xF=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const s=kt(t,n.schema);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),s.isTextblock?o().command(({commands:c})=>Rw(s,{...l,...e})(n)?!0:c.clearNodes()).command(({state:c})=>Rw(s,{...l,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},vF=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=ks(t,0,r.content.size),s=Te.create(r,o);e.setSelection(s)}return!0},wF=(t,e)=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=r;let l,c;return typeof e=="number"?(l=e,c=e):e&&"from"in e&&"to"in e?(l=e.from,c=e.to):(l=s.from,c=s.to),o&&n.doc.nodesBetween(l,c,(u,h)=>{u.isText||n.setNodeMarkup(h,void 0,{...u.attrs,dir:t})}),!0},bF=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:s}=typeof t=="number"?{from:t,to:t}:t,l=Ie.atStart(r).from,c=Ie.atEnd(r).to,u=ks(o,l,c),h=ks(s,l,c),p=Ie.create(r,u,h);e.setSelection(p)}return!0},kF=t=>({state:e,dispatch:n})=>{const r=kt(t,e.schema);return p5(r)(e,n)};function v1(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e==null?void 0:e.includes(o.type.name));t.tr.ensureMarks(r)}}var SF=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:s,doc:l}=e,{$from:c,$to:u}=s,h=o.extensionManager.attributes,p=fu(h,c.node().type.name,c.node().attrs);if(s instanceof Te&&s.node.isBlock)return!c.parentOffset||!Kr(l,c.pos)?!1:(r&&(t&&v1(n,o.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,y=c.depth===0?void 0:Y$(c.node(-1).contentMatchAt(c.indexAfter(-1)));let x=m&&y?[{type:y,attrs:p}]:void 0,b=Kr(e.doc,e.mapping.map(c.pos),1,x);if(!x&&!b&&Kr(e.doc,e.mapping.map(c.pos),1,y?[{type:y}]:void 0)&&(b=!0,x=y?[{type:y,attrs:p}]:void 0),r){if(b&&(s instanceof Ie&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,x),y&&!m&&!c.parentOffset&&c.parent.type!==y)){const k=e.mapping.map(c.before()),C=e.doc.resolve(k);c.node(-1).canReplaceWith(C.index(),C.index()+1,y)&&e.setNodeMarkup(e.mapping.map(c.before()),y)}t&&v1(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return b},CF=(t,e={})=>({tr:n,state:r,dispatch:o,editor:s})=>{var l;const c=kt(t,r.schema),{$from:u,$to:h}=r.selection,p=r.selection.node;if(p&&p.isBlock||u.depth<2||!u.sameParent(h))return!1;const m=u.node(-1);if(m.type!==c)return!1;const y=s.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(o){let N=Y.empty;const M=u.index(-1)?1:u.index(-2)?2:3;for(let _=u.depth-M;_>=u.depth-3;_-=1)N=Y.from(u.node(_).copy(N));const T=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,j={...fu(y,u.node().type.name,u.node().attrs),...e},P=((l=c.contentMatch.defaultType)==null?void 0:l.createAndFill(j))||void 0;N=N.append(Y.from(c.createAndFill(null,P)||void 0));const L=u.before(u.depth-(M-1));n.replace(L,u.after(-T),new ue(N,4-M,0));let I=-1;n.doc.nodesBetween(L,n.doc.content.size,(_,$)=>{if(I>-1)return!1;_.isTextblock&&_.content.size===0&&(I=$+1)}),I>-1&&n.setSelection(Ie.near(n.doc.resolve(I))),n.scrollIntoView()}return!0}const x=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,b={...fu(y,m.type.name,m.attrs),...e},k={...fu(y,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const C=x?[{type:c,attrs:b},{type:x,attrs:k}]:[{type:c,attrs:b}];if(!Kr(n.doc,u.pos,2))return!1;if(o){const{selection:N,storedMarks:M}=r,{splittableMarks:T}=s.extensionManager,j=M||N.$to.parentOffset&&N.$from.marks();if(n.split(u.pos,2,C).scrollIntoView(),!j||!o)return!0;const P=j.filter(L=>T.includes(L.type.name));n.ensureMarks(P)}return!0},Rp=(t,e)=>{const n=Xd(l=>l.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&Qo(t.doc,n.pos)&&t.join(n.pos),!0},Pp=(t,e)=>{const n=Xd(l=>l.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&Qo(t.doc,r)&&t.join(r),!0};function NF(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),o=e.resolve(n.nodeSize-1);return Ie.between(r,o)}var EF=(t,e,n,r={})=>({editor:o,tr:s,state:l,dispatch:c,chain:u,commands:h,can:p})=>{const{extensions:m,splittableMarks:y}=o.extensionManager,x=kt(t,l.schema),b=kt(e,l.schema),{selection:k,storedMarks:C}=l,{$from:N,$to:M}=k,T=N.blockRange(M),j=C||k.$to.parentOffset&&k.$from.marks();if(!T)return!1;const P=Xd(K=>Ap(K.type.name,m))(k),L=k.from===0&&k.to===l.doc.content.size,I=l.doc.content.content,_=I.length===1?I[0]:null,$=L&&_&&Ap(_.type.name,m)?{node:_,pos:0}:null,q=P??$,X=!!P&&T.depth>=1&&T.depth-P.depth<=1,ee=!!$;if((X||ee)&&q){if(q.node.type===x)return L&&ee?u().command(({tr:K,dispatch:ie})=>{const ne=NF(K);return ne?(K.setSelection(ne),ie&&ie(K),!0):!1}).liftListItem(b).run():h.liftListItem(b);if(Ap(q.node.type.name,m)&&x.validContent(q.node.content))return u().command(()=>(s.setNodeMarkup(q.pos,x),!0)).command(()=>Rp(s,x)).command(()=>Pp(s,x)).run()}return!n||!j||!c?u().command(()=>p().wrapInList(x,r)?!0:h.clearNodes()).wrapInList(x,r).command(()=>Rp(s,x)).command(()=>Pp(s,x)).run():u().command(()=>{const K=p().wrapInList(x,r),ie=j.filter(ne=>y.includes(ne.type.name));return s.ensureMarks(ie),K?!0:h.clearNodes()}).wrapInList(x,r).command(()=>Rp(s,x)).command(()=>Pp(s,x)).run()},MF=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:s=!1}=n,l=Xr(t,r.schema);return Rm(r,l,e)?o.unsetMark(l,{extendEmptyMarkRange:s}):o.setMark(l,e)},TF=(t,e,n={})=>({state:r,commands:o})=>{const s=kt(t,r.schema),l=kt(e,r.schema),c=Ko(r,s,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?o.setNode(l,u):o.setNode(s,{...u,...n})},jF=(t,e={})=>({state:n,commands:r})=>{const o=kt(t,n.schema);return Ko(n,o,e)?r.lift(o):r.wrapIn(o,e)},AF=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let s;if(o.spec.isInputRules&&(s=o.getState(t))){if(e){const l=t.tr,c=s.transform;for(let u=c.steps.length-1;u>=0;u-=1)l.step(c.steps[u].invert(c.docs[u]));if(s.text){const u=l.doc.resolve(s.from).marks();l.replaceWith(s.from,s.to,t.schema.text(s.text,u))}else l.delete(s.from,s.to)}return!0}}return!1},RF=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},PF=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var s;const{extendEmptyMarkRange:l=!1}=e,{selection:c}=n,u=Xr(t,r.schema),{$from:h,empty:p,ranges:m}=c;if(!o)return!0;if(p&&l){let{from:y,to:x}=c;const b=(s=h.marks().find(C=>C.type===u))==null?void 0:s.attrs,k=oy(h,u,b);k&&(y=k.from,x=k.to),n.removeMark(y,x,u)}else m.forEach(y=>{n.removeMark(y.$from.pos,y.$to.pos,u)});return n.removeStoredMark(u),!0},OF=t=>({tr:e,state:n,dispatch:r})=>{const{selection:o}=n;let s,l;return typeof t=="number"?(s=t,l=t):t&&"from"in t&&"to"in t?(s=t.from,l=t.to):(s=o.from,l=o.to),r&&e.doc.nodesBetween(s,l,(c,u)=>{if(c.isText)return;const h={...c.attrs};delete h.dir,e.setNodeMarkup(u,void 0,h)}),!0},IF=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let s=null,l=null;const c=Qd(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(s=kt(t,r.schema)),c==="mark"&&(l=Xr(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const p=h.$from.pos,m=h.$to.pos;let y,x,b,k;n.selection.empty?r.doc.nodesBetween(p,m,(C,N)=>{s&&s===C.type&&(u=!0,b=Math.max(N,p),k=Math.min(N+C.nodeSize,m),y=N,x=C)}):r.doc.nodesBetween(p,m,(C,N)=>{N<p&&s&&s===C.type&&(u=!0,b=Math.max(N,p),k=Math.min(N+C.nodeSize,m),y=N,x=C),N>=p&&N<=m&&(s&&s===C.type&&(u=!0,o&&n.setNodeMarkup(N,void 0,{...C.attrs,...e})),l&&C.marks.length&&C.marks.forEach(M=>{if(l===M.type&&(u=!0,o)){const T=Math.max(N,p),j=Math.min(N+C.nodeSize,m);n.addMark(T,j,l.create({...M.attrs,...e}))}}))}),x&&(y!==void 0&&o&&n.setNodeMarkup(y,void 0,{...x.attrs,...e}),l&&x.marks.length&&x.marks.forEach(C=>{l===C.type&&o&&n.addMark(b,k,l.create({...C.attrs,...e}))}))}),u},DF=(t,e={})=>({state:n,dispatch:r})=>{const o=kt(t,n.schema);return l5(o,e)(n,r)},_F=(t,e={})=>({state:n,dispatch:r})=>{const o=kt(t,n.schema);return a5(o,e)(n,r)},LF=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},ef=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},zF=(t,e)=>{if(ry(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Yc(t){var e;const{editor:n,from:r,to:o,text:s,rules:l,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const h=u.state.doc.resolve(r);if(h.parent.type.spec.code||(e=h.nodeBefore||h.nodeAfter)!=null&&e.marks.find(y=>y.type.spec.code))return!1;let p=!1;const m=cF(h)+s;return l.forEach(y=>{if(p)return;const x=zF(m,y.find);if(!x)return;const b=u.state.tr,k=Jd({state:u.state,transaction:b}),C={from:r-(x[0].length-s.length),to:o},{commands:N,chain:M,can:T}=new Yd({editor:n,state:k});y.handler({state:k,range:C,match:x,commands:N,chain:M,can:T})===null||!b.steps.length||(y.undoable&&b.setMeta(c,{transform:b,from:r,to:o,text:s}),u.dispatch(b),p=!0)}),p}function $F(t){const{editor:e,rules:n}=t,r=new Ze({state:{init(){return null},apply(o,s,l){const c=o.getMeta(r);if(c)return c;const u=o.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:p}=u;typeof p=="string"?p=p:p=iy(Y.from(p),l.schema);const{from:m}=u,y=m+p.length;Yc({editor:e,from:m,to:y,text:p,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:s}},props:{handleTextInput(o,s,l,c){return Yc({editor:e,from:s,to:l,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:s}=o.state.selection;s&&Yc({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,s){if(s.key!=="Enter")return!1;const{$cursor:l}=o.state.selection;return l?Yc({editor:e,from:l.pos,to:l.pos,text:`
454
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function FF(t){return Object.prototype.toString.call(t).slice(8,-1)}function Qc(t){return FF(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function xM(t,e){const n={...t};return Qc(t)&&Qc(e)&&Object.keys(e).forEach(r=>{Qc(e[r])&&Qc(t[r])?n[r]=xM(t[r],e[r]):n[r]=e[r]}),n}var ay=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{...Ge(Me(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Ge(Me(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>xM(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const 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}},Hs=class vM extends ay{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new vM(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const l=o.marks();if(!!!l.find(h=>(h==null?void 0:h.type.name)===n.name))return!1;const u=l.find(h=>(h==null?void 0:h.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function BF(t){return typeof t=="number"}var VF=class{constructor(t){this.find=t.find,this.handler=t.handler}},HF=(t,e,n)=>{if(ry(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(o=>{const s=[o.text];return s.index=o.index,s.input=t,s.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(o.replaceWith)),s}):[]};function WF(t){const{editor:e,state:n,from:r,to:o,rule:s,pasteEvent:l,dropEvent:c}=t,{commands:u,chain:h,can:p}=new Yd({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,o,(x,b)=>{var k,C,N,M,T;if((C=(k=x.type)==null?void 0:k.spec)!=null&&C.code||!(x.isText||x.isTextblock||x.isInline))return;const j=(T=(M=(N=x.content)==null?void 0:N.size)!=null?M:x.nodeSize)!=null?T:0,P=Math.max(r,b),L=Math.min(o,b+j);if(P>=L)return;const I=x.isText?x.text||"":x.textBetween(P-b,L-b,void 0,"");HF(I,s.find,l).forEach($=>{if($.index===void 0)return;const q=P+$.index+1,X=q+$[0].length,ee={from:n.tr.mapping.map(q),to:n.tr.mapping.map(X)},K=s.handler({state:n,range:ee,match:$,commands:u,chain:h,can:p,pasteEvent:l,dropEvent:c});m.push(K)})}),m.every(x=>x!==null)}var Xc=null,UF=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function KF(t){const{editor:e,rules:n}=t;let r=null,o=!1,s=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:p,from:m,to:y,rule:x,pasteEvt:b})=>{const k=p.tr,C=Jd({state:p,transaction:k});if(!(!WF({editor:e,state:C,from:Math.max(m-1,0),to:y.b-1,rule:x,pasteEvent:b,dropEvent:c})||!k.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,k}};return n.map(p=>new Ze({view(m){const y=b=>{var k;r=(k=m.dom.parentElement)!=null&&k.contains(b.target)?m.dom.parentElement:null,r&&(Xc=e)},x=()=>{Xc&&(Xc=null)};return window.addEventListener("dragstart",y),window.addEventListener("dragend",x),{destroy(){window.removeEventListener("dragstart",y),window.removeEventListener("dragend",x)}}},props:{handleDOMEvents:{drop:(m,y)=>{if(s=r===m.dom.parentElement,c=y,!s){const x=Xc;x!=null&&x.isEditable&&setTimeout(()=>{const b=x.state.selection;b&&x.commands.deleteRange({from:b.from,to:b.to})},10)}return!1},paste:(m,y)=>{var x;const b=(x=y.clipboardData)==null?void 0:x.getData("text/html");return l=y,o=!!(b!=null&&b.includes("data-pm-slice")),!1}}},appendTransaction:(m,y,x)=>{const b=m[0],k=b.getMeta("uiEvent")==="paste"&&!o,C=b.getMeta("uiEvent")==="drop"&&!s,N=b.getMeta("applyPasteRules"),M=!!N;if(!k&&!C&&!M)return;if(M){let{text:P}=N;typeof P=="string"?P=P:P=iy(Y.from(P),x.schema);const{from:L}=N,I=L+P.length,_=UF(P);return u({rule:p,state:x,from:L,to:{b:I},pasteEvt:_})}const T=y.doc.content.findDiffStart(x.doc.content),j=y.doc.content.findDiffEnd(x.doc.content);if(!(!BF(T)||!j||T===j.b))return u({rule:p,state:x,from:T,to:j,pasteEvt:l})}}))}var tf=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=uM(t),this.schema=nF(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Il(e.name,this.schema)},r=Me(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Jl([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Il(r.name,this.schema)},s=[],l=Me(r,"addKeyboardShortcuts",o);let c={};if(r.type==="mark"&&Me(r,"exitable",o)&&(c.ArrowRight=()=>Hs.handleExit({editor:t,mark:r})),l){const y=Object.fromEntries(Object.entries(l()).map(([x,b])=>[x,()=>b({editor:t})]));c={...c,...y}}const u=o$(c);s.push(u);const h=Me(r,"addInputRules",o);if(x1(r,t.options.enableInputRules)&&h){const y=h();if(y&&y.length){const x=$F({editor:t,rules:y}),b=Array.isArray(x)?x:[x];s.push(...b)}}const p=Me(r,"addPasteRules",o);if(x1(r,t.options.enablePasteRules)&&p){const y=p();if(y&&y.length){const x=KF({editor:t,rules:y});s.push(...x)}}const m=Me(r,"addProseMirrorPlugins",o);if(m){const y=m();s.push(...y)}return s})}get attributes(){return cM(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=$i(this.extensions);return Object.fromEntries(e.filter(n=>!!Me(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:kt(n.name,this.schema)},s=Me(n,"addNodeView",o);if(!s)return[];const l=s();if(!l)return[];const c=(u,h,p,m,y)=>{const x=ha(u,r);return l({node:u,view:h,getPos:p,decorations:m,innerDecorations:y,editor:t,extension:n,HTMLAttributes:x})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return Jl([...this.extensions].reverse()).reduceRight((r,o)=>{const s={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:e,type:Il(o.name,this.schema)},l=Me(o,"dispatchTransaction",s);return l?c=>{l.call(s,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return Jl([...this.extensions]).reduce((r,o)=>{const s={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:e,type:Il(o.name,this.schema)},l=Me(o,"transformPastedHTML",s);return l?(c,u)=>{const h=r(c,u);return l.call(s,h)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=$i(this.extensions);return Object.fromEntries(e.filter(n=>!!Me(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Xr(n.name,this.schema)},s=Me(n,"addMarkView",o);if(!s)return[];const l=(c,u,h)=>{const p=ha(c,r);return s()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:p,updateAttributes:m=>{iB(c,t,m)}})};return[n.name,l]}))}destroy(){this.extensions.forEach(t=>{let e=t;for(;e.parent;){const n=e.parent;n.child===e&&(n.child=null),e=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Il(e.name,this.schema)};e.type==="mark"&&((n=Ge(Me(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const o=Me(e,"onBeforeCreate",r),s=Me(e,"onCreate",r),l=Me(e,"onUpdate",r),c=Me(e,"onSelectionUpdate",r),u=Me(e,"onTransaction",r),h=Me(e,"onFocus",r),p=Me(e,"onBlur",r),m=Me(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),s&&this.editor.on("create",s),l&&this.editor.on("update",l),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),h&&this.editor.on("focus",h),p&&this.editor.on("blur",p),m&&this.editor.on("destroy",m)})}};tf.resolve=uM;tf.sort=Jl;tf.flatten=sy;var qF={};ny(qF,{ClipboardTextSerializer:()=>bM,Commands:()=>kM,Delete:()=>SM,Drop:()=>CM,Editable:()=>NM,FocusEvents:()=>MM,Keymap:()=>TM,Paste:()=>jM,Tabindex:()=>AM,TextDirection:()=>RM,focusEventsPluginKey:()=>EM});var it=class wM extends ay{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new wM(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},bM=it.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ze({key:new ht("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:s}=o,l=Math.min(...s.map(p=>p.$from.pos)),c=Math.max(...s.map(p=>p.$to.pos)),u=fM(n);return dM(r,{from:l,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),kM=it.create({name:"commands",addCommands(){return{...eM}}}),SM=it.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,o;const s=()=>{var l,c,u,h;if((h=(u=(c=(l=this.editor.options.coreExtensionOptions)==null?void 0:l.delete)==null?void 0:c.filterTransaction)==null?void 0:u.call(c,t))!=null?h:t.getMeta("y-sync$"))return;const p=lM(t.before,[t,...e]);pM(p).forEach(x=>{p.mapping.mapResult(x.oldRange.from).deletedAfter&&p.mapping.mapResult(x.oldRange.to).deletedBefore&&p.before.nodesBetween(x.oldRange.from,x.oldRange.to,(b,k)=>{const C=k+b.nodeSize-2,N=x.oldRange.from<=k&&C<=x.oldRange.to;this.editor.emit("delete",{type:"node",node:b,from:k,to:C,newFrom:p.mapping.map(k),newTo:p.mapping.map(C),deletedRange:x.oldRange,newRange:x.newRange,partial:!N,editor:this.editor,transaction:t,combinedTransform:p})})});const y=p.mapping;p.steps.forEach((x,b)=>{var k,C;if(x instanceof sr){const N=y.slice(b).map(x.from,-1),M=y.slice(b).map(x.to),T=y.invert().map(N,-1),j=y.invert().map(M),P=N>0?(k=p.doc.nodeAt(N-1))==null?void 0:k.marks.some(I=>I.eq(x.mark)):!1,L=(C=p.doc.nodeAt(M))==null?void 0:C.marks.some(I=>I.eq(x.mark));this.editor.emit("delete",{type:"mark",mark:x.mark,from:x.from,to:x.to,deletedRange:{from:T,to:j},newRange:{from:N,to:M},partial:!!(L||P),editor:this.editor,transaction:t,combinedTransform:p})}})};(o=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||o?setTimeout(s,0):s()}}),CM=it.create({name:"drop",addProseMirrorPlugins(){return[new Ze({key:new ht("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),NM=it.create({name:"editable",addProseMirrorPlugins(){return[new Ze({key:new ht("editable"),props:{editable:()=>this.editor.options.editable}})]}}),EM=new ht("focusEvents"),MM=it.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ze({key:EM,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),TM=it.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:c})=>{const{selection:u,doc:h}=c,{empty:p,$anchor:m}=u,{pos:y,parent:x}=m,b=m.parent.isTextblock&&y>0?c.doc.resolve(y-1):m,k=b.parent.type.spec.isolating,C=m.pos-m.parentOffset,N=k&&b.parent.childCount===1?C===m.pos:Le.atStart(h).from===y;return!p||!x.type.isTextblock||x.textContent.length||!N||N&&m.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Bu()||sM()?s:o},addProseMirrorPlugins(){return[new Ze({key:new ht("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(k=>k.getMeta("composition")))return;const r=t.some(k=>k.docChanged)&&!e.doc.eq(n.doc),o=t.some(k=>k.getMeta("preventClearDocument"));if(!r||o)return;const{empty:s,from:l,to:c}=e.selection,u=Le.atStart(e.doc).from,h=Le.atEnd(e.doc).to;if(s||!(l===u&&c===h)||!Zd(n.doc))return;const y=n.tr,x=Jd({state:n,transaction:y}),{commands:b}=new Yd({editor:this.editor,state:x});if(b.clearNodes(),!!y.steps.length)return y}})]}}),jM=it.create({name:"paste",addProseMirrorPlugins(){return[new Ze({key:new ht("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),AM=it.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Ze({key:new ht("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),RM=it.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=$i(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const 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 Ze({key:new ht("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),GF=class Hl{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 name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Hl(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 Hl(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 Hl(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,l=n.isInline,c=this.pos+r+(s?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(c);if(!o&&!l&&u.depth<=this.depth)return;const h=new Hl(u,this.editor,o,o||l?n:null);o&&(h.actualDepth=this.depth+1),e.push(h)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){const s=o.node.attrs,l=Object.keys(n);for(let c=0;c<l.length;c+=1){const u=l[c];if(s[u]!==n[u])break}}else r=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;const s=Object.keys(n);return this.children.forEach(l=>{r&&o.length>0||(l.node.type.name===e&&s.every(u=>n[u]===l.node.attrs[u])&&o.push(l),!(r&&o.length>0)&&(o=o.concat(l.querySelectorAll(e,n,r))))}),o}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},JF=`.ProseMirror {
455
+ position: relative;
456
+ }
457
+
458
+ .ProseMirror {
459
+ word-wrap: break-word;
460
+ white-space: pre-wrap;
461
+ white-space: break-spaces;
462
+ -webkit-font-variant-ligatures: none;
463
+ font-variant-ligatures: none;
464
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
465
+ }
466
+
467
+ .ProseMirror [contenteditable="false"] {
468
+ white-space: normal;
469
+ }
470
+
471
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
472
+ white-space: pre-wrap;
473
+ }
474
+
475
+ .ProseMirror pre {
476
+ white-space: pre-wrap;
477
+ }
478
+
479
+ img.ProseMirror-separator {
480
+ display: inline !important;
481
+ border: none !important;
482
+ margin: 0 !important;
483
+ width: 0 !important;
484
+ height: 0 !important;
485
+ }
486
+
487
+ .ProseMirror-gapcursor {
488
+ display: none;
489
+ pointer-events: none;
490
+ position: absolute;
491
+ margin: 0;
492
+ }
493
+
494
+ .ProseMirror-gapcursor:after {
495
+ content: "";
496
+ display: block;
497
+ position: absolute;
498
+ top: -2px;
499
+ width: 20px;
500
+ border-top: 1px solid black;
501
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
502
+ }
503
+
504
+ @keyframes ProseMirror-cursor-blink {
505
+ to {
506
+ visibility: hidden;
507
+ }
508
+ }
509
+
510
+ .ProseMirror-hideselection *::selection {
511
+ background: transparent;
512
+ }
513
+
514
+ .ProseMirror-hideselection *::-moz-selection {
515
+ background: transparent;
516
+ }
517
+
518
+ .ProseMirror-hideselection * {
519
+ caret-color: transparent;
520
+ }
521
+
522
+ .ProseMirror-focused .ProseMirror-gapcursor {
523
+ display: block;
524
+ }`;function YF(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute("data-tiptap-style",""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}var QF=class extends LF{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.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:hF,createMappablePosition:pF},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:r,slice:o,moved:s})=>this.options.onDrop(r,o,s)),this.on("paste",({event:r,slice:o})=>this.options.onPaste(r,o)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=rM(e,this.options.autofocus);this.editorState=Ei.create({doc:e,schema:this.schema,selection:n||void 0}),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){const t=this.editorView.dom;t!=null&&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.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=YF(JF,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),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 this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=aM(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;const e=this.state.plugins;let n=e;if([].concat(t).forEach(o=>{const s=typeof o=="string"?`${o}$`:o.key;n=n.filter(l=>!l.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e,n,r;const s=[...this.options.enableCoreExtensions?[NM,bM.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),kM,MM,TM,AM.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),CM,jM,SM,RM.configure({direction:this.options.textDirection})].filter(l=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[l.name]!==!1:!0):[],...this.options.extensions].filter(l=>["extension","node","mark"].includes(l==null?void 0:l.type));this.extensionManager=new tf(s,this)}createCommandManager(){this.commandManager=new Yd({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Am(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;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(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Am(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),o=n?this.extensionManager.dispatchTransaction(r):r,s=e.transformPastedHTML,l=this.extensionManager.transformPastedHTML(s);this.editorView=new XE(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:o,transformPastedHTML:l,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const u=this.view.dom;u.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;const 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(h=>{var p;return(p=this.capturedTransaction)==null?void 0:p.step(h)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),o=n.includes(t),s=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});const l=n.findLast(h=>h.getMeta("focus")||h.getMeta("blur")),c=l==null?void 0:l.getMeta("focus"),u=l==null?void 0:l.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:l}),u&&this.emit("blur",{editor:this,event:u.event,transaction:l}),!(t.getMeta("preventUpdate")||!n.some(h=>h.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return hM(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return uF(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return iy(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
525
+
526
+ `,textSerializers:n={}}=t||{};return oF(this.state.doc,{blockSeparator:e,textSerializers:{...fM(this.schema),...n}})}get isEmpty(){return Zd(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(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new GF(e,this)}get $doc(){return this.$pos(0)}};function Fi(t){return new ef({find:t.find,handler:({state:e,range:n,match:r})=>{const o=Ge(t.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:s}=e,l=r[r.length-1],c=r[0];if(l){const u=c.search(/\S/),h=n.from+c.indexOf(l),p=h+l.length;if(ly(n.from,n.to,e.doc).filter(x=>x.mark.type.excluded.find(k=>k===t.type&&k!==x.mark.type)).filter(x=>x.to>h).length)return null;p<n.to&&s.delete(p,n.to),h>n.from&&s.delete(n.from+u,h);const y=n.from+u+l.length;s.addMark(n.from+u,y,t.type.create(o||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function XF(t){return new ef({find:t.find,handler:({state:e,range:n,match:r})=>{const o=Ge(t.getAttributes,void 0,r)||{},{tr:s}=e,l=n.from;let c=n.to;const u=t.type.create(o);if(r[1]){const h=r[0].lastIndexOf(r[1]);let p=l+h;p>c?p=c:c=p+r[1].length;const m=r[0][r[0].length-1];s.insertText(m,l+r[0].length-1),s.replaceWith(p,c,u)}else if(r[0]){const h=t.type.isInline?l:l-1;s.insert(h,t.type.create(o)).delete(s.mapping.map(l),s.mapping.map(c))}s.scrollIntoView()},undoable:t.undoable})}function Pm(t){return new ef({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),s=Ge(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,s)},undoable:t.undoable})}function Bi(t){return new ef({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{const s=Ge(t.getAttributes,void 0,r)||{},l=e.tr.delete(n.from,n.to),u=l.doc.resolve(n.from).blockRange(),h=u&&Fg(u,t.type,s);if(!h)return null;if(l.wrap(u,h),t.keepMarks&&t.editor){const{selection:m,storedMarks:y}=e,{splittableMarks:x}=t.editor.extensionManager,b=y||m.$to.parentOffset&&m.$from.marks();if(b){const k=b.filter(C=>x.includes(C.type.name));l.ensureMarks(k)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(m,s).run()}const p=l.doc.resolve(n.from-1).nodeBefore;p&&p.type===t.type&&Qo(l.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,p))&&l.join(n.from-1)},undoable:t.undoable})}function ZF(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Te){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let o=r.depth;for(;o>=0;){const s=r.index(o);if(r.node(o).contentMatchAt(s).matchType(e))return!0;o-=1}return!1}var eB={};ny(eB,{createAtomBlockMarkdownSpec:()=>tB,createBlockMarkdownSpec:()=>nB,createInlineMarkdownSpec:()=>sB,parseAttributes:()=>cy,parseIndentedBlocks:()=>Om,renderNestedMarkdownContent:()=>dy,serializeAttributes:()=>uy});function cy(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const h=o.map(p=>p.trim().slice(1));e.class=h.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const l=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(l)).forEach(([,h,p])=>{var m;const y=parseInt(((m=p.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),x=n[y];x&&(e[h]=x.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(p=>{p.match(/^[a-zA-Z][\w-]*$/)&&(e[p]=!0)}),e}function uy(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function tB(t){const{nodeName:e,name:n,parseAttributes:r=cy,serializeAttributes:o=uy,defaultAttributes:s={},requiredAttributes:l=[],allowedAttributes:c}=t,u=n||e,h=p=>{if(!c)return p;const m={};return c.forEach(y=>{y in p&&(m[y]=p[y])}),m};return{parseMarkdown:(p,m)=>{const y={...s,...p.attributes};return m.createNode(e,y,[])},markdownTokenizer:{name:e,level:"block",start(p){var m;const y=new RegExp(`^:::${u}(?:\\s|$)`,"m"),x=(m=p.match(y))==null?void 0:m.index;return x!==void 0?x:-1},tokenize(p,m,y){const x=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),b=p.match(x);if(!b)return;const k=b[1]||"",C=r(k);if(!l.find(M=>!(M in C)))return{type:e,raw:b[0],attributes:C}}},renderMarkdown:p=>{const m=h(p.attrs||{}),y=o(m),x=y?` {${y}}`:"";return`:::${u}${x} :::`}}}function nB(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=cy,serializeAttributes:s=uy,defaultAttributes:l={},content:c="block",allowedAttributes:u}=t,h=n||e,p=m=>{if(!u)return m;const y={};return u.forEach(x=>{x in m&&(y[x]=m[x])}),y};return{parseMarkdown:(m,y)=>{let x;if(r){const k=r(m);x=typeof k=="string"?[{type:"text",text:k}]:k}else c==="block"?x=y.parseChildren(m.tokens||[]):x=y.parseInline(m.tokens||[]);const b={...l,...m.attributes};return y.createNode(e,b,x)},markdownTokenizer:{name:e,level:"block",start(m){var y;const x=new RegExp(`^:::${h}`,"m"),b=(y=m.match(x))==null?void 0:y.index;return b!==void 0?b:-1},tokenize(m,y,x){var b;const k=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),C=m.match(k);if(!C)return;const[N,M=""]=C,T=o(M);let j=1;const P=N.length;let L="";const I=/^:::([\w-]*)(\s.*)?/gm,_=m.slice(P);for(I.lastIndex=0;;){const $=I.exec(_);if($===null)break;const q=$.index,X=$[1];if(!((b=$[2])!=null&&b.endsWith(":::"))){if(X)j+=1;else if(j-=1,j===0){const ee=_.slice(0,q);L=ee.trim();const K=m.slice(0,P+q+$[0].length);let ie=[];if(L)if(c==="block")for(ie=x.blockTokens(ee),ie.forEach(ne=>{ne.text&&(!ne.tokens||ne.tokens.length===0)&&(ne.tokens=x.inlineTokens(ne.text))});ie.length>0;){const ne=ie[ie.length-1];if(ne.type==="paragraph"&&(!ne.text||ne.text.trim()===""))ie.pop();else break}else ie=x.inlineTokens(L);return{type:e,raw:K,attributes:T,content:L,tokens:ie}}}}}},renderMarkdown:(m,y)=>{const x=p(m.attrs||{}),b=s(x),k=b?` {${b}}`:"",C=y.renderChildren(m.content||[],`
527
+
528
+ `);return`:::${h}${k}
529
+
530
+ ${C}
531
+
532
+ :::`}}}function rB(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,o,s,l]=r;e[o]=s||l,r=n.exec(t)}return e}function oB(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function sB(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=rB,serializeAttributes:s=oB,defaultAttributes:l={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,p=y=>{if(!u)return y;const x={};return u.forEach(b=>{const k=typeof b=="string"?b:b.name,C=typeof b=="string"?void 0:b.skipIfDefault;if(k in y){const N=y[k];if(C!==void 0&&N===C)return;x[k]=N}}),x},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(y,x)=>{const b={...l,...y.attributes};if(c)return x.createNode(e,b);const k=r?r(y):y.content||"";return k?x.createNode(e,b,[x.createTextNode(k)]):x.createNode(e,b,[])},markdownTokenizer:{name:e,level:"inline",start(y){const x=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),b=y.match(x),k=b==null?void 0:b.index;return k!==void 0?k:-1},tokenize(y,x,b){const k=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),C=y.match(k);if(!C)return;let N="",M="";if(c){const[,j]=C;M=j}else{const[,j,P]=C;M=j,N=P||""}const T=o(M.trim());return{type:e,raw:C[0],content:N.trim(),attributes:T}}},renderMarkdown:y=>{let x="";r?x=r(y):y.content&&y.content.length>0&&(x=y.content.filter(N=>N.type==="text").map(N=>N.text).join(""));const b=p(y.attrs||{}),k=s(b),C=k?` ${k}`:"";return c?`[${h}${C}]`:`[${h}${C}]${x}[/${h}]`}}}function Om(t,e,n){var r,o,s,l;const c=t.split(`
533
+ `),u=[];let h="",p=0;const m=e.baseIndentSize||2;for(;p<c.length;){const y=c[p],x=y.match(e.itemPattern);if(!x){if(u.length>0)break;if(y.trim()===""){p+=1,h=`${h}${y}
534
+ `;continue}else return}const b=e.extractItemData(x),{indentLevel:k,mainContent:C}=b;h=`${h}${y}
535
+ `;const N=[C];for(p+=1;p<c.length;){const P=c[p];if(P.trim()===""){const I=c.slice(p+1).findIndex(q=>q.trim()!=="");if(I===-1)break;if((((o=(r=c[p+1+I].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:o.length)||0)>k){N.push(P),h=`${h}${P}
536
+ `,p+=1;continue}else break}if((((l=(s=P.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:l.length)||0)>k)N.push(P),h=`${h}${P}
537
+ `,p+=1;else break}let M;const T=N.slice(1);if(T.length>0){const P=T.map(L=>L.slice(k+m)).join(`
538
+ `);P.trim()&&(e.customNestedParser?M=e.customNestedParser(P):M=n.blockTokens(P))}const j=e.createToken(b,M);u.push(j)}if(u.length!==0)return{items:u,raw:h}}function dy(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const o=typeof n=="function"?n(r):n,[s,...l]=t.content,c=e.renderChildren([s]);let u=`${o}${c}`;return l&&l.length>0&&l.forEach((h,p)=>{var m,y;const x=(y=(m=e.renderChild)==null?void 0:m.call(e,h,p+1))!=null?y:e.renderChildren([h]);if(x!=null){const b=x.split(`
539
+ `).map(k=>k?e.indent(k):e.indent("")).join(`
540
+ `);u+=h.type==="paragraph"?`
541
+
542
+ ${b}`:`
543
+ ${b}`}}),u}function iB(t,e,n={}){const{state:r}=e,{doc:o,tr:s}=r,l=t;o.descendants((c,u)=>{const h=s.mapping.map(u),p=s.mapping.map(u)+c.nodeSize;let m=null;if(c.marks.forEach(x=>{if(x!==l)return!1;m=x}),!m)return;let y=!1;if(Object.keys(n).forEach(x=>{n[x]!==m.attrs[x]&&(y=!0)}),y){const x=t.type.create({...t.attrs,...n});s.removeMark(h,p,t.type),s.addMark(h,p,x)}}),s.docChanged&&e.view.dispatch(s)}var Rn=class PM extends ay{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new PM(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function zs(t){return new VF({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const s=Ge(t.getAttributes,void 0,r,o);if(s===!1||s===null)return null;const{tr:l}=e,c=r[r.length-1],u=r[0];let h=n.to;if(c){const p=u.search(/\S/),m=n.from+u.indexOf(c),y=m+c.length;if(ly(n.from,n.to,e.doc).filter(k=>k.mark.type.excluded.find(N=>N===t.type&&N!==k.mark.type)).filter(k=>k.to>m).length)return null;y<n.to&&l.delete(y,n.to),m>n.from&&l.delete(n.from+p,m),h=n.from+p+c.length,l.addMark(n.from+p,h,t.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||l.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:lB,getOwnPropertySymbols:aB}=Object,{hasOwnProperty:cB}=Object.prototype;function Op(t,e){return function(r,o,s){return t(r,o,s)&&e(r,o,s)}}function Zc(t){return function(n,r,o){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,o);const{cache:s}=o,l=s.get(n),c=s.get(r);if(l&&c)return l===r&&c===n;s.set(n,r),s.set(r,n);const u=t(n,r,o);return s.delete(n),s.delete(r),u}}function uB(t){return t!=null?t[Symbol.toStringTag]:void 0}function w1(t){return lB(t).concat(aB(t))}const dB=Object.hasOwn||((t,e)=>cB.call(t,e));function Ws(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const fB="__v",hB="__o",pB="_owner",{getOwnPropertyDescriptor:b1,keys:k1}=Object;function mB(t,e){return t.byteLength===e.byteLength&&Vu(new Uint8Array(t),new Uint8Array(e))}function gB(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function yB(t,e){return t.byteLength===e.byteLength&&Vu(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function xB(t,e){return Ws(t.getTime(),e.getTime())}function vB(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function wB(t,e){return t===e}function S1(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const o=new Array(r),s=t.entries();let l,c,u=0;for(;(l=s.next())&&!l.done;){const h=e.entries();let p=!1,m=0;for(;(c=h.next())&&!c.done;){if(o[m]){m++;continue}const y=l.value,x=c.value;if(n.equals(y[0],x[0],u,m,t,e,n)&&n.equals(y[1],x[1],y[0],x[0],t,e,n)){p=o[m]=!0;break}m++}if(!p)return!1;u++}return!0}const bB=Ws;function kB(t,e,n){const r=k1(t);let o=r.length;if(k1(e).length!==o)return!1;for(;o-- >0;)if(!OM(t,e,n,r[o]))return!1;return!0}function Dl(t,e,n){const r=w1(t);let o=r.length;if(w1(e).length!==o)return!1;let s,l,c;for(;o-- >0;)if(s=r[o],!OM(t,e,n,s)||(l=b1(t,s),c=b1(e,s),(l||c)&&(!l||!c||l.configurable!==c.configurable||l.enumerable!==c.enumerable||l.writable!==c.writable)))return!1;return!0}function SB(t,e){return Ws(t.valueOf(),e.valueOf())}function CB(t,e){return t.source===e.source&&t.flags===e.flags}function C1(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const o=new Array(r),s=t.values();let l,c;for(;(l=s.next())&&!l.done;){const u=e.values();let h=!1,p=0;for(;(c=u.next())&&!c.done;){if(!o[p]&&n.equals(l.value,c.value,l.value,c.value,t,e,n)){h=o[p]=!0;break}p++}if(!h)return!1}return!0}function Vu(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function NB(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function OM(t,e,n,r){return(r===pB||r===hB||r===fB)&&(t.$$typeof||e.$$typeof)?!0:dB(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const EB="[object ArrayBuffer]",MB="[object Arguments]",TB="[object Boolean]",jB="[object DataView]",AB="[object Date]",RB="[object Error]",PB="[object Map]",OB="[object Number]",IB="[object Object]",DB="[object RegExp]",_B="[object Set]",LB="[object String]",zB={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},$B="[object URL]",FB=Object.prototype.toString;function BB({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:o,areFunctionsEqual:s,areMapsEqual:l,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:h,areRegExpsEqual:p,areSetsEqual:m,areTypedArraysEqual:y,areUrlsEqual:x,unknownTagComparators:b}){return function(C,N,M){if(C===N)return!0;if(C==null||N==null)return!1;const T=typeof C;if(T!==typeof N)return!1;if(T!=="object")return T==="number"?c(C,N,M):T==="function"?s(C,N,M):!1;const j=C.constructor;if(j!==N.constructor)return!1;if(j===Object)return u(C,N,M);if(Array.isArray(C))return e(C,N,M);if(j===Date)return r(C,N,M);if(j===RegExp)return p(C,N,M);if(j===Map)return l(C,N,M);if(j===Set)return m(C,N,M);const P=FB.call(C);if(P===AB)return r(C,N,M);if(P===DB)return p(C,N,M);if(P===PB)return l(C,N,M);if(P===_B)return m(C,N,M);if(P===IB)return typeof C.then!="function"&&typeof N.then!="function"&&u(C,N,M);if(P===$B)return x(C,N,M);if(P===RB)return o(C,N,M);if(P===MB)return u(C,N,M);if(zB[P])return y(C,N,M);if(P===EB)return t(C,N,M);if(P===jB)return n(C,N,M);if(P===TB||P===OB||P===LB)return h(C,N,M);if(b){let L=b[P];if(!L){const I=uB(C);I&&(L=b[I])}if(L)return L(C,N,M)}return!1}}function VB({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:mB,areArraysEqual:n?Dl:gB,areDataViewsEqual:yB,areDatesEqual:xB,areErrorsEqual:vB,areFunctionsEqual:wB,areMapsEqual:n?Op(S1,Dl):S1,areNumbersEqual:bB,areObjectsEqual:n?Dl:kB,arePrimitiveWrappersEqual:SB,areRegExpsEqual:CB,areSetsEqual:n?Op(C1,Dl):C1,areTypedArraysEqual:n?Op(Vu,Dl):Vu,areUrlsEqual:NB,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const o=Zc(r.areArraysEqual),s=Zc(r.areMapsEqual),l=Zc(r.areObjectsEqual),c=Zc(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:o,areMapsEqual:s,areObjectsEqual:l,areSetsEqual:c})}return r}function HB(t){return function(e,n,r,o,s,l,c){return t(e,n,c)}}function WB({circular:t,comparator:e,createState:n,equals:r,strict:o}){if(n)return function(c,u){const{cache:h=t?new WeakMap:void 0,meta:p}=n();return e(c,u,{cache:h,equals:r,meta:p,strict:o})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:r,meta:void 0,strict:o})};const s={cache:void 0,equals:r,meta:void 0,strict:o};return function(c,u){return e(c,u,s)}}const UB=Zo();Zo({strict:!0});Zo({circular:!0});Zo({circular:!0,strict:!0});Zo({createInternalComparator:()=>Ws});Zo({strict:!0,createInternalComparator:()=>Ws});Zo({circular:!0,createInternalComparator:()=>Ws});Zo({circular:!0,createInternalComparator:()=>Ws,strict:!0});function Zo(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:o=!1}=t,s=VB(t),l=BB(s),c=n?n(l):HB(l);return WB({circular:e,comparator:l,createState:r,equals:c,strict:o})}var Ip={exports:{}},Dp={};/**
544
+ * @license React
545
+ * use-sync-external-store-shim/with-selector.production.js
546
+ *
547
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
548
+ *
549
+ * This source code is licensed under the MIT license found in the
550
+ * LICENSE file in the root directory of this source tree.
551
+ */var N1;function KB(){if(N1)return Dp;N1=1;var t=ga(),e=XS();function n(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var r=typeof Object.is=="function"?Object.is:n,o=e.useSyncExternalStore,s=t.useRef,l=t.useEffect,c=t.useMemo,u=t.useDebugValue;return Dp.useSyncExternalStoreWithSelector=function(h,p,m,y,x){var b=s(null);if(b.current===null){var k={hasValue:!1,value:null};b.current=k}else k=b.current;b=c(function(){function N(L){if(!M){if(M=!0,T=L,L=y(L),x!==void 0&&k.hasValue){var I=k.value;if(x(I,L))return j=I}return j=L}if(I=j,r(T,L))return I;var _=y(L);return x!==void 0&&x(I,_)?(T=L,I):(T=L,j=_)}var M=!1,T,j,P=m===void 0?null:m;return[function(){return N(p())},P===null?void 0:function(){return N(P())}]},[p,m,y,x]);var C=o(h,b[0],b[1]);return l(function(){k.hasValue=!0,k.value=C},[C]),u(C),C},Dp}var E1;function qB(){return E1||(E1=1,Ip.exports=KB()),Ip.exports}var GB=qB(),JB=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},YB=({contentComponent:t})=>{const e=bg.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return f.jsx(f.Fragment,{children:Object.values(e)})};function QB(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:Ob.createPortal(r.reactElement,r.element,n)},t.forEach(o=>o())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(o=>o())}}}var XB=class extends Yt.Component{constructor(t){super(t),this.editorContentRef=Yt.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=QB(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var t;const e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return f.jsxs(f.Fragment,{children:[f.jsx("div",{ref:JB(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&f.jsx(YB,{contentComponent:t.contentComponent})]})}},ZB=w.forwardRef((t,e)=>{const n=Yt.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Yt.createElement(XB,{key:n,innerRef:e,...t})}),IM=Yt.memo(ZB),e6=typeof window<"u"?w.useLayoutEffect:w.useEffect,t6=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function n6(t){var e;const[n]=w.useState(()=>new t6(t.editor)),r=GB.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:UB);return e6(()=>n.watch(t.editor),[t.editor,n]),w.useDebugValue(r),r}var DM=typeof window>"u",r6=DM||!!(typeof window<"u"&&window.next),o6=class _M{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){var e;let n=(e=this.options.current.immediatelyRender)!=null?e:!0;return n&&(DM||r6)&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var o,s;return(s=(o=this.options.current).onBeforeCreate)==null?void 0:s.call(o,...r)},onBlur:(...r)=>{var o,s;return(s=(o=this.options.current).onBlur)==null?void 0:s.call(o,...r)},onCreate:(...r)=>{var o,s;return(s=(o=this.options.current).onCreate)==null?void 0:s.call(o,...r)},onDestroy:(...r)=>{var o,s;return(s=(o=this.options.current).onDestroy)==null?void 0:s.call(o,...r)},onFocus:(...r)=>{var o,s;return(s=(o=this.options.current).onFocus)==null?void 0:s.call(o,...r)},onSelectionUpdate:(...r)=>{var o,s;return(s=(o=this.options.current).onSelectionUpdate)==null?void 0:s.call(o,...r)},onTransaction:(...r)=>{var o,s;return(s=(o=this.options.current).onTransaction)==null?void 0:s.call(o,...r)},onUpdate:(...r)=>{var o,s;return(s=(o=this.options.current).onUpdate)==null?void 0:s.call(o,...r)},onContentError:(...r)=>{var o,s;return(s=(o=this.options.current).onContentError)==null?void 0:s.call(o,...r)},onDrop:(...r)=>{var o,s;return(s=(o=this.options.current).onDrop)==null?void 0:s.call(o,...r)},onPaste:(...r)=>{var o,s;return(s=(o=this.options.current).onPaste)==null?void 0:s.call(o,...r)},onDelete:(...r)=>{var o,s;return(s=(o=this.options.current).onDelete)==null?void 0:s.call(o,...r)}};return new QF(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((o,s)=>{var l;return o===((l=n.extensions)==null?void 0:l[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?_M.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,o)=>r===e[o]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function s6(t={},e=[]){const n=w.useRef(t);n.current=t;const[r]=w.useState(()=>new o6(n)),o=bg.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return w.useDebugValue(o),w.useEffect(r.onRender(e)),n6({editor:o,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),o}var LM=w.createContext({editor:null});LM.Consumer;var i6=w.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),l6=()=>w.useContext(i6);Yt.forwardRef((t,e)=>{const{onDragStart:n}=l6(),r=t.as||"div";return f.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Yt.createContext({markViewContentRef:()=>{}});var fy=w.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});fy.displayName="TiptapContext";var a6=()=>w.useContext(fy);function zM({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const o=w.useMemo(()=>({editor:r}),[r]),s=w.useMemo(()=>({editor:r}),[r]);return f.jsx(LM.Provider,{value:s,children:f.jsx(fy.Provider,{value:o,children:n})})}zM.displayName="Tiptap";function $M({...t}){const{editor:e}=a6();return f.jsx(IM,{editor:e,...t})}$M.displayName="Tiptap.Content";Object.assign(zM,{Content:$M});var Hu=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},c6=/^\s*>\s$/,u6=Rn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Hu("blockquote",{...St(this.options.HTMLAttributes,t),children:Hu("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((o,s)=>{var l,c;const p=((c=(l=e.renderChild)==null?void 0:l.call(e,o,s))!=null?c:e.renderChildren([o])).split(`
552
+ `).map(m=>m.trim()===""?n:`${n} ${m}`);r.push(p.join(`
553
+ `))}),r.join(`
554
+ ${n}
555
+ `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Bi({find:c6,type:this.type})]}}),d6=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,f6=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,h6=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,p6=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,m6=Hs.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 Hu("strong",{...St(this.options.HTMLAttributes,t),children:Hu("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[Fi({find:d6,type:this.type}),Fi({find:h6,type:this.type})]},addPasteRules(){return[zs({find:f6,type:this.type}),zs({find:p6,type:this.type})]}}),g6=/(^|[^`])`([^`]+)`(?!`)$/,y6=/(^|[^`])`([^`]+)`(?!`)/g,x6=Hs.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",St(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",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[Fi({find:g6,type:this.type})]},addPasteRules(){return[zs({find:y6,type:this.type})]}}),_p=4,v6=/^```([a-z]+)?[\s\n]$/,w6=/^~~~([a-z]+)?[\s\n]$/,b6=Rn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:_p,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const s=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(l=>l.startsWith(n)).map(l=>l.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",St(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?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?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="";const o=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${o}`,e.renderChildren(t.content),"```"].join(`
556
+ `):r=`\`\`\`${o}
557
+
558
+ \`\`\``,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:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:_p,{state:r}=t,{selection:o}=r,{$from:s,empty:l}=o;if(s.parent.type!==this.type)return!1;const c=" ".repeat(n);return l?t.commands.insertContent(c):t.commands.command(({tr:u})=>{const{from:h,to:p}=o,x=r.doc.textBetween(h,p,`
559
+ `,`
560
+ `).split(`
561
+ `).map(b=>c+b).join(`
562
+ `);return u.replaceWith(h,p,r.schema.text(x)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:_p,{state:r}=t,{selection:o}=r,{$from:s,empty:l}=o;return s.parent.type!==this.type?!1:l?t.commands.command(({tr:c})=>{var u;const{pos:h}=s,p=s.start(),m=s.end(),x=r.doc.textBetween(p,m,`
563
+ `,`
564
+ `).split(`
565
+ `);let b=0,k=0;const C=h-p;for(let L=0;L<x.length;L+=1){if(k+x[L].length>=C){b=L;break}k+=x[L].length+1}const M=((u=x[b].match(/^ */))==null?void 0:u[0])||"",T=Math.min(M.length,n);if(T===0)return!0;let j=p;for(let L=0;L<b;L+=1)j+=x[L].length+1;return c.delete(j,j+T),h-j<=T&&c.setSelection(Ie.create(c.doc,j)),!0}):t.commands.command(({tr:c})=>{const{from:u,to:h}=o,y=r.doc.textBetween(u,h,`
566
+ `,`
567
+ `).split(`
568
+ `).map(x=>{var b;const k=((b=x.match(/^ */))==null?void 0:b[0])||"",C=Math.min(k.length,n);return x.slice(C)}).join(`
569
+ `);return c.replaceWith(u,h,r.schema.text(y)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,l=r.parent.textContent.endsWith(`
570
+
571
+ `);return!s||!l?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:o,empty:s}=n;if(!s||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const c=o.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:h})=>(h.setSelection(Le.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[Pm({find:v6,type:this.type,getAttributes:t=>({language:t[1]})}),Pm({find:w6,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ze({key:new ht("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,s=o==null?void 0:o.mode;if(!n||!s)return!1;const{tr:l,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,`
572
+ `));return l.replaceSelectionWith(this.type.create({language:s},u)),l.selection.$from.parent.type!==this.type&&l.setSelection(Ie.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),t.dispatch(l),!0}}})]}}),k6=Rn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
573
+
574
+ `):""}),S6=Rn.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",St(this.options.HTMLAttributes,t)]},renderText(){return`
575
+ `},renderMarkdown:()=>`
576
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:s}=n;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:c}=r.extensionManager,u=s||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:h,dispatch:p})=>{if(p&&u&&l){const m=u.filter(y=>c.includes(y.type.name));h.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),C6=Rn.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]}`,St(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&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=>Pm({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),N6=Rn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",St(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!ZF(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,o=t();return mM(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:s,tr:l,dispatch:c})=>{if(c){const{$to:u}=l.selection,h=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?l.setSelection(Ie.create(l.doc,u.pos+1)):u.nodeAfter.isBlock?l.setSelection(Te.create(l.doc,u.pos)):l.setSelection(Ie.create(l.doc,u.pos));else{const p=s.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=p==null?void 0:p.create();m&&(l.insert(h,m),l.setSelection(Ie.create(l.doc,h+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[XF({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),E6=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,M6=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,T6=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,j6=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,A6=Hs.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",St(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[Fi({find:E6,type:this.type}),Fi({find:T6,type:this.type})]},addPasteRules(){return[zs({find:M6,type:this.type}),zs({find:j6,type:this.type})]}});const R6="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",P6="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Im="numeric",Dm="ascii",_m="alpha",Yl="asciinumeric",Wl="alphanumeric",Lm="domain",FM="emoji",O6="scheme",I6="slashscheme",Lp="whitespace";function D6(t,e){return t in e||(e[t]=[]),e[t]}function Ss(t,e,n){e[Im]&&(e[Yl]=!0,e[Wl]=!0),e[Dm]&&(e[Yl]=!0,e[_m]=!0),e[Yl]&&(e[Wl]=!0),e[_m]&&(e[Wl]=!0),e[Wl]&&(e[Lm]=!0),e[FM]&&(e[Lm]=!0);for(const r in e){const o=D6(r,n);o.indexOf(t)<0&&o.push(t)}}function _6(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function mn(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}mn.groups={};mn.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const o=e.jr[r][0],s=e.jr[r][1];if(s&&o.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){r=r||mn.groups;let o;return e&&e.j?o=e:(o=new mn(e),n&&r&&Ss(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const s=t.length;if(!s)return o;for(let l=0;l<s-1;l++)o=o.tt(t[l]);return o.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||mn.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const s=e;let l,c=o.go(t);if(c?(l=new mn,Object.assign(l.j,c.j),l.jr.push.apply(l.jr,c.jr),l.jd=c.jd,l.t=c.t):l=new mn,s){if(r)if(l.t&&typeof l.t=="string"){const u=Object.assign(_6(l.t,r),n);Ss(s,u,r)}else n&&Ss(s,n,r);l.t=s}return o.j[t]=l,l}};const ze=(t,e,n,r,o)=>t.ta(e,n,r,o),dt=(t,e,n,r,o)=>t.tr(e,n,r,o),M1=(t,e,n,r,o)=>t.ts(e,n,r,o),Z=(t,e,n,r,o)=>t.tt(e,n,r,o),Hr="WORD",zm="UWORD",BM="ASCIINUMERICAL",VM="ALPHANUMERICAL",pa="LOCALHOST",$m="TLD",Fm="UTLD",hu="SCHEME",Si="SLASH_SCHEME",hy="NUM",Bm="WS",py="NL",Ql="OPENBRACE",Xl="CLOSEBRACE",Wu="OPENBRACKET",Uu="CLOSEBRACKET",Ku="OPENPAREN",qu="CLOSEPAREN",Gu="OPENANGLEBRACKET",Ju="CLOSEANGLEBRACKET",Yu="FULLWIDTHLEFTPAREN",Qu="FULLWIDTHRIGHTPAREN",Xu="LEFTCORNERBRACKET",Zu="RIGHTCORNERBRACKET",ed="LEFTWHITECORNERBRACKET",td="RIGHTWHITECORNERBRACKET",nd="FULLWIDTHLESSTHAN",rd="FULLWIDTHGREATERTHAN",od="AMPERSAND",sd="APOSTROPHE",id="ASTERISK",No="AT",ld="BACKSLASH",ad="BACKTICK",cd="CARET",Cs="COLON",my="COMMA",ud="DOLLAR",xr="DOT",dd="EQUALS",gy="EXCLAMATION",Fn="HYPHEN",Zl="PERCENT",fd="PIPE",hd="PLUS",pd="POUND",ea="QUERY",yy="QUOTE",HM="FULLWIDTHMIDDLEDOT",xy="SEMI",vr="SLASH",ta="TILDE",md="UNDERSCORE",WM="EMOJI",gd="SYM";var UM=Object.freeze({__proto__:null,ALPHANUMERICAL:VM,AMPERSAND:od,APOSTROPHE:sd,ASCIINUMERICAL:BM,ASTERISK:id,AT:No,BACKSLASH:ld,BACKTICK:ad,CARET:cd,CLOSEANGLEBRACKET:Ju,CLOSEBRACE:Xl,CLOSEBRACKET:Uu,CLOSEPAREN:qu,COLON:Cs,COMMA:my,DOLLAR:ud,DOT:xr,EMOJI:WM,EQUALS:dd,EXCLAMATION:gy,FULLWIDTHGREATERTHAN:rd,FULLWIDTHLEFTPAREN:Yu,FULLWIDTHLESSTHAN:nd,FULLWIDTHMIDDLEDOT:HM,FULLWIDTHRIGHTPAREN:Qu,HYPHEN:Fn,LEFTCORNERBRACKET:Xu,LEFTWHITECORNERBRACKET:ed,LOCALHOST:pa,NL:py,NUM:hy,OPENANGLEBRACKET:Gu,OPENBRACE:Ql,OPENBRACKET:Wu,OPENPAREN:Ku,PERCENT:Zl,PIPE:fd,PLUS:hd,POUND:pd,QUERY:ea,QUOTE:yy,RIGHTCORNERBRACKET:Zu,RIGHTWHITECORNERBRACKET:td,SCHEME:hu,SEMI:xy,SLASH:vr,SLASH_SCHEME:Si,SYM:gd,TILDE:ta,TLD:$m,UNDERSCORE:md,UTLD:Fm,UWORD:zm,WORD:Hr,WS:Bm});const Fr=/[a-z]/,_l=new RegExp("\\p{L}","u"),zp=new RegExp("\\p{Emoji}","u"),Br=/\d/,$p=/\s/,T1="\r",Fp=`
577
+ `,L6="️",z6="‍",Bp="";let eu=null,tu=null;function $6(t=[]){const e={};mn.groups=e;const n=new mn;eu==null&&(eu=j1(R6)),tu==null&&(tu=j1(P6)),Z(n,"'",sd),Z(n,"{",Ql),Z(n,"}",Xl),Z(n,"[",Wu),Z(n,"]",Uu),Z(n,"(",Ku),Z(n,")",qu),Z(n,"<",Gu),Z(n,">",Ju),Z(n,"(",Yu),Z(n,")",Qu),Z(n,"「",Xu),Z(n,"」",Zu),Z(n,"『",ed),Z(n,"』",td),Z(n,"<",nd),Z(n,">",rd),Z(n,"&",od),Z(n,"*",id),Z(n,"@",No),Z(n,"`",ad),Z(n,"^",cd),Z(n,":",Cs),Z(n,",",my),Z(n,"$",ud),Z(n,".",xr),Z(n,"=",dd),Z(n,"!",gy),Z(n,"-",Fn),Z(n,"%",Zl),Z(n,"|",fd),Z(n,"+",hd),Z(n,"#",pd),Z(n,"?",ea),Z(n,'"',yy),Z(n,"/",vr),Z(n,";",xy),Z(n,"~",ta),Z(n,"_",md),Z(n,"\\",ld),Z(n,"・",HM);const r=dt(n,Br,hy,{[Im]:!0});dt(r,Br,r);const o=dt(r,Fr,BM,{[Yl]:!0}),s=dt(r,_l,VM,{[Wl]:!0}),l=dt(n,Fr,Hr,{[Dm]:!0});dt(l,Br,o),dt(l,Fr,l),dt(o,Br,o),dt(o,Fr,o);const c=dt(n,_l,zm,{[_m]:!0});dt(c,Fr),dt(c,Br,s),dt(c,_l,c),dt(s,Br,s),dt(s,Fr),dt(s,_l,s);const u=Z(n,Fp,py,{[Lp]:!0}),h=Z(n,T1,Bm,{[Lp]:!0}),p=dt(n,$p,Bm,{[Lp]:!0});Z(n,Bp,p),Z(h,Fp,u),Z(h,Bp,p),dt(h,$p,p),Z(p,T1),Z(p,Fp),dt(p,$p,p),Z(p,Bp,p);const m=dt(n,zp,WM,{[FM]:!0});Z(m,"#"),dt(m,zp,m),Z(m,L6,m);const y=Z(m,z6);Z(y,"#"),dt(y,zp,m);const x=[[Fr,l],[Br,o]],b=[[Fr,null],[_l,c],[Br,s]];for(let k=0;k<eu.length;k++)bo(n,eu[k],$m,Hr,x);for(let k=0;k<tu.length;k++)bo(n,tu[k],Fm,zm,b);Ss($m,{tld:!0,ascii:!0},e),Ss(Fm,{utld:!0,alpha:!0},e),bo(n,"file",hu,Hr,x),bo(n,"mailto",hu,Hr,x),bo(n,"http",Si,Hr,x),bo(n,"https",Si,Hr,x),bo(n,"ftp",Si,Hr,x),bo(n,"ftps",Si,Hr,x),Ss(hu,{scheme:!0,ascii:!0},e),Ss(Si,{slashscheme:!0,ascii:!0},e),t=t.sort((k,C)=>k[0]>C[0]?1:-1);for(let k=0;k<t.length;k++){const C=t[k][0],M=t[k][1]?{[O6]:!0}:{[I6]:!0};C.indexOf("-")>=0?M[Lm]=!0:Fr.test(C)?Br.test(C)?M[Yl]=!0:M[Dm]=!0:M[Im]=!0,M1(n,C,C,M)}return M1(n,"localhost",pa,{ascii:!0}),n.jd=new mn(gd),{start:n,tokens:Object.assign({groups:e},UM)}}function KM(t,e){const n=F6(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,o=[];let s=0,l=0;for(;l<r;){let c=t,u=null,h=0,p=null,m=-1,y=-1;for(;l<r&&(u=c.go(n[l]));)c=u,c.accepts()?(m=0,y=0,p=c):m>=0&&(m+=n[l].length,y++),h+=n[l].length,s+=n[l].length,l++;s-=m,l-=y,h-=m,o.push({t:p.t,v:e.slice(s-h,s),s:s-h,e:s})}return o}function F6(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),s,l=o<55296||o>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(l),r+=l.length}return e}function bo(t,e,n,r,o){let s;const l=e.length;for(let c=0;c<l-1;c++){const u=e[c];t.j[u]?s=t.j[u]:(s=new mn(r),s.jr=o.slice(),t.j[u]=s),t=s}return s=new mn(n),s.jr=o.slice(),t.j[e[l-1]]=s,s}function j1(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let s=0;for(;o.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let l=parseInt(t.substring(r,r+s),10);l>0;l--)n.pop();r+=s}else n.push(t[r]),r++}return e}const ma={defaultProtocol:"http",events:null,format:A1,formatHref:A1,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function vy(t,e=null){let n=Object.assign({},ma);t&&(n=Object.assign(n,t instanceof vy?t.o:t));const r=n.ignoreTags,o=[];for(let s=0;s<r.length;s++)o.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}vy.prototype={o:ma,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:ma[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){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function A1(t){return t}function qM(t,e){this.t="token",this.v=t,this.tk=e}qM.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=ma.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),s=this.toFormattedString(t),l={},c=t.get("className",n,e),u=t.get("target",n,e),h=t.get("rel",n,e),p=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return l.href=r,c&&(l.class=c),u&&(l.target=u),h&&(l.rel=h),p&&Object.assign(l,p),{tagName:o,attributes:l,content:s,eventListeners:m}}};function nf(t,e){class n extends qM{constructor(o,s){super(o,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const B6=nf("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),R1=nf("text"),V6=nf("nl"),nu=nf("url",{isLink:!0,toHref(t=ma.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==pa&&t[1].t===Cs}}),$n=t=>new mn(t);function H6({groups:t}){const e=t.domain.concat([od,id,No,ld,ad,cd,ud,dd,Fn,hy,Zl,fd,hd,pd,vr,gd,ta,md]),n=[sd,Cs,my,xr,gy,Zl,ea,yy,xy,Gu,Ju,Ql,Xl,Uu,Wu,Ku,qu,Yu,Qu,Xu,Zu,ed,td,nd,rd],r=[od,sd,id,ld,ad,cd,ud,dd,Fn,Ql,Xl,Zl,fd,hd,pd,ea,vr,gd,ta,md],o=$n(),s=Z(o,ta);ze(s,r,s),ze(s,t.domain,s);const l=$n(),c=$n(),u=$n();ze(o,t.domain,l),ze(o,t.scheme,c),ze(o,t.slashscheme,u),ze(l,r,s),ze(l,t.domain,l);const h=Z(l,No);Z(s,No,h),Z(c,No,h),Z(u,No,h);const p=Z(s,xr);ze(p,r,s),ze(p,t.domain,s);const m=$n();ze(h,t.domain,m),ze(m,t.domain,m);const y=Z(m,xr);ze(y,t.domain,m);const x=$n(B6);ze(y,t.tld,x),ze(y,t.utld,x),Z(h,pa,x);const b=Z(m,Fn);Z(b,Fn,b),ze(b,t.domain,m),ze(x,t.domain,m),Z(x,xr,y),Z(x,Fn,b);const k=Z(l,Fn),C=Z(l,xr);Z(k,Fn,k),ze(k,t.domain,l),ze(C,r,s),ze(C,t.domain,l);const N=$n(nu);ze(C,t.tld,N),ze(C,t.utld,N),ze(N,t.domain,l),ze(N,r,s),Z(N,xr,C),Z(N,Fn,k),Z(N,No,h);const M=Z(N,Cs),T=$n(nu);ze(M,t.numeric,T);const j=$n(nu),P=$n();ze(j,e,j),ze(j,n,P),ze(P,e,j),ze(P,n,P),Z(N,vr,j),Z(T,vr,j);const L=Z(c,Cs),I=Z(u,Cs),_=Z(I,vr),$=Z(_,vr);ze(c,t.domain,l),Z(c,xr,C),Z(c,Fn,k),ze(u,t.domain,l),Z(u,xr,C),Z(u,Fn,k),ze(L,t.domain,j),Z(L,vr,j),Z(L,ea,j),ze($,t.domain,j),ze($,e,j),Z($,vr,j);const q=[[Ql,Xl],[Wu,Uu],[Ku,qu],[Gu,Ju],[Yu,Qu],[Xu,Zu],[ed,td],[nd,rd]];for(let X=0;X<q.length;X++){const[ee,K]=q[X],ie=Z(j,ee);Z(P,ee,ie);const ne=$n(nu);ze(ie,e,ne);const re=$n();ze(ie,n,re),Z(ie,K,j),ze(ne,e,ne),ze(ne,n,re),ze(re,e,ne),ze(re,n,re),Z(ne,K,j),Z(re,K,j)}return Z(o,pa,N),Z(o,py,V6),{start:o,tokens:UM}}function W6(t,e,n){let r=n.length,o=0,s=[],l=[];for(;o<r;){let c=t,u=null,h=null,p=0,m=null,y=-1;for(;o<r&&!(u=c.go(n[o].t));)l.push(n[o++]);for(;o<r&&(h=u||c.go(n[o].t));)u=null,c=h,c.accepts()?(y=0,m=c):y>=0&&y++,o++,p++;if(y<0)o-=p,o<r&&(l.push(n[o]),o++);else{l.length>0&&(s.push(Vp(R1,e,l)),l=[]),o-=y,p-=y;const x=m.t,b=n.slice(o-p,o);s.push(Vp(x,e,b))}}return l.length>0&&s.push(Vp(R1,e,l)),s}function Vp(t,e,n){const r=n[0].s,o=n[n.length-1].e,s=e.slice(r,o);return new t(s,n)}const U6=typeof console<"u"&&console&&console.warn||(()=>{}),K6="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",nt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function q6(){return mn.groups={},nt.scanner=null,nt.parser=null,nt.tokenQueue=[],nt.pluginQueue=[],nt.customSchemes=[],nt.initialized=!1,nt}function P1(t,e=!1){if(nt.initialized&&U6(`linkifyjs: already initialized - will not register custom scheme "${t}" ${K6}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
578
+ 1. Must only contain digits, lowercase ASCII letters or "-"
579
+ 2. Cannot start or end with "-"
580
+ 3. "-" cannot repeat`);nt.customSchemes.push([t,e])}function G6(){nt.scanner=$6(nt.customSchemes);for(let t=0;t<nt.tokenQueue.length;t++)nt.tokenQueue[t][1]({scanner:nt.scanner});nt.parser=H6(nt.scanner.tokens);for(let t=0;t<nt.pluginQueue.length;t++)nt.pluginQueue[t][1]({scanner:nt.scanner,parser:nt.parser});return nt.initialized=!0,nt}function wy(t){return nt.initialized||G6(),W6(nt.parser.start,t,KM(nt.scanner.start,t))}wy.scan=KM;function GM(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new vy(n),o=wy(t),s=[];for(let l=0;l<o.length;l++){const c=o[l];c.isLink&&(!e||c.t===e)&&r.check(c)&&s.push(c.toFormattedObject(r))}return s}var by="[\0-   ᠎ -\u2029  ]",J6=new RegExp(by),Y6=new RegExp(`${by}$`),Q6=new RegExp(by,"g");function X6(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Z6(t){return new Ze({key:new ht("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(h=>h.docChanged)&&!n.doc.eq(r.doc),s=e.some(h=>h.getMeta("preventAutolink"));if(!o||s)return;const{tr:l}=r,c=lM(n.doc,[...e]);if(pM(c).forEach(({newRange:h})=>{const p=Q$(r.doc,h,x=>x.isTextblock);let m,y;if(p.length>1)m=p[0],y=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(p.length){const x=r.doc.textBetween(h.from,h.to," "," ");if(!Y6.test(x))return;m=p[0],y=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&y){const x=y.split(J6).filter(Boolean);if(x.length<=0)return!1;const b=x[x.length-1],k=m.pos+y.lastIndexOf(b);if(!b)return!1;const C=wy(b).map(N=>N.toObject(t.defaultProtocol));if(!X6(C))return!1;C.filter(N=>N.isLink).map(N=>({...N,from:k+N.start+1,to:k+N.end+1})).filter(N=>r.schema.marks.code?!r.doc.rangeHasMark(N.from,N.to,r.schema.marks.code):!0).filter(N=>t.validate(N.value)).filter(N=>t.shouldAutoLink(N.value)).forEach(N=>{ly(N.from,N.to,r.doc).some(M=>M.mark.type===t.type)||l.addMark(N.from,N.to,t.type.create({href:N.href}))})}}),!!l.steps.length)return l}})}function eV(t){return new Ze({key:new ht("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,s;if(r.button!==0||!e.editable)return!1;let l=null;if(r.target instanceof HTMLAnchorElement)l=r.target;else{const u=r.target;if(!u)return!1;const h=t.editor.view.dom;l=u.closest("a"),l&&!h.contains(l)&&(l=null)}if(!l)return!1;let c=!1;if(t.enableClickSelection&&(c=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=hM(e.state,t.type.name),h=(o=l.href)!=null?o:u.href,p=(s=l.target)!=null?s:u.target;h&&(window.open(h,p),c=!0)}return c}}})}function tV(t){return new Ze({key:new ht("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:o}=t,{state:s}=e,{selection:l}=s,{empty:c}=l;if(c)return!1;let u="";r.content.forEach(p=>{u+=p.textContent});const h=GM(u,{defaultProtocol:t.defaultProtocol}).find(p=>p.isLink&&p.value===u);return!u||!h||o!==void 0&&!o(h.value)?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function gs(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(Q6,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var JM=Hs.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"){P1(t);return}P1(t.scheme,t.optionalSlashes)})},onDestroy(){q6()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!gs(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const 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;const o=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(o)||!/\./.test(o))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!gs(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=>!!gs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",St(this.options.HTMLAttributes,t),0]:["a",St(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,s;const l=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",c=(s=(o=t.attrs)==null?void 0:o.title)!=null?s:"",u=e.renderChildren(t);return c?`[${u}](${l} "${c}")`:`[${u}](${l})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!gs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!gs(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()}},addPasteRules(){return[zs({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=GM(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!gs(l,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Z6({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!gs(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(eV({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(tV({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),nV=JM,rV=Object.defineProperty,oV=(t,e)=>{for(var n in e)rV(t,n,{get:e[n],enumerable:!0})},sV="listItem",O1="textStyle",I1=/^\s*([-+*])\s$/,YM=Rn.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",St(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,`
581
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(sV,this.editor.getAttributes(O1)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Bi({find:I1,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Bi({find:I1,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(O1),editor:this.editor})),[t]}});function iV(t){var e,n;const r=(e=t.tokens)==null?void 0:e[0];return!!(t.text&&((n=t.tokens)==null?void 0:n.length)===1&&(r==null?void 0:r.type)==="list"&&r.ordered&&r.raw===t.text)}function lV(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var QM=Rn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",St(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;let o=[];if(t.tokens&&t.tokens.length>0){if(iV(t))return{type:"listItem",content:[{type:"paragraph",content:lV(t.text||"",e)}]};if(t.tokens.some(l=>l.type==="paragraph"))o=r(t.tokens);else{const l=t.tokens[0];if(l&&l.type==="text"&&l.tokens&&l.tokens.length>0){if(o=[{type:"paragraph",content:e.parseInline(l.tokens)}],t.tokens.length>1){const u=t.tokens.slice(1),h=r(u);o.push(...h)}}else o=r(t.tokens)}}return o.length===0&&(o=[{type:"paragraph",content:[]}]),{type:"listItem",content:o}},renderMarkdown:(t,e,n)=>dy(t,e,r=>{var o,s;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((s=(o=r.meta)==null?void 0:o.parentAttrs)==null?void 0:s.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),aV={};oV(aV,{findListItemPos:()=>Ma,getNextListDepth:()=>ky,handleBackspace:()=>Vm,handleDelete:()=>Hm,hasListBefore:()=>XM,hasListItemAfter:()=>cV,hasListItemBefore:()=>ZM,listItemHasSubList:()=>eT,nextListIsDeeper:()=>tT,nextListIsHigher:()=>nT});var Ma=(t,e)=>{const{$from:n}=e.selection,r=kt(t,e.schema);let o=null,s=n.depth,l=n.pos,c=null;for(;s>0&&c===null;)o=n.node(s),o.type===r?c=s:(s-=1,l-=1);return c===null?null:{$pos:e.doc.resolve(l),depth:c}},ky=(t,e)=>{const n=Ma(t,e);if(!n)return!1;const[,r]=aF(e,t,n.$pos.pos+4);return r},XM=(t,e,n)=>{const{$anchor:r}=t.selection,o=Math.max(0,r.pos-2),s=t.doc.resolve(o).node();return!(!s||!n.includes(s.type.name))},ZM=(t,e)=>{var n;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-2);return!(o.index()===0||((n=o.nodeBefore)==null?void 0:n.type.name)!==t)},eT=(t,e,n)=>{if(!n)return!1;const r=kt(t,e.schema);let o=!1;return n.descendants(s=>{s.type===r&&(o=!0)}),o},Vm=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Ko(t.state,e)&&XM(t.state,e,n)){const{$anchor:c}=t.state.selection,u=t.state.doc.resolve(c.before()-1),h=[];u.node().descendants((y,x)=>{y.type.name===e&&h.push({node:y,pos:x})});const p=h.at(-1);if(!p)return!1;const m=t.state.doc.resolve(u.start()+p.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},m.end()).joinForward().run()}if(!Ko(t.state,e)||!fF(t.state))return!1;const r=Ma(e,t.state);if(!r)return!1;const s=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),l=eT(e,t.state,s);return ZM(e,t.state)&&!l?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},tT=(t,e)=>{const n=ky(t,e),r=Ma(t,e);return!r||!n?!1:n>r.depth},nT=(t,e)=>{const n=ky(t,e),r=Ma(t,e);return!r||!n?!1:n<r.depth},Hm=(t,e)=>{if(!Ko(t.state,e)||!dF(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:o}=n;return!n.empty&&r.sameParent(o)?!1:tT(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():nT(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},cV=(t,e)=>{var n;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-r.parentOffset-2);return!(o.index()===o.parent.childCount-1||((n=o.nodeAfter)==null?void 0:n.type.name)!==t)},rT=it.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&&Hm(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&&Hm(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&&Vm(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&&Vm(t,n,r)&&(e=!0)}),e}}}}),D1=/^(\s*)(\d+)\.\s+(.*)$/,uV=/^\s/;function dV(t){const e=t.trimStart();return/^[-+*]\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}function fV(t){const e=[],n=[];let 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&&dV(o)){r=!0,n.push(o);return}e.push(o)}),{paragraphLines:e,blockLines:n}}function hV(t){const e=[];let n=0,r=0;for(;n<t.length;){const o=t[n],s=o.match(D1);if(!s)break;const[,l,c,u]=s,h=l.length,p=[u];let m=n+1;const y=[o];let x=!1;for(;m<t.length;){const b=t[m];if(b.match(D1))break;if(b.trim()==="")y.push(b),p.push(""),x=!0,m+=1;else if(b.match(uV))y.push(b),p.push(b.slice(h+2)),m+=1;else{if(x)break;y.push(b),p.push(b),m+=1}}e.push({indent:h,number:parseInt(c,10),content:p.join(`
582
+ `).trim(),contentLines:p,raw:y.join(`
583
+ `)}),r=m,n=m}return[e,r]}function oT(t,e,n){const r=[];let o=0;for(;o<t.length;){const s=t[o];if(s.indent===e){const{paragraphLines:l,blockLines:c}=fV(s.contentLines),u=l.join(`
584
+ `).trim(),h=[];u&&h.push({type:"paragraph",raw:u,tokens:n.inlineTokens(u)});const p=c.join(`
585
+ `).trim();if(p){const x=n.blockTokens(p);h.push(...x)}let m=o+1;const y=[];for(;m<t.length&&t[m].indent>e;)y.push(t[m]),m+=1;if(y.length>0){const x=Math.min(...y.map(k=>k.indent)),b=oT(y,x,n);h.push({type:"list",ordered:!0,start:y[0].number,items:b,raw:y.map(k=>k.raw).join(`
586
+ `)})}r.push({type:"list_item",raw:s.raw,tokens:h}),o=m}else o+=1}return r}function pV(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(o=>{if(o.type==="paragraph"||o.type==="list"||o.type==="blockquote"||o.type==="code")r.push(...e.parseChildren([o]));else if(o.type==="text"&&o.tokens){const s=e.parseChildren([o]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([o]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var mV="listItem",_1="textStyle",L1=/^(\d+)\.\s$/,sT=Rn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",St(this.options.HTMLAttributes,n),0]:["ol",St(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?pV(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
587
+ `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const o=t.split(`
588
+ `),[s,l]=hV(o);if(s.length===0)return;const c=oT(s,0,n);return c.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:c,raw:o.slice(0,l).join(`
589
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(mV,this.editor.getAttributes(_1)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Bi({find:L1,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Bi({find:L1,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(_1)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),gV=/^\s*(\[([( |x])?\])\s$/,iT=Rn.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=>{const 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}]},renderHTML({node:t,HTMLAttributes:e}){return["li",St(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const 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){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const o=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return dy(t,e,o)},addKeyboardShortcuts(){const 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})=>{const o=document.createElement("li"),s=document.createElement("label"),l=document.createElement("span"),c=document.createElement("input"),u=document.createElement("div"),h=m=>{var y,x;c.ariaLabel=((x=(y=this.options.a11y)==null?void 0:y.checkboxLabel)==null?void 0:x.call(y,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};h(t),s.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:y}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:x})=>{const b=n();if(typeof b!="number")return!1;const k=x.doc.nodeAt(b);return x.setNodeMarkup(b,void 0,{...k==null?void 0:k.attrs,checked:y}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,y)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,y])=>{o.setAttribute(m,y)}),o.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,s.append(c,l),o.append(s,u),Object.entries(e).forEach(([m,y])=>{o.setAttribute(m,y)});let p=new Set(Object.keys(e));return{dom:o,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;o.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,h(m);const y=r.extensionManager.attributes,x=ha(m,y),b=new Set(Object.keys(x)),k=this.options.HTMLAttributes;return p.forEach(C=>{b.has(C)||(C in k?o.setAttribute(C,k[C]):o.removeAttribute(C))}),Object.entries(x).forEach(([C,N])=>{N==null?C in k?o.setAttribute(C,k[C]):o.removeAttribute(C):o.setAttribute(C,N)}),p=b,!0}}}},addInputRules(){return[Bi({find:gV,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),lT=Rn.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",St(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,`
590
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=s=>{const l=Om(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,u)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:n.inlineTokens(c.mainContent),nestedTokens:u}),customNestedParser:r},n);return l?[{type:"taskList",raw:l.raw,items:l.items}]:n.blockTokens(s)},o=Om(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,l)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:l}),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()}}});it.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(YM.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(QM.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(rT.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(sT.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(iT.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(lT.configure(this.options.taskList)),t}});var ru="&nbsp;",Hp=" ",yV=Rn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",St(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===ru||n[0].text===ru||n[0].raw===Hp||n[0].text===Hp)&&r.length===1&&r[0].type==="text"&&(r[0].text===ru||r[0].text===Hp)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,o;if(!t)return"";const s=Array.isArray(t.content)?t.content:[];if(s.length===0){const l=Array.isArray((r=n==null?void 0:n.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((o=n==null?void 0:n.previousNode)==null?void 0:o.type)==="paragraph"&&l.length===0?ru:""}return e.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),xV=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,vV=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,wV=Hs.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",St(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[Fi({find:xV,type:this.type})]},addPasteRules(){return[zs({find:vV,type:this.type})]}}),bV=Rn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),kV=Hs.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",St(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const o=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!o)return;const s=o[2].trim();return{type:"underline",raw:o[0],text:s,tokens:n.inlineTokens(s)}}},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 SV(t={}){return new Ze({view(e){return new CV(e,t)}})}class CV{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let s=l=>{this[o](l)};return e.dom.addEventListener(o,s),{name:o,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,o=this.editorView.dom,s=o.getBoundingClientRect(),l=s.width/o.offsetWidth,c=s.height/o.offsetHeight;if(n){let m=e.nodeBefore,y=e.nodeAfter;if(m||y){let x=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(x){let b=x.getBoundingClientRect(),k=m?b.bottom:b.top;m&&y&&(k=(k+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let C=this.width/2*c;r={left:b.left,right:b.right,top:k-C,bottom:k+C}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),y=this.width/2*l;r={left:m.left-y,right:m.left+y,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let h,p;if(!u||u==document.body&&getComputedStyle(u).position=="static")h=-pageXOffset,p=-pageYOffset;else{let m=u.getBoundingClientRect(),y=m.width/u.offsetWidth,x=m.height/u.offsetHeight;h=m.left-u.scrollLeft*y,p=m.top-u.scrollTop*x}this.element.style.left=(r.left-h)/l+"px",this.element.style.top=(r.top-p)/c+"px",this.element.style.width=(r.right-r.left)/l+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,s=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!s){let l=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=XN(this.editorView.state.doc,l,this.editorView.dragging.slice);c!=null&&(l=c)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ft extends Le{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ft.valid(r)?new ft(r):Le.near(r)}content(){return ue.empty}eq(e){return e instanceof ft&&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 ft(e.resolve(n.pos))}getBookmark(){return new Sy(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!NV(e)||!EV(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&&ft.valid(e))return e;let o=e.pos,s=null;for(let l=e.depth;;l--){let c=e.node(l);if(n>0?e.indexAfter(l)<c.childCount:e.index(l)>0){s=c.child(n>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;o+=n;let u=e.doc.resolve(o);if(ft.valid(u))return u}for(;;){let l=n>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!Te.isSelectable(s)){e=e.doc.resolve(o+s.nodeSize*n),r=!1;continue e}break}s=l,o+=n;let c=e.doc.resolve(o);if(ft.valid(c))return c}return null}}}ft.prototype.visible=!1;ft.findFrom=ft.findGapCursorFrom;Le.jsonID("gapcursor",ft);class Sy{constructor(e){this.pos=e}map(e){return new Sy(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ft.valid(n)?new ft(n):Le.near(n)}}function aT(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function NV(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||aT(o.type))return!0;if(o.inlineContent)return!1}}return!0}function EV(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||aT(o.type))return!0;if(o.inlineContent)return!1}}return!0}function MV(){return new Ze({props:{decorations:RV,createSelectionBetween(t,e,n){return e.pos==n.pos&&ft.valid(n)?new ft(n):null},handleClick:jV,handleKeyDown:TV,handleDOMEvents:{beforeinput:AV}}})}const TV=ZE({ArrowLeft:ou("horiz",-1),ArrowRight:ou("horiz",1),ArrowUp:ou("vert",-1),ArrowDown:ou("vert",1)});function ou(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,s){let l=r.selection,c=e>0?l.$to:l.$from,u=l.empty;if(l instanceof Ie){if(!s.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=ft.findGapCursorFrom(c,e,u);return h?(o&&o(r.tr.setSelection(new ft(h))),!0):!1}}function jV(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ft.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&Te.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ft(r))),!0)}function AV(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ft))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=Y.empty;for(let l=r.length-1;l>=0;l--)o=Y.from(r[l].createAndFill(null,o));let s=t.state.tr.replace(n.pos,n.pos,new ue(o,0,0));return s.setSelection(Ie.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function RV(t){if(!(t.selection instanceof ft))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Xe.create(t.doc,[wt.widget(t.selection.head,e,{key:"gapcursor"})])}var yd=200,Dt=function(){};Dt.prototype.append=function(e){return e.length?(e=Dt.from(e),!this.length&&e||e.length<yd&&this.leafAppend(e)||this.length<yd&&e.leafPrepend(this)||this.appendInner(e)):this};Dt.prototype.prepend=function(e){return e.length?Dt.from(e).append(this):this};Dt.prototype.appendInner=function(e){return new PV(this,e)};Dt.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Dt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Dt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Dt.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)};Dt.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(s,l){return o.push(e(s,l))},n,r),o};Dt.from=function(e){return e instanceof Dt?e:e&&e.length?new cT(e):Dt.empty};var cT=(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,s){return o==0&&s==this.length?this:new e(this.values.slice(o,s))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,s,l,c){for(var u=s;u<l;u++)if(o(this.values[u],c+u)===!1)return!1},e.prototype.forEachInvertedInner=function(o,s,l,c){for(var u=s-1;u>=l;u--)if(o(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=yd)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=yd)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})(Dt);Dt.empty=new cT([]);var PV=(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,s,l){var c=this.left.length;if(o<c&&this.left.forEachInner(r,o,Math.min(s,c),l)===!1||s>c&&this.right.forEachInner(r,Math.max(o-c,0),Math.min(this.length,s)-c,l+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,s,l){var c=this.left.length;if(o>c&&this.right.forEachInvertedInner(r,o-c,Math.max(s,c)-c,l+c)===!1||s<c&&this.left.forEachInvertedInner(r,Math.min(o,c),s,l)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var s=this.left.length;return o<=s?this.left.slice(r,o):r>=s?this.right.slice(r-s,o-s):this.left.slice(r,s).append(this.right.slice(0,o-s))},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})(Dt);const OV=500;class or{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,s;n&&(o=this.remapping(r,this.items.length),s=o.maps.length);let l=e.tr,c,u,h=[],p=[];return this.items.forEach((m,y)=>{if(!m.step){o||(o=this.remapping(r,y+1),s=o.maps.length),s--,p.push(m);return}if(o){p.push(new wr(m.map));let x=m.step.map(o.slice(s)),b;x&&l.maybeStep(x).doc&&(b=l.mapping.maps[l.mapping.maps.length-1],h.push(new wr(b,void 0,void 0,h.length+p.length))),s--,b&&o.appendMap(b,s)}else l.maybeStep(m.step);if(m.selection)return c=o?m.selection.map(o.slice(s)):m.selection,u=new or(this.items.slice(0,r).append(p.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:l,selection:c}}addTransform(e,n,r,o){let s=[],l=this.eventCount,c=this.items,u=!o&&c.length?c.get(c.length-1):null;for(let p=0;p<e.steps.length;p++){let m=e.steps[p].invert(e.docs[p]),y=new wr(e.mapping.maps[p],m,n),x;(x=u&&u.merge(y))&&(y=x,p?s.pop():c=c.slice(0,c.length-1)),s.push(y),n&&(l++,n=void 0),o||(u=y)}let h=l-r.depth;return h>DV&&(c=IV(c,h),l-=h),new or(c.append(s),l)}remapping(e,n){let r=new la;return this.items.forEach((o,s)=>{let l=o.mirrorOffset!=null&&s-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,l)},e,n),r}addMaps(e){return this.eventCount==0?this:new or(this.items.append(e.map(n=>new wr(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),s=e.mapping,l=e.steps.length,c=this.eventCount;this.items.forEach(y=>{y.selection&&c--},o);let u=n;this.items.forEach(y=>{let x=s.getMirror(--u);if(x==null)return;l=Math.min(l,x);let b=s.maps[x];if(y.step){let k=e.steps[x].invert(e.docs[x]),C=y.selection&&y.selection.map(s.slice(u+1,x));C&&c++,r.push(new wr(b,k,C))}else r.push(new wr(b))},o);let h=[];for(let y=n;y<l;y++)h.push(new wr(s.maps[y]));let p=this.items.slice(0,o).append(h).append(r),m=new or(p,c);return m.emptyItemCount()>OV&&(m=m.compress(this.items.length-r.length)),m}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],s=0;return this.items.forEach((l,c)=>{if(c>=e)o.push(l),l.selection&&s++;else if(l.step){let u=l.step.map(n.slice(r)),h=u&&u.getMap();if(r--,h&&n.appendMap(h,r),u){let p=l.selection&&l.selection.map(n.slice(r));p&&s++;let m=new wr(h.invert(),u,p),y,x=o.length-1;(y=o.length&&o[x].merge(m))?o[x]=y:o.push(m)}}else l.map&&r--},this.items.length,0),new or(Dt.from(o.reverse()),s)}}or.empty=new or(Dt.empty,0);function IV(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class wr{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 wr(n.getMap().invert(),n,this.selection)}}}class Eo{constructor(e,n,r,o,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=s}}const DV=20;function _V(t,e,n,r){let o=n.getMeta(js),s;if(o)return o.historyState;n.getMeta($V)&&(t=new Eo(t.done,t.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(l&&l.getMeta(js))return l.getMeta(js).redo?new Eo(t.done.addTransform(n,void 0,r,pu(e)),t.undone,z1(n.mapping.maps),t.prevTime,t.prevComposition):new Eo(t.done,t.undone.addTransform(n,void 0,r,pu(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),u=t.prevTime==0||!l&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!LV(n,t.prevRanges)),h=l?Wp(t.prevRanges,n.mapping):z1(n.mapping.maps);return new Eo(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,pu(e)),or.empty,h,n.time,c??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Eo(t.done.rebased(n,s),t.undone.rebased(n,s),Wp(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Eo(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Wp(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function LV(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&o>=e[s]&&(n=!0)}),n}function z1(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,s,l)=>e.push(s,l));return e}function Wp(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),s=e.map(t[r+1],-1);o<=s&&n.push(o,s)}return n}function zV(t,e,n){let r=pu(e),o=js.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let l=s.selection.resolve(s.transform.doc),c=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),o,r),u=new Eo(n?c:s.remaining,n?s.remaining:c,null,0,-1);return s.transform.setSelection(l).setMeta(js,{redo:n,historyState:u})}let Up=!1,$1=null;function pu(t){let e=t.plugins;if($1!=e){Up=!1,$1=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Up=!0;break}}return Up}const js=new ht("history"),$V=new ht("closeHistory");function FV(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ze({key:js,state:{init(){return new Eo(or.empty,or.empty,null,0,-1)},apply(e,n,r){return _V(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?dT:r=="historyRedo"?fT:null;return!o||!e.editable?!1:(n.preventDefault(),o(e.state,e.dispatch))}}}})}function uT(t,e){return(n,r)=>{let o=js.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let s=zV(o,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const dT=uT(!1,!0),fT=uT(!0,!0);it.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Ze({key:new ht("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const o=this.options.limit;if(o==null||o===0){t=!0;return}const s=this.storage.characters({node:r.doc});if(s>o){const l=s-o,c=0,u=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const h=r.tr.deleteRange(c,u);return t=!0,h}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||o>r&&s>r&&s<=o)return!0;if(o>r&&s>r&&s>o||!e.getMeta("paste"))return!1;const c=e.selection.$head.pos,u=s-r,h=c-u,p=c;return e.deleteRange(h,p),!(this.storage.characters({node:e.doc})>r)}})]}});var BV=it.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[SV(this.options)]}});it.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ze({key:new ht("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,s=[];if(!n||!r)return Xe.create(t,[]);let l=0;this.options.mode==="deepest"&&t.descendants((u,h)=>{if(u.isText)return;if(!(o>=h&&o<=h+u.nodeSize-1))return!1;l+=1});let c=0;return t.descendants((u,h)=>{if(u.isText||!(o>=h&&o<=h+u.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&l-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";s.push(wt.node(h,h+u.nodeSize,{class:this.options.className}))}),Xe.create(t,s)}}})]}});var VV=it.create({name:"gapCursor",addProseMirrorPlugins(){return[MV()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Ge(Me(t,"allowGapCursor",n)))!=null?e:null}}}),F1="placeholder";function HV(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var WV=it.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:F1,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${HV(this.options.dataAttribute)}`:`data-${F1}`;return[new Ze({key:new ht("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=n,s=[];if(!r)return null;const l=this.editor.isEmpty;return e.descendants((c,u)=>{const h=o>=u&&o<=u+c.nodeSize,p=!c.isLeaf&&Zd(c);if(!c.type.isTextblock)return this.options.includeChildren;if((h||!this.options.showOnlyCurrent)&&p){const m=[this.options.emptyNodeClass];l&&m.push(this.options.emptyEditorClass);const y=wt.node(u,u+c.nodeSize,{class:m.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:u,hasAnchor:h}):this.options.placeholder});s.push(y)}return this.options.includeChildren}),Xe.create(e,s)}}})]}});it.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Ze({key:new ht("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||mM(n.selection)||t.view.dragging?null:Xe.create(n.doc,[wt.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});var UV="skipTrailingNode";function B1({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var KV=it.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new ht(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?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 Ze({key:e,appendTransaction:(o,s,l)=>{const{doc:c,tr:u,schema:h}=l,p=e.getState(l),m=c.content.size,y=h.nodes[n];if(!o.some(x=>x.getMeta(UV))&&p)return u.insert(m,y.create())},state:{init:(o,s)=>{const l=s.tr.doc.lastChild;return!B1({node:l,types:r})},apply:(o,s)=>{if(!o.docChanged||o.getMeta("__uniqueIDTransaction"))return s;const l=o.doc.lastChild;return!B1({node:l,types:r})}}})]}}),qV=it.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>dT(t,e),redo:()=>({state:t,dispatch:e})=>fT(t,e)}},addProseMirrorPlugins(){return[FV(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),GV=it.create({name:"starterKit",addExtensions(){var t,e,n,r;const o=[];return this.options.bold!==!1&&o.push(m6.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(u6.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(YM.configure(this.options.bulletList)),this.options.code!==!1&&o.push(x6.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(b6.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(k6.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(BV.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(VV.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(S6.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(C6.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(qV.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(N6.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(A6.configure(this.options.italic)),this.options.listItem!==!1&&o.push(QM.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(rT.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&o.push(JM.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(sT.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(yV.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(wV.configure(this.options.strike)),this.options.text!==!1&&o.push(bV.configure(this.options.text)),this.options.underline!==!1&&o.push(kV.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&o.push(KV.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),JV=GV,YV=WV,QV=lT,XV=iT;const V1=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,su=new Map,ZV=it.create({name:"wikiLink",addOptions(){return{onWikiLinkClick:void 0,checkExists:void 0}},addProseMirrorPlugins(){const{onWikiLinkClick:t,checkExists:e}=this.options;return[new Ze({key:new ht("wikiLink"),props:{decorations(n){const r=[],o=n.doc;return o.descendants((s,l)=>{var h;if(!s.isText||!s.text)return;const c=s.text;let u;for(V1.lastIndex=0;(u=V1.exec(c))!==null;){const p=u[0],m=u[1].trim(),y=((h=u[2])==null?void 0:h.trim())||m,x=l+u.index,b=su.get(m.toLowerCase()),k=(b==null?void 0:b.exists)??!e,C=b==null?void 0:b.id,N=k?"wiki-link-exists":"wiki-link-broken",M=k?`Open "${m}"`:`"${m}" not found in this nest`,T=x+2,j=x+p.length-2;r.push(wt.inline(x,T,{class:"wiki-bracket-hidden"})),r.push(wt.inline(T,j,{class:`wiki-link ${N}`,"data-wiki-title":m,"data-wiki-id":C||"","data-wiki-display":y,title:M})),r.push(wt.inline(j,x+p.length,{class:"wiki-bracket-hidden"})),e&&!su.has(m.toLowerCase())&&(su.set(m.toLowerCase(),{exists:!1}),e(m).then(P=>{su.set(m.toLowerCase(),P)}).catch(()=>{}))}}),Xe.create(o,r)},handleClick(n,r,o){const s=o.target;if(!s.classList.contains("wiki-link"))return!1;const l=s.getAttribute("data-wiki-title"),c=s.getAttribute("data-wiki-id")||null;return l&&t?(t(l,c),!0):!1}}})]}}),iu=/\[([ xX])\]/g,eH=it.create({name:"taskCheckbox",addProseMirrorPlugins(){return[new Ze({key:new ht("taskCheckbox"),props:{decorations(t){const e=[],n=t.doc;return n.descendants((r,o)=>{if(!r.isText||!r.text)return;const s=r.text;let l;for(iu.lastIndex=0;(l=iu.exec(s))!==null;){const c=l[1]==="x"||l[1]==="X",u=o+l.index,h=u+l[0].length;e.push(wt.inline(u,h,{class:`task-checkbox ${c?"task-checked":"task-unchecked"}`,"data-task-checked":c?"true":"false"}))}}),Xe.create(n,e)},handleClick(t,e,n){const r=n.target;if(!r.classList.contains("task-checkbox"))return!1;const o=r.getAttribute("data-task-checked")==="true",{state:s}=t,{doc:l}=s;let c=!1;return l.descendants((u,h)=>{if(c||!u.isText||!u.text)return;const p=u.text;let m;for(iu.lastIndex=0;(m=iu.exec(p))!==null;){const y=h+m.index,x=y+m[0].length;if(e>=y&&e<=x){const b=o?"[ ]":"[x]",k=s.tr.replaceWith(y,x,s.schema.text(b));return t.dispatch(k),c=!0,!1}}}),c}}})]}}),H1=/(?:^|\s)@(?:\(([^)]+)\)|([a-zA-Z0-9._@-]+))/g,tH=it.create({name:"mention",addOptions(){return{onMentionClick:void 0}},addProseMirrorPlugins(){const{onMentionClick:t}=this.options;return[new Ze({key:new ht("mention"),props:{decorations(e){const n=[],r=e.doc;return r.descendants((o,s)=>{if(!o.isText||!o.text)return;const l=o.text;let c;for(H1.lastIndex=0;(c=H1.exec(l))!==null;){const u=c[0],h=c[1]||c[2],p=u.startsWith(" ")||u.startsWith(`
591
+ `)?1:0,m=s+c.index+p,y=m+u.length-p;n.push(wt.inline(m,y,{class:"mention mention-user","data-mention-name":h}))}}),Xe.create(r,n)},handleClick(e,n,r){const o=r.target;if(!o.classList.contains("mention"))return!1;const s=o.getAttribute("data-mention-name");return s&&t?(t(s),!0):!1}}})]}}),hT=w.forwardRef(function({content:e,onChange:n,onSave:r,nestId:o,onRequestDocLink:s,onWikiLinkClick:l,onMentionClick:c,placeholder:u="Start writing...",editable:h=!0,className:p},m){const[y,x]=w.useState(!1),b=h&&!y,k=s6({extensions:[JV.configure({heading:{levels:[1,2,3]},link:!1}),YV.configure({placeholder:u}),nV.configure({openOnClick:!1}),QV,XV.configure({nested:!0}),ZV.configure({onWikiLinkClick:l,checkExists:o?async N=>{try{const{nodes:M}=await qm(o,N),T=M.find(j=>j.title.toLowerCase()===N.toLowerCase());return T?{exists:!0,id:T.id}:{exists:!1}}catch{return{exists:!1}}}:void 0}),eH,tH.configure({onMentionClick:c})],content:e,editable:h,immediatelyRender:!1,onUpdate:({editor:N})=>{const M=N.getHTML(),T=N.isEmpty||N.getText().trim().length===0;n(T?"":M)},editorProps:{attributes:{class:"prose prose-sm dark:prose-invert max-w-none focus:outline-none min-h-[300px] px-6 py-4"},handleKeyDown:(N,M)=>(M.ctrlKey||M.metaKey)&&M.key==="s"?(M.preventDefault(),r==null||r(),!0):!1}});w.useEffect(()=>{k&&k.isEditable!==b&&k.setEditable(b)},[k,b]),w.useEffect(()=>{k&&(k.isFocused||e!==k.getHTML()&&k.commands.setContent(e,!1))},[e,k]),w.useImperativeHandle(m,()=>({insertWikiLink:N=>{k&&k.chain().focus().insertContent(`[[${N}]] `).run()}}),[k]);const C=()=>{if(!k)return;const N=k.getAttributes("link").href??"",M=window.prompt("URL",N);if(M!==null){if(M===""){k.chain().focus().extendMarkRange("link").unsetLink().run();return}k.chain().focus().extendMarkRange("link").setLink({href:M}).run()}};return k?f.jsxs("div",{className:Ee("relative border rounded-lg bg-background shadow-sm",p),children:[h&&f.jsx("div",{className:"sticky top-0 z-20 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/75 border-b",children:f.jsx(nH,{editor:k,onLink:C,onRequestDocLink:s,previewing:y,onTogglePreview:()=>x(N=>!N)})}),f.jsx(IM,{editor:k,className:Ee("min-h-[60vh] max-h-[60vh] overflow-y-auto",y&&"bg-muted/20"),"data-testid":"markdown-editor-content"})]}):f.jsxs("div",{className:"border rounded-lg bg-background shadow-sm",children:[f.jsx("div",{className:"h-12 bg-muted/40 rounded-t-lg border-b"}),f.jsx("div",{className:"animate-pulse bg-muted/20 h-[300px] rounded-b-lg"})]})});function nH({editor:t,onLink:e,onRequestDocLink:n,previewing:r,onTogglePreview:o}){return r?f.jsxs("div",{className:"flex items-center gap-0.5 p-1 flex-wrap",children:[f.jsx(zt,{active:!0,onClick:o,title:"Back to editing",children:f.jsx(ub,{className:"h-3.5 w-3.5"})}),f.jsx("span",{className:"text-xs text-muted-foreground px-2",children:"Preview — read-only"})]}):f.jsxs("div",{className:"flex items-center gap-0.5 p-1 flex-wrap",children:[f.jsx(zt,{active:t.isActive("bold"),onClick:()=>t.chain().focus().toggleBold().run(),title:"Bold (Ctrl+B)",children:f.jsx(eA,{className:"h-3.5 w-3.5"})}),f.jsx(zt,{active:t.isActive("italic"),onClick:()=>t.chain().focus().toggleItalic().run(),title:"Italic (Ctrl+I)",children:f.jsx(zA,{className:"h-3.5 w-3.5"})}),f.jsx(zt,{active:t.isActive("strike"),onClick:()=>t.chain().focus().toggleStrike().run(),title:"Strikethrough",children:f.jsx(SR,{className:"h-3.5 w-3.5"})}),f.jsx(Ll,{}),f.jsx(zt,{active:t.isActive("heading",{level:1}),onClick:()=>t.chain().focus().toggleHeading({level:1}).run(),title:"Heading 1",children:f.jsx(AA,{className:"h-3.5 w-3.5"})}),f.jsx(zt,{active:t.isActive("heading",{level:2}),onClick:()=>t.chain().focus().toggleHeading({level:2}).run(),title:"Heading 2",children:f.jsx(PA,{className:"h-3.5 w-3.5"})}),f.jsx(zt,{active:t.isActive("heading",{level:3}),onClick:()=>t.chain().focus().toggleHeading({level:3}).run(),title:"Heading 3",children:f.jsx(IA,{className:"h-3.5 w-3.5"})}),f.jsx(Ll,{}),f.jsx(zt,{active:t.isActive("bulletList"),onClick:()=>t.chain().focus().toggleBulletList().run(),title:"Bullet list",children:f.jsx(JA,{className:"h-3.5 w-3.5"})}),f.jsx(zt,{active:t.isActive("orderedList"),onClick:()=>t.chain().focus().toggleOrderedList().run(),title:"Numbered list",children:f.jsx(qA,{className:"h-3.5 w-3.5"})}),f.jsx(zt,{onClick:()=>t.chain().focus().insertContent("[ ] ").run(),title:"Insert task ([ ])",children:f.jsx(bR,{className:"h-3.5 w-3.5"})}),f.jsx(zt,{active:t.isActive("blockquote"),onClick:()=>t.chain().focus().toggleBlockquote().run(),title:"Quote",children:f.jsx(sR,{className:"h-3.5 w-3.5"})}),f.jsx(zt,{active:t.isActive("codeBlock"),onClick:()=>t.chain().focus().toggleCodeBlock().run(),title:"Code block",children:f.jsx(mA,{className:"h-3.5 w-3.5"})}),f.jsx(Ll,{}),f.jsx(zt,{active:t.isActive("link"),onClick:e,title:"Insert URL link",children:f.jsx(UA,{className:"h-3.5 w-3.5"})}),n&&f.jsx(zt,{onClick:n,title:"Link to a document in this nest",children:f.jsx($o,{className:"h-3.5 w-3.5"})}),f.jsx(Ll,{}),f.jsx(zt,{onClick:()=>t.chain().focus().undo().run(),disabled:!t.can().undo(),title:"Undo (Ctrl+Z)",children:f.jsx(jR,{className:"h-3.5 w-3.5"})}),f.jsx(zt,{onClick:()=>t.chain().focus().redo().run(),disabled:!t.can().redo(),title:"Redo (Ctrl+Shift+Z)",children:f.jsx(lR,{className:"h-3.5 w-3.5"})}),f.jsx(Ll,{}),f.jsx(zt,{onClick:o,title:"Preview — see how it will render",children:f.jsx(ib,{className:"h-3.5 w-3.5"})}),f.jsxs("div",{className:"ml-auto text-xs text-muted-foreground hidden sm:flex items-center gap-2 px-1",children:[f.jsx("span",{children:"[[wiki]]"}),f.jsx("span",{children:"@mention"}),f.jsx("span",{children:"[ ] task"})]})]})}function zt({active:t,onClick:e,disabled:n,title:r,children:o}){return f.jsx(xe,{type:"button",variant:"ghost",size:"sm",onMouseDown:s=>s.preventDefault(),onClick:e,disabled:n,title:r,className:Ee("h-7 w-7 p-0",t&&"bg-muted text-foreground"),children:o})}function Ll(){return f.jsx("span",{className:"mx-1 inline-block h-5 w-px bg-border"})}function rH({nestId:t,nestName:e,onBack:n,onOpenDocument:r}){var Pn,wn;const{isAdmin:o,adminStatus:s}=Vi(),l=((wn=(Pn=s==null?void 0:s.me)==null?void 0:Pn.email)==null?void 0:wn.toLowerCase())??"",[c,u]=w.useState([]),[h,p]=w.useState([]),[m,y]=w.useState([]),[x,b]=w.useState(!1),[k,C]=w.useState(!1),[N,M]=w.useState("all"),[T,j]=w.useState(!0),[P,L]=w.useState(""),[I,_]=w.useState("all"),[$,q]=w.useState(null),[X,ee]=w.useState(null),[K,ie]=w.useState(null),[ne,re]=w.useState({versions:[],approvedVersion:null,currentVersion:0}),[ae,H]=w.useState(!1),[W,B]=w.useState(!1),R=w.useCallback(async()=>{j(!0);const[se,Be,lt,fr]=await Promise.all([Km(t).catch(()=>({nodes:[]})),zj(t).catch(()=>({stewards:[]})),Hj(t).catch(()=>({requests:[],total:0})),Y1(t).catch(()=>({stewardship_enabled:!1}))]);u(se.nodes),p(Be.stewards),y(lt.requests),b(fr.stewardship_enabled),j(!1)},[t]);w.useEffect(()=>{R()},[R]);const U={total:c.length,pending:c.filter(se=>se.status==="pending_review").length,approved:c.filter(se=>se.status==="approved").length,reviewQueue:m.length},Ne=c.filter(se=>!(I!=="all"&&se.status!==I||P&&!se.title.toLowerCase().includes(P.toLowerCase()))),Se=h.filter(se=>se.userEmail.toLowerCase()===l),he=!(!o&&Se.length>0)||Se.some(se=>se.role==="editor"),oe=Se.some(se=>se.role==="reviewer"&&se.canApprove),pe=new Map;for(const se of m)pe.set(se.nodeId,se.requestedBy.toLowerCase());const le=se=>se?Se.some(Be=>{if(!Be.canApprove)return!1;if(Be.scope==="nest")return!0;if(Be.scope==="document")return Be.nodePattern===se.id;if(Be.scope==="folder")return Be.nodePattern===t||Be.nodePattern&&se.id.startsWith(Be.nodePattern+"/");if(Be.scope==="tag"){const lt=(Be.tagName||"").toLowerCase().replace(/^#+/,"");return(se.tags||[]).map(fr=>fr.toLowerCase().replace(/^#+/,"")).includes(lt)}return!1}):!1,je=m.filter(se=>{if(se.requestedBy.toLowerCase()===l)return!1;const Be=c.find(lt=>lt.id===se.nodeId);return Be?le(Be):!1}),De=async se=>{ie(se);try{const Be=await Wj(t,se.id);re(Be)}catch{}},_e=async se=>{$&&(await Z1(t,$.id,se),q(null),R())},Je=async se=>{$&&(await eb(t,$.id,se),q(null),R())},rt=async(se,Be)=>{X&&(await X1(t,X.id,se,Be),ee(null),R())},de=async se=>{if(window.confirm("Remove this steward? They will lose approval rights immediately. The user account and any documents stay intact."))try{await Bj(t,se),R()}catch(lt){window.alert((lt==null?void 0:lt.message)||"Failed to remove steward")}},We=async se=>{const{target:Be,...lt}=se,fr={...lt};se.scope==="document"||se.scope==="folder"?fr.nodePattern=Be:se.scope==="tag"&&(fr.tagName=Be),await Fj(t,fr),R()},ot=async se=>{if(window.confirm(`Delete "${se.title}"? This cannot be undone.`))try{await Lj(t,se.id),R()}catch(lt){window.alert((lt==null?void 0:lt.message)||"Failed to delete document")}};return f.jsxs("div",{className:"md:py-6",children:[f.jsxs("div",{className:"flex flex-col sm:flex-row items-start justify-between gap-2 sm:gap-4 mb-4",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(xe,{variant:"ghost",size:"icon",onClick:n,children:f.jsx(Gm,{className:"h-4 w-4"})}),f.jsx("h3",{className:"text-xl font-semibold",children:e})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs(xe,{variant:"outline",onClick:()=>B(!0),children:[f.jsx(HA,{className:"h-4 w-4 mr-2"}),"Connect"]}),o&&f.jsxs(xe,{variant:"outline",onClick:()=>C(!0),children:[f.jsx(C0,{className:"h-4 w-4 mr-2"}),"Settings"]}),x&&f.jsxs(f.Fragment,{children:[f.jsxs(xe,{variant:"outline",onClick:()=>$j(t).then(R),children:[f.jsx(mu,{className:"h-4 w-4 mr-2"}),"Sync stewards.yaml"]}),f.jsxs(xe,{variant:"outline",onClick:()=>H(!0),children:[f.jsx(En,{className:"h-4 w-4 mr-2"}),"Assign Steward"]})]}),f.jsxs(xe,{onClick:()=>r("new"),children:[f.jsx(Yp,{className:"h-4 w-4 mr-2"}),"New Document"]})]})]}),f.jsxs("div",{className:`grid grid-cols-1 gap-4 mb-6 ${x?"md:grid-cols-4":"md:grid-cols-1 max-w-sm"}`,children:[f.jsxs(Mt,{children:[f.jsxs(Ft,{className:"pb-2",children:[f.jsx(rr,{children:"Total Documents"}),f.jsx(Bt,{className:"text-3xl",children:U.total})]}),f.jsx(Tt,{children:f.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[f.jsx($o,{className:"h-4 w-4"}),f.jsx("span",{children:x?"In your context":"Auto-approved, AI-ready"})]})})]}),x&&f.jsxs(f.Fragment,{children:[f.jsxs(Mt,{children:[f.jsxs(Ft,{className:"pb-2",children:[f.jsx(rr,{children:"Pending Review"}),f.jsx(Bt,{className:"text-3xl text-amber-600",children:U.pending})]}),f.jsx(Tt,{children:f.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[f.jsx(Ym,{className:"h-4 w-4"}),f.jsx("span",{children:"Awaiting approval"})]})})]}),f.jsxs(Mt,{children:[f.jsxs(Ft,{className:"pb-2",children:[f.jsx(rr,{children:"AI Ready"}),f.jsx(Bt,{className:"text-3xl text-green-600",children:U.approved})]}),f.jsx(Tt,{children:f.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[f.jsx(Pi,{className:"h-4 w-4"}),f.jsx("span",{children:"Approved for AI"})]})})]}),f.jsxs(Mt,{children:[f.jsxs(Ft,{className:"pb-2",children:[f.jsx(rr,{children:"Review Queue"}),f.jsx(Bt,{className:"text-3xl text-blue-600",children:U.reviewQueue})]}),f.jsx(Tt,{children:f.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[f.jsx(En,{className:"h-4 w-4"}),f.jsx("span",{children:"Need your review"})]})})]})]})]}),f.jsxs(Ik,{defaultValue:"documents",className:"w-full",children:[f.jsxs(ag,{className:"mb-4",children:[f.jsx(To,{value:"documents",children:"Documents"}),x&&f.jsxs(To,{value:"review",className:"gap-2",children:["Review Queue",je.length>0&&f.jsx(Wn,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:je.length})]}),x&&f.jsx(To,{value:"stewards",children:"Stewards"})]}),f.jsx(jo,{value:"documents",className:"space-y-4",children:f.jsxs(Mt,{children:[f.jsx(Ft,{children:f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsx(Bt,{className:"text-lg",children:"Documents"}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs("div",{className:"relative",children:[f.jsx(db,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),f.jsx(yn,{placeholder:"Search...",value:P,onChange:se=>L(se.target.value),className:"pl-9 w-48 h-8"})]}),x&&f.jsxs(Ci,{value:I,onValueChange:_,children:[f.jsx(xs,{className:"w-[140px] h-8",children:f.jsx(Ni,{})}),f.jsxs(vs,{children:[f.jsx(Qt,{value:"all",children:"All Status"}),f.jsx(Qt,{value:"draft",children:"Draft"}),f.jsx(Qt,{value:"pending_review",children:"Pending"}),f.jsx(Qt,{value:"approved",children:"Approved"}),f.jsx(Qt,{value:"rejected",children:"Rejected"})]})]})]})]})}),f.jsx(Tt,{children:T?f.jsx("div",{className:"flex items-center justify-center py-8",children:f.jsx(jt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):Ne.length===0?f.jsx("div",{className:"text-center py-8 text-sm text-muted-foreground",children:P||I!=="all"?"No matching documents":"No documents yet"}):f.jsx("div",{className:"space-y-2",children:Ne.map(se=>{var Be;return f.jsxs("div",{onClick:()=>r(se.id),className:"flex items-center gap-3 p-3 rounded-lg border hover:bg-muted/50 transition-colors group cursor-pointer","data-testid":`document-row-${se.id}`,children:[f.jsx($o,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"font-medium truncate",children:se.title}),x&&f.jsx(Z3,{status:se.status||"draft",size:"sm"})]}),f.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-1",children:[f.jsxs("span",{children:["v",se.version||1]}),((Be=se.tags)==null?void 0:Be.length)>0&&f.jsxs(f.Fragment,{children:[f.jsx("span",{children:"·"}),f.jsx("span",{className:"truncate",children:se.tags.slice(0,3).join(" ")})]})]})]}),f.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",onClick:lt=>lt.stopPropagation(),children:[x&&se.status==="draft"&&he&&f.jsxs(xe,{variant:"outline",size:"sm",onClick:()=>ee(se),children:[f.jsx(Qm,{className:"h-3.5 w-3.5 mr-1"}),"Submit"]}),x&&se.status==="pending_review"&&pe.get(se.id)!==l&&oe&&f.jsx(xe,{variant:"outline",size:"sm",onClick:()=>q(se),className:"border-green-200 text-green-700 hover:bg-green-50",children:"Review"}),se.status!=="pending_review"&&he&&f.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>r(se.id),title:"Edit",children:f.jsx(ub,{className:"h-3.5 w-3.5"})}),f.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>De(se),title:"History",children:f.jsx(Gp,{className:"h-3.5 w-3.5"})}),he&&f.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>ot(se),title:"Delete",className:"text-destructive hover:text-destructive hover:bg-destructive/10",children:f.jsx(pb,{className:"h-3.5 w-3.5"})})]})]},se.id)})})})]})}),x&&f.jsx(jo,{value:"review",className:"space-y-4",children:f.jsx(z3,{requests:je,loading:T,onRefresh:R,onSelect:se=>{const Be=c.find(lt=>lt.id===se.nodeId);Be&&q(Be)}})}),x&&f.jsxs(jo,{value:"stewards",className:"space-y-4",children:[f.jsxs(Mt,{className:"border-blue-200 bg-blue-50/40",children:[f.jsx(Ft,{className:"pb-2",children:f.jsxs(Bt,{className:"text-sm flex items-center gap-2",children:[f.jsx(En,{className:"h-4 w-4 text-blue-700"}),"How stewardship works"]})}),f.jsxs(Tt,{className:"text-xs text-muted-foreground space-y-2 leading-relaxed",children:[f.jsxs("p",{children:[f.jsx("strong",{className:"text-foreground",children:"New documents start as drafts."})," ","They're not available to AI queries until a steward approves them."]}),f.jsxs("p",{children:[f.jsx("strong",{className:"text-foreground",children:"Stewards"})," are people you name to govern content by scope. Resolution priority (first match wins):"]}),f.jsxs("ol",{className:"list-decimal list-inside ml-2 space-y-0.5",children:[f.jsxs("li",{children:[f.jsx("strong",{children:"Document"})," — this exact doc"]}),f.jsxs("li",{children:[f.jsx("strong",{children:"Folder"})," — everything under a path"]}),f.jsxs("li",{children:[f.jsx("strong",{children:"Tag"})," — everything with #tag"]}),f.jsxs("li",{children:[f.jsx("strong",{children:"Nest"})," — anything not matched above"]})]}),f.jsxs("p",{children:[f.jsx("strong",{className:"text-foreground",children:"Reviewers"})," can approve/reject; ",f.jsx("strong",{className:"text-foreground",children:"editors"})," can edit;"," ",f.jsx("strong",{className:"text-foreground",children:"viewers"})," have read access. Authors can't approve their own work."]})]})]}),f.jsxs(Mt,{children:[f.jsx(Ft,{className:"pb-3",children:f.jsxs("div",{className:"flex items-center justify-between gap-3",children:[f.jsxs("div",{children:[f.jsx(Bt,{className:"text-lg",children:"Stewards"}),f.jsx(rr,{children:h.length===0?"Nobody's governing content yet":"Who governs what"})]}),h.length>0&&f.jsx("div",{className:"flex items-center gap-2",children:["all","document","folder","tag","nest"].map(se=>f.jsx("button",{onClick:()=>M(se),className:`text-xs px-2 py-1 rounded border ${N===se?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-border hover:bg-secondary"}`,children:se==="all"?"All":se.charAt(0).toUpperCase()+se.slice(1)},se))})]})}),f.jsx(Tt,{children:h.length===0?f.jsxs("div",{className:"text-sm space-y-3 py-2",children:[f.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Without stewards, every draft needs the nest owner to approve. Add an editor/reviewer to delegate approvals for a tag, folder, or specific doc."}),f.jsxs(xe,{variant:"outline",size:"sm",className:"w-full",onClick:()=>H(!0),children:[f.jsx(En,{className:"h-3.5 w-3.5 mr-2"}),"Assign your first steward"]})]}):f.jsx(A3,{stewards:N==="all"?h:h.filter(se=>se.scope===N),showScope:!0,onAddSteward:()=>H(!0),onRemove:de})})]})]})]}),!x&&f.jsxs(Mt,{className:"mt-4",children:[f.jsxs(Ft,{className:"pb-3",children:[f.jsxs(Bt,{className:"text-base flex items-center gap-2",children:[f.jsx(En,{className:"h-4 w-4"}),"Stewardship is off"]}),f.jsx(rr,{children:"New documents are auto-approved and immediately AI-ready."})]}),f.jsxs(Tt,{children:[f.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Enable stewardship to require steward approval before documents become AI-ready. Versioning stays on either way."}),o?f.jsxs(xe,{variant:"outline",size:"sm",className:"w-full",onClick:()=>C(!0),children:[f.jsx(C0,{className:"h-3.5 w-3.5 mr-2"}),"Open Settings"]}):f.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Only the server admin can enable stewardship."})]})]}),W&&f.jsx(KI,{isOpen:W,onClose:()=>B(!1),nestId:t,nestName:e}),k&&f.jsx(tD,{nestId:t,nestName:e,stewardshipEnabled:x,onClose:()=>C(!1),onChanged:()=>{C(!1),R()}}),ae&&f.jsx(D3,{isOpen:ae,onClose:()=>H(!1),nestId:t,onSubmit:We}),X&&f.jsx(dN,{isOpen:!!X,onClose:()=>ee(null),documentTitle:X.title,currentVersion:X.version||1,onSubmit:rt}),$&&f.jsx(oH,{node:$,onApprove:_e,onReject:Je,onClose:()=>q(null)}),K&&f.jsx(xn,{open:!0,onOpenChange:()=>ie(null),children:f.jsxs(nn,{className:"sm:max-w-[600px]",children:[f.jsx(rn,{children:f.jsx(on,{children:K.title})}),f.jsx(X3,{versions:ne.versions,currentVersion:ne.currentVersion,approvedVersion:ne.approvedVersion})]})})]})}function oH({node:t,onApprove:e,onReject:n,onClose:r}){return f.jsx(xn,{open:!0,onOpenChange:r,children:f.jsxs(nn,{className:"sm:max-w-[600px] max-h-[80vh] flex flex-col",children:[f.jsx(rn,{children:f.jsx(on,{children:t.title})}),f.jsx("div",{className:"flex-1 overflow-y-auto rounded-md",children:t.content?f.jsx(hT,{content:t.content,onChange:()=>{},editable:!1}):f.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"(no content)"})}),f.jsx(Nr,{children:f.jsx(uN,{documentTitle:t.title,version:t.version||1,onApprove:e,onReject:n})})]})})}function sH({isOpen:t,onClose:e,nestId:n,excludeNodeId:r,onSelect:o}){const[s,l]=w.useState([]),[c,u]=w.useState(""),[h,p]=w.useState(!1),[m,y]=w.useState(null);w.useEffect(()=>{if(!t){u(""),y(null);return}let b=!1;return(async()=>{p(!0);try{const{nodes:k}=await Km(n);b||l(k)}catch(k){b||y(k.message)}finally{b||p(!1)}})(),()=>{b=!0}},[t,n]),w.useEffect(()=>{if(!t||!c.trim())return;let b=!1;const k=setTimeout(async()=>{p(!0);try{const{nodes:C}=await qm(n,c.trim());b||l(C)}catch(C){b||y(C.message)}finally{b||p(!1)}},200);return()=>{b=!0,clearTimeout(k)}},[t,n,c]);const x=w.useMemo(()=>{const b=c.trim().toLowerCase();return s.filter(k=>k.id===r?!1:b?k.title.toLowerCase().includes(b):!0)},[s,c,r]);return f.jsx(xn,{open:t,onOpenChange:e,children:f.jsxs(nn,{className:"sm:max-w-[520px] max-h-[80vh] flex flex-col",children:[f.jsxs(rn,{children:[f.jsx(on,{children:"Link to a document"}),f.jsx(An,{children:"Pick a document in this nest. The link will use this title and point at the document — clicking it inside the editor opens the target."})]}),f.jsxs("div",{className:"relative",children:[f.jsx(db,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),f.jsx(yn,{value:c,onChange:b=>u(b.target.value),placeholder:"Search by title...",className:"pl-8",autoFocus:!0,"data-testid":"document-picker-search"})]}),f.jsxs("div",{className:"flex-1 overflow-y-auto -mx-1 px-1",children:[m&&f.jsx("div",{className:"text-sm text-destructive p-2",children:m}),h&&s.length===0?f.jsxs("div",{className:"flex items-center justify-center py-10 text-muted-foreground",children:[f.jsx(jt,{className:"h-5 w-5 animate-spin mr-2"}),"Loading documents..."]}):x.length===0?f.jsx("div",{className:"text-center text-sm text-muted-foreground py-10",children:c.trim()?"No matches":"No other documents in this nest yet"}):f.jsx("div",{className:"space-y-1",children:x.map(b=>f.jsxs("button",{type:"button",onClick:()=>{o({id:b.id,title:b.title}),e()},className:"w-full flex items-center gap-2 p-2 rounded hover:bg-muted text-left","data-testid":`document-picker-row-${b.id}`,children:[f.jsx($o,{className:"h-4 w-4 text-muted-foreground shrink-0"}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:"font-medium truncate",children:b.title}),b.tags&&b.tags.length>0&&f.jsx("div",{className:"text-xs text-muted-foreground truncate",children:b.tags.slice(0,4).join(" · ")})]})]},b.id))})]})]})})}function iH({nestId:t,nestName:e,nodeId:n,onBack:r,onSaved:o,onNavigateDocument:s}){var Je,rt;const l=n==="new",{adminStatus:c}=Vi(),u=((rt=(Je=c==null?void 0:c.me)==null?void 0:Je.email)==null?void 0:rt.toLowerCase())??"",[h,p]=w.useState(!1),[m,y]=w.useState(""),[x,b]=w.useState(""),[k,C]=w.useState([]),[N,M]=w.useState(""),[T,j]=w.useState(void 0),[P,L]=w.useState(null),[I,_]=w.useState(!1),[$,q]=w.useState(!1),[X,ee]=w.useState(!1),K=w.useRef(null),[ie,ne]=w.useState(!l),[re,ae]=w.useState(!1),[H,W]=w.useState(null);w.useEffect(()=>{let de=!1;return(async()=>{try{const We=await Y1(t).catch(()=>({stewardship_enabled:!1}));if(de)return;_(!!We.stewardship_enabled)}catch{}})(),()=>{de=!0}},[t]),w.useEffect(()=>{if(l||!n||!u){p(!1);return}let de=!1;return(async()=>{try{const{stewards:We}=await Vj(t,n);if(de)return;const ot=We.find(Pn=>(Pn.email||"").toLowerCase()===u);p(!!ot&&ot.role==="reviewer"&&ot.canApprove)}catch{de||p(!1)}})(),()=>{de=!0}},[l,t,n,u]);const B=w.useCallback(async()=>{if(!l){ne(!0);try{const{node:de}=await Ij(t,n);y((de==null?void 0:de.title)??""),b((de==null?void 0:de.content)??""),C(Array.isArray(de==null?void 0:de.tags)?de.tags:[]),j(de==null?void 0:de.version),L((de==null?void 0:de.status)??null)}catch(de){W(de.message)}finally{ne(!1)}}},[l,t,n]);w.useEffect(()=>{l||B()},[l,B]);const R=P==="pending_review",U=w.useMemo(()=>!R&&m.trim().length>0&&x.trim().length>0&&!re,[R,m,x,re]),Ne=w.useCallback(()=>{const de=N.split(/[\s,]+/).map(ot=>ot.trim().replace(/^#+/,"")).filter(Boolean);if(de.length===0)return;const We=[...k];for(const ot of de)We.includes(ot)||We.push(ot);C(We),M("")},[N,k]),Se=de=>C(k.filter(We=>We!==de)),we=async()=>{var de;if(U){ae(!0),W(null);try{if(l){const We=await Dj(t,{title:m.trim(),content:x,tags:k}),ot=(de=We==null?void 0:We.node)==null?void 0:de.id;o==null||o(ot??"")}else await _j(t,n,{title:m.trim(),content:x,tags:k},T),o==null||o(n)}catch(We){W(We.message)}finally{ae(!1)}}},he=async(de,We)=>{l||(await X1(t,n,de,We),q(!1),await B())},oe=async de=>{l||(await Z1(t,n,de),await B())},pe=async de=>{l||(await eb(t,n,de),await B())},le=!l&&P==="pending_review"&&h,je=!l&&I&&P==="draft",De=de=>{var We;(We=K.current)==null||We.insertWikiLink(de.title)},_e=async(de,We)=>{if(We){s==null||s(t,We);return}try{const{nodes:ot}=await qm(t,de),Pn=ot.find(wn=>wn.title.toLowerCase()===de.toLowerCase());Pn&&(s==null||s(t,Pn.id))}catch{}};return f.jsxs("div",{className:"md:py-6",children:[f.jsxs("div",{className:"flex items-center justify-between gap-3 mb-6 mt-14 md:mt-0",children:[f.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[f.jsx(xe,{variant:"ghost",size:"icon",onClick:r,"data-testid":"document-editor-back",children:f.jsx(Gm,{className:"h-5 w-5"})}),f.jsxs("div",{className:"min-w-0",children:[f.jsx("div",{className:"text-xs text-muted-foreground truncate",children:e}),f.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[f.jsx("h3",{className:"text-xl font-semibold truncate mb-0",children:m||(l?"New document":"Untitled")}),!l&&P&&f.jsx(lH,{status:P})]})]})]}),f.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[je&&f.jsxs(xe,{variant:"outline",onClick:()=>q(!0),"data-testid":"document-editor-submit",children:[f.jsx(Qm,{className:"h-4 w-4 mr-2"}),"Submit for Review"]}),le&&f.jsx(uN,{documentTitle:m,version:T??1,onApprove:oe,onReject:pe}),!R&&f.jsxs(xe,{onClick:we,disabled:!U,"data-testid":"document-editor-save",children:[re?f.jsx(jt,{className:"h-4 w-4 mr-2 animate-spin"}):f.jsx(dR,{className:"h-4 w-4 mr-2"}),l?"Create":"Save"]})]})]}),H&&f.jsxs(ir,{variant:"destructive",className:"mb-4",children:[f.jsx(Hn,{className:"h-4 w-4"}),f.jsx(lr,{children:H})]}),ie?f.jsxs("div",{className:"flex items-center justify-center py-20 text-muted-foreground",children:[f.jsx(jt,{className:"h-5 w-5 animate-spin mr-2"}),"Loading document..."]}):f.jsxs("div",{className:"space-y-4",children:[R&&f.jsxs(ir,{children:[f.jsx(Hn,{className:"h-4 w-4"}),f.jsx(lr,{children:"This document is awaiting steward review. Editing is locked until the review is resolved."})]}),f.jsxs("div",{children:[f.jsxs("label",{className:"block mb-1 text-sm font-medium",children:["Title ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(yn,{value:m,onChange:de=>y(de.target.value),placeholder:"Document title",disabled:R,"data-testid":"document-editor-title"})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block mb-1 text-sm font-medium",children:"Tags"}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(yn,{value:N,onChange:de=>M(de.target.value),onKeyDown:de=>{(de.key==="Enter"||de.key===","||de.key===" ")&&(de.preventDefault(),Ne())},placeholder:'Press Enter or space. Try "#api #v2" or "api, v2"',disabled:R,"data-testid":"document-editor-tag-input"}),f.jsx(xe,{type:"button",variant:"outline",onClick:Ne,disabled:R||!N.trim(),children:"Add"})]}),k.length>0&&f.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:k.map(de=>f.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-secondary px-2 py-0.5 text-xs",children:[de,!R&&f.jsx("button",{type:"button",onClick:()=>Se(de),className:"hover:text-destructive","aria-label":`Remove ${de}`,children:f.jsx(OR,{className:"h-3 w-3"})})]},de))})]}),f.jsxs("div",{children:[f.jsxs("label",{className:"block mb-1 text-sm font-medium",children:["Content ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(hT,{ref:K,content:x,onChange:b,onSave:we,nestId:t,editable:!R,onRequestDocLink:()=>ee(!0),onWikiLinkClick:_e,placeholder:"Start writing..."})]})]}),!l&&f.jsx(dN,{isOpen:$,onClose:()=>q(!1),documentTitle:m,currentVersion:T??1,onSubmit:he}),f.jsx(sH,{isOpen:X,onClose:()=>ee(!1),nestId:t,excludeNodeId:l?void 0:n,onSelect:De})]})}function lH({status:t}){const n={draft:{label:"Draft",cls:"bg-muted text-muted-foreground"},pending_review:{label:"Pending review",cls:"bg-amber-100 text-amber-800 dark:bg-amber-950 dark:text-amber-300"},approved:{label:"Approved",cls:"bg-emerald-100 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-300"},rejected:{label:"Rejected",cls:"bg-red-100 text-red-800 dark:bg-red-950 dark:text-red-300"}}[t];return n?f.jsx("span",{className:`shrink-0 inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${n.cls}`,"data-testid":`document-status-${t}`,children:n.label}):null}function aH({alreadyClaimed:t,existingAdmin:e,onClose:n}){const{loginSuccess:r}=Vi(),[o,s]=w.useState("promptowl"),[l,c]=w.useState(""),[u,h]=w.useState(""),[p,m]=w.useState(!1),[y,x]=w.useState(null),[b,k]=w.useState(null),[C,N]=w.useState(null),[M,T]=w.useState(!1),[j,P]=w.useState(null),L=async()=>{C&&(await navigator.clipboard.writeText(C),T(!0),setTimeout(()=>T(!1),1500))},I=async()=>{x(null),m(!0);try{const $=await q1();k($.verificationUrl),N($.deviceCode),window.open($.verificationUrl,"_blank","noopener,noreferrer");for(let q=0;q<180;q++){await new Promise(ee=>setTimeout(ee,2e3));const X=await G1($.deviceCode,$.clientSecret);if(X.status==="approved"&&X.token){const ee=await J1(X.token);if(r(ee.user?{email:ee.user.email,name:ee.user.name,is_admin:!!ee.user.is_admin}:void 0),ee.claim_blocked&&!ee.user.is_admin){P({info:ee.claim_blocked,attemptedEmail:ee.user.email}),k(null),N(null),m(!1);return}n();return}if(X.status==="expired"){x("Login expired. Try again."),k(null),N(null),m(!1);return}}}catch($){x($.message),k(null),N(null),m(!1)}},_=async $=>{$.preventDefault(),x(null),m(!0);try{const q=await K1(l,u);r(q.user?{email:q.user.email,name:q.user.name,is_admin:!!q.user.is_admin}:void 0),n()}catch(q){x(q.message),m(!1)}};return f.jsx(xn,{open:!0,onOpenChange:n,children:f.jsxs(nn,{className:"sm:max-w-[420px]",children:[f.jsxs(rn,{children:[f.jsxs(on,{className:"flex items-center gap-2",children:[f.jsx(En,{className:"h-4 w-4"}),t?"Login":"Claim as Admin"]}),f.jsx(An,{children:t?e?`This server is administered by ${e}. Login to manage settings and teammates.`:"Login with your account.":"The first PromptOwl-authenticated user becomes this server's admin. Admins can enable stewardship, invite teammates, and manage settings."})]}),f.jsxs("div",{className:"space-y-4 pt-2",children:[y&&f.jsxs(ir,{variant:"destructive",children:[f.jsx(Hn,{className:"h-4 w-4"}),f.jsx(lr,{children:y})]}),j&&f.jsxs(ir,{variant:"destructive",children:[f.jsx(ab,{className:"h-4 w-4"}),f.jsx(lr,{children:j.info.reason==="license_required"?f.jsxs("div",{className:"space-y-2",children:[f.jsx("p",{className:"font-medium",children:"Admin claim blocked — no license installed."}),f.jsx("p",{className:"text-xs",children:"Generate a Community License key in PromptOwl, then paste it on the setup screen. Only the PromptOwl account that minted the key can claim admin on this server."}),f.jsxs("a",{href:"https://app.promptowl.ai/community-license",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs underline",children:["Open Community License page",f.jsx(qp,{className:"h-3 w-3"})]})]}):f.jsxs("div",{className:"space-y-2",children:[f.jsx("p",{className:"font-medium",children:"Admin claim blocked — email does not match license owner."}),f.jsxs("p",{className:"text-xs",children:["License owner:"," ",f.jsx("code",{className:"font-mono",children:j.info.license_owner_email||"(unknown)"})]}),f.jsxs("p",{className:"text-xs",children:["You logged in as:"," ",f.jsx("code",{className:"font-mono",children:j.attemptedEmail})]}),f.jsx("p",{className:"text-xs",children:"Log in with the PromptOwl account that generated the installed license key, or install a different key belonging to this account."})]})})]}),o==="promptowl"?f.jsxs(f.Fragment,{children:[f.jsx(xe,{onClick:I,disabled:p,className:"w-full",children:p&&b?f.jsxs(f.Fragment,{children:[f.jsx(jt,{className:"h-4 w-4 mr-2 animate-spin"}),"Waiting for approval..."]}):"Login with PromptOwl"}),b&&f.jsxs("div",{className:"rounded-md border bg-muted/40 p-3 space-y-2",children:[f.jsxs("p",{className:"text-xs text-muted-foreground",children:["A new tab opened at"," ",f.jsxs("a",{href:b,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-primary underline",children:["PromptOwl",f.jsx(qp,{className:"h-3 w-3"})]}),". If it asks for a verification code, use this:"]}),C&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("code",{className:"flex-1 bg-background border rounded px-2 py-1.5 text-xs font-mono break-all",children:C}),f.jsx(xe,{size:"sm",variant:"outline",onClick:L,children:M?f.jsx(qo,{className:"h-3.5 w-3.5 text-green-600"}):f.jsx(ya,{className:"h-3.5 w-3.5"})})]})]}),f.jsxs("div",{className:"relative",children:[f.jsx("div",{className:"absolute inset-0 flex items-center",children:f.jsx("div",{className:"w-full border-t border-border"})}),f.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:f.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"or"})})]}),f.jsx(xe,{variant:"outline",className:"w-full",onClick:()=>s("password"),children:"Use email + password"})]}):f.jsxs("form",{onSubmit:_,className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{children:"Email"}),f.jsx(yn,{type:"email",value:l,onChange:$=>c($.target.value),required:!0,autoFocus:!0})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{children:"Password"}),f.jsx(yn,{type:"password",value:u,onChange:$=>h($.target.value),required:!0})]}),f.jsx(xe,{type:"submit",disabled:p,className:"w-full",children:p?f.jsx(jt,{className:"h-4 w-4 animate-spin"}):"Login"}),f.jsx("button",{type:"button",onClick:()=>s("promptowl"),className:"w-full text-xs text-muted-foreground hover:text-foreground",children:"← Back to PromptOwl login"})]})]})]})})}function cH({onBack:t}){const[e,n]=w.useState([]),[r,o]=w.useState([]),[s,l]=w.useState(!0),[c,u]=w.useState(null),[h,p]=w.useState(!1),[m,y]=w.useState(""),[x,b]=w.useState(null),k=async()=>{l(!0);try{const N=await Mj();n(N.teammates),o(N.pending_stewards||[]),u(null)}catch(N){u(N.message)}finally{l(!1)}};w.useEffect(()=>{k()},[]);const C=N=>{if(!N)return"Never";const M=new Date(N),T=Date.now()-M.getTime();return T<6e4?"Just now":T<36e5?`${Math.floor(T/6e4)}m ago`:T<864e5?`${Math.floor(T/36e5)}h ago`:T<6048e5?`${Math.floor(T/864e5)}d ago`:M.toLocaleDateString()};return f.jsxs("div",{children:[f.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[f.jsx(xe,{variant:"ghost",size:"icon",onClick:t,children:f.jsx(Gm,{className:"h-4 w-4"})}),f.jsxs("div",{className:"flex-1",children:[f.jsx("h2",{className:"text-2xl font-semibold",children:"Teammates"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Invite teammates and manage their access keys"})]}),f.jsxs(xe,{onClick:()=>p(!0),children:[f.jsx(Mi,{className:"h-4 w-4 mr-2"}),"Invite Teammate"]})]}),c&&f.jsxs(ir,{variant:"destructive",className:"mb-4",children:[f.jsx(Hn,{className:"h-4 w-4"}),f.jsx(lr,{children:c})]}),f.jsxs(Mt,{children:[f.jsxs(Ft,{children:[f.jsxs(Bt,{className:"text-lg flex items-center gap-2",children:[f.jsx(mb,{className:"h-4 w-4"}),"All Users"]}),f.jsx(rr,{children:"Everyone who has access to this community server"})]}),f.jsx(Tt,{children:s?f.jsx("div",{className:"flex items-center justify-center py-8",children:f.jsx(jt,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):e.length===0?f.jsx("div",{className:"text-center py-8 text-sm text-muted-foreground",children:'No teammates yet. Click "Invite Teammate" to add one.'}):f.jsx("div",{className:"space-y-2",children:e.map(N=>f.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border",children:[f.jsx(Ho,{className:"h-9 w-9",children:f.jsx(Wo,{children:(N.email[0]||"?").toUpperCase()})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"font-medium truncate",children:N.name||N.email}),N.is_admin&&f.jsxs(Wn,{variant:"outline",className:"gap-1 border-blue-200 bg-blue-50 text-blue-700",children:[f.jsx(En,{className:"h-3 w-3"}),"Admin"]}),!!N.is_invited&&f.jsx(Wn,{variant:"outline",className:"border-amber-200 bg-amber-50 text-amber-700",title:"Invited but not yet registered. They must complete registration with this email to claim the account.",children:"Invited"})]}),f.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-3",children:[f.jsx("span",{children:N.email}),f.jsx("span",{children:"·"}),f.jsxs("span",{children:[N.key_count," key",N.key_count!==1?"s":""]}),N.last_active&&f.jsxs(f.Fragment,{children:[f.jsx("span",{children:"·"}),f.jsxs("span",{children:["last active ",C(N.last_active)]})]})]})]})]},N.id))})})]}),r.length>0&&f.jsxs(Mt,{className:"mt-4 border-amber-200 bg-amber-50/40",children:[f.jsxs(Ft,{children:[f.jsxs(Bt,{className:"text-lg flex items-center gap-2",children:[f.jsx(En,{className:"h-4 w-4 text-amber-700"}),"Stewards without server access"]}),f.jsx(rr,{children:"These emails are assigned as stewards on one or more nests, but haven't been invited to this server yet — they can't log in or approve anything until they have an API key."})]}),f.jsx(Tt,{children:f.jsx("div",{className:"space-y-2",children:r.map(N=>f.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border bg-background",children:[f.jsx(Ho,{className:"h-9 w-9",children:f.jsx(Wo,{className:"bg-amber-100 text-amber-800",children:(N[0]||"?").toUpperCase()})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("span",{className:"font-medium text-sm truncate",children:N}),f.jsx("div",{className:"text-xs text-muted-foreground",children:"Assigned as steward · no API key yet"})]}),f.jsxs(xe,{size:"sm",onClick:()=>{y(N),p(!0)},children:[f.jsx(Mi,{className:"h-3.5 w-3.5 mr-1"}),"Invite"]})]},N))})})]}),h&&f.jsx(uH,{seedEmail:m,onClose:()=>{p(!1),y("")},onCreated:(N,M)=>{p(!1),y(""),b({email:N,key:M}),k()}}),x&&f.jsx(dH,{email:x.email,apiKey:x.key,onClose:()=>b(null)})]})}function uH({seedEmail:t,onClose:e,onCreated:n}){const[r,o]=w.useState(t||""),[s,l]=w.useState(""),[c,u]=w.useState(!1),[h,p]=w.useState(null),m=async y=>{if(y.preventDefault(),!!r.trim()){u(!0),p(null);try{const x=await Tj(r,s||void 0);n(r,x.api_key)}catch(x){p(x.message),u(!1)}}};return f.jsx(xn,{open:!0,onOpenChange:e,children:f.jsxs(nn,{className:"sm:max-w-[420px]",children:[f.jsxs(rn,{children:[f.jsx(on,{children:"Invite Teammate"}),f.jsx(An,{children:"Create an API key for a teammate. They'll use it to authenticate from Hootie, Claude Desktop, or the CLI."})]}),f.jsxs("form",{onSubmit:m,className:"space-y-3",children:[h&&f.jsxs(ir,{variant:"destructive",children:[f.jsx(Hn,{className:"h-4 w-4"}),f.jsx(lr,{children:h})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{children:"Email"}),f.jsx(yn,{type:"email",placeholder:"jane@acme.com",value:r,onChange:y=>o(y.target.value),required:!0,autoFocus:!0})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{children:"Key label (optional)"}),f.jsx(yn,{placeholder:"Jane's laptop",value:s,onChange:y=>l(y.target.value)})]}),f.jsxs(Nr,{children:[f.jsx(xe,{variant:"outline",type:"button",onClick:e,children:"Cancel"}),f.jsx(xe,{type:"submit",disabled:c||!r.trim(),children:c?f.jsx(jt,{className:"h-4 w-4 animate-spin"}):"Generate Key"})]})]})]})})}function dH({email:t,apiKey:e,onClose:n}){const[r,o]=w.useState(!1),s=async()=>{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),1500)};return f.jsx(xn,{open:!0,onOpenChange:n,children:f.jsxs(nn,{className:"sm:max-w-[520px]",children:[f.jsxs(rn,{children:[f.jsxs(on,{children:["Key created for ",t]}),f.jsxs(An,{children:["Copy this key and send it to them via Slack, email, or another secure channel. ",f.jsx("strong",{children:"It won't be shown again."})]})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(yt,{className:"text-xs text-muted-foreground",children:"API Key"}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("code",{className:"flex-1 bg-muted px-3 py-2 rounded text-xs font-mono break-all",children:e}),f.jsx(xe,{size:"sm",variant:"outline",onClick:s,children:r?f.jsx(qo,{className:"h-3.5 w-3.5 text-green-600"}):f.jsx(ya,{className:"h-3.5 w-3.5"})})]}),f.jsx("p",{className:"text-xs text-muted-foreground pt-2",children:"They'll paste this into:"}),f.jsxs("ul",{className:"text-xs text-muted-foreground list-disc list-inside space-y-0.5",children:[f.jsx("li",{children:"Hootie → Settings → Vault → Remote Server → API Key"}),f.jsxs("li",{children:["Claude Desktop → add as"," ",f.jsx("code",{className:"text-[10px]",children:"Authorization: Bearer ..."})," ","in MCP config"]}),f.jsxs("li",{children:["CLI → ",f.jsx("code",{className:"text-[10px]",children:"--key ..."})," flag"]})]})]}),f.jsx(Nr,{children:f.jsx(xe,{onClick:n,children:"Done"})})]})})}function fH({onActivated:t}){const[e,n]=w.useState(""),[r,o]=w.useState(!1),[s,l]=w.useState(null),c=async()=>{const u=e.trim();if(!u.startsWith("pk_")){l("License key must start with pk_");return}l(null),o(!0);try{const h=await Ej(u);if(!h.valid){l(h.error||"PromptOwl rejected this key.");return}t()}catch(h){l(h instanceof Error?h.message:"Failed to install key")}finally{o(!1)}};return f.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background px-4",children:f.jsxs("div",{className:"w-full max-w-lg space-y-6",children:[f.jsxs("div",{className:"text-center space-y-2",children:[f.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-primary/10",children:f.jsx(xR,{className:"h-6 w-6 text-primary"})}),f.jsx("h1",{className:"text-2xl font-bold",children:"Activate ContextNest Community"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"This server is in setup mode. Paste a PromptOwl license key to unlock write access."})]}),f.jsxs("div",{className:"border rounded-lg p-6 space-y-4 bg-card",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx(yt,{htmlFor:"license-key",children:"License key"}),f.jsx(yn,{id:"license-key","data-testid":"license-setup-key-input",placeholder:"pk_...",value:e,autoFocus:!0,onChange:u=>{n(u.target.value),s&&l(null)},onKeyDown:u=>{u.key==="Enter"&&!r&&c()},className:"font-mono"}),s&&f.jsx("p",{className:"text-sm text-destructive","data-testid":"license-setup-error",children:s})]}),f.jsx(xe,{className:"w-full",onClick:c,disabled:r||!e.trim(),"data-testid":"license-setup-submit",children:r?f.jsxs(f.Fragment,{children:[f.jsx(jt,{className:"h-4 w-4 mr-2 animate-spin"}),"Validating..."]}):f.jsxs(f.Fragment,{children:[f.jsx(ab,{className:"h-4 w-4 mr-2"}),"Activate Server"]})})]}),f.jsxs("div",{className:"text-sm text-muted-foreground space-y-2 border rounded-lg p-4 bg-muted/30",children:[f.jsx("p",{className:"font-medium text-foreground",children:"Need a key?"}),f.jsxs("ol",{className:"list-decimal list-inside space-y-1",children:[f.jsxs("li",{children:["Sign up free at"," ",f.jsxs("a",{href:"https://app.promptowl.ai",target:"_blank",rel:"noreferrer",className:"text-primary underline inline-flex items-center gap-1",children:["app.promptowl.ai",f.jsx(qp,{className:"h-3 w-3"})]})]}),f.jsx("li",{children:"Open Overview > Community License"}),f.jsx("li",{children:"Generate a key and paste it above"})]}),f.jsx("p",{className:"text-xs pt-2",children:"Reads stay available without a license. Writes (nest/node create, update, delete) require activation."})]})]})})}const hH="/assets/hootie-C2ocYkn4.svg";function pH(){var M,T;const{authMode:t,adminStatus:e,authenticated:n,isAdmin:r,loading:o,error:s,logout:l}=Vi(),[c,u]=w.useState({page:"dashboard"}),[h,p]=w.useState(!1),[m,y]=w.useState(null),[x,b]=w.useState(!0),k=w.useCallback(async()=>{try{const j=await Nj();y(j)}catch{y(null)}finally{b(!1)}},[]);w.useEffect(()=>{k();const j=setInterval(k,900*1e3),P=()=>{k()};return window.addEventListener("auth:unauthorized",P),()=>{clearInterval(j),window.removeEventListener("auth:unauthorized",P)}},[k]);const C=((M=e==null?void 0:e.me)==null?void 0:M.email)??null,N=w.useRef(C);return w.useEffect(()=>{N.current!==C&&(N.current=C,u({page:"dashboard"}))},[C]),s?f.jsx("div",{className:"min-h-screen flex items-center justify-center",children:f.jsxs("div",{className:"text-center",children:[f.jsx("p",{className:"text-lg font-medium text-destructive",children:s}),f.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Check that the community server is running."})]})}):o||t===null||x?f.jsx("div",{className:"min-h-screen flex items-center justify-center",children:f.jsx("div",{className:"animate-pulse text-muted-foreground",children:"Connecting..."})}):m&&!m.valid?f.jsx(fH,{onActivated:k}):!n&&t==="key"?f.jsx(Kj,{}):f.jsxs("div",{className:"min-h-screen bg-background",children:[f.jsx("header",{className:"border-b border-border bg-card",children:f.jsxs("div",{className:"max-w-6xl mx-auto px-4 py-3 flex items-center justify-between",children:[f.jsxs("button",{onClick:()=>u({page:"dashboard"}),className:"flex items-center gap-2 hover:opacity-80",children:[f.jsx("img",{src:hH,alt:"ContextNest",className:"h-7 w-7"}),f.jsx("span",{className:"font-semibold",children:"ContextNest"}),f.jsx(Wn,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Community"})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[t==="open"&&!(e!=null&&e.me)&&f.jsxs("span",{className:"hidden md:inline-flex items-center gap-1.5 text-xs text-amber-700 bg-amber-50 border border-amber-200 px-2 py-1 rounded",children:[f.jsx(Jp,{className:"h-3 w-3"}),"Open mode"]}),e!=null&&e.me?f.jsx(mH,{me:e.me,isAdmin:r,onTeammates:()=>u({page:"teammates"}),onLogout:l}):f.jsxs(xe,{variant:"outline",size:"sm",onClick:()=>p(!0),children:[f.jsx(En,{className:"h-3.5 w-3.5 mr-1"}),e!=null&&e.claimed?"Login":"Claim as Admin"]})]})]})}),f.jsxs("main",{className:"max-w-6xl mx-auto px-4 py-6",children:[c.page==="dashboard"&&f.jsx(zP,{onSelectNest:(j,P)=>u({page:"nest",nestId:j,nestName:P})}),c.page==="nest"&&f.jsx(rH,{nestId:c.nestId,nestName:c.nestName,onBack:()=>u({page:"dashboard"}),onOpenDocument:j=>u({page:"document",nestId:c.nestId,nestName:c.nestName,nodeId:j})}),c.page==="document"&&f.jsx(iH,{nestId:c.nestId,nestName:c.nestName,nodeId:c.nodeId,onBack:()=>u({page:"nest",nestId:c.nestId,nestName:c.nestName}),onSaved:()=>u({page:"nest",nestId:c.nestId,nestName:c.nestName}),onNavigateDocument:(j,P)=>u({page:"document",nestId:j,nestName:j===c.nestId?c.nestName:"Document",nodeId:P})}),c.page==="teammates"&&f.jsx(cH,{onBack:()=>u({page:"dashboard"})})]}),h&&f.jsx(aH,{alreadyClaimed:!!(e!=null&&e.claimed),existingAdmin:((T=e==null?void 0:e.admin)==null?void 0:T.email)||null,onClose:()=>p(!1)})]})}function mH({me:t,isAdmin:e,onTeammates:n,onLogout:r}){var l;const o=((l=t.name)==null?void 0:l.trim())||t.email,s=o.charAt(0);return f.jsxs(tN,{children:[f.jsx(nN,{asChild:!0,children:f.jsxs(xe,{variant:"ghost",size:"sm",className:"group h-9 gap-2 px-2","data-testid":"user-menu-trigger",children:[f.jsx(Ho,{className:"h-[1.8rem] w-[1.8rem] rounded-sm shrink-0",children:f.jsx(Wo,{className:"rounded-sm",children:s})}),f.jsx("span",{className:"hidden sm:inline max-w-[140px] truncate text-sm font-medium",children:o}),f.jsx(Jm,{className:"h-3.5 w-3.5 text-muted-foreground"})]})}),f.jsxs(Ag,{align:"end",className:"min-w-56",children:[f.jsxs("div",{className:"flex items-center gap-2 p-2",children:[f.jsx(Ho,{className:"h-8 w-8 rounded-sm shrink-0",children:f.jsx(Wo,{className:"rounded-sm",children:s})}),f.jsxs("div",{className:"grid gap-0.5 leading-none min-w-0 flex-1",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"font-semibold truncate",children:o}),e&&f.jsxs(Wn,{variant:"outline",className:"gap-1 border-blue-200 bg-blue-50 text-blue-700 text-[10px] px-1.5 py-0",children:[f.jsx(En,{className:"h-2.5 w-2.5"}),"Admin"]})]}),f.jsx("div",{className:"text-sm text-muted-foreground truncate",children:t.email})]})]}),e&&f.jsxs(f.Fragment,{children:[f.jsx(dm,{}),f.jsxs(Eu,{onSelect:n,className:"cursor-pointer",children:[f.jsx(mb,{className:"h-3.5 w-3.5 mr-2"}),"Teammates"]})]}),f.jsx(dm,{}),f.jsxs(Eu,{onSelect:r,className:"cursor-pointer text-red-600 focus:text-red-700","data-testid":"user-menu-logout",children:[f.jsx(XA,{className:"h-3.5 w-3.5 mr-2"}),"Logout"]})]})]})}vj.createRoot(document.getElementById("root")).render(f.jsx(Yt.StrictMode,{children:f.jsx(Uj,{children:f.jsx(pH,{})})}));