@maplab/hyperdoc 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +18406 -801
- package/dist/index.js.map +1 -1
- package/dist/prompts/agent.txt +25 -3
- package/dist/web/apple-touch-icon.png +0 -0
- package/dist/web/assets/index-CheWhgv9.css +1 -0
- package/dist/web/assets/index-DMxgWNcj.js +720 -0
- package/dist/web/favicon.png +0 -0
- package/dist/web/index.html +4 -3
- package/dist/web/logo.png +0 -0
- package/package.json +2 -1
- package/dist/web/assets/index-DMhiJVmN.js +0 -549
- package/dist/web/assets/index-KIh2MATB.css +0 -1
|
@@ -0,0 +1,720 @@
|
|
|
1
|
+
var b3=Object.defineProperty;var YS=e=>{throw TypeError(e)};var k3=(e,t,n)=>t in e?b3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var it=(e,t,n)=>k3(e,typeof t!="symbol"?t+"":t,n),Iy=(e,t,n)=>t.has(e)||YS("Cannot "+n);var P=(e,t,n)=>(Iy(e,t,"read from private field"),n?n.call(e):t.get(e)),he=(e,t,n)=>t.has(e)?YS("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),se=(e,t,n,r)=>(Iy(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Oe=(e,t,n)=>(Iy(e,t,"access private method"),n);var Gf=(e,t,n,r)=>({set _(s){se(e,t,s,n)},get _(){return P(e,t,r)}});function S3(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Rp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lO={exports:{}},xg={},aO={exports:{}},Ue={};/**
|
|
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 bf=Symbol.for("react.element"),C3=Symbol.for("react.portal"),E3=Symbol.for("react.fragment"),N3=Symbol.for("react.strict_mode"),T3=Symbol.for("react.profiler"),R3=Symbol.for("react.provider"),M3=Symbol.for("react.context"),O3=Symbol.for("react.forward_ref"),j3=Symbol.for("react.suspense"),P3=Symbol.for("react.memo"),A3=Symbol.for("react.lazy"),XS=Symbol.iterator;function _3(e){return e===null||typeof e!="object"?null:(e=XS&&e[XS]||e["@@iterator"],typeof e=="function"?e:null)}var uO={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},cO=Object.assign,dO={};function Xu(e,t,n){this.props=e,this.context=t,this.refs=dO,this.updater=n||uO}Xu.prototype.isReactComponent={};Xu.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};Xu.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function fO(){}fO.prototype=Xu.prototype;function Sb(e,t,n){this.props=e,this.context=t,this.refs=dO,this.updater=n||uO}var Cb=Sb.prototype=new fO;Cb.constructor=Sb;cO(Cb,Xu.prototype);Cb.isPureReactComponent=!0;var eC=Array.isArray,hO=Object.prototype.hasOwnProperty,Eb={current:null},pO={key:!0,ref:!0,__self:!0,__source:!0};function mO(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)hO.call(t,r)&&!pO.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var a=Array(l),u=0;u<l;u++)a[u]=arguments[u+2];s.children=a}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:bf,type:e,key:i,ref:o,props:s,_owner:Eb.current}}function I3(e,t){return{$$typeof:bf,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Nb(e){return typeof e=="object"&&e!==null&&e.$$typeof===bf}function D3(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var tC=/\/+/g;function Dy(e,t){return typeof e=="object"&&e!==null&&e.key!=null?D3(""+e.key):t.toString(36)}function Jh(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case bf:case C3:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+Dy(o,0):r,eC(s)?(n="",e!=null&&(n=e.replace(tC,"$&/")+"/"),Jh(s,t,n,"",function(u){return u})):s!=null&&(Nb(s)&&(s=I3(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(tC,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",eC(e))for(var l=0;l<e.length;l++){i=e[l];var a=r+Dy(i,l);o+=Jh(i,t,n,a,s)}else if(a=_3(e),typeof a=="function")for(e=a.call(e),l=0;!(i=e.next()).done;)i=i.value,a=r+Dy(i,l++),o+=Jh(i,t,n,a,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Jf(e,t,n){if(e==null)return e;var r=[],s=0;return Jh(e,r,"","",function(i){return t.call(n,i,s++)}),r}function L3(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var qn={current:null},Zh={transition:null},$3={ReactCurrentDispatcher:qn,ReactCurrentBatchConfig:Zh,ReactCurrentOwner:Eb};function gO(){throw Error("act(...) is not supported in production builds of React.")}Ue.Children={map:Jf,forEach:function(e,t,n){Jf(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Jf(e,function(){t++}),t},toArray:function(e){return Jf(e,function(t){return t})||[]},only:function(e){if(!Nb(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ue.Component=Xu;Ue.Fragment=E3;Ue.Profiler=T3;Ue.PureComponent=Sb;Ue.StrictMode=N3;Ue.Suspense=j3;Ue.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=$3;Ue.act=gO;Ue.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=cO({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=Eb.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(a in t)hO.call(t,a)&&!pO.hasOwnProperty(a)&&(r[a]=t[a]===void 0&&l!==void 0?l[a]:t[a])}var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){l=Array(a);for(var u=0;u<a;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:bf,type:e.type,key:s,ref:i,props:r,_owner:o}};Ue.createContext=function(e){return e={$$typeof:M3,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:R3,_context:e},e.Consumer=e};Ue.createElement=mO;Ue.createFactory=function(e){var t=mO.bind(null,e);return t.type=e,t};Ue.createRef=function(){return{current:null}};Ue.forwardRef=function(e){return{$$typeof:O3,render:e}};Ue.isValidElement=Nb;Ue.lazy=function(e){return{$$typeof:A3,_payload:{_status:-1,_result:e},_init:L3}};Ue.memo=function(e,t){return{$$typeof:P3,type:e,compare:t===void 0?null:t}};Ue.startTransition=function(e){var t=Zh.transition;Zh.transition={};try{e()}finally{Zh.transition=t}};Ue.unstable_act=gO;Ue.useCallback=function(e,t){return qn.current.useCallback(e,t)};Ue.useContext=function(e){return qn.current.useContext(e)};Ue.useDebugValue=function(){};Ue.useDeferredValue=function(e){return qn.current.useDeferredValue(e)};Ue.useEffect=function(e,t){return qn.current.useEffect(e,t)};Ue.useId=function(){return qn.current.useId()};Ue.useImperativeHandle=function(e,t,n){return qn.current.useImperativeHandle(e,t,n)};Ue.useInsertionEffect=function(e,t){return qn.current.useInsertionEffect(e,t)};Ue.useLayoutEffect=function(e,t){return qn.current.useLayoutEffect(e,t)};Ue.useMemo=function(e,t){return qn.current.useMemo(e,t)};Ue.useReducer=function(e,t,n){return qn.current.useReducer(e,t,n)};Ue.useRef=function(e){return qn.current.useRef(e)};Ue.useState=function(e){return qn.current.useState(e)};Ue.useSyncExternalStore=function(e,t,n){return qn.current.useSyncExternalStore(e,t,n)};Ue.useTransition=function(){return qn.current.useTransition()};Ue.version="18.3.1";aO.exports=Ue;var x=aO.exports;const Wr=yg(x),kf=S3({__proto__:null,default:Wr},[x]);/**
|
|
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 z3=x,F3=Symbol.for("react.element"),B3=Symbol.for("react.fragment"),V3=Object.prototype.hasOwnProperty,H3=z3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,U3={key:!0,ref:!0,__self:!0,__source:!0};function yO(e,t,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)V3.call(t,r)&&!U3.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:F3,type:e,key:i,ref:o,props:s,_owner:H3.current}}xg.Fragment=B3;xg.jsx=yO;xg.jsxs=yO;lO.exports=xg;var p=lO.exports,xO={exports:{}},Cr={},vO={exports:{}},wO={};/**
|
|
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
|
+
*/(function(e){function t(_,Q){var M=_.length;_.push(Q);e:for(;0<M;){var oe=M-1>>>1,F=_[oe];if(0<s(F,Q))_[oe]=Q,_[M]=F,M=oe;else break e}}function n(_){return _.length===0?null:_[0]}function r(_){if(_.length===0)return null;var Q=_[0],M=_.pop();if(M!==Q){_[0]=M;e:for(var oe=0,F=_.length,R=F>>>1;oe<R;){var I=2*(oe+1)-1,V=_[I],Y=I+1,G=_[Y];if(0>s(V,M))Y<F&&0>s(G,V)?(_[oe]=G,_[Y]=M,oe=Y):(_[oe]=V,_[I]=M,oe=I);else if(Y<F&&0>s(G,M))_[oe]=G,_[Y]=M,oe=Y;else break e}}return Q}function s(_,Q){var M=_.sortIndex-Q.sortIndex;return M!==0?M:_.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var a=[],u=[],c=1,d=null,h=3,f=!1,m=!1,g=!1,v=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(_){for(var Q=n(u);Q!==null;){if(Q.callback===null)r(u);else if(Q.startTime<=_)r(u),Q.sortIndex=Q.expirationTime,t(a,Q);else break;Q=n(u)}}function C(_){if(g=!1,b(_),!m)if(n(a)!==null)m=!0,H(S);else{var Q=n(u);Q!==null&&K(C,Q.startTime-_)}}function S(_,Q){m=!1,g&&(g=!1,y(N),N=-1),f=!0;var M=h;try{for(b(Q),d=n(a);d!==null&&(!(d.expirationTime>Q)||_&&!j());){var oe=d.callback;if(typeof oe=="function"){d.callback=null,h=d.priorityLevel;var F=oe(d.expirationTime<=Q);Q=e.unstable_now(),typeof F=="function"?d.callback=F:d===n(a)&&r(a),b(Q)}else r(a);d=n(a)}if(d!==null)var R=!0;else{var I=n(u);I!==null&&K(C,I.startTime-Q),R=!1}return R}finally{d=null,h=M,f=!1}}var k=!1,E=null,N=-1,O=5,T=-1;function j(){return!(e.unstable_now()-T<O)}function A(){if(E!==null){var _=e.unstable_now();T=_;var Q=!0;try{Q=E(!0,_)}finally{Q?z():(k=!1,E=null)}}else k=!1}var z;if(typeof w=="function")z=function(){w(A)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,L=D.port2;D.port1.onmessage=A,z=function(){L.postMessage(null)}}else z=function(){v(A,0)};function H(_){E=_,k||(k=!0,z())}function K(_,Q){N=v(function(){_(e.unstable_now())},Q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(_){_.callback=null},e.unstable_continueExecution=function(){m||f||(m=!0,H(S))},e.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<_?Math.floor(1e3/_):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(a)},e.unstable_next=function(_){switch(h){case 1:case 2:case 3:var Q=3;break;default:Q=h}var M=h;h=Q;try{return _()}finally{h=M}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(_,Q){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var M=h;h=_;try{return Q()}finally{h=M}},e.unstable_scheduleCallback=function(_,Q,M){var oe=e.unstable_now();switch(typeof M=="object"&&M!==null?(M=M.delay,M=typeof M=="number"&&0<M?oe+M:oe):M=oe,_){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=M+F,_={id:c++,callback:Q,priorityLevel:_,startTime:M,expirationTime:F,sortIndex:-1},M>oe?(_.sortIndex=M,t(u,_),n(a)===null&&_===n(u)&&(g?(y(N),N=-1):g=!0,K(C,M-oe))):(_.sortIndex=F,t(a,_),m||f||(m=!0,H(S))),_},e.unstable_shouldYield=j,e.unstable_wrapCallback=function(_){var Q=h;return function(){var M=h;h=Q;try{return _.apply(this,arguments)}finally{h=M}}}})(wO);vO.exports=wO;var q3=vO.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 W3=x,wr=q3;function te(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var bO=new Set,Ed={};function sa(e,t){Eu(e,t),Eu(e+"Capture",t)}function Eu(e,t){for(Ed[e]=t,e=0;e<t.length;e++)bO.add(t[e])}var Ri=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Av=Object.prototype.hasOwnProperty,K3=/^[: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]*$/,nC={},rC={};function Q3(e){return Av.call(rC,e)?!0:Av.call(nC,e)?!1:K3.test(e)?rC[e]=!0:(nC[e]=!0,!1)}function G3(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function J3(e,t,n,r){if(t===null||typeof t>"u"||G3(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Wn(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var hn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){hn[e]=new Wn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];hn[t]=new Wn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){hn[e]=new Wn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){hn[e]=new Wn(e,2,!1,e,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(e){hn[e]=new Wn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){hn[e]=new Wn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){hn[e]=new Wn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){hn[e]=new Wn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){hn[e]=new Wn(e,5,!1,e.toLowerCase(),null,!1,!1)});var Tb=/[\-:]([a-z])/g;function Rb(e){return e[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(e){var t=e.replace(Tb,Rb);hn[t]=new Wn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Tb,Rb);hn[t]=new Wn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Tb,Rb);hn[t]=new Wn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){hn[e]=new Wn(e,1,!1,e.toLowerCase(),null,!1,!1)});hn.xlinkHref=new Wn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){hn[e]=new Wn(e,1,!1,e.toLowerCase(),null,!0,!0)});function Mb(e,t,n,r){var s=hn.hasOwnProperty(t)?hn[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(J3(t,n,s,r)&&(n=null),r||s===null?Q3(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Ai=W3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Zf=Symbol.for("react.element"),La=Symbol.for("react.portal"),$a=Symbol.for("react.fragment"),Ob=Symbol.for("react.strict_mode"),_v=Symbol.for("react.profiler"),kO=Symbol.for("react.provider"),SO=Symbol.for("react.context"),jb=Symbol.for("react.forward_ref"),Iv=Symbol.for("react.suspense"),Dv=Symbol.for("react.suspense_list"),Pb=Symbol.for("react.memo"),Wi=Symbol.for("react.lazy"),CO=Symbol.for("react.offscreen"),sC=Symbol.iterator;function gc(e){return e===null||typeof e!="object"?null:(e=sC&&e[sC]||e["@@iterator"],typeof e=="function"?e:null)}var Rt=Object.assign,Ly;function Lc(e){if(Ly===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ly=t&&t[1]||""}return`
|
|
34
|
+
`+Ly+e}var $y=!1;function zy(e,t){if(!e||$y)return"";$y=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
|
|
35
|
+
`),i=r.stack.split(`
|
|
36
|
+
`),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var a=`
|
|
37
|
+
`+s[o].replace(" at new "," at ");return e.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",e.displayName)),a}while(1<=o&&0<=l);break}}}finally{$y=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Lc(e):""}function Z3(e){switch(e.tag){case 5:return Lc(e.type);case 16:return Lc("Lazy");case 13:return Lc("Suspense");case 19:return Lc("SuspenseList");case 0:case 2:case 15:return e=zy(e.type,!1),e;case 11:return e=zy(e.type.render,!1),e;case 1:return e=zy(e.type,!0),e;default:return""}}function Lv(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case $a:return"Fragment";case La:return"Portal";case _v:return"Profiler";case Ob:return"StrictMode";case Iv:return"Suspense";case Dv:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case SO:return(e.displayName||"Context")+".Consumer";case kO:return(e._context.displayName||"Context")+".Provider";case jb:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Pb:return t=e.displayName||null,t!==null?t:Lv(e.type)||"Memo";case Wi:t=e._payload,e=e._init;try{return Lv(e(t))}catch{}}return null}function Y3(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Lv(t);case 8:return t===Ob?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Do(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function EO(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function X3(e){var t=EO(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Yf(e){e._valueTracker||(e._valueTracker=X3(e))}function NO(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=EO(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Mp(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function $v(e,t){var n=t.checked;return Rt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function iC(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Do(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function TO(e,t){t=t.checked,t!=null&&Mb(e,"checked",t,!1)}function zv(e,t){TO(e,t);var n=Do(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Fv(e,t.type,n):t.hasOwnProperty("defaultValue")&&Fv(e,t.type,Do(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function oC(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Fv(e,t,n){(t!=="number"||Mp(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var $c=Array.isArray;function Ya(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Do(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Bv(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(te(91));return Rt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function lC(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(te(92));if($c(n)){if(1<n.length)throw Error(te(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Do(n)}}function RO(e,t){var n=Do(t.value),r=Do(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function aC(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function MO(e){switch(e){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 Vv(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?MO(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Xf,OO=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Xf=Xf||document.createElement("div"),Xf.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Xf.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Nd(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Zc={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},eF=["Webkit","ms","Moz","O"];Object.keys(Zc).forEach(function(e){eF.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Zc[t]=Zc[e]})});function jO(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Zc.hasOwnProperty(e)&&Zc[e]?(""+t).trim():t+"px"}function PO(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=jO(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var tF=Rt({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 Hv(e,t){if(t){if(tF[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(te(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(te(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(te(61))}if(t.style!=null&&typeof t.style!="object")throw Error(te(62))}}function Uv(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 qv=null;function Ab(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wv=null,Xa=null,eu=null;function uC(e){if(e=Ef(e)){if(typeof Wv!="function")throw Error(te(280));var t=e.stateNode;t&&(t=Sg(t),Wv(e.stateNode,e.type,t))}}function AO(e){Xa?eu?eu.push(e):eu=[e]:Xa=e}function _O(){if(Xa){var e=Xa,t=eu;if(eu=Xa=null,uC(e),t)for(e=0;e<t.length;e++)uC(t[e])}}function IO(e,t){return e(t)}function DO(){}var Fy=!1;function LO(e,t,n){if(Fy)return e(t,n);Fy=!0;try{return IO(e,t,n)}finally{Fy=!1,(Xa!==null||eu!==null)&&(DO(),_O())}}function Td(e,t){var n=e.stateNode;if(n===null)return null;var r=Sg(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(te(231,t,typeof n));return n}var Kv=!1;if(Ri)try{var yc={};Object.defineProperty(yc,"passive",{get:function(){Kv=!0}}),window.addEventListener("test",yc,yc),window.removeEventListener("test",yc,yc)}catch{Kv=!1}function nF(e,t,n,r,s,i,o,l,a){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(c){this.onError(c)}}var Yc=!1,Op=null,jp=!1,Qv=null,rF={onError:function(e){Yc=!0,Op=e}};function sF(e,t,n,r,s,i,o,l,a){Yc=!1,Op=null,nF.apply(rF,arguments)}function iF(e,t,n,r,s,i,o,l,a){if(sF.apply(this,arguments),Yc){if(Yc){var u=Op;Yc=!1,Op=null}else throw Error(te(198));jp||(jp=!0,Qv=u)}}function ia(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function $O(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function cC(e){if(ia(e)!==e)throw Error(te(188))}function oF(e){var t=e.alternate;if(!t){if(t=ia(e),t===null)throw Error(te(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return cC(s),e;if(i===r)return cC(s),t;i=i.sibling}throw Error(te(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o)throw Error(te(189))}}if(n.alternate!==r)throw Error(te(190))}if(n.tag!==3)throw Error(te(188));return n.stateNode.current===n?e:t}function zO(e){return e=oF(e),e!==null?FO(e):null}function FO(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=FO(e);if(t!==null)return t;e=e.sibling}return null}var BO=wr.unstable_scheduleCallback,dC=wr.unstable_cancelCallback,lF=wr.unstable_shouldYield,aF=wr.unstable_requestPaint,_t=wr.unstable_now,uF=wr.unstable_getCurrentPriorityLevel,_b=wr.unstable_ImmediatePriority,VO=wr.unstable_UserBlockingPriority,Pp=wr.unstable_NormalPriority,cF=wr.unstable_LowPriority,HO=wr.unstable_IdlePriority,vg=null,Fs=null;function dF(e){if(Fs&&typeof Fs.onCommitFiberRoot=="function")try{Fs.onCommitFiberRoot(vg,e,void 0,(e.current.flags&128)===128)}catch{}}var hs=Math.clz32?Math.clz32:pF,fF=Math.log,hF=Math.LN2;function pF(e){return e>>>=0,e===0?32:31-(fF(e)/hF|0)|0}var eh=64,th=4194304;function zc(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ap(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=zc(l):(i&=o,i!==0&&(r=zc(i)))}else o=n&~s,o!==0?r=zc(o):i!==0&&(r=zc(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-hs(t),s=1<<n,r|=e[n],t&=~s;return r}function mF(e,t){switch(e){case 1:case 2:case 4:return t+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 t+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 gF(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-hs(i),l=1<<o,a=s[o];a===-1?(!(l&n)||l&r)&&(s[o]=mF(l,t)):a<=t&&(e.expiredLanes|=l),i&=~l}}function Gv(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function UO(){var e=eh;return eh<<=1,!(eh&4194240)&&(eh=64),e}function By(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Sf(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-hs(t),e[t]=n}function yF(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var s=31-hs(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function Ib(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-hs(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var at=0;function qO(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var WO,Db,KO,QO,GO,Jv=!1,nh=[],wo=null,bo=null,ko=null,Rd=new Map,Md=new Map,Yi=[],xF="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 fC(e,t){switch(e){case"focusin":case"focusout":wo=null;break;case"dragenter":case"dragleave":bo=null;break;case"mouseover":case"mouseout":ko=null;break;case"pointerover":case"pointerout":Rd.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Md.delete(t.pointerId)}}function xc(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=Ef(t),t!==null&&Db(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function vF(e,t,n,r,s){switch(t){case"focusin":return wo=xc(wo,e,t,n,r,s),!0;case"dragenter":return bo=xc(bo,e,t,n,r,s),!0;case"mouseover":return ko=xc(ko,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return Rd.set(i,xc(Rd.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Md.set(i,xc(Md.get(i)||null,e,t,n,r,s)),!0}return!1}function JO(e){var t=yl(e.target);if(t!==null){var n=ia(t);if(n!==null){if(t=n.tag,t===13){if(t=$O(n),t!==null){e.blockedOn=t,GO(e.priority,function(){KO(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Yh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Zv(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);qv=r,n.target.dispatchEvent(r),qv=null}else return t=Ef(n),t!==null&&Db(t),e.blockedOn=n,!1;t.shift()}return!0}function hC(e,t,n){Yh(e)&&n.delete(t)}function wF(){Jv=!1,wo!==null&&Yh(wo)&&(wo=null),bo!==null&&Yh(bo)&&(bo=null),ko!==null&&Yh(ko)&&(ko=null),Rd.forEach(hC),Md.forEach(hC)}function vc(e,t){e.blockedOn===t&&(e.blockedOn=null,Jv||(Jv=!0,wr.unstable_scheduleCallback(wr.unstable_NormalPriority,wF)))}function Od(e){function t(s){return vc(s,e)}if(0<nh.length){vc(nh[0],e);for(var n=1;n<nh.length;n++){var r=nh[n];r.blockedOn===e&&(r.blockedOn=null)}}for(wo!==null&&vc(wo,e),bo!==null&&vc(bo,e),ko!==null&&vc(ko,e),Rd.forEach(t),Md.forEach(t),n=0;n<Yi.length;n++)r=Yi[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Yi.length&&(n=Yi[0],n.blockedOn===null);)JO(n),n.blockedOn===null&&Yi.shift()}var tu=Ai.ReactCurrentBatchConfig,_p=!0;function bF(e,t,n,r){var s=at,i=tu.transition;tu.transition=null;try{at=1,Lb(e,t,n,r)}finally{at=s,tu.transition=i}}function kF(e,t,n,r){var s=at,i=tu.transition;tu.transition=null;try{at=4,Lb(e,t,n,r)}finally{at=s,tu.transition=i}}function Lb(e,t,n,r){if(_p){var s=Zv(e,t,n,r);if(s===null)Zy(e,t,r,Ip,n),fC(e,r);else if(vF(s,e,t,n,r))r.stopPropagation();else if(fC(e,r),t&4&&-1<xF.indexOf(e)){for(;s!==null;){var i=Ef(s);if(i!==null&&WO(i),i=Zv(e,t,n,r),i===null&&Zy(e,t,r,Ip,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Zy(e,t,r,null,n)}}var Ip=null;function Zv(e,t,n,r){if(Ip=null,e=Ab(r),e=yl(e),e!==null)if(t=ia(e),t===null)e=null;else if(n=t.tag,n===13){if(e=$O(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Ip=e,null}function ZO(e){switch(e){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(uF()){case _b:return 1;case VO:return 4;case Pp:case cF:return 16;case HO:return 536870912;default:return 16}default:return 16}}var ho=null,$b=null,Xh=null;function YO(){if(Xh)return Xh;var e,t=$b,n=t.length,r,s="value"in ho?ho.value:ho.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return Xh=s.slice(e,1<r?1-r:void 0)}function ep(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function rh(){return!0}function pC(){return!1}function Er(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?rh:pC,this.isPropagationStopped=pC,this}return Rt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=rh)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=rh)},persist:function(){},isPersistent:rh}),t}var ec={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zb=Er(ec),Cf=Rt({},ec,{view:0,detail:0}),SF=Er(Cf),Vy,Hy,wc,wg=Rt({},Cf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fb,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==wc&&(wc&&e.type==="mousemove"?(Vy=e.screenX-wc.screenX,Hy=e.screenY-wc.screenY):Hy=Vy=0,wc=e),Vy)},movementY:function(e){return"movementY"in e?e.movementY:Hy}}),mC=Er(wg),CF=Rt({},wg,{dataTransfer:0}),EF=Er(CF),NF=Rt({},Cf,{relatedTarget:0}),Uy=Er(NF),TF=Rt({},ec,{animationName:0,elapsedTime:0,pseudoElement:0}),RF=Er(TF),MF=Rt({},ec,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),OF=Er(MF),jF=Rt({},ec,{data:0}),gC=Er(jF),PF={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},AF={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"},_F={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function IF(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=_F[e])?!!t[e]:!1}function Fb(){return IF}var DF=Rt({},Cf,{key:function(e){if(e.key){var t=PF[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ep(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?AF[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fb,charCode:function(e){return e.type==="keypress"?ep(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ep(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),LF=Er(DF),$F=Rt({},wg,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),yC=Er($F),zF=Rt({},Cf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fb}),FF=Er(zF),BF=Rt({},ec,{propertyName:0,elapsedTime:0,pseudoElement:0}),VF=Er(BF),HF=Rt({},wg,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),UF=Er(HF),qF=[9,13,27,32],Bb=Ri&&"CompositionEvent"in window,Xc=null;Ri&&"documentMode"in document&&(Xc=document.documentMode);var WF=Ri&&"TextEvent"in window&&!Xc,XO=Ri&&(!Bb||Xc&&8<Xc&&11>=Xc),xC=" ",vC=!1;function ej(e,t){switch(e){case"keyup":return qF.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tj(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var za=!1;function KF(e,t){switch(e){case"compositionend":return tj(t);case"keypress":return t.which!==32?null:(vC=!0,xC);case"textInput":return e=t.data,e===xC&&vC?null:e;default:return null}}function QF(e,t){if(za)return e==="compositionend"||!Bb&&ej(e,t)?(e=YO(),Xh=$b=ho=null,za=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return XO&&t.locale!=="ko"?null:t.data;default:return null}}var GF={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 wC(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!GF[e.type]:t==="textarea"}function nj(e,t,n,r){AO(r),t=Dp(t,"onChange"),0<t.length&&(n=new zb("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var ed=null,jd=null;function JF(e){hj(e,0)}function bg(e){var t=Va(e);if(NO(t))return e}function ZF(e,t){if(e==="change")return t}var rj=!1;if(Ri){var qy;if(Ri){var Wy="oninput"in document;if(!Wy){var bC=document.createElement("div");bC.setAttribute("oninput","return;"),Wy=typeof bC.oninput=="function"}qy=Wy}else qy=!1;rj=qy&&(!document.documentMode||9<document.documentMode)}function kC(){ed&&(ed.detachEvent("onpropertychange",sj),jd=ed=null)}function sj(e){if(e.propertyName==="value"&&bg(jd)){var t=[];nj(t,jd,e,Ab(e)),LO(JF,t)}}function YF(e,t,n){e==="focusin"?(kC(),ed=t,jd=n,ed.attachEvent("onpropertychange",sj)):e==="focusout"&&kC()}function XF(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return bg(jd)}function e4(e,t){if(e==="click")return bg(t)}function t4(e,t){if(e==="input"||e==="change")return bg(t)}function n4(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var xs=typeof Object.is=="function"?Object.is:n4;function Pd(e,t){if(xs(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!Av.call(t,s)||!xs(e[s],t[s]))return!1}return!0}function SC(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function CC(e,t){var n=SC(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=SC(n)}}function ij(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ij(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function oj(){for(var e=window,t=Mp();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Mp(e.document)}return t}function Vb(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function r4(e){var t=oj(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ij(n.ownerDocument.documentElement,n)){if(r!==null&&Vb(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=CC(n,i);var o=CC(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var s4=Ri&&"documentMode"in document&&11>=document.documentMode,Fa=null,Yv=null,td=null,Xv=!1;function EC(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Xv||Fa==null||Fa!==Mp(r)||(r=Fa,"selectionStart"in r&&Vb(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),td&&Pd(td,r)||(td=r,r=Dp(Yv,"onSelect"),0<r.length&&(t=new zb("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Fa)))}function sh(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ba={animationend:sh("Animation","AnimationEnd"),animationiteration:sh("Animation","AnimationIteration"),animationstart:sh("Animation","AnimationStart"),transitionend:sh("Transition","TransitionEnd")},Ky={},lj={};Ri&&(lj=document.createElement("div").style,"AnimationEvent"in window||(delete Ba.animationend.animation,delete Ba.animationiteration.animation,delete Ba.animationstart.animation),"TransitionEvent"in window||delete Ba.transitionend.transition);function kg(e){if(Ky[e])return Ky[e];if(!Ba[e])return e;var t=Ba[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in lj)return Ky[e]=t[n];return e}var aj=kg("animationend"),uj=kg("animationiteration"),cj=kg("animationstart"),dj=kg("transitionend"),fj=new Map,NC="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 Qo(e,t){fj.set(e,t),sa(t,[e])}for(var Qy=0;Qy<NC.length;Qy++){var Gy=NC[Qy],i4=Gy.toLowerCase(),o4=Gy[0].toUpperCase()+Gy.slice(1);Qo(i4,"on"+o4)}Qo(aj,"onAnimationEnd");Qo(uj,"onAnimationIteration");Qo(cj,"onAnimationStart");Qo("dblclick","onDoubleClick");Qo("focusin","onFocus");Qo("focusout","onBlur");Qo(dj,"onTransitionEnd");Eu("onMouseEnter",["mouseout","mouseover"]);Eu("onMouseLeave",["mouseout","mouseover"]);Eu("onPointerEnter",["pointerout","pointerover"]);Eu("onPointerLeave",["pointerout","pointerover"]);sa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));sa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));sa("onBeforeInput",["compositionend","keypress","textInput","paste"]);sa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));sa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));sa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Fc="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(" "),l4=new Set("cancel close invalid load scroll toggle".split(" ").concat(Fc));function TC(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,iF(r,t,void 0,e),e.currentTarget=null}function hj(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],a=l.instance,u=l.currentTarget;if(l=l.listener,a!==i&&s.isPropagationStopped())break e;TC(s,l,u),i=a}else for(o=0;o<r.length;o++){if(l=r[o],a=l.instance,u=l.currentTarget,l=l.listener,a!==i&&s.isPropagationStopped())break e;TC(s,l,u),i=a}}}if(jp)throw e=Qv,jp=!1,Qv=null,e}function xt(e,t){var n=t[s0];n===void 0&&(n=t[s0]=new Set);var r=e+"__bubble";n.has(r)||(pj(t,e,2,!1),n.add(r))}function Jy(e,t,n){var r=0;t&&(r|=4),pj(n,e,r,t)}var ih="_reactListening"+Math.random().toString(36).slice(2);function Ad(e){if(!e[ih]){e[ih]=!0,bO.forEach(function(n){n!=="selectionchange"&&(l4.has(n)||Jy(n,!1,e),Jy(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ih]||(t[ih]=!0,Jy("selectionchange",!1,t))}}function pj(e,t,n,r){switch(ZO(t)){case 1:var s=bF;break;case 4:s=kF;break;default:s=Lb}n=s.bind(null,t,n,e),s=void 0,!Kv||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function Zy(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var a=o.tag;if((a===3||a===4)&&(a=o.stateNode.containerInfo,a===s||a.nodeType===8&&a.parentNode===s))return;o=o.return}for(;l!==null;){if(o=yl(l),o===null)return;if(a=o.tag,a===5||a===6){r=i=o;continue e}l=l.parentNode}}r=r.return}LO(function(){var u=i,c=Ab(n),d=[];e:{var h=fj.get(e);if(h!==void 0){var f=zb,m=e;switch(e){case"keypress":if(ep(n)===0)break e;case"keydown":case"keyup":f=LF;break;case"focusin":m="focus",f=Uy;break;case"focusout":m="blur",f=Uy;break;case"beforeblur":case"afterblur":f=Uy;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=mC;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=EF;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=FF;break;case aj:case uj:case cj:f=RF;break;case dj:f=VF;break;case"scroll":f=SF;break;case"wheel":f=UF;break;case"copy":case"cut":case"paste":f=OF;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=yC}var g=(t&4)!==0,v=!g&&e==="scroll",y=g?h!==null?h+"Capture":null:h;g=[];for(var w=u,b;w!==null;){b=w;var C=b.stateNode;if(b.tag===5&&C!==null&&(b=C,y!==null&&(C=Td(w,y),C!=null&&g.push(_d(w,C,b)))),v)break;w=w.return}0<g.length&&(h=new f(h,m,null,n,c),d.push({event:h,listeners:g}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",f=e==="mouseout"||e==="pointerout",h&&n!==qv&&(m=n.relatedTarget||n.fromElement)&&(yl(m)||m[Mi]))break e;if((f||h)&&(h=c.window===c?c:(h=c.ownerDocument)?h.defaultView||h.parentWindow:window,f?(m=n.relatedTarget||n.toElement,f=u,m=m?yl(m):null,m!==null&&(v=ia(m),m!==v||m.tag!==5&&m.tag!==6)&&(m=null)):(f=null,m=u),f!==m)){if(g=mC,C="onMouseLeave",y="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(g=yC,C="onPointerLeave",y="onPointerEnter",w="pointer"),v=f==null?h:Va(f),b=m==null?h:Va(m),h=new g(C,w+"leave",f,n,c),h.target=v,h.relatedTarget=b,C=null,yl(c)===u&&(g=new g(y,w+"enter",m,n,c),g.target=b,g.relatedTarget=v,C=g),v=C,f&&m)t:{for(g=f,y=m,w=0,b=g;b;b=ya(b))w++;for(b=0,C=y;C;C=ya(C))b++;for(;0<w-b;)g=ya(g),w--;for(;0<b-w;)y=ya(y),b--;for(;w--;){if(g===y||y!==null&&g===y.alternate)break t;g=ya(g),y=ya(y)}g=null}else g=null;f!==null&&RC(d,h,f,g,!1),m!==null&&v!==null&&RC(d,v,m,g,!0)}}e:{if(h=u?Va(u):window,f=h.nodeName&&h.nodeName.toLowerCase(),f==="select"||f==="input"&&h.type==="file")var S=ZF;else if(wC(h))if(rj)S=t4;else{S=XF;var k=YF}else(f=h.nodeName)&&f.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(S=e4);if(S&&(S=S(e,u))){nj(d,S,n,c);break e}k&&k(e,h,u),e==="focusout"&&(k=h._wrapperState)&&k.controlled&&h.type==="number"&&Fv(h,"number",h.value)}switch(k=u?Va(u):window,e){case"focusin":(wC(k)||k.contentEditable==="true")&&(Fa=k,Yv=u,td=null);break;case"focusout":td=Yv=Fa=null;break;case"mousedown":Xv=!0;break;case"contextmenu":case"mouseup":case"dragend":Xv=!1,EC(d,n,c);break;case"selectionchange":if(s4)break;case"keydown":case"keyup":EC(d,n,c)}var E;if(Bb)e:{switch(e){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else za?ej(e,n)&&(N="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(XO&&n.locale!=="ko"&&(za||N!=="onCompositionStart"?N==="onCompositionEnd"&&za&&(E=YO()):(ho=c,$b="value"in ho?ho.value:ho.textContent,za=!0)),k=Dp(u,N),0<k.length&&(N=new gC(N,e,null,n,c),d.push({event:N,listeners:k}),E?N.data=E:(E=tj(n),E!==null&&(N.data=E)))),(E=WF?KF(e,n):QF(e,n))&&(u=Dp(u,"onBeforeInput"),0<u.length&&(c=new gC("onBeforeInput","beforeinput",null,n,c),d.push({event:c,listeners:u}),c.data=E))}hj(d,t)})}function _d(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Dp(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Td(e,n),i!=null&&r.unshift(_d(e,i,s)),i=Td(e,t),i!=null&&r.push(_d(e,i,s))),e=e.return}return r}function ya(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function RC(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var l=n,a=l.alternate,u=l.stateNode;if(a!==null&&a===r)break;l.tag===5&&u!==null&&(l=u,s?(a=Td(n,i),a!=null&&o.unshift(_d(n,a,l))):s||(a=Td(n,i),a!=null&&o.push(_d(n,a,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var a4=/\r\n?/g,u4=/\u0000|\uFFFD/g;function MC(e){return(typeof e=="string"?e:""+e).replace(a4,`
|
|
38
|
+
`).replace(u4,"")}function oh(e,t,n){if(t=MC(t),MC(e)!==t&&n)throw Error(te(425))}function Lp(){}var e0=null,t0=null;function n0(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var r0=typeof setTimeout=="function"?setTimeout:void 0,c4=typeof clearTimeout=="function"?clearTimeout:void 0,OC=typeof Promise=="function"?Promise:void 0,d4=typeof queueMicrotask=="function"?queueMicrotask:typeof OC<"u"?function(e){return OC.resolve(null).then(e).catch(f4)}:r0;function f4(e){setTimeout(function(){throw e})}function Yy(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),Od(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Od(t)}function So(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function jC(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var tc=Math.random().toString(36).slice(2),Ds="__reactFiber$"+tc,Id="__reactProps$"+tc,Mi="__reactContainer$"+tc,s0="__reactEvents$"+tc,h4="__reactListeners$"+tc,p4="__reactHandles$"+tc;function yl(e){var t=e[Ds];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Mi]||n[Ds]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=jC(e);e!==null;){if(n=e[Ds])return n;e=jC(e)}return t}e=n,n=e.parentNode}return null}function Ef(e){return e=e[Ds]||e[Mi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Va(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(te(33))}function Sg(e){return e[Id]||null}var i0=[],Ha=-1;function Go(e){return{current:e}}function wt(e){0>Ha||(e.current=i0[Ha],i0[Ha]=null,Ha--)}function gt(e,t){Ha++,i0[Ha]=e.current,e.current=t}var Lo={},Mn=Go(Lo),tr=Go(!1),Bl=Lo;function Nu(e,t){var n=e.type.contextTypes;if(!n)return Lo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function nr(e){return e=e.childContextTypes,e!=null}function $p(){wt(tr),wt(Mn)}function PC(e,t,n){if(Mn.current!==Lo)throw Error(te(168));gt(Mn,t),gt(tr,n)}function mj(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(te(108,Y3(e)||"Unknown",s));return Rt({},n,r)}function zp(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Lo,Bl=Mn.current,gt(Mn,e),gt(tr,tr.current),!0}function AC(e,t,n){var r=e.stateNode;if(!r)throw Error(te(169));n?(e=mj(e,t,Bl),r.__reactInternalMemoizedMergedChildContext=e,wt(tr),wt(Mn),gt(Mn,e)):wt(tr),gt(tr,n)}var di=null,Cg=!1,Xy=!1;function gj(e){di===null?di=[e]:di.push(e)}function m4(e){Cg=!0,gj(e)}function Jo(){if(!Xy&&di!==null){Xy=!0;var e=0,t=at;try{var n=di;for(at=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}di=null,Cg=!1}catch(s){throw di!==null&&(di=di.slice(e+1)),BO(_b,Jo),s}finally{at=t,Xy=!1}}return null}var Ua=[],qa=0,Fp=null,Bp=0,Lr=[],$r=0,Vl=null,yi=1,xi="";function dl(e,t){Ua[qa++]=Bp,Ua[qa++]=Fp,Fp=e,Bp=t}function yj(e,t,n){Lr[$r++]=yi,Lr[$r++]=xi,Lr[$r++]=Vl,Vl=e;var r=yi;e=xi;var s=32-hs(r)-1;r&=~(1<<s),n+=1;var i=32-hs(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,yi=1<<32-hs(t)+s|n<<s|r,xi=i+e}else yi=1<<i|n<<s|r,xi=e}function Hb(e){e.return!==null&&(dl(e,1),yj(e,1,0))}function Ub(e){for(;e===Fp;)Fp=Ua[--qa],Ua[qa]=null,Bp=Ua[--qa],Ua[qa]=null;for(;e===Vl;)Vl=Lr[--$r],Lr[$r]=null,xi=Lr[--$r],Lr[$r]=null,yi=Lr[--$r],Lr[$r]=null}var yr=null,mr=null,kt=!1,is=null;function xj(e,t){var n=Vr(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function _C(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,yr=e,mr=So(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,yr=e,mr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Vl!==null?{id:yi,overflow:xi}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Vr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,yr=e,mr=null,!0):!1;default:return!1}}function o0(e){return(e.mode&1)!==0&&(e.flags&128)===0}function l0(e){if(kt){var t=mr;if(t){var n=t;if(!_C(e,t)){if(o0(e))throw Error(te(418));t=So(n.nextSibling);var r=yr;t&&_C(e,t)?xj(r,n):(e.flags=e.flags&-4097|2,kt=!1,yr=e)}}else{if(o0(e))throw Error(te(418));e.flags=e.flags&-4097|2,kt=!1,yr=e}}}function IC(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;yr=e}function lh(e){if(e!==yr)return!1;if(!kt)return IC(e),kt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!n0(e.type,e.memoizedProps)),t&&(t=mr)){if(o0(e))throw vj(),Error(te(418));for(;t;)xj(e,t),t=So(t.nextSibling)}if(IC(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(te(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){mr=So(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}mr=null}}else mr=yr?So(e.stateNode.nextSibling):null;return!0}function vj(){for(var e=mr;e;)e=So(e.nextSibling)}function Tu(){mr=yr=null,kt=!1}function qb(e){is===null?is=[e]:is.push(e)}var g4=Ai.ReactCurrentBatchConfig;function bc(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(te(309));var r=n.stateNode}if(!r)throw Error(te(147,e));var s=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(te(284));if(!n._owner)throw Error(te(290,e))}return e}function ah(e,t){throw e=Object.prototype.toString.call(t),Error(te(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function DC(e){var t=e._init;return t(e._payload)}function wj(e){function t(y,w){if(e){var b=y.deletions;b===null?(y.deletions=[w],y.flags|=16):b.push(w)}}function n(y,w){if(!e)return null;for(;w!==null;)t(y,w),w=w.sibling;return null}function r(y,w){for(y=new Map;w!==null;)w.key!==null?y.set(w.key,w):y.set(w.index,w),w=w.sibling;return y}function s(y,w){return y=To(y,w),y.index=0,y.sibling=null,y}function i(y,w,b){return y.index=b,e?(b=y.alternate,b!==null?(b=b.index,b<w?(y.flags|=2,w):b):(y.flags|=2,w)):(y.flags|=1048576,w)}function o(y){return e&&y.alternate===null&&(y.flags|=2),y}function l(y,w,b,C){return w===null||w.tag!==6?(w=ox(b,y.mode,C),w.return=y,w):(w=s(w,b),w.return=y,w)}function a(y,w,b,C){var S=b.type;return S===$a?c(y,w,b.props.children,C,b.key):w!==null&&(w.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Wi&&DC(S)===w.type)?(C=s(w,b.props),C.ref=bc(y,w,b),C.return=y,C):(C=lp(b.type,b.key,b.props,null,y.mode,C),C.ref=bc(y,w,b),C.return=y,C)}function u(y,w,b,C){return w===null||w.tag!==4||w.stateNode.containerInfo!==b.containerInfo||w.stateNode.implementation!==b.implementation?(w=lx(b,y.mode,C),w.return=y,w):(w=s(w,b.children||[]),w.return=y,w)}function c(y,w,b,C,S){return w===null||w.tag!==7?(w=_l(b,y.mode,C,S),w.return=y,w):(w=s(w,b),w.return=y,w)}function d(y,w,b){if(typeof w=="string"&&w!==""||typeof w=="number")return w=ox(""+w,y.mode,b),w.return=y,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Zf:return b=lp(w.type,w.key,w.props,null,y.mode,b),b.ref=bc(y,null,w),b.return=y,b;case La:return w=lx(w,y.mode,b),w.return=y,w;case Wi:var C=w._init;return d(y,C(w._payload),b)}if($c(w)||gc(w))return w=_l(w,y.mode,b,null),w.return=y,w;ah(y,w)}return null}function h(y,w,b,C){var S=w!==null?w.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return S!==null?null:l(y,w,""+b,C);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Zf:return b.key===S?a(y,w,b,C):null;case La:return b.key===S?u(y,w,b,C):null;case Wi:return S=b._init,h(y,w,S(b._payload),C)}if($c(b)||gc(b))return S!==null?null:c(y,w,b,C,null);ah(y,b)}return null}function f(y,w,b,C,S){if(typeof C=="string"&&C!==""||typeof C=="number")return y=y.get(b)||null,l(w,y,""+C,S);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Zf:return y=y.get(C.key===null?b:C.key)||null,a(w,y,C,S);case La:return y=y.get(C.key===null?b:C.key)||null,u(w,y,C,S);case Wi:var k=C._init;return f(y,w,b,k(C._payload),S)}if($c(C)||gc(C))return y=y.get(b)||null,c(w,y,C,S,null);ah(w,C)}return null}function m(y,w,b,C){for(var S=null,k=null,E=w,N=w=0,O=null;E!==null&&N<b.length;N++){E.index>N?(O=E,E=null):O=E.sibling;var T=h(y,E,b[N],C);if(T===null){E===null&&(E=O);break}e&&E&&T.alternate===null&&t(y,E),w=i(T,w,N),k===null?S=T:k.sibling=T,k=T,E=O}if(N===b.length)return n(y,E),kt&&dl(y,N),S;if(E===null){for(;N<b.length;N++)E=d(y,b[N],C),E!==null&&(w=i(E,w,N),k===null?S=E:k.sibling=E,k=E);return kt&&dl(y,N),S}for(E=r(y,E);N<b.length;N++)O=f(E,y,N,b[N],C),O!==null&&(e&&O.alternate!==null&&E.delete(O.key===null?N:O.key),w=i(O,w,N),k===null?S=O:k.sibling=O,k=O);return e&&E.forEach(function(j){return t(y,j)}),kt&&dl(y,N),S}function g(y,w,b,C){var S=gc(b);if(typeof S!="function")throw Error(te(150));if(b=S.call(b),b==null)throw Error(te(151));for(var k=S=null,E=w,N=w=0,O=null,T=b.next();E!==null&&!T.done;N++,T=b.next()){E.index>N?(O=E,E=null):O=E.sibling;var j=h(y,E,T.value,C);if(j===null){E===null&&(E=O);break}e&&E&&j.alternate===null&&t(y,E),w=i(j,w,N),k===null?S=j:k.sibling=j,k=j,E=O}if(T.done)return n(y,E),kt&&dl(y,N),S;if(E===null){for(;!T.done;N++,T=b.next())T=d(y,T.value,C),T!==null&&(w=i(T,w,N),k===null?S=T:k.sibling=T,k=T);return kt&&dl(y,N),S}for(E=r(y,E);!T.done;N++,T=b.next())T=f(E,y,N,T.value,C),T!==null&&(e&&T.alternate!==null&&E.delete(T.key===null?N:T.key),w=i(T,w,N),k===null?S=T:k.sibling=T,k=T);return e&&E.forEach(function(A){return t(y,A)}),kt&&dl(y,N),S}function v(y,w,b,C){if(typeof b=="object"&&b!==null&&b.type===$a&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Zf:e:{for(var S=b.key,k=w;k!==null;){if(k.key===S){if(S=b.type,S===$a){if(k.tag===7){n(y,k.sibling),w=s(k,b.props.children),w.return=y,y=w;break e}}else if(k.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Wi&&DC(S)===k.type){n(y,k.sibling),w=s(k,b.props),w.ref=bc(y,k,b),w.return=y,y=w;break e}n(y,k);break}else t(y,k);k=k.sibling}b.type===$a?(w=_l(b.props.children,y.mode,C,b.key),w.return=y,y=w):(C=lp(b.type,b.key,b.props,null,y.mode,C),C.ref=bc(y,w,b),C.return=y,y=C)}return o(y);case La:e:{for(k=b.key;w!==null;){if(w.key===k)if(w.tag===4&&w.stateNode.containerInfo===b.containerInfo&&w.stateNode.implementation===b.implementation){n(y,w.sibling),w=s(w,b.children||[]),w.return=y,y=w;break e}else{n(y,w);break}else t(y,w);w=w.sibling}w=lx(b,y.mode,C),w.return=y,y=w}return o(y);case Wi:return k=b._init,v(y,w,k(b._payload),C)}if($c(b))return m(y,w,b,C);if(gc(b))return g(y,w,b,C);ah(y,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,w!==null&&w.tag===6?(n(y,w.sibling),w=s(w,b),w.return=y,y=w):(n(y,w),w=ox(b,y.mode,C),w.return=y,y=w),o(y)):n(y,w)}return v}var Ru=wj(!0),bj=wj(!1),Vp=Go(null),Hp=null,Wa=null,Wb=null;function Kb(){Wb=Wa=Hp=null}function Qb(e){var t=Vp.current;wt(Vp),e._currentValue=t}function a0(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function nu(e,t){Hp=e,Wb=Wa=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(er=!0),e.firstContext=null)}function Kr(e){var t=e._currentValue;if(Wb!==e)if(e={context:e,memoizedValue:t,next:null},Wa===null){if(Hp===null)throw Error(te(308));Wa=e,Hp.dependencies={lanes:0,firstContext:e}}else Wa=Wa.next=e;return t}var xl=null;function Gb(e){xl===null?xl=[e]:xl.push(e)}function kj(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Gb(t)):(n.next=s.next,s.next=n),t.interleaved=n,Oi(e,r)}function Oi(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ki=!1;function Jb(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Sj(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Si(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Co(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ze&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Oi(e,n)}return s=r.interleaved,s===null?(t.next=t,Gb(r)):(t.next=s.next,s.next=t),r.interleaved=t,Oi(e,n)}function tp(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ib(e,n)}}function LC(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Up(e,t,n,r){var s=e.updateQueue;Ki=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var a=l,u=a.next;a.next=null,o===null?i=u:o.next=u,o=a;var c=e.alternate;c!==null&&(c=c.updateQueue,l=c.lastBaseUpdate,l!==o&&(l===null?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=a))}if(i!==null){var d=s.baseState;o=0,c=u=a=null,l=i;do{var h=l.lane,f=l.eventTime;if((r&h)===h){c!==null&&(c=c.next={eventTime:f,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,g=l;switch(h=t,f=n,g.tag){case 1:if(m=g.payload,typeof m=="function"){d=m.call(f,d,h);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,h=typeof m=="function"?m.call(f,d,h):m,h==null)break e;d=Rt({},d,h);break e;case 2:Ki=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[l]:h.push(l))}else f={eventTime:f,lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(u=c=f,a=d):c=c.next=f,o|=h;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;h=l,l=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(c===null&&(a=d),s.baseState=a,s.firstBaseUpdate=u,s.lastBaseUpdate=c,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Ul|=o,e.lanes=o,e.memoizedState=d}}function $C(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(te(191,s));s.call(r)}}}var Nf={},Bs=Go(Nf),Dd=Go(Nf),Ld=Go(Nf);function vl(e){if(e===Nf)throw Error(te(174));return e}function Zb(e,t){switch(gt(Ld,t),gt(Dd,e),gt(Bs,Nf),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Vv(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Vv(t,e)}wt(Bs),gt(Bs,t)}function Mu(){wt(Bs),wt(Dd),wt(Ld)}function Cj(e){vl(Ld.current);var t=vl(Bs.current),n=Vv(t,e.type);t!==n&&(gt(Dd,e),gt(Bs,n))}function Yb(e){Dd.current===e&&(wt(Bs),wt(Dd))}var Et=Go(0);function qp(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ex=[];function Xb(){for(var e=0;e<ex.length;e++)ex[e]._workInProgressVersionPrimary=null;ex.length=0}var np=Ai.ReactCurrentDispatcher,tx=Ai.ReactCurrentBatchConfig,Hl=0,Tt=null,qt=null,Jt=null,Wp=!1,nd=!1,$d=0,y4=0;function wn(){throw Error(te(321))}function ek(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!xs(e[n],t[n]))return!1;return!0}function tk(e,t,n,r,s,i){if(Hl=i,Tt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,np.current=e===null||e.memoizedState===null?b4:k4,e=n(r,s),nd){i=0;do{if(nd=!1,$d=0,25<=i)throw Error(te(301));i+=1,Jt=qt=null,t.updateQueue=null,np.current=S4,e=n(r,s)}while(nd)}if(np.current=Kp,t=qt!==null&&qt.next!==null,Hl=0,Jt=qt=Tt=null,Wp=!1,t)throw Error(te(300));return e}function nk(){var e=$d!==0;return $d=0,e}function Ts(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jt===null?Tt.memoizedState=Jt=e:Jt=Jt.next=e,Jt}function Qr(){if(qt===null){var e=Tt.alternate;e=e!==null?e.memoizedState:null}else e=qt.next;var t=Jt===null?Tt.memoizedState:Jt.next;if(t!==null)Jt=t,qt=e;else{if(e===null)throw Error(te(310));qt=e,e={memoizedState:qt.memoizedState,baseState:qt.baseState,baseQueue:qt.baseQueue,queue:qt.queue,next:null},Jt===null?Tt.memoizedState=Jt=e:Jt=Jt.next=e}return Jt}function zd(e,t){return typeof t=="function"?t(e):t}function nx(e){var t=Qr(),n=t.queue;if(n===null)throw Error(te(311));n.lastRenderedReducer=e;var r=qt,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=o=null,a=null,u=i;do{var c=u.lane;if((Hl&c)===c)a!==null&&(a=a.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var d={lane:c,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};a===null?(l=a=d,o=r):a=a.next=d,Tt.lanes|=c,Ul|=c}u=u.next}while(u!==null&&u!==i);a===null?o=r:a.next=l,xs(r,t.memoizedState)||(er=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=a,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,Tt.lanes|=i,Ul|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function rx(e){var t=Qr(),n=t.queue;if(n===null)throw Error(te(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);xs(i,t.memoizedState)||(er=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function Ej(){}function Nj(e,t){var n=Tt,r=Qr(),s=t(),i=!xs(r.memoizedState,s);if(i&&(r.memoizedState=s,er=!0),r=r.queue,rk(Mj.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Jt!==null&&Jt.memoizedState.tag&1){if(n.flags|=2048,Fd(9,Rj.bind(null,n,r,s,t),void 0,null),en===null)throw Error(te(349));Hl&30||Tj(n,t,s)}return s}function Tj(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Tt.updateQueue,t===null?(t={lastEffect:null,stores:null},Tt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Rj(e,t,n,r){t.value=n,t.getSnapshot=r,Oj(t)&&jj(e)}function Mj(e,t,n){return n(function(){Oj(t)&&jj(e)})}function Oj(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xs(e,n)}catch{return!0}}function jj(e){var t=Oi(e,1);t!==null&&ps(t,e,1,-1)}function zC(e){var t=Ts();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:zd,lastRenderedState:e},t.queue=e,e=e.dispatch=w4.bind(null,Tt,e),[t.memoizedState,e]}function Fd(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Tt.updateQueue,t===null?(t={lastEffect:null,stores:null},Tt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Pj(){return Qr().memoizedState}function rp(e,t,n,r){var s=Ts();Tt.flags|=e,s.memoizedState=Fd(1|t,n,void 0,r===void 0?null:r)}function Eg(e,t,n,r){var s=Qr();r=r===void 0?null:r;var i=void 0;if(qt!==null){var o=qt.memoizedState;if(i=o.destroy,r!==null&&ek(r,o.deps)){s.memoizedState=Fd(t,n,i,r);return}}Tt.flags|=e,s.memoizedState=Fd(1|t,n,i,r)}function FC(e,t){return rp(8390656,8,e,t)}function rk(e,t){return Eg(2048,8,e,t)}function Aj(e,t){return Eg(4,2,e,t)}function _j(e,t){return Eg(4,4,e,t)}function Ij(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Dj(e,t,n){return n=n!=null?n.concat([e]):null,Eg(4,4,Ij.bind(null,t,e),n)}function sk(){}function Lj(e,t){var n=Qr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ek(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function $j(e,t){var n=Qr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ek(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function zj(e,t,n){return Hl&21?(xs(n,t)||(n=UO(),Tt.lanes|=n,Ul|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,er=!0),e.memoizedState=n)}function x4(e,t){var n=at;at=n!==0&&4>n?n:4,e(!0);var r=tx.transition;tx.transition={};try{e(!1),t()}finally{at=n,tx.transition=r}}function Fj(){return Qr().memoizedState}function v4(e,t,n){var r=No(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Bj(e))Vj(t,n);else if(n=kj(e,t,n,r),n!==null){var s=Bn();ps(n,e,r,s),Hj(n,t,r)}}function w4(e,t,n){var r=No(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Bj(e))Vj(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,xs(l,o)){var a=t.interleaved;a===null?(s.next=s,Gb(t)):(s.next=a.next,a.next=s),t.interleaved=s;return}}catch{}finally{}n=kj(e,t,s,r),n!==null&&(s=Bn(),ps(n,e,r,s),Hj(n,t,r))}}function Bj(e){var t=e.alternate;return e===Tt||t!==null&&t===Tt}function Vj(e,t){nd=Wp=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Hj(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ib(e,n)}}var Kp={readContext:Kr,useCallback:wn,useContext:wn,useEffect:wn,useImperativeHandle:wn,useInsertionEffect:wn,useLayoutEffect:wn,useMemo:wn,useReducer:wn,useRef:wn,useState:wn,useDebugValue:wn,useDeferredValue:wn,useTransition:wn,useMutableSource:wn,useSyncExternalStore:wn,useId:wn,unstable_isNewReconciler:!1},b4={readContext:Kr,useCallback:function(e,t){return Ts().memoizedState=[e,t===void 0?null:t],e},useContext:Kr,useEffect:FC,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,rp(4194308,4,Ij.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rp(4194308,4,e,t)},useInsertionEffect:function(e,t){return rp(4,2,e,t)},useMemo:function(e,t){var n=Ts();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ts();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=v4.bind(null,Tt,e),[r.memoizedState,e]},useRef:function(e){var t=Ts();return e={current:e},t.memoizedState=e},useState:zC,useDebugValue:sk,useDeferredValue:function(e){return Ts().memoizedState=e},useTransition:function(){var e=zC(!1),t=e[0];return e=x4.bind(null,e[1]),Ts().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Tt,s=Ts();if(kt){if(n===void 0)throw Error(te(407));n=n()}else{if(n=t(),en===null)throw Error(te(349));Hl&30||Tj(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,FC(Mj.bind(null,r,i,e),[e]),r.flags|=2048,Fd(9,Rj.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ts(),t=en.identifierPrefix;if(kt){var n=xi,r=yi;n=(r&~(1<<32-hs(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=$d++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=y4++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},k4={readContext:Kr,useCallback:Lj,useContext:Kr,useEffect:rk,useImperativeHandle:Dj,useInsertionEffect:Aj,useLayoutEffect:_j,useMemo:$j,useReducer:nx,useRef:Pj,useState:function(){return nx(zd)},useDebugValue:sk,useDeferredValue:function(e){var t=Qr();return zj(t,qt.memoizedState,e)},useTransition:function(){var e=nx(zd)[0],t=Qr().memoizedState;return[e,t]},useMutableSource:Ej,useSyncExternalStore:Nj,useId:Fj,unstable_isNewReconciler:!1},S4={readContext:Kr,useCallback:Lj,useContext:Kr,useEffect:rk,useImperativeHandle:Dj,useInsertionEffect:Aj,useLayoutEffect:_j,useMemo:$j,useReducer:rx,useRef:Pj,useState:function(){return rx(zd)},useDebugValue:sk,useDeferredValue:function(e){var t=Qr();return qt===null?t.memoizedState=e:zj(t,qt.memoizedState,e)},useTransition:function(){var e=rx(zd)[0],t=Qr().memoizedState;return[e,t]},useMutableSource:Ej,useSyncExternalStore:Nj,useId:Fj,unstable_isNewReconciler:!1};function ts(e,t){if(e&&e.defaultProps){t=Rt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function u0(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Rt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ng={isMounted:function(e){return(e=e._reactInternals)?ia(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Bn(),s=No(e),i=Si(r,s);i.payload=t,n!=null&&(i.callback=n),t=Co(e,i,s),t!==null&&(ps(t,e,s,r),tp(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Bn(),s=No(e),i=Si(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Co(e,i,s),t!==null&&(ps(t,e,s,r),tp(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Bn(),r=No(e),s=Si(n,r);s.tag=2,t!=null&&(s.callback=t),t=Co(e,s,r),t!==null&&(ps(t,e,r,n),tp(t,e,r))}};function BC(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!Pd(n,r)||!Pd(s,i):!0}function Uj(e,t,n){var r=!1,s=Lo,i=t.contextType;return typeof i=="object"&&i!==null?i=Kr(i):(s=nr(t)?Bl:Mn.current,r=t.contextTypes,i=(r=r!=null)?Nu(e,s):Lo),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ng,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function VC(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ng.enqueueReplaceState(t,t.state,null)}function c0(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},Jb(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=Kr(i):(i=nr(t)?Bl:Mn.current,s.context=Nu(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(u0(e,t,i,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&Ng.enqueueReplaceState(s,s.state,null),Up(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Ou(e,t){try{var n="",r=t;do n+=Z3(r),r=r.return;while(r);var s=n}catch(i){s=`
|
|
39
|
+
Error generating stack: `+i.message+`
|
|
40
|
+
`+i.stack}return{value:e,source:t,stack:s,digest:null}}function sx(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function d0(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var C4=typeof WeakMap=="function"?WeakMap:Map;function qj(e,t,n){n=Si(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Gp||(Gp=!0,b0=r),d0(e,t)},n}function Wj(e,t,n){n=Si(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){d0(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){d0(e,t),typeof r!="function"&&(Eo===null?Eo=new Set([this]):Eo.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function HC(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new C4;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=$4.bind(null,e,t,n),t.then(e,e))}function UC(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function qC(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Si(-1,1),t.tag=2,Co(n,t,1))),n.lanes|=1),e)}var E4=Ai.ReactCurrentOwner,er=!1;function Dn(e,t,n,r){t.child=e===null?bj(t,null,n,r):Ru(t,e.child,n,r)}function WC(e,t,n,r,s){n=n.render;var i=t.ref;return nu(t,s),r=tk(e,t,n,r,i,s),n=nk(),e!==null&&!er?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ji(e,t,s)):(kt&&n&&Hb(t),t.flags|=1,Dn(e,t,r,s),t.child)}function KC(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!fk(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Kj(e,t,i,r,s)):(e=lp(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Pd,n(o,r)&&e.ref===t.ref)return ji(e,t,s)}return t.flags|=1,e=To(i,r),e.ref=t.ref,e.return=t,t.child=e}function Kj(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(Pd(i,r)&&e.ref===t.ref)if(er=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(er=!0);else return t.lanes=e.lanes,ji(e,t,s)}return f0(e,t,n,r,s)}function Qj(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},gt(Qa,fr),fr|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,gt(Qa,fr),fr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,gt(Qa,fr),fr|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,gt(Qa,fr),fr|=r;return Dn(e,t,s,n),t.child}function Gj(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function f0(e,t,n,r,s){var i=nr(n)?Bl:Mn.current;return i=Nu(t,i),nu(t,s),n=tk(e,t,n,r,i,s),r=nk(),e!==null&&!er?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ji(e,t,s)):(kt&&r&&Hb(t),t.flags|=1,Dn(e,t,n,s),t.child)}function QC(e,t,n,r,s){if(nr(n)){var i=!0;zp(t)}else i=!1;if(nu(t,s),t.stateNode===null)sp(e,t),Uj(t,n,r),c0(t,n,r,s),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var a=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Kr(u):(u=nr(n)?Bl:Mn.current,u=Nu(t,u));var c=n.getDerivedStateFromProps,d=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||a!==u)&&VC(t,o,r,u),Ki=!1;var h=t.memoizedState;o.state=h,Up(t,r,o,s),a=t.memoizedState,l!==r||h!==a||tr.current||Ki?(typeof c=="function"&&(u0(t,n,c,r),a=t.memoizedState),(l=Ki||BC(t,n,l,r,h,a,u))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=a),o.props=r,o.state=a,o.context=u,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Sj(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:ts(t.type,l),o.props=u,d=t.pendingProps,h=o.context,a=n.contextType,typeof a=="object"&&a!==null?a=Kr(a):(a=nr(n)?Bl:Mn.current,a=Nu(t,a));var f=n.getDerivedStateFromProps;(c=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==d||h!==a)&&VC(t,o,r,a),Ki=!1,h=t.memoizedState,o.state=h,Up(t,r,o,s);var m=t.memoizedState;l!==d||h!==m||tr.current||Ki?(typeof f=="function"&&(u0(t,n,f,r),m=t.memoizedState),(u=Ki||BC(t,n,u,r,h,m,a)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,m,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,m,a)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=a,r=u):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return h0(e,t,n,r,i,s)}function h0(e,t,n,r,s,i){Gj(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&AC(t,n,!1),ji(e,t,i);r=t.stateNode,E4.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ru(t,e.child,null,i),t.child=Ru(t,null,l,i)):Dn(e,t,l,i),t.memoizedState=r.state,s&&AC(t,n,!0),t.child}function Jj(e){var t=e.stateNode;t.pendingContext?PC(e,t.pendingContext,t.pendingContext!==t.context):t.context&&PC(e,t.context,!1),Zb(e,t.containerInfo)}function GC(e,t,n,r,s){return Tu(),qb(s),t.flags|=256,Dn(e,t,n,r),t.child}var p0={dehydrated:null,treeContext:null,retryLane:0};function m0(e){return{baseLanes:e,cachePool:null,transitions:null}}function Zj(e,t,n){var r=t.pendingProps,s=Et.current,i=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),gt(Et,s&1),e===null)return l0(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=Mg(o,r,0,null),e=_l(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=m0(n),t.memoizedState=p0,e):ik(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return N4(e,t,o,r,l,s,n);if(i){i=r.fallback,o=t.mode,s=e.child,l=s.sibling;var a={mode:"hidden",children:r.children};return!(o&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=a,t.deletions=null):(r=To(s,a),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=To(l,i):(i=_l(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?m0(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=p0,r}return i=e.child,e=i.sibling,r=To(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function ik(e,t){return t=Mg({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function uh(e,t,n,r){return r!==null&&qb(r),Ru(t,e.child,null,n),e=ik(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function N4(e,t,n,r,s,i,o){if(n)return t.flags&256?(t.flags&=-257,r=sx(Error(te(422))),uh(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=Mg({mode:"visible",children:r.children},s,0,null),i=_l(i,s,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Ru(t,e.child,null,o),t.child.memoizedState=m0(o),t.memoizedState=p0,i);if(!(t.mode&1))return uh(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(te(419)),r=sx(i,r,void 0),uh(e,t,o,r)}if(l=(o&e.childLanes)!==0,er||l){if(r=en,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=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:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Oi(e,s),ps(r,e,s,-1))}return dk(),r=sx(Error(te(421))),uh(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=z4.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,mr=So(s.nextSibling),yr=t,kt=!0,is=null,e!==null&&(Lr[$r++]=yi,Lr[$r++]=xi,Lr[$r++]=Vl,yi=e.id,xi=e.overflow,Vl=t),t=ik(t,r.children),t.flags|=4096,t)}function JC(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),a0(e.return,t,n)}function ix(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function Yj(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(Dn(e,t,r.children,n),r=Et.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&JC(e,n,t);else if(e.tag===19)JC(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(gt(Et,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&qp(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),ix(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&qp(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}ix(t,!0,n,null,i);break;case"together":ix(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function sp(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ji(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ul|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(te(153));if(t.child!==null){for(e=t.child,n=To(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=To(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function T4(e,t,n){switch(t.tag){case 3:Jj(t),Tu();break;case 5:Cj(t);break;case 1:nr(t.type)&&zp(t);break;case 4:Zb(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;gt(Vp,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(gt(Et,Et.current&1),t.flags|=128,null):n&t.child.childLanes?Zj(e,t,n):(gt(Et,Et.current&1),e=ji(e,t,n),e!==null?e.sibling:null);gt(Et,Et.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Yj(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),gt(Et,Et.current),r)break;return null;case 22:case 23:return t.lanes=0,Qj(e,t,n)}return ji(e,t,n)}var Xj,g0,eP,tP;Xj=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};g0=function(){};eP=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,vl(Bs.current);var i=null;switch(n){case"input":s=$v(e,s),r=$v(e,r),i=[];break;case"select":s=Rt({},s,{value:void 0}),r=Rt({},r,{value:void 0}),i=[];break;case"textarea":s=Bv(e,s),r=Bv(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Lp)}Hv(n,r);var o;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Ed.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var a=r[u];if(l=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&a!==l&&(a!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(n||(n={}),n[o]=a[o])}else n||(i||(i=[]),i.push(u,n)),n=a;else u==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(i=i||[]).push(u,a)):u==="children"?typeof a!="string"&&typeof a!="number"||(i=i||[]).push(u,""+a):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Ed.hasOwnProperty(u)?(a!=null&&u==="onScroll"&&xt("scroll",e),i||l===a||(i=[])):(i=i||[]).push(u,a))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};tP=function(e,t,n,r){n!==r&&(t.flags|=4)};function kc(e,t){if(!kt)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function bn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function R4(e,t,n){var r=t.pendingProps;switch(Ub(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return bn(t),null;case 1:return nr(t.type)&&$p(),bn(t),null;case 3:return r=t.stateNode,Mu(),wt(tr),wt(Mn),Xb(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(lh(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,is!==null&&(C0(is),is=null))),g0(e,t),bn(t),null;case 5:Yb(t);var s=vl(Ld.current);if(n=t.type,e!==null&&t.stateNode!=null)eP(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(te(166));return bn(t),null}if(e=vl(Bs.current),lh(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Ds]=t,r[Id]=i,e=(t.mode&1)!==0,n){case"dialog":xt("cancel",r),xt("close",r);break;case"iframe":case"object":case"embed":xt("load",r);break;case"video":case"audio":for(s=0;s<Fc.length;s++)xt(Fc[s],r);break;case"source":xt("error",r);break;case"img":case"image":case"link":xt("error",r),xt("load",r);break;case"details":xt("toggle",r);break;case"input":iC(r,i),xt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},xt("invalid",r);break;case"textarea":lC(r,i),xt("invalid",r)}Hv(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&oh(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&oh(r.textContent,l,e),s=["children",""+l]):Ed.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&xt("scroll",r)}switch(n){case"input":Yf(r),oC(r,i,!0);break;case"textarea":Yf(r),aC(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Lp)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=MO(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Ds]=t,e[Id]=r,Xj(e,t,!1,!1),t.stateNode=e;e:{switch(o=Uv(n,r),n){case"dialog":xt("cancel",e),xt("close",e),s=r;break;case"iframe":case"object":case"embed":xt("load",e),s=r;break;case"video":case"audio":for(s=0;s<Fc.length;s++)xt(Fc[s],e);s=r;break;case"source":xt("error",e),s=r;break;case"img":case"image":case"link":xt("error",e),xt("load",e),s=r;break;case"details":xt("toggle",e),s=r;break;case"input":iC(e,r),s=$v(e,r),xt("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Rt({},r,{value:void 0}),xt("invalid",e);break;case"textarea":lC(e,r),s=Bv(e,r),xt("invalid",e);break;default:s=r}Hv(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var a=l[i];i==="style"?PO(e,a):i==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&OO(e,a)):i==="children"?typeof a=="string"?(n!=="textarea"||a!=="")&&Nd(e,a):typeof a=="number"&&Nd(e,""+a):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Ed.hasOwnProperty(i)?a!=null&&i==="onScroll"&&xt("scroll",e):a!=null&&Mb(e,i,a,o))}switch(n){case"input":Yf(e),oC(e,r,!1);break;case"textarea":Yf(e),aC(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Do(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Ya(e,!!r.multiple,i,!1):r.defaultValue!=null&&Ya(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Lp)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return bn(t),null;case 6:if(e&&t.stateNode!=null)tP(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(te(166));if(n=vl(Ld.current),vl(Bs.current),lh(t)){if(r=t.stateNode,n=t.memoizedProps,r[Ds]=t,(i=r.nodeValue!==n)&&(e=yr,e!==null))switch(e.tag){case 3:oh(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&oh(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Ds]=t,t.stateNode=r}return bn(t),null;case 13:if(wt(Et),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(kt&&mr!==null&&t.mode&1&&!(t.flags&128))vj(),Tu(),t.flags|=98560,i=!1;else if(i=lh(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(te(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(te(317));i[Ds]=t}else Tu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;bn(t),i=!1}else is!==null&&(C0(is),is=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Et.current&1?Kt===0&&(Kt=3):dk())),t.updateQueue!==null&&(t.flags|=4),bn(t),null);case 4:return Mu(),g0(e,t),e===null&&Ad(t.stateNode.containerInfo),bn(t),null;case 10:return Qb(t.type._context),bn(t),null;case 17:return nr(t.type)&&$p(),bn(t),null;case 19:if(wt(Et),i=t.memoizedState,i===null)return bn(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)kc(i,!1);else{if(Kt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=qp(e),o!==null){for(t.flags|=128,kc(i,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return gt(Et,Et.current&1|2),t.child}e=e.sibling}i.tail!==null&&_t()>ju&&(t.flags|=128,r=!0,kc(i,!1),t.lanes=4194304)}else{if(!r)if(e=qp(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),kc(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!kt)return bn(t),null}else 2*_t()-i.renderingStartTime>ju&&n!==1073741824&&(t.flags|=128,r=!0,kc(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=_t(),t.sibling=null,n=Et.current,gt(Et,r?n&1|2:n&1),t):(bn(t),null);case 22:case 23:return ck(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?fr&1073741824&&(bn(t),t.subtreeFlags&6&&(t.flags|=8192)):bn(t),null;case 24:return null;case 25:return null}throw Error(te(156,t.tag))}function M4(e,t){switch(Ub(t),t.tag){case 1:return nr(t.type)&&$p(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Mu(),wt(tr),wt(Mn),Xb(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Yb(t),null;case 13:if(wt(Et),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(te(340));Tu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return wt(Et),null;case 4:return Mu(),null;case 10:return Qb(t.type._context),null;case 22:case 23:return ck(),null;case 24:return null;default:return null}}var ch=!1,Tn=!1,O4=typeof WeakSet=="function"?WeakSet:Set,pe=null;function Ka(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){jt(e,t,r)}else n.current=null}function y0(e,t,n){try{n()}catch(r){jt(e,t,r)}}var ZC=!1;function j4(e,t){if(e0=_p,e=oj(),Vb(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,a=-1,u=0,c=0,d=e,h=null;t:for(;;){for(var f;d!==n||s!==0&&d.nodeType!==3||(l=o+s),d!==i||r!==0&&d.nodeType!==3||(a=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(f=d.firstChild)!==null;)h=d,d=f;for(;;){if(d===e)break t;if(h===n&&++u===s&&(l=o),h===i&&++c===r&&(a=o),(f=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=f}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(t0={focusedElem:e,selectionRange:n},_p=!1,pe=t;pe!==null;)if(t=pe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,pe=e;else for(;pe!==null;){t=pe;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var g=m.memoizedProps,v=m.memoizedState,y=t.stateNode,w=y.getSnapshotBeforeUpdate(t.elementType===t.type?g:ts(t.type,g),v);y.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(te(163))}}catch(C){jt(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,pe=e;break}pe=t.return}return m=ZC,ZC=!1,m}function rd(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&y0(t,n,i)}s=s.next}while(s!==r)}}function Tg(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function x0(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function nP(e){var t=e.alternate;t!==null&&(e.alternate=null,nP(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ds],delete t[Id],delete t[s0],delete t[h4],delete t[p4])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function rP(e){return e.tag===5||e.tag===3||e.tag===4}function YC(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||rP(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function v0(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Lp));else if(r!==4&&(e=e.child,e!==null))for(v0(e,t,n),e=e.sibling;e!==null;)v0(e,t,n),e=e.sibling}function w0(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(w0(e,t,n),e=e.sibling;e!==null;)w0(e,t,n),e=e.sibling}var an=null,ss=!1;function $i(e,t,n){for(n=n.child;n!==null;)sP(e,t,n),n=n.sibling}function sP(e,t,n){if(Fs&&typeof Fs.onCommitFiberUnmount=="function")try{Fs.onCommitFiberUnmount(vg,n)}catch{}switch(n.tag){case 5:Tn||Ka(n,t);case 6:var r=an,s=ss;an=null,$i(e,t,n),an=r,ss=s,an!==null&&(ss?(e=an,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):an.removeChild(n.stateNode));break;case 18:an!==null&&(ss?(e=an,n=n.stateNode,e.nodeType===8?Yy(e.parentNode,n):e.nodeType===1&&Yy(e,n),Od(e)):Yy(an,n.stateNode));break;case 4:r=an,s=ss,an=n.stateNode.containerInfo,ss=!0,$i(e,t,n),an=r,ss=s;break;case 0:case 11:case 14:case 15:if(!Tn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&y0(n,t,o),s=s.next}while(s!==r)}$i(e,t,n);break;case 1:if(!Tn&&(Ka(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){jt(n,t,l)}$i(e,t,n);break;case 21:$i(e,t,n);break;case 22:n.mode&1?(Tn=(r=Tn)||n.memoizedState!==null,$i(e,t,n),Tn=r):$i(e,t,n);break;default:$i(e,t,n)}}function XC(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new O4),t.forEach(function(r){var s=F4.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Zr(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:an=l.stateNode,ss=!1;break e;case 3:an=l.stateNode.containerInfo,ss=!0;break e;case 4:an=l.stateNode.containerInfo,ss=!0;break e}l=l.return}if(an===null)throw Error(te(160));sP(i,o,s),an=null,ss=!1;var a=s.alternate;a!==null&&(a.return=null),s.return=null}catch(u){jt(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)iP(t,e),t=t.sibling}function iP(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Zr(t,e),Es(e),r&4){try{rd(3,e,e.return),Tg(3,e)}catch(g){jt(e,e.return,g)}try{rd(5,e,e.return)}catch(g){jt(e,e.return,g)}}break;case 1:Zr(t,e),Es(e),r&512&&n!==null&&Ka(n,n.return);break;case 5:if(Zr(t,e),Es(e),r&512&&n!==null&&Ka(n,n.return),e.flags&32){var s=e.stateNode;try{Nd(s,"")}catch(g){jt(e,e.return,g)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,l=e.type,a=e.updateQueue;if(e.updateQueue=null,a!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&TO(s,i),Uv(l,o);var u=Uv(l,i);for(o=0;o<a.length;o+=2){var c=a[o],d=a[o+1];c==="style"?PO(s,d):c==="dangerouslySetInnerHTML"?OO(s,d):c==="children"?Nd(s,d):Mb(s,c,d,u)}switch(l){case"input":zv(s,i);break;case"textarea":RO(s,i);break;case"select":var h=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var f=i.value;f!=null?Ya(s,!!i.multiple,f,!1):h!==!!i.multiple&&(i.defaultValue!=null?Ya(s,!!i.multiple,i.defaultValue,!0):Ya(s,!!i.multiple,i.multiple?[]:"",!1))}s[Id]=i}catch(g){jt(e,e.return,g)}}break;case 6:if(Zr(t,e),Es(e),r&4){if(e.stateNode===null)throw Error(te(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(g){jt(e,e.return,g)}}break;case 3:if(Zr(t,e),Es(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Od(t.containerInfo)}catch(g){jt(e,e.return,g)}break;case 4:Zr(t,e),Es(e);break;case 13:Zr(t,e),Es(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(ak=_t())),r&4&&XC(e);break;case 22:if(c=n!==null&&n.memoizedState!==null,e.mode&1?(Tn=(u=Tn)||c,Zr(t,e),Tn=u):Zr(t,e),Es(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!c&&e.mode&1)for(pe=e,c=e.child;c!==null;){for(d=pe=c;pe!==null;){switch(h=pe,f=h.child,h.tag){case 0:case 11:case 14:case 15:rd(4,h,h.return);break;case 1:Ka(h,h.return);var m=h.stateNode;if(typeof m.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(g){jt(r,n,g)}}break;case 5:Ka(h,h.return);break;case 22:if(h.memoizedState!==null){tE(d);continue}}f!==null?(f.return=h,pe=f):tE(d)}c=c.sibling}e:for(c=null,d=e;;){if(d.tag===5){if(c===null){c=d;try{s=d.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=d.stateNode,a=d.memoizedProps.style,o=a!=null&&a.hasOwnProperty("display")?a.display:null,l.style.display=jO("display",o))}catch(g){jt(e,e.return,g)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(g){jt(e,e.return,g)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Zr(t,e),Es(e),r&4&&XC(e);break;case 21:break;default:Zr(t,e),Es(e)}}function Es(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(rP(n)){var r=n;break e}n=n.return}throw Error(te(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Nd(s,""),r.flags&=-33);var i=YC(e);w0(e,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=YC(e);v0(e,l,o);break;default:throw Error(te(161))}}catch(a){jt(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function P4(e,t,n){pe=e,oP(e)}function oP(e,t,n){for(var r=(e.mode&1)!==0;pe!==null;){var s=pe,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||ch;if(!o){var l=s.alternate,a=l!==null&&l.memoizedState!==null||Tn;l=ch;var u=Tn;if(ch=o,(Tn=a)&&!u)for(pe=s;pe!==null;)o=pe,a=o.child,o.tag===22&&o.memoizedState!==null?nE(s):a!==null?(a.return=o,pe=a):nE(s);for(;i!==null;)pe=i,oP(i),i=i.sibling;pe=s,ch=l,Tn=u}eE(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,pe=i):eE(e)}}function eE(e){for(;pe!==null;){var t=pe;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Tn||Tg(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Tn)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:ts(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&$C(t,i,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}$C(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var a=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break;case"img":a.src&&(n.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var c=u.memoizedState;if(c!==null){var d=c.dehydrated;d!==null&&Od(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(te(163))}Tn||t.flags&512&&x0(t)}catch(h){jt(t,t.return,h)}}if(t===e){pe=null;break}if(n=t.sibling,n!==null){n.return=t.return,pe=n;break}pe=t.return}}function tE(e){for(;pe!==null;){var t=pe;if(t===e){pe=null;break}var n=t.sibling;if(n!==null){n.return=t.return,pe=n;break}pe=t.return}}function nE(e){for(;pe!==null;){var t=pe;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Tg(4,t)}catch(a){jt(t,n,a)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(a){jt(t,s,a)}}var i=t.return;try{x0(t)}catch(a){jt(t,i,a)}break;case 5:var o=t.return;try{x0(t)}catch(a){jt(t,o,a)}}}catch(a){jt(t,t.return,a)}if(t===e){pe=null;break}var l=t.sibling;if(l!==null){l.return=t.return,pe=l;break}pe=t.return}}var A4=Math.ceil,Qp=Ai.ReactCurrentDispatcher,ok=Ai.ReactCurrentOwner,Hr=Ai.ReactCurrentBatchConfig,Ze=0,en=null,zt=null,fn=0,fr=0,Qa=Go(0),Kt=0,Bd=null,Ul=0,Rg=0,lk=0,sd=null,Yn=null,ak=0,ju=1/0,li=null,Gp=!1,b0=null,Eo=null,dh=!1,po=null,Jp=0,id=0,k0=null,ip=-1,op=0;function Bn(){return Ze&6?_t():ip!==-1?ip:ip=_t()}function No(e){return e.mode&1?Ze&2&&fn!==0?fn&-fn:g4.transition!==null?(op===0&&(op=UO()),op):(e=at,e!==0||(e=window.event,e=e===void 0?16:ZO(e.type)),e):1}function ps(e,t,n,r){if(50<id)throw id=0,k0=null,Error(te(185));Sf(e,n,r),(!(Ze&2)||e!==en)&&(e===en&&(!(Ze&2)&&(Rg|=n),Kt===4&&Xi(e,fn)),rr(e,r),n===1&&Ze===0&&!(t.mode&1)&&(ju=_t()+500,Cg&&Jo()))}function rr(e,t){var n=e.callbackNode;gF(e,t);var r=Ap(e,e===en?fn:0);if(r===0)n!==null&&dC(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&dC(n),t===1)e.tag===0?m4(rE.bind(null,e)):gj(rE.bind(null,e)),d4(function(){!(Ze&6)&&Jo()}),n=null;else{switch(qO(r)){case 1:n=_b;break;case 4:n=VO;break;case 16:n=Pp;break;case 536870912:n=HO;break;default:n=Pp}n=pP(n,lP.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function lP(e,t){if(ip=-1,op=0,Ze&6)throw Error(te(327));var n=e.callbackNode;if(ru()&&e.callbackNode!==n)return null;var r=Ap(e,e===en?fn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Zp(e,r);else{t=r;var s=Ze;Ze|=2;var i=uP();(en!==e||fn!==t)&&(li=null,ju=_t()+500,Al(e,t));do try{D4();break}catch(l){aP(e,l)}while(!0);Kb(),Qp.current=i,Ze=s,zt!==null?t=0:(en=null,fn=0,t=Kt)}if(t!==0){if(t===2&&(s=Gv(e),s!==0&&(r=s,t=S0(e,s))),t===1)throw n=Bd,Al(e,0),Xi(e,r),rr(e,_t()),n;if(t===6)Xi(e,r);else{if(s=e.current.alternate,!(r&30)&&!_4(s)&&(t=Zp(e,r),t===2&&(i=Gv(e),i!==0&&(r=i,t=S0(e,i))),t===1))throw n=Bd,Al(e,0),Xi(e,r),rr(e,_t()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(te(345));case 2:fl(e,Yn,li);break;case 3:if(Xi(e,r),(r&130023424)===r&&(t=ak+500-_t(),10<t)){if(Ap(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Bn(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=r0(fl.bind(null,e,Yn,li),t);break}fl(e,Yn,li);break;case 4:if(Xi(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-hs(r);i=1<<o,o=t[o],o>s&&(s=o),r&=~i}if(r=s,r=_t()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*A4(r/1960))-r,10<r){e.timeoutHandle=r0(fl.bind(null,e,Yn,li),r);break}fl(e,Yn,li);break;case 5:fl(e,Yn,li);break;default:throw Error(te(329))}}}return rr(e,_t()),e.callbackNode===n?lP.bind(null,e):null}function S0(e,t){var n=sd;return e.current.memoizedState.isDehydrated&&(Al(e,t).flags|=256),e=Zp(e,t),e!==2&&(t=Yn,Yn=n,t!==null&&C0(t)),e}function C0(e){Yn===null?Yn=e:Yn.push.apply(Yn,e)}function _4(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!xs(i(),s))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Xi(e,t){for(t&=~lk,t&=~Rg,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-hs(t),r=1<<n;e[n]=-1,t&=~r}}function rE(e){if(Ze&6)throw Error(te(327));ru();var t=Ap(e,0);if(!(t&1))return rr(e,_t()),null;var n=Zp(e,t);if(e.tag!==0&&n===2){var r=Gv(e);r!==0&&(t=r,n=S0(e,r))}if(n===1)throw n=Bd,Al(e,0),Xi(e,t),rr(e,_t()),n;if(n===6)throw Error(te(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,fl(e,Yn,li),rr(e,_t()),null}function uk(e,t){var n=Ze;Ze|=1;try{return e(t)}finally{Ze=n,Ze===0&&(ju=_t()+500,Cg&&Jo())}}function ql(e){po!==null&&po.tag===0&&!(Ze&6)&&ru();var t=Ze;Ze|=1;var n=Hr.transition,r=at;try{if(Hr.transition=null,at=1,e)return e()}finally{at=r,Hr.transition=n,Ze=t,!(Ze&6)&&Jo()}}function ck(){fr=Qa.current,wt(Qa)}function Al(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,c4(n)),zt!==null)for(n=zt.return;n!==null;){var r=n;switch(Ub(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&$p();break;case 3:Mu(),wt(tr),wt(Mn),Xb();break;case 5:Yb(r);break;case 4:Mu();break;case 13:wt(Et);break;case 19:wt(Et);break;case 10:Qb(r.type._context);break;case 22:case 23:ck()}n=n.return}if(en=e,zt=e=To(e.current,null),fn=fr=t,Kt=0,Bd=null,lk=Rg=Ul=0,Yn=sd=null,xl!==null){for(t=0;t<xl.length;t++)if(n=xl[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}xl=null}return e}function aP(e,t){do{var n=zt;try{if(Kb(),np.current=Kp,Wp){for(var r=Tt.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Wp=!1}if(Hl=0,Jt=qt=Tt=null,nd=!1,$d=0,ok.current=null,n===null||n.return===null){Kt=1,Bd=t,zt=null;break}e:{var i=e,o=n.return,l=n,a=t;if(t=fn,l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var u=a,c=l,d=c.tag;if(!(c.mode&1)&&(d===0||d===11||d===15)){var h=c.alternate;h?(c.updateQueue=h.updateQueue,c.memoizedState=h.memoizedState,c.lanes=h.lanes):(c.updateQueue=null,c.memoizedState=null)}var f=UC(o);if(f!==null){f.flags&=-257,qC(f,o,l,i,t),f.mode&1&&HC(i,u,t),t=f,a=u;var m=t.updateQueue;if(m===null){var g=new Set;g.add(a),t.updateQueue=g}else m.add(a);break e}else{if(!(t&1)){HC(i,u,t),dk();break e}a=Error(te(426))}}else if(kt&&l.mode&1){var v=UC(o);if(v!==null){!(v.flags&65536)&&(v.flags|=256),qC(v,o,l,i,t),qb(Ou(a,l));break e}}i=a=Ou(a,l),Kt!==4&&(Kt=2),sd===null?sd=[i]:sd.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var y=qj(i,a,t);LC(i,y);break e;case 1:l=a;var w=i.type,b=i.stateNode;if(!(i.flags&128)&&(typeof w.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(Eo===null||!Eo.has(b)))){i.flags|=65536,t&=-t,i.lanes|=t;var C=Wj(i,l,t);LC(i,C);break e}}i=i.return}while(i!==null)}dP(n)}catch(S){t=S,zt===n&&n!==null&&(zt=n=n.return);continue}break}while(!0)}function uP(){var e=Qp.current;return Qp.current=Kp,e===null?Kp:e}function dk(){(Kt===0||Kt===3||Kt===2)&&(Kt=4),en===null||!(Ul&268435455)&&!(Rg&268435455)||Xi(en,fn)}function Zp(e,t){var n=Ze;Ze|=2;var r=uP();(en!==e||fn!==t)&&(li=null,Al(e,t));do try{I4();break}catch(s){aP(e,s)}while(!0);if(Kb(),Ze=n,Qp.current=r,zt!==null)throw Error(te(261));return en=null,fn=0,Kt}function I4(){for(;zt!==null;)cP(zt)}function D4(){for(;zt!==null&&!lF();)cP(zt)}function cP(e){var t=hP(e.alternate,e,fr);e.memoizedProps=e.pendingProps,t===null?dP(e):zt=t,ok.current=null}function dP(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=M4(n,t),n!==null){n.flags&=32767,zt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Kt=6,zt=null;return}}else if(n=R4(n,t,fr),n!==null){zt=n;return}if(t=t.sibling,t!==null){zt=t;return}zt=t=e}while(t!==null);Kt===0&&(Kt=5)}function fl(e,t,n){var r=at,s=Hr.transition;try{Hr.transition=null,at=1,L4(e,t,n,r)}finally{Hr.transition=s,at=r}return null}function L4(e,t,n,r){do ru();while(po!==null);if(Ze&6)throw Error(te(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(te(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(yF(e,i),e===en&&(zt=en=null,fn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||dh||(dh=!0,pP(Pp,function(){return ru(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Hr.transition,Hr.transition=null;var o=at;at=1;var l=Ze;Ze|=4,ok.current=null,j4(e,n),iP(n,e),r4(t0),_p=!!e0,t0=e0=null,e.current=n,P4(n),aF(),Ze=l,at=o,Hr.transition=i}else e.current=n;if(dh&&(dh=!1,po=e,Jp=s),i=e.pendingLanes,i===0&&(Eo=null),dF(n.stateNode),rr(e,_t()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(Gp)throw Gp=!1,e=b0,b0=null,e;return Jp&1&&e.tag!==0&&ru(),i=e.pendingLanes,i&1?e===k0?id++:(id=0,k0=e):id=0,Jo(),null}function ru(){if(po!==null){var e=qO(Jp),t=Hr.transition,n=at;try{if(Hr.transition=null,at=16>e?16:e,po===null)var r=!1;else{if(e=po,po=null,Jp=0,Ze&6)throw Error(te(331));var s=Ze;for(Ze|=4,pe=e.current;pe!==null;){var i=pe,o=i.child;if(pe.flags&16){var l=i.deletions;if(l!==null){for(var a=0;a<l.length;a++){var u=l[a];for(pe=u;pe!==null;){var c=pe;switch(c.tag){case 0:case 11:case 15:rd(8,c,i)}var d=c.child;if(d!==null)d.return=c,pe=d;else for(;pe!==null;){c=pe;var h=c.sibling,f=c.return;if(nP(c),c===u){pe=null;break}if(h!==null){h.return=f,pe=h;break}pe=f}}}var m=i.alternate;if(m!==null){var g=m.child;if(g!==null){m.child=null;do{var v=g.sibling;g.sibling=null,g=v}while(g!==null)}}pe=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,pe=o;else e:for(;pe!==null;){if(i=pe,i.flags&2048)switch(i.tag){case 0:case 11:case 15:rd(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,pe=y;break e}pe=i.return}}var w=e.current;for(pe=w;pe!==null;){o=pe;var b=o.child;if(o.subtreeFlags&2064&&b!==null)b.return=o,pe=b;else e:for(o=w;pe!==null;){if(l=pe,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Tg(9,l)}}catch(S){jt(l,l.return,S)}if(l===o){pe=null;break e}var C=l.sibling;if(C!==null){C.return=l.return,pe=C;break e}pe=l.return}}if(Ze=s,Jo(),Fs&&typeof Fs.onPostCommitFiberRoot=="function")try{Fs.onPostCommitFiberRoot(vg,e)}catch{}r=!0}return r}finally{at=n,Hr.transition=t}}return!1}function sE(e,t,n){t=Ou(n,t),t=qj(e,t,1),e=Co(e,t,1),t=Bn(),e!==null&&(Sf(e,1,t),rr(e,t))}function jt(e,t,n){if(e.tag===3)sE(e,e,n);else for(;t!==null;){if(t.tag===3){sE(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Eo===null||!Eo.has(r))){e=Ou(n,e),e=Wj(t,e,1),t=Co(t,e,1),e=Bn(),t!==null&&(Sf(t,1,e),rr(t,e));break}}t=t.return}}function $4(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Bn(),e.pingedLanes|=e.suspendedLanes&n,en===e&&(fn&n)===n&&(Kt===4||Kt===3&&(fn&130023424)===fn&&500>_t()-ak?Al(e,0):lk|=n),rr(e,t)}function fP(e,t){t===0&&(e.mode&1?(t=th,th<<=1,!(th&130023424)&&(th=4194304)):t=1);var n=Bn();e=Oi(e,t),e!==null&&(Sf(e,t,n),rr(e,n))}function z4(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),fP(e,n)}function F4(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(te(314))}r!==null&&r.delete(t),fP(e,n)}var hP;hP=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||tr.current)er=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return er=!1,T4(e,t,n);er=!!(e.flags&131072)}else er=!1,kt&&t.flags&1048576&&yj(t,Bp,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;sp(e,t),e=t.pendingProps;var s=Nu(t,Mn.current);nu(t,n),s=tk(null,t,r,e,s,n);var i=nk();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,nr(r)?(i=!0,zp(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Jb(t),s.updater=Ng,t.stateNode=s,s._reactInternals=t,c0(t,r,e,n),t=h0(null,t,r,!0,i,n)):(t.tag=0,kt&&i&&Hb(t),Dn(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(sp(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=V4(r),e=ts(r,e),s){case 0:t=f0(null,t,r,e,n);break e;case 1:t=QC(null,t,r,e,n);break e;case 11:t=WC(null,t,r,e,n);break e;case 14:t=KC(null,t,r,ts(r.type,e),n);break e}throw Error(te(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ts(r,s),f0(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ts(r,s),QC(e,t,r,s,n);case 3:e:{if(Jj(t),e===null)throw Error(te(387));r=t.pendingProps,i=t.memoizedState,s=i.element,Sj(e,t),Up(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Ou(Error(te(423)),t),t=GC(e,t,r,n,s);break e}else if(r!==s){s=Ou(Error(te(424)),t),t=GC(e,t,r,n,s);break e}else for(mr=So(t.stateNode.containerInfo.firstChild),yr=t,kt=!0,is=null,n=bj(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Tu(),r===s){t=ji(e,t,n);break e}Dn(e,t,r,n)}t=t.child}return t;case 5:return Cj(t),e===null&&l0(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,n0(r,s)?o=null:i!==null&&n0(r,i)&&(t.flags|=32),Gj(e,t),Dn(e,t,o,n),t.child;case 6:return e===null&&l0(t),null;case 13:return Zj(e,t,n);case 4:return Zb(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ru(t,null,r,n):Dn(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ts(r,s),WC(e,t,r,s,n);case 7:return Dn(e,t,t.pendingProps,n),t.child;case 8:return Dn(e,t,t.pendingProps.children,n),t.child;case 12:return Dn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,gt(Vp,r._currentValue),r._currentValue=o,i!==null)if(xs(i.value,o)){if(i.children===s.children&&!tr.current){t=ji(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=Si(-1,n&-n),a.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),a0(i.return,n,t),l.lanes|=n;break}a=a.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(te(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),a0(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Dn(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,nu(t,n),s=Kr(s),r=r(s),t.flags|=1,Dn(e,t,r,n),t.child;case 14:return r=t.type,s=ts(r,t.pendingProps),s=ts(r.type,s),KC(e,t,r,s,n);case 15:return Kj(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ts(r,s),sp(e,t),t.tag=1,nr(r)?(e=!0,zp(t)):e=!1,nu(t,n),Uj(t,r,s),c0(t,r,s,n),h0(null,t,r,!0,e,n);case 19:return Yj(e,t,n);case 22:return Qj(e,t,n)}throw Error(te(156,t.tag))};function pP(e,t){return BO(e,t)}function B4(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vr(e,t,n,r){return new B4(e,t,n,r)}function fk(e){return e=e.prototype,!(!e||!e.isReactComponent)}function V4(e){if(typeof e=="function")return fk(e)?1:0;if(e!=null){if(e=e.$$typeof,e===jb)return 11;if(e===Pb)return 14}return 2}function To(e,t){var n=e.alternate;return n===null?(n=Vr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function lp(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")fk(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case $a:return _l(n.children,s,i,t);case Ob:o=8,s|=8;break;case _v:return e=Vr(12,n,t,s|2),e.elementType=_v,e.lanes=i,e;case Iv:return e=Vr(13,n,t,s),e.elementType=Iv,e.lanes=i,e;case Dv:return e=Vr(19,n,t,s),e.elementType=Dv,e.lanes=i,e;case CO:return Mg(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case kO:o=10;break e;case SO:o=9;break e;case jb:o=11;break e;case Pb:o=14;break e;case Wi:o=16,r=null;break e}throw Error(te(130,e==null?e:typeof e,""))}return t=Vr(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function _l(e,t,n,r){return e=Vr(7,e,r,t),e.lanes=n,e}function Mg(e,t,n,r){return e=Vr(22,e,r,t),e.elementType=CO,e.lanes=n,e.stateNode={isHidden:!1},e}function ox(e,t,n){return e=Vr(6,e,null,t),e.lanes=n,e}function lx(e,t,n){return t=Vr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function H4(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=By(0),this.expirationTimes=By(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=By(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function hk(e,t,n,r,s,i,o,l,a){return e=new H4(e,t,n,l,a),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Vr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Jb(i),e}function U4(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:La,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function mP(e){if(!e)return Lo;e=e._reactInternals;e:{if(ia(e)!==e||e.tag!==1)throw Error(te(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(nr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(te(171))}if(e.tag===1){var n=e.type;if(nr(n))return mj(e,n,t)}return t}function gP(e,t,n,r,s,i,o,l,a){return e=hk(n,r,!0,e,s,i,o,l,a),e.context=mP(null),n=e.current,r=Bn(),s=No(n),i=Si(r,s),i.callback=t??null,Co(n,i,s),e.current.lanes=s,Sf(e,s,r),rr(e,r),e}function Og(e,t,n,r){var s=t.current,i=Bn(),o=No(s);return n=mP(n),t.context===null?t.context=n:t.pendingContext=n,t=Si(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Co(s,t,o),e!==null&&(ps(e,s,o,i),tp(e,s,o)),o}function Yp(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function iE(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function pk(e,t){iE(e,t),(e=e.alternate)&&iE(e,t)}function q4(){return null}var yP=typeof reportError=="function"?reportError:function(e){console.error(e)};function mk(e){this._internalRoot=e}jg.prototype.render=mk.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(te(409));Og(e,t,null,null)};jg.prototype.unmount=mk.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ql(function(){Og(null,e,null,null)}),t[Mi]=null}};function jg(e){this._internalRoot=e}jg.prototype.unstable_scheduleHydration=function(e){if(e){var t=QO();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Yi.length&&t!==0&&t<Yi[n].priority;n++);Yi.splice(n,0,e),n===0&&JO(e)}};function gk(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Pg(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function oE(){}function W4(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=Yp(o);i.call(u)}}var o=gP(t,r,e,0,null,!1,!1,"",oE);return e._reactRootContainer=o,e[Mi]=o.current,Ad(e.nodeType===8?e.parentNode:e),ql(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=Yp(a);l.call(u)}}var a=hk(e,0,!1,null,null,!1,!1,"",oE);return e._reactRootContainer=a,e[Mi]=a.current,Ad(e.nodeType===8?e.parentNode:e),ql(function(){Og(t,a,n,r)}),a}function Ag(e,t,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var a=Yp(o);l.call(a)}}Og(t,o,e,s)}else o=W4(n,t,e,s,r);return Yp(o)}WO=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=zc(t.pendingLanes);n!==0&&(Ib(t,n|1),rr(t,_t()),!(Ze&6)&&(ju=_t()+500,Jo()))}break;case 13:ql(function(){var r=Oi(e,1);if(r!==null){var s=Bn();ps(r,e,1,s)}}),pk(e,1)}};Db=function(e){if(e.tag===13){var t=Oi(e,134217728);if(t!==null){var n=Bn();ps(t,e,134217728,n)}pk(e,134217728)}};KO=function(e){if(e.tag===13){var t=No(e),n=Oi(e,t);if(n!==null){var r=Bn();ps(n,e,t,r)}pk(e,t)}};QO=function(){return at};GO=function(e,t){var n=at;try{return at=e,t()}finally{at=n}};Wv=function(e,t,n){switch(t){case"input":if(zv(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=Sg(r);if(!s)throw Error(te(90));NO(r),zv(r,s)}}}break;case"textarea":RO(e,n);break;case"select":t=n.value,t!=null&&Ya(e,!!n.multiple,t,!1)}};IO=uk;DO=ql;var K4={usingClientEntryPoint:!1,Events:[Ef,Va,Sg,AO,_O,uk]},Sc={findFiberByHostInstance:yl,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Q4={bundleType:Sc.bundleType,version:Sc.version,rendererPackageName:Sc.rendererPackageName,rendererConfig:Sc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ai.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=zO(e),e===null?null:e.stateNode},findFiberByHostInstance:Sc.findFiberByHostInstance||q4,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 fh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fh.isDisabled&&fh.supportsFiber)try{vg=fh.inject(Q4),Fs=fh}catch{}}Cr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=K4;Cr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!gk(t))throw Error(te(200));return U4(e,t,null,n)};Cr.createRoot=function(e,t){if(!gk(e))throw Error(te(299));var n=!1,r="",s=yP;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=hk(e,1,!1,null,null,n,!1,r,s),e[Mi]=t.current,Ad(e.nodeType===8?e.parentNode:e),new mk(t)};Cr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(te(188)):(e=Object.keys(e).join(","),Error(te(268,e)));return e=zO(t),e=e===null?null:e.stateNode,e};Cr.flushSync=function(e){return ql(e)};Cr.hydrate=function(e,t,n){if(!Pg(t))throw Error(te(200));return Ag(null,e,t,!0,n)};Cr.hydrateRoot=function(e,t,n){if(!gk(e))throw Error(te(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=yP;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=gP(t,null,e,1,n??null,s,!1,i,o),e[Mi]=t.current,Ad(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new jg(t)};Cr.render=function(e,t,n){if(!Pg(t))throw Error(te(200));return Ag(null,e,t,!1,n)};Cr.unmountComponentAtNode=function(e){if(!Pg(e))throw Error(te(40));return e._reactRootContainer?(ql(function(){Ag(null,null,e,!1,function(){e._reactRootContainer=null,e[Mi]=null})}),!0):!1};Cr.unstable_batchedUpdates=uk;Cr.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Pg(n))throw Error(te(200));if(e==null||e._reactInternals===void 0)throw Error(te(38));return Ag(e,t,n,!1,r)};Cr.version="18.3.1-next-f1338f8080-20240426";function xP(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(xP)}catch(e){console.error(e)}}xP(),xO.exports=Cr;var Zo=xO.exports;const vP=yg(Zo);var wP,lE=Zo;wP=lE.createRoot,lE.hydrateRoot;/**
|
|
41
|
+
* @remix-run/router v1.23.2
|
|
42
|
+
*
|
|
43
|
+
* Copyright (c) Remix Software Inc.
|
|
44
|
+
*
|
|
45
|
+
* This source code is licensed under the MIT license found in the
|
|
46
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
47
|
+
*
|
|
48
|
+
* @license MIT
|
|
49
|
+
*/function Vd(){return Vd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vd.apply(this,arguments)}var mo;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(mo||(mo={}));const aE="popstate";function G4(e){e===void 0&&(e={});function t(r,s){let{pathname:i,search:o,hash:l}=r.location;return E0("",{pathname:i,search:o,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:bP(s)}return Z4(t,n,null,e)}function Qt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function yk(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function J4(){return Math.random().toString(36).substr(2,8)}function uE(e,t){return{usr:e.state,key:e.key,idx:t}}function E0(e,t,n,r){return n===void 0&&(n=null),Vd({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?nc(t):t,{state:n,key:t&&t.key||r||J4()})}function bP(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function nc(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function Z4(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,l=mo.Pop,a=null,u=c();u==null&&(u=0,o.replaceState(Vd({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function d(){l=mo.Pop;let v=c(),y=v==null?null:v-u;u=v,a&&a({action:l,location:g.location,delta:y})}function h(v,y){l=mo.Push;let w=E0(g.location,v,y);u=c()+1;let b=uE(w,u),C=g.createHref(w);try{o.pushState(b,"",C)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;s.location.assign(C)}i&&a&&a({action:l,location:g.location,delta:1})}function f(v,y){l=mo.Replace;let w=E0(g.location,v,y);u=c();let b=uE(w,u),C=g.createHref(w);o.replaceState(b,"",C),i&&a&&a({action:l,location:g.location,delta:0})}function m(v){let y=s.location.origin!=="null"?s.location.origin:s.location.href,w=typeof v=="string"?v:bP(v);return w=w.replace(/ $/,"%20"),Qt(y,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,y)}let g={get action(){return l},get location(){return e(s,o)},listen(v){if(a)throw new Error("A history only accepts one active listener");return s.addEventListener(aE,d),a=v,()=>{s.removeEventListener(aE,d),a=null}},createHref(v){return t(s,v)},createURL:m,encodeLocation(v){let y=m(v);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:h,replace:f,go(v){return o.go(v)}};return g}var cE;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(cE||(cE={}));function Y4(e,t,n){return n===void 0&&(n="/"),X4(e,t,n)}function X4(e,t,n,r){let s=typeof t=="string"?nc(t):t,i=CP(s.pathname||"/",n);if(i==null)return null;let o=kP(e);e5(o);let l=null;for(let a=0;l==null&&a<o.length;++a){let u=f5(i);l=u5(o[a],u)}return l}function kP(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let s=(i,o,l)=>{let a={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};a.relativePath.startsWith("/")&&(Qt(a.relativePath.startsWith(r),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(r.length));let u=Il([r,a.relativePath]),c=n.concat(a);i.children&&i.children.length>0&&(Qt(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),kP(i.children,t,c,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:l5(u,i.index),routesMeta:c})};return e.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))s(i,o);else for(let a of SP(i.path))s(i,o,a)}),t}function SP(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=SP(r.join("/")),l=[];return l.push(...o.map(a=>a===""?i:[i,a].join("/"))),s&&l.push(...o),l.map(a=>e.startsWith("/")&&a===""?"/":a)}function e5(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:a5(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const t5=/^:[\w-]+$/,n5=3,r5=2,s5=1,i5=10,o5=-2,dE=e=>e==="*";function l5(e,t){let n=e.split("/"),r=n.length;return n.some(dE)&&(r+=o5),t&&(r+=r5),n.filter(s=>!dE(s)).reduce((s,i)=>s+(t5.test(i)?n5:i===""?s5:i5),r)}function a5(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function u5(e,t,n){let{routesMeta:r}=e,s={},i="/",o=[];for(let l=0;l<r.length;++l){let a=r[l],u=l===r.length-1,c=i==="/"?t:t.slice(i.length)||"/",d=c5({path:a.relativePath,caseSensitive:a.caseSensitive,end:u},c),h=a.route;if(!d)return null;Object.assign(s,d.params),o.push({params:s,pathname:Il([i,d.pathname]),pathnameBase:v5(Il([i,d.pathnameBase])),route:h}),d.pathnameBase!=="/"&&(i=Il([i,d.pathnameBase]))}return o}function c5(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=d5(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:r.reduce((u,c,d)=>{let{paramName:h,isOptional:f}=c;if(h==="*"){let g=l[d]||"";o=i.slice(0,i.length-g.length).replace(/(.)\/+$/,"$1")}const m=l[d];return f&&!m?u[h]=void 0:u[h]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function d5(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),yk(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,a)=>(r.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function f5(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return yk(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function CP(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const h5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,p5=e=>h5.test(e);function m5(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?nc(e):e,i;if(n)if(p5(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),yk(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=fE(n.substring(1),"/"):i=fE(n,t)}else i=t;return{pathname:i,search:w5(r),hash:b5(s)}}function fE(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function ax(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function g5(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function y5(e,t){let n=g5(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function x5(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=nc(e):(s=Vd({},e),Qt(!s.pathname||!s.pathname.includes("?"),ax("?","pathname","search",s)),Qt(!s.pathname||!s.pathname.includes("#"),ax("#","pathname","hash",s)),Qt(!s.search||!s.search.includes("#"),ax("#","search","hash",s)));let i=e===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=n;else{let d=t.length-1;if(!r&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),d-=1;s.pathname=h.join("/")}l=d>=0?t[d]:"/"}let a=m5(s,l),u=o&&o!=="/"&&o.endsWith("/"),c=(i||o===".")&&n.endsWith("/");return!a.pathname.endsWith("/")&&(u||c)&&(a.pathname+="/"),a}const Il=e=>e.join("/").replace(/\/\/+/g,"/"),v5=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),w5=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,b5=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function k5(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const EP=["post","put","patch","delete"];new Set(EP);const S5=["get",...EP];new Set(S5);/**
|
|
50
|
+
* React Router v6.30.3
|
|
51
|
+
*
|
|
52
|
+
* Copyright (c) Remix Software Inc.
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the MIT license found in the
|
|
55
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
56
|
+
*
|
|
57
|
+
* @license MIT
|
|
58
|
+
*/function Hd(){return Hd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Hd.apply(this,arguments)}const xk=x.createContext(null),C5=x.createContext(null),_g=x.createContext(null),Ig=x.createContext(null),rc=x.createContext({outlet:null,matches:[],isDataRoute:!1}),NP=x.createContext(null);function Dg(){return x.useContext(Ig)!=null}function Tf(){return Dg()||Qt(!1),x.useContext(Ig).location}function TP(e){x.useContext(_g).static||x.useLayoutEffect(e)}function Lg(){let{isDataRoute:e}=x.useContext(rc);return e?L5():E5()}function E5(){Dg()||Qt(!1);let e=x.useContext(xk),{basename:t,future:n,navigator:r}=x.useContext(_g),{matches:s}=x.useContext(rc),{pathname:i}=Tf(),o=JSON.stringify(y5(s,n.v7_relativeSplatPath)),l=x.useRef(!1);return TP(()=>{l.current=!0}),x.useCallback(function(u,c){if(c===void 0&&(c={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let d=x5(u,JSON.parse(o),i,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:Il([t,d.pathname])),(c.replace?r.replace:r.push)(d,c.state,c)},[t,r,o,i,e])}function N5(e,t){return T5(e,t)}function T5(e,t,n,r){Dg()||Qt(!1);let{navigator:s}=x.useContext(_g),{matches:i}=x.useContext(rc),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let a=o?o.pathnameBase:"/";o&&o.route;let u=Tf(),c;if(t){var d;let v=typeof t=="string"?nc(t):t;a==="/"||(d=v.pathname)!=null&&d.startsWith(a)||Qt(!1),c=v}else c=u;let h=c.pathname||"/",f=h;if(a!=="/"){let v=a.replace(/^\//,"").split("/");f="/"+h.replace(/^\//,"").split("/").slice(v.length).join("/")}let m=Y4(e,{pathname:f}),g=P5(m&&m.map(v=>Object.assign({},v,{params:Object.assign({},l,v.params),pathname:Il([a,s.encodeLocation?s.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?a:Il([a,s.encodeLocation?s.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),i,n,r);return t&&g?x.createElement(Ig.Provider,{value:{location:Hd({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:mo.Pop}},g):g}function R5(){let e=D5(),t=k5(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),n?x.createElement("pre",{style:s},n):null,null)}const M5=x.createElement(R5,null);class O5 extends x.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?x.createElement(rc.Provider,{value:this.props.routeContext},x.createElement(NP.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function j5(e){let{routeContext:t,match:n,children:r}=e,s=x.useContext(xk);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),x.createElement(rc.Provider,{value:t},r)}function P5(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(s=n)==null?void 0:s.errors;if(l!=null){let c=o.findIndex(d=>d.route.id&&(l==null?void 0:l[d.route.id])!==void 0);c>=0||Qt(!1),o=o.slice(0,Math.min(o.length,c+1))}let a=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let c=0;c<o.length;c++){let d=o[c];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(u=c),d.route.id){let{loaderData:h,errors:f}=n,m=d.route.loader&&h[d.route.id]===void 0&&(!f||f[d.route.id]===void 0);if(d.route.lazy||m){a=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,d,h)=>{let f,m=!1,g=null,v=null;n&&(f=l&&d.route.id?l[d.route.id]:void 0,g=d.route.errorElement||M5,a&&(u<0&&h===0?($5("route-fallback"),m=!0,v=null):u===h&&(m=!0,v=d.route.hydrateFallbackElement||null)));let y=t.concat(o.slice(0,h+1)),w=()=>{let b;return f?b=g:m?b=v:d.route.Component?b=x.createElement(d.route.Component,null):d.route.element?b=d.route.element:b=c,x.createElement(j5,{match:d,routeContext:{outlet:c,matches:y,isDataRoute:n!=null},children:b})};return n&&(d.route.ErrorBoundary||d.route.errorElement||h===0)?x.createElement(O5,{location:n.location,revalidation:n.revalidation,component:g,error:f,children:w(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):w()},null)}var RP=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(RP||{}),MP=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(MP||{});function A5(e){let t=x.useContext(xk);return t||Qt(!1),t}function _5(e){let t=x.useContext(C5);return t||Qt(!1),t}function I5(e){let t=x.useContext(rc);return t||Qt(!1),t}function OP(e){let t=I5(),n=t.matches[t.matches.length-1];return n.route.id||Qt(!1),n.route.id}function D5(){var e;let t=x.useContext(NP),n=_5(),r=OP();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function L5(){let{router:e}=A5(RP.UseNavigateStable),t=OP(MP.UseNavigateStable),n=x.useRef(!1);return TP(()=>{n.current=!0}),x.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,Hd({fromRouteId:t},i)))},[e,t])}const hE={};function $5(e,t,n){hE[e]||(hE[e]=!0)}function z5(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function jP(e){Qt(!1)}function F5(e){let{basename:t="/",children:n=null,location:r,navigationType:s=mo.Pop,navigator:i,static:o=!1,future:l}=e;Dg()&&Qt(!1);let a=t.replace(/^\/*/,"/"),u=x.useMemo(()=>({basename:a,navigator:i,static:o,future:Hd({v7_relativeSplatPath:!1},l)}),[a,l,i,o]);typeof r=="string"&&(r=nc(r));let{pathname:c="/",search:d="",hash:h="",state:f=null,key:m="default"}=r,g=x.useMemo(()=>{let v=CP(c,a);return v==null?null:{location:{pathname:v,search:d,hash:h,state:f,key:m},navigationType:s}},[a,c,d,h,f,m,s]);return g==null?null:x.createElement(_g.Provider,{value:u},x.createElement(Ig.Provider,{children:n,value:g}))}function B5(e){let{children:t,location:n}=e;return N5(N0(t),n)}new Promise(()=>{});function N0(e,t){t===void 0&&(t=[]);let n=[];return x.Children.forEach(e,(r,s)=>{if(!x.isValidElement(r))return;let i=[...t,s];if(r.type===x.Fragment){n.push.apply(n,N0(r.props.children,i));return}r.type!==jP&&Qt(!1),!r.props.index||!r.props.children||Qt(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=N0(r.props.children,i)),n.push(o)}),n}/**
|
|
59
|
+
* React Router DOM v6.30.3
|
|
60
|
+
*
|
|
61
|
+
* Copyright (c) Remix Software Inc.
|
|
62
|
+
*
|
|
63
|
+
* This source code is licensed under the MIT license found in the
|
|
64
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
65
|
+
*
|
|
66
|
+
* @license MIT
|
|
67
|
+
*/const V5="6";try{window.__reactRouterVersion=V5}catch{}const H5="startTransition",pE=kf[H5];function U5(e){let{basename:t,children:n,future:r,window:s}=e,i=x.useRef();i.current==null&&(i.current=G4({window:s,v5Compat:!0}));let o=i.current,[l,a]=x.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},c=x.useCallback(d=>{u&&pE?pE(()=>a(d)):a(d)},[a,u]);return x.useLayoutEffect(()=>o.listen(c),[o,c]),x.useEffect(()=>z5(r),[r]),x.createElement(F5,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}var mE;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(mE||(mE={}));var gE;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(gE||(gE={}));var oa=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},q5={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},no,kb,QM,W5=(QM=class{constructor(){he(this,no,q5);he(this,kb,!1)}setTimeoutProvider(e){se(this,no,e)}setTimeout(e,t){return P(this,no).setTimeout(e,t)}clearTimeout(e){P(this,no).clearTimeout(e)}setInterval(e,t){return P(this,no).setInterval(e,t)}clearInterval(e){P(this,no).clearInterval(e)}},no=new WeakMap,kb=new WeakMap,QM),wl=new W5;function K5(e){setTimeout(e,0)}var Wl=typeof window>"u"||"Deno"in globalThis;function Nn(){}function Q5(e,t){return typeof e=="function"?e(t):e}function T0(e){return typeof e=="number"&&e>=0&&e!==1/0}function PP(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ro(e,t){return typeof e=="function"?e(t):e}function Ir(e,t){return typeof e=="function"?e(t):e}function yE(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==vk(o,t.options))return!1}else if(!Ud(t.queryKey,o))return!1}if(n!=="all"){const a=t.isActive();if(n==="active"&&!a||n==="inactive"&&a)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||i&&!i(t))}function xE(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if($o(t.options.mutationKey)!==$o(i))return!1}else if(!Ud(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function vk(e,t){return((t==null?void 0:t.queryKeyHashFn)||$o)(e)}function $o(e){return JSON.stringify(e,(t,n)=>R0(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Ud(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ud(e[n],t[n])):!1}var G5=Object.prototype.hasOwnProperty;function wk(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=vE(e)&&vE(t);if(!r&&!(R0(e)&&R0(t)))return t;const i=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),l=o.length,a=r?new Array(l):{};let u=0;for(let c=0;c<l;c++){const d=r?c:o[c],h=e[d],f=t[d];if(h===f){a[d]=h,(r?c<i:G5.call(e,d))&&u++;continue}if(h===null||f===null||typeof h!="object"||typeof f!="object"){a[d]=f;continue}const m=wk(h,f,n+1);a[d]=m,m===h&&u++}return i===l&&u===i?e:a}function qd(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function vE(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function R0(e){if(!wE(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!wE(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function wE(e){return Object.prototype.toString.call(e)==="[object Object]"}function J5(e){return new Promise(t=>{wl.setTimeout(t,e)})}function M0(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?wk(e,t):t}function Z5(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Y5(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var hr=Symbol();function AP(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===hr?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function bk(e,t){return typeof e=="function"?e(...t):!!e}function X5(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var Cl,ro,cu,GM,eB=(GM=class extends oa{constructor(){super();he(this,Cl);he(this,ro);he(this,cu);se(this,cu,t=>{if(!Wl&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){P(this,ro)||this.setEventListener(P(this,cu))}onUnsubscribe(){var t;this.hasListeners()||((t=P(this,ro))==null||t.call(this),se(this,ro,void 0))}setEventListener(t){var n;se(this,cu,t),(n=P(this,ro))==null||n.call(this),se(this,ro,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){P(this,Cl)!==t&&(se(this,Cl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof P(this,Cl)=="boolean"?P(this,Cl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Cl=new WeakMap,ro=new WeakMap,cu=new WeakMap,GM),kk=new eB;function O0(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var tB=K5;function nB(){let e=[],t=0,n=l=>{l()},r=l=>{l()},s=tB;const i=l=>{t?e.push(l):s(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&s(()=>{r(()=>{l.forEach(a=>{n(a)})})})};return{batch:l=>{let a;t++;try{a=l()}finally{t--,t||o()}return a},batchCalls:l=>(...a)=>{i(()=>{l(...a)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var At=nB(),du,so,fu,JM,rB=(JM=class extends oa{constructor(){super();he(this,du,!0);he(this,so);he(this,fu);se(this,fu,t=>{if(!Wl&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){P(this,so)||this.setEventListener(P(this,fu))}onUnsubscribe(){var t;this.hasListeners()||((t=P(this,so))==null||t.call(this),se(this,so,void 0))}setEventListener(t){var n;se(this,fu,t),(n=P(this,so))==null||n.call(this),se(this,so,t(this.setOnline.bind(this)))}setOnline(t){P(this,du)!==t&&(se(this,du,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return P(this,du)}},du=new WeakMap,so=new WeakMap,fu=new WeakMap,JM),Xp=new rB;function sB(e){return Math.min(1e3*2**e,3e4)}function _P(e){return(e??"online")==="online"?Xp.isOnline():!0}var j0=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function IP(e){let t=!1,n=0,r;const s=O0(),i=()=>s.status!=="pending",o=g=>{var v;if(!i()){const y=new j0(g);h(y),(v=e.onCancel)==null||v.call(e,y)}},l=()=>{t=!0},a=()=>{t=!1},u=()=>kk.isFocused()&&(e.networkMode==="always"||Xp.isOnline())&&e.canRun(),c=()=>_P(e.networkMode)&&e.canRun(),d=g=>{i()||(r==null||r(),s.resolve(g))},h=g=>{i()||(r==null||r(),s.reject(g))},f=()=>new Promise(g=>{var v;r=y=>{(i()||u())&&g(y)},(v=e.onPause)==null||v.call(e)}).then(()=>{var g;r=void 0,i()||(g=e.onContinue)==null||g.call(e)}),m=()=>{if(i())return;let g;const v=n===0?e.initialPromise:void 0;try{g=v??e.fn()}catch(y){g=Promise.reject(y)}Promise.resolve(g).then(d).catch(y=>{var k;if(i())return;const w=e.retry??(Wl?0:3),b=e.retryDelay??sB,C=typeof b=="function"?b(n,y):b,S=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,y);if(t||!S){h(y);return}n++,(k=e.onFail)==null||k.call(e,n,y),J5(C).then(()=>u()?void 0:f()).then(()=>{t?h(y):m()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:l,continueRetry:a,canStart:c,start:()=>(c()?m():f().then(m),s)}}var El,ZM,DP=(ZM=class{constructor(){he(this,El)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),T0(this.gcTime)&&se(this,El,wl.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wl?1/0:5*60*1e3))}clearGcTimeout(){P(this,El)&&(wl.clearTimeout(P(this,El)),se(this,El,void 0))}},El=new WeakMap,ZM),Nl,hu,Ar,Tl,Gt,ff,Rl,ns,ri,YM,iB=(YM=class extends DP{constructor(t){super();he(this,ns);he(this,Nl);he(this,hu);he(this,Ar);he(this,Tl);he(this,Gt);he(this,ff);he(this,Rl);se(this,Rl,!1),se(this,ff,t.defaultOptions),this.setOptions(t.options),this.observers=[],se(this,Tl,t.client),se(this,Ar,P(this,Tl).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,se(this,Nl,kE(this.options)),this.state=t.state??P(this,Nl),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=P(this,Gt))==null?void 0:t.promise}setOptions(t){if(this.options={...P(this,ff),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=kE(this.options);n.data!==void 0&&(this.setState(bE(n.data,n.dataUpdatedAt)),se(this,Nl,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&P(this,Ar).remove(this)}setData(t,n){const r=M0(this.state.data,t,this.options);return Oe(this,ns,ri).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Oe(this,ns,ri).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=P(this,Gt))==null?void 0:r.promise;return(s=P(this,Gt))==null||s.cancel(t),n?n.then(Nn).catch(Nn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(P(this,Nl))}isActive(){return this.observers.some(t=>Ir(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===hr||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ro(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!PP(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=P(this,Gt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=P(this,Gt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),P(this,Ar).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(P(this,Gt)&&(P(this,Rl)?P(this,Gt).cancel({revert:!0}):P(this,Gt).cancelRetry()),this.scheduleGc()),P(this,Ar).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Oe(this,ns,ri).call(this,{type:"invalidate"})}async fetch(t,n){var a,u,c,d,h,f,m,g,v,y,w,b;if(this.state.fetchStatus!=="idle"&&((a=P(this,Gt))==null?void 0:a.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(P(this,Gt))return P(this,Gt).continueRetry(),P(this,Gt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const C=this.observers.find(S=>S.options.queryFn);C&&this.setOptions(C.options)}const r=new AbortController,s=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(se(this,Rl,!0),r.signal)})},i=()=>{const C=AP(this.options,n),k=(()=>{const E={client:P(this,Tl),queryKey:this.queryKey,meta:this.meta};return s(E),E})();return se(this,Rl,!1),this.options.persister?this.options.persister(C,k,this):C(k)},l=(()=>{const C={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:P(this,Tl),state:this.state,fetchFn:i};return s(C),C})();(u=this.options.behavior)==null||u.onFetch(l,this),se(this,hu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=l.fetchOptions)==null?void 0:c.meta))&&Oe(this,ns,ri).call(this,{type:"fetch",meta:(d=l.fetchOptions)==null?void 0:d.meta}),se(this,Gt,IP({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,onCancel:C=>{C instanceof j0&&C.revert&&this.setState({...P(this,hu),fetchStatus:"idle"}),r.abort()},onFail:(C,S)=>{Oe(this,ns,ri).call(this,{type:"failed",failureCount:C,error:S})},onPause:()=>{Oe(this,ns,ri).call(this,{type:"pause"})},onContinue:()=>{Oe(this,ns,ri).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const C=await P(this,Gt).start();if(C===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(C),(f=(h=P(this,Ar).config).onSuccess)==null||f.call(h,C,this),(g=(m=P(this,Ar).config).onSettled)==null||g.call(m,C,this.state.error,this),C}catch(C){if(C instanceof j0){if(C.silent)return P(this,Gt).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw Oe(this,ns,ri).call(this,{type:"error",error:C}),(y=(v=P(this,Ar).config).onError)==null||y.call(v,C,this),(b=(w=P(this,Ar).config).onSettled)==null||b.call(w,this.state.data,C,this),C}finally{this.scheduleGc()}}},Nl=new WeakMap,hu=new WeakMap,Ar=new WeakMap,Tl=new WeakMap,Gt=new WeakMap,ff=new WeakMap,Rl=new WeakMap,ns=new WeakSet,ri=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...LP(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...bE(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return se(this,hu,t.manual?s:void 0),s;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),At.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),P(this,Ar).notify({query:this,type:"updated",action:t})})},YM);function LP(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:_P(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function bE(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function kE(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Jn,Qe,hf,In,Ml,pu,hi,io,pf,mu,gu,Ol,jl,oo,yu,st,Bc,P0,A0,_0,I0,D0,L0,$0,$P,XM,Rf=(XM=class extends oa{constructor(t,n){super();he(this,st);he(this,Jn);he(this,Qe);he(this,hf);he(this,In);he(this,Ml);he(this,pu);he(this,hi);he(this,io);he(this,pf);he(this,mu);he(this,gu);he(this,Ol);he(this,jl);he(this,oo);he(this,yu,new Set);this.options=n,se(this,Jn,t),se(this,io,null),se(this,hi,O0()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(P(this,Qe).addObserver(this),SE(P(this,Qe),this.options)?Oe(this,st,Bc).call(this):this.updateResult(),Oe(this,st,I0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return z0(P(this,Qe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return z0(P(this,Qe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Oe(this,st,D0).call(this),Oe(this,st,L0).call(this),P(this,Qe).removeObserver(this)}setOptions(t){const n=this.options,r=P(this,Qe);if(this.options=P(this,Jn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ir(this.options.enabled,P(this,Qe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Oe(this,st,$0).call(this),P(this,Qe).setOptions(this.options),n._defaulted&&!qd(this.options,n)&&P(this,Jn).getQueryCache().notify({type:"observerOptionsUpdated",query:P(this,Qe),observer:this});const s=this.hasListeners();s&&CE(P(this,Qe),r,this.options,n)&&Oe(this,st,Bc).call(this),this.updateResult(),s&&(P(this,Qe)!==r||Ir(this.options.enabled,P(this,Qe))!==Ir(n.enabled,P(this,Qe))||Ro(this.options.staleTime,P(this,Qe))!==Ro(n.staleTime,P(this,Qe)))&&Oe(this,st,P0).call(this);const i=Oe(this,st,A0).call(this);s&&(P(this,Qe)!==r||Ir(this.options.enabled,P(this,Qe))!==Ir(n.enabled,P(this,Qe))||i!==P(this,oo))&&Oe(this,st,_0).call(this,i)}getOptimisticResult(t){const n=P(this,Jn).getQueryCache().build(P(this,Jn),t),r=this.createResult(n,t);return lB(this,r)&&(se(this,In,r),se(this,pu,this.options),se(this,Ml,P(this,Qe).state)),r}getCurrentResult(){return P(this,In)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&P(this,hi).status==="pending"&&P(this,hi).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){P(this,yu).add(t)}getCurrentQuery(){return P(this,Qe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=P(this,Jn).defaultQueryOptions(t),r=P(this,Jn).getQueryCache().build(P(this,Jn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Oe(this,st,Bc).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),P(this,In)))}createResult(t,n){var O;const r=P(this,Qe),s=this.options,i=P(this,In),o=P(this,Ml),l=P(this,pu),u=t!==r?t.state:P(this,hf),{state:c}=t;let d={...c},h=!1,f;if(n._optimisticResults){const T=this.hasListeners(),j=!T&&SE(t,n),A=T&&CE(t,r,n,s);(j||A)&&(d={...d,...LP(c.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:g,status:v}=d;f=d.data;let y=!1;if(n.placeholderData!==void 0&&f===void 0&&v==="pending"){let T;i!=null&&i.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(T=i.data,y=!0):T=typeof n.placeholderData=="function"?n.placeholderData((O=P(this,gu))==null?void 0:O.state.data,P(this,gu)):n.placeholderData,T!==void 0&&(v="success",f=M0(i==null?void 0:i.data,T,n),h=!0)}if(n.select&&f!==void 0&&!y)if(i&&f===(o==null?void 0:o.data)&&n.select===P(this,pf))f=P(this,mu);else try{se(this,pf,n.select),f=n.select(f),f=M0(i==null?void 0:i.data,f,n),se(this,mu,f),se(this,io,null)}catch(T){se(this,io,T)}P(this,io)&&(m=P(this,io),f=P(this,mu),g=Date.now(),v="error");const w=d.fetchStatus==="fetching",b=v==="pending",C=v==="error",S=b&&w,k=f!==void 0,N={status:v,fetchStatus:d.fetchStatus,isPending:b,isSuccess:v==="success",isError:C,isInitialLoading:S,isLoading:S,data:f,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>u.dataUpdateCount||d.errorUpdateCount>u.errorUpdateCount,isFetching:w,isRefetching:w&&!b,isLoadingError:C&&!k,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:C&&k,isStale:Sk(t,n),refetch:this.refetch,promise:P(this,hi),isEnabled:Ir(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const T=N.data!==void 0,j=N.status==="error"&&!T,A=L=>{j?L.reject(N.error):T&&L.resolve(N.data)},z=()=>{const L=se(this,hi,N.promise=O0());A(L)},D=P(this,hi);switch(D.status){case"pending":t.queryHash===r.queryHash&&A(D);break;case"fulfilled":(j||N.data!==D.value)&&z();break;case"rejected":(!j||N.error!==D.reason)&&z();break}}return N}updateResult(){const t=P(this,In),n=this.createResult(P(this,Qe),this.options);if(se(this,Ml,P(this,Qe).state),se(this,pu,this.options),P(this,Ml).data!==void 0&&se(this,gu,P(this,Qe)),qd(n,t))return;se(this,In,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!P(this,yu).size)return!0;const o=new Set(i??P(this,yu));return this.options.throwOnError&&o.add("error"),Object.keys(P(this,In)).some(l=>{const a=l;return P(this,In)[a]!==t[a]&&o.has(a)})};Oe(this,st,$P).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Oe(this,st,I0).call(this)}},Jn=new WeakMap,Qe=new WeakMap,hf=new WeakMap,In=new WeakMap,Ml=new WeakMap,pu=new WeakMap,hi=new WeakMap,io=new WeakMap,pf=new WeakMap,mu=new WeakMap,gu=new WeakMap,Ol=new WeakMap,jl=new WeakMap,oo=new WeakMap,yu=new WeakMap,st=new WeakSet,Bc=function(t){Oe(this,st,$0).call(this);let n=P(this,Qe).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Nn)),n},P0=function(){Oe(this,st,D0).call(this);const t=Ro(this.options.staleTime,P(this,Qe));if(Wl||P(this,In).isStale||!T0(t))return;const r=PP(P(this,In).dataUpdatedAt,t)+1;se(this,Ol,wl.setTimeout(()=>{P(this,In).isStale||this.updateResult()},r))},A0=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(P(this,Qe)):this.options.refetchInterval)??!1},_0=function(t){Oe(this,st,L0).call(this),se(this,oo,t),!(Wl||Ir(this.options.enabled,P(this,Qe))===!1||!T0(P(this,oo))||P(this,oo)===0)&&se(this,jl,wl.setInterval(()=>{(this.options.refetchIntervalInBackground||kk.isFocused())&&Oe(this,st,Bc).call(this)},P(this,oo)))},I0=function(){Oe(this,st,P0).call(this),Oe(this,st,_0).call(this,Oe(this,st,A0).call(this))},D0=function(){P(this,Ol)&&(wl.clearTimeout(P(this,Ol)),se(this,Ol,void 0))},L0=function(){P(this,jl)&&(wl.clearInterval(P(this,jl)),se(this,jl,void 0))},$0=function(){const t=P(this,Jn).getQueryCache().build(P(this,Jn),this.options);if(t===P(this,Qe))return;const n=P(this,Qe);se(this,Qe,t),se(this,hf,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},$P=function(t){At.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(P(this,In))}),P(this,Jn).getQueryCache().notify({query:P(this,Qe),type:"observerResultsUpdated"})})},XM);function oB(e,t){return Ir(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function SE(e,t){return oB(e,t)||e.state.data!==void 0&&z0(e,t,t.refetchOnMount)}function z0(e,t,n){if(Ir(t.enabled,e)!==!1&&Ro(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Sk(e,t)}return!1}function CE(e,t,n,r){return(e!==t||Ir(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Sk(e,n)}function Sk(e,t){return Ir(t.enabled,e)!==!1&&e.isStaleByTime(Ro(t.staleTime,e))}function lB(e,t){return!qd(e.getCurrentResult(),t)}function em(e){return{onFetch:(t,n)=>{var c,d,h,f,m;const r=t.options,s=(h=(d=(c=t.fetchOptions)==null?void 0:c.meta)==null?void 0:d.fetchMore)==null?void 0:h.direction,i=((f=t.state.data)==null?void 0:f.pages)||[],o=((m=t.state.data)==null?void 0:m.pageParams)||[];let l={pages:[],pageParams:[]},a=0;const u=async()=>{let g=!1;const v=b=>{X5(b,()=>t.signal,()=>g=!0)},y=AP(t.options,t.fetchOptions),w=async(b,C,S)=>{if(g)return Promise.reject();if(C==null&&b.pages.length)return Promise.resolve(b);const E=(()=>{const j={client:t.client,queryKey:t.queryKey,pageParam:C,direction:S?"backward":"forward",meta:t.options.meta};return v(j),j})(),N=await y(E),{maxPages:O}=t.options,T=S?Y5:Z5;return{pages:T(b.pages,N,O),pageParams:T(b.pageParams,C,O)}};if(s&&i.length){const b=s==="backward",C=b?zP:F0,S={pages:i,pageParams:o},k=C(r,S);l=await w(S,k,b)}else{const b=e??i.length;do{const C=a===0?o[0]??r.initialPageParam:F0(r,l);if(a>0&&C==null)break;l=await w(l,C),a++}while(a<b)}return l};t.options.persister?t.fetchFn=()=>{var g,v;return(v=(g=t.options).persister)==null?void 0:v.call(g,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function F0(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function zP(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}function aB(e,t){return t?F0(e,t)!=null:!1}function uB(e,t){return!t||!e.getPreviousPageParam?!1:zP(e,t)!=null}var FP=class extends Rf{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:em()})}getOptimisticResult(e){return e.behavior=em(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var m,g;const{state:n}=e,r=super.createResult(e,t),{isFetching:s,isRefetching:i,isError:o,isRefetchError:l}=r,a=(g=(m=n.fetchMeta)==null?void 0:m.fetchMore)==null?void 0:g.direction,u=o&&a==="forward",c=s&&a==="forward",d=o&&a==="backward",h=s&&a==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:aB(t,n.data),hasPreviousPage:uB(t,n.data),isFetchNextPageError:u,isFetchingNextPage:c,isFetchPreviousPageError:d,isFetchingPreviousPage:h,isRefetchError:l&&!u&&!d,isRefetching:i&&!c&&!h}}},mf,As,Cn,Pl,_s,Vi,eO,cB=(eO=class extends DP{constructor(t){super();he(this,_s);he(this,mf);he(this,As);he(this,Cn);he(this,Pl);se(this,mf,t.client),this.mutationId=t.mutationId,se(this,Cn,t.mutationCache),se(this,As,[]),this.state=t.state||BP(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){P(this,As).includes(t)||(P(this,As).push(t),this.clearGcTimeout(),P(this,Cn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){se(this,As,P(this,As).filter(n=>n!==t)),this.scheduleGc(),P(this,Cn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){P(this,As).length||(this.state.status==="pending"?this.scheduleGc():P(this,Cn).remove(this))}continue(){var t;return((t=P(this,Pl))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,a,u,c,d,h,f,m,g,v,y,w,b,C,S,k,E;const n=()=>{Oe(this,_s,Vi).call(this,{type:"continue"})},r={client:P(this,mf),meta:this.options.meta,mutationKey:this.options.mutationKey};se(this,Pl,IP({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(N,O)=>{Oe(this,_s,Vi).call(this,{type:"failed",failureCount:N,error:O})},onPause:()=>{Oe(this,_s,Vi).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>P(this,Cn).canRun(this)}));const s=this.state.status==="pending",i=!P(this,Pl).canStart();try{if(s)n();else{Oe(this,_s,Vi).call(this,{type:"pending",variables:t,isPaused:i}),P(this,Cn).config.onMutate&&await P(this,Cn).config.onMutate(t,this,r);const O=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t,r));O!==this.state.context&&Oe(this,_s,Vi).call(this,{type:"pending",context:O,variables:t,isPaused:i})}const N=await P(this,Pl).start();return await((u=(a=P(this,Cn).config).onSuccess)==null?void 0:u.call(a,N,t,this.state.context,this,r)),await((d=(c=this.options).onSuccess)==null?void 0:d.call(c,N,t,this.state.context,r)),await((f=(h=P(this,Cn).config).onSettled)==null?void 0:f.call(h,N,null,this.state.variables,this.state.context,this,r)),await((g=(m=this.options).onSettled)==null?void 0:g.call(m,N,null,t,this.state.context,r)),Oe(this,_s,Vi).call(this,{type:"success",data:N}),N}catch(N){try{await((y=(v=P(this,Cn).config).onError)==null?void 0:y.call(v,N,t,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((b=(w=this.options).onError)==null?void 0:b.call(w,N,t,this.state.context,r))}catch(O){Promise.reject(O)}try{await((S=(C=P(this,Cn).config).onSettled)==null?void 0:S.call(C,void 0,N,this.state.variables,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((E=(k=this.options).onSettled)==null?void 0:E.call(k,void 0,N,t,this.state.context,r))}catch(O){Promise.reject(O)}throw Oe(this,_s,Vi).call(this,{type:"error",error:N}),N}finally{P(this,Cn).runNext(this)}}},mf=new WeakMap,As=new WeakMap,Cn=new WeakMap,Pl=new WeakMap,_s=new WeakSet,Vi=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),At.batch(()=>{P(this,As).forEach(r=>{r.onMutationUpdate(t)}),P(this,Cn).notify({mutation:this,type:"updated",action:t})})},eO);function BP(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var pi,rs,gf,tO,dB=(tO=class extends oa{constructor(t={}){super();he(this,pi);he(this,rs);he(this,gf);this.config=t,se(this,pi,new Set),se(this,rs,new Map),se(this,gf,0)}build(t,n,r){const s=new cB({client:t,mutationCache:this,mutationId:++Gf(this,gf)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){P(this,pi).add(t);const n=hh(t);if(typeof n=="string"){const r=P(this,rs).get(n);r?r.push(t):P(this,rs).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(P(this,pi).delete(t)){const n=hh(t);if(typeof n=="string"){const r=P(this,rs).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&P(this,rs).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=hh(t);if(typeof n=="string"){const r=P(this,rs).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=hh(t);if(typeof n=="string"){const s=(r=P(this,rs).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){At.batch(()=>{P(this,pi).forEach(t=>{this.notify({type:"removed",mutation:t})}),P(this,pi).clear(),P(this,rs).clear()})}getAll(){return Array.from(P(this,pi))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>xE(n,r))}findAll(t={}){return this.getAll().filter(n=>xE(t,n))}notify(t){At.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return At.batch(()=>Promise.all(t.map(n=>n.continue().catch(Nn))))}},pi=new WeakMap,rs=new WeakMap,gf=new WeakMap,tO);function hh(e){var t;return(t=e.options.scope)==null?void 0:t.id}var mi,lo,Zn,gi,Ti,ap,B0,nO,fB=(nO=class extends oa{constructor(n,r){super();he(this,Ti);he(this,mi);he(this,lo);he(this,Zn);he(this,gi);se(this,mi,n),this.setOptions(r),this.bindMethods(),Oe(this,Ti,ap).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const r=this.options;this.options=P(this,mi).defaultMutationOptions(n),qd(this.options,r)||P(this,mi).getMutationCache().notify({type:"observerOptionsUpdated",mutation:P(this,Zn),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&$o(r.mutationKey)!==$o(this.options.mutationKey)?this.reset():((s=P(this,Zn))==null?void 0:s.state.status)==="pending"&&P(this,Zn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=P(this,Zn))==null||n.removeObserver(this)}onMutationUpdate(n){Oe(this,Ti,ap).call(this),Oe(this,Ti,B0).call(this,n)}getCurrentResult(){return P(this,lo)}reset(){var n;(n=P(this,Zn))==null||n.removeObserver(this),se(this,Zn,void 0),Oe(this,Ti,ap).call(this),Oe(this,Ti,B0).call(this)}mutate(n,r){var s;return se(this,gi,r),(s=P(this,Zn))==null||s.removeObserver(this),se(this,Zn,P(this,mi).getMutationCache().build(P(this,mi),this.options)),P(this,Zn).addObserver(this),P(this,Zn).execute(n)}},mi=new WeakMap,lo=new WeakMap,Zn=new WeakMap,gi=new WeakMap,Ti=new WeakSet,ap=function(){var r;const n=((r=P(this,Zn))==null?void 0:r.state)??BP();se(this,lo,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},B0=function(n){At.batch(()=>{var r,s,i,o,l,a,u,c;if(P(this,gi)&&this.hasListeners()){const d=P(this,lo).variables,h=P(this,lo).context,f={client:P(this,mi),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(r=P(this,gi)).onSuccess)==null||s.call(r,n.data,d,h,f)}catch(m){Promise.reject(m)}try{(o=(i=P(this,gi)).onSettled)==null||o.call(i,n.data,null,d,h,f)}catch(m){Promise.reject(m)}}else if((n==null?void 0:n.type)==="error"){try{(a=(l=P(this,gi)).onError)==null||a.call(l,n.error,d,h,f)}catch(m){Promise.reject(m)}try{(c=(u=P(this,gi)).onSettled)==null||c.call(u,void 0,n.error,d,h,f)}catch(m){Promise.reject(m)}}}this.listeners.forEach(d=>{d(P(this,lo))})})},nO);function EE(e,t){const n=new Set(t);return e.filter(r=>!n.has(r))}function hB(e,t,n){const r=e.slice(0);return r[t]=n,r}var xu,dr,vu,wu,_r,ao,yf,xf,vf,wf,mn,V0,H0,U0,q0,W0,rO,pB=(rO=class extends oa{constructor(t,n,r){super();he(this,mn);he(this,xu);he(this,dr);he(this,vu);he(this,wu);he(this,_r);he(this,ao);he(this,yf);he(this,xf);he(this,vf);he(this,wf,[]);se(this,xu,t),se(this,wu,r),se(this,vu,[]),se(this,_r,[]),se(this,dr,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&P(this,_r).forEach(t=>{t.subscribe(n=>{Oe(this,mn,q0).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,P(this,_r).forEach(t=>{t.destroy()})}setQueries(t,n){se(this,vu,t),se(this,wu,n),At.batch(()=>{const r=P(this,_r),s=Oe(this,mn,U0).call(this,P(this,vu));s.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const i=s.map(d=>d.observer),o=i.map(d=>d.getCurrentResult()),l=r.length!==i.length,a=i.some((d,h)=>d!==r[h]),u=l||a,c=u?!0:o.some((d,h)=>{const f=P(this,dr)[h];return!f||!qd(d,f)});!u&&!c||(u&&(se(this,wf,s),se(this,_r,i)),se(this,dr,o),this.hasListeners()&&(u&&(EE(r,i).forEach(d=>{d.destroy()}),EE(i,r).forEach(d=>{d.subscribe(h=>{Oe(this,mn,q0).call(this,d,h)})})),Oe(this,mn,W0).call(this)))})}getCurrentResult(){return P(this,dr)}getQueries(){return P(this,_r).map(t=>t.getCurrentQuery())}getObservers(){return P(this,_r)}getOptimisticResult(t,n){const r=Oe(this,mn,U0).call(this,t),s=r.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),i=r.map(o=>o.defaultedQueryOptions.queryHash);return[s,o=>Oe(this,mn,H0).call(this,o??s,n,i),()=>Oe(this,mn,V0).call(this,s,r)]}},xu=new WeakMap,dr=new WeakMap,vu=new WeakMap,wu=new WeakMap,_r=new WeakMap,ao=new WeakMap,yf=new WeakMap,xf=new WeakMap,vf=new WeakMap,wf=new WeakMap,mn=new WeakSet,V0=function(t,n){return n.map((r,s)=>{const i=t[s];return r.defaultedQueryOptions.notifyOnChangeProps?i:r.observer.trackResult(i,o=>{n.forEach(l=>{l.observer.trackProp(o)})})})},H0=function(t,n,r){if(n){const s=P(this,vf),i=r!==void 0&&s!==void 0&&(s.length!==r.length||r.some((o,l)=>o!==s[l]));return(!P(this,ao)||P(this,dr)!==P(this,xf)||i||n!==P(this,yf))&&(se(this,yf,n),se(this,xf,P(this,dr)),r!==void 0&&se(this,vf,r),se(this,ao,wk(P(this,ao),n(t)))),P(this,ao)}return t},U0=function(t){const n=new Map;P(this,_r).forEach(s=>{const i=s.options.queryHash;if(!i)return;const o=n.get(i);o?o.push(s):n.set(i,[s])});const r=[];return t.forEach(s=>{var a;const i=P(this,xu).defaultQueryOptions(s),l=((a=n.get(i.queryHash))==null?void 0:a.shift())??new Rf(P(this,xu),i);r.push({defaultedQueryOptions:i,observer:l})}),r},q0=function(t,n){const r=P(this,_r).indexOf(t);r!==-1&&(se(this,dr,hB(P(this,dr),r,n)),Oe(this,mn,W0).call(this))},W0=function(){var t;if(this.hasListeners()){const n=P(this,ao),r=Oe(this,mn,V0).call(this,P(this,dr),P(this,wf)),s=Oe(this,mn,H0).call(this,r,(t=P(this,wu))==null?void 0:t.combine);n!==s&&At.batch(()=>{this.listeners.forEach(i=>{i(P(this,dr))})})}},rO),Is,sO,mB=(sO=class extends oa{constructor(t={}){super();he(this,Is);this.config=t,se(this,Is,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??vk(s,n);let o=this.get(i);return o||(o=new iB({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){P(this,Is).has(t.queryHash)||(P(this,Is).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=P(this,Is).get(t.queryHash);n&&(t.destroy(),n===t&&P(this,Is).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){At.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return P(this,Is).get(t)}getAll(){return[...P(this,Is).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>yE(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>yE(t,r)):n}notify(t){At.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){At.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){At.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Is=new WeakMap,sO),Ot,uo,co,bu,ku,fo,Su,Cu,iO,gB=(iO=class{constructor(e={}){he(this,Ot);he(this,uo);he(this,co);he(this,bu);he(this,ku);he(this,fo);he(this,Su);he(this,Cu);se(this,Ot,e.queryCache||new mB),se(this,uo,e.mutationCache||new dB),se(this,co,e.defaultOptions||{}),se(this,bu,new Map),se(this,ku,new Map),se(this,fo,0)}mount(){Gf(this,fo)._++,P(this,fo)===1&&(se(this,Su,kk.subscribe(async e=>{e&&(await this.resumePausedMutations(),P(this,Ot).onFocus())})),se(this,Cu,Xp.subscribe(async e=>{e&&(await this.resumePausedMutations(),P(this,Ot).onOnline())})))}unmount(){var e,t;Gf(this,fo)._--,P(this,fo)===0&&((e=P(this,Su))==null||e.call(this),se(this,Su,void 0),(t=P(this,Cu))==null||t.call(this),se(this,Cu,void 0))}isFetching(e){return P(this,Ot).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return P(this,uo).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=P(this,Ot).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=P(this,Ot).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ro(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return P(this,Ot).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=P(this,Ot).get(r.queryHash),i=s==null?void 0:s.state.data,o=Q5(t,i);if(o!==void 0)return P(this,Ot).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return At.batch(()=>P(this,Ot).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=P(this,Ot).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=P(this,Ot);At.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=P(this,Ot);return At.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=At.batch(()=>P(this,Ot).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Nn).catch(Nn)}invalidateQueries(e,t={}){return At.batch(()=>(P(this,Ot).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=At.batch(()=>P(this,Ot).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(Nn)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Nn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=P(this,Ot).build(this,t);return n.isStaleByTime(Ro(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Nn).catch(Nn)}fetchInfiniteQuery(e){return e.behavior=em(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Nn).catch(Nn)}ensureInfiniteQueryData(e){return e.behavior=em(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Xp.isOnline()?P(this,uo).resumePausedMutations():Promise.resolve()}getQueryCache(){return P(this,Ot)}getMutationCache(){return P(this,uo)}getDefaultOptions(){return P(this,co)}setDefaultOptions(e){se(this,co,e)}setQueryDefaults(e,t){P(this,bu).set($o(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...P(this,bu).values()],n={};return t.forEach(r=>{Ud(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){P(this,ku).set($o(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...P(this,ku).values()],n={};return t.forEach(r=>{Ud(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...P(this,co).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=vk(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===hr&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...P(this,co).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){P(this,Ot).clear(),P(this,uo).clear()}},Ot=new WeakMap,uo=new WeakMap,co=new WeakMap,bu=new WeakMap,ku=new WeakMap,fo=new WeakMap,Su=new WeakMap,Cu=new WeakMap,iO),VP=x.createContext(void 0),_i=e=>{const t=x.useContext(VP);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},yB=({client:e,children:t})=>(x.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(VP.Provider,{value:e,children:t})),HP=x.createContext(!1),UP=()=>x.useContext(HP);HP.Provider;function xB(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var vB=x.createContext(xB()),qP=()=>x.useContext(vB),WP=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?bk(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},KP=e=>{x.useEffect(()=>{e.clearReset()},[e])},QP=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||bk(n,[e.error,r])),Ck=(e,t)=>t.state.data===void 0,GP=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},JP=(e,t)=>e.isLoading&&e.isFetching&&!t,K0=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,tm=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ZP({queries:e,...t},n){const r=_i(n),s=UP(),i=qP(),o=x.useMemo(()=>e.map(g=>{const v=r.defaultQueryOptions(g);return v._optimisticResults=s?"isRestoring":"optimistic",v}),[e,r,s]);o.forEach(g=>{GP(g);const v=r.getQueryCache().get(g.queryHash);WP(g,i,v)}),KP(i);const[l]=x.useState(()=>new pB(r,o,t)),[a,u,c]=l.getOptimisticResult(o,t.combine),d=!s&&t.subscribed!==!1;x.useSyncExternalStore(x.useCallback(g=>d?l.subscribe(At.batchCalls(g)):Nn,[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),x.useEffect(()=>{l.setQueries(o,t)},[o,t,l]);const f=a.some((g,v)=>K0(o[v],g))?a.flatMap((g,v)=>{const y=o[v];if(y){const w=new Rf(r,y);if(K0(y,g))return tm(y,w,i);JP(g,s)&&tm(y,w,i)}return[]}):[];if(f.length>0)throw Promise.all(f);const m=a.find((g,v)=>{const y=o[v];return y&&QP({result:g,errorResetBoundary:i,throwOnError:y.throwOnError,query:r.getQueryCache().get(y.queryHash),suspense:y.suspense})});if(m!=null&&m.error)throw m.error;return u(c())}function $g(e,t,n){var h,f,m,g;const r=UP(),s=qP(),i=_i(n),o=i.defaultQueryOptions(e);(f=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||f.call(h,o);const l=i.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",GP(o),WP(o,s,l),KP(s);const a=!i.getQueryCache().get(o.queryHash),[u]=x.useState(()=>new t(i,o)),c=u.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(v=>{const y=d?u.subscribe(At.batchCalls(v)):Nn;return u.updateResult(),y},[u,d]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),x.useEffect(()=>{u.setOptions(o)},[o,u]),K0(o,c))throw tm(o,u,s);if(QP({result:c,errorResetBoundary:s,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw c.error;if((g=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||g.call(m,o,c),o.experimental_prefetchInRender&&!Wl&&JP(c,r)){const v=a?tm(o,u,s):l==null?void 0:l.promise;v==null||v.catch(Nn).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?c:u.trackResult(c)}function Mf(e,t){return $g(e,Rf,t)}function wB(e,t){return $g({...e,enabled:!0,suspense:!0,throwOnError:Ck,placeholderData:void 0},Rf,t)}function bB(e,t){return $g({...e,enabled:!0,suspense:!0,throwOnError:Ck},FP,t)}function kB(e,t){return ZP({...e,queries:e.queries.map(n=>({...n,suspense:!0,throwOnError:Ck,enabled:!0,placeholderData:void 0}))},t)}function SB(e,t){const n=_i(t);n.getQueryState(e.queryKey)||n.prefetchQuery(e)}function CB(e,t){const n=_i(t);n.getQueryState(e.queryKey)||n.prefetchInfiniteQuery(e)}function ai(e,t){const n=_i(t),[r]=x.useState(()=>new fB(n,e));x.useEffect(()=>{r.setOptions(e)},[r,e]);const s=x.useSyncExternalStore(x.useCallback(o=>r.subscribe(At.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=x.useCallback((o,l)=>{r.mutate(o,l).catch(Nn)},[r]);if(s.error&&bk(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}function EB(e,t){return $g(e,FP,t)}function Kl(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function NB(){return Object.create(null)}const TB=typeof Symbol=="function"&&!!Symbol.asyncIterator;function YP(e){return TB&&Kl(e)&&Symbol.asyncIterator in e}var RB=Object.create,XP=Object.defineProperty,MB=Object.getOwnPropertyDescriptor,eA=Object.getOwnPropertyNames,OB=Object.getPrototypeOf,jB=Object.prototype.hasOwnProperty,Of=(e,t)=>function(){return t||(0,e[eA(e)[0]])((t={exports:{}}).exports,t),t.exports},PB=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var s=eA(t),i=0,o=s.length,l;i<o;i++)l=s[i],!jB.call(e,l)&&l!==n&&XP(e,l,{get:(a=>t[a]).bind(null,l),enumerable:!(r=MB(t,l))||r.enumerable});return e},zg=(e,t,n)=>(n=e!=null?RB(OB(e)):{},PB(XP(n,"default",{value:e,enumerable:!0}),e));const tA=()=>{},NE=e=>{Object.freeze&&Object.freeze(e)};function nA(e,t,n){var r;const s=t.join(".");return(r=n[s])!==null&&r!==void 0||(n[s]=new Proxy(tA,{get(i,o){if(!(typeof o!="string"||o==="then"))return nA(e,[...t,o],n)},apply(i,o,l){const a=t[t.length-1];let u={args:l,path:t};return a==="call"?u={args:l.length>=2?[l[1]]:[],path:t.slice(0,-1)}:a==="apply"&&(u={args:l.length>=2?l[1]:[],path:t.slice(0,-1)}),NE(u.args),NE(u.path),e(u)}})),n[s]}const Fg=e=>nA(e,[],NB()),Ek=e=>new Proxy(tA,{get(t,n){if(n!=="then")return e(n)}});var rA=Of({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(r){"@babel/helpers - typeof";return t.exports=n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},t.exports.__esModule=!0,t.exports.default=t.exports,n(r)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),AB=Of({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=rA().default;function r(s,i){if(n(s)!="object"||!s)return s;var o=s[Symbol.toPrimitive];if(o!==void 0){var l=o.call(s,i||"default");if(n(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(s)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),_B=Of({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=rA().default,r=AB();function s(i){var o=r(i,"string");return n(o)=="symbol"?o:o+""}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}}),sA=Of({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=_B();function r(s,i,o){return(i=n(i))in s?Object.defineProperty(s,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[i]=o,s}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Nk=Of({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=sA();function r(i,o){var l=Object.keys(i);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(i);o&&(a=a.filter(function(u){return Object.getOwnPropertyDescriptor(i,u).enumerable})),l.push.apply(l,a)}return l}function s(i){for(var o=1;o<arguments.length;o++){var l=arguments[o]!=null?arguments[o]:{};o%2?r(Object(l),!0).forEach(function(a){n(i,a,l[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(l)):r(Object(l)).forEach(function(a){Object.defineProperty(i,a,Object.getOwnPropertyDescriptor(l,a))})}return i}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}});zg(Nk());zg(sA());var ph=zg(Nk());function IB(e,t){if("error"in e){const r=t.deserialize(e.error);return{ok:!1,error:(0,ph.default)((0,ph.default)({},e),{},{error:r})}}return{ok:!0,result:(0,ph.default)((0,ph.default)({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var ux=class extends Error{constructor(){super("Unable to transform response from server")}};function DB(e,t){let n;try{n=IB(e,t)}catch{throw new ux}if(!n.ok&&(!Kl(n.error.error)||typeof n.error.error.code!="number"))throw new ux;if(n.ok&&!Kl(n.result))throw new ux;return n}zg(Nk());function Bg(e){const t={subscribe(n){let r=null,s=!1,i=!1,o=!1;function l(){if(r===null){o=!0;return}i||(i=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=e({next(a){var u;s||(u=n.next)===null||u===void 0||u.call(n,a)},error(a){var u;s||(s=!0,(u=n.error)===null||u===void 0||u.call(n,a),l())},complete(){var a;s||(s=!0,(a=n.complete)===null||a===void 0||a.call(n),l())}}),o&&l(),{unsubscribe:l}},pipe(...n){return n.reduce(LB,t)}};return t}function LB(e,t){return t(e)}function $B(e){const t=new AbortController;return new Promise((r,s)=>{let i=!1;function o(){i||(i=!0,l.unsubscribe())}t.signal.addEventListener("abort",()=>{s(t.signal.reason)});const l=e.subscribe({next(a){i=!0,r(a),o()},error(a){s(a)},complete(){t.abort(),o()}})})}var zB=Object.create,iA=Object.defineProperty,FB=Object.getOwnPropertyDescriptor,oA=Object.getOwnPropertyNames,BB=Object.getPrototypeOf,VB=Object.prototype.hasOwnProperty,Yo=(e,t)=>function(){return t||(0,e[oA(e)[0]])((t={exports:{}}).exports,t),t.exports},HB=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var s=oA(t),i=0,o=s.length,l;i<o;i++)l=s[i],!VB.call(e,l)&&l!==n&&iA(e,l,{get:(a=>t[a]).bind(null,l),enumerable:!(r=FB(t,l))||r.enumerable});return e},la=(e,t,n)=>(n=e!=null?zB(BB(e)):{},HB(t||!e||!e.__esModule?iA(n,"default",{value:e,enumerable:!0}):n,e)),UB=Yo({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(e,t){function n(r,s){if(r==null)return{};var i={};for(var o in r)if({}.hasOwnProperty.call(r,o)){if(s.includes(o))continue;i[o]=r[o]}return i}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),qB=Yo({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(e,t){var n=UB();function r(s,i){if(s==null)return{};var o,l,a=n(s,i);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(s);for(l=0;l<u.length;l++)o=u[l],i.includes(o)||{}.propertyIsEnumerable.call(s,o)&&(a[o]=s[o])}return a}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),lA=Yo({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(r){"@babel/helpers - typeof";return t.exports=n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},t.exports.__esModule=!0,t.exports.default=t.exports,n(r)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),WB=Yo({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=lA().default;function r(s,i){if(n(s)!="object"||!s)return s;var o=s[Symbol.toPrimitive];if(o!==void 0){var l=o.call(s,i||"default");if(n(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(s)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),KB=Yo({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=lA().default,r=WB();function s(i){var o=r(i,"string");return n(o)=="symbol"?o:o+""}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}}),QB=Yo({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=KB();function r(s,i,o){return(i=n(i))in s?Object.defineProperty(s,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[i]=o,s}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),jf=Yo({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=QB();function r(i,o){var l=Object.keys(i);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(i);o&&(a=a.filter(function(u){return Object.getOwnPropertyDescriptor(i,u).enumerable})),l.push.apply(l,a)}return l}function s(i){for(var o=1;o<arguments.length;o++){var l=arguments[o]!=null?arguments[o]:{};o%2?r(Object(l),!0).forEach(function(a){n(i,a,l[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(l)):r(Object(l)).forEach(function(a){Object.defineProperty(i,a,Object.getOwnPropertyDescriptor(l,a))})}return i}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}}),GB=la(qB(),1),TE=la(jf(),1);const JB=["cursor","direction"];function Ps(e,t,n){const r=e.flatMap(s=>s.split("."));if(!t&&(!n||n==="any"))return r.length?[r]:[];if(n==="infinite"&&Kl(t)&&("direction"in t||"cursor"in t)){const{cursor:s,direction:i}=t,o=(0,GB.default)(t,JB);return[r,{input:o,type:"infinite"}]}return[r,(0,TE.default)((0,TE.default)({},typeof t<"u"&&t!==hr&&{input:t}),n&&n!=="any"&&{type:n})]}function up(e){return Ps(e,void 0,"any")}var ZB=Object.create,aA=Object.defineProperty,YB=Object.getOwnPropertyDescriptor,uA=Object.getOwnPropertyNames,XB=Object.getPrototypeOf,eV=Object.prototype.hasOwnProperty,Js=(e,t)=>function(){return t||(0,e[uA(e)[0]])((t={exports:{}}).exports,t),t.exports},tV=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var s=uA(t),i=0,o=s.length,l;i<o;i++)l=s[i],!eV.call(e,l)&&l!==n&&aA(e,l,{get:(a=>t[a]).bind(null,l),enumerable:!(r=YB(t,l))||r.enumerable});return e},It=(e,t,n)=>(n=e!=null?ZB(XB(e)):{},tV(aA(n,"default",{value:e,enumerable:!0}),e)),cA=Js({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(r){"@babel/helpers - typeof";return t.exports=n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},t.exports.__esModule=!0,t.exports.default=t.exports,n(r)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),nV=Js({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=cA().default;function r(s,i){if(n(s)!="object"||!s)return s;var o=s[Symbol.toPrimitive];if(o!==void 0){var l=o.call(s,i||"default");if(n(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(s)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),rV=Js({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=cA().default,r=nV();function s(i){var o=r(i,"string");return n(o)=="symbol"?o:o+""}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}}),aa=Js({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=rV();function r(s,i,o){return(i=n(i))in s?Object.defineProperty(s,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[i]=o,s}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Ss=Js({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=aa();function r(i,o){var l=Object.keys(i);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(i);o&&(a=a.filter(function(u){return Object.getOwnPropertyDescriptor(i,u).enumerable})),l.push.apply(l,a)}return l}function s(i){for(var o=1;o<arguments.length;o++){var l=arguments[o]!=null?arguments[o]:{};o%2?r(Object(l),!0).forEach(function(a){n(i,a,l[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(l)):r(Object(l)).forEach(function(a){Object.defineProperty(i,a,Object.getOwnPropertyDescriptor(l,a))})}return i}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}});function sV(e){return t=>{let n=0,r=null;const s=[];function i(){r||(r=t.subscribe({next(l){for(const u of s){var a;(a=u.next)===null||a===void 0||a.call(u,l)}},error(l){for(const u of s){var a;(a=u.error)===null||a===void 0||a.call(u,l)}},complete(){for(const a of s){var l;(l=a.complete)===null||l===void 0||l.call(a)}}}))}function o(){if(n===0&&r){const l=r;r=null,l.unsubscribe()}}return Bg(l=>(n++,s.push(l),i(),{unsubscribe(){n--,o();const a=s.findIndex(u=>u===l);a>-1&&s.splice(a,1)}}))}}function iV(e){let t=e;const n=[],r=o=>{t!==void 0&&o.next(t),n.push(o)},s=o=>{n.splice(n.indexOf(o),1)},i=Bg(o=>(r(o),()=>{s(o)}));return i.next=o=>{if(t!==o){t=o;for(const l of n)l.next(o)}},i.get=()=>t,i}function oV(e){return Bg(t=>{function n(s=0,i=e.op){const o=e.links[s];if(!o)throw new Error("No more links to execute - did you forget to add an ending link?");return o({op:i,next(a){return n(s+1,a)}})}return n().subscribe(t)})}var mh=It(aa()),xa=It(Ss());function lV(e){return e instanceof nm}function aV(e){return Kl(e)&&Kl(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function uV(e,t){return typeof e=="string"?e:Kl(e)&&typeof e.message=="string"?e.message:t}var nm=class cp extends Error{constructor(t,n){var r,s;const i=n==null?void 0:n.cause;super(t,{cause:i}),(0,mh.default)(this,"cause",void 0),(0,mh.default)(this,"shape",void 0),(0,mh.default)(this,"data",void 0),(0,mh.default)(this,"meta",void 0),this.meta=n==null?void 0:n.meta,this.cause=i,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(s=n.result)===null||s===void 0?void 0:s.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,cp.prototype)}static from(t,n={}){const r=t;return lV(r)?(n.meta&&(r.meta=(0,xa.default)((0,xa.default)({},r.meta),n.meta)),r):aV(r)?new cp(r.error.message,(0,xa.default)((0,xa.default)({},n),{},{result:r})):new cp(uV(r,"Unknown error"),(0,xa.default)((0,xa.default)({},n),{},{cause:r}))}};function cV(e){const t=e;return t?"input"in t?t:{input:t,output:t}:{input:{serialize:n=>n,deserialize:n=>n},output:{serialize:n=>n,deserialize:n=>n}}}const RE=e=>typeof e=="function";function dV(e){if(e)return e;if(typeof window<"u"&&RE(window.fetch))return window.fetch;if(typeof globalThis<"u"&&RE(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var od=It(Ss());function fV(e){return{url:e.url.toString(),fetch:e.fetch,transformer:cV(e.transformer),methodOverride:e.methodOverride}}function hV(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}const pV={query:"GET",mutation:"POST",subscription:"PATCH"};function dA(e){return"input"in e?e.transformer.input.serialize(e.input):hV(e.inputs.map(t=>e.transformer.input.serialize(t)))}const fA=e=>{const t=e.url.split("?");let r=t[0].replace(/\/$/,"")+"/"+e.path;const s=[];if(t[1]&&s.push(t[1]),"inputs"in e&&s.push("batch=1"),e.type==="query"||e.type==="subscription"){const i=dA(e);i!==void 0&&e.methodOverride!=="POST"&&s.push(`input=${encodeURIComponent(JSON.stringify(i))}`)}return s.length&&(r+="?"+s.join("&")),r},mV=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=dA(e);return t!==void 0?JSON.stringify(t):void 0},gV=e=>wV((0,od.default)((0,od.default)({},e),{},{contentTypeHeader:"application/json",getUrl:fA,getBody:mV}));var yV=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const xV=e=>{var t;if(e!=null&&e.aborted)throw(t=e.throwIfAborted)===null||t===void 0||t.call(e),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new yV};async function vV(e){var t;xV(e.signal);const n=e.getUrl(e),r=e.getBody(e),s=(t=e.methodOverride)!==null&&t!==void 0?t:pV[e.type],i=await(async()=>{const l=await e.headers();return Symbol.iterator in l?Object.fromEntries(l):l})(),o=(0,od.default)((0,od.default)((0,od.default)({},e.contentTypeHeader&&s!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{"trpc-accept":e.trpcAcceptHeader}:void 0),i);return dV(e.fetch)(n,{method:s,signal:e.signal,body:r,headers:o})}async function wV(e){const t={},n=await vV(e);t.response=n;const r=await n.json();return t.responseJSON=r,{json:r,meta:t}}It(Ss());const ME=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function OE(e){let t=null,n=null;const r=()=>{clearTimeout(n),n=null,t=null};function s(l){const a=[[]];let u=0;for(;;){const h=l[u];if(!h)break;const f=a[a.length-1];if(h.aborted){var c;(c=h.reject)===null||c===void 0||c.call(h,new Error("Aborted")),u++;continue}if(e.validate(f.concat(h).map(g=>g.key))){f.push(h),u++;continue}if(f.length===0){var d;(d=h.reject)===null||d===void 0||d.call(h,new Error("Input is too big for a single dispatch")),u++;continue}a.push([])}return a}function i(){const l=s(t);r();for(const a of l){if(!a.length)continue;const u={items:a};for(const d of a)d.batch=u;e.fetch(u.items.map(d=>d.key)).then(async d=>{await Promise.all(d.map(async(f,m)=>{const g=u.items[m];try{var v;const w=await Promise.resolve(f);(v=g.resolve)===null||v===void 0||v.call(g,w)}catch(w){var y;(y=g.reject)===null||y===void 0||y.call(g,w)}g.batch=null,g.reject=null,g.resolve=null}));for(const f of u.items){var h;(h=f.reject)===null||h===void 0||h.call(f,new Error("Missing result")),f.batch=null}}).catch(d=>{for(const f of u.items){var h;(h=f.reject)===null||h===void 0||h.call(f,d),f.batch=null}})}}function o(l){var a;const u={aborted:!1,key:l,batch:null,resolve:ME,reject:ME},c=new Promise((d,h)=>{var f;u.reject=h,u.resolve=d,(f=t)!==null&&f!==void 0||(t=[]),t.push(u)});return(a=n)!==null&&a!==void 0||(n=setTimeout(i)),c}return{load:o}}function bV(...e){const t=new AbortController,n=e.length;let r=0;const s=()=>{++r===n&&t.abort()};for(const i of e)i!=null&&i.aborted?s():i==null||i.addEventListener("abort",s,{once:!0});return t.signal}var gh=It(Ss());function kV(e){var t,n;const r=fV(e),s=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,i=(n=e.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const o=c=>({validate(d){if(s===1/0&&i===1/0)return!0;if(d.length>i)return!1;const h=d.map(g=>g.path).join(","),f=d.map(g=>g.input);return fA((0,gh.default)((0,gh.default)({},r),{},{type:c,path:h,inputs:f,signal:null})).length<=s},async fetch(d){const h=d.map(w=>w.path).join(","),f=d.map(w=>w.input),m=bV(...d.map(w=>w.signal)),g=await gV((0,gh.default)((0,gh.default)({},r),{},{path:h,inputs:f,type:c,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:d}):e.headers:{}},signal:m}));return(Array.isArray(g.json)?g.json:d.map(()=>g.json)).map(w=>({meta:g.meta,json:w}))}}),l=OE(o("query")),a=OE(o("mutation")),u={query:l,mutation:a};return({op:c})=>Bg(d=>{/* istanbul ignore if -- @preserve */if(c.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const f=u[c.type].load(c);let m;return f.then(g=>{m=g;const v=DB(g.json,r.transformer.output);if(!v.ok){d.error(nm.from(v.error,{meta:g.meta}));return}d.next({context:g.meta,result:v.result}),d.complete()}).catch(g=>{d.error(nm.from(g,{meta:m==null?void 0:m.meta}))}),()=>{}})}}It(Ss());const hA=(e,...t)=>typeof e=="function"?e(...t):e;It(aa());function SV(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}async function CV(e){const t=await hA(e.url);if(!e.connectionParams)return t;const r=`${t.includes("?")?"&":"?"}connectionParams=1`;return t+r}async function EV(e){const t={method:"connectionParams",data:await hA(e)};return JSON.stringify(t)}It(aa());var hl=It(aa());function NV(e){const{promise:t,resolve:n,reject:r}=SV();return e.addEventListener("open",()=>{e.removeEventListener("error",r),n()}),e.addEventListener("error",r),t}function TV(e,{intervalMs:t,pongTimeoutMs:n}){let r,s;function i(){r=setTimeout(()=>{e.send("PING"),s=setTimeout(()=>{e.close()},n)},t)}function o(){clearTimeout(r),i()}function l(){clearTimeout(s),o()}e.addEventListener("open",i),e.addEventListener("message",({data:a})=>{clearTimeout(r),i(),a==="PONG"&&l()}),e.addEventListener("close",()=>{clearTimeout(r),clearTimeout(s)})}var RV=class Q0{constructor(t){var n;if((0,hl.default)(this,"id",++Q0.connectCount),(0,hl.default)(this,"WebSocketPonyfill",void 0),(0,hl.default)(this,"urlOptions",void 0),(0,hl.default)(this,"keepAliveOpts",void 0),(0,hl.default)(this,"wsObservable",iV(null)),(0,hl.default)(this,"openPromise",null),this.WebSocketPonyfill=(n=t.WebSocketPonyfill)!==null&&n!==void 0?n:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive}get ws(){return this.wsObservable.get()}set ws(t){this.wsObservable.next(t)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var t=this;if(t.openPromise)return t.openPromise;t.id=++Q0.connectCount;const n=CV(t.urlOptions).then(r=>new t.WebSocketPonyfill(r));t.openPromise=n.then(async r=>{t.ws=r,r.binaryType="arraybuffer",r.addEventListener("message",function({data:s}){s==="PING"&&this.send("PONG")}),t.keepAliveOpts.enabled&&TV(r,t.keepAliveOpts),r.addEventListener("close",()=>{t.ws===r&&(t.ws=null)}),await NV(r),t.urlOptions.connectionParams&&r.send(await EV(t.urlOptions.connectionParams))});try{await t.openPromise}finally{t.openPromise=null}}async close(){var t=this;try{await t.openPromise}finally{var n;(n=t.ws)===null||n===void 0||n.close()}}};(0,hl.default)(RV,"connectCount",0);It(aa());It(Ss());var cx=It(aa()),jE=It(Ss()),Vg=class{constructor(e){(0,cx.default)(this,"links",void 0),(0,cx.default)(this,"runtime",void 0),(0,cx.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return oV({links:this.links,op:(0,jE.default)((0,jE.default)({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(sV())}async requestAsPromise(e){var t=this;try{const n=t.$request(e);return(await $B(n)).result.data}catch(n){throw nm.from(n)}}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:n==null?void 0:n.context,signal:n==null?void 0:n.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:n==null?void 0:n.context,signal:n==null?void 0:n.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,context:n.context,signal:n.signal}).subscribe({next(s){switch(s.result.type){case"state":{var i;(i=n.onConnectionStateChange)===null||i===void 0||i.call(n,s.result);break}case"started":{var o;(o=n.onStarted)===null||o===void 0||o.call(n,{context:s.context});break}case"stopped":{var l;(l=n.onStopped)===null||l===void 0||l.call(n);break}case"data":case void 0:{var a;(a=n.onData)===null||a===void 0||a.call(n,s.result.data);break}}},error(s){var i;(i=n.onError)===null||i===void 0||i.call(n,s)},complete(){var s;(s=n.onComplete)===null||s===void 0||s.call(n)}})}};const pA=Symbol.for("trpc_untypedClient"),MV={query:"query",mutate:"mutation",subscribe:"subscription"},OV=e=>MV[e];function mA(e){const t=Fg(({path:n,args:r})=>{const s=[...n],i=OV(s.pop()),o=s.join(".");return e[i](o,...r)});return Ek(n=>n===pA?e:t[n])}function jV(e){const t=new Vg(e);return mA(t)}function Tk(e){return e[pA]}It(Ss());It(Ss());var PV=Js({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function n(s){var i,o,l,a=2;for(typeof Symbol<"u"&&(o=Symbol.asyncIterator,l=Symbol.iterator);a--;){if(o&&(i=s[o])!=null)return i.call(s);if(l&&(i=s[l])!=null)return new r(i.call(s));o="@@asyncIterator",l="@@iterator"}throw new TypeError("Object is not async iterable")}function r(s){function i(o){if(Object(o)!==o)return Promise.reject(new TypeError(o+" is not an object."));var l=o.done;return Promise.resolve(o.value).then(function(a){return{value:a,done:l}})}return r=function(l){this.s=l,this.n=l.next},r.prototype={s:null,n:null,next:function(){return i(this.n.apply(this.s,arguments))},return:function(l){var a=this.s.return;return a===void 0?Promise.resolve({value:l,done:!0}):i(a.apply(this.s,arguments))},throw:function(l){var a=this.s.return;return a===void 0?Promise.reject(l):i(a.apply(this.s,arguments))}},new r(s)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}});It(PV());It(Ss());var AV=Js({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(e,t){function n(){var r=typeof SuppressedError=="function"?SuppressedError:function(l,a){var u=Error();return u.name="SuppressedError",u.error=l,u.suppressed=a,u},s={},i=[];function o(l,a){if(a!=null){if(Object(a)!==a)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(l)var u=a[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(u===void 0&&(u=a[Symbol.dispose||Symbol.for("Symbol.dispose")],l))var c=u;if(typeof u!="function")throw new TypeError("Object is not disposable.");c&&(u=function(){try{c.call(a)}catch(h){return Promise.reject(h)}}),i.push({v:a,d:u,a:l})}else l&&i.push({d:a,a:l});return a}return{e:s,u:o.bind(null,!1),a:o.bind(null,!0),d:function(){var a,u=this.e,c=0;function d(){for(;a=i.pop();)try{if(!a.a&&c===1)return c=0,i.push(a),Promise.resolve().then(d);if(a.d){var f=a.d.call(a.v);if(a.a)return c|=2,Promise.resolve(f).then(d,h)}else c|=1}catch(m){return h(m)}if(c===1)return u!==s?Promise.reject(u):Promise.resolve();if(u!==s)throw u}function h(f){return u=u!==s?new r(f,u):f,d()}return d()}}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),gA=Js({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(e,t){function n(r,s){this.v=r,this.k=s}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),_V=Js({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var n=gA();function r(s){return new n(s,0)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),IV=Js({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var n=gA();function r(i){return function(){return new s(i.apply(this,arguments))}}function s(i){var o,l;function a(c,d){try{var h=i[c](d),f=h.value,m=f instanceof n;Promise.resolve(m?f.v:f).then(function(g){if(m){var v=c==="return"?"return":"next";if(!f.k||g.done)return a(v,g);g=i[v](g).value}u(h.done?"return":"normal",g)},function(g){a("throw",g)})}catch(g){u("throw",g)}}function u(c,d){switch(c){case"return":o.resolve({value:d,done:!0});break;case"throw":o.reject(d);break;default:o.resolve({value:d,done:!1})}(o=o.next)?a(o.key,o.arg):l=null}this._invoke=function(c,d){return new Promise(function(h,f){var m={key:c,arg:d,resolve:h,reject:f,next:null};l?l=l.next=m:(o=l=m,a(c,d))})},typeof i.return!="function"&&(this.return=void 0)}s.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},s.prototype.next=function(i){return this._invoke("next",i)},s.prototype.throw=function(i){return this._invoke("throw",i)},s.prototype.return=function(i){return this._invoke("return",i)},t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}});It(AV());It(_V());It(IV());It(Ss());function DV(e){return Fg(({path:t,args:n})=>{var r;const s=[...t],i=s.pop();if(i==="useMutation")return e[i](s,...n);if(i==="_def")return{path:s};const[o,...l]=n,a=(r=l[0])!==null&&r!==void 0?r:{};return e[i](s,o,a)})}var dx;const LV=["client","ssrContext","ssrState","abortOnUnmount"],$V=(dx=x.createContext)===null||dx===void 0?void 0:dx.call(kf,null),zV=e=>{switch(e){case"queryOptions":case"fetch":case"ensureData":case"prefetch":case"getData":case"setData":case"setQueriesData":return"query";case"infiniteQueryOptions":case"fetchInfinite":case"prefetchInfinite":case"getInfiniteData":case"setInfiniteData":return"infinite";case"setMutationDefaults":case"getMutationDefaults":case"isMutating":case"cancel":case"invalidate":case"refetch":case"reset":return"any"}};function FV(e){return Fg(t=>{const n=[...t.path],r=n.pop(),s=[...t.args],i=s.shift(),o=zV(r),l=Ps(n,i,o);return{infiniteQueryOptions:()=>e.infiniteQueryOptions(n,l,s[0]),queryOptions:()=>e.queryOptions(n,l,...s),fetch:()=>e.fetchQuery(l,...s),fetchInfinite:()=>e.fetchInfiniteQuery(l,s[0]),prefetch:()=>e.prefetchQuery(l,...s),prefetchInfinite:()=>e.prefetchInfiniteQuery(l,s[0]),ensureData:()=>e.ensureQueryData(l,...s),invalidate:()=>e.invalidateQueries(l,...s),reset:()=>e.resetQueries(l,...s),refetch:()=>e.refetchQueries(l,...s),cancel:()=>e.cancelQuery(l,...s),setData:()=>{e.setQueryData(l,s[0],s[1])},setQueriesData:()=>e.setQueriesData(l,s[0],s[1],s[2]),setInfiniteData:()=>{e.setInfiniteQueryData(l,s[0],s[1])},getData:()=>e.getQueryData(l),getInfiniteData:()=>e.getInfiniteQueryData(l),setMutationDefaults:()=>e.setMutationDefaults(up(n),i),getMutationDefaults:()=>e.getMutationDefaults(up(n)),isMutating:()=>e.isMutating({mutationKey:up(n)})}[r]()})}function BV(e){const t=mA(e.client),n=FV(e);return Ek(r=>{const s=r;return s==="client"?t:LV.includes(s)?e[s]:n[r]})}var VV=la(jf(),1);function PE(e){const t=e instanceof Vg?e:Tk(e);return Fg(n=>{const r=n.path,s=r.join("."),[i,o]=n.args;return(0,VV.default)({queryKey:Ps(r,i,"query"),queryFn:()=>t.query(s,i,o==null?void 0:o.trpc)},o)})}var fx=la(jf(),1);function Ln(e,t,n){var r;const s=e[0];let i=(r=e[1])===null||r===void 0?void 0:r.input;if(n){var o;i=(0,fx.default)((0,fx.default)((0,fx.default)({},(o=i)!==null&&o!==void 0?o:{}),n.pageParam?{cursor:n.pageParam}:{}),{},{direction:n.direction})}return[s.join("."),i,t==null?void 0:t.trpc]}var HV=Yo({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function n(s){var i,o,l,a=2;for(typeof Symbol<"u"&&(o=Symbol.asyncIterator,l=Symbol.iterator);a--;){if(o&&(i=s[o])!=null)return i.call(s);if(l&&(i=s[l])!=null)return new r(i.call(s));o="@@asyncIterator",l="@@iterator"}throw new TypeError("Object is not async iterable")}function r(s){function i(o){if(Object(o)!==o)return Promise.reject(new TypeError(o+" is not an object."));var l=o.done;return Promise.resolve(o.value).then(function(a){return{value:a,done:l}})}return r=function(l){this.s=l,this.n=l.next},r.prototype={s:null,n:null,next:function(){return i(this.n.apply(this.s,arguments))},return:function(l){var a=this.s.return;return a===void 0?Promise.resolve({value:l,done:!0}):i(a.apply(this.s,arguments))},throw:function(l){var a=this.s.return;return a===void 0?Promise.reject(l):i(a.apply(this.s,arguments))}},new r(s)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),UV=la(HV(),1);function G0(e){return{path:e.path.join(".")}}function Cc(e){const t=G0(e);return x.useMemo(()=>t,[t])}async function yA(e,t,n){const s=t.getQueryCache().build(t,{queryKey:n});s.setState({data:[],status:"success"});const i=[];var o=!1,l=!1,a;try{for(var u=(0,UV.default)(e),c;o=!(c=await u.next()).done;o=!1){const d=c.value;i.push(d),s.setState({data:[...i]})}}catch(d){l=!0,a=d}finally{try{o&&u.return!=null&&await u.return()}finally{if(l)throw a}}return i}var Xe=la(jf(),1);function qV(e){const{client:t,queryClient:n}=e,r=t instanceof Vg?t:Tk(t);return{infiniteQueryOptions:(s,i,o)=>{var l,a;const u=((l=i[1])===null||l===void 0?void 0:l.input)===hr,c=async d=>{var h;const f=(0,Xe.default)((0,Xe.default)({},o),{},{trpc:(0,Xe.default)((0,Xe.default)({},o==null?void 0:o.trpc),!(o==null||(h=o.trpc)===null||h===void 0)&&h.abortOnUnmount?{signal:d.signal}:{signal:null})});return await r.query(...Ln(i,f,{direction:d.direction,pageParam:d.pageParam}))};return Object.assign((0,Xe.default)((0,Xe.default)({},o),{},{initialData:o==null?void 0:o.initialData,queryKey:i,queryFn:u?hr:c,initialPageParam:(a=o==null?void 0:o.initialCursor)!==null&&a!==void 0?a:null}),{trpc:G0({path:s})})},queryOptions:(s,i,o)=>{var l;const a=((l=i[1])===null||l===void 0?void 0:l.input)===hr,u=async c=>{var d;const h=(0,Xe.default)((0,Xe.default)({},o),{},{trpc:(0,Xe.default)((0,Xe.default)({},o==null?void 0:o.trpc),!(o==null||(d=o.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:c.signal}:{signal:null})}),f=await r.query(...Ln(i,h));return YP(f)?yA(f,n,i):f};return Object.assign((0,Xe.default)((0,Xe.default)({},o),{},{initialData:o==null?void 0:o.initialData,queryKey:i,queryFn:a?hr:u}),{trpc:G0({path:s})})},fetchQuery:(s,i)=>n.fetchQuery((0,Xe.default)((0,Xe.default)({},i),{},{queryKey:s,queryFn:()=>r.query(...Ln(s,i))})),fetchInfiniteQuery:(s,i)=>{var o;return n.fetchInfiniteQuery((0,Xe.default)((0,Xe.default)({},i),{},{queryKey:s,queryFn:({pageParam:l,direction:a})=>r.query(...Ln(s,i,{pageParam:l,direction:a})),initialPageParam:(o=i==null?void 0:i.initialCursor)!==null&&o!==void 0?o:null}))},prefetchQuery:(s,i)=>n.prefetchQuery((0,Xe.default)((0,Xe.default)({},i),{},{queryKey:s,queryFn:()=>r.query(...Ln(s,i))})),prefetchInfiniteQuery:(s,i)=>{var o;return n.prefetchInfiniteQuery((0,Xe.default)((0,Xe.default)({},i),{},{queryKey:s,queryFn:({pageParam:l,direction:a})=>r.query(...Ln(s,i,{pageParam:l,direction:a})),initialPageParam:(o=i==null?void 0:i.initialCursor)!==null&&o!==void 0?o:null}))},ensureQueryData:(s,i)=>n.ensureQueryData((0,Xe.default)((0,Xe.default)({},i),{},{queryKey:s,queryFn:()=>r.query(...Ln(s,i))})),invalidateQueries:(s,i,o)=>n.invalidateQueries((0,Xe.default)((0,Xe.default)({},i),{},{queryKey:s}),o),resetQueries:(s,i,o)=>n.resetQueries((0,Xe.default)((0,Xe.default)({},i),{},{queryKey:s}),o),refetchQueries:(s,i,o)=>n.refetchQueries((0,Xe.default)((0,Xe.default)({},i),{},{queryKey:s}),o),cancelQuery:(s,i)=>n.cancelQueries({queryKey:s},i),setQueryData:(s,i,o)=>n.setQueryData(s,i,o),setQueriesData:(s,i,o,l)=>n.setQueriesData((0,Xe.default)((0,Xe.default)({},i),{},{queryKey:s}),o,l),getQueryData:s=>n.getQueryData(s),setInfiniteQueryData:(s,i,o)=>n.setQueryData(s,i,o),getInfiniteQueryData:s=>n.getQueryData(s),setMutationDefaults:(s,i)=>{const o=s[0],l=a=>r.mutation(...Ln([o,{input:a}],e));return n.setMutationDefaults(s,typeof i=="function"?i({canonicalMutationFn:l}):i)},getMutationDefaults:s=>n.getMutationDefaults(s),isMutating:s=>n.isMutating((0,Xe.default)((0,Xe.default)({},s),{},{exact:!0}))}}var ce=la(jf());const AE=(e,t)=>new Proxy(e,{get(r,s){return t(s),r[s]}});function WV(e){var t,n;const r=(t=void 0)!==null&&t!==void 0?t:S=>S.originalFn(),s=(n=void 0)!==null&&n!==void 0?n:$V,i=jV,o=S=>{var k;const{abortOnUnmount:E=!1,queryClient:N,ssrContext:O}=S,[T,j]=x.useState((k=S.ssrState)!==null&&k!==void 0?k:!1),A=S.client instanceof Vg?S.client:Tk(S.client),z=x.useMemo(()=>qV({client:A,queryClient:N}),[A,N]),D=x.useMemo(()=>(0,ce.default)({abortOnUnmount:E,queryClient:N,client:A,ssrContext:O??null,ssrState:T},z),[E,A,z,N,O,T]);return x.useEffect(()=>{j(L=>L?"mounted":!1)},[]),p.jsx(s.Provider,{value:D,children:S.children})};function l(){const S=x.useContext(s);if(!S)throw new Error("Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?");return S}function a(S,k){var E;const{queryClient:N,ssrState:O}=l();return O&&O!=="mounted"&&((E=N.getQueryCache().find({queryKey:S}))===null||E===void 0?void 0:E.state.status)==="error"?(0,ce.default)({retryOnMount:!1},k):k}function u(S,k,E){var N,O,T,j,A;const z=l(),{abortOnUnmount:D,client:L,ssrState:H,queryClient:K,prefetchQuery:_}=z,Q=Ps(S,k,"query"),M=K.getQueryDefaults(Q),oe=k===hr;typeof window>"u"&&H==="prepass"&&(E==null||(N=E.trpc)===null||N===void 0?void 0:N.ssr)!==!1&&((O=E==null?void 0:E.enabled)!==null&&O!==void 0?O:M==null?void 0:M.enabled)!==!1&&!oe&&!K.getQueryCache().find({queryKey:Q})&&_(Q,E);const F=a(Q,(0,ce.default)((0,ce.default)({},M),E)),R=(T=(j=E==null||(A=E.trpc)===null||A===void 0?void 0:A.abortOnUnmount)!==null&&j!==void 0?j:void 0)!==null&&T!==void 0?T:D,I=Mf((0,ce.default)((0,ce.default)({},F),{},{queryKey:Q,queryFn:oe?k:async V=>{const Y=(0,ce.default)((0,ce.default)({},F),{},{trpc:(0,ce.default)((0,ce.default)({},F==null?void 0:F.trpc),R?{signal:V.signal}:{signal:null})}),G=await L.query(...Ln(Q,Y));return YP(G)?yA(G,K,Q):G}}),K);return I.trpc=Cc({path:S}),I}function c(S,k,E){var N,O,T;const j=l(),A=Ps(S,k,"query"),z=k===hr,D=(N=(O=E==null||(T=E.trpc)===null||T===void 0?void 0:T.abortOnUnmount)!==null&&O!==void 0?O:void 0)!==null&&N!==void 0?N:j.abortOnUnmount;SB((0,ce.default)((0,ce.default)({},E),{},{queryKey:A,queryFn:z?k:L=>{const H={trpc:(0,ce.default)((0,ce.default)({},E==null?void 0:E.trpc),D?{signal:L.signal}:{})};return j.client.query(...Ln(A,H))}}))}function d(S,k,E){var N,O,T;const j=l(),A=Ps(S,k,"query"),z=(N=(O=E==null||(T=E.trpc)===null||T===void 0?void 0:T.abortOnUnmount)!==null&&O!==void 0?O:void 0)!==null&&N!==void 0?N:j.abortOnUnmount,D=wB((0,ce.default)((0,ce.default)({},E),{},{queryKey:A,queryFn:L=>{const H=(0,ce.default)((0,ce.default)({},E),{},{trpc:(0,ce.default)((0,ce.default)({},E==null?void 0:E.trpc),z?{signal:L.signal}:{signal:null})});return j.client.query(...Ln(A,H))}}),j.queryClient);return D.trpc=Cc({path:S}),[D.data,D]}function h(S,k){const{client:E,queryClient:N}=l(),O=up(S),T=N.defaultMutationOptions(N.getMutationDefaults(O)),j=ai((0,ce.default)((0,ce.default)({},k),{},{mutationKey:O,mutationFn:A=>E.mutation(...Ln([S,{input:A}],k)),onSuccess(...A){var z,D;return r({originalFn:()=>{var H,K,_;return(H=k==null||(K=k.onSuccess)===null||K===void 0?void 0:K.call(k,...A))!==null&&H!==void 0?H:T==null||(_=T.onSuccess)===null||_===void 0?void 0:_.call(T,...A)},queryClient:N,meta:(z=(D=k==null?void 0:k.meta)!==null&&D!==void 0?D:T==null?void 0:T.meta)!==null&&z!==void 0?z:{}})}}),N);return j.trpc=Cc({path:S}),j}const f={data:void 0,error:null,status:"idle"},m={data:void 0,error:null,status:"connecting"};/* istanbul ignore next -- @preserve */function g(S,k,E){var N;const O=(N=E==null?void 0:E.enabled)!==null&&N!==void 0?N:k!==hr,T=$o(Ps(S,k,"any")),{client:j}=l(),A=x.useRef(E);x.useEffect(()=>{A.current=E});const[z]=x.useState(new Set([])),D=x.useCallback(oe=>{z.add(oe)},[z]),L=x.useRef(null),H=x.useCallback(oe=>{const F=_.current,R=_.current=oe(F);let I=!1;for(const V of z)if(F[V]!==R[V]){I=!0;break}I&&M(AE(R,D))},[D,z]),K=x.useCallback(()=>{var oe;if((oe=L.current)===null||oe===void 0||oe.unsubscribe(),!O){H(()=>(0,ce.default)((0,ce.default)({},f),{},{reset:K}));return}H(()=>(0,ce.default)((0,ce.default)({},m),{},{reset:K}));const F=j.subscription(S.join("."),k??void 0,{onStarted:()=>{var R,I;(R=(I=A.current).onStarted)===null||R===void 0||R.call(I),H(V=>(0,ce.default)((0,ce.default)({},V),{},{status:"pending",error:null}))},onData:R=>{var I,V;(I=(V=A.current).onData)===null||I===void 0||I.call(V,R),H(Y=>(0,ce.default)((0,ce.default)({},Y),{},{status:"pending",data:R,error:null}))},onError:R=>{var I,V;(I=(V=A.current).onError)===null||I===void 0||I.call(V,R),H(Y=>(0,ce.default)((0,ce.default)({},Y),{},{status:"error",error:R}))},onConnectionStateChange:R=>{H(I=>{switch(R.state){case"idle":return(0,ce.default)((0,ce.default)({},I),{},{status:R.state,error:null,data:void 0});case"connecting":return(0,ce.default)((0,ce.default)({},I),{},{error:R.error,status:R.state});case"pending":return I}})},onComplete:()=>{var R,I;(R=(I=A.current).onComplete)===null||R===void 0||R.call(I),H(V=>(0,ce.default)((0,ce.default)({},V),{},{status:"idle",error:null,data:void 0}))}});L.current=F},[j,T,O,H]);x.useEffect(()=>(K(),()=>{var oe;(oe=L.current)===null||oe===void 0||oe.unsubscribe()}),[K]);const _=x.useRef(O?(0,ce.default)((0,ce.default)({},m),{},{reset:K}):(0,ce.default)((0,ce.default)({},f),{},{reset:K})),[Q,M]=x.useState(AE(_.current,D));return Q}function v(S,k,E){var N,O,T,j,A;const{client:z,ssrState:D,prefetchInfiniteQuery:L,queryClient:H,abortOnUnmount:K}=l(),_=Ps(S,k,"infinite"),Q=H.getQueryDefaults(_),M=k===hr;typeof window>"u"&&D==="prepass"&&(E==null||(N=E.trpc)===null||N===void 0?void 0:N.ssr)!==!1&&((O=E==null?void 0:E.enabled)!==null&&O!==void 0?O:Q==null?void 0:Q.enabled)!==!1&&!M&&!H.getQueryCache().find({queryKey:_})&&L(_,(0,ce.default)((0,ce.default)({},Q),E));const oe=a(_,(0,ce.default)((0,ce.default)({},Q),E)),F=(T=E==null||(j=E.trpc)===null||j===void 0?void 0:j.abortOnUnmount)!==null&&T!==void 0?T:K,R=EB((0,ce.default)((0,ce.default)({},oe),{},{initialPageParam:(A=E.initialCursor)!==null&&A!==void 0?A:null,persister:E.persister,queryKey:_,queryFn:M?k:I=>{var V;const Y=(0,ce.default)((0,ce.default)({},oe),{},{trpc:(0,ce.default)((0,ce.default)({},oe==null?void 0:oe.trpc),F?{signal:I.signal}:{signal:null})});return z.query(...Ln(_,Y,{pageParam:(V=I.pageParam)!==null&&V!==void 0?V:E.initialCursor,direction:I.direction}))}}),H);return R.trpc=Cc({path:S}),R}function y(S,k,E){var N,O,T;const j=l(),A=Ps(S,k,"infinite"),z=j.queryClient.getQueryDefaults(A),D=k===hr,L=a(A,(0,ce.default)((0,ce.default)({},z),E)),H=(N=E==null||(O=E.trpc)===null||O===void 0?void 0:O.abortOnUnmount)!==null&&N!==void 0?N:j.abortOnUnmount;CB((0,ce.default)((0,ce.default)({},E),{},{initialPageParam:(T=E.initialCursor)!==null&&T!==void 0?T:null,queryKey:A,queryFn:D?k:K=>{var _;const Q=(0,ce.default)((0,ce.default)({},L),{},{trpc:(0,ce.default)((0,ce.default)({},L==null?void 0:L.trpc),H?{signal:K.signal}:{})});return j.client.query(...Ln(A,Q,{pageParam:(_=K.pageParam)!==null&&_!==void 0?_:E.initialCursor,direction:K.direction}))}}))}function w(S,k,E){var N,O,T;const j=l(),A=Ps(S,k,"infinite"),z=j.queryClient.getQueryDefaults(A),D=a(A,(0,ce.default)((0,ce.default)({},z),E)),L=(N=E==null||(O=E.trpc)===null||O===void 0?void 0:O.abortOnUnmount)!==null&&N!==void 0?N:j.abortOnUnmount,H=bB((0,ce.default)((0,ce.default)({},E),{},{initialPageParam:(T=E.initialCursor)!==null&&T!==void 0?T:null,queryKey:A,queryFn:K=>{var _;const Q=(0,ce.default)((0,ce.default)({},D),{},{trpc:(0,ce.default)((0,ce.default)({},D==null?void 0:D.trpc),L?{signal:K.signal}:{})});return j.client.query(...Ln(A,Q,{pageParam:(_=K.pageParam)!==null&&_!==void 0?_:E.initialCursor,direction:K.direction}))}}),j.queryClient);return H.trpc=Cc({path:S}),[H.data,H]}return{Provider:o,createClient:i,useContext:l,useUtils:l,useQuery:u,usePrefetchQuery:c,useSuspenseQuery:d,useQueries:(S,k)=>{const{ssrState:E,queryClient:N,prefetchQuery:O,client:T}=l(),j=PE(T),A=S(j);if(typeof window>"u"&&E==="prepass")for(const D of A){var z;const L=D;((z=L.trpc)===null||z===void 0?void 0:z.ssr)!==!1&&!N.getQueryCache().find({queryKey:L.queryKey})&&O(L.queryKey,L)}return ZP({queries:A.map(D=>(0,ce.default)((0,ce.default)({},D),{},{queryKey:D.queryKey})),combine:k==null?void 0:k.combine},N)},useSuspenseQueries:S=>{const{queryClient:k,client:E}=l(),N=PE(E),O=S(N),T=kB({queries:O.map(j=>(0,ce.default)((0,ce.default)({},j),{},{queryFn:j.queryFn,queryKey:j.queryKey}))},k);return[T.map(j=>j.data),T]},useMutation:h,useSubscription:g,useInfiniteQuery:v,usePrefetchInfiniteQuery:y,useSuspenseInfiniteQuery:w}}function KV(e){const t=DV(e);return Ek(n=>n==="useContext"||n==="useUtils"?()=>{const r=e.useUtils();return x.useMemo(()=>BV(r),[r])}:e.hasOwnProperty(n)?e[n]:t[n])}function QV(e){const t=WV();return KV(t)}class GV{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(t,n){this.keyToValue.set(t,n),this.valueToKey.set(n,t)}getByKey(t){return this.keyToValue.get(t)}getByValue(t){return this.valueToKey.get(t)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}}class xA{constructor(t){this.generateIdentifier=t,this.kv=new GV}register(t,n){this.kv.getByValue(t)||(n||(n=this.generateIdentifier(t)),this.kv.set(n,t))}clear(){this.kv.clear()}getIdentifier(t){return this.kv.getByValue(t)}getValue(t){return this.kv.getByKey(t)}}class JV extends xA{constructor(){super(t=>t.name),this.classToAllowedProps=new Map}register(t,n){typeof n=="object"?(n.allowProps&&this.classToAllowedProps.set(t,n.allowProps),super.register(t,n.identifier)):super.register(t,n)}getAllowedProps(t){return this.classToAllowedProps.get(t)}}function ZV(e){if("values"in Object)return Object.values(e);const t=[];for(const n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}function YV(e,t){const n=ZV(e);if("find"in n)return n.find(t);const r=n;for(let s=0;s<r.length;s++){const i=r[s];if(t(i))return i}}function Pu(e,t){Object.entries(e).forEach(([n,r])=>t(r,n))}function dp(e,t){return e.indexOf(t)!==-1}function _E(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(t(r))return r}}class XV{constructor(){this.transfomers={}}register(t){this.transfomers[t.name]=t}findApplicable(t){return YV(this.transfomers,n=>n.isApplicable(t))}findByName(t){return this.transfomers[t]}}const eH=e=>Object.prototype.toString.call(e).slice(8,-1),vA=e=>typeof e>"u",tH=e=>e===null,Wd=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,J0=e=>Wd(e)&&Object.keys(e).length===0,zo=e=>Array.isArray(e),nH=e=>typeof e=="string",rH=e=>typeof e=="number"&&!isNaN(e),sH=e=>typeof e=="boolean",iH=e=>e instanceof RegExp,Kd=e=>e instanceof Map,Qd=e=>e instanceof Set,wA=e=>eH(e)==="Symbol",oH=e=>e instanceof Date&&!isNaN(e.valueOf()),bA=e=>e instanceof Error,IE=e=>typeof e=="number"&&isNaN(e),lH=e=>sH(e)||tH(e)||vA(e)||rH(e)||nH(e)||wA(e),aH=e=>typeof e=="bigint",uH=e=>e===1/0||e===-1/0,cH=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),dH=e=>e instanceof URL,Z0=e=>e.replace(/\\/g,"\\\\").replace(/\./g,"\\."),hx=e=>e.map(String).map(Z0).join("."),ld=(e,t)=>{const n=[];let r="";for(let i=0;i<e.length;i++){let o=e.charAt(i);if(!t&&o==="\\"){const u=e.charAt(i+1);if(u==="\\"){r+="\\",i++;continue}else if(u!==".")throw Error("invalid path")}if(o==="\\"&&e.charAt(i+1)==="."){r+=".",i++;continue}if(o==="."){n.push(r),r="";continue}r+=o}const s=r;return n.push(s),n};function Ns(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}const kA=[Ns(vA,"undefined",()=>null,()=>{}),Ns(aH,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):(console.error("Please add a BigInt polyfill."),e)),Ns(oH,"Date",e=>e.toISOString(),e=>new Date(e)),Ns(bA,"Error",(e,t)=>{const n={name:e.name,message:e.message};return"cause"in e&&(n.cause=e.cause),t.allowedErrorProps.forEach(r=>{n[r]=e[r]}),n},(e,t)=>{const n=new Error(e.message,{cause:e.cause});return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(r=>{n[r]=e[r]}),n}),Ns(iH,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),n=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,n)}),Ns(Qd,"set",e=>[...e.values()],e=>new Set(e)),Ns(Kd,"map",e=>[...e.entries()],e=>new Map(e)),Ns(e=>IE(e)||uH(e),"number",e=>IE(e)?"NaN":e>0?"Infinity":"-Infinity",Number),Ns(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),Ns(dH,"URL",e=>e.toString(),e=>new URL(e))];function Hg(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}const SA=Hg((e,t)=>wA(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,n)=>{const r=n.symbolRegistry.getValue(t[1]);if(!r)throw new Error("Trying to deserialize unknown symbol");return r}),fH=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),CA=Hg(cH,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const n=fH[t[1]];if(!n)throw new Error("Trying to deserialize unknown typed array");return new n(e)});function EA(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}const NA=Hg(EA,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{const n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return{...e};const r={};return n.forEach(s=>{r[s]=e[s]}),r},(e,t,n)=>{const r=n.classRegistry.getValue(t[1]);if(!r)throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(r.prototype),e)}),TA=Hg((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,n)=>{const r=n.customTransformerRegistry.findByName(t[1]);if(!r)throw new Error("Trying to deserialize unknown custom value");return r.deserialize(e)}),hH=[NA,SA,TA,CA],DE=(e,t)=>{const n=_E(hH,s=>s.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};const r=_E(kA,s=>s.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation}},RA={};kA.forEach(e=>{RA[e.annotation]=e});const pH=(e,t,n)=>{if(zo(t))switch(t[0]){case"symbol":return SA.untransform(e,t,n);case"class":return NA.untransform(e,t,n);case"custom":return TA.untransform(e,t,n);case"typed-array":return CA.untransform(e,t,n);default:throw new Error("Unknown transformation: "+t)}else{const r=RA[t];if(!r)throw new Error("Unknown transformation: "+t);return r.untransform(e,n)}},Ga=(e,t)=>{if(t>e.size)throw new Error("index out of bounds");const n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function MA(e){if(dp(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(dp(e,"prototype"))throw new Error("prototype is not allowed as a property");if(dp(e,"constructor"))throw new Error("constructor is not allowed as a property")}const mH=(e,t)=>{MA(t);for(let n=0;n<t.length;n++){const r=t[n];if(Qd(e))e=Ga(e,+r);else if(Kd(e)){const s=+r,i=+t[++n]==0?"key":"value",o=Ga(e,s);switch(i){case"key":e=o;break;case"value":e=e.get(o);break}}else e=e[r]}return e},Y0=(e,t,n)=>{if(MA(t),t.length===0)return n(e);let r=e;for(let i=0;i<t.length-1;i++){const o=t[i];if(zo(r)){const l=+o;r=r[l]}else if(Wd(r))r=r[o];else if(Qd(r)){const l=+o;r=Ga(r,l)}else if(Kd(r)){if(i===t.length-2)break;const a=+o,u=+t[++i]==0?"key":"value",c=Ga(r,a);switch(u){case"key":r=c;break;case"value":r=r.get(c);break}}}const s=t[t.length-1];if(zo(r)?r[+s]=n(r[+s]):Wd(r)&&(r[s]=n(r[s])),Qd(r)){const i=Ga(r,+s),o=n(i);i!==o&&(r.delete(i),r.add(o))}if(Kd(r)){const i=+t[t.length-2],o=Ga(r,i);switch(+s==0?"key":"value"){case"key":{const a=n(o);r.set(a,r.get(o)),a!==o&&r.delete(o);break}case"value":{r.set(o,n(r.get(o)));break}}}return e},OA=e=>e<1;function X0(e,t,n,r=[]){if(!e)return;const s=OA(n);if(!zo(e)){Pu(e,(l,a)=>X0(l,t,n,[...r,...ld(a,s)]));return}const[i,o]=e;o&&Pu(o,(l,a)=>{X0(l,t,n,[...r,...ld(a,s)])}),t(i,r)}function gH(e,t,n,r){return X0(t,(s,i)=>{e=Y0(e,i,o=>pH(o,s,r))},n),e}function yH(e,t,n){const r=OA(n);function s(i,o){const l=mH(e,ld(o,r));i.map(a=>ld(a,r)).forEach(a=>{e=Y0(e,a,()=>l)})}if(zo(t)){const[i,o]=t;i.forEach(l=>{e=Y0(e,ld(l,r),()=>e)}),o&&Pu(o,s)}else Pu(t,s);return e}const xH=(e,t)=>Wd(e)||zo(e)||Kd(e)||Qd(e)||bA(e)||EA(e,t);function vH(e,t,n){const r=n.get(e);r?r.push(t):n.set(e,[t])}function wH(e,t){const n={};let r;return e.forEach(s=>{if(s.length<=1)return;t||(s=s.map(l=>l.map(String)).sort((l,a)=>l.length-a.length));const[i,...o]=s;i.length===0?r=o.map(hx):n[hx(i)]=o.map(hx)}),r?J0(n)?[r]:[r,n]:J0(n)?void 0:n}const jA=(e,t,n,r,s=[],i=[],o=new Map)=>{const l=lH(e);if(!l){vH(e,s,t);const f=o.get(e);if(f)return r?{transformedValue:null}:f}if(!xH(e,n)){const f=DE(e,n),m=f?{transformedValue:f.value,annotations:[f.type]}:{transformedValue:e};return l||o.set(e,m),m}if(dp(i,e))return{transformedValue:null};const a=DE(e,n),u=(a==null?void 0:a.value)??e,c=zo(u)?[]:{},d={};Pu(u,(f,m)=>{if(m==="__proto__"||m==="constructor"||m==="prototype")throw new Error(`Detected property ${m}. This is a prototype pollution risk, please remove it from your object.`);const g=jA(f,t,n,r,[...s,m],[...i,e],o);c[m]=g.transformedValue,zo(g.annotations)?d[Z0(m)]=g.annotations:Wd(g.annotations)&&Pu(g.annotations,(v,y)=>{d[Z0(m)+"."+y]=v})});const h=J0(d)?{transformedValue:c,annotations:a?[a.type]:void 0}:{transformedValue:c,annotations:a?[a.type,d]:d};return l||o.set(e,h),h};function PA(e){return Object.prototype.toString.call(e).slice(8,-1)}function LE(e){return PA(e)==="Array"}function bH(e){if(PA(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function kH(e,t,n,r,s){const i={}.propertyIsEnumerable.call(r,t)?"enumerable":"nonenumerable";i==="enumerable"&&(e[t]=n),s&&i==="nonenumerable"&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function ew(e,t={}){if(LE(e))return e.map(s=>ew(s,t));if(!bH(e))return e;const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertySymbols(e);return[...n,...r].reduce((s,i)=>{if(i==="__proto__"||LE(t.props)&&!t.props.includes(i))return s;const o=e[i],l=ew(o,t);return kH(s,i,l,e,t.nonenumerable),s},{})}class Ge{constructor({dedupe:t=!1}={}){this.classRegistry=new JV,this.symbolRegistry=new xA(n=>n.description??""),this.customTransformerRegistry=new XV,this.allowedErrorProps=[],this.dedupe=t}serialize(t){const n=new Map,r=jA(t,n,this,this.dedupe),s={json:r.transformedValue};r.annotations&&(s.meta={...s.meta,values:r.annotations});const i=wH(n,this.dedupe);return i&&(s.meta={...s.meta,referentialEqualities:i}),s.meta&&(s.meta.v=1),s}deserialize(t,n){const{json:r,meta:s}=t;let i=n!=null&&n.inPlace?r:ew(r);return s!=null&&s.values&&(i=gH(i,s.values,s.v??0,this)),s!=null&&s.referentialEqualities&&(i=yH(i,s.referentialEqualities,s.v??0)),i}stringify(t){return JSON.stringify(this.serialize(t))}parse(t){return this.deserialize(JSON.parse(t),{inPlace:!0})}registerClass(t,n){this.classRegistry.register(t,n)}registerSymbol(t,n){this.symbolRegistry.register(t,n)}registerCustom(t,n){this.customTransformerRegistry.register({name:n,...t})}allowErrorProps(...t){this.allowedErrorProps.push(...t)}}Ge.defaultInstance=new Ge;Ge.serialize=Ge.defaultInstance.serialize.bind(Ge.defaultInstance);Ge.deserialize=Ge.defaultInstance.deserialize.bind(Ge.defaultInstance);Ge.stringify=Ge.defaultInstance.stringify.bind(Ge.defaultInstance);Ge.parse=Ge.defaultInstance.parse.bind(Ge.defaultInstance);Ge.registerClass=Ge.defaultInstance.registerClass.bind(Ge.defaultInstance);Ge.registerSymbol=Ge.defaultInstance.registerSymbol.bind(Ge.defaultInstance);Ge.registerCustom=Ge.defaultInstance.registerCustom.bind(Ge.defaultInstance);Ge.allowErrorProps=Ge.defaultInstance.allowErrorProps.bind(Ge.defaultInstance);Ge.serialize;Ge.deserialize;Ge.stringify;Ge.parse;Ge.registerClass;Ge.registerCustom;Ge.registerSymbol;Ge.allowErrorProps;const nt=QV(),SH=nt.createClient({links:[kV({url:"/trpc",transformer:Ge})]}),AA=x.createContext(null),CH=AA.Provider,Ht=()=>{const e=x.useContext(AA);if(!e)throw new Error("useProjectContext must be used within ProjectProvider.");return e};class Rk extends Error{constructor(n="Not found"){super(n);it(this,"code","NOT_FOUND");this.name="NotFoundError"}}function EH(e){if(e instanceof Rk)return!0;if(e&&typeof e=="object"){if("code"in e&&e.code==="NOT_FOUND")return!0;if("data"in e){const t=e.data;if((t==null?void 0:t.code)==="NOT_FOUND")return!0}}return!1}const Pf=()=>{var d;const{apiRoot:e,activeProject:t}=Ht(),n=_i(),r=Mf({queryKey:["agents",t==null?void 0:t.id],queryFn:async()=>{const h=await fetch(`${e}/agents?includeArchived=true`);if(!h.ok)throw new Error(h.statusText);return await h.json()},enabled:!!t,refetchInterval:5e3,refetchOnWindowFocus:!1}),s=ai({mutationFn:async h=>{const f=await fetch(`${e}/agents`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:h})});if(!f.ok)throw new Error(f.statusText);return await f.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["agents",t==null?void 0:t.id]})}}),i=ai({mutationFn:async({agentId:h,message:f,onStream:m})=>new Promise((y,w)=>{let b=!1,C=Date.now(),S=null,k=null;const E=()=>{S&&(clearInterval(S),S=null)},N=T=>{b||(b=!0,E(),y(T))},O=T=>{b||(b=!0,E(),w(T))};S=setInterval(()=>{if(b)return E();Date.now()-C>45e3&&(m==null||m({type:"disconnected",reason:"timeout"}),k==null||k.cancel().catch(()=>{}),O(new Error("Connection to agent lost. Send a follow-up message to continue.")))},5e3),fetch(`${e}/agents/${h}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:f})}).then(async T=>{if(!T.ok)throw new Error(T.statusText);if(!T.body)throw new Error("No response body");k=T.body.getReader();const j=new TextDecoder;let A="";for(;;){const{done:z,value:D}=await k.read();if(z)break;C=Date.now(),A+=j.decode(D,{stream:!0});const L=A.split(`
|
|
68
|
+
`);A=L.pop()||"";for(const H of L)if(H.startsWith("data: "))try{const K=JSON.parse(H.slice(6));m==null||m(K),K.type==="complete"?(n.invalidateQueries({queryKey:["agents",t==null?void 0:t.id]}),n.invalidateQueries({queryKey:["agent",t==null?void 0:t.id,h]}),N({success:!0})):K.type==="error"&&O(new Error(K.error||"Unknown error"))}catch{}}b||(m==null||m({type:"disconnected",reason:"network"}),O(new Error("Connection to agent lost. Send a follow-up message to continue.")))}).catch(T=>O(T instanceof Error?T:new Error(String(T))))}),onSuccess:(h,f)=>{n.invalidateQueries({queryKey:["agents",t==null?void 0:t.id]}),n.invalidateQueries({queryKey:["agent",t==null?void 0:t.id,f.agentId]})}}),o=ai({mutationFn:async h=>{const f=await fetch(`${e}/agents/${h}`,{method:"DELETE"});if(!f.ok)throw new Error(f.statusText);return await f.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["agents",t==null?void 0:t.id]})}}),l=ai({mutationFn:async h=>{const f=await fetch(`${e}/agents/${h}/archive`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!f.ok)throw new Error(f.statusText);return await f.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["agents",t==null?void 0:t.id]})}}),a=ai({mutationFn:async h=>{const f=await fetch(`${e}/agents/${h}/interrupt`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!f.ok)throw new Error(f.statusText);return await f.json()},onSuccess:(h,f)=>{n.invalidateQueries({queryKey:["agent",t==null?void 0:t.id,f]})}}),u=ai({mutationFn:async({agentId:h,name:f})=>{const m=await fetch(`${e}/agents/${h}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:f})});if(!m.ok)throw new Error(m.statusText);return await m.json()},onSuccess:(h,f)=>{n.invalidateQueries({queryKey:["agents",t==null?void 0:t.id]}),n.invalidateQueries({queryKey:["agent",t==null?void 0:t.id,f.agentId]})}}),c=ai({mutationFn:async({agentId:h,mode:f})=>{const m=await fetch(`${e}/agents/${h}/permission-mode`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:f})});if(!m.ok)throw new Error(m.statusText);return await m.json()},onSuccess:(h,f)=>{n.invalidateQueries({queryKey:["agent",t==null?void 0:t.id,f.agentId]})}});return{agents:((d=r.data)==null?void 0:d.agents)??[],isLoading:r.isLoading,error:r.error,createAgent:s.mutate,sendMessage:i.mutate,deleteAgent:o.mutate,archiveAgent:l.mutate,interruptAgent:a.mutate,updateAgent:u.mutate,setPermissionMode:c.mutate}},NH=e=>{const{apiRoot:t,activeProject:n}=Ht();return Mf({queryKey:["agent",n==null?void 0:n.id,e],queryFn:async()=>{if(!e)return null;const r=await fetch(`${t}/agents/${e}`);if(r.status===404)throw new Rk("Agent not found");if(!r.ok)throw new Error(r.statusText);return await r.json()},enabled:!!(n&&e),refetchInterval:!1,refetchOnWindowFocus:!1})},_A=e=>{var o;const{apiRoot:t,activeProject:n}=Ht(),r=_i(),s=Mf({queryKey:["permissions",n==null?void 0:n.id,e],queryFn:async()=>{if(!e)return{permissions:[]};const l=await fetch(`${t}/agents/${e}/permissions`);if(!l.ok)throw new Error(l.statusText);return await l.json()},enabled:!!(n&&e),refetchInterval:1e3,refetchOnWindowFocus:!1}),i=ai({mutationFn:async({agentId:l,permissionId:a,behavior:u,message:c,updatedPermissions:d})=>{const h=await fetch(`${t}/agents/${l}/permissions/${a}/respond`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({behavior:u,message:c,updatedPermissions:d})});if(!h.ok)throw new Error(h.statusText);return await h.json()},onSuccess:()=>{r.invalidateQueries({queryKey:["permissions",n==null?void 0:n.id,e]}),r.invalidateQueries({queryKey:["agent",n==null?void 0:n.id,e]})}});return{permissions:((o=s.data)==null?void 0:o.permissions)??[],isLoading:s.isLoading,respondToPermission:i.mutate}};/**
|
|
69
|
+
* @license lucide-react v0.563.0 - ISC
|
|
70
|
+
*
|
|
71
|
+
* This source code is licensed under the ISC license.
|
|
72
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
73
|
+
*/const IA=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
|
|
74
|
+
* @license lucide-react v0.563.0 - ISC
|
|
75
|
+
*
|
|
76
|
+
* This source code is licensed under the ISC license.
|
|
77
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
78
|
+
*/const TH=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
79
|
+
* @license lucide-react v0.563.0 - ISC
|
|
80
|
+
*
|
|
81
|
+
* This source code is licensed under the ISC license.
|
|
82
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
83
|
+
*/const RH=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
|
|
84
|
+
* @license lucide-react v0.563.0 - ISC
|
|
85
|
+
*
|
|
86
|
+
* This source code is licensed under the ISC license.
|
|
87
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
88
|
+
*/const $E=e=>{const t=RH(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
|
89
|
+
* @license lucide-react v0.563.0 - ISC
|
|
90
|
+
*
|
|
91
|
+
* This source code is licensed under the ISC license.
|
|
92
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
93
|
+
*/var MH={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"};/**
|
|
94
|
+
* @license lucide-react v0.563.0 - ISC
|
|
95
|
+
*
|
|
96
|
+
* This source code is licensed under the ISC license.
|
|
97
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
98
|
+
*/const OH=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
|
|
99
|
+
* @license lucide-react v0.563.0 - ISC
|
|
100
|
+
*
|
|
101
|
+
* This source code is licensed under the ISC license.
|
|
102
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
103
|
+
*/const jH=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},a)=>x.createElement("svg",{ref:a,...MH,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:IA("lucide",s),...!i&&!OH(l)&&{"aria-hidden":"true"},...l},[...o.map(([u,c])=>x.createElement(u,c)),...Array.isArray(i)?i:[i]]));/**
|
|
104
|
+
* @license lucide-react v0.563.0 - ISC
|
|
105
|
+
*
|
|
106
|
+
* This source code is licensed under the ISC license.
|
|
107
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
108
|
+
*/const Se=(e,t)=>{const n=x.forwardRef(({className:r,...s},i)=>x.createElement(jH,{ref:i,iconNode:t,className:IA(`lucide-${TH($E(e))}`,`lucide-${e}`,r),...s}));return n.displayName=$E(e),n};/**
|
|
109
|
+
* @license lucide-react v0.563.0 - ISC
|
|
110
|
+
*
|
|
111
|
+
* This source code is licensed under the ISC license.
|
|
112
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
113
|
+
*/const PH=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],rm=Se("archive",PH);/**
|
|
114
|
+
* @license lucide-react v0.563.0 - ISC
|
|
115
|
+
*
|
|
116
|
+
* This source code is licensed under the ISC license.
|
|
117
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
118
|
+
*/const AH=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]],_H=Se("arrow-down-a-z",AH);/**
|
|
119
|
+
* @license lucide-react v0.563.0 - ISC
|
|
120
|
+
*
|
|
121
|
+
* This source code is licensed under the ISC license.
|
|
122
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
123
|
+
*/const IH=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],tw=Se("arrow-down-wide-narrow",IH);/**
|
|
124
|
+
* @license lucide-react v0.563.0 - ISC
|
|
125
|
+
*
|
|
126
|
+
* This source code is licensed under the ISC license.
|
|
127
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
128
|
+
*/const DH=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]],LH=Se("arrow-up-a-z",DH);/**
|
|
129
|
+
* @license lucide-react v0.563.0 - ISC
|
|
130
|
+
*
|
|
131
|
+
* This source code is licensed under the ISC license.
|
|
132
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
133
|
+
*/const $H=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],sm=Se("arrow-up-narrow-wide",$H);/**
|
|
134
|
+
* @license lucide-react v0.563.0 - ISC
|
|
135
|
+
*
|
|
136
|
+
* This source code is licensed under the ISC license.
|
|
137
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
138
|
+
*/const zH=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],FH=Se("bell",zH);/**
|
|
139
|
+
* @license lucide-react v0.563.0 - ISC
|
|
140
|
+
*
|
|
141
|
+
* This source code is licensed under the ISC license.
|
|
142
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
143
|
+
*/const BH=[["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"}]],VH=Se("bold",BH);/**
|
|
144
|
+
* @license lucide-react v0.563.0 - ISC
|
|
145
|
+
*
|
|
146
|
+
* This source code is licensed under the ISC license.
|
|
147
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
148
|
+
*/const HH=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Af=Se("check",HH);/**
|
|
149
|
+
* @license lucide-react v0.563.0 - ISC
|
|
150
|
+
*
|
|
151
|
+
* This source code is licensed under the ISC license.
|
|
152
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
153
|
+
*/const UH=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Mo=Se("chevron-down",UH);/**
|
|
154
|
+
* @license lucide-react v0.563.0 - ISC
|
|
155
|
+
*
|
|
156
|
+
* This source code is licensed under the ISC license.
|
|
157
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
158
|
+
*/const qH=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Au=Se("chevron-right",qH);/**
|
|
159
|
+
* @license lucide-react v0.563.0 - ISC
|
|
160
|
+
*
|
|
161
|
+
* This source code is licensed under the ISC license.
|
|
162
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
163
|
+
*/const WH=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],KH=Se("chevron-up",WH);/**
|
|
164
|
+
* @license lucide-react v0.563.0 - ISC
|
|
165
|
+
*
|
|
166
|
+
* This source code is licensed under the ISC license.
|
|
167
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
168
|
+
*/const QH=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],GH=Se("chevrons-up-down",QH);/**
|
|
169
|
+
* @license lucide-react v0.563.0 - ISC
|
|
170
|
+
*
|
|
171
|
+
* This source code is licensed under the ISC license.
|
|
172
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
173
|
+
*/const JH=[["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"}]],ZH=Se("circle-alert",JH);/**
|
|
174
|
+
* @license lucide-react v0.563.0 - ISC
|
|
175
|
+
*
|
|
176
|
+
* This source code is licensed under the ISC license.
|
|
177
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
178
|
+
*/const YH=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Mk=Se("code-xml",YH);/**
|
|
179
|
+
* @license lucide-react v0.563.0 - ISC
|
|
180
|
+
*
|
|
181
|
+
* This source code is licensed under the ISC license.
|
|
182
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
183
|
+
*/const XH=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],eU=Se("code",XH);/**
|
|
184
|
+
* @license lucide-react v0.563.0 - ISC
|
|
185
|
+
*
|
|
186
|
+
* This source code is licensed under the ISC license.
|
|
187
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
188
|
+
*/const tU=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],nU=Se("command",tU);/**
|
|
189
|
+
* @license lucide-react v0.563.0 - ISC
|
|
190
|
+
*
|
|
191
|
+
* This source code is licensed under the ISC license.
|
|
192
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
193
|
+
*/const rU=[["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"}]],sU=Se("copy",rU);/**
|
|
194
|
+
* @license lucide-react v0.563.0 - ISC
|
|
195
|
+
*
|
|
196
|
+
* This source code is licensed under the ISC license.
|
|
197
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
198
|
+
*/const iU=[["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"}]],oU=Se("database",iU);/**
|
|
199
|
+
* @license lucide-react v0.563.0 - ISC
|
|
200
|
+
*
|
|
201
|
+
* This source code is licensed under the ISC license.
|
|
202
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
203
|
+
*/const lU=[["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"}]],DA=Se("ellipsis-vertical",lU);/**
|
|
204
|
+
* @license lucide-react v0.563.0 - ISC
|
|
205
|
+
*
|
|
206
|
+
* This source code is licensed under the ISC license.
|
|
207
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
208
|
+
*/const aU=[["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"}]],LA=Se("external-link",aU);/**
|
|
209
|
+
* @license lucide-react v0.563.0 - ISC
|
|
210
|
+
*
|
|
211
|
+
* This source code is licensed under the ISC license.
|
|
212
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
213
|
+
*/const uU=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],cU=Se("eye-off",uU);/**
|
|
214
|
+
* @license lucide-react v0.563.0 - ISC
|
|
215
|
+
*
|
|
216
|
+
* This source code is licensed under the ISC license.
|
|
217
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
218
|
+
*/const dU=[["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"}]],fU=Se("eye",dU);/**
|
|
219
|
+
* @license lucide-react v0.563.0 - ISC
|
|
220
|
+
*
|
|
221
|
+
* This source code is licensed under the ISC license.
|
|
222
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
223
|
+
*/const hU=[["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"}]],ua=Se("file-text",hU);/**
|
|
224
|
+
* @license lucide-react v0.563.0 - ISC
|
|
225
|
+
*
|
|
226
|
+
* This source code is licensed under the ISC license.
|
|
227
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
228
|
+
*/const pU=[["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"}]],mU=Se("file",pU);/**
|
|
229
|
+
* @license lucide-react v0.563.0 - ISC
|
|
230
|
+
*
|
|
231
|
+
* This source code is licensed under the ISC license.
|
|
232
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
233
|
+
*/const gU=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],im=Se("folder-open",gU);/**
|
|
234
|
+
* @license lucide-react v0.563.0 - ISC
|
|
235
|
+
*
|
|
236
|
+
* This source code is licensed under the ISC license.
|
|
237
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
238
|
+
*/const yU=[["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"}]],sc=Se("folder",yU);/**
|
|
239
|
+
* @license lucide-react v0.563.0 - ISC
|
|
240
|
+
*
|
|
241
|
+
* This source code is licensed under the ISC license.
|
|
242
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
243
|
+
*/const xU=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],$A=Se("funnel",xU);/**
|
|
244
|
+
* @license lucide-react v0.563.0 - ISC
|
|
245
|
+
*
|
|
246
|
+
* This source code is licensed under the ISC license.
|
|
247
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
248
|
+
*/const vU=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],wU=Se("grip-vertical",vU);/**
|
|
249
|
+
* @license lucide-react v0.563.0 - ISC
|
|
250
|
+
*
|
|
251
|
+
* This source code is licensed under the ISC license.
|
|
252
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
253
|
+
*/const bU=[["path",{d:"M3 7V5c0-1.1.9-2 2-2h2",key:"adw53z"}],["path",{d:"M17 3h2c1.1 0 2 .9 2 2v2",key:"an4l38"}],["path",{d:"M21 17v2c0 1.1-.9 2-2 2h-2",key:"144t0e"}],["path",{d:"M7 21H5c-1.1 0-2-.9-2-2v-2",key:"rtnfgi"}],["rect",{width:"7",height:"5",x:"7",y:"7",rx:"1",key:"1eyiv7"}],["rect",{width:"7",height:"5",x:"10",y:"12",rx:"1",key:"1qlmkx"}]],zA=Se("group",bU);/**
|
|
254
|
+
* @license lucide-react v0.563.0 - ISC
|
|
255
|
+
*
|
|
256
|
+
* This source code is licensed under the ISC license.
|
|
257
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
258
|
+
*/const kU=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],FA=Se("hash",kU);/**
|
|
259
|
+
* @license lucide-react v0.563.0 - ISC
|
|
260
|
+
*
|
|
261
|
+
* This source code is licensed under the ISC license.
|
|
262
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
263
|
+
*/const SU=[["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"}]],CU=Se("heading-2",SU);/**
|
|
264
|
+
* @license lucide-react v0.563.0 - ISC
|
|
265
|
+
*
|
|
266
|
+
* This source code is licensed under the ISC license.
|
|
267
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
268
|
+
*/const EU=[["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"}]],NU=Se("heading-3",EU);/**
|
|
269
|
+
* @license lucide-react v0.563.0 - ISC
|
|
270
|
+
*
|
|
271
|
+
* This source code is licensed under the ISC license.
|
|
272
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
273
|
+
*/const TU=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],BA=Se("info",TU);/**
|
|
274
|
+
* @license lucide-react v0.563.0 - ISC
|
|
275
|
+
*
|
|
276
|
+
* This source code is licensed under the ISC license.
|
|
277
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
278
|
+
*/const RU=[["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"}]],MU=Se("italic",RU);/**
|
|
279
|
+
* @license lucide-react v0.563.0 - ISC
|
|
280
|
+
*
|
|
281
|
+
* This source code is licensed under the ISC license.
|
|
282
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
283
|
+
*/const OU=[["path",{d:"M5 3v14",key:"9nsxs2"}],["path",{d:"M12 3v8",key:"1h2ygw"}],["path",{d:"M19 3v18",key:"1sk56x"}]],jU=Se("kanban",OU);/**
|
|
284
|
+
* @license lucide-react v0.563.0 - ISC
|
|
285
|
+
*
|
|
286
|
+
* This source code is licensed under the ISC license.
|
|
287
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
288
|
+
*/const PU=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],AU=Se("keyboard",PU);/**
|
|
289
|
+
* @license lucide-react v0.563.0 - ISC
|
|
290
|
+
*
|
|
291
|
+
* This source code is licensed under the ISC license.
|
|
292
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
293
|
+
*/const _U=[["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"}]],IU=Se("link-2",_U);/**
|
|
294
|
+
* @license lucide-react v0.563.0 - ISC
|
|
295
|
+
*
|
|
296
|
+
* This source code is licensed under the ISC license.
|
|
297
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
298
|
+
*/const DU=[["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"}]],VA=Se("link",DU);/**
|
|
299
|
+
* @license lucide-react v0.563.0 - ISC
|
|
300
|
+
*
|
|
301
|
+
* This source code is licensed under the ISC license.
|
|
302
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
303
|
+
*/const LU=[["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"}]],$U=Se("list-ordered",LU);/**
|
|
304
|
+
* @license lucide-react v0.563.0 - ISC
|
|
305
|
+
*
|
|
306
|
+
* This source code is licensed under the ISC license.
|
|
307
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
308
|
+
*/const zU=[["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"}]],HA=Se("list",zU);/**
|
|
309
|
+
* @license lucide-react v0.563.0 - ISC
|
|
310
|
+
*
|
|
311
|
+
* This source code is licensed under the ISC license.
|
|
312
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
313
|
+
*/const FU=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],om=Se("loader-circle",FU);/**
|
|
314
|
+
* @license lucide-react v0.563.0 - ISC
|
|
315
|
+
*
|
|
316
|
+
* This source code is licensed under the ISC license.
|
|
317
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
318
|
+
*/const BU=[["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"}]],VU=Se("message-square",BU);/**
|
|
319
|
+
* @license lucide-react v0.563.0 - ISC
|
|
320
|
+
*
|
|
321
|
+
* This source code is licensed under the ISC license.
|
|
322
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
323
|
+
*/const HU=[["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"}]],UU=Se("pen",HU);/**
|
|
324
|
+
* @license lucide-react v0.563.0 - ISC
|
|
325
|
+
*
|
|
326
|
+
* This source code is licensed under the ISC license.
|
|
327
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
328
|
+
*/const qU=[["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"}]],WU=Se("pencil",qU);/**
|
|
329
|
+
* @license lucide-react v0.563.0 - ISC
|
|
330
|
+
*
|
|
331
|
+
* This source code is licensed under the ISC license.
|
|
332
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
333
|
+
*/const KU=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],UA=Se("pin",KU);/**
|
|
334
|
+
* @license lucide-react v0.563.0 - ISC
|
|
335
|
+
*
|
|
336
|
+
* This source code is licensed under the ISC license.
|
|
337
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
338
|
+
*/const QU=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],qA=Se("play",QU);/**
|
|
339
|
+
* @license lucide-react v0.563.0 - ISC
|
|
340
|
+
*
|
|
341
|
+
* This source code is licensed under the ISC license.
|
|
342
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
343
|
+
*/const GU=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],$n=Se("plus",GU);/**
|
|
344
|
+
* @license lucide-react v0.563.0 - ISC
|
|
345
|
+
*
|
|
346
|
+
* This source code is licensed under the ISC license.
|
|
347
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
348
|
+
*/const JU=[["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"}]],ZU=Se("quote",JU);/**
|
|
349
|
+
* @license lucide-react v0.563.0 - ISC
|
|
350
|
+
*
|
|
351
|
+
* This source code is licensed under the ISC license.
|
|
352
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
353
|
+
*/const YU=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],XU=Se("rotate-cw",YU);/**
|
|
354
|
+
* @license lucide-react v0.563.0 - ISC
|
|
355
|
+
*
|
|
356
|
+
* This source code is licensed under the ISC license.
|
|
357
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
358
|
+
*/const e6=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],t6=Se("scroll-text",e6);/**
|
|
359
|
+
* @license lucide-react v0.563.0 - ISC
|
|
360
|
+
*
|
|
361
|
+
* This source code is licensed under the ISC license.
|
|
362
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
363
|
+
*/const n6=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ok=Se("search",n6);/**
|
|
364
|
+
* @license lucide-react v0.563.0 - ISC
|
|
365
|
+
*
|
|
366
|
+
* This source code is licensed under the ISC license.
|
|
367
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
368
|
+
*/const r6=[["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"}]],s6=Se("send",r6);/**
|
|
369
|
+
* @license lucide-react v0.563.0 - ISC
|
|
370
|
+
*
|
|
371
|
+
* This source code is licensed under the ISC license.
|
|
372
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
373
|
+
*/const i6=[["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"}]],WA=Se("settings",i6);/**
|
|
374
|
+
* @license lucide-react v0.563.0 - ISC
|
|
375
|
+
*
|
|
376
|
+
* This source code is licensed under the ISC license.
|
|
377
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
378
|
+
*/const o6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],l6=Se("smile",o6);/**
|
|
379
|
+
* @license lucide-react v0.563.0 - ISC
|
|
380
|
+
*
|
|
381
|
+
* This source code is licensed under the ISC license.
|
|
382
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
383
|
+
*/const a6=[["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"}]],u6=Se("square-check-big",a6);/**
|
|
384
|
+
* @license lucide-react v0.563.0 - ISC
|
|
385
|
+
*
|
|
386
|
+
* This source code is licensed under the ISC license.
|
|
387
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
388
|
+
*/const c6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],KA=Se("square",c6);/**
|
|
389
|
+
* @license lucide-react v0.563.0 - ISC
|
|
390
|
+
*
|
|
391
|
+
* This source code is licensed under the ISC license.
|
|
392
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
393
|
+
*/const d6=[["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"}]],f6=Se("strikethrough",d6);/**
|
|
394
|
+
* @license lucide-react v0.563.0 - ISC
|
|
395
|
+
*
|
|
396
|
+
* This source code is licensed under the ISC license.
|
|
397
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
398
|
+
*/const h6=[["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"}]],ic=Se("trash-2",h6);/**
|
|
399
|
+
* @license lucide-react v0.563.0 - ISC
|
|
400
|
+
*
|
|
401
|
+
* This source code is licensed under the ISC license.
|
|
402
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
403
|
+
*/const p6=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],m6=Se("unlink",p6);/**
|
|
404
|
+
* @license lucide-react v0.563.0 - ISC
|
|
405
|
+
*
|
|
406
|
+
* This source code is licensed under the ISC license.
|
|
407
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
408
|
+
*/const g6=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],y6=Se("wifi-off",g6);/**
|
|
409
|
+
* @license lucide-react v0.563.0 - ISC
|
|
410
|
+
*
|
|
411
|
+
* This source code is licensed under the ISC license.
|
|
412
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
413
|
+
*/const x6=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Gr=Se("x",x6),v6=e=>{var t;(t=e.openCreateDialog)==null||t.call(e,"markdown")},w6=e=>{var t;(t=e.openCreateDialog)==null||t.call(e,"json")},b6=e=>{var t;(t=e.openCreateDialog)==null||t.call(e,"prompt")},k6=e=>{var t;(t=e.openCreateDialog)==null||t.call(e,"app")},S6=e=>{var t;(t=e.openCreateDialog)==null||t.call(e,"tasks")},jk=async e=>{var t;e.activeDoc&&await((t=e.toggleDocPinned)==null?void 0:t.call(e,e.activeDoc))},Pk=async e=>{var t;e.activeDoc&&await((t=e.archiveDoc)==null?void 0:t.call(e,e.activeDoc))},Ak=async e=>{var t;e.activeDoc&&await((t=e.deleteDoc)==null?void 0:t.call(e,e.activeDoc))},C6=e=>{var t;(t=e.setAgentsSidebarOpen)==null||t.call(e,!0)},E6=e=>{var t;(t=e.setAgentsSidebarOpen)==null||t.call(e,!1)},N6=e=>{var t;(t=e.createAgent)==null||t.call(e)},T6=e=>{var t;(t=e.openInTerminal)==null||t.call(e)},R6=e=>{var t;(t=e.openZapper)==null||t.call(e)},M6=e=>{var t;(t=e.openCreateProject)==null||t.call(e)};function QA(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=QA(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function GA(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=QA(e))&&(r&&(r+=" "),r+=t);return r}const O6=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},j6=(e,t)=>({classGroupId:e,validator:t}),JA=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),lm="-",zE=[],P6="arbitrary..",A6=e=>{const t=I6(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return _6(o);const l=o.split(lm),a=l[0]===""&&l.length>1?1:0;return ZA(l,a,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const a=r[o],u=n[o];return a?u?O6(u,a):a:u||zE}return n[o]||zE}}},ZA=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],i=n.nextPart.get(s);if(i){const u=ZA(e,t+1,i);if(u)return u}const o=n.validators;if(o===null)return;const l=t===0?e.join(lm):e.slice(t).join(lm),a=o.length;for(let u=0;u<a;u++){const c=o[u];if(c.validator(l))return c.classGroupId}},_6=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?P6+r:void 0})(),I6=e=>{const{theme:t,classGroups:n}=e;return D6(n,t)},D6=(e,t)=>{const n=JA();for(const r in e){const s=e[r];_k(s,n,r,t)}return n},_k=(e,t,n,r)=>{const s=e.length;for(let i=0;i<s;i++){const o=e[i];L6(o,t,n,r)}},L6=(e,t,n,r)=>{if(typeof e=="string"){$6(e,t,n);return}if(typeof e=="function"){z6(e,t,n,r);return}F6(e,t,n,r)},$6=(e,t,n)=>{const r=e===""?t:YA(t,e);r.classGroupId=n},z6=(e,t,n,r)=>{if(B6(e)){_k(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(j6(n,e))},F6=(e,t,n,r)=>{const s=Object.entries(e),i=s.length;for(let o=0;o<i;o++){const[l,a]=s[o];_k(a,YA(t,l),n,r)}},YA=(e,t)=>{let n=e;const r=t.split(lm),s=r.length;for(let i=0;i<s;i++){const o=r[i];let l=n.nextPart.get(o);l||(l=JA(),n.nextPart.set(o,l)),n=l}return n},B6=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,V6=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(i,o)=>{n[i]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=r[i])!==void 0)return s(i,o),o},set(i,o){i in n?n[i]=o:s(i,o)}}},nw="!",FE=":",H6=[],BE=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),U6=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const i=[];let o=0,l=0,a=0,u;const c=s.length;for(let g=0;g<c;g++){const v=s[g];if(o===0&&l===0){if(v===FE){i.push(s.slice(a,g)),a=g+1;continue}if(v==="/"){u=g;continue}}v==="["?o++:v==="]"?o--:v==="("?l++:v===")"&&l--}const d=i.length===0?s:s.slice(a);let h=d,f=!1;d.endsWith(nw)?(h=d.slice(0,-1),f=!0):d.startsWith(nw)&&(h=d.slice(1),f=!0);const m=u&&u>a?u-a:void 0;return BE(i,f,h,m)};if(t){const s=t+FE,i=r;r=o=>o.startsWith(s)?i(o.slice(s.length)):BE(H6,!1,o,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},q6=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i<n.length;i++){const o=n[i],l=o[0]==="[",a=t.has(o);l||a?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(o)):s.push(o)}return s.length>0&&(s.sort(),r.push(...s)),r}},W6=e=>({cache:V6(e.cacheSize),parseClassName:U6(e),sortModifiers:q6(e),...A6(e)}),K6=/\s+/,Q6=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=t,o=[],l=e.trim().split(K6);let a="";for(let u=l.length-1;u>=0;u-=1){const c=l[u],{isExternal:d,modifiers:h,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:g}=n(c);if(d){a=c+(a.length>0?" "+a:a);continue}let v=!!g,y=r(v?m.substring(0,g):m);if(!y){if(!v){a=c+(a.length>0?" "+a:a);continue}if(y=r(m),!y){a=c+(a.length>0?" "+a:a);continue}v=!1}const w=h.length===0?"":h.length===1?h[0]:i(h).join(":"),b=f?w+nw:w,C=b+y;if(o.indexOf(C)>-1)continue;o.push(C);const S=s(y,v);for(let k=0;k<S.length;++k){const E=S[k];o.push(b+E)}a=c+(a.length>0?" "+a:a)}return a},G6=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=XA(n))&&(s&&(s+=" "),s+=r);return s},XA=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=XA(e[r]))&&(n&&(n+=" "),n+=t);return n},J6=(e,...t)=>{let n,r,s,i;const o=a=>{const u=t.reduce((c,d)=>d(c),e());return n=W6(u),r=n.cache.get,s=n.cache.set,i=l,l(a)},l=a=>{const u=r(a);if(u)return u;const c=Q6(a,n);return s(a,c),c};return i=o,(...a)=>i(G6(...a))},Z6=[],Ut=e=>{const t=n=>n[e]||Z6;return t.isThemeGetter=!0,t},e_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,t_=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Y6=/^\d+\/\d+$/,X6=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,e9=/\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$/,t9=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,n9=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,r9=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,va=e=>Y6.test(e),He=e=>!!e&&!Number.isNaN(Number(e)),zi=e=>!!e&&Number.isInteger(Number(e)),px=e=>e.endsWith("%")&&He(e.slice(0,-1)),Xs=e=>X6.test(e),s9=()=>!0,i9=e=>e9.test(e)&&!t9.test(e),n_=()=>!1,o9=e=>n9.test(e),l9=e=>r9.test(e),a9=e=>!ge(e)&&!ye(e),u9=e=>oc(e,i_,n_),ge=e=>e_.test(e),al=e=>oc(e,o_,i9),mx=e=>oc(e,p9,He),VE=e=>oc(e,r_,n_),c9=e=>oc(e,s_,l9),yh=e=>oc(e,l_,o9),ye=e=>t_.test(e),Ec=e=>lc(e,o_),d9=e=>lc(e,m9),HE=e=>lc(e,r_),f9=e=>lc(e,i_),h9=e=>lc(e,s_),xh=e=>lc(e,l_,!0),oc=(e,t,n)=>{const r=e_.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},lc=(e,t,n=!1)=>{const r=t_.exec(e);return r?r[1]?t(r[1]):n:!1},r_=e=>e==="position"||e==="percentage",s_=e=>e==="image"||e==="url",i_=e=>e==="length"||e==="size"||e==="bg-size",o_=e=>e==="length",p9=e=>e==="number",m9=e=>e==="family-name",l_=e=>e==="shadow",g9=()=>{const e=Ut("color"),t=Ut("font"),n=Ut("text"),r=Ut("font-weight"),s=Ut("tracking"),i=Ut("leading"),o=Ut("breakpoint"),l=Ut("container"),a=Ut("spacing"),u=Ut("radius"),c=Ut("shadow"),d=Ut("inset-shadow"),h=Ut("text-shadow"),f=Ut("drop-shadow"),m=Ut("blur"),g=Ut("perspective"),v=Ut("aspect"),y=Ut("ease"),w=Ut("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...C(),ye,ge],k=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],N=()=>[ye,ge,a],O=()=>[va,"full","auto",...N()],T=()=>[zi,"none","subgrid",ye,ge],j=()=>["auto",{span:["full",zi,ye,ge]},zi,ye,ge],A=()=>[zi,"auto",ye,ge],z=()=>["auto","min","max","fr",ye,ge],D=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],L=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...N()],K=()=>[va,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],_=()=>[e,ye,ge],Q=()=>[...C(),HE,VE,{position:[ye,ge]}],M=()=>["no-repeat",{repeat:["","x","y","space","round"]}],oe=()=>["auto","cover","contain",f9,u9,{size:[ye,ge]}],F=()=>[px,Ec,al],R=()=>["","none","full",u,ye,ge],I=()=>["",He,Ec,al],V=()=>["solid","dashed","dotted","double"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>[He,px,HE,VE],me=()=>["","none",m,ye,ge],we=()=>["none",He,ye,ge],qe=()=>["none",He,ye,ge],ut=()=>[He,ye,ge],rn=()=>[va,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xs],breakpoint:[Xs],color:[s9],container:[Xs],"drop-shadow":[Xs],ease:["in","out","in-out"],font:[a9],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xs],shadow:[Xs],spacing:["px",He],text:[Xs],"text-shadow":[Xs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",va,ge,ye,v]}],container:["container"],columns:[{columns:[He,ge,ye,l]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"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:S()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{start:O()}],end:[{end:O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[zi,"auto",ye,ge]}],basis:[{basis:[va,"full","auto",l,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[He,va,"auto","initial","none",ge]}],grow:[{grow:["",He,ye,ge]}],shrink:[{shrink:["",He,ye,ge]}],order:[{order:[zi,"first","last","none",ye,ge]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:j()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:j()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...D(),"normal"]}],"justify-items":[{"justify-items":[...L(),"normal"]}],"justify-self":[{"justify-self":["auto",...L()]}],"align-content":[{content:["normal",...D()]}],"align-items":[{items:[...L(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...L(),{baseline:["","last"]}]}],"place-content":[{"place-content":D()}],"place-items":[{"place-items":[...L(),"baseline"]}],"place-self":[{"place-self":["auto",...L()]}],p:[{p:N()}],px:[{px:N()}],py:[{py:N()}],ps:[{ps:N()}],pe:[{pe:N()}],pt:[{pt:N()}],pr:[{pr:N()}],pb:[{pb:N()}],pl:[{pl:N()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[l,"screen",...K()]}],"min-w":[{"min-w":[l,"screen","none",...K()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",n,Ec,al]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ye,mx]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",px,ge]}],"font-family":[{font:[d9,ge,t]}],"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:[s,ye,ge]}],"line-clamp":[{"line-clamp":[He,"none",ye,mx]}],leading:[{leading:[i,...N()]}],"list-image":[{"list-image":["none",ye,ge]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ye,ge]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:[He,"from-font","auto",ye,al]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[He,"auto",ye,ge]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ye,ge]}],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",ye,ge]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:M()}],"bg-size":[{bg:oe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},zi,ye,ge],radial:["",ye,ge],conic:[zi,ye,ge]},h9,c9]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:F()}],"gradient-via-pos":[{via:F()}],"gradient-to-pos":[{to:F()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":I()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...V(),"hidden","none"]}],"divide-style":[{divide:[...V(),"hidden","none"]}],"border-color":[{border:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:[...V(),"none","hidden"]}],"outline-offset":[{"outline-offset":[He,ye,ge]}],"outline-w":[{outline:["",He,Ec,al]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",c,xh,yh]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",d,xh,yh]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[He,al]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",h,xh,yh]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[He,ye,ge]}],"mix-blend":[{"mix-blend":[...Y(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Y()}],"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":[He]}],"mask-image-linear-from-pos":[{"mask-linear-from":G()}],"mask-image-linear-to-pos":[{"mask-linear-to":G()}],"mask-image-linear-from-color":[{"mask-linear-from":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"mask-image-t-from-pos":[{"mask-t-from":G()}],"mask-image-t-to-pos":[{"mask-t-to":G()}],"mask-image-t-from-color":[{"mask-t-from":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"mask-image-r-from-pos":[{"mask-r-from":G()}],"mask-image-r-to-pos":[{"mask-r-to":G()}],"mask-image-r-from-color":[{"mask-r-from":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"mask-image-b-from-pos":[{"mask-b-from":G()}],"mask-image-b-to-pos":[{"mask-b-to":G()}],"mask-image-b-from-color":[{"mask-b-from":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"mask-image-l-from-pos":[{"mask-l-from":G()}],"mask-image-l-to-pos":[{"mask-l-to":G()}],"mask-image-l-from-color":[{"mask-l-from":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"mask-image-x-from-pos":[{"mask-x-from":G()}],"mask-image-x-to-pos":[{"mask-x-to":G()}],"mask-image-x-from-color":[{"mask-x-from":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"mask-image-y-from-pos":[{"mask-y-from":G()}],"mask-image-y-to-pos":[{"mask-y-to":G()}],"mask-image-y-from-color":[{"mask-y-from":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[ye,ge]}],"mask-image-radial-from-pos":[{"mask-radial-from":G()}],"mask-image-radial-to-pos":[{"mask-radial-to":G()}],"mask-image-radial-from-color":[{"mask-radial-from":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"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":C()}],"mask-image-conic-pos":[{"mask-conic":[He]}],"mask-image-conic-from-pos":[{"mask-conic-from":G()}],"mask-image-conic-to-pos":[{"mask-conic-to":G()}],"mask-image-conic-from-color":[{"mask-conic-from":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:M()}],"mask-size":[{mask:oe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ye,ge]}],filter:[{filter:["","none",ye,ge]}],blur:[{blur:me()}],brightness:[{brightness:[He,ye,ge]}],contrast:[{contrast:[He,ye,ge]}],"drop-shadow":[{"drop-shadow":["","none",f,xh,yh]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",He,ye,ge]}],"hue-rotate":[{"hue-rotate":[He,ye,ge]}],invert:[{invert:["",He,ye,ge]}],saturate:[{saturate:[He,ye,ge]}],sepia:[{sepia:["",He,ye,ge]}],"backdrop-filter":[{"backdrop-filter":["","none",ye,ge]}],"backdrop-blur":[{"backdrop-blur":me()}],"backdrop-brightness":[{"backdrop-brightness":[He,ye,ge]}],"backdrop-contrast":[{"backdrop-contrast":[He,ye,ge]}],"backdrop-grayscale":[{"backdrop-grayscale":["",He,ye,ge]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[He,ye,ge]}],"backdrop-invert":[{"backdrop-invert":["",He,ye,ge]}],"backdrop-opacity":[{"backdrop-opacity":[He,ye,ge]}],"backdrop-saturate":[{"backdrop-saturate":[He,ye,ge]}],"backdrop-sepia":[{"backdrop-sepia":["",He,ye,ge]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":N()}],"border-spacing-x":[{"border-spacing-x":N()}],"border-spacing-y":[{"border-spacing-y":N()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ye,ge]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[He,"initial",ye,ge]}],ease:[{ease:["linear","initial",y,ye,ge]}],delay:[{delay:[He,ye,ge]}],animate:[{animate:["none",w,ye,ge]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,ye,ge]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:we()}],"rotate-x":[{"rotate-x":we()}],"rotate-y":[{"rotate-y":we()}],"rotate-z":[{"rotate-z":we()}],scale:[{scale:qe()}],"scale-x":[{"scale-x":qe()}],"scale-y":[{"scale-y":qe()}],"scale-z":[{"scale-z":qe()}],"scale-3d":["scale-3d"],skew:[{skew:ut()}],"skew-x":[{"skew-x":ut()}],"skew-y":[{"skew-y":ut()}],transform:[{transform:[ye,ge,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:rn()}],"translate-x":[{"translate-x":rn()}],"translate-y":[{"translate-y":rn()}],"translate-z":[{"translate-z":rn()}],"translate-none":["translate-none"],accent:[{accent:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"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",ye,ge]}],"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":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"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",ye,ge]}],fill:[{fill:["none",..._()]}],"stroke-w":[{stroke:[He,Ec,al,mx]}],stroke:[{stroke:["none",..._()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","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","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","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-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-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-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-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"]}},y9=J6(g9);function mt(...e){return y9(GA(e))}const Ja=typeof navigator<"u"&&navigator.platform.includes("Mac"),rw=e=>e.split("+").map(t=>t==="mod"?Ja?"⌘":"Ctrl":t==="shift"?Ja?"⇧":"Shift":t==="alt"?Ja?"⌥":"Alt":t.toUpperCase()).join(Ja?"":"+"),a_=()=>[{id:"commandPalette.open",label:"Open command palette",scope:"global",shortcut:"mod+k",keywords:["search","command","palette"]},{id:"sidebar.toggleTab",label:"Toggle docs / agents",scope:"global",shortcut:"mod+e",keywords:["docs","agents","sidebar","switch","toggle"]},{id:"doc.create.markdown",label:"Create markdown document",scope:"global",keywords:["new","create","markdown","doc"],run:v6},{id:"doc.create.json",label:"Create data table document",scope:"global",keywords:["new","create","json","table","doc"],run:w6},{id:"doc.create.prompt",label:"Create prompt document",scope:"global",keywords:["new","create","prompt","text","doc"],run:b6},{id:"doc.create.app",label:"Create React app document",scope:"global",keywords:["new","create","app","react","bundle","doc"],run:k6},{id:"doc.create.tasks",label:"Create task board",scope:"global",keywords:["new","create","tasks","todo","kanban","board","doc"],run:S6},{id:"doc.pin",label:"Pin document",scope:"doc",keywords:["pin","document","info"],run:jk},{id:"doc.archive",label:"Archive document",scope:"doc",keywords:["archive","document","info"],run:Pk},{id:"doc.delete",label:"Delete document",scope:"doc",keywords:["delete","remove","document","info"],run:Ak},{id:"agent.create",label:"Create new agent",scope:"global",shortcut:"mod+shift+a",keywords:["new","create","agent","conversation"],run:N6},{id:"agents.sidebar.open",label:"Show agents sidebar",scope:"global",keywords:["agents","sidebar","open","show"],run:C6},{id:"agents.sidebar.close",label:"Hide agents sidebar",scope:"global",keywords:["agents","sidebar","close","hide"],run:E6},{id:"project.create",label:"Create new project",scope:"global",keywords:["new","create","project"],run:M6},{id:"project.openInTerminal",label:"Open project in terminal",scope:"global",shortcut:"mod+shift+t",keywords:["terminal","project","open","shell"],run:T6},{id:"zapper.open",label:"Show Zapper",scope:"global",keywords:["zapper","services","processes","docker","tasks","zap"],run:R6}],u_=()=>{const{activeProject:e}=Ht(),t=nt.useUtils(),n=(e==null?void 0:e.id)??"",r=nt.docs.list.useQuery({projectId:n},{enabled:!!e,refetchInterval:5e3,refetchOnWindowFocus:!1}),s=x.useMemo(()=>{var u;return((u=r.data)==null?void 0:u.docs)??[]},[r.data]),i=x.useMemo(()=>{var u;return((u=r.data)==null?void 0:u.folders)??[]},[r.data]),o=x.useCallback(u=>{t.docs.list.setData({projectId:n},c=>{if(c)return{...c,docs:u(c.docs)}})},[t,n]),l=x.useCallback(()=>{t.docs.list.invalidate({projectId:n}).catch(()=>{})},[t,n]),a=x.useMemo(()=>r.error?String(r.error):"",[r.error]);return{docs:s,folders:i,docsQuery:r,updateDocsCache:o,invalidateDocs:l,errorMessage:a}},c_="hyperdoc:recent-items",x9=3,sw=new Set,v9=e=>(sw.add(e),()=>sw.delete(e));let Ra=null;function iw(){if(Ra)return Ra;try{const e=localStorage.getItem(c_);Ra=e?JSON.parse(e):[]}catch{Ra=[]}return Ra}function UE(e){Ra=e,localStorage.setItem(c_,JSON.stringify(e)),sw.forEach(t=>t())}const w9=()=>iw();function b9(){const e=x.useSyncExternalStore(v9,w9),t=x.useCallback((r,s,i,o)=>{const l=iw().filter(u=>!(u.type===r&&u.id===s)),a={type:r,id:s,label:i,emoji:o,timestamp:Date.now()};UE([a,...l].slice(0,x9))},[]),n=x.useCallback((r,s)=>{UE(iw().filter(i=>!(i.type===r&&i.id===s)))},[]);return{recentItems:e,trackItem:t,removeItem:n}}const d_=x.createContext(null),k9=d_.Provider,f_=()=>{const e=x.useContext(d_);if(!e)throw new Error("useCommandPaletteContext must be used within CommandPaletteProvider.");return e};var qE=1,S9=.9,C9=.8,E9=.17,gx=.1,yx=.999,N9=.9999,T9=.99,R9=/[\\\/_+.#"@\[\(\{&]/,M9=/[\\\/_+.#"@\[\(\{&]/g,O9=/[\s-]/,h_=/[\s-]/g;function ow(e,t,n,r,s,i,o){if(i===t.length)return s===e.length?qE:T9;var l=`${s},${i}`;if(o[l]!==void 0)return o[l];for(var a=r.charAt(i),u=n.indexOf(a,s),c=0,d,h,f,m;u>=0;)d=ow(e,t,n,r,u+1,i+1,o),d>c&&(u===s?d*=qE:R9.test(e.charAt(u-1))?(d*=C9,f=e.slice(s,u-1).match(M9),f&&s>0&&(d*=Math.pow(yx,f.length))):O9.test(e.charAt(u-1))?(d*=S9,m=e.slice(s,u-1).match(h_),m&&s>0&&(d*=Math.pow(yx,m.length))):(d*=E9,s>0&&(d*=Math.pow(yx,u-s))),e.charAt(u)!==t.charAt(i)&&(d*=N9)),(d<gx&&n.charAt(u-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(u-1)!==r.charAt(i))&&(h=ow(e,t,n,r,u+1,i+2,o),h*gx>d&&(d=h*gx)),d>c&&(c=d),u=n.indexOf(a,u+1);return o[l]=c,c}function WE(e){return e.toLowerCase().replace(h_," ")}function j9(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,ow(e,t,WE(e),WE(t),0,0,{})}function Wt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function KE(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Fo(...e){return t=>{let n=!1;const r=e.map(s=>{const i=KE(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():KE(e[s],null)}}}}function Nr(...e){return x.useCallback(Fo(...e),e)}function P9(e,t){const n=x.createContext(t),r=i=>{const{children:o,...l}=i,a=x.useMemo(()=>l,Object.values(l));return p.jsx(n.Provider,{value:a,children:o})};r.displayName=e+"Provider";function s(i){const o=x.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,s]}function Ug(e,t=[]){let n=[];function r(i,o){const l=x.createContext(o),a=n.length;n=[...n,o];const u=d=>{var y;const{scope:h,children:f,...m}=d,g=((y=h==null?void 0:h[e])==null?void 0:y[a])||l,v=x.useMemo(()=>m,Object.values(m));return p.jsx(g.Provider,{value:v,children:f})};u.displayName=i+"Provider";function c(d,h){var g;const f=((g=h==null?void 0:h[e])==null?void 0:g[a])||l,m=x.useContext(f);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[u,c]}const s=()=>{const i=n.map(o=>x.createContext(o));return function(l){const a=(l==null?void 0:l[e])||i;return x.useMemo(()=>({[`__scope${e}`]:{...l,[e]:a}}),[l,a])}};return s.scopeName=e,[r,A9(s,...t)]}function A9(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:a,scopeName:u})=>{const d=a(i)[`__scope${u}`];return{...l,...d}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Bo=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},_9=kf[" useId ".trim().toString()]||(()=>{}),I9=0;function ms(e){const[t,n]=x.useState(_9());return Bo(()=>{n(r=>r??String(I9++))},[e]),t?`radix-${t}`:""}var D9=kf[" useInsertionEffect ".trim().toString()]||Bo;function Ik({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=L9({defaultProp:t,onChange:n}),l=e!==void 0,a=l?e:s;{const c=x.useRef(e!==void 0);x.useEffect(()=>{const d=c.current;d!==l&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=l},[l,r])}const u=x.useCallback(c=>{var d;if(l){const h=$9(c)?c(e):c;h!==e&&((d=o.current)==null||d.call(o,h))}else i(c)},[l,e,i,o]);return[a,u]}function L9({defaultProp:e,onChange:t}){const[n,r]=x.useState(e),s=x.useRef(n),i=x.useRef(t);return D9(()=>{i.current=t},[t]),x.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}function $9(e){return typeof e=="function"}function Dk(e){const t=z9(e),n=x.forwardRef((r,s)=>{const{children:i,...o}=r,l=x.Children.toArray(i),a=l.find(B9);if(a){const u=a.props.children,c=l.map(d=>d===a?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:d);return p.jsx(t,{...o,ref:s,children:x.isValidElement(u)?x.cloneElement(u,void 0,c):null})}return p.jsx(t,{...o,ref:s,children:i})});return n.displayName=`${e}.Slot`,n}function z9(e){const t=x.forwardRef((n,r)=>{const{children:s,...i}=n;if(x.isValidElement(s)){const o=H9(s),l=V9(i,s.props);return s.type!==x.Fragment&&(l.ref=r?Fo(r,o):o),x.cloneElement(s,l)}return x.Children.count(s)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var p_=Symbol("radix.slottable");function F9(e){const t=({children:n})=>p.jsx(p.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=p_,t}function B9(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===p_}function V9(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const a=i(...l);return s(...l),a}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function H9(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var U9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],On=U9.reduce((e,t)=>{const n=Dk(`Primitive.${t}`),r=x.forwardRef((s,i)=>{const{asChild:o,...l}=s,a=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(a,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function q9(e,t){e&&Zo.flushSync(()=>e.dispatchEvent(t))}function _u(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function W9(e,t=globalThis==null?void 0:globalThis.document){const n=_u(e);x.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var K9="DismissableLayer",lw="dismissableLayer.update",Q9="dismissableLayer.pointerDownOutside",G9="dismissableLayer.focusOutside",QE,m_=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qg=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...a}=e,u=x.useContext(m_),[c,d]=x.useState(null),h=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=x.useState({}),m=Nr(t,E=>d(E)),g=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(v),w=c?g.indexOf(c):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,C=w>=y,S=Y9(E=>{const N=E.target,O=[...u.branches].some(T=>T.contains(N));!C||O||(s==null||s(E),o==null||o(E),E.defaultPrevented||l==null||l())},h),k=X9(E=>{const N=E.target;[...u.branches].some(T=>T.contains(N))||(i==null||i(E),o==null||o(E),E.defaultPrevented||l==null||l())},h);return W9(E=>{w===u.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&l&&(E.preventDefault(),l()))},h),x.useEffect(()=>{if(c)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(QE=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),GE(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=QE)}},[c,h,n,u]),x.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),GE())},[c,u]),x.useEffect(()=>{const E=()=>f({});return document.addEventListener(lw,E),()=>document.removeEventListener(lw,E)},[]),p.jsx(On.div,{...a,ref:m,style:{pointerEvents:b?C?"auto":"none":void 0,...e.style},onFocusCapture:Wt(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Wt(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Wt(e.onPointerDownCapture,S.onPointerDownCapture)})});qg.displayName=K9;var J9="DismissableLayerBranch",Z9=x.forwardRef((e,t)=>{const n=x.useContext(m_),r=x.useRef(null),s=Nr(t,r);return x.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),p.jsx(On.div,{...e,ref:s})});Z9.displayName=J9;function Y9(e,t=globalThis==null?void 0:globalThis.document){const n=_u(e),r=x.useRef(!1),s=x.useRef(()=>{});return x.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let a=function(){g_(Q9,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=a,t.addEventListener("click",s.current,{once:!0})):a()}else t.removeEventListener("click",s.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function X9(e,t=globalThis==null?void 0:globalThis.document){const n=_u(e),r=x.useRef(!1);return x.useEffect(()=>{const s=i=>{i.target&&!r.current&&g_(G9,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function GE(){const e=new CustomEvent(lw);document.dispatchEvent(e)}function g_(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?q9(s,i):s.dispatchEvent(i)}var xx="focusScope.autoFocusOnMount",vx="focusScope.autoFocusOnUnmount",JE={bubbles:!1,cancelable:!0},eq="FocusScope",Lk=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[l,a]=x.useState(null),u=_u(s),c=_u(i),d=x.useRef(null),h=Nr(t,g=>a(g)),f=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let g=function(b){if(f.paused||!l)return;const C=b.target;l.contains(C)?d.current=C:Hi(d.current,{select:!0})},v=function(b){if(f.paused||!l)return;const C=b.relatedTarget;C!==null&&(l.contains(C)||Hi(d.current,{select:!0}))},y=function(b){if(document.activeElement===document.body)for(const S of b)S.removedNodes.length>0&&Hi(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",v);const w=new MutationObserver(y);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",v),w.disconnect()}}},[r,l,f.paused]),x.useEffect(()=>{if(l){YE.add(f);const g=document.activeElement;if(!l.contains(g)){const y=new CustomEvent(xx,JE);l.addEventListener(xx,u),l.dispatchEvent(y),y.defaultPrevented||(tq(oq(y_(l)),{select:!0}),document.activeElement===g&&Hi(l))}return()=>{l.removeEventListener(xx,u),setTimeout(()=>{const y=new CustomEvent(vx,JE);l.addEventListener(vx,c),l.dispatchEvent(y),y.defaultPrevented||Hi(g??document.body,{select:!0}),l.removeEventListener(vx,c),YE.remove(f)},0)}}},[l,u,c,f]);const m=x.useCallback(g=>{if(!n&&!r||f.paused)return;const v=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,y=document.activeElement;if(v&&y){const w=g.currentTarget,[b,C]=nq(w);b&&C?!g.shiftKey&&y===C?(g.preventDefault(),n&&Hi(b,{select:!0})):g.shiftKey&&y===b&&(g.preventDefault(),n&&Hi(C,{select:!0})):y===w&&g.preventDefault()}},[n,r,f.paused]);return p.jsx(On.div,{tabIndex:-1,...o,ref:h,onKeyDown:m})});Lk.displayName=eq;function tq(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Hi(r,{select:t}),document.activeElement!==n)return}function nq(e){const t=y_(e),n=ZE(t,e),r=ZE(t.reverse(),e);return[n,r]}function y_(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ZE(e,t){for(const n of e)if(!rq(n,{upTo:t}))return n}function rq(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function sq(e){return e instanceof HTMLInputElement&&"select"in e}function Hi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&sq(e)&&t&&e.select()}}var YE=iq();function iq(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=XE(e,t),e.unshift(t)},remove(t){var n;e=XE(e,t),(n=e[0])==null||n.resume()}}}function XE(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function oq(e){return e.filter(t=>t.tagName!=="A")}var lq="Portal",$k=x.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[s,i]=x.useState(!1);Bo(()=>i(!0),[]);const o=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?vP.createPortal(p.jsx(On.div,{...r,ref:t}),o):null});$k.displayName=lq;function aq(e,t){return x.useReducer((n,r)=>t[n][r]??n,e)}var ca=e=>{const{present:t,children:n}=e,r=uq(t),s=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),i=Nr(r.ref,cq(s));return typeof n=="function"||r.isPresent?x.cloneElement(s,{ref:i}):null};ca.displayName="Presence";function uq(e){const[t,n]=x.useState(),r=x.useRef(null),s=x.useRef(e),i=x.useRef("none"),o=e?"mounted":"unmounted",[l,a]=aq(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const u=vh(r.current);i.current=l==="mounted"?u:"none"},[l]),Bo(()=>{const u=r.current,c=s.current;if(c!==e){const h=i.current,f=vh(u);e?a("MOUNT"):f==="none"||(u==null?void 0:u.display)==="none"?a("UNMOUNT"):a(c&&h!==f?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,a]),Bo(()=>{if(t){let u;const c=t.ownerDocument.defaultView??window,d=f=>{const g=vh(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&g&&(a("ANIMATION_END"),!s.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",u=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},h=f=>{f.target===t&&(i.current=vh(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{c.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else a("ANIMATION_END")},[t,a]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:x.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function vh(e){return(e==null?void 0:e.animationName)||"none"}function cq(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var wx=0;function x_(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??eN()),document.body.insertAdjacentElement("beforeend",e[1]??eN()),wx++,()=>{wx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),wx--}},[])}function eN(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ls=function(){return Ls=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ls.apply(this,arguments)};function v_(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function dq(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var fp="right-scroll-bar-position",hp="width-before-scroll-bar",fq="with-scroll-bars-hidden",hq="--removed-body-scroll-bar-size";function bx(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function pq(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var mq=typeof window<"u"?x.useLayoutEffect:x.useEffect,tN=new WeakMap;function gq(e,t){var n=pq(null,function(r){return e.forEach(function(s){return bx(s,r)})});return mq(function(){var r=tN.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(l){i.has(l)||bx(l,null)}),i.forEach(function(l){s.has(l)||bx(l,o)})}tN.set(n,e)},[e]),n}function yq(e){return e}function xq(e,t){t===void 0&&(t=yq);var n=[],r=!1,s={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]:e},useMedium:function(i){var o=t(i,r);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(i),o=n}var a=function(){var c=o;o=[],c.forEach(i)},u=function(){return Promise.resolve().then(a)};u(),n={push:function(c){o.push(c),u()},filter:function(c){return o=o.filter(c),n}}}};return s}function vq(e){e===void 0&&(e={});var t=xq(null);return t.options=Ls({async:!0,ssr:!1},e),t}var w_=function(e){var t=e.sideCar,n=v_(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,Ls({},n))};w_.isSideCarExport=!0;function wq(e,t){return e.useMedium(t),w_}var b_=vq(),kx=function(){},Wg=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:kx,onWheelCapture:kx,onTouchMoveCapture:kx}),s=r[0],i=r[1],o=e.forwardProps,l=e.children,a=e.className,u=e.removeScrollBar,c=e.enabled,d=e.shards,h=e.sideCar,f=e.noRelative,m=e.noIsolation,g=e.inert,v=e.allowPinchZoom,y=e.as,w=y===void 0?"div":y,b=e.gapMode,C=v_(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,k=gq([n,t]),E=Ls(Ls({},C),s);return x.createElement(x.Fragment,null,c&&x.createElement(S,{sideCar:b_,removeScrollBar:u,shards:d,noRelative:f,noIsolation:m,inert:g,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:b}),o?x.cloneElement(x.Children.only(l),Ls(Ls({},E),{ref:k})):x.createElement(w,Ls({},E,{className:a,ref:k}),l))});Wg.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Wg.classNames={fullWidth:hp,zeroRight:fp};var bq=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function kq(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=bq();return t&&e.setAttribute("nonce",t),e}function Sq(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Cq(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Eq=function(){var e=0,t=null;return{add:function(n){e==0&&(t=kq())&&(Sq(t,n),Cq(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Nq=function(){var e=Eq();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},k_=function(){var e=Nq(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Tq={left:0,top:0,right:0,gap:0},Sx=function(e){return parseInt(e||"",10)||0},Rq=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Sx(n),Sx(r),Sx(s)]},Mq=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Tq;var t=Rq(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Oq=k_(),su="data-scroll-locked",jq=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
414
|
+
.`.concat(fq,` {
|
|
415
|
+
overflow: hidden `).concat(r,`;
|
|
416
|
+
padding-right: `).concat(l,"px ").concat(r,`;
|
|
417
|
+
}
|
|
418
|
+
body[`).concat(su,`] {
|
|
419
|
+
overflow: hidden `).concat(r,`;
|
|
420
|
+
overscroll-behavior: contain;
|
|
421
|
+
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
422
|
+
padding-left: `.concat(s,`px;
|
|
423
|
+
padding-top: `).concat(i,`px;
|
|
424
|
+
padding-right: `).concat(o,`px;
|
|
425
|
+
margin-left:0;
|
|
426
|
+
margin-top:0;
|
|
427
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
428
|
+
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.`).concat(fp,` {
|
|
432
|
+
right: `).concat(l,"px ").concat(r,`;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.`).concat(hp,` {
|
|
436
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
.`).concat(fp," .").concat(fp,` {
|
|
440
|
+
right: 0 `).concat(r,`;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.`).concat(hp," .").concat(hp,` {
|
|
444
|
+
margin-right: 0 `).concat(r,`;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
body[`).concat(su,`] {
|
|
448
|
+
`).concat(hq,": ").concat(l,`px;
|
|
449
|
+
}
|
|
450
|
+
`)},nN=function(){var e=parseInt(document.body.getAttribute(su)||"0",10);return isFinite(e)?e:0},Pq=function(){x.useEffect(function(){return document.body.setAttribute(su,(nN()+1).toString()),function(){var e=nN()-1;e<=0?document.body.removeAttribute(su):document.body.setAttribute(su,e.toString())}},[])},Aq=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;Pq();var i=x.useMemo(function(){return Mq(s)},[s]);return x.createElement(Oq,{styles:jq(i,!t,s,n?"":"!important")})},aw=!1;if(typeof window<"u")try{var wh=Object.defineProperty({},"passive",{get:function(){return aw=!0,!0}});window.addEventListener("test",wh,wh),window.removeEventListener("test",wh,wh)}catch{aw=!1}var wa=aw?{passive:!1}:!1,_q=function(e){return e.tagName==="TEXTAREA"},S_=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!_q(e)&&n[t]==="visible")},Iq=function(e){return S_(e,"overflowY")},Dq=function(e){return S_(e,"overflowX")},rN=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=C_(e,r);if(s){var i=E_(e,r),o=i[1],l=i[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Lq=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},$q=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},C_=function(e,t){return e==="v"?Iq(t):Dq(t)},E_=function(e,t){return e==="v"?Lq(t):$q(t)},zq=function(e,t){return e==="h"&&t==="rtl"?-1:1},Fq=function(e,t,n,r,s){var i=zq(e,window.getComputedStyle(t).direction),o=i*r,l=n.target,a=t.contains(l),u=!1,c=o>0,d=0,h=0;do{if(!l)break;var f=E_(e,l),m=f[0],g=f[1],v=f[2],y=g-v-i*m;(m||y)&&C_(e,l)&&(d+=y,h+=m);var w=l.parentNode;l=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!a&&l!==document.body||a&&(t.contains(l)||t===l));return(c&&Math.abs(d)<1||!c&&Math.abs(h)<1)&&(u=!0),u},bh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},sN=function(e){return[e.deltaX,e.deltaY]},iN=function(e){return e&&"current"in e?e.current:e},Bq=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Vq=function(e){return`
|
|
451
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
452
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
453
|
+
`)},Hq=0,ba=[];function Uq(e){var t=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),s=x.useState(Hq++)[0],i=x.useState(k_)[0],o=x.useRef(e);x.useEffect(function(){o.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=dq([e.lockRef.current],(e.shards||[]).map(iN),!0).filter(Boolean);return g.forEach(function(v){return v.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=x.useCallback(function(g,v){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var y=bh(g),w=n.current,b="deltaX"in g?g.deltaX:w[0]-y[0],C="deltaY"in g?g.deltaY:w[1]-y[1],S,k=g.target,E=Math.abs(b)>Math.abs(C)?"h":"v";if("touches"in g&&E==="h"&&k.type==="range")return!1;var N=window.getSelection(),O=N&&N.anchorNode,T=O?O===k||O.contains(k):!1;if(T)return!1;var j=rN(E,k);if(!j)return!0;if(j?S=E:(S=E==="v"?"h":"v",j=rN(E,k)),!j)return!1;if(!r.current&&"changedTouches"in g&&(b||C)&&(r.current=S),!S)return!0;var A=r.current||S;return Fq(A,v,g,A==="h"?b:C)},[]),a=x.useCallback(function(g){var v=g;if(!(!ba.length||ba[ba.length-1]!==i)){var y="deltaY"in v?sN(v):bh(v),w=t.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&Bq(S.delta,y)})[0];if(w&&w.should){v.cancelable&&v.preventDefault();return}if(!w){var b=(o.current.shards||[]).map(iN).filter(Boolean).filter(function(S){return S.contains(v.target)}),C=b.length>0?l(v,b[0]):!o.current.noIsolation;C&&v.cancelable&&v.preventDefault()}}},[]),u=x.useCallback(function(g,v,y,w){var b={name:g,delta:v,target:y,should:w,shadowParent:qq(y)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(C){return C!==b})},1)},[]),c=x.useCallback(function(g){n.current=bh(g),r.current=void 0},[]),d=x.useCallback(function(g){u(g.type,sN(g),g.target,l(g,e.lockRef.current))},[]),h=x.useCallback(function(g){u(g.type,bh(g),g.target,l(g,e.lockRef.current))},[]);x.useEffect(function(){return ba.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",a,wa),document.addEventListener("touchmove",a,wa),document.addEventListener("touchstart",c,wa),function(){ba=ba.filter(function(g){return g!==i}),document.removeEventListener("wheel",a,wa),document.removeEventListener("touchmove",a,wa),document.removeEventListener("touchstart",c,wa)}},[]);var f=e.removeScrollBar,m=e.inert;return x.createElement(x.Fragment,null,m?x.createElement(i,{styles:Vq(s)}):null,f?x.createElement(Aq,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function qq(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Wq=wq(b_,Uq);var zk=x.forwardRef(function(e,t){return x.createElement(Wg,Ls({},e,{ref:t,sideCar:Wq}))});zk.classNames=Wg.classNames;var Kq=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ka=new WeakMap,kh=new WeakMap,Sh={},Cx=0,N_=function(e){return e&&(e.host||N_(e.parentNode))},Qq=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=N_(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Gq=function(e,t,n,r){var s=Qq(t,Array.isArray(e)?e:[e]);Sh[n]||(Sh[n]=new WeakMap);var i=Sh[n],o=[],l=new Set,a=new Set(s),u=function(d){!d||l.has(d)||(l.add(d),u(d.parentNode))};s.forEach(u);var c=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(h){if(l.has(h))c(h);else try{var f=h.getAttribute(r),m=f!==null&&f!=="false",g=(ka.get(h)||0)+1,v=(i.get(h)||0)+1;ka.set(h,g),i.set(h,v),o.push(h),g===1&&m&&kh.set(h,!0),v===1&&h.setAttribute(n,"true"),m||h.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",h,y)}})};return c(t),l.clear(),Cx++,function(){o.forEach(function(d){var h=ka.get(d)-1,f=i.get(d)-1;ka.set(d,h),i.set(d,f),h||(kh.has(d)||d.removeAttribute(r),kh.delete(d)),f||d.removeAttribute(n)}),Cx--,Cx||(ka=new WeakMap,ka=new WeakMap,kh=new WeakMap,Sh={})}},T_=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Kq(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Gq(r,s,n,"aria-hidden")):function(){return null}},Kg="Dialog",[R_]=Ug(Kg),[Jq,Cs]=R_(Kg),M_=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,l=x.useRef(null),a=x.useRef(null),[u,c]=Ik({prop:r,defaultProp:s??!1,onChange:i,caller:Kg});return p.jsx(Jq,{scope:t,triggerRef:l,contentRef:a,contentId:ms(),titleId:ms(),descriptionId:ms(),open:u,onOpenChange:c,onOpenToggle:x.useCallback(()=>c(d=>!d),[c]),modal:o,children:n})};M_.displayName=Kg;var O_="DialogTrigger",Zq=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Cs(O_,n),i=Nr(t,s.triggerRef);return p.jsx(On.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Vk(s.open),...r,ref:i,onClick:Wt(e.onClick,s.onOpenToggle)})});Zq.displayName=O_;var Fk="DialogPortal",[Yq,j_]=R_(Fk,{forceMount:void 0}),P_=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=Cs(Fk,t);return p.jsx(Yq,{scope:t,forceMount:n,children:x.Children.map(r,o=>p.jsx(ca,{present:n||i.open,children:p.jsx($k,{asChild:!0,container:s,children:o})}))})};P_.displayName=Fk;var am="DialogOverlay",A_=x.forwardRef((e,t)=>{const n=j_(am,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=Cs(am,e.__scopeDialog);return i.modal?p.jsx(ca,{present:r||i.open,children:p.jsx(eW,{...s,ref:t})}):null});A_.displayName=am;var Xq=Dk("DialogOverlay.RemoveScroll"),eW=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Cs(am,n);return p.jsx(zk,{as:Xq,allowPinchZoom:!0,shards:[s.contentRef],children:p.jsx(On.div,{"data-state":Vk(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Ql="DialogContent",__=x.forwardRef((e,t)=>{const n=j_(Ql,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=Cs(Ql,e.__scopeDialog);return p.jsx(ca,{present:r||i.open,children:i.modal?p.jsx(tW,{...s,ref:t}):p.jsx(nW,{...s,ref:t})})});__.displayName=Ql;var tW=x.forwardRef((e,t)=>{const n=Cs(Ql,e.__scopeDialog),r=x.useRef(null),s=Nr(t,n.contentRef,r);return x.useEffect(()=>{const i=r.current;if(i)return T_(i)},[]),p.jsx(I_,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Wt(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Wt(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:Wt(e.onFocusOutside,i=>i.preventDefault())})}),nW=x.forwardRef((e,t)=>{const n=Cs(Ql,e.__scopeDialog),r=x.useRef(!1),s=x.useRef(!1);return p.jsx(I_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var a,u;(a=e.onInteractOutside)==null||a.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),I_=x.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,l=Cs(Ql,n),a=x.useRef(null),u=Nr(t,a);return x_(),p.jsxs(p.Fragment,{children:[p.jsx(Lk,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:p.jsx(qg,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Vk(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(rW,{titleId:l.titleId}),p.jsx(iW,{contentRef:a,descriptionId:l.descriptionId})]})]})}),Bk="DialogTitle",D_=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Cs(Bk,n);return p.jsx(On.h2,{id:s.titleId,...r,ref:t})});D_.displayName=Bk;var L_="DialogDescription",$_=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Cs(L_,n);return p.jsx(On.p,{id:s.descriptionId,...r,ref:t})});$_.displayName=L_;var z_="DialogClose",F_=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Cs(z_,n);return p.jsx(On.button,{type:"button",...r,ref:t,onClick:Wt(e.onClick,()=>s.onOpenChange(!1))})});F_.displayName=z_;function Vk(e){return e?"open":"closed"}var B_="DialogTitleWarning",[Hde,V_]=P9(B_,{contentName:Ql,titleName:Bk,docsSlug:"dialog"}),rW=({titleId:e})=>{const t=V_(B_),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
454
|
+
|
|
455
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
456
|
+
|
|
457
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},sW="DialogDescriptionWarning",iW=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${V_(sW).contentName}}.`;return x.useEffect(()=>{var i;const s=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},H_=M_,U_=P_,Hk=A_,Uk=__,q_=D_,W_=$_,oW=F_,lW=Symbol.for("react.lazy"),um=kf[" use ".trim().toString()];function aW(e){return typeof e=="object"&&e!==null&&"then"in e}function K_(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===lW&&"_payload"in e&&aW(e._payload)}function uW(e){const t=cW(e),n=x.forwardRef((r,s)=>{let{children:i,...o}=r;K_(i)&&typeof um=="function"&&(i=um(i._payload));const l=x.Children.toArray(i),a=l.find(fW);if(a){const u=a.props.children,c=l.map(d=>d===a?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:d);return p.jsx(t,{...o,ref:s,children:x.isValidElement(u)?x.cloneElement(u,void 0,c):null})}return p.jsx(t,{...o,ref:s,children:i})});return n.displayName=`${e}.Slot`,n}function cW(e){const t=x.forwardRef((n,r)=>{let{children:s,...i}=n;if(K_(s)&&typeof um=="function"&&(s=um(s._payload)),x.isValidElement(s)){const o=pW(s),l=hW(i,s.props);return s.type!==x.Fragment&&(l.ref=r?Fo(r,o):o),x.cloneElement(s,l)}return x.Children.count(s)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var dW=Symbol("radix.slottable");function fW(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===dW}function hW(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const a=i(...l);return s(...l),a}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function pW(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mW=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Xo=mW.reduce((e,t)=>{const n=uW(`Primitive.${t}`),r=x.forwardRef((s,i)=>{const{asChild:o,...l}=s,a=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(a,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Nc='[cmdk-group=""]',Ex='[cmdk-group-items=""]',gW='[cmdk-group-heading=""]',Q_='[cmdk-item=""]',oN=`${Q_}:not([aria-disabled="true"])`,uw="cmdk-item-select",Ma="data-value",yW=(e,t,n)=>j9(e,t,n),G_=x.createContext(void 0),_f=()=>x.useContext(G_),J_=x.createContext(void 0),qk=()=>x.useContext(J_),Z_=x.createContext(void 0),Y_=x.forwardRef((e,t)=>{let n=Oa(()=>{var F,R;return{search:"",value:(R=(F=e.value)!=null?F:e.defaultValue)!=null?R:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Oa(()=>new Set),s=Oa(()=>new Map),i=Oa(()=>new Map),o=Oa(()=>new Set),l=X_(e),{label:a,children:u,value:c,onValueChange:d,filter:h,shouldFilter:f,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,w=ms(),b=ms(),C=ms(),S=x.useRef(null),k=RW();Gl(()=>{if(c!==void 0){let F=c.trim();n.current.value=F,E.emit()}},[c]),Gl(()=>{k(6,z)},[]);let E=x.useMemo(()=>({subscribe:F=>(o.current.add(F),()=>o.current.delete(F)),snapshot:()=>n.current,setState:(F,R,I)=>{var V,Y,G,me;if(!Object.is(n.current[F],R)){if(n.current[F]=R,F==="search")A(),T(),k(1,j);else if(F==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let we=document.getElementById(C);we?we.focus():(V=document.getElementById(w))==null||V.focus()}if(k(7,()=>{var we;n.current.selectedItemId=(we=D())==null?void 0:we.id,E.emit()}),I||k(5,z),((Y=l.current)==null?void 0:Y.value)!==void 0){let we=R??"";(me=(G=l.current).onValueChange)==null||me.call(G,we);return}}E.emit()}},emit:()=>{o.current.forEach(F=>F())}}),[]),N=x.useMemo(()=>({value:(F,R,I)=>{var V;R!==((V=i.current.get(F))==null?void 0:V.value)&&(i.current.set(F,{value:R,keywords:I}),n.current.filtered.items.set(F,O(R,I)),k(2,()=>{T(),E.emit()}))},item:(F,R)=>(r.current.add(F),R&&(s.current.has(R)?s.current.get(R).add(F):s.current.set(R,new Set([F]))),k(3,()=>{A(),T(),n.current.value||j(),E.emit()}),()=>{i.current.delete(F),r.current.delete(F),n.current.filtered.items.delete(F);let I=D();k(4,()=>{A(),(I==null?void 0:I.getAttribute("id"))===F&&j(),E.emit()})}),group:F=>(s.current.has(F)||s.current.set(F,new Set),()=>{i.current.delete(F),s.current.delete(F)}),filter:()=>l.current.shouldFilter,label:a||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:w,inputId:C,labelId:b,listInnerRef:S}),[]);function O(F,R){var I,V;let Y=(V=(I=l.current)==null?void 0:I.filter)!=null?V:yW;return F?Y(F,n.current.search,R):0}function T(){if(!n.current.search||l.current.shouldFilter===!1)return;let F=n.current.filtered.items,R=[];n.current.filtered.groups.forEach(V=>{let Y=s.current.get(V),G=0;Y.forEach(me=>{let we=F.get(me);G=Math.max(we,G)}),R.push([V,G])});let I=S.current;L().sort((V,Y)=>{var G,me;let we=V.getAttribute("id"),qe=Y.getAttribute("id");return((G=F.get(qe))!=null?G:0)-((me=F.get(we))!=null?me:0)}).forEach(V=>{let Y=V.closest(Ex);Y?Y.appendChild(V.parentElement===Y?V:V.closest(`${Ex} > *`)):I.appendChild(V.parentElement===I?V:V.closest(`${Ex} > *`))}),R.sort((V,Y)=>Y[1]-V[1]).forEach(V=>{var Y;let G=(Y=S.current)==null?void 0:Y.querySelector(`${Nc}[${Ma}="${encodeURIComponent(V[0])}"]`);G==null||G.parentElement.appendChild(G)})}function j(){let F=L().find(I=>I.getAttribute("aria-disabled")!=="true"),R=F==null?void 0:F.getAttribute(Ma);E.setState("value",R||void 0)}function A(){var F,R,I,V;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let Y=0;for(let G of r.current){let me=(R=(F=i.current.get(G))==null?void 0:F.value)!=null?R:"",we=(V=(I=i.current.get(G))==null?void 0:I.keywords)!=null?V:[],qe=O(me,we);n.current.filtered.items.set(G,qe),qe>0&&Y++}for(let[G,me]of s.current)for(let we of me)if(n.current.filtered.items.get(we)>0){n.current.filtered.groups.add(G);break}n.current.filtered.count=Y}function z(){var F,R,I;let V=D();V&&(((F=V.parentElement)==null?void 0:F.firstChild)===V&&((I=(R=V.closest(Nc))==null?void 0:R.querySelector(gW))==null||I.scrollIntoView({block:"nearest"})),V.scrollIntoView({block:"nearest"}))}function D(){var F;return(F=S.current)==null?void 0:F.querySelector(`${Q_}[aria-selected="true"]`)}function L(){var F;return Array.from(((F=S.current)==null?void 0:F.querySelectorAll(oN))||[])}function H(F){let R=L()[F];R&&E.setState("value",R.getAttribute(Ma))}function K(F){var R;let I=D(),V=L(),Y=V.findIndex(me=>me===I),G=V[Y+F];(R=l.current)!=null&&R.loop&&(G=Y+F<0?V[V.length-1]:Y+F===V.length?V[0]:V[Y+F]),G&&E.setState("value",G.getAttribute(Ma))}function _(F){let R=D(),I=R==null?void 0:R.closest(Nc),V;for(;I&&!V;)I=F>0?NW(I,Nc):TW(I,Nc),V=I==null?void 0:I.querySelector(oN);V?E.setState("value",V.getAttribute(Ma)):K(F)}let Q=()=>H(L().length-1),M=F=>{F.preventDefault(),F.metaKey?Q():F.altKey?_(1):K(1)},oe=F=>{F.preventDefault(),F.metaKey?H(0):F.altKey?_(-1):K(-1)};return x.createElement(Xo.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:F=>{var R;(R=y.onKeyDown)==null||R.call(y,F);let I=F.nativeEvent.isComposing||F.keyCode===229;if(!(F.defaultPrevented||I))switch(F.key){case"n":case"j":{v&&F.ctrlKey&&M(F);break}case"ArrowDown":{M(F);break}case"p":case"k":{v&&F.ctrlKey&&oe(F);break}case"ArrowUp":{oe(F);break}case"Home":{F.preventDefault(),H(0);break}case"End":{F.preventDefault(),Q();break}case"Enter":{F.preventDefault();let V=D();if(V){let Y=new Event(uw);V.dispatchEvent(Y)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:N.inputId,id:N.labelId,style:OW},a),Qg(e,F=>x.createElement(J_.Provider,{value:E},x.createElement(G_.Provider,{value:N},F))))}),xW=x.forwardRef((e,t)=>{var n,r;let s=ms(),i=x.useRef(null),o=x.useContext(Z_),l=_f(),a=X_(e),u=(r=(n=a.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;Gl(()=>{if(!u)return l.item(s,o==null?void 0:o.id)},[u]);let c=e2(s,i,[e.value,e.children,i],e.keywords),d=qk(),h=Vo(k=>k.value&&k.value===c.current),f=Vo(k=>u||l.filter()===!1?!0:k.search?k.filtered.items.get(s)>0:!0);x.useEffect(()=>{let k=i.current;if(!(!k||e.disabled))return k.addEventListener(uw,m),()=>k.removeEventListener(uw,m)},[f,e.onSelect,e.disabled]);function m(){var k,E;g(),(E=(k=a.current).onSelect)==null||E.call(k,c.current)}function g(){d.setState("value",c.current,!0)}if(!f)return null;let{disabled:v,value:y,onSelect:w,forceMount:b,keywords:C,...S}=e;return x.createElement(Xo.div,{ref:Fo(i,t),...S,id:s,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!h,"data-disabled":!!v,"data-selected":!!h,onPointerMove:v||l.getDisablePointerSelection()?void 0:g,onClick:v?void 0:m},e.children)}),vW=x.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...i}=e,o=ms(),l=x.useRef(null),a=x.useRef(null),u=ms(),c=_f(),d=Vo(f=>s||c.filter()===!1?!0:f.search?f.filtered.groups.has(o):!0);Gl(()=>c.group(o),[]),e2(o,l,[e.value,e.heading,a]);let h=x.useMemo(()=>({id:o,forceMount:s}),[s]);return x.createElement(Xo.div,{ref:Fo(l,t),...i,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},n&&x.createElement("div",{ref:a,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),Qg(e,f=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},x.createElement(Z_.Provider,{value:h},f))))}),wW=x.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=x.useRef(null),i=Vo(o=>!o.search);return!n&&!i?null:x.createElement(Xo.div,{ref:Fo(s,t),...r,"cmdk-separator":"",role:"separator"})}),bW=x.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,i=qk(),o=Vo(u=>u.search),l=Vo(u=>u.selectedItemId),a=_f();return x.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),x.createElement(Xo.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":a.listId,"aria-labelledby":a.labelId,"aria-activedescendant":l,id:a.inputId,type:"text",value:s?e.value:o,onChange:u=>{s||i.setState("search",u.target.value),n==null||n(u.target.value)}})}),kW=x.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,i=x.useRef(null),o=x.useRef(null),l=Vo(u=>u.selectedItemId),a=_f();return x.useEffect(()=>{if(o.current&&i.current){let u=o.current,c=i.current,d,h=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{let f=u.offsetHeight;c.style.setProperty("--cmdk-list-height",f.toFixed(1)+"px")})});return h.observe(u),()=>{cancelAnimationFrame(d),h.unobserve(u)}}},[]),x.createElement(Xo.div,{ref:Fo(i,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:a.listId},Qg(e,u=>x.createElement("div",{ref:Fo(o,a.listInnerRef),"cmdk-list-sizer":""},u)))}),SW=x.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:o,...l}=e;return x.createElement(H_,{open:n,onOpenChange:r},x.createElement(U_,{container:o},x.createElement(Hk,{"cmdk-overlay":"",className:s}),x.createElement(Uk,{"aria-label":e.label,"cmdk-dialog":"",className:i},x.createElement(Y_,{ref:t,...l}))))}),CW=x.forwardRef((e,t)=>Vo(n=>n.filtered.count===0)?x.createElement(Xo.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),EW=x.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...i}=e;return x.createElement(Xo.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Qg(e,o=>x.createElement("div",{"aria-hidden":!0},o)))}),or=Object.assign(Y_,{List:kW,Item:xW,Input:bW,Group:vW,Separator:wW,Dialog:SW,Empty:CW,Loading:EW});function NW(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function TW(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function X_(e){let t=x.useRef(e);return Gl(()=>{t.current=e}),t}var Gl=typeof window>"u"?x.useEffect:x.useLayoutEffect;function Oa(e){let t=x.useRef();return t.current===void 0&&(t.current=e()),t}function Vo(e){let t=qk(),n=()=>e(t.snapshot());return x.useSyncExternalStore(t.subscribe,n,n)}function e2(e,t,n,r=[]){let s=x.useRef(),i=_f();return Gl(()=>{var o;let l=(()=>{var u;for(let c of n){if(typeof c=="string")return c.trim();if(typeof c=="object"&&"current"in c)return c.current?(u=c.current.textContent)==null?void 0:u.trim():s.current}})(),a=r.map(u=>u.trim());i.value(e,l,a),(o=t.current)==null||o.setAttribute(Ma,l),s.current=l}),s}var RW=()=>{let[e,t]=x.useState(),n=Oa(()=>new Map);return Gl(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function MW(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Qg({asChild:e,children:t},n){return e&&x.isValidElement(t)?x.cloneElement(MW(t),{ref:t.ref},n(t.props.children)):n(t)}var OW={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const el=H_,jW=U_,t2=x.forwardRef(({className:e,...t},n)=>p.jsx(Hk,{ref:n,className:mt("fixed inset-0 z-40 bg-black/40 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));t2.displayName=Hk.displayName;const Ii=x.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(jW,{children:[p.jsx(t2,{}),p.jsxs(Uk,{ref:r,className:mt("fixed left-[50%] top-[50%] z-50 w-full max-w-lg translate-x-[-50%] translate-y-[-50%] rounded-lg border border-border bg-card p-4 shadow-xl outline-none",e),...n,children:[t,p.jsxs(oW,{className:"absolute right-3 top-3 rounded-sm text-muted-foreground transition-opacity hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[p.jsx(Gr,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ii.displayName=Uk.displayName;const tl=({className:e,...t})=>p.jsx("div",{className:mt("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});tl.displayName="DialogHeader";const nl=x.forwardRef(({className:e,...t},n)=>p.jsx(q_,{ref:n,className:mt("text-lg font-semibold leading-none tracking-tight",e),...t}));nl.displayName=q_.displayName;const If=x.forwardRef(({className:e,...t},n)=>p.jsx(W_,{ref:n,className:mt("text-sm text-muted-foreground",e),...t}));If.displayName=W_.displayName;const n2=x.forwardRef(({className:e,...t},n)=>p.jsx(or,{ref:n,className:mt("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));n2.displayName=or.displayName;const PW=({children:e,...t})=>p.jsx(el,{...t,children:p.jsx(Ii,{className:"overflow-hidden p-0 shadow-2xl",children:p.jsx(n2,{loop:!0,className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]]:border-b [&_[cmdk-input-wrapper]]:border-border [&_[cmdk-input]]:h-11 [&_[cmdk-input]]:px-2 [&_[cmdk-input]]:text-sm [&_[cmdk-input]]:outline-none [&_[cmdk-item]]:flex [&_[cmdk-item]]:cursor-default [&_[cmdk-item]]:select-none [&_[cmdk-item]]:items-center [&_[cmdk-item]]:justify-between [&_[cmdk-item]]:rounded-md [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-2 [&_[cmdk-item]]:text-sm [&_[cmdk-item]]:outline-none [&_[cmdk-item][data-disabled=true]]:opacity-50 [&_[cmdk-item][data-selected=true]]:bg-accent [&_[cmdk-item][data-selected=true]]:text-accent-foreground",children:e})})}),r2=x.forwardRef(({className:e,...t},n)=>p.jsxs("div",{className:"flex items-center gap-2 px-3","cmdk-input-wrapper":"",children:[p.jsx(Ok,{className:"h-4 w-4 text-muted-foreground"}),p.jsx(or.Input,{ref:n,className:mt("flex h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",e),...t})]}));r2.displayName=or.Input.displayName;const s2=x.forwardRef(({className:e,...t},n)=>p.jsx(or.List,{ref:n,className:mt("max-h-[360px] overflow-y-auto overflow-x-hidden",e),...t}));s2.displayName=or.List.displayName;const i2=x.forwardRef((e,t)=>p.jsx(or.Empty,{ref:t,className:"py-6 text-center text-sm text-muted-foreground",...e}));i2.displayName=or.Empty.displayName;const ja=x.forwardRef(({className:e,...t},n)=>p.jsx(or.Group,{ref:n,className:mt("overflow-hidden p-1 text-foreground",e),...t}));ja.displayName=or.Group.displayName;const pp=x.forwardRef(({className:e,...t},n)=>p.jsx(or.Separator,{ref:n,className:mt("-mx-1 h-px bg-border",e),...t}));pp.displayName=or.Separator.displayName;const Pa=x.forwardRef(({className:e,...t},n)=>p.jsx(or.Item,{ref:n,className:mt("relative flex cursor-default select-none items-center",e),...t}));Pa.displayName=or.Item.displayName;const Nx=e=>e.displayName??e.name,AW=e=>e==="project"?p.jsx(im,{className:"h-4 w-4 text-muted-foreground"}):e==="document"?p.jsx(ua,{className:"h-4 w-4 text-muted-foreground"}):p.jsx(FA,{className:"h-4 w-4 text-muted-foreground"}),_W=()=>{const{docs:e}=u_(),{recentItems:t,trackItem:n,removeItem:r}=b9(),{open:s,onOpenChange:i,activeDoc:o,commands:l,onSelectDoc:a,onRunCommand:u}=f_(),{projects:c,activeProject:d,setActiveProjectId:h}=Ht(),f=l.filter(b=>b.scope==="doc"),m=l.filter(b=>b.scope==="global"),g=b=>{const C=c.find(S=>S.id===b);C&&n("project",C.id,C.name,C.emoji??void 0),i(!1),h(b)},v=b=>{n("document",b.name,Nx(b)),a(b)},y=b=>{n("command",b.id,b.label),u(b)},w=b=>{if(b.type==="project")g(b.id);else if(b.type==="document"){const C=e.find(S=>S.name===b.id);C&&v(C)}else{const C=l.find(S=>S.id===b.id);C&&y(C)}};return p.jsxs(PW,{open:s,onOpenChange:i,children:[p.jsx(r2,{placeholder:"Search docs, projects, or commands..."}),p.jsxs(s2,{children:[p.jsx(i2,{children:"No matches found."}),t.length>0?p.jsxs(p.Fragment,{children:[p.jsx(ja,{heading:"Recent",children:t.map(b=>p.jsx(Pa,{value:`recent ${b.label} ${b.id}`,onSelect:()=>w(b),children:p.jsxs("span",{className:"flex w-full items-center gap-2",children:[b.emoji?p.jsx("span",{children:b.emoji}):AW(b.type),p.jsx("span",{className:"flex-1",children:b.label}),p.jsx("button",{type:"button",className:"ml-auto rounded p-0.5 text-muted-foreground hover:text-foreground",onClick:C=>{C.stopPropagation(),r(b.type,b.id)},"aria-label":`Remove ${b.label} from recents`,children:p.jsx(Gr,{className:"h-3 w-3"})})]})},`recent-${b.type}-${b.id}`))}),p.jsx(pp,{})]}):null,c.length>0?p.jsx(ja,{heading:"Projects",children:c.map(b=>p.jsx(Pa,{value:`project ${b.name} ${b.id}`,onSelect:()=>g(b.id),children:p.jsxs("span",{className:"flex items-center gap-2",children:[b.emoji?p.jsx("span",{children:b.emoji}):p.jsx(im,{className:"h-4 w-4 text-muted-foreground"}),p.jsx("span",{children:b.name}),b.id===(d==null?void 0:d.id)?p.jsx("span",{className:"text-xs text-muted-foreground",children:"(active)"}):null]})},b.id))}):null,c.length>0&&e.length>0?p.jsx(pp,{}):null,e.length>0?p.jsx(ja,{heading:"Documents",children:e.map(b=>p.jsx(Pa,{value:`${Nx(b)} ${b.name}`,onSelect:()=>v(b),children:p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(ua,{className:"h-4 w-4 text-muted-foreground"}),p.jsxs("span",{className:"flex flex-col",children:[p.jsx("span",{children:Nx(b)}),p.jsx("span",{className:"text-xs text-muted-foreground",children:b.name})]})]})},b.name))}):null,(e.length>0||c.length>0)&&(f.length>0||m.length>0)?p.jsx(pp,{}):null,f.length>0?p.jsx(ja,{heading:"Document commands",children:f.map(b=>p.jsxs(Pa,{value:`${b.label} ${(b.keywords??[]).join(" ")}`,onSelect:()=>y(b),disabled:!o,children:[p.jsxs("span",{className:"flex flex-1 items-center gap-2",children:[p.jsx(BA,{className:"h-4 w-4 text-muted-foreground"}),p.jsx("span",{children:b.label})]}),b.shortcut?p.jsx("kbd",{className:"ml-auto rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:rw(b.shortcut)}):o?null:p.jsx("span",{className:"text-xs text-muted-foreground",children:"Select a document first"})]},b.id))}):null,m.length>0?p.jsx(ja,{heading:"Global commands",children:m.map(b=>p.jsxs(Pa,{value:`${b.label} ${(b.keywords??[]).join(" ")}`,onSelect:()=>y(b),children:[p.jsxs("span",{className:"flex flex-1 items-center gap-2",children:[p.jsx(FA,{className:"h-4 w-4 text-muted-foreground"}),p.jsx("span",{children:b.label})]}),b.shortcut?p.jsx("kbd",{className:"ml-auto rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:rw(b.shortcut)}):null]},b.id))}):null]})]})},IW=({filePath:e})=>{var i;const{activeProject:t}=Ht(),n=(t==null?void 0:t.id)??"",r=nt.code.get.useQuery({projectId:n,path:e},{enabled:!!t}),s=e.includes("/")?e.slice(e.lastIndexOf("/")+1):e;return p.jsxs("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden p-4",children:[p.jsxs("div",{className:"mb-3 flex items-center gap-2 text-muted-foreground",children:[p.jsx(Mk,{className:"h-4 w-4"}),p.jsx("span",{className:"font-mono text-sm",children:e})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-auto rounded-md border border-border bg-muted/30",children:r.isLoading?p.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"}):r.error?p.jsxs("div",{className:"p-4 text-sm text-destructive",children:["Failed to load ",s]}):p.jsx("pre",{className:"p-4 font-mono text-sm leading-relaxed",children:p.jsx("code",{children:(i=r.data)==null?void 0:i.content})})})]})},lN=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,aN=GA,DW=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return aN(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(u=>{const c=n==null?void 0:n[u],d=i==null?void 0:i[u];if(c===null)return null;const h=lN(c)||lN(d);return s[u][h]}),l=n&&Object.entries(n).reduce((u,c)=>{let[d,h]=c;return h===void 0||(u[d]=h),u},{}),a=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,c)=>{let{class:d,className:h,...f}=c;return Object.entries(f).every(m=>{let[g,v]=m;return Array.isArray(v)?v.includes({...i,...l}[g]):{...i,...l}[g]===v})?[...u,d,h]:u},[]);return aN(e,o,a,n==null?void 0:n.class,n==null?void 0:n.className)},LW=DW("inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium transition-colors focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"border border-primary bg-primary text-primary-foreground hover:bg-primary/90",secondary:"border border-border bg-transparent text-foreground hover:bg-accent",muted:"bg-muted text-muted-foreground hover:bg-muted/70",outline:"border border-primary bg-background text-primary hover:bg-accent hover:text-accent-foreground",ghost:"bg-transparent text-foreground hover:text-foreground"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3 text-xs",xs:"h-6 px-2 text-xs",icon:"h-8 w-8"}},defaultVariants:{variant:"default",size:"default"}}),ae=x.forwardRef(({className:e,variant:t,size:n,...r},s)=>p.jsx("button",{className:mt(LW({variant:t,size:n,className:e})),ref:s,...r}));ae.displayName="Button";const o2=x.createContext(null),$W=o2.Provider,Tr=()=>{const e=x.useContext(o2);if(!e)throw new Error("useAppStateContext must be used within AppStateProvider.");return e},l2=x.createContext(null),zW=l2.Provider,a2=()=>{const e=x.useContext(l2);if(!e)throw new Error("useCreateDocDialogContext must be used within CreateDocDialogProvider.");return e},u2=()=>{const{activeProject:e}=Ht(),t=nt.useUtils(),n=nt.tags.list.useQuery({projectId:(e==null?void 0:e.id)??""},{enabled:!!e,refetchInterval:1e4,refetchOnWindowFocus:!1}),r=x.useMemo(()=>{var l;const o=((l=n.data)==null?void 0:l.tags)??[];return[...new Set(o)].sort()},[n.data]),s=x.useMemo(()=>n.error?String(n.error):"",[n.error]),i=x.useCallback(()=>{t.tags.list.invalidate({projectId:(e==null?void 0:e.id)??""}).catch(()=>{})},[t,e==null?void 0:e.id]);return{tags:r,errorMessage:s,invalidateTags:i}},FW=()=>{const{dialogs:{createDoc:e}}=Tr(),{open:t,setOpen:n,docType:r,folder:s}=a2(),{tags:i}=u2(),[o,l]=x.useState(""),[a,u]=x.useState([]),[c,d]=x.useState(""),[h,f]=x.useState(""),[m,g]=x.useState("");x.useEffect(()=>{t&&(l(""),u([]),d(""),f(""),g(""))},[t]);const v=x.useMemo(()=>{const S=o.trim();if(!S)return"";const k=T=>T.toLowerCase().replace(/[\s_]+/g,"-").replace(/-{2,}/g,"-").replace(/^-|-$/g,""),E=S.toLowerCase();let N=S;const O=[".tasks.json",".app.json",".table.json",".prompt.yaml",".yaml",".json",".md"];for(const T of O)if(E.endsWith(T)){N=S.slice(0,S.length-T.length);break}return r==="app"?`${k(N)}.app.json`:r==="prompt"?`${k(N)}.prompt.yaml`:r==="json"?`${k(N)}.table.json`:`${k(N)}.md`},[r,o]),y=x.useMemo(()=>{const S=new Set([...i,...a]);return Array.from(S).sort()},[i,a]),w=S=>{const k=S.trim().toLowerCase();return!k||!/^[a-z]+$/.test(k)?"":k},b=S=>{u(k=>k.includes(S)?k.filter(E=>E!==S):[...k,S].sort())},C=()=>{const S=w(c);if(!S){f("Tags must be lowercase letters only.");return}u(k=>k.includes(S)?k:[...k,S].sort()),d(""),f("")};return t?p.jsx("div",{className:"fixed inset-0 z-30 flex items-center justify-center bg-black/40 p-4",children:p.jsxs("div",{className:"w-full max-w-md rounded-lg border border-border bg-card p-5 shadow-xl",children:[p.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[p.jsx("h3",{className:"text-base font-semibold",children:r==="json"?"New Data Table":r==="app"?"New React App":r==="prompt"?"New Prompt":r==="tasks"?"New Task Board":"New Markdown Document"}),p.jsx("button",{type:"button",className:"text-sm text-muted-foreground hover:text-foreground",onClick:()=>n(!1),children:"Close"})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[p.jsx("span",{className:"text-muted-foreground",children:"Name"}),p.jsx("input",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:o,onChange:S=>{const k=S.target.value.replace(/[^a-zA-Z\s-]/g,"").replace(/ {2,}/g," ");if(!k)return l("");l(k.charAt(0).toUpperCase()+k.slice(1).toLowerCase())},placeholder:"Quarterly plan"})]}),p.jsxs("div",{className:"text-sm text-muted-foreground",children:["Type:"," ",p.jsx("span",{className:"font-medium text-foreground",children:r==="json"?"Data table":r==="app"?"React app":r==="prompt"?"Prompt":"Markdown document"})]}),p.jsxs("div",{className:"text-xs text-muted-foreground",children:["File name:"," ",p.jsx("span",{className:"font-mono text-foreground",children:v||"—"})]}),p.jsxs("div",{className:"flex flex-col gap-2 text-sm",children:[p.jsx("span",{className:"text-muted-foreground",children:"Tags"}),r==="markdown"?p.jsxs(p.Fragment,{children:[y.length>0?p.jsx("div",{className:"flex flex-wrap gap-2",children:y.map(S=>p.jsxs("label",{className:`flex items-center gap-1 rounded-full border px-2 py-1 text-xs ${a.includes(S)?"border-primary bg-primary/10 text-primary":"border-border bg-muted text-muted-foreground"}`,children:[p.jsx("input",{type:"checkbox",className:"hidden",checked:a.includes(S),onChange:()=>b(S)}),p.jsx("span",{children:S})]},S))}):p.jsx("div",{className:"text-xs text-muted-foreground",children:"No tags yet."}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{className:"h-8 w-full rounded-md border border-input bg-background px-2 text-xs focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:c,onChange:S=>{d(S.target.value),h&&f("")},placeholder:"Add a tag"}),p.jsx(ae,{type:"button",size:"sm",variant:"outline",onClick:C,disabled:!c.trim(),children:"Add"})]})]}):p.jsx("div",{className:"text-xs text-muted-foreground",children:"Tags are only available for Markdown docs."}),h?p.jsx("div",{className:"text-xs text-destructive",children:h}):null]}),m?p.jsx("div",{className:"text-sm text-destructive",children:m}):null]}),p.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[p.jsx(ae,{type:"button",variant:"ghost",onClick:()=>n(!1),children:"Cancel"}),p.jsx(ae,{type:"button",onClick:()=>{g(""),e({title:o,type:r,tags:a,folder:s}).then(()=>n(!1)).catch(S=>g(String(S)))},children:"Create"})]})]})}):null};var BW=Object.defineProperty,VW=(e,t)=>{for(var n in t)BW(e,n,{get:t[n],enumerable:!0})},pl={};VW(pl,{ActiveEmoji:()=>j2,Empty:()=>O2,List:()=>T2,Loading:()=>M2,Root:()=>w2,Search:()=>b2,SkinTone:()=>P2,SkinToneSelector:()=>R2,Viewport:()=>k2});var c2="'Apple Color Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', 'Android Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', EmojiSymbols, sans-serif",Wk=["none","light","medium-light","medium","medium-dark","dark"];function Tx(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Yr=2,kn=null;function uN(e){try{kn??(kn=document.createElement("canvas").getContext("2d",{willReadFrequently:!0}))}catch{}if(!kn||(queueMicrotask(()=>{kn&&(kn=null)}),kn.canvas.width=Yr,kn.canvas.height=Yr,kn.font=`2px ${c2}`,kn.textBaseline="middle",kn.measureText(e).width>=Yr*2))return!1;kn.fillStyle="#00f",kn.fillText(e,0,0);let t=kn.getImageData(0,0,Yr,Yr).data;kn.clearRect(0,0,Yr,Yr),kn.fillStyle="#f00",kn.fillText(e,0,0);let n=kn.getImageData(0,0,Yr,Yr).data;for(let r=0;r<Yr*Yr*4;r+=4)if(t[r]!==n[r]||t[r+1]!==n[r+1]||t[r+2]!==n[r+2])return!1;return!0}function cN(e,t,n){try{let r=e.getItem(t);if(!r)throw new Error(`No value found for "${t}".`);let s=JSON.parse(r);return n(s)}catch{return null}}function d2(e,t,n){e.setItem(t,JSON.stringify(n))}function dN(e){return t=>t===void 0?void 0:e(t)}function fN(e){return t=>t===null?null:e(t)}function ln(e){if(typeof e!="string")throw new Error;return e}function mp(e){if(typeof e!="number")throw new Error;return e}function f2(e){if(typeof e!="boolean")throw new Error;return e}function Ui(e){return t=>{if(typeof t!="object"||t===null)throw new Error;let n={};for(let r in e){let s=t[r];s===void 0&&e[r](void 0),n[r]=e[r](s)}return n}}function Rx(e){return t=>{if(!Array.isArray(t))throw new Error;return t.length>0&&e(t[0]),t}}var h2=(e,t)=>`${e}/${t}/data.json`,p2=(e,t)=>`${e}/${t}/messages.json`,HW=["bn","da","de","en-gb","en","es-mx","es","et","fi","fr","hi","hu","it","ja","ko","lt","ms","nb","nl","pl","pt","ru","sv","th","uk","vi","zh-hant","zh"],hN="en",m2=e=>`frimousse/data/${e}`,pN="frimousse/metadata";async function mN(e,t){try{return(await fetch(e,{method:"HEAD",signal:t})).headers.get("etag")}catch{return null}}async function UW(e,t,n){let[{emojis:r,emojisEtag:s},{messages:i,messagesEtag:o}]=await Promise.all([fetch(h2(e,t),{signal:n}).then(async l=>({emojis:await l.json(),emojisEtag:l.headers.get("etag")})),fetch(p2(e,t),{signal:n}).then(async l=>({messages:await l.json(),messagesEtag:l.headers.get("etag")}))]);return{emojis:r,messages:i,emojisEtag:s,messagesEtag:o}}async function qW(e,t,n){let[r,s]=await Promise.all([mN(h2(e,t),n),mN(p2(e,t),n)]);return{emojisEtag:r,messagesEtag:s}}function WW(e){return e.skins?e.skins.filter(t=>typeof t.tone=="number").reduce((t,n)=>{let r=Wk[n.tone];return t[r]=n.emoji,t},{}):void 0}async function gN(e,t,n){let{emojis:r,emojisEtag:s,messages:i,messagesEtag:o}=await UW(e,t,n),l=i.subgroups.find(m=>m.key==="country-flag"||m.key==="subdivision-flag"),a=i.groups.filter(m=>m.key!=="component"),u=r.filter(m=>"group"in m),c=a.map(m=>({index:m.order,label:Tx(m.message)})),d=i.skinTones.reduce((m,g)=>(m[g.key]=Tx(g.message),m),{}),h=u.map(m=>({emoji:m.emoji,category:m.group,version:m.version,label:Tx(m.label),tags:m.tags??[],countryFlag:l&&m.subgroup===l.order||void 0,skins:WW(m)})),f={locale:t,emojis:h,categories:c,skinTones:d};return d2(localStorage,m2(t),{data:f,metadata:{emojisEtag:s,messagesEtag:o}}),f}function KW(e,t){let n=new Map;for(let o of e)n.has(o.version)||n.set(o.version,o.emoji);let r=[...n.keys()].sort((o,l)=>l-o),s=r[0]??0,i=uN("🇪🇺");if(typeof t=="number")return{emojiVersion:t,countryFlags:i};for(let o of r){let l=n.get(o);if(uN(l))return{emojiVersion:o,countryFlags:i}}return{emojiVersion:s,countryFlags:i}}var QW=Ui({emojiVersion:mp,countryFlags:f2}),GW=Ui({data:Ui({locale:ln,emojis:Rx(Ui({emoji:ln,category:mp,label:ln,version:mp,tags:Rx(ln),countryFlag:dN(f2),skins:dN(Ui({light:ln,"medium-light":ln,medium:ln,"medium-dark":ln,dark:ln}))})),categories:Rx(Ui({index:mp,label:ln})),skinTones:Ui({light:ln,"medium-light":ln,medium:ln,"medium-dark":ln,dark:ln})}),metadata:Ui({emojisEtag:fN(ln),messagesEtag:fN(ln)})});async function JW({locale:e,emojiVersion:t,emojibaseUrl:n,signal:r}){let s=typeof n=="string"?n:`https://cdn.jsdelivr.net/npm/emojibase-data@${typeof t=="number"?Math.floor(t):"latest"}`,i=cN(sessionStorage,pN,QW),o=cN(localStorage,m2(e),GW),l;if(!o)l=await gN(s,e,r);else if(i)l=o.data;else try{let{emojisEtag:u,messagesEtag:c}=await qW(s,e,r);l=!u||!c||u!==o.metadata.emojisEtag||c!==o.metadata.messagesEtag?await gN(s,e,r):o.data}catch{l=o.data}i??(i=KW(l.emojis,t)),d2(sessionStorage,pN,i);let a=l.emojis.filter(u=>{let c=u.version<=i.emojiVersion;return u.countryFlag?c&&i.countryFlags:c});return{locale:e,emojis:a,categories:l.categories,skinTones:l.skinTones}}function yN(e){return HW.includes(e)?e:(console.warn(`Locale "${e}" is not supported, using "${hN}" instead.`),hN)}function xN(e){return Wk.includes(e)?e:(console.warn(`Skin tone "${e}" is not valid, using "none" instead.`),"none")}function ZW(e,t){let n=[];if(t<=0)return n;for(let r=0,s=e.length;r<s;r+=t)n.push(e.slice(r,r+t));return n}function YW(e,t){if(!t)return e;let n=t.toLowerCase().trim(),r=new WeakMap;return e.filter(s=>{let i=0;s.label.toLowerCase().includes(n)&&(i+=10);for(let o of s.tags)o.toLowerCase().includes(n)&&(i+=1);return i>0?(r.set(s,i),!0):!1}).sort((s,i)=>(r.get(i)??0)-(r.get(s)??0))}function XW(e,t,n,r){let s=YW(e.emojis,r),i=[],o=[],l=[],a={},u=0,c=0;for(let d of s)a[d.category]||(a[d.category]=[]),a[d.category].push({emoji:n&&n!=="none"&&d.skins?d.skins[n]:d.emoji,label:d.label});for(let d of e.categories){let h=a[d.index];if(!h||h.length===0)continue;let f=ZW(Array.from(h),t).map(m=>({categoryIndex:u,emojis:m}));i.push(...f),o.push({label:d.label,rowsCount:f.length,startRowIndex:c}),l.push(c),u++,c+=f.length}return{count:s.length,categories:o,categoriesStartRowIndices:l,rows:i,skinTones:e.skinTones}}function e8(e){let t={},n=null,r=null,s=new Set,i=()=>{if(n){t=n,n=null;for(let u of s)u(t)}r=null},o=()=>n??t,l=u=>{n??(n=t),Object.assign(n,typeof u=="function"?u(o()):u),r||(r=requestAnimationFrame(i))},a=u=>(s.add(u),()=>s.delete(u));return t=e(l,o),{get:o,set:l,subscribe:a}}function t8(e){let[t]=x.useState(e);return t}function n8(e){let t=x.createContext(null);return{useStore:()=>{let n=x.useContext(t);if(!n)throw new Error(e);return n},Provider:({store:n,children:r})=>p.jsx(t.Provider,{value:n,children:r})}}function br(e,t,n=Object.is){let[r,s]=x.useState(()=>t(e.get()));return x.useEffect(()=>e.subscribe(()=>{let i=t(e.get());s(o=>n(o,i)?o:i)}),[e,t,n]),x.useDebugValue(r),r}function zs(e,t,n){let r=x.useCallback(s=>s[t],[t]);return br(e,r,n)}var vN=2;function r8(e,t,n,r,s){let i=0;return e8((o,l)=>({locale:t,columns:n,sticky:r,skinTone:s,onEmojiSelect:e,data:null,search:"",interaction:"none",activeColumnIndex:0,activeRowIndex:0,rowHeight:null,categoryHeaderHeight:null,viewportWidth:null,viewportHeight:null,viewportCurrentCategoryIndex:null,viewportStartCategoryIndex:0,viewportStartRowIndex:0,viewportEndRowIndex:0,rootRef:null,searchRef:null,viewportRef:null,listRef:null,updateViewportState:a=>{var N;let u=l(),c=(a==null?void 0:a.data)??u.data,d=(a==null?void 0:a.categoryHeaderHeight)??u.categoryHeaderHeight,h=(a==null?void 0:a.rowHeight)??u.rowHeight,f=(a==null?void 0:a.viewportHeight)??u.viewportHeight;if(!c||c.rows.length===0||!d||!h||!f)return o({...a,viewportStartCategoryIndex:0,viewportStartRowIndex:0,viewportEndRowIndex:0});let m=0,g=0;for(let O of c.categories)if(g++*d+O.startRowIndex*h<i)m+=d;else break;let v=c.categories.length*d+c.rows.length*h,y=Math.floor(vN*h/2),w=Math.ceil(vN*h/2),b=Math.min(i-m-y,v-f),C=b+f+w,S=Math.max(0,Math.floor(b/h)),k=Math.min(c.rows.length-1,Math.ceil(C/h)),E=(N=c.rows[S])==null?void 0:N.categoryIndex;return o(E===void 0&&a?a:{...a,viewportStartCategoryIndex:E,viewportStartRowIndex:S,viewportEndRowIndex:k})},onDataChange:a=>{l().updateViewportState({data:a,activeColumnIndex:0,activeRowIndex:0})},onSearchChange:a=>{o({search:a,interaction:a?"keyboard":"none"})},onActiveEmojiChange:(a,u,c)=>{if(o({interaction:a,activeColumnIndex:u,activeRowIndex:c}),a!=="keyboard")return;let{listRef:d,viewportRef:h,sticky:f,rowHeight:m,viewportHeight:g,categoryHeaderHeight:v}=l(),y=d==null?void 0:d.current,w=h==null?void 0:h.current;if(!y||!w||!m||!v||!g)return;let b=c;b===0&&w.scrollTo({top:0,behavior:"instant"});let C=y.querySelector(`[aria-rowindex="${b}"]`);if(!(C instanceof HTMLElement))return;let S=C.offsetTop,k=getComputedStyle(C),E=Number.parseFloat(k.scrollMarginTop),N=Number.parseFloat(k.scrollMarginBottom),O=i+E;f&&S<i+g/2&&(O+=v);let T=O+g-N;(S<O||S+m>T)&&w.scrollTo({top:Math.max(S<O+v?S-Math.max(f?v:0,E):S-g+m+N,0),behavior:"instant"})},onActiveEmojiReset:()=>{o({interaction:"none",activeColumnIndex:0,activeRowIndex:0})},onRowHeightChange:a=>{l().updateViewportState({rowHeight:a})},onCategoryHeaderHeightChange:a=>{l().updateViewportState({categoryHeaderHeight:a})},onViewportSizeChange:(a,u)=>{l().updateViewportState({viewportWidth:a,viewportHeight:u})},onViewportScroll:a=>{i=a,l().updateViewportState()}}))}var{useStore:lr,Provider:s8}=n8("EmojiPicker.Root is missing.");function i8(e){return e.search}function Kk(e){var t,n;return e.interaction==="none"||(n=(t=e.data)==null?void 0:t.rows[e.activeRowIndex])==null?void 0:n.emojis[e.activeColumnIndex]}function o8(e){var t;return e.data===void 0||typeof((t=e.data)==null?void 0:t.count)=="number"&&e.data.count===0}function l8(e){return e.data===null||e.viewportHeight===null||e.rowHeight===null||e.categoryHeaderHeight===null}function g2(e){var t;return(t=e.data)==null?void 0:t.rows.length}function a8(e){var t;return(t=e.data)==null?void 0:t.categories.length}function u8(e){var t;return(t=e.data)==null?void 0:t.categoriesStartRowIndices}function c8(e){var t;return(t=e.data)==null?void 0:t.skinTones}function y2(e,t){return(e==null?void 0:e.emoji)===(t==null?void 0:t.emoji)}function d8(e,t){return(e==null?void 0:e.categoryIndex)!==(t==null?void 0:t.categoryIndex)||(e==null?void 0:e.emojis.length)!==(t==null?void 0:t.emojis.length)?!1:!!(e!=null&&e.emojis.every((n,r)=>y2(n,t==null?void 0:t.emojis[r])))}var Tc="",wN=new RegExp("\\p{Emoji_Modifier_Base}","u"),f8=/\uFE0F$/,h8=/\u{1F3FB}|\u{1F3FC}|\u{1F3FD}|\u{1F3FE}|\u{1F3FF}/gu,p8={light:"🏻","medium-light":"🏼",medium:"🏽","medium-dark":"🏾",dark:"🏿"};function m8(e,t){if(!e.split(Tc).some(r=>wN.test(r)))return e;let n=e.split(Tc).map(r=>r.replace(h8,"")).join(Tc);return t==="none"?n:n.split(Tc).map((r,s,i)=>{let o=i.length>1;return!wN.test(r)||o&&r==="🤝"?r:r.replace(f8,"")+p8[t]}).join(Tc)}function g8(e){return Wk.map(t=>({skinTone:t,emoji:m8(e,t)}))}function x2(){let e=lr(),t=br(e,Kk,y2);return x.useDeferredValue(t)}function v2(e="✋"){let t=lr(),n=zs(t,"skinTone"),r=x.useMemo(()=>g8(e),[e]),s=x.useCallback(i=>{t.set({skinTone:i})},[]);return[n,s,r]}function Qk(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)!==Array.isArray(t))return!1;let n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(s=>s in t&&e[s]===t[s])}function y8(...e){}function x8(e,t){let n=null;if(typeof window.requestIdleCallback=="function")n=window.requestIdleCallback(e,t);else{let r=Date.now();n=window.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,(t==null?void 0:t.timeout)-(Date.now()-r))})},10)}return()=>{typeof window.cancelIdleCallback=="function"?window.cancelIdleCallback(n):window.clearTimeout(n)}}var ls=typeof window<"u"?x.useLayoutEffect:x.useEffect;function v8(e){let t=x.useRef(e);return ls(()=>{t.current=e}),x.useCallback((...n)=>t.current(...n),[])}function w8({emojiVersion:e,emojibaseUrl:t}){let[n,r]=x.useState(void 0),s=lr(),i=zs(s,"locale"),o=zs(s,"columns"),l=zs(s,"skinTone"),a=zs(s,"search");return x.useEffect(()=>{let u=new AbortController,c=u.signal;return JW({locale:i,emojiVersion:e,emojibaseUrl:t,signal:c}).then(d=>{r(d)}).catch(d=>{c.aborted||console.error(d)}),()=>{u.abort()}},[e,t,i]),x.useEffect(()=>{if(n)return x8(()=>{s.get().onDataChange(XW(n,o,l,a))},{timeout:100})},[n,o,l,a]),null}var w2=x.forwardRef(({locale:e="en",columns:t=9,skinTone:n="none",onEmojiSelect:r=y8,emojiVersion:s,emojibaseUrl:i,onFocusCapture:o,onBlurCapture:l,children:a,style:u,sticky:c=!0,...d},h)=>{let f=v8(r),m=t8(()=>r8(f,yN(e),t,c,xN(n))),[g,v]=x.useState(!1),y=x.useRef(null),w=x.useCallback(S=>{S&&(y.current=S,m.set({rootRef:y}))},[]);ls(()=>{m.set({locale:yN(e)})},[e]),ls(()=>{m.set({columns:t})},[t]),ls(()=>{m.set({sticky:c})},[c]),ls(()=>{m.set({skinTone:xN(n)})},[n]);let b=x.useCallback(S=>{o==null||o(S);let{searchRef:k,viewportRef:E}=m.get(),N=S.target===(k==null?void 0:k.current)||S.target.hasAttribute("frimousse-search"),O=S.target===(E==null?void 0:E.current)||S.target.hasAttribute("frimousse-viewport");S.isDefaultPrevented()||(v(N||O),S.isDefaultPrevented()||(v(N||O),O?m.get().onActiveEmojiChange("keyboard",0,0):N&&m.get().search===""&&m.set({interaction:"none"})))},[o]),C=x.useCallback(S=>{l==null||l(S),!S.isDefaultPrevented()&&!S.currentTarget.contains(S.relatedTarget)&&v(!1)},[l]);return ls(()=>{g||m.get().onActiveEmojiReset()},[g]),x.useImperativeHandle(h,()=>y.current),x.useEffect(()=>{if(!g)return;function S(k){if(k.defaultPrevented||!k.key.startsWith("Arrow")&&k.key!=="Enter")return;let{data:E,onEmojiSelect:N,onActiveEmojiChange:O,interaction:T,activeColumnIndex:j,activeRowIndex:A}=m.get();if(k.key==="Enter"){let z=Kk(m.get());z&&(k.preventDefault(),N(z))}if(k.key.startsWith("Arrow")){let z=j,D=A;if(k.preventDefault(),T!=="none"){if(E!=null&&E.rows&&E.rows.length>0)switch(k.key){case"ArrowLeft":{if(z===0){let L=D-1,H=E.rows[L];H&&(D=L,z=H.emojis.length-1)}else z-=1;break}case"ArrowRight":{if(z===E.rows[D].emojis.length-1){let L=D+1;E.rows[L]&&(D=L,z=0)}else z+=1;break}case"ArrowUp":{let L=E.rows[D-1];L&&(D-=1,L.emojis[z]||(z=L.emojis.length-1));break}case"ArrowDown":{let L=E.rows[D+1];L&&(D+=1,L.emojis[z]||(z=L.emojis.length-1));break}}O("keyboard",z,D)}else O("keyboard",0,0)}}return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[g]),ls(()=>{let S=null,k=null,E=null,N=null,O=m.subscribe(D=>{y.current&&(S!==D.viewportWidth&&(S=D.viewportWidth,y.current.style.setProperty("--frimousse-viewport-width",`${D.viewportWidth}px`)),k!==D.viewportHeight&&(k=D.viewportHeight,y.current.style.setProperty("--frimousse-viewport-height",`${D.viewportHeight}px`)),E!==D.rowHeight&&(E=D.rowHeight,y.current.style.setProperty("--frimousse-row-height",`${D.rowHeight}px`)),N!==D.categoryHeaderHeight&&(N=D.categoryHeaderHeight,y.current.style.setProperty("--frimousse-category-header-height",`${D.categoryHeaderHeight}px`)))}),{viewportWidth:T,viewportHeight:j,rowHeight:A,categoryHeaderHeight:z}=m.get();return T&&y.current.style.setProperty("--frimousse-viewport-width",`${T}px`),j&&y.current.style.setProperty("--frimousse-viewport-height",`${j}px`),A&&y.current.style.setProperty("--frimousse-row-height",`${A}px`),z&&y.current.style.setProperty("--frimousse-category-header-height",`${z}px`),O},[]),p.jsx("div",{"data-focused":g?"":void 0,"frimousse-root":"",onBlurCapture:C,onFocusCapture:b,...d,ref:w,style:{"--frimousse-emoji-font":c2,...u},children:p.jsxs(s8,{store:m,children:[p.jsx(w8,{emojiVersion:s,emojibaseUrl:i}),a]})})}),b2=x.forwardRef(({value:e,defaultValue:t,onChange:n,...r},s)=>{let i=lr(),o=x.useRef(null),l=x.useCallback(d=>{d&&(o.current=d,i.set({searchRef:o}))},[]),a=typeof e=="string",u=x.useRef(a);x.useEffect(()=>{u.current=a},[a]),ls(()=>{i.set({search:typeof e=="string"?e:typeof t=="string"?t:""})},[]),ls(()=>{typeof e=="string"&&i.get().onSearchChange(e)},[e]);let c=x.useCallback(d=>{n==null||n(d),d.isDefaultPrevented()||i.get().onSearchChange(d.target.value)},[n]);return x.useImperativeHandle(s,()=>o.current),p.jsx("input",{autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",enterKeyHint:"done","frimousse-search":"",placeholder:"Search…",spellCheck:!1,type:"search",...r,defaultValue:t,onChange:c,ref:l,value:e})}),b8=x.memo(()=>{let e=x2();return e?p.jsx("div",{"aria-live":"polite",style:{border:0,clip:"rect(0, 0, 0, 0)",height:1,margin:-1,overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:1,wordWrap:"normal"},children:e.label}):null}),k2=x.forwardRef(({children:e,onScroll:t,onKeyDown:n,style:r,...s},i)=>{let o=lr(),l=x.useRef(null),a=x.useCallback(h=>{h&&(l.current=h,o.set({viewportRef:l}))},[]),u=br(o,g2),c=br(o,a8),d=x.useCallback(h=>{t==null||t(h),o.get().onViewportScroll(h.currentTarget.scrollTop)},[t]);return ls(()=>{if(!l.current)return;let h=new ResizeObserver(([f])=>{var b,C;let m=((b=f==null?void 0:f.borderBoxSize[0])==null?void 0:b.inlineSize)??0,g=((C=f==null?void 0:f.borderBoxSize[0])==null?void 0:C.blockSize)??0,{onViewportSizeChange:v,viewportHeight:y,viewportWidth:w}=o.get();(y!==g||w!==m)&&v(m,g)});return h.observe(l.current),o.get().onViewportSizeChange(l.current.offsetWidth,l.current.clientHeight),()=>{h.disconnect()}},[]),x.useImperativeHandle(i,()=>l.current),p.jsxs("div",{"frimousse-viewport":"",...s,onScroll:d,ref:a,style:{position:"relative",boxSizing:"border-box",contain:"layout paint",containIntrinsicSize:typeof u=="number"&&typeof c=="number"?`var(--frimousse-viewport-width, auto) calc(${u} * var(--frimousse-row-height) + ${c} * var(--frimousse-category-header-height))`:void 0,overflowY:"auto",overscrollBehavior:"contain",scrollbarGutter:"stable",willChange:"scroll-position",...r},children:[p.jsx(b8,{}),e]})});function S2(e,t,n){return{emoji:{...e,isActive:n},role:"gridcell","aria-colindex":t,"aria-selected":n||void 0,"aria-label":e.label,"data-active":n?"":void 0,"frimousse-emoji":"",style:{fontFamily:"var(--frimousse-emoji-font)"},tabIndex:-1}}function C2(e,t=!1){return{role:t?void 0:"row","aria-rowindex":t?void 0:e,"frimousse-row":"",style:{contain:t?void 0:"content",height:t?void 0:"var(--frimousse-row-height)",display:"flex"}}}function E2(e,t){return{"frimousse-category":"",style:{contain:"content",top:t?`calc(${e} * var(--frimousse-category-header-height) + ${t.startRowIndex} * var(--frimousse-row-height))`:void 0,height:t?`calc(var(--frimousse-category-header-height) + ${t.rowsCount} * var(--frimousse-row-height))`:void 0,width:"100%",pointerEvents:"none",position:"absolute"}}}function N2(e,t=!1,n=!0){return{category:e,"frimousse-category-header":"",style:{contain:t?void 0:"layout paint",height:t?void 0:"var(--frimousse-category-header-height)",pointerEvents:"auto",position:n?"sticky":void 0,top:0}}}function bN(e,t,n,r){return{"frimousse-list-sizer":"",style:{position:"relative",boxSizing:"border-box",height:`calc(${e} * var(--frimousse-row-height) + ${t} * var(--frimousse-category-header-height))`,paddingTop:`calc(${n} * var(--frimousse-row-height) + ${r} * var(--frimousse-category-header-height))`}}}function kN(e,t,n){return{"aria-colcount":e,"aria-rowcount":t,"frimousse-list":"",style:{"--frimousse-list-columns":e,...n},role:"grid"}}function k8(e){e.preventDefault()}var S8=x.memo(({Emoji:e,emoji:t,columnIndex:n,rowIndex:r})=>{let s=lr(),i=br(s,u=>{var c;return((c=Kk(u))==null?void 0:c.emoji)===t.emoji}),o=x.useCallback(()=>{s.get().onEmojiSelect(t)},[t]),l=x.useCallback(()=>{s.get().onActiveEmojiChange("pointer",n,r)},[n,r]),a=x.useCallback(()=>{s.get().onActiveEmojiReset()},[]);return p.jsx(e,{...S2(t,n,i),onClick:o,onPointerDown:k8,onPointerEnter:l,onPointerLeave:a})}),C8=x.memo(({Row:e,Emoji:t,rowIndex:n})=>{let r=lr(),s=br(r,i=>{var o;return(o=i.data)==null?void 0:o.rows[n]},d8);return s?p.jsx(e,{...C2(n),children:s.emojis.map((i,o)=>p.jsx(S8,{Emoji:t,columnIndex:o,emoji:i,rowIndex:n},i.label))}):null}),E8=x.memo(({CategoryHeader:e,categoryIndex:t})=>{let n=lr(),r=br(n,i=>{var o;return(o=i.data)==null?void 0:o.categories[t]},Qk),s=zs(n,"sticky");return r?p.jsx("div",{...E2(t,r),children:p.jsx(e,{...N2({label:r.label},!1,s)})}):null}),SN=x.memo(({CategoryHeader:e,Row:t,Emoji:n})=>{let r=x.useRef(null),s=lr(),i=zs(s,"columns"),o=x.useMemo(()=>Array(i).fill({emoji:"🙂",label:""}),[i]),l=x.useMemo(()=>({label:"Category"}),[]),a=x.useRef(null),u=x.useRef(null);return ls(()=>{var m,g;let c=(g=(m=r.current)==null?void 0:m.parentElement)==null?void 0:g.parentElement;if(!c||!a.current||!u.current)return;let d=new ResizeObserver(v=>{for(let y of v){let w=y.contentRect.height,{onRowHeightChange:b,onCategoryHeaderHeightChange:C,rowHeight:S,categoryHeaderHeight:k}=s.get();y.target===a.current&&S!==w&&b(w),y.target===u.current&&k!==w&&C(w)}});d.observe(c),d.observe(a.current),d.observe(u.current);let{onRowHeightChange:h,onCategoryHeaderHeightChange:f}=s.get();return h(a.current.clientHeight),f(u.current.clientHeight),()=>{d.disconnect()}},[]),p.jsxs("div",{"aria-hidden":!0,ref:r,style:{height:0,visibility:"hidden"},children:[p.jsx("div",{"frimousse-row-sizer":"",ref:a,children:p.jsx(t,{...C2(-1,!0),children:o.map((c,d)=>p.jsx(n,{...S2(c,d,!1)},d))})}),p.jsx("div",{...E2(-1),children:p.jsx("div",{"frimousse-category-header-sizer":"",ref:u,children:p.jsx(e,{...N2(l,!0)})})})]})});function N8({category:e,...t}){return p.jsx("div",{...t,children:e.label})}function T8({emoji:e,...t}){return p.jsx("button",{type:"button",...t,children:e.emoji})}function R8({...e}){return p.jsx("div",{...e})}var T2=x.forwardRef(({style:e,components:t,...n},r)=>{let s=lr(),i=x.useRef(null),o=x.useCallback(y=>{y&&(i.current=y,s.set({listRef:i}))},[]),l=(t==null?void 0:t.CategoryHeader)??N8,a=(t==null?void 0:t.Emoji)??T8,u=(t==null?void 0:t.Row)??R8,c=zs(s,"columns"),d=zs(s,"viewportStartRowIndex"),h=zs(s,"viewportEndRowIndex"),f=br(s,g2),m=br(s,u8,Qk),g=x.useMemo(()=>(m==null?void 0:m.filter(y=>y<d).length)??0,[m,d]),v=(m==null?void 0:m.length)??0;return x.useImperativeHandle(r,()=>i.current),!f||!m||v===0?p.jsx("div",{...kN(c,0,e),...n,children:p.jsx("div",{...bN(0,0,0,0),children:p.jsx(SN,{CategoryHeader:l,Emoji:a,Row:u})})}):p.jsx("div",{...kN(c,f,e),...n,ref:o,children:p.jsxs("div",{...bN(f,v,d,g),children:[p.jsx(SN,{CategoryHeader:l,Emoji:a,Row:u}),Array.from({length:h-d+1},(y,w)=>{let b=d+w,C=m.indexOf(b);return p.jsxs(x.Fragment,{children:[C>=0&&p.jsx("div",{style:{height:"var(--frimousse-category-header-height)"}}),p.jsx(C8,{Emoji:a,Row:u,rowIndex:b})]},b)}),Array.from({length:v},(y,w)=>p.jsx(E8,{CategoryHeader:l,categoryIndex:w},w))]})})}),R2=x.forwardRef(({emoji:e,onClick:t,"aria-label":n="Change skin tone",...r},s)=>{let i=lr(),o=br(i,c8,Qk),[l,a,u]=v2(e),c=x.useMemo(()=>Math.max(0,u.findIndex(v=>v.skinTone===l)),[l,u]),d=u[c],h=u[(c+1)%u.length].skinTone,f=l==="none"||o==null?void 0:o[l],m=h==="none"||o==null?void 0:o[h],g=x.useCallback(v=>{t==null||t(v),v.isDefaultPrevented()||a(h)},[t,a,h]);return p.jsx("button",{type:"button",...r,"aria-label":n+(m?` (${m})`:""),"aria-live":"polite","aria-valuetext":f,"frimousse-skin-tone-selector":"",onClick:g,ref:s,children:d.emoji})});function M2({children:e,...t}){let n=lr();return br(n,l8)?p.jsx("span",{"frimousse-loading":"",...t,children:e}):null}function M8({children:e}){let t=lr(),n=br(t,i8);return e({search:n})}function O2({children:e,...t}){let n=lr();return br(n,o8)?p.jsx("span",{"frimousse-empty":"",...t,children:typeof e=="function"?p.jsx(M8,{children:e}):e}):null}function j2({children:e}){let t=x2();return e({emoji:t})}function P2({children:e,emoji:t}){let[n,r,s]=v2(t);return e({skinTone:n,setSkinTone:r,skinToneVariations:s})}w2.displayName="EmojiPicker.Root";b2.displayName="EmojiPicker.Search";k2.displayName="EmojiPicker.Viewport";T2.displayName="EmojiPicker.List";M2.displayName="EmojiPicker.Loading";O2.displayName="EmojiPicker.Empty";R2.displayName="EmojiPicker.SkinToneSelector";j2.displayName="EmojiPicker.ActiveEmoji";P2.displayName="EmojiPicker.SkinTone";const A2=["top","right","bottom","left"],CN=["start","end"],EN=A2.reduce((e,t)=>e.concat(t,t+"-"+CN[0],t+"-"+CN[1]),[]),vs=Math.min,Rn=Math.max,cm=Math.round,Ch=Math.floor,Vs=e=>({x:e,y:e}),O8={left:"right",right:"left",bottom:"top",top:"bottom"},j8={start:"end",end:"start"};function cw(e,t,n){return Rn(e,vs(t,n))}function ws(e,t){return typeof e=="function"?e(t):e}function kr(e){return e.split("-")[0]}function gs(e){return e.split("-")[1]}function Gk(e){return e==="x"?"y":"x"}function Jk(e){return e==="y"?"height":"width"}const P8=new Set(["top","bottom"]);function ds(e){return P8.has(kr(e))?"y":"x"}function Zk(e){return Gk(ds(e))}function _2(e,t,n){n===void 0&&(n=!1);const r=gs(e),s=Zk(e),i=Jk(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=fm(o)),[o,fm(o)]}function A8(e){const t=fm(e);return[dm(e),t,dm(t)]}function dm(e){return e.replace(/start|end/g,t=>j8[t])}const NN=["left","right"],TN=["right","left"],_8=["top","bottom"],I8=["bottom","top"];function D8(e,t,n){switch(e){case"top":case"bottom":return n?t?TN:NN:t?NN:TN;case"left":case"right":return t?_8:I8;default:return[]}}function L8(e,t,n,r){const s=gs(e);let i=D8(kr(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(dm)))),i}function fm(e){return e.replace(/left|right|bottom|top/g,t=>O8[t])}function $8(e){return{top:0,right:0,bottom:0,left:0,...e}}function Yk(e){return typeof e!="number"?$8(e):{top:e,right:e,bottom:e,left:e}}function Iu(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function RN(e,t,n){let{reference:r,floating:s}=e;const i=ds(t),o=Zk(t),l=Jk(o),a=kr(t),u=i==="y",c=r.x+r.width/2-s.width/2,d=r.y+r.height/2-s.height/2,h=r[l]/2-s[l]/2;let f;switch(a){case"top":f={x:c,y:r.y-s.height};break;case"bottom":f={x:c,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-s.width,y:d};break;default:f={x:r.x,y:r.y}}switch(gs(t)){case"start":f[o]-=h*(n&&u?-1:1);break;case"end":f[o]+=h*(n&&u?-1:1);break}return f}async function z8(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:o,elements:l,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=ws(t,e),m=Yk(f),v=l[h?d==="floating"?"reference":"floating":d],y=Iu(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:c,strategy:a})),w=d==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),C=await(i.isElement==null?void 0:i.isElement(b))?await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1}:{x:1,y:1},S=Iu(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:b,strategy:a}):w);return{top:(y.top-S.top+m.top)/C.y,bottom:(S.bottom-y.bottom+m.bottom)/C.y,left:(y.left-S.left+m.left)/C.x,right:(S.right-y.right+m.right)/C.x}}const F8=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,l=i.filter(Boolean),a=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:c,y:d}=RN(u,r,a),h=r,f={},m=0;for(let v=0;v<l.length;v++){var g;const{name:y,fn:w}=l[v],{x:b,y:C,data:S,reset:k}=await w({x:c,y:d,initialPlacement:r,placement:h,strategy:s,middlewareData:f,rects:u,platform:{...o,detectOverflow:(g=o.detectOverflow)!=null?g:z8},elements:{reference:e,floating:t}});c=b??c,d=C??d,f={...f,[y]:{...f[y],...S}},k&&m<=50&&(m++,typeof k=="object"&&(k.placement&&(h=k.placement),k.rects&&(u=k.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):k.rects),{x:c,y:d}=RN(u,h,a)),v=-1)}return{x:c,y:d,placement:h,strategy:s,middlewareData:f}},B8=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:l,middlewareData:a}=t,{element:u,padding:c=0}=ws(e,t)||{};if(u==null)return{};const d=Yk(c),h={x:n,y:r},f=Zk(s),m=Jk(f),g=await o.getDimensions(u),v=f==="y",y=v?"top":"left",w=v?"bottom":"right",b=v?"clientHeight":"clientWidth",C=i.reference[m]+i.reference[f]-h[f]-i.floating[m],S=h[f]-i.reference[f],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let E=k?k[b]:0;(!E||!await(o.isElement==null?void 0:o.isElement(k)))&&(E=l.floating[b]||i.floating[m]);const N=C/2-S/2,O=E/2-g[m]/2-1,T=vs(d[y],O),j=vs(d[w],O),A=T,z=E-g[m]-j,D=E/2-g[m]/2+N,L=cw(A,D,z),H=!a.arrow&&gs(s)!=null&&D!==L&&i.reference[m]/2-(D<A?T:j)-g[m]/2<0,K=H?D<A?D-A:D-z:0;return{[f]:h[f]+K,data:{[f]:L,centerOffset:D-L-K,...H&&{alignmentOffset:K}},reset:H}}});function V8(e,t,n){return(e?[...n.filter(s=>gs(s)===e),...n.filter(s=>gs(s)!==e)]:n.filter(s=>kr(s)===s)).filter(s=>e?gs(s)===e||(t?dm(s)!==s:!1):!0)}const H8=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,s;const{rects:i,middlewareData:o,placement:l,platform:a,elements:u}=t,{crossAxis:c=!1,alignment:d,allowedPlacements:h=EN,autoAlignment:f=!0,...m}=ws(e,t),g=d!==void 0||h===EN?V8(d||null,f,h):h,v=await a.detectOverflow(t,m),y=((n=o.autoPlacement)==null?void 0:n.index)||0,w=g[y];if(w==null)return{};const b=_2(w,i,await(a.isRTL==null?void 0:a.isRTL(u.floating)));if(l!==w)return{reset:{placement:g[0]}};const C=[v[kr(w)],v[b[0]],v[b[1]]],S=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:w,overflows:C}],k=g[y+1];if(k)return{data:{index:y+1,overflows:S},reset:{placement:k}};const E=S.map(T=>{const j=gs(T.placement);return[T.placement,j&&c?T.overflows.slice(0,2).reduce((A,z)=>A+z,0):T.overflows[0],T.overflows]}).sort((T,j)=>T[1]-j[1]),O=((s=E.filter(T=>T[2].slice(0,gs(T[0])?2:3).every(j=>j<=0))[0])==null?void 0:s[0])||E[0][0];return O!==l?{data:{index:y+1,overflows:S},reset:{placement:O}}:{}}}},U8=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:l,platform:a,elements:u}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...v}=ws(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=kr(s),w=ds(l),b=kr(l)===l,C=await(a.isRTL==null?void 0:a.isRTL(u.floating)),S=h||(b||!g?[fm(l)]:A8(l)),k=m!=="none";!h&&k&&S.push(...L8(l,g,m,C));const E=[l,...S],N=await a.detectOverflow(t,v),O=[];let T=((r=i.flip)==null?void 0:r.overflows)||[];if(c&&O.push(N[y]),d){const D=_2(s,o,C);O.push(N[D[0]],N[D[1]])}if(T=[...T,{placement:s,overflows:O}],!O.every(D=>D<=0)){var j,A;const D=(((j=i.flip)==null?void 0:j.index)||0)+1,L=E[D];if(L&&(!(d==="alignment"?w!==ds(L):!1)||T.every(_=>ds(_.placement)===w?_.overflows[0]>0:!0)))return{data:{index:D,overflows:T},reset:{placement:L}};let H=(A=T.filter(K=>K.overflows[0]<=0).sort((K,_)=>K.overflows[1]-_.overflows[1])[0])==null?void 0:A.placement;if(!H)switch(f){case"bestFit":{var z;const K=(z=T.filter(_=>{if(k){const Q=ds(_.placement);return Q===w||Q==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(Q=>Q>0).reduce((Q,M)=>Q+M,0)]).sort((_,Q)=>_[1]-Q[1])[0])==null?void 0:z[0];K&&(H=K);break}case"initialPlacement":H=l;break}if(s!==H)return{reset:{placement:H}}}return{}}}};function MN(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ON(e){return A2.some(t=>e[t]>=0)}const q8=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...i}=ws(e,t);switch(s){case"referenceHidden":{const o=await r.detectOverflow(t,{...i,elementContext:"reference"}),l=MN(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:ON(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),l=MN(o,n.floating);return{data:{escapedOffsets:l,escaped:ON(l)}}}default:return{}}}}};function I2(e){const t=vs(...e.map(i=>i.left)),n=vs(...e.map(i=>i.top)),r=Rn(...e.map(i=>i.right)),s=Rn(...e.map(i=>i.bottom));return{x:t,y:n,width:r-t,height:s-n}}function W8(e){const t=e.slice().sort((s,i)=>s.y-i.y),n=[];let r=null;for(let s=0;s<t.length;s++){const i=t[s];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(s=>Iu(I2(s)))}const K8=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:s,platform:i,strategy:o}=t,{padding:l=2,x:a,y:u}=ws(e,t),c=Array.from(await(i.getClientRects==null?void 0:i.getClientRects(r.reference))||[]),d=W8(c),h=Iu(I2(c)),f=Yk(l);function m(){if(d.length===2&&d[0].left>d[1].right&&a!=null&&u!=null)return d.find(v=>a>v.left-f.left&&a<v.right+f.right&&u>v.top-f.top&&u<v.bottom+f.bottom)||h;if(d.length>=2){if(ds(n)==="y"){const T=d[0],j=d[d.length-1],A=kr(n)==="top",z=T.top,D=j.bottom,L=A?T.left:j.left,H=A?T.right:j.right,K=H-L,_=D-z;return{top:z,bottom:D,left:L,right:H,width:K,height:_,x:L,y:z}}const v=kr(n)==="left",y=Rn(...d.map(T=>T.right)),w=vs(...d.map(T=>T.left)),b=d.filter(T=>v?T.left===w:T.right===y),C=b[0].top,S=b[b.length-1].bottom,k=w,E=y,N=E-k,O=S-C;return{top:C,bottom:S,left:k,right:E,width:N,height:O,x:k,y:C}}return h}const g=await i.getElementRects({reference:{getBoundingClientRect:m},floating:r.floating,strategy:o});return s.reference.x!==g.reference.x||s.reference.y!==g.reference.y||s.reference.width!==g.reference.width||s.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},D2=new Set(["left","top"]);async function Q8(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=kr(n),l=gs(n),a=ds(n)==="y",u=D2.has(o)?-1:1,c=i&&a?-1:1,d=ws(t,e);let{mainAxis:h,crossAxis:f,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof m=="number"&&(f=l==="end"?m*-1:m),a?{x:f*c,y:h*u}:{x:h*u,y:f*c}}const G8=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:o,middlewareData:l}=t,a=await Q8(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+a.x,y:i+a.y,data:{...a,placement:o}}}}},J8=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:a={fn:y=>{let{x:w,y:b}=y;return{x:w,y:b}}},...u}=ws(e,t),c={x:n,y:r},d=await i.detectOverflow(t,u),h=ds(kr(s)),f=Gk(h);let m=c[f],g=c[h];if(o){const y=f==="y"?"top":"left",w=f==="y"?"bottom":"right",b=m+d[y],C=m-d[w];m=cw(b,m,C)}if(l){const y=h==="y"?"top":"left",w=h==="y"?"bottom":"right",b=g+d[y],C=g-d[w];g=cw(b,g,C)}const v=a.fn({...t,[f]:m,[h]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[f]:o,[h]:l}}}}}},Z8=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:i,middlewareData:o}=t,{offset:l=0,mainAxis:a=!0,crossAxis:u=!0}=ws(e,t),c={x:n,y:r},d=ds(s),h=Gk(d);let f=c[h],m=c[d];const g=ws(l,t),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(a){const b=h==="y"?"height":"width",C=i.reference[h]-i.floating[b]+v.mainAxis,S=i.reference[h]+i.reference[b]-v.mainAxis;f<C?f=C:f>S&&(f=S)}if(u){var y,w;const b=h==="y"?"width":"height",C=D2.has(kr(s)),S=i.reference[d]-i.floating[b]+(C&&((y=o.offset)==null?void 0:y[d])||0)+(C?0:v.crossAxis),k=i.reference[d]+i.reference[b]+(C?0:((w=o.offset)==null?void 0:w[d])||0)-(C?v.crossAxis:0);m<S?m=S:m>k&&(m=k)}return{[h]:f,[d]:m}}}},Y8=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:i,platform:o,elements:l}=t,{apply:a=()=>{},...u}=ws(e,t),c=await o.detectOverflow(t,u),d=kr(s),h=gs(s),f=ds(s)==="y",{width:m,height:g}=i.floating;let v,y;d==="top"||d==="bottom"?(v=d,y=h===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(y=d,v=h==="end"?"top":"bottom");const w=g-c.top-c.bottom,b=m-c.left-c.right,C=vs(g-c[v],w),S=vs(m-c[y],b),k=!t.middlewareData.shift;let E=C,N=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=w),k&&!h){const T=Rn(c.left,0),j=Rn(c.right,0),A=Rn(c.top,0),z=Rn(c.bottom,0);f?N=m-2*(T!==0||j!==0?T+j:Rn(c.left,c.right)):E=g-2*(A!==0||z!==0?A+z:Rn(c.top,c.bottom))}await a({...t,availableWidth:N,availableHeight:E});const O=await o.getDimensions(l.floating);return m!==O.width||g!==O.height?{reset:{rects:!0}}:{}}}};function Gg(){return typeof window<"u"}function ac(e){return L2(e)?(e.nodeName||"").toLowerCase():"#document"}function xr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zs(e){var t;return(t=(L2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function L2(e){return Gg()?e instanceof Node||e instanceof xr(e).Node:!1}function bs(e){return Gg()?e instanceof Element||e instanceof xr(e).Element:!1}function qs(e){return Gg()?e instanceof HTMLElement||e instanceof xr(e).HTMLElement:!1}function jN(e){return!Gg()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof xr(e).ShadowRoot}const X8=new Set(["inline","contents"]);function Df(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=ks(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!X8.has(s)}const e7=new Set(["table","td","th"]);function t7(e){return e7.has(ac(e))}const n7=[":popover-open",":modal"];function Jg(e){return n7.some(t=>{try{return e.matches(t)}catch{return!1}})}const r7=["transform","translate","scale","rotate","perspective"],s7=["transform","translate","scale","rotate","perspective","filter"],i7=["paint","layout","strict","content"];function Xk(e){const t=e1(),n=bs(e)?ks(e):e;return r7.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||s7.some(r=>(n.willChange||"").includes(r))||i7.some(r=>(n.contain||"").includes(r))}function o7(e){let t=Ho(e);for(;qs(t)&&!Du(t);){if(Xk(t))return t;if(Jg(t))return null;t=Ho(t)}return null}function e1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const l7=new Set(["html","body","#document"]);function Du(e){return l7.has(ac(e))}function ks(e){return xr(e).getComputedStyle(e)}function Zg(e){return bs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ho(e){if(ac(e)==="html")return e;const t=e.assignedSlot||e.parentNode||jN(e)&&e.host||Zs(e);return jN(t)?t.host:t}function $2(e){const t=Ho(e);return Du(t)?e.ownerDocument?e.ownerDocument.body:e.body:qs(t)&&Df(t)?t:$2(t)}function Gd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=$2(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=xr(s);if(i){const l=dw(o);return t.concat(o,o.visualViewport||[],Df(s)?s:[],l&&n?Gd(l):[])}return t.concat(s,Gd(s,[],n))}function dw(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function z2(e){const t=ks(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=qs(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,l=cm(n)!==i||cm(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function t1(e){return bs(e)?e:e.contextElement}function iu(e){const t=t1(e);if(!qs(t))return Vs(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=z2(t);let o=(i?cm(n.width):n.width)/r,l=(i?cm(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const a7=Vs(0);function F2(e){const t=xr(e);return!e1()||!t.visualViewport?a7:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function u7(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==xr(e)?!1:t}function Jl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=t1(e);let o=Vs(1);t&&(r?bs(r)&&(o=iu(r)):o=iu(e));const l=u7(i,n,r)?F2(i):Vs(0);let a=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,c=s.width/o.x,d=s.height/o.y;if(i){const h=xr(i),f=r&&bs(r)?xr(r):r;let m=h,g=dw(m);for(;g&&r&&f!==m;){const v=iu(g),y=g.getBoundingClientRect(),w=ks(g),b=y.left+(g.clientLeft+parseFloat(w.paddingLeft))*v.x,C=y.top+(g.clientTop+parseFloat(w.paddingTop))*v.y;a*=v.x,u*=v.y,c*=v.x,d*=v.y,a+=b,u+=C,m=xr(g),g=dw(m)}}return Iu({width:c,height:d,x:a,y:u})}function Yg(e,t){const n=Zg(e).scrollLeft;return t?t.left+n:Jl(Zs(e)).left+n}function B2(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Yg(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function c7(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=Zs(r),l=t?Jg(t.floating):!1;if(r===o||l&&i)return n;let a={scrollLeft:0,scrollTop:0},u=Vs(1);const c=Vs(0),d=qs(r);if((d||!d&&!i)&&((ac(r)!=="body"||Df(o))&&(a=Zg(r)),qs(r))){const f=Jl(r);u=iu(r),c.x=f.x+r.clientLeft,c.y=f.y+r.clientTop}const h=o&&!d&&!i?B2(o,a):Vs(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+c.x+h.x,y:n.y*u.y-a.scrollTop*u.y+c.y+h.y}}function d7(e){return Array.from(e.getClientRects())}function f7(e){const t=Zs(e),n=Zg(e),r=e.ownerDocument.body,s=Rn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Rn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Yg(e);const l=-n.scrollTop;return ks(r).direction==="rtl"&&(o+=Rn(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:l}}const PN=25;function h7(e,t){const n=xr(e),r=Zs(e),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,l=0,a=0;if(s){i=s.width,o=s.height;const c=e1();(!c||c&&t==="fixed")&&(l=s.offsetLeft,a=s.offsetTop)}const u=Yg(r);if(u<=0){const c=r.ownerDocument,d=c.body,h=getComputedStyle(d),f=c.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,m=Math.abs(r.clientWidth-d.clientWidth-f);m<=PN&&(i-=m)}else u<=PN&&(i+=u);return{width:i,height:o,x:l,y:a}}const p7=new Set(["absolute","fixed"]);function m7(e,t){const n=Jl(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=qs(e)?iu(e):Vs(1),o=e.clientWidth*i.x,l=e.clientHeight*i.y,a=s*i.x,u=r*i.y;return{width:o,height:l,x:a,y:u}}function AN(e,t,n){let r;if(t==="viewport")r=h7(e,n);else if(t==="document")r=f7(Zs(e));else if(bs(t))r=m7(t,n);else{const s=F2(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Iu(r)}function V2(e,t){const n=Ho(e);return n===t||!bs(n)||Du(n)?!1:ks(n).position==="fixed"||V2(n,t)}function g7(e,t){const n=t.get(e);if(n)return n;let r=Gd(e,[],!1).filter(l=>bs(l)&&ac(l)!=="body"),s=null;const i=ks(e).position==="fixed";let o=i?Ho(e):e;for(;bs(o)&&!Du(o);){const l=ks(o),a=Xk(o);!a&&l.position==="fixed"&&(s=null),(i?!a&&!s:!a&&l.position==="static"&&!!s&&p7.has(s.position)||Df(o)&&!a&&V2(e,o))?r=r.filter(c=>c!==o):s=l,o=Ho(o)}return t.set(e,r),r}function y7(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?Jg(t)?[]:g7(t,this._c):[].concat(n),r],l=o[0],a=o.reduce((u,c)=>{const d=AN(t,c,s);return u.top=Rn(d.top,u.top),u.right=vs(d.right,u.right),u.bottom=vs(d.bottom,u.bottom),u.left=Rn(d.left,u.left),u},AN(t,l,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function x7(e){const{width:t,height:n}=z2(e);return{width:t,height:n}}function v7(e,t,n){const r=qs(t),s=Zs(t),i=n==="fixed",o=Jl(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const a=Vs(0);function u(){a.x=Yg(s)}if(r||!r&&!i)if((ac(t)!=="body"||Df(s))&&(l=Zg(t)),r){const f=Jl(t,!0,i,t);a.x=f.x+t.clientLeft,a.y=f.y+t.clientTop}else s&&u();i&&!r&&s&&u();const c=s&&!r&&!i?B2(s,l):Vs(0),d=o.left+l.scrollLeft-a.x-c.x,h=o.top+l.scrollTop-a.y-c.y;return{x:d,y:h,width:o.width,height:o.height}}function Mx(e){return ks(e).position==="static"}function _N(e,t){if(!qs(e)||ks(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Zs(e)===n&&(n=n.ownerDocument.body),n}function H2(e,t){const n=xr(e);if(Jg(e))return n;if(!qs(e)){let s=Ho(e);for(;s&&!Du(s);){if(bs(s)&&!Mx(s))return s;s=Ho(s)}return n}let r=_N(e,t);for(;r&&t7(r)&&Mx(r);)r=_N(r,t);return r&&Du(r)&&Mx(r)&&!Xk(r)?n:r||o7(e)||n}const w7=async function(e){const t=this.getOffsetParent||H2,n=this.getDimensions,r=await n(e.floating);return{reference:v7(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function b7(e){return ks(e).direction==="rtl"}const k7={convertOffsetParentRelativeRectToViewportRelativeRect:c7,getDocumentElement:Zs,getClippingRect:y7,getOffsetParent:H2,getElementRects:w7,getClientRects:d7,getDimensions:x7,getScale:iu,isElement:bs,isRTL:b7};function U2(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function S7(e,t){let n=null,r;const s=Zs(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),i();const u=e.getBoundingClientRect(),{left:c,top:d,width:h,height:f}=u;if(l||t(),!h||!f)return;const m=Ch(d),g=Ch(s.clientWidth-(c+h)),v=Ch(s.clientHeight-(d+f)),y=Ch(c),b={rootMargin:-m+"px "+-g+"px "+-v+"px "+-y+"px",threshold:Rn(0,vs(1,a))||1};let C=!0;function S(k){const E=k[0].intersectionRatio;if(E!==a){if(!C)return o();E?o(!1,E):r=setTimeout(()=>{o(!1,1e-7)},1e3)}E===1&&!U2(u,e.getBoundingClientRect())&&o(),C=!1}try{n=new IntersectionObserver(S,{...b,root:s.ownerDocument})}catch{n=new IntersectionObserver(S,b)}n.observe(e)}return o(!0),i}function C7(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=t1(e),c=s||i?[...u?Gd(u):[],...Gd(t)]:[];c.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const d=u&&l?S7(u,n):null;let h=-1,f=null;o&&(f=new ResizeObserver(y=>{let[w]=y;w&&w.target===u&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var b;(b=f)==null||b.observe(t)})),n()}),u&&!a&&f.observe(u),f.observe(t));let m,g=a?Jl(e):null;a&&v();function v(){const y=Jl(e);g&&!U2(g,y)&&n(),g=y,m=requestAnimationFrame(v)}return n(),()=>{var y;c.forEach(w=>{s&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),d==null||d(),(y=f)==null||y.disconnect(),f=null,a&&cancelAnimationFrame(m)}}const n1=G8,q2=H8,r1=J8,s1=U8,i1=Y8,o1=q8,hm=B8,W2=K8,E7=Z8,l1=(e,t,n)=>{const r=new Map,s={platform:k7,...n},i={...s.platform,_c:r};return F8(e,t,{...s,platform:i})};var N7=typeof document<"u",T7=function(){},gp=N7?x.useLayoutEffect:T7;function pm(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!pm(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!pm(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function K2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function IN(e,t){const n=K2(e);return Math.round(t*n)/n}function Ox(e){const t=x.useRef(e);return gp(()=>{t.current=e}),t}function R7(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:a,open:u}=e,[c,d]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,f]=x.useState(r);pm(h,r)||f(r);const[m,g]=x.useState(null),[v,y]=x.useState(null),w=x.useCallback(_=>{_!==k.current&&(k.current=_,g(_))},[]),b=x.useCallback(_=>{_!==E.current&&(E.current=_,y(_))},[]),C=i||m,S=o||v,k=x.useRef(null),E=x.useRef(null),N=x.useRef(c),O=a!=null,T=Ox(a),j=Ox(s),A=Ox(u),z=x.useCallback(()=>{if(!k.current||!E.current)return;const _={placement:t,strategy:n,middleware:h};j.current&&(_.platform=j.current),l1(k.current,E.current,_).then(Q=>{const M={...Q,isPositioned:A.current!==!1};D.current&&!pm(N.current,M)&&(N.current=M,Zo.flushSync(()=>{d(M)}))})},[h,t,n,j,A]);gp(()=>{u===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,d(_=>({..._,isPositioned:!1})))},[u]);const D=x.useRef(!1);gp(()=>(D.current=!0,()=>{D.current=!1}),[]),gp(()=>{if(C&&(k.current=C),S&&(E.current=S),C&&S){if(T.current)return T.current(C,S,z);z()}},[C,S,z,T,O]);const L=x.useMemo(()=>({reference:k,floating:E,setReference:w,setFloating:b}),[w,b]),H=x.useMemo(()=>({reference:C,floating:S}),[C,S]),K=x.useMemo(()=>{const _={position:n,left:0,top:0};if(!H.floating)return _;const Q=IN(H.floating,c.x),M=IN(H.floating,c.y);return l?{..._,transform:"translate("+Q+"px, "+M+"px)",...K2(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Q,top:M}},[n,l,H.floating,c.x,c.y]);return x.useMemo(()=>({...c,update:z,refs:L,elements:H,floatingStyles:K}),[c,z,L,H,K])}const M7=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?hm({element:r.current,padding:s}).fn(n):{}:r?hm({element:r,padding:s}).fn(n):{}}}},O7=(e,t)=>({...n1(e),options:[e,t]}),j7=(e,t)=>({...r1(e),options:[e,t]}),P7=(e,t)=>({...E7(e),options:[e,t]}),A7=(e,t)=>({...s1(e),options:[e,t]}),_7=(e,t)=>({...i1(e),options:[e,t]}),I7=(e,t)=>({...o1(e),options:[e,t]}),D7=(e,t)=>({...M7(e),options:[e,t]});var L7="Arrow",Q2=x.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return p.jsx(On.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});Q2.displayName=L7;var $7=Q2;function z7(e){const[t,n]=x.useState(void 0);return Bo(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,l;if("borderBoxSize"in i){const a=i.borderBoxSize,u=Array.isArray(a)?a[0]:a;o=u.inlineSize,l=u.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var a1="Popper",[G2,Xg]=Ug(a1),[F7,J2]=G2(a1),Z2=e=>{const{__scopePopper:t,children:n}=e,[r,s]=x.useState(null);return p.jsx(F7,{scope:t,anchor:r,onAnchorChange:s,children:n})};Z2.displayName=a1;var Y2="PopperAnchor",X2=x.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=J2(Y2,n),o=x.useRef(null),l=Nr(t,o),a=x.useRef(null);return x.useEffect(()=>{const u=a.current;a.current=(r==null?void 0:r.current)||o.current,u!==a.current&&i.onAnchorChange(a.current)}),r?null:p.jsx(On.div,{...s,ref:l})});X2.displayName=Y2;var u1="PopperContent",[B7,V7]=G2(u1),eI=x.forwardRef((e,t)=>{var G,me,we,qe,ut,rn;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:a=!0,collisionBoundary:u=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:f="optimized",onPlaced:m,...g}=e,v=J2(u1,n),[y,w]=x.useState(null),b=Nr(t,Le=>w(Le)),[C,S]=x.useState(null),k=z7(C),E=(k==null?void 0:k.width)??0,N=(k==null?void 0:k.height)??0,O=r+(i!=="center"?"-"+i:""),T=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},j=Array.isArray(u)?u:[u],A=j.length>0,z={padding:T,boundary:j.filter(U7),altBoundary:A},{refs:D,floatingStyles:L,placement:H,isPositioned:K,middlewareData:_}=R7({strategy:"fixed",placement:O,whileElementsMounted:(...Le)=>C7(...Le,{animationFrame:f==="always"}),elements:{reference:v.anchor},middleware:[O7({mainAxis:s+N,alignmentAxis:o}),a&&j7({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?P7():void 0,...z}),a&&A7({...z}),_7({...z,apply:({elements:Le,rects:Dt,availableWidth:sn,availableHeight:ct})=>{const{width:ur,height:Mr}=Dt.reference,dt=Le.floating.style;dt.setProperty("--radix-popper-available-width",`${sn}px`),dt.setProperty("--radix-popper-available-height",`${ct}px`),dt.setProperty("--radix-popper-anchor-width",`${ur}px`),dt.setProperty("--radix-popper-anchor-height",`${Mr}px`)}}),C&&D7({element:C,padding:l}),q7({arrowWidth:E,arrowHeight:N}),h&&I7({strategy:"referenceHidden",...z})]}),[Q,M]=rI(H),oe=_u(m);Bo(()=>{K&&(oe==null||oe())},[K,oe]);const F=(G=_.arrow)==null?void 0:G.x,R=(me=_.arrow)==null?void 0:me.y,I=((we=_.arrow)==null?void 0:we.centerOffset)!==0,[V,Y]=x.useState();return Bo(()=>{y&&Y(window.getComputedStyle(y).zIndex)},[y]),p.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:K?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[(qe=_.transformOrigin)==null?void 0:qe.x,(ut=_.transformOrigin)==null?void 0:ut.y].join(" "),...((rn=_.hide)==null?void 0:rn.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(B7,{scope:n,placedSide:Q,onArrowChange:S,arrowX:F,arrowY:R,shouldHideArrow:I,children:p.jsx(On.div,{"data-side":Q,"data-align":M,...g,ref:b,style:{...g.style,animation:K?void 0:"none"}})})})});eI.displayName=u1;var tI="PopperArrow",H7={top:"bottom",right:"left",bottom:"top",left:"right"},nI=x.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=V7(tI,r),o=H7[i.placedSide];return p.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:p.jsx($7,{...s,ref:n,style:{...s.style,display:"block"}})})});nI.displayName=tI;function U7(e){return e!==null}var q7=e=>({name:"transformOrigin",options:e,fn(t){var v,y,w;const{placement:n,rects:r,middlewareData:s}=t,o=((v=s.arrow)==null?void 0:v.centerOffset)!==0,l=o?0:e.arrowWidth,a=o?0:e.arrowHeight,[u,c]=rI(n),d={start:"0%",center:"50%",end:"100%"}[c],h=(((y=s.arrow)==null?void 0:y.x)??0)+l/2,f=(((w=s.arrow)==null?void 0:w.y)??0)+a/2;let m="",g="";return u==="bottom"?(m=o?d:`${h}px`,g=`${-a}px`):u==="top"?(m=o?d:`${h}px`,g=`${r.floating.height+a}px`):u==="right"?(m=`${-a}px`,g=o?d:`${f}px`):u==="left"&&(m=`${r.floating.width+a}px`,g=o?d:`${f}px`),{data:{x:m,y:g}}}});function rI(e){const[t,n="center"]=e.split("-");return[t,n]}var sI=Z2,c1=X2,iI=eI,oI=nI,ey="Popover",[lI]=Ug(ey,[Xg]),Lf=Xg(),[W7,rl]=lI(ey),aI=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=e,l=Lf(t),a=x.useRef(null),[u,c]=x.useState(!1),[d,h]=Ik({prop:r,defaultProp:s??!1,onChange:i,caller:ey});return p.jsx(sI,{...l,children:p.jsx(W7,{scope:t,contentId:ms(),triggerRef:a,open:d,onOpenChange:h,onOpenToggle:x.useCallback(()=>h(f=>!f),[h]),hasCustomAnchor:u,onCustomAnchorAdd:x.useCallback(()=>c(!0),[]),onCustomAnchorRemove:x.useCallback(()=>c(!1),[]),modal:o,children:n})})};aI.displayName=ey;var uI="PopoverAnchor",K7=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=rl(uI,n),i=Lf(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=s;return x.useEffect(()=>(o(),()=>l()),[o,l]),p.jsx(c1,{...i,...r,ref:t})});K7.displayName=uI;var cI="PopoverTrigger",dI=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=rl(cI,n),i=Lf(n),o=Nr(t,s.triggerRef),l=p.jsx(On.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":gI(s.open),...r,ref:o,onClick:Wt(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:p.jsx(c1,{asChild:!0,...i,children:l})});dI.displayName=cI;var d1="PopoverPortal",[Q7,G7]=lI(d1,{forceMount:void 0}),fI=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,i=rl(d1,t);return p.jsx(Q7,{scope:t,forceMount:n,children:p.jsx(ca,{present:n||i.open,children:p.jsx($k,{asChild:!0,container:s,children:r})})})};fI.displayName=d1;var Lu="PopoverContent",hI=x.forwardRef((e,t)=>{const n=G7(Lu,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,i=rl(Lu,e.__scopePopover);return p.jsx(ca,{present:r||i.open,children:i.modal?p.jsx(Z7,{...s,ref:t}):p.jsx(Y7,{...s,ref:t})})});hI.displayName=Lu;var J7=Dk("PopoverContent.RemoveScroll"),Z7=x.forwardRef((e,t)=>{const n=rl(Lu,e.__scopePopover),r=x.useRef(null),s=Nr(t,r),i=x.useRef(!1);return x.useEffect(()=>{const o=r.current;if(o)return T_(o)},[]),p.jsx(zk,{as:J7,allowPinchZoom:!0,children:p.jsx(pI,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Wt(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Wt(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,a=l.button===0&&l.ctrlKey===!0,u=l.button===2||a;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:Wt(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Y7=x.forwardRef((e,t)=>{const n=rl(Lu,e.__scopePopover),r=x.useRef(!1),s=x.useRef(!1);return p.jsx(pI,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var a,u;(a=e.onInteractOutside)==null||a.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),pI=x.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:u,onInteractOutside:c,...d}=e,h=rl(Lu,n),f=Lf(n);return x_(),p.jsx(Lk,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:p.jsx(qg,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:c,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:p.jsx(iI,{"data-state":gI(h.open),role:"dialog",id:h.contentId,...f,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),mI="PopoverClose",X7=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=rl(mI,n);return p.jsx(On.button,{type:"button",...r,ref:t,onClick:Wt(e.onClick,()=>s.onOpenChange(!1))})});X7.displayName=mI;var eK="PopoverArrow",tK=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Lf(n);return p.jsx(oI,{...s,...r,ref:t})});tK.displayName=eK;function gI(e){return e?"open":"closed"}var nK=aI,rK=dI,sK=fI,iK=hI;function oK({...e}){return p.jsx(nK,{"data-slot":"popover",...e})}function lK({...e}){return p.jsx(rK,{"data-slot":"popover-trigger",...e})}function aK({className:e,align:t="center",sideOffset:n=4,...r}){return p.jsx(sK,{children:p.jsx(iK,{"data-slot":"popover-content",align:t,sideOffset:n,className:mt("bg-popover text-popover-foreground 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 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...r})})}const uK=({onSelect:e})=>p.jsxs(pl.Root,{className:"isolate flex h-[340px] w-[284px] flex-col bg-background text-foreground",onEmojiSelect:t=>e(t.emoji),columns:8,children:[p.jsx(pl.Search,{className:"mx-2 mt-2 rounded-md border bg-background px-2.5 py-2 text-sm",placeholder:"Search emoji..."}),p.jsxs(pl.Viewport,{className:"flex-1 overflow-y-auto overflow-x-hidden px-1",children:[p.jsx(pl.Loading,{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"Loading…"}),p.jsx(pl.Empty,{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"No emoji found."}),p.jsx(pl.List,{className:"select-none pb-2",components:{CategoryHeader:({category:t,...n})=>p.jsx("div",{...n,className:"sticky top-0 bg-background px-0.5 pt-1.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:t.label}),Row:({className:t,...n})=>p.jsx("div",{...n,className:`${t??""} flex`}),Emoji:({emoji:t,className:n,...r})=>p.jsx("button",{...r,className:`${n??""} flex size-[33px] items-center justify-center rounded text-xl transition-colors hover:bg-muted`,children:t.emoji})}})]})]}),cK=({value:e,onChange:t,fallback:n})=>{const[r,s]=x.useState(!1);return p.jsxs(oK,{open:r,onOpenChange:s,children:[p.jsx(lK,{asChild:!0,children:p.jsx("button",{type:"button",className:"flex items-center justify-center text-muted-foreground transition-colors hover:text-foreground",children:e?p.jsx("span",{className:"text-base",children:e}):n})}),p.jsx(aK,{className:"w-auto p-0",align:"start",children:p.jsx(uK,{onSelect:i=>{t(i),s(!1)}})})]})};var oO;const Sa=!!((oO=window.electronAPI)!=null&&oO.pickDirectory),jx="h-9 flex-1 rounded-md border border-input bg-background px-3 text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",dK=({controller:e})=>{const{open:t,setOpen:n}=e,{setActiveProjectId:r}=Ht(),[s,i]=x.useState(""),[o,l]=x.useState(null),[a,u]=x.useState([]),[c,d]=x.useState([]),[h,f]=x.useState(""),m=nt.useUtils(),g=nt.projects.create.useMutation({onSuccess:T=>{m.projects.list.invalidate(),n(!1),r(T.id)},onError:T=>f(T.message)});x.useEffect(()=>{t&&(i(""),l(null),u([]),d([]),f(""))},[t]);const v=x.useMemo(()=>{const T=s.trim().toLowerCase();return T?T.replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,100):""},[s]),y=()=>{!v||c.length===0||c.some(T=>!T.trim())||(f(""),g.mutate({id:v,name:s.trim(),docsDirs:c.map(T=>T.trim()),rootDirs:a.length>0?a.map(T=>T.trim()):void 0,emoji:o}))},w=x.useCallback(async(T,j)=>{const A=await window.electronAPI.pickDirectory();A&&T(z=>z.map((D,L)=>L===j?A:D))},[]),b=x.useCallback(async()=>{if(Sa){const T=await window.electronAPI.pickDirectory();if(!T)return;u(j=>[...j,T]),d(j=>j.length===0?[T+"/docs"]:j)}else u(T=>[...T,""])},[]),C=x.useCallback(async()=>{if(Sa){const T=await window.electronAPI.pickDirectory();if(!T)return;d(j=>[...j,T])}else d(T=>[...T,""])},[]),S=x.useCallback((T,j)=>{T(A=>A.filter((z,D)=>D!==j))},[]),k=x.useCallback((T,j,A)=>{T(z=>z.map((D,L)=>L===j?A:D))},[]),E=a.length>0,N=c.length>0,O=!!v&&c.length>0&&c.every(T=>T.trim())&&!g.isPending;return p.jsx(el,{open:t,onOpenChange:n,children:p.jsxs(Ii,{children:[p.jsxs(tl,{children:[p.jsx(nl,{children:"Create new project"}),p.jsx(If,{children:"Add a new project to your Hyperdoc workspace."})]}),p.jsxs("div",{className:"space-y-3 pt-2",children:[p.jsxs("div",{className:"flex flex-col gap-1 text-sm",children:[p.jsx("span",{className:"text-muted-foreground",children:"Name"}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(cK,{value:o,onChange:l,fallback:p.jsx(l6,{className:"h-5 w-5"})}),p.jsx("input",{className:jx,value:s,onChange:T=>i(T.target.value),placeholder:"My Project"})]})]}),p.jsxs("div",{className:"flex flex-col gap-1 text-sm",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-muted-foreground",children:"Root path"}),E&&p.jsxs(ae,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-2 text-xs text-muted-foreground",onClick:b,children:[p.jsx($n,{className:"h-3 w-3"})," Add"]})]}),a.map((T,j)=>p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{className:jx,value:T,onChange:A=>k(u,j,A.target.value),placeholder:"/path/to/project",readOnly:Sa}),Sa&&p.jsx(ae,{type:"button",variant:"outline",size:"icon",className:"h-9 w-9 shrink-0",onClick:()=>w(u,j),children:p.jsx(im,{className:"h-4 w-4"})}),p.jsx(ae,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-muted-foreground",onClick:()=>S(u,j),children:p.jsx(Gr,{className:"h-4 w-4"})})]},j)),!E&&p.jsxs(ae,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1 self-start text-xs",onClick:b,children:[p.jsx($n,{className:"h-3 w-3"})," Add root path"]})]}),E&&p.jsxs("div",{className:"flex flex-col gap-1 text-sm",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-muted-foreground",children:"Docs path"}),N&&p.jsxs(ae,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-2 text-xs text-muted-foreground",onClick:C,children:[p.jsx($n,{className:"h-3 w-3"})," Add"]})]}),c.map((T,j)=>p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{className:jx,value:T,onChange:A=>k(d,j,A.target.value),placeholder:"/path/to/project/docs",readOnly:Sa}),Sa&&p.jsx(ae,{type:"button",variant:"outline",size:"icon",className:"h-9 w-9 shrink-0",onClick:()=>w(d,j),children:p.jsx(im,{className:"h-4 w-4"})}),c.length>1&&p.jsx(ae,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-muted-foreground",onClick:()=>S(d,j),children:p.jsx(Gr,{className:"h-4 w-4"})})]},j)),!N&&p.jsxs(ae,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1 self-start text-xs",onClick:C,children:[p.jsx($n,{className:"h-3 w-3"})," Add docs path"]}),p.jsx("span",{className:"text-xs text-muted-foreground",children:"Where your Hyperdoc documents live."})]}),h?p.jsx("div",{className:"text-sm text-destructive",children:h}):null]}),p.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[p.jsx(ae,{type:"button",variant:"ghost",onClick:()=>n(!1),children:"Cancel"}),p.jsx(ae,{type:"button",disabled:!O,onClick:y,children:g.isPending?"Creating…":"Create"})]})]})})};function fK({status:e,onManualSave:t,errorMessage:n}){return n?p.jsxs("span",{className:"group relative inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive","aria-live":"polite",title:"Save error",children:[p.jsx(ZH,{className:"h-4 w-4"}),p.jsx("span",{className:"text-[11px] font-medium",children:"Save error"}),p.jsx("span",{className:"pointer-events-none absolute left-full ml-2 w-64 rounded-md border border-border bg-popover px-2 py-1 text-[11px] text-foreground opacity-0 shadow-sm transition-opacity group-hover:opacity-100",children:n})]}):e==="saving"?p.jsxs("span",{className:"group relative inline-flex items-center text-muted-foreground/70","aria-live":"polite",title:"Saving",children:[p.jsx(om,{className:"h-4 w-4 animate-spin text-emerald-400/80"}),p.jsx("span",{className:"pointer-events-none absolute left-full ml-2 rounded-md border border-border bg-popover px-2 py-1 text-[11px] text-foreground opacity-0 shadow-sm transition-opacity group-hover:opacity-100",children:"Saving"})]}):p.jsxs("span",{className:"group relative inline-flex items-center text-muted-foreground/70","aria-live":"polite",title:e==="idle"?"No changes":"Saved",children:[p.jsx(Af,{className:"h-4 w-4 text-emerald-400/80"}),p.jsx("span",{className:"pointer-events-none absolute left-full ml-2 rounded-md border border-border bg-popover px-2 py-1 text-[11px] text-foreground opacity-0 shadow-sm transition-opacity group-hover:opacity-100",children:e==="idle"?"No changes":"Saved"})]})}const yI=()=>{const{docHeader:e}=Tr(),{active:t,save:n,saveStatus:r,status:s,conflict:i,openMetadataDialog:o,runCommandAction:l,pinDocCommand:a,archiveDocCommand:u,deleteDocCommand:c}=e,d=!!t,h=()=>{n().catch(()=>{})},f=x.useMemo(()=>{if(t)return()=>l(a)},[t,a,l]),m=x.useMemo(()=>{if(t)return()=>l(u)},[t,u,l]),g=x.useMemo(()=>{if(t)return()=>l(c)},[t,c,l]),v=x.useMemo(()=>{if(!t)return"";const y=t.name;return y.includes("/")?y.slice(y.lastIndexOf("/")+1):y},[t]);return{docType:(t==null?void 0:t.type)??null,fileName:v,isPinned:(t==null?void 0:t.pinned)??!1,saveStatus:r,errorStatus:s,conflict:i,showMetadataButton:d,onShowMetadata:o,onManualSave:h,onTogglePinned:f,onArchive:m,onDelete:g}},DN=({label:e,fileName:t})=>{const[n,r]=x.useState(!1),s=x.useCallback(()=>{navigator.clipboard.writeText(t).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})},[t]);return p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),p.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-muted px-2 py-1 font-mono text-xs text-foreground",children:[t,p.jsx("button",{type:"button",className:"ml-0.5 text-muted-foreground hover:text-foreground",onClick:s,title:"Copy to clipboard",children:n?p.jsx(Af,{className:"h-3 w-3 text-neon-green-strong"}):p.jsx(sU,{className:"h-3 w-3"})})]})]})},hK=({nextFileName:e})=>{const{fileName:t,isPinned:n,onTogglePinned:r,onArchive:s,onDelete:i,showMetadataButton:o,onShowMetadata:l,saveStatus:a,onManualSave:u,errorStatus:c}=yI();return p.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[p.jsxs("div",{className:"flex",children:[r?p.jsx(ae,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-md bg-transparent",onClick:r,"aria-label":n?"Unpin document":"Pin document",title:n?"Unpin":"Pin",children:p.jsx(UA,{className:`h-4 w-4 ${n?"text-foreground":"text-muted-foreground"}`})}):null,s?p.jsx(ae,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-md bg-transparent",onClick:s,"aria-label":"Archive document",title:"Archive",children:p.jsx(rm,{className:"h-4 w-4 text-muted-foreground"})}):null,i?p.jsx(ae,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-md bg-transparent",onClick:i,"aria-label":"Delete document",title:"Delete",children:p.jsx(ic,{className:"h-4 w-4 text-muted-foreground"})}):null,o?p.jsx(ae,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-md bg-transparent opacity-60 hover:bg-transparent hover:opacity-100",onClick:l,"aria-label":"Show document info",title:"Show document info",children:p.jsx(BA,{className:"h-4 w-4"})}):null]}),p.jsx("span",{className:"h-5 w-px bg-border/70","aria-hidden":"true"}),p.jsx(fK,{status:a,onManualSave:u,errorMessage:c}),p.jsx("span",{className:"h-5 w-px bg-border/70","aria-hidden":"true"}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[t?p.jsx(DN,{label:e?"Current":"File",fileName:t}):p.jsx("span",{children:"No file name yet"}),e?p.jsx(DN,{label:"New",fileName:e}):null]})]})},pK=()=>{const{docHeader:e}=Tr(),{availableHeaderTags:t,headerTags:n,applyHeaderTags:r}=e,s=x.useMemo(()=>n??[],[n]);return{availableTags:x.useMemo(()=>t??[],[t]),selectedTags:s,applyHeaderTags:r}},mK=()=>{const{selectedTags:e,availableTags:t,applyHeaderTags:n}=pK(),[r,s]=x.useState(!1),[i,o]=x.useState(""),[l,a]=x.useState(""),[u,c]=x.useState([]);x.useEffect(()=>{if(!r){o(""),a(""),c([]);return}c(e)},[r,e]);const d=x.useMemo(()=>t.filter(v=>!u.includes(v)),[t,u]),h=v=>{const y=v.trim().toLowerCase();return!y||!/^[a-z]+$/.test(y)?"":y},f=()=>{const v=h(i);if(!v){a("Tags must be lowercase letters only.");return}c(y=>y.includes(v)?y:[...y,v].sort()),o(""),a("")},m=v=>{c(y=>y.includes(v)?y.filter(w=>w!==v):[...y,v].sort())},g=async()=>{await n(u)&&s(!1)};return p.jsxs("div",{className:"flex flex-col gap-2 px-4 py-3 text-sm md:w-[320px] md:pl-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Tags"}),p.jsx(ae,{type:"button",size:"xs",variant:"ghost",onClick:()=>s(!0),children:"Edit"})]}),e.length?p.jsx("div",{className:"flex flex-wrap gap-2",children:e.map(v=>p.jsx("span",{className:"rounded-full border border-border bg-muted px-2.5 py-1 text-[11px] text-muted-foreground",children:v},v))}):p.jsx("span",{className:"text-xs text-muted-foreground",children:"No tags yet."}),p.jsx(el,{open:r,onOpenChange:s,children:p.jsxs(Ii,{className:"max-w-xl",children:[p.jsxs(tl,{className:"text-left",children:[p.jsx(nl,{children:"Edit tags"}),p.jsx(If,{children:"Add new tags or pick from existing ones."})]}),p.jsxs("div",{className:"mt-4 space-y-4",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("input",{className:"h-8 w-full min-w-[160px] flex-1 rounded-md border border-input bg-background px-2 text-xs focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:i,onChange:v=>{o(v.target.value),l&&a("")},placeholder:"Add a tag"}),p.jsx(ae,{type:"button",size:"sm",variant:"outline",onClick:f,disabled:!i.trim(),children:"Add"}),l?p.jsx("span",{className:"text-xs text-destructive",children:l}):null]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Selected"}),u.length?p.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(v=>p.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-full border border-border bg-muted px-2.5 py-1 text-[11px] text-muted-foreground transition-colors hover:border-destructive/50 hover:text-destructive",onClick:()=>m(v),"aria-label":`Remove tag ${v}`,children:[p.jsx("span",{children:v}),p.jsx(Gr,{className:"h-3 w-3"})]},v))}):p.jsx("span",{className:"text-xs text-muted-foreground",children:"No tags yet."})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Suggestions"}),d.length?p.jsx("div",{className:"flex flex-wrap gap-2",children:d.map(v=>p.jsx("button",{type:"button",className:"rounded-full border border-border bg-muted px-2.5 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary/40 hover:bg-primary/10 hover:text-primary",onClick:()=>m(v),children:v},v))}):p.jsx("span",{className:"text-xs text-muted-foreground",children:"No suggestions yet."})]}),p.jsxs("div",{className:"flex items-center justify-end gap-2",children:[p.jsx(ae,{type:"button",variant:"ghost",onClick:()=>s(!1),children:"Cancel"}),p.jsx(ae,{type:"button",onClick:g,children:"Save"})]})]})]})})]})};function gK({value:e,onChange:t,onConfirm:n,onCancel:r,showActions:s,inputRef:i,disabled:o}){return p.jsx("div",{className:"flex min-w-[220px] flex-1 flex-col gap-2",children:p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("input",{ref:i,className:"min-w-[160px] flex-1 border-b border-dashed border-muted-foreground/60 bg-transparent text-lg font-semibold text-foreground outline-none transition-colors focus:border-foreground",value:e,onChange:l=>t(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),n==null||n()),l.key==="Escape"&&(l.preventDefault(),r==null||r())},placeholder:"Untitled","aria-label":"Document name",disabled:o}),s?p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(ae,{type:"button",size:"xs",onClick:n,children:"Confirm"}),p.jsx(ae,{type:"button",size:"xs",variant:"ghost",onClick:r,children:"Cancel"})]}):null]})})}const yK=e=>{const{draftTitle:t,onDraftTitleChange:n,onConfirmRename:r,onCancelRename:s,showActions:i,inputRef:o,disabled:l}=e;return p.jsx(gK,{value:t,onChange:n,onConfirm:r,onCancel:s,showActions:i,inputRef:o,disabled:l})},xK=()=>{const{docHeader:e}=Tr(),{active:t,activeTitleLabel:n,titleInputRef:r,deriveFileName:s,renameDoc:i}=e,o=(t==null?void 0:t.type)??null,l=(t==null?void 0:t.name)??"",a=x.useMemo(()=>{if(t)return c=>s(c,t.type)},[t,s]);return{docType:o,title:n,titleInputRef:r,deriveFileName:a,onTitleChange:c=>{i(c).catch(()=>{})},fileName:l}};function vK(){const{docType:e,title:t,titleInputRef:n,deriveFileName:r,onTitleChange:s,fileName:i}=xK(),{conflict:o}=yI(),l=!!e,[a,u]=x.useState(t),c=y=>{const w=y.replace(/[^a-zA-Z\s-]/g,"").replace(/ {2,}/g," ");if(!w)return u("");u(w.charAt(0).toUpperCase()+w.slice(1).toLowerCase())},d=a!==t,h=x.useMemo(()=>r==null?void 0:r(a),[r,a]),m=!!(d&&h&&h!==i)?h:void 0;x.useEffect(()=>{u(t)},[t]);const g=()=>{d&&s(a)},v=()=>{u(t)};return p.jsx("section",{className:"border border-border bg-card",children:p.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-stretch md:gap-0",children:[p.jsxs("div",{className:"flex flex-col gap-2 px-4 py-3 md:flex-1 md:pr-4 md:border-r md:border-border",children:[p.jsx(yK,{draftTitle:a,onDraftTitleChange:c,onConfirmRename:g,onCancelRename:v,showActions:d,inputRef:n,disabled:!e}),p.jsx(hK,{nextFileName:m}),o?p.jsx("span",{className:"text-xs text-destructive",children:"File changed on disk. Reload or save to override."}):null]}),l?p.jsx(mK,{}):null]})})}function wK({bundleUrl:e,cssUrl:t,mountId:n,bundleType:r="classic",backgroundColor:s,projectId:i}){const[o,l]=x.useState("loading"),a=x.useMemo(()=>{const u=new URLSearchParams({bundle:e,mount:n});return t&&u.set("css",t),r==="module"&&u.set("type","module"),s&&u.set("bg",s),`/api/projects/${i}/app-frame?${u}`},[e,t,n,r,s,i]);return p.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-2",children:[o==="loading"&&p.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading bundle..."}),o==="error"&&p.jsx("div",{className:"text-xs text-destructive",children:"Failed to load app frame"}),p.jsx("iframe",{src:a,onLoad:()=>l("ready"),onError:()=>l("error"),className:"min-h-0 flex-1 border-0",style:s?{backgroundColor:s}:void 0,title:"App"})]})}const bK=({docName:e})=>{const{main:{appConfig:t,appConfigError:n}}=Tr(),{activeProject:r}=Ht();return p.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3",children:[p.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["Bundle: ",t!=null&&t.bundleUrl?t.bundleUrl:"—"]}),t&&!n&&r?p.jsx(wK,{bundleUrl:t.bundleUrl,cssUrl:t.cssUrl,mountId:t.mountId,bundleType:t.bundleType,backgroundColor:t.backgroundColor,projectId:r.id}):p.jsx("div",{className:"rounded-md border border-dashed border-border bg-card p-4 text-sm text-muted-foreground",children:n||"Add a bundleUrl and mountId to render."})]})},kK=({open:e,onOpenChange:t})=>{const{main:{addTableColumn:n,parseColumnOptions:r}}=Tr(),[s,i]=x.useState(""),[o,l]=x.useState("text"),[a,u]=x.useState(""),[c,d]=x.useState(""),h=x.useMemo(()=>r(a),[a,r]),f=g=>{g||t(!1)},m=()=>{const g=s.trim();if(!g){d("Column name is required.");return}if(o==="select"&&h.length===0){d("Select columns need at least one option.");return}n({name:g,type:o,options:o==="select"?h:void 0}),t(!1)};return p.jsx(el,{open:e,onOpenChange:f,children:p.jsxs(Ii,{children:[p.jsx(tl,{children:p.jsx(nl,{children:"Add property"})}),p.jsxs("div",{className:"mt-4 space-y-4 text-sm",children:[p.jsxs("label",{className:"flex flex-col gap-1",children:[p.jsx("span",{className:"text-xs text-muted-foreground",children:"Name"}),p.jsx("input",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:s,onChange:g=>{i(g.target.value),c&&d("")},placeholder:"Status"})]}),p.jsxs("label",{className:"flex flex-col gap-1",children:[p.jsx("span",{className:"text-xs text-muted-foreground",children:"Type"}),p.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:o,onChange:g=>{l(g.target.value),c&&d("")},children:[p.jsx("option",{value:"text",children:"Text"}),p.jsx("option",{value:"select",children:"Select"})]})]}),o==="select"?p.jsxs("label",{className:"flex flex-col gap-1",children:[p.jsx("span",{className:"text-xs text-muted-foreground",children:"Options (comma-separated)"}),p.jsx("input",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:a,onChange:g=>{u(g.target.value),c&&d("")},placeholder:"Todo, In progress, Done"})]}):null,c?p.jsx("div",{className:"text-xs text-destructive",children:c}):null,p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx(ae,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),p.jsx(ae,{type:"button",onClick:m,children:"Add"})]})]})]})})};/**
|
|
458
|
+
* table-core
|
|
459
|
+
*
|
|
460
|
+
* Copyright (c) TanStack
|
|
461
|
+
*
|
|
462
|
+
* This source code is licensed under the MIT license found in the
|
|
463
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
464
|
+
*
|
|
465
|
+
* @license MIT
|
|
466
|
+
*/function go(e,t){return typeof e=="function"?e(t):e}function Sr(e,t){return n=>{t.setState(r=>({...r,[e]:go(n,r[e])}))}}function ty(e){return e instanceof Function}function SK(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function xI(e,t){const n=[],r=s=>{s.forEach(i=>{n.push(i);const o=t(i);o!=null&&o.length&&r(o)})};return r(e),n}function Re(e,t,n){let r=[],s;return i=>{let o;n.key&&n.debug&&(o=Date.now());const l=e(i);if(!(l.length!==r.length||l.some((c,d)=>r[d]!==c)))return s;r=l;let u;if(n.key&&n.debug&&(u=Date.now()),s=t(...l),n==null||n.onChange==null||n.onChange(s),n.key&&n.debug&&n!=null&&n.debug()){const c=Math.round((Date.now()-o)*100)/100,d=Math.round((Date.now()-u)*100)/100,h=d/16,f=(m,g)=>{for(m=String(m);m.length<g;)m=" "+m;return m};console.info(`%c⏱ ${f(d,5)} /${f(c,5)} ms`,`
|
|
467
|
+
font-size: .6rem;
|
|
468
|
+
font-weight: bold;
|
|
469
|
+
color: hsl(${Math.max(0,Math.min(120-120*h,120))}deg 100% 31%);`,n==null?void 0:n.key)}return s}}function Me(e,t,n,r){return{debug:()=>{var s;return(s=e==null?void 0:e.debugAll)!=null?s:e[t]},key:!1,onChange:r}}function CK(e,t,n,r){const s=()=>{var o;return(o=i.getValue())!=null?o:e.options.renderFallbackValue},i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:s,getContext:Re(()=>[e,n,t,i],(o,l,a,u)=>({table:o,column:l,row:a,cell:u,getValue:u.getValue,renderValue:u.renderValue}),Me(e.options,"debugCells"))};return e._features.forEach(o=>{o.createCell==null||o.createCell(i,n,t,e)},{}),i}function EK(e,t,n,r){var s,i;const l={...e._getDefaultColumnDef(),...t},a=l.accessorKey;let u=(s=(i=l.id)!=null?i:a?typeof String.prototype.replaceAll=="function"?a.replaceAll(".","_"):a.replace(/\./g,"_"):void 0)!=null?s:typeof l.header=="string"?l.header:void 0,c;if(l.accessorFn?c=l.accessorFn:a&&(a.includes(".")?c=h=>{let f=h;for(const g of a.split(".")){var m;f=(m=f)==null?void 0:m[g]}return f}:c=h=>h[l.accessorKey]),!u)throw new Error;let d={id:`${String(u)}`,accessorFn:c,parent:r,depth:n,columnDef:l,columns:[],getFlatColumns:Re(()=>[!0],()=>{var h;return[d,...(h=d.columns)==null?void 0:h.flatMap(f=>f.getFlatColumns())]},Me(e.options,"debugColumns")),getLeafColumns:Re(()=>[e._getOrderColumnsFn()],h=>{var f;if((f=d.columns)!=null&&f.length){let m=d.columns.flatMap(g=>g.getLeafColumns());return h(m)}return[d]},Me(e.options,"debugColumns"))};for(const h of e._features)h.createColumn==null||h.createColumn(d,e);return d}const Sn="debugHeaders";function LN(e,t,n){var r;let i={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const o=[],l=a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders.map(l),o.push(a)};return l(i),o},getContext:()=>({table:e,header:i,column:t})};return e._features.forEach(o=>{o.createHeader==null||o.createHeader(i,e)}),i}const NK={createTable:e=>{e.getHeaderGroups=Re(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,s)=>{var i,o;const l=(i=r==null?void 0:r.map(d=>n.find(h=>h.id===d)).filter(Boolean))!=null?i:[],a=(o=s==null?void 0:s.map(d=>n.find(h=>h.id===d)).filter(Boolean))!=null?o:[],u=n.filter(d=>!(r!=null&&r.includes(d.id))&&!(s!=null&&s.includes(d.id)));return Eh(t,[...l,...u,...a],e)},Me(e.options,Sn)),e.getCenterHeaderGroups=Re(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,s)=>(n=n.filter(i=>!(r!=null&&r.includes(i.id))&&!(s!=null&&s.includes(i.id))),Eh(t,n,e,"center")),Me(e.options,Sn)),e.getLeftHeaderGroups=Re(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var s;const i=(s=r==null?void 0:r.map(o=>n.find(l=>l.id===o)).filter(Boolean))!=null?s:[];return Eh(t,i,e,"left")},Me(e.options,Sn)),e.getRightHeaderGroups=Re(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var s;const i=(s=r==null?void 0:r.map(o=>n.find(l=>l.id===o)).filter(Boolean))!=null?s:[];return Eh(t,i,e,"right")},Me(e.options,Sn)),e.getFooterGroups=Re(()=>[e.getHeaderGroups()],t=>[...t].reverse(),Me(e.options,Sn)),e.getLeftFooterGroups=Re(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),Me(e.options,Sn)),e.getCenterFooterGroups=Re(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),Me(e.options,Sn)),e.getRightFooterGroups=Re(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),Me(e.options,Sn)),e.getFlatHeaders=Re(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),Me(e.options,Sn)),e.getLeftFlatHeaders=Re(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),Me(e.options,Sn)),e.getCenterFlatHeaders=Re(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),Me(e.options,Sn)),e.getRightFlatHeaders=Re(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),Me(e.options,Sn)),e.getCenterLeafHeaders=Re(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Me(e.options,Sn)),e.getLeftLeafHeaders=Re(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Me(e.options,Sn)),e.getRightLeafHeaders=Re(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Me(e.options,Sn)),e.getLeafHeaders=Re(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var s,i,o,l,a,u;return[...(s=(i=t[0])==null?void 0:i.headers)!=null?s:[],...(o=(l=n[0])==null?void 0:l.headers)!=null?o:[],...(a=(u=r[0])==null?void 0:u.headers)!=null?a:[]].map(c=>c.getLeafHeaders()).flat()},Me(e.options,Sn))}};function Eh(e,t,n,r){var s,i;let o=0;const l=function(h,f){f===void 0&&(f=1),o=Math.max(o,f),h.filter(m=>m.getIsVisible()).forEach(m=>{var g;(g=m.columns)!=null&&g.length&&l(m.columns,f+1)},0)};l(e);let a=[];const u=(h,f)=>{const m={depth:f,id:[r,`${f}`].filter(Boolean).join("_"),headers:[]},g=[];h.forEach(v=>{const y=[...g].reverse()[0],w=v.column.depth===m.depth;let b,C=!1;if(w&&v.column.parent?b=v.column.parent:(b=v.column,C=!0),y&&(y==null?void 0:y.column)===b)y.subHeaders.push(v);else{const S=LN(n,b,{id:[r,f,b.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:C,placeholderId:C?`${g.filter(k=>k.column===b).length}`:void 0,depth:f,index:g.length});S.subHeaders.push(v),g.push(S)}m.headers.push(v),v.headerGroup=m}),a.push(m),f>0&&u(g,f-1)},c=t.map((h,f)=>LN(n,h,{depth:o,index:f}));u(c,o-1),a.reverse();const d=h=>h.filter(m=>m.column.getIsVisible()).map(m=>{let g=0,v=0,y=[0];m.subHeaders&&m.subHeaders.length?(y=[],d(m.subHeaders).forEach(b=>{let{colSpan:C,rowSpan:S}=b;g+=C,y.push(S)})):g=1;const w=Math.min(...y);return v=v+w,m.colSpan=g,m.rowSpan=v,{colSpan:g,rowSpan:v}});return d((s=(i=a[0])==null?void 0:i.headers)!=null?s:[]),a}const ny=(e,t,n,r,s,i,o)=>{let l={id:t,index:r,original:n,depth:s,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:a=>{if(l._valuesCache.hasOwnProperty(a))return l._valuesCache[a];const u=e.getColumn(a);if(u!=null&&u.accessorFn)return l._valuesCache[a]=u.accessorFn(l.original,r),l._valuesCache[a]},getUniqueValues:a=>{if(l._uniqueValuesCache.hasOwnProperty(a))return l._uniqueValuesCache[a];const u=e.getColumn(a);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(l._uniqueValuesCache[a]=u.columnDef.getUniqueValues(l.original,r),l._uniqueValuesCache[a]):(l._uniqueValuesCache[a]=[l.getValue(a)],l._uniqueValuesCache[a])},renderValue:a=>{var u;return(u=l.getValue(a))!=null?u:e.options.renderFallbackValue},subRows:i??[],getLeafRows:()=>xI(l.subRows,a=>a.subRows),getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let a=[],u=l;for(;;){const c=u.getParentRow();if(!c)break;a.push(c),u=c}return a.reverse()},getAllCells:Re(()=>[e.getAllLeafColumns()],a=>a.map(u=>CK(e,l,u,u.id)),Me(e.options,"debugRows")),_getAllCellsByColumnId:Re(()=>[l.getAllCells()],a=>a.reduce((u,c)=>(u[c.column.id]=c,u),{}),Me(e.options,"debugRows"))};for(let a=0;a<e._features.length;a++){const u=e._features[a];u==null||u.createRow==null||u.createRow(l,e)}return l},TK={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},vI=(e,t,n)=>{var r,s;const i=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((s=e.getValue(t))==null||(s=s.toString())==null||(s=s.toLowerCase())==null)&&s.includes(i))};vI.autoRemove=e=>ys(e);const wI=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};wI.autoRemove=e=>ys(e);const bI=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===(n==null?void 0:n.toLowerCase())};bI.autoRemove=e=>ys(e);const kI=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};kI.autoRemove=e=>ys(e);const SI=(e,t,n)=>!n.some(r=>{var s;return!((s=e.getValue(t))!=null&&s.includes(r))});SI.autoRemove=e=>ys(e)||!(e!=null&&e.length);const CI=(e,t,n)=>n.some(r=>{var s;return(s=e.getValue(t))==null?void 0:s.includes(r)});CI.autoRemove=e=>ys(e)||!(e!=null&&e.length);const EI=(e,t,n)=>e.getValue(t)===n;EI.autoRemove=e=>ys(e);const NI=(e,t,n)=>e.getValue(t)==n;NI.autoRemove=e=>ys(e);const f1=(e,t,n)=>{let[r,s]=n;const i=e.getValue(t);return i>=r&&i<=s};f1.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,s=typeof n!="number"?parseFloat(n):n,i=t===null||Number.isNaN(r)?-1/0:r,o=n===null||Number.isNaN(s)?1/0:s;if(i>o){const l=i;i=o,o=l}return[i,o]};f1.autoRemove=e=>ys(e)||ys(e[0])&&ys(e[1]);const ui={includesString:vI,includesStringSensitive:wI,equalsString:bI,arrIncludes:kI,arrIncludesAll:SI,arrIncludesSome:CI,equals:EI,weakEquals:NI,inNumberRange:f1};function ys(e){return e==null||e===""}const RK={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Sr("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);return typeof r=="string"?ui.includesString:typeof r=="number"?ui.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?ui.equals:Array.isArray(r)?ui.arrIncludes:ui.weakEquals},e.getFilterFn=()=>{var n,r;return ty(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:ui[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,s;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((s=t.options.enableFilters)!=null?s:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(s=>s.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const s=e.getFilterFn(),i=r==null?void 0:r.find(c=>c.id===e.id),o=go(n,i?i.value:void 0);if($N(s,o,e)){var l;return(l=r==null?void 0:r.filter(c=>c.id!==e.id))!=null?l:[]}const a={id:e.id,value:o};if(i){var u;return(u=r==null?void 0:r.map(c=>c.id===e.id?a:c))!=null?u:[]}return r!=null&&r.length?[...r,a]:[a]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=s=>{var i;return(i=go(t,s))==null?void 0:i.filter(o=>{const l=n.find(a=>a.id===o.id);if(l){const a=l.getFilterFn();if($N(a,o.value,l))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function $N(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const MK=(e,t,n)=>n.reduce((r,s)=>{const i=s.getValue(e);return r+(typeof i=="number"?i:0)},0),OK=(e,t,n)=>{let r;return n.forEach(s=>{const i=s.getValue(e);i!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}),r},jK=(e,t,n)=>{let r;return n.forEach(s=>{const i=s.getValue(e);i!=null&&(r<i||r===void 0&&i>=i)&&(r=i)}),r},PK=(e,t,n)=>{let r,s;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r===void 0?o>=o&&(r=s=o):(r>o&&(r=o),s<o&&(s=o)))}),[r,s]},AK=(e,t)=>{let n=0,r=0;if(t.forEach(s=>{let i=s.getValue(e);i!=null&&(i=+i)>=i&&(++n,r+=i)}),n)return r/n},_K=(e,t)=>{if(!t.length)return;const n=t.map(i=>i.getValue(e));if(!SK(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),s=n.sort((i,o)=>i-o);return n.length%2!==0?s[r]:(s[r-1]+s[r])/2},IK=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),DK=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,LK=(e,t)=>t.length,Px={sum:MK,min:OK,max:jK,extent:PK,mean:AK,median:_K,unique:IK,uniqueCount:DK,count:LK},$K={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Sr("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((r=t.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);if(typeof r=="number")return Px.sum;if(Object.prototype.toString.call(r)==="[object Date]")return Px.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return ty(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:Px[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var s;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((s=n.subRows)!=null&&s.length)}}};function zK(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(i=>!t.includes(i.id));return n==="remove"?r:[...t.map(i=>e.find(o=>o.id===i)).filter(Boolean),...r]}const FK={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Sr("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Re(n=>[ad(t,n)],n=>n.findIndex(r=>r.id===e.id),Me(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=ad(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const s=ad(t,n);return((r=s[s.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=Re(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>s=>{let i=[];if(!(t!=null&&t.length))i=s;else{const o=[...t],l=[...s];for(;l.length&&o.length;){const a=o.shift(),u=l.findIndex(c=>c.id===a);u>-1&&i.push(l.splice(u,1)[0])}i=[...i,...l]}return zK(i,n,r)},Me(e.options,"debugTable"))}},Ax=()=>({left:[],right:[]}),BK={getInitialState:e=>({columnPinning:Ax(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Sr("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(s=>s.id).filter(Boolean);t.setColumnPinning(s=>{var i,o;if(n==="right"){var l,a;return{left:((l=s==null?void 0:s.left)!=null?l:[]).filter(d=>!(r!=null&&r.includes(d))),right:[...((a=s==null?void 0:s.right)!=null?a:[]).filter(d=>!(r!=null&&r.includes(d))),...r]}}if(n==="left"){var u,c;return{left:[...((u=s==null?void 0:s.left)!=null?u:[]).filter(d=>!(r!=null&&r.includes(d))),...r],right:((c=s==null?void 0:s.right)!=null?c:[]).filter(d=>!(r!=null&&r.includes(d)))}}return{left:((i=s==null?void 0:s.left)!=null?i:[]).filter(d=>!(r!=null&&r.includes(d))),right:((o=s==null?void 0:s.right)!=null?o:[]).filter(d=>!(r!=null&&r.includes(d)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var s,i,o;return((s=r.columnDef.enablePinning)!=null?s:!0)&&((i=(o=t.options.enableColumnPinning)!=null?o:t.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(l=>l.id),{left:r,right:s}=t.getState().columnPinning,i=n.some(l=>r==null?void 0:r.includes(l)),o=n.some(l=>s==null?void 0:s.includes(l));return i?"left":o?"right":!1},e.getPinnedIndex=()=>{var n,r;const s=e.getIsPinned();return s?(n=(r=t.getState().columnPinning)==null||(r=r[s])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Re(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,s)=>{const i=[...r??[],...s??[]];return n.filter(o=>!i.includes(o.column.id))},Me(t.options,"debugRows")),e.getLeftVisibleCells=Re(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(i=>n.find(o=>o.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),Me(t.options,"debugRows")),e.getRightVisibleCells=Re(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(i=>n.find(o=>o.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),Me(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?Ax():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:Ax())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var s,i;return!!((s=r.left)!=null&&s.length||(i=r.right)!=null&&i.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=Re(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(s=>s.id===r)).filter(Boolean),Me(e.options,"debugColumns")),e.getRightLeafColumns=Re(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(s=>s.id===r)).filter(Boolean),Me(e.options,"debugColumns")),e.getCenterLeafColumns=Re(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const s=[...n??[],...r??[]];return t.filter(i=>!s.includes(i.id))},Me(e.options,"debugColumns"))}};function VK(e){return e||(typeof document<"u"?document:null)}const Nh={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},_x=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),HK={getDefaultColumnDef:()=>Nh,getInitialState:e=>({columnSizing:{},columnSizingInfo:_x(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Sr("columnSizing",e),onColumnSizingInfoChange:Sr("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,s;const i=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:Nh.minSize,(r=i??e.columnDef.size)!=null?r:Nh.size),(s=e.columnDef.maxSize)!=null?s:Nh.maxSize)},e.getStart=Re(n=>[n,ad(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((s,i)=>s+i.getSize(),0),Me(t.options,"debugColumns")),e.getAfter=Re(n=>[n,ad(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((s,i)=>s+i.getSize(),0),Me(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...s}=n;return s})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=s=>{if(s.subHeaders.length)s.subHeaders.forEach(r);else{var i;n+=(i=s.column.getSize())!=null?i:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),s=r==null?void 0:r.getCanResize();return i=>{if(!r||!s||(i.persist==null||i.persist(),Ix(i)&&i.touches&&i.touches.length>1))return;const o=e.getSize(),l=e?e.getLeafHeaders().map(y=>[y.column.id,y.column.getSize()]):[[r.id,r.getSize()]],a=Ix(i)?Math.round(i.touches[0].clientX):i.clientX,u={},c=(y,w)=>{typeof w=="number"&&(t.setColumnSizingInfo(b=>{var C,S;const k=t.options.columnResizeDirection==="rtl"?-1:1,E=(w-((C=b==null?void 0:b.startOffset)!=null?C:0))*k,N=Math.max(E/((S=b==null?void 0:b.startSize)!=null?S:0),-.999999);return b.columnSizingStart.forEach(O=>{let[T,j]=O;u[T]=Math.round(Math.max(j+j*N,0)*100)/100}),{...b,deltaOffset:E,deltaPercentage:N}}),(t.options.columnResizeMode==="onChange"||y==="end")&&t.setColumnSizing(b=>({...b,...u})))},d=y=>c("move",y),h=y=>{c("end",y),t.setColumnSizingInfo(w=>({...w,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},f=VK(n),m={moveHandler:y=>d(y.clientX),upHandler:y=>{f==null||f.removeEventListener("mousemove",m.moveHandler),f==null||f.removeEventListener("mouseup",m.upHandler),h(y.clientX)}},g={moveHandler:y=>(y.cancelable&&(y.preventDefault(),y.stopPropagation()),d(y.touches[0].clientX),!1),upHandler:y=>{var w;f==null||f.removeEventListener("touchmove",g.moveHandler),f==null||f.removeEventListener("touchend",g.upHandler),y.cancelable&&(y.preventDefault(),y.stopPropagation()),h((w=y.touches[0])==null?void 0:w.clientX)}},v=UK()?{passive:!1}:!1;Ix(i)?(f==null||f.addEventListener("touchmove",g.moveHandler,v),f==null||f.addEventListener("touchend",g.upHandler,v)):(f==null||f.addEventListener("mousemove",m.moveHandler,v),f==null||f.addEventListener("mouseup",m.upHandler,v)),t.setColumnSizingInfo(y=>({...y,startOffset:a,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?_x():(n=e.initialState.columnSizingInfo)!=null?n:_x())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?t:0}}};let Th=null;function UK(){if(typeof Th=="boolean")return Th;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Th=e,Th}function Ix(e){return e.type==="touchstart"}const qK={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Sr("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const s=e.columns;return(n=s.length?s.some(i=>i.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Re(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),Me(t.options,"debugRows")),e.getVisibleCells=Re(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,s)=>[...n,...r,...s],Me(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>Re(()=>[r(),r().filter(s=>s.getIsVisible()).map(s=>s.id).join("_")],s=>s.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),Me(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((s,i)=>({...s,[i.id]:n||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function ad(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const WK={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},KK={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Sr("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,s,i;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((s=t.options.enableFilters)!=null?s:!0)&&((i=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>ui.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return ty(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:ui[r]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},QK={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Sr("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,s;if(!t){e._queue(()=>{t=!0});return}if((r=(s=e.options.autoResetAll)!=null?s:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var s,i;e.setExpanded(r?{}:(s=(i=e.initialState)==null?void 0:i.expanded)!=null?s:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(s=>!s.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const o=i.split(".");r=Math.max(r,o.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var s;const i=r===!0?!0:!!(r!=null&&r[e.id]);let o={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(l=>{o[l]=!0}):o=r,n=(s=n)!=null?s:!i,!i&&n)return{...o,[e.id]:!0};if(i&&!n){const{[e.id]:l,...a}=o;return a}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r!=null&&r[e.id])},e.getCanExpand=()=>{var n,r,s;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((s=e.subRows)!=null&&s.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},fw=0,hw=10,Dx=()=>({pageIndex:fw,pageSize:hw}),GK={getInitialState:e=>({...e,pagination:{...Dx(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Sr("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,s;if(!t){e._queue(()=>{t=!0});return}if((r=(s=e.options.autoResetAll)!=null?s:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const s=i=>go(r,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(s)},e.resetPagination=r=>{var s;e.setPagination(r?Dx():(s=e.initialState.pagination)!=null?s:Dx())},e.setPageIndex=r=>{e.setPagination(s=>{let i=go(r,s.pageIndex);const o=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,o)),{...s,pageIndex:i}})},e.resetPageIndex=r=>{var s,i;e.setPageIndex(r?fw:(s=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?s:fw)},e.resetPageSize=r=>{var s,i;e.setPageSize(r?hw:(s=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?s:hw)},e.setPageSize=r=>{e.setPagination(s=>{const i=Math.max(1,go(r,s.pageSize)),o=s.pageSize*s.pageIndex,l=Math.floor(o/i);return{...s,pageIndex:l,pageSize:i}})},e.setPageCount=r=>e.setPagination(s=>{var i;let o=go(r,(i=e.options.pageCount)!=null?i:-1);return typeof o=="number"&&(o=Math.max(-1,o)),{...s,pageCount:o}}),e.getPageOptions=Re(()=>[e.getPageCount()],r=>{let s=[];return r&&r>0&&(s=[...new Array(r)].fill(null).map((i,o)=>o)),s},Me(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,s=e.getPageCount();return s===-1?!0:s===0?!1:r<s-1},e.previousPage=()=>e.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},Lx=()=>({top:[],bottom:[]}),JK={getInitialState:e=>({rowPinning:Lx(),...e}),getDefaultOptions:e=>({onRowPinningChange:Sr("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,s)=>{const i=r?e.getLeafRows().map(a=>{let{id:u}=a;return u}):[],o=s?e.getParentRows().map(a=>{let{id:u}=a;return u}):[],l=new Set([...o,e.id,...i]);t.setRowPinning(a=>{var u,c;if(n==="bottom"){var d,h;return{top:((d=a==null?void 0:a.top)!=null?d:[]).filter(g=>!(l!=null&&l.has(g))),bottom:[...((h=a==null?void 0:a.bottom)!=null?h:[]).filter(g=>!(l!=null&&l.has(g))),...Array.from(l)]}}if(n==="top"){var f,m;return{top:[...((f=a==null?void 0:a.top)!=null?f:[]).filter(g=>!(l!=null&&l.has(g))),...Array.from(l)],bottom:((m=a==null?void 0:a.bottom)!=null?m:[]).filter(g=>!(l!=null&&l.has(g)))}}return{top:((u=a==null?void 0:a.top)!=null?u:[]).filter(g=>!(l!=null&&l.has(g))),bottom:((c=a==null?void 0:a.bottom)!=null?c:[]).filter(g=>!(l!=null&&l.has(g)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:s}=t.options;return typeof r=="function"?r(e):(n=r??s)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:s}=t.getState().rowPinning,i=n.some(l=>r==null?void 0:r.includes(l)),o=n.some(l=>s==null?void 0:s.includes(l));return i?"top":o?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const s=e.getIsPinned();if(!s)return-1;const i=(n=s==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(o=>{let{id:l}=o;return l});return(r=i==null?void 0:i.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?Lx():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:Lx())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var s,i;return!!((s=r.top)!=null&&s.length||(i=r.bottom)!=null&&i.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=(t,n,r)=>{var s;return((s=e.options.keepPinnedRows)==null||s?(n??[]).map(o=>{const l=e.getRow(o,!0);return l.getIsAllParentsExpanded()?l:null}):(n??[]).map(o=>t.find(l=>l.id===o))).filter(Boolean).map(o=>({...o,position:r}))},e.getTopRows=Re(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),Me(e.options,"debugRows")),e.getBottomRows=Re(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),Me(e.options,"debugRows")),e.getCenterRows=Re(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const s=new Set([...n??[],...r??[]]);return t.filter(i=>!s.has(i.id))},Me(e.options,"debugRows"))}},ZK={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Sr("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},s=e.getPreGroupedRowModel().flatRows;return t?s.forEach(i=>{i.getCanSelect()&&(r[i.id]=!0)}):s.forEach(i=>{delete r[i.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),s={...n};return e.getRowModel().rows.forEach(i=>{pw(s,i.id,r,!0,e)}),s}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Re(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?$x(e,n):{rows:[],flatRows:[],rowsById:{}},Me(e.options,"debugTable")),e.getFilteredSelectedRowModel=Re(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?$x(e,n):{rows:[],flatRows:[],rowsById:{}},Me(e.options,"debugTable")),e.getGroupedSelectedRowModel=Re(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?$x(e,n):{rows:[],flatRows:[],rowsById:{}},Me(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(s=>s.getCanSelect()&&!n[s.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(s=>s.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(s=>!n[s.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const s=e.getIsSelected();t.setRowSelection(i=>{var o;if(n=typeof n<"u"?n:!s,e.getCanSelect()&&s===n)return i;const l={...i};return pw(l,e.id,n,(o=r==null?void 0:r.selectChildren)!=null?o:!0,t),l})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return h1(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return mw(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return mw(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var s;n&&e.toggleSelected((s=r.target)==null?void 0:s.checked)}}}},pw=(e,t,n,r,s)=>{var i;const o=s.getRow(t,!0);n?(o.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),o.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(i=o.subRows)!=null&&i.length&&o.getCanSelectSubRows()&&o.subRows.forEach(l=>pw(e,l.id,n,r,s))};function $x(e,t){const n=e.getState().rowSelection,r=[],s={},i=function(o,l){return o.map(a=>{var u;const c=h1(a,n);if(c&&(r.push(a),s[a.id]=a),(u=a.subRows)!=null&&u.length&&(a={...a,subRows:i(a.subRows)}),c)return a}).filter(Boolean)};return{rows:i(t.rows),flatRows:r,rowsById:s}}function h1(e,t){var n;return(n=t[e.id])!=null?n:!1}function mw(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let s=!0,i=!1;return e.subRows.forEach(o=>{if(!(i&&!s)&&(o.getCanSelect()&&(h1(o,t)?i=!0:s=!1),o.subRows&&o.subRows.length)){const l=mw(o,t);l==="all"?i=!0:(l==="some"&&(i=!0),s=!1)}}),s?"all":i?"some":!1}const gw=/([0-9]+)/gm,YK=(e,t,n)=>TI(Uo(e.getValue(n)).toLowerCase(),Uo(t.getValue(n)).toLowerCase()),XK=(e,t,n)=>TI(Uo(e.getValue(n)),Uo(t.getValue(n))),eQ=(e,t,n)=>p1(Uo(e.getValue(n)).toLowerCase(),Uo(t.getValue(n)).toLowerCase()),tQ=(e,t,n)=>p1(Uo(e.getValue(n)),Uo(t.getValue(n))),nQ=(e,t,n)=>{const r=e.getValue(n),s=t.getValue(n);return r>s?1:r<s?-1:0},rQ=(e,t,n)=>p1(e.getValue(n),t.getValue(n));function p1(e,t){return e===t?0:e>t?1:-1}function Uo(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function TI(e,t){const n=e.split(gw).filter(Boolean),r=t.split(gw).filter(Boolean);for(;n.length&&r.length;){const s=n.shift(),i=r.shift(),o=parseInt(s,10),l=parseInt(i,10),a=[o,l].sort();if(isNaN(a[0])){if(s>i)return 1;if(i>s)return-1;continue}if(isNaN(a[1]))return isNaN(o)?-1:1;if(o>l)return 1;if(l>o)return-1}return n.length-r.length}const Rc={alphanumeric:YK,alphanumericCaseSensitive:XK,text:eQ,textCaseSensitive:tQ,datetime:nQ,basic:rQ},sQ={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Sr("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const s of n){const i=s==null?void 0:s.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return Rc.datetime;if(typeof i=="string"&&(r=!0,i.split(gw).length>1))return Rc.alphanumeric}return r?Rc.text:Rc.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return ty(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:Rc[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const s=e.getNextSortingOrder(),i=typeof n<"u"&&n!==null;t.setSorting(o=>{const l=o==null?void 0:o.find(f=>f.id===e.id),a=o==null?void 0:o.findIndex(f=>f.id===e.id);let u=[],c,d=i?n:s==="desc";if(o!=null&&o.length&&e.getCanMultiSort()&&r?l?c="toggle":c="add":o!=null&&o.length&&a!==o.length-1?c="replace":l?c="toggle":c="replace",c==="toggle"&&(i||s||(c="remove")),c==="add"){var h;u=[...o,{id:e.id,desc:d}],u.splice(0,u.length-((h=t.options.maxMultiSortColCount)!=null?h:Number.MAX_SAFE_INTEGER))}else c==="toggle"?u=o.map(f=>f.id===e.id?{...f,desc:d}:f):c==="remove"?u=o.filter(f=>f.id!==e.id):u=[{id:e.id,desc:d}];return u})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,s;const i=e.getFirstSortDir(),o=e.getIsSorted();return o?o!==i&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(s=t.options.enableMultiRemove)!=null)||s)?!1:o==="desc"?"asc":"desc":i},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(s=>s.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(s=>s.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},iQ=[NK,qK,FK,BK,TK,RK,WK,KK,sQ,$K,QK,GK,JK,ZK,HK];function oQ(e){var t,n;const r=[...iQ,...(t=e._features)!=null?t:[]];let s={_features:r};const i=s._features.reduce((h,f)=>Object.assign(h,f.getDefaultOptions==null?void 0:f.getDefaultOptions(s)),{}),o=h=>s.options.mergeOptions?s.options.mergeOptions(i,h):{...i,...h};let a={...{},...(n=e.initialState)!=null?n:{}};s._features.forEach(h=>{var f;a=(f=h.getInitialState==null?void 0:h.getInitialState(a))!=null?f:a});const u=[];let c=!1;const d={_features:r,options:{...i,...e},initialState:a,_queue:h=>{u.push(h),c||(c=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();c=!1}).catch(f=>setTimeout(()=>{throw f})))},reset:()=>{s.setState(s.initialState)},setOptions:h=>{const f=go(h,s.options);s.options=o(f)},getState:()=>s.options.state,setState:h=>{s.options.onStateChange==null||s.options.onStateChange(h)},_getRowId:(h,f,m)=>{var g;return(g=s.options.getRowId==null?void 0:s.options.getRowId(h,f,m))!=null?g:`${m?[m.id,f].join("."):f}`},getCoreRowModel:()=>(s._getCoreRowModel||(s._getCoreRowModel=s.options.getCoreRowModel(s)),s._getCoreRowModel()),getRowModel:()=>s.getPaginationRowModel(),getRow:(h,f)=>{let m=(f?s.getPrePaginationRowModel():s.getRowModel()).rowsById[h];if(!m&&(m=s.getCoreRowModel().rowsById[h],!m))throw new Error;return m},_getDefaultColumnDef:Re(()=>[s.options.defaultColumn],h=>{var f;return h=(f=h)!=null?f:{},{header:m=>{const g=m.header.column.columnDef;return g.accessorKey?g.accessorKey:g.accessorFn?g.id:null},cell:m=>{var g,v;return(g=(v=m.renderValue())==null||v.toString==null?void 0:v.toString())!=null?g:null},...s._features.reduce((m,g)=>Object.assign(m,g.getDefaultColumnDef==null?void 0:g.getDefaultColumnDef()),{}),...h}},Me(e,"debugColumns")),_getColumnDefs:()=>s.options.columns,getAllColumns:Re(()=>[s._getColumnDefs()],h=>{const f=function(m,g,v){return v===void 0&&(v=0),m.map(y=>{const w=EK(s,y,v,g),b=y;return w.columns=b.columns?f(b.columns,w,v+1):[],w})};return f(h)},Me(e,"debugColumns")),getAllFlatColumns:Re(()=>[s.getAllColumns()],h=>h.flatMap(f=>f.getFlatColumns()),Me(e,"debugColumns")),_getAllFlatColumnsById:Re(()=>[s.getAllFlatColumns()],h=>h.reduce((f,m)=>(f[m.id]=m,f),{}),Me(e,"debugColumns")),getAllLeafColumns:Re(()=>[s.getAllColumns(),s._getOrderColumnsFn()],(h,f)=>{let m=h.flatMap(g=>g.getLeafColumns());return f(m)},Me(e,"debugColumns")),getColumn:h=>s._getAllFlatColumnsById()[h]};Object.assign(s,d);for(let h=0;h<s._features.length;h++){const f=s._features[h];f==null||f.createTable==null||f.createTable(s)}return s}function lQ(){return e=>Re(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(s,i,o){i===void 0&&(i=0);const l=[];for(let u=0;u<s.length;u++){const c=ny(e,e._getRowId(s[u],u,o),s[u],u,i,void 0,o==null?void 0:o.id);if(n.flatRows.push(c),n.rowsById[c.id]=c,l.push(c),e.options.getSubRows){var a;c.originalSubRows=e.options.getSubRows(s[u],u),(a=c.originalSubRows)!=null&&a.length&&(c.subRows=r(c.originalSubRows,i+1,c))}}return l};return n.rows=r(t),n},Me(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function aQ(){return e=>Re(()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows],(t,n,r)=>!n.rows.length||t!==!0&&!Object.keys(t??{}).length||!r?n:uQ(n),Me(e.options,"debugTable"))}function uQ(e){const t=[],n=r=>{var s;t.push(r),(s=r.subRows)!=null&&s.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function cQ(e,t,n){return n.options.filterFromLeafRows?dQ(e,t,n):fQ(e,t,n)}function dQ(e,t,n){var r;const s=[],i={},o=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,l=function(a,u){u===void 0&&(u=0);const c=[];for(let h=0;h<a.length;h++){var d;let f=a[h];const m=ny(n,f.id,f.original,f.index,f.depth,void 0,f.parentId);if(m.columnFilters=f.columnFilters,(d=f.subRows)!=null&&d.length&&u<o){if(m.subRows=l(f.subRows,u+1),f=m,t(f)&&!m.subRows.length){c.push(f),i[f.id]=f,s.push(f);continue}if(t(f)||m.subRows.length){c.push(f),i[f.id]=f,s.push(f);continue}}else f=m,t(f)&&(c.push(f),i[f.id]=f,s.push(f))}return c};return{rows:l(e),flatRows:s,rowsById:i}}function fQ(e,t,n){var r;const s=[],i={},o=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,l=function(a,u){u===void 0&&(u=0);const c=[];for(let h=0;h<a.length;h++){let f=a[h];if(t(f)){var d;if((d=f.subRows)!=null&&d.length&&u<o){const g=ny(n,f.id,f.original,f.index,f.depth,void 0,f.parentId);g.subRows=l(f.subRows,u+1),f=g}c.push(f),s.push(f),i[f.id]=f}}return c};return{rows:l(e),flatRows:s,rowsById:i}}function hQ(){return e=>Re(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let h=0;h<t.flatRows.length;h++)t.flatRows[h].columnFilters={},t.flatRows[h].columnFiltersMeta={};return t}const s=[],i=[];(n??[]).forEach(h=>{var f;const m=e.getColumn(h.id);if(!m)return;const g=m.getFilterFn();g&&s.push({id:h.id,filterFn:g,resolvedValue:(f=g.resolveFilterValue==null?void 0:g.resolveFilterValue(h.value))!=null?f:h.value})});const o=(n??[]).map(h=>h.id),l=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(h=>h.getCanGlobalFilter());r&&l&&a.length&&(o.push("__global__"),a.forEach(h=>{var f;i.push({id:h.id,filterFn:l,resolvedValue:(f=l.resolveFilterValue==null?void 0:l.resolveFilterValue(r))!=null?f:r})}));let u,c;for(let h=0;h<t.flatRows.length;h++){const f=t.flatRows[h];if(f.columnFilters={},s.length)for(let m=0;m<s.length;m++){u=s[m];const g=u.id;f.columnFilters[g]=u.filterFn(f,g,u.resolvedValue,v=>{f.columnFiltersMeta[g]=v})}if(i.length){for(let m=0;m<i.length;m++){c=i[m];const g=c.id;if(c.filterFn(f,g,c.resolvedValue,v=>{f.columnFiltersMeta[g]=v})){f.columnFilters.__global__=!0;break}}f.columnFilters.__global__!==!0&&(f.columnFilters.__global__=!1)}}const d=h=>{for(let f=0;f<o.length;f++)if(h.columnFilters[o[f]]===!1)return!1;return!0};return cQ(t.rows,d,e)},Me(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function pQ(){return e=>Re(()=>[e.getState().grouping,e.getPreGroupedRowModel()],(t,n)=>{if(!n.rows.length||!t.length)return n.rows.forEach(a=>{a.depth=0,a.parentId=void 0}),n;const r=t.filter(a=>e.getColumn(a)),s=[],i={},o=function(a,u,c){if(u===void 0&&(u=0),u>=r.length)return a.map(m=>(m.depth=u,s.push(m),i[m.id]=m,m.subRows&&(m.subRows=o(m.subRows,u+1,m.id)),m));const d=r[u],h=mQ(a,d);return Array.from(h.entries()).map((m,g)=>{let[v,y]=m,w=`${d}:${v}`;w=c?`${c}>${w}`:w;const b=o(y,u+1,w);b.forEach(k=>{k.parentId=w});const C=u?xI(y,k=>k.subRows):y,S=ny(e,w,C[0].original,g,u,void 0,c);return Object.assign(S,{groupingColumnId:d,groupingValue:v,subRows:b,leafRows:C,getValue:k=>{if(r.includes(k)){if(S._valuesCache.hasOwnProperty(k))return S._valuesCache[k];if(y[0]){var E;S._valuesCache[k]=(E=y[0].getValue(k))!=null?E:void 0}return S._valuesCache[k]}if(S._groupingValuesCache.hasOwnProperty(k))return S._groupingValuesCache[k];const N=e.getColumn(k),O=N==null?void 0:N.getAggregationFn();if(O)return S._groupingValuesCache[k]=O(k,C,y),S._groupingValuesCache[k]}}),b.forEach(k=>{s.push(k),i[k.id]=k}),S})},l=o(n.rows,0);return l.forEach(a=>{s.push(a),i[a.id]=a}),{rows:l,flatRows:s,rowsById:i}},Me(e.options,"debugTable","getGroupedRowModel",()=>{e._queue(()=>{e._autoResetExpanded(),e._autoResetPageIndex()})}))}function mQ(e,t){const n=new Map;return e.reduce((r,s)=>{const i=`${s.getGroupingValue(t)}`,o=r.get(i);return o?o.push(s):r.set(i,[s]),r},n)}function gQ(){return e=>Re(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,s=[],i=r.filter(a=>{var u;return(u=e.getColumn(a.id))==null?void 0:u.getCanSort()}),o={};i.forEach(a=>{const u=e.getColumn(a.id);u&&(o[a.id]={sortUndefined:u.columnDef.sortUndefined,invertSorting:u.columnDef.invertSorting,sortingFn:u.getSortingFn()})});const l=a=>{const u=a.map(c=>({...c}));return u.sort((c,d)=>{for(let f=0;f<i.length;f+=1){var h;const m=i[f],g=o[m.id],v=g.sortUndefined,y=(h=m==null?void 0:m.desc)!=null?h:!1;let w=0;if(v){const b=c.getValue(m.id),C=d.getValue(m.id),S=b===void 0,k=C===void 0;if(S||k){if(v==="first")return S?-1:1;if(v==="last")return S?1:-1;w=S&&k?0:S?v:-v}}if(w===0&&(w=g.sortingFn(c,d,m.id)),w!==0)return y&&(w*=-1),g.invertSorting&&(w*=-1),w}return c.index-d.index}),u.forEach(c=>{var d;s.push(c),(d=c.subRows)!=null&&d.length&&(c.subRows=l(c.subRows))}),u};return{rows:l(n.rows),flatRows:s,rowsById:n.rowsById}},Me(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
|
|
470
|
+
* react-table
|
|
471
|
+
*
|
|
472
|
+
* Copyright (c) TanStack
|
|
473
|
+
*
|
|
474
|
+
* This source code is licensed under the MIT license found in the
|
|
475
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
476
|
+
*
|
|
477
|
+
* @license MIT
|
|
478
|
+
*/function Ca(e,t){return e?yQ(e)?x.createElement(e,t):e:null}function yQ(e){return xQ(e)||typeof e=="function"||vQ(e)}function xQ(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function vQ(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function wQ(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=x.useState(()=>({current:oQ(t)})),[r,s]=x.useState(()=>n.current.initialState);return n.current.setOptions(i=>({...i,...e,state:{...r,...e.state},onStateChange:o=>{s(o),e.onStateChange==null||e.onStateChange(o)}})),n.current}function bQ({globalFilter:e,onGlobalFilterChange:t,sorting:n,grouping:r,onSortingChange:s,onGroupingChange:i,sortableColumns:o,groupableColumns:l,onClear:a,onColumnsOpen:u,rowCount:c,disableSearch:d=!1,disableSorting:h=!1,disableGrouping:f=!1}){const m=n[0],g=(m==null?void 0:m.id)??"",v=(m==null?void 0:m.desc)??!1,y=r[0]??"";return p.jsxs("div",{className:"flex flex-wrap items-center gap-2 border border-border bg-card p-2",children:[d?null:p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[p.jsx($A,{className:"h-4 w-4"}),p.jsx("span",{children:"Filter"})]}),p.jsx("input",{value:e,onChange:w=>t(w.target.value),placeholder:"Search",className:"h-8 w-48 border border-input bg-background px-2 text-xs focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2"})]}),h?null:p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[p.jsx(sm,{className:"h-4 w-4"}),p.jsx("span",{children:"Sort"})]}),p.jsxs("select",{value:g,onChange:w=>{const b=w.target.value;if(!b){s([]);return}s([{id:b,desc:v}])},className:"h-8 border border-input bg-background px-2 text-xs focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",children:[p.jsx("option",{value:"",children:"No sort"}),o.map(w=>p.jsx("option",{value:w.id,children:w.id},w.id))]}),p.jsx(ae,{type:"button",variant:"ghost",size:"icon",onClick:()=>{g&&s([{id:g,desc:!v}])},children:v?p.jsx(tw,{className:"h-4 w-4"}):p.jsx(sm,{className:"h-4 w-4"})})]}),f?null:p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[p.jsx(zA,{className:"h-4 w-4"}),p.jsx("span",{children:"Group"})]}),p.jsxs("select",{value:y,onChange:w=>{const b=w.target.value;i(b?[b]:[])},className:"h-8 border border-input bg-background px-2 text-xs focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",children:[p.jsx("option",{value:"",children:"No group"}),l.map(w=>p.jsx("option",{value:w.id,children:w.id},w.id))]})]}),p.jsx(ae,{type:"button",variant:"ghost",size:"sm",onClick:a,children:"Clear"}),p.jsx(ae,{type:"button",variant:"ghost",size:"sm",onClick:u,children:"Columns"}),p.jsxs("div",{className:"ml-auto text-xs text-muted-foreground",children:[c," rows"]})]})}var et;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},e.getValidEnumValues=s=>{const i=e.objectKeys(s).filter(l=>typeof s[s[l]]!="number"),o={};for(const l of i)o[l]=s[l];return e.objectValues(o)},e.objectValues=s=>e.objectKeys(s).map(function(i){return s[i]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},e.find=(s,i)=>{for(const o of s)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(et||(et={}));var zN;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(zN||(zN={}));const xe=et.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qi=e=>{switch(typeof e){case"undefined":return xe.undefined;case"string":return xe.string;case"number":return Number.isNaN(e)?xe.nan:xe.number;case"boolean":return xe.boolean;case"function":return xe.function;case"bigint":return xe.bigint;case"symbol":return xe.symbol;case"object":return Array.isArray(e)?xe.array:e===null?xe.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?xe.promise:typeof Map<"u"&&e instanceof Map?xe.map:typeof Set<"u"&&e instanceof Set?xe.set:typeof Date<"u"&&e instanceof Date?xe.date:xe.object;default:return xe.unknown}},re=et.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Pi extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let l=r,a=0;for(;a<o.path.length;){const u=o.path[a];a===o.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(n(o))):l[u]=l[u]||{_errors:[]},l=l[u],a++}}};return s(this),r}static assert(t){if(!(t instanceof Pi))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,et.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(t(s))}else r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Pi.create=e=>new Pi(e);const yw=(e,t)=>{let n;switch(e.code){case re.invalid_type:e.received===xe.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case re.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,et.jsonStringifyReplacer)}`;break;case re.unrecognized_keys:n=`Unrecognized key(s) in object: ${et.joinValues(e.keys,", ")}`;break;case re.invalid_union:n="Invalid input";break;case re.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${et.joinValues(e.options)}`;break;case re.invalid_enum_value:n=`Invalid enum value. Expected ${et.joinValues(e.options)}, received '${e.received}'`;break;case re.invalid_arguments:n="Invalid function arguments";break;case re.invalid_return_type:n="Invalid function return type";break;case re.invalid_date:n="Invalid date";break;case re.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:et.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case re.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case re.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case re.custom:n="Invalid input";break;case re.invalid_intersection_types:n="Intersection results could not be merged";break;case re.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case re.not_finite:n="Number must be finite";break;default:n=t.defaultError,et.assertNever(e)}return{message:n}};let kQ=yw;function SQ(){return kQ}const CQ=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let l="";const a=r.filter(u=>!!u).slice().reverse();for(const u of a)l=u(o,{data:t,defaultError:l}).message;return{...s,path:i,message:l}};function de(e,t){const n=SQ(),r=CQ({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===yw?void 0:yw].filter(s=>!!s)});e.common.issues.push(r)}class Vn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const s of n){if(s.status==="aborted")return $e;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return Vn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return $e;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:t.value,value:r}}}const $e=Object.freeze({status:"aborted"}),Vc=e=>({status:"dirty",value:e}),Jr=e=>({status:"valid",value:e}),FN=e=>e.status==="aborted",BN=e=>e.status==="dirty",$u=e=>e.status==="valid",mm=e=>typeof Promise<"u"&&e instanceof Promise;var Ce;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ce||(Ce={}));class Ws{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const VN=(e,t)=>{if($u(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Pi(e.common.issues);return this._error=n,this._error}}};function Ve(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(o,l)=>{const{message:a}=e;return o.code==="invalid_enum_value"?{message:a??l.defaultError}:typeof l.data>"u"?{message:a??r??l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:a??n??l.defaultError}},description:s}}class Je{get description(){return this._def.description}_getType(t){return Qi(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Qi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Vn,ctx:{common:t.parent.common,data:t.data,parsedType:Qi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(mm(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Qi(t)},s=this._parseSync({data:t,path:r.path,parent:r});return VN(r,s)}"~validate"(t){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Qi(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return $u(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>$u(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Qi(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(mm(s)?s:Promise.resolve(s));return VN(r,i)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=t(s),l=()=>i.addIssue({code:re.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(a=>a?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new Bu({schema:this,typeName:De.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Oo.create(this,this._def)}nullable(){return Vu.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Hs.create(this)}promise(){return wm.create(this,this._def)}or(t){return ym.create([this,t],this._def)}and(t){return xm.create(this,t,this._def)}transform(t){return new Bu({...Ve(this._def),schema:this,typeName:De.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new kw({...Ve(this._def),innerType:this,defaultValue:n,typeName:De.ZodDefault})}brand(){return new KQ({typeName:De.ZodBranded,type:this,...Ve(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Sw({...Ve(this._def),innerType:this,catchValue:n,typeName:De.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return m1.create(this,t)}readonly(){return Cw.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const EQ=/^c[^\s-]{8,}$/i,NQ=/^[0-9a-z]+$/,TQ=/^[0-9A-HJKMNP-TV-Z]{26}$/i,RQ=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,MQ=/^[a-z0-9_-]{21}$/i,OQ=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jQ=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,PQ=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,AQ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let zx;const _Q=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,IQ=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,DQ=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,LQ=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$Q=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,zQ=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,RI="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",FQ=new RegExp(`^${RI}$`);function MI(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function BQ(e){return new RegExp(`^${MI(e)}$`)}function VQ(e){let t=`${RI}T${MI(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function HQ(e,t){return!!((t==="v4"||!t)&&_Q.test(e)||(t==="v6"||!t)&&DQ.test(e))}function UQ(e,t){if(!OQ.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function qQ(e,t){return!!((t==="v4"||!t)&&IQ.test(e)||(t==="v6"||!t)&&LQ.test(e))}class vi extends Je{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==xe.string){const i=this._getOrReturnCtx(t);return de(i,{code:re.invalid_type,expected:xe.string,received:i.parsedType}),$e}const r=new Vn;let s;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(s=this._getOrReturnCtx(t,s),de(s,{code:re.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(s=this._getOrReturnCtx(t,s),de(s,{code:re.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=t.data.length>i.value,l=t.data.length<i.value;(o||l)&&(s=this._getOrReturnCtx(t,s),o?de(s,{code:re.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):l&&de(s,{code:re.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")PQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"email",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")zx||(zx=new RegExp(AQ,"u")),zx.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"emoji",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")RQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"uuid",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")MQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"nanoid",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")EQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"cuid",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")NQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"cuid2",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")TQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"ulid",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),de(s,{validation:"url",code:re.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"regex",code:re.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(t,s),de(s,{code:re.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(s=this._getOrReturnCtx(t,s),de(s,{code:re.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(s=this._getOrReturnCtx(t,s),de(s,{code:re.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?VQ(i).test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{code:re.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?FQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{code:re.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?BQ(i).test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{code:re.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?jQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"duration",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?HQ(t.data,i.version)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"ip",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?UQ(t.data,i.alg)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"jwt",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?qQ(t.data,i.version)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"cidr",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?$Q.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"base64",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?zQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"base64url",code:re.invalid_string,message:i.message}),r.dirty()):et.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:re.invalid_string,...Ce.errToObj(r)})}_addCheck(t){return new vi({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ce.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ce.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ce.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ce.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Ce.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ce.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ce.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ce.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Ce.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Ce.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Ce.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ce.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Ce.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...Ce.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Ce.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Ce.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Ce.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Ce.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Ce.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Ce.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Ce.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Ce.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Ce.errToObj(n)})}nonempty(t){return this.min(1,Ce.errToObj(t))}trim(){return new vi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new vi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new vi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}vi.create=e=>new vi({checks:[],typeName:De.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Ve(e)});function WQ(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(e.toFixed(s).replace(".","")),o=Number.parseInt(t.toFixed(s).replace(".",""));return i%o/10**s}class zu extends Je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==xe.number){const i=this._getOrReturnCtx(t);return de(i,{code:re.invalid_type,expected:xe.number,received:i.parsedType}),$e}let r;const s=new Vn;for(const i of this._def.checks)i.kind==="int"?et.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),de(r,{code:re.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),de(r,{code:re.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),de(r,{code:re.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?WQ(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),de(r,{code:re.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),de(r,{code:re.not_finite,message:i.message}),s.dirty()):et.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ce.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ce.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ce.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ce.toString(n))}setLimit(t,n,r,s){return new zu({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ce.toString(s)}]})}_addCheck(t){return new zu({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ce.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ce.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ce.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ce.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ce.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ce.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Ce.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ce.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ce.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&et.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}zu.create=e=>new zu({checks:[],typeName:De.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ve(e)});class Jd extends Je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==xe.bigint)return this._getInvalidInput(t);let r;const s=new Vn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),de(r,{code:re.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),de(r,{code:re.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),de(r,{code:re.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):et.assertNever(i);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return de(n,{code:re.invalid_type,expected:xe.bigint,received:n.parsedType}),$e}gte(t,n){return this.setLimit("min",t,!0,Ce.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ce.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ce.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ce.toString(n))}setLimit(t,n,r,s){return new Jd({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ce.toString(s)}]})}_addCheck(t){return new Jd({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ce.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ce.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ce.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ce.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ce.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Jd.create=e=>new Jd({checks:[],typeName:De.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Ve(e)});class xw extends Je{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==xe.boolean){const r=this._getOrReturnCtx(t);return de(r,{code:re.invalid_type,expected:xe.boolean,received:r.parsedType}),$e}return Jr(t.data)}}xw.create=e=>new xw({typeName:De.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ve(e)});class gm extends Je{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==xe.date){const i=this._getOrReturnCtx(t);return de(i,{code:re.invalid_type,expected:xe.date,received:i.parsedType}),$e}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return de(i,{code:re.invalid_date}),$e}const r=new Vn;let s;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(s=this._getOrReturnCtx(t,s),de(s,{code:re.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(s=this._getOrReturnCtx(t,s),de(s,{code:re.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):et.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new gm({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Ce.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Ce.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}gm.create=e=>new gm({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:De.ZodDate,...Ve(e)});class HN extends Je{_parse(t){if(this._getType(t)!==xe.symbol){const r=this._getOrReturnCtx(t);return de(r,{code:re.invalid_type,expected:xe.symbol,received:r.parsedType}),$e}return Jr(t.data)}}HN.create=e=>new HN({typeName:De.ZodSymbol,...Ve(e)});class UN extends Je{_parse(t){if(this._getType(t)!==xe.undefined){const r=this._getOrReturnCtx(t);return de(r,{code:re.invalid_type,expected:xe.undefined,received:r.parsedType}),$e}return Jr(t.data)}}UN.create=e=>new UN({typeName:De.ZodUndefined,...Ve(e)});class qN extends Je{_parse(t){if(this._getType(t)!==xe.null){const r=this._getOrReturnCtx(t);return de(r,{code:re.invalid_type,expected:xe.null,received:r.parsedType}),$e}return Jr(t.data)}}qN.create=e=>new qN({typeName:De.ZodNull,...Ve(e)});class WN extends Je{constructor(){super(...arguments),this._any=!0}_parse(t){return Jr(t.data)}}WN.create=e=>new WN({typeName:De.ZodAny,...Ve(e)});class vw extends Je{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Jr(t.data)}}vw.create=e=>new vw({typeName:De.ZodUnknown,...Ve(e)});class qo extends Je{_parse(t){const n=this._getOrReturnCtx(t);return de(n,{code:re.invalid_type,expected:xe.never,received:n.parsedType}),$e}}qo.create=e=>new qo({typeName:De.ZodNever,...Ve(e)});class KN extends Je{_parse(t){if(this._getType(t)!==xe.undefined){const r=this._getOrReturnCtx(t);return de(r,{code:re.invalid_type,expected:xe.void,received:r.parsedType}),$e}return Jr(t.data)}}KN.create=e=>new KN({typeName:De.ZodVoid,...Ve(e)});class Hs extends Je{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==xe.array)return de(n,{code:re.invalid_type,expected:xe.array,received:n.parsedType}),$e;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,l=n.data.length<s.exactLength.value;(o||l)&&(de(n,{code:o?re.too_big:re.too_small,minimum:l?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(de(n,{code:re.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(de(n,{code:re.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>s.type._parseAsync(new Ws(n,o,n.path,l)))).then(o=>Vn.mergeArray(r,o));const i=[...n.data].map((o,l)=>s.type._parseSync(new Ws(n,o,n.path,l)));return Vn.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Hs({...this._def,minLength:{value:t,message:Ce.toString(n)}})}max(t,n){return new Hs({...this._def,maxLength:{value:t,message:Ce.toString(n)}})}length(t,n){return new Hs({...this._def,exactLength:{value:t,message:Ce.toString(n)}})}nonempty(t){return this.min(1,t)}}Hs.create=(e,t)=>new Hs({type:e,minLength:null,maxLength:null,exactLength:null,typeName:De.ZodArray,...Ve(t)});function Aa(e){if(e instanceof $t){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Oo.create(Aa(r))}return new $t({...e._def,shape:()=>t})}else return e instanceof Hs?new Hs({...e._def,type:Aa(e.element)}):e instanceof Oo?Oo.create(Aa(e.unwrap())):e instanceof Vu?Vu.create(Aa(e.unwrap())):e instanceof Zl?Zl.create(e.items.map(t=>Aa(t))):e}class $t extends Je{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=et.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==xe.object){const u=this._getOrReturnCtx(t);return de(u,{code:re.invalid_type,expected:xe.object,received:u.parsedType}),$e}const{status:r,ctx:s}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof qo&&this._def.unknownKeys==="strip"))for(const u in s.data)o.includes(u)||l.push(u);const a=[];for(const u of o){const c=i[u],d=s.data[u];a.push({key:{status:"valid",value:u},value:c._parse(new Ws(s,d,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof qo){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of l)a.push({key:{status:"valid",value:c},value:{status:"valid",value:s.data[c]}});else if(u==="strict")l.length>0&&(de(s,{code:re.unrecognized_keys,keys:l}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of l){const d=s.data[c];a.push({key:{status:"valid",value:c},value:u._parse(new Ws(s,d,s.path,c)),alwaysSet:c in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of a){const d=await c.key,h=await c.value;u.push({key:d,value:h,alwaysSet:c.alwaysSet})}return u}).then(u=>Vn.mergeObjectSync(r,u)):Vn.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(t){return Ce.errToObj,new $t({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:Ce.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new $t({...this._def,unknownKeys:"strip"})}passthrough(){return new $t({...this._def,unknownKeys:"passthrough"})}extend(t){return new $t({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new $t({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:De.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new $t({...this._def,catchall:t})}pick(t){const n={};for(const r of et.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new $t({...this._def,shape:()=>n})}omit(t){const n={};for(const r of et.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new $t({...this._def,shape:()=>n})}deepPartial(){return Aa(this)}partial(t){const n={};for(const r of et.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new $t({...this._def,shape:()=>n})}required(t){const n={};for(const r of et.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Oo;)i=i._def.innerType;n[r]=i}return new $t({...this._def,shape:()=>n})}keyof(){return OI(et.objectKeys(this.shape))}}$t.create=(e,t)=>new $t({shape:()=>e,unknownKeys:"strip",catchall:qo.create(),typeName:De.ZodObject,...Ve(t)});$t.strictCreate=(e,t)=>new $t({shape:()=>e,unknownKeys:"strict",catchall:qo.create(),typeName:De.ZodObject,...Ve(t)});$t.lazycreate=(e,t)=>new $t({shape:e,unknownKeys:"strip",catchall:qo.create(),typeName:De.ZodObject,...Ve(t)});class ym extends Je{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(i){for(const l of i)if(l.result.status==="valid")return l.result;for(const l of i)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=i.map(l=>new Pi(l.ctx.common.issues));return de(n,{code:re.invalid_union,unionErrors:o}),$e}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const a of r){const u={...n,common:{...n.common,issues:[]},parent:null},c=a._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!i&&(i={result:c,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const l=o.map(a=>new Pi(a));return de(n,{code:re.invalid_union,unionErrors:l}),$e}}get options(){return this._def.options}}ym.create=(e,t)=>new ym({options:e,typeName:De.ZodUnion,...Ve(t)});function ww(e,t){const n=Qi(e),r=Qi(t);if(e===t)return{valid:!0,data:e};if(n===xe.object&&r===xe.object){const s=et.objectKeys(t),i=et.objectKeys(e).filter(l=>s.indexOf(l)!==-1),o={...e,...t};for(const l of i){const a=ww(e[l],t[l]);if(!a.valid)return{valid:!1};o[l]=a.data}return{valid:!0,data:o}}else if(n===xe.array&&r===xe.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let i=0;i<e.length;i++){const o=e[i],l=t[i],a=ww(o,l);if(!a.valid)return{valid:!1};s.push(a.data)}return{valid:!0,data:s}}else return n===xe.date&&r===xe.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class xm extends Je{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(i,o)=>{if(FN(i)||FN(o))return $e;const l=ww(i.value,o.value);return l.valid?((BN(i)||BN(o))&&n.dirty(),{status:n.value,value:l.data}):(de(r,{code:re.invalid_intersection_types}),$e)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}xm.create=(e,t,n)=>new xm({left:e,right:t,typeName:De.ZodIntersection,...Ve(n)});class Zl extends Je{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==xe.array)return de(r,{code:re.invalid_type,expected:xe.array,received:r.parsedType}),$e;if(r.data.length<this._def.items.length)return de(r,{code:re.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$e;!this._def.rest&&r.data.length>this._def.items.length&&(de(r,{code:re.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,l)=>{const a=this._def.items[l]||this._def.rest;return a?a._parse(new Ws(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>Vn.mergeArray(n,o)):Vn.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Zl({...this._def,rest:t})}}Zl.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zl({items:e,typeName:De.ZodTuple,rest:null,...Ve(t)})};class vm extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==xe.object)return de(r,{code:re.invalid_type,expected:xe.object,received:r.parsedType}),$e;const s=[],i=this._def.keyType,o=this._def.valueType;for(const l in r.data)s.push({key:i._parse(new Ws(r,l,r.path,l)),value:o._parse(new Ws(r,r.data[l],r.path,l)),alwaysSet:l in r.data});return r.common.async?Vn.mergeObjectAsync(n,s):Vn.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Je?new vm({keyType:t,valueType:n,typeName:De.ZodRecord,...Ve(r)}):new vm({keyType:vi.create(),valueType:t,typeName:De.ZodRecord,...Ve(n)})}}class QN extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==xe.map)return de(r,{code:re.invalid_type,expected:xe.map,received:r.parsedType}),$e;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([l,a],u)=>({key:s._parse(new Ws(r,l,r.path,[u,"key"])),value:i._parse(new Ws(r,a,r.path,[u,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const a of o){const u=await a.key,c=await a.value;if(u.status==="aborted"||c.status==="aborted")return $e;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),l.set(u.value,c.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const a of o){const u=a.key,c=a.value;if(u.status==="aborted"||c.status==="aborted")return $e;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),l.set(u.value,c.value)}return{status:n.value,value:l}}}}QN.create=(e,t,n)=>new QN({valueType:t,keyType:e,typeName:De.ZodMap,...Ve(n)});class Zd extends Je{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==xe.set)return de(r,{code:re.invalid_type,expected:xe.set,received:r.parsedType}),$e;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(de(r,{code:re.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(de(r,{code:re.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(a){const u=new Set;for(const c of a){if(c.status==="aborted")return $e;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const l=[...r.data.values()].map((a,u)=>i._parse(new Ws(r,a,r.path,u)));return r.common.async?Promise.all(l).then(a=>o(a)):o(l)}min(t,n){return new Zd({...this._def,minSize:{value:t,message:Ce.toString(n)}})}max(t,n){return new Zd({...this._def,maxSize:{value:t,message:Ce.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Zd.create=(e,t)=>new Zd({valueType:e,minSize:null,maxSize:null,typeName:De.ZodSet,...Ve(t)});class GN extends Je{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}GN.create=(e,t)=>new GN({getter:e,typeName:De.ZodLazy,...Ve(t)});class bw extends Je{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return de(n,{received:n.data,code:re.invalid_literal,expected:this._def.value}),$e}return{status:"valid",value:t.data}}get value(){return this._def.value}}bw.create=(e,t)=>new bw({value:e,typeName:De.ZodLiteral,...Ve(t)});function OI(e,t){return new Fu({values:e,typeName:De.ZodEnum,...Ve(t)})}class Fu extends Je{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return de(n,{expected:et.joinValues(r),received:n.parsedType,code:re.invalid_type}),$e}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return de(n,{received:n.data,code:re.invalid_enum_value,options:r}),$e}return Jr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Fu.create(t,{...this._def,...n})}exclude(t,n=this._def){return Fu.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Fu.create=OI;class JN extends Je{_parse(t){const n=et.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==xe.string&&r.parsedType!==xe.number){const s=et.objectValues(n);return de(r,{expected:et.joinValues(s),received:r.parsedType,code:re.invalid_type}),$e}if(this._cache||(this._cache=new Set(et.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=et.objectValues(n);return de(r,{received:r.data,code:re.invalid_enum_value,options:s}),$e}return Jr(t.data)}get enum(){return this._def.values}}JN.create=(e,t)=>new JN({values:e,typeName:De.ZodNativeEnum,...Ve(t)});class wm extends Je{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==xe.promise&&n.common.async===!1)return de(n,{code:re.invalid_type,expected:xe.promise,received:n.parsedType}),$e;const r=n.parsedType===xe.promise?n.data:Promise.resolve(n.data);return Jr(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}wm.create=(e,t)=>new wm({type:e,typeName:De.ZodPromise,...Ve(t)});class Bu extends Je{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===De.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,i={addIssue:o=>{de(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return $e;const a=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return a.status==="aborted"?$e:a.status==="dirty"||n.value==="dirty"?Vc(a.value):a});{if(n.value==="aborted")return $e;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?$e:l.status==="dirty"||n.value==="dirty"?Vc(l.value):l}}if(s.type==="refinement"){const o=l=>{const a=s.refinement(l,i);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?$e:(l.status==="dirty"&&n.dirty(),o(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?$e:(l.status==="dirty"&&n.dirty(),o(l.value).then(()=>({status:n.value,value:l.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!$u(o))return $e;const l=s.transform(o.value,i);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>$u(o)?Promise.resolve(s.transform(o.value,i)).then(l=>({status:n.value,value:l})):$e);et.assertNever(s)}}Bu.create=(e,t,n)=>new Bu({schema:e,typeName:De.ZodEffects,effect:t,...Ve(n)});Bu.createWithPreprocess=(e,t,n)=>new Bu({schema:t,effect:{type:"preprocess",transform:e},typeName:De.ZodEffects,...Ve(n)});class Oo extends Je{_parse(t){return this._getType(t)===xe.undefined?Jr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Oo.create=(e,t)=>new Oo({innerType:e,typeName:De.ZodOptional,...Ve(t)});class Vu extends Je{_parse(t){return this._getType(t)===xe.null?Jr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Vu.create=(e,t)=>new Vu({innerType:e,typeName:De.ZodNullable,...Ve(t)});class kw extends Je{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===xe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}kw.create=(e,t)=>new kw({innerType:e,typeName:De.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ve(t)});class Sw extends Je{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return mm(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Pi(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Pi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Sw.create=(e,t)=>new Sw({innerType:e,typeName:De.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ve(t)});class ZN extends Je{_parse(t){if(this._getType(t)!==xe.nan){const r=this._getOrReturnCtx(t);return de(r,{code:re.invalid_type,expected:xe.nan,received:r.parsedType}),$e}return{status:"valid",value:t.data}}}ZN.create=e=>new ZN({typeName:De.ZodNaN,...Ve(e)});class KQ extends Je{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class m1 extends Je{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?$e:i.status==="dirty"?(n.dirty(),Vc(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?$e:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new m1({in:t,out:n,typeName:De.ZodPipeline})}}class Cw extends Je{_parse(t){const n=this._def.innerType._parse(t),r=s=>($u(s)&&(s.value=Object.freeze(s.value)),s);return mm(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Cw.create=(e,t)=>new Cw({innerType:e,typeName:De.ZodReadonly,...Ve(t)});var De;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(De||(De={}));const Zt=vi.create,QQ=zu.create,yp=xw.create,Ew=vw.create;qo.create;const Hu=Hs.create,Fr=$t.create,GQ=ym.create;xm.create;Zl.create;const bm=vm.create,YN=bw.create,jI=Fu.create;wm.create;Oo.create;Vu.create;const XN=GQ([Fr({type:YN("pageLink"),details:Fr({label:Zt().optional(),pageName:Zt()})}),Fr({type:YN("command"),details:Fr({id:Zt(),args:bm(Ew()).optional()})}),Fr({type:Zt(),details:bm(Ew()).optional()})]),JQ=jI(["text","select","object"]),ZQ=Fr({id:Zt().min(1),name:Zt().min(1),type:JQ.optional().default("text"),options:Hu(Zt()).optional(),width:QQ().int().positive().optional()}),PI=Fr({columns:Hu(ZQ).default([])}),AI=Fr({sortBy:Fr({id:Zt(),desc:yp().optional()}).nullable().optional(),groupBy:Zt().nullable().optional(),columnOrder:Hu(Zt()).nullable().optional(),columnVisibility:bm(yp()).nullable().optional(),tags:Hu(Zt()).nullable().optional(),pinned:yp().nullable().optional()}).partial().passthrough(),YQ=Fr({data:Hu(bm(Ew())).optional(),metadata:AI.optional(),schema:PI.optional()}).passthrough(),eT=e=>e.type!=="pageLink"||!e.details||typeof e.details!="object"?!1:"pageName"in e.details,tT=e=>e.type!=="command"||!e.details||typeof e.details!="object"?!1:"id"in e.details;function XQ({rows:e,schema:t,view:n,onViewChange:r,onRowsChange:s,getRowId:i,onAddRow:o,onAddColumn:l,onDeleteColumn:a,emptyStateRowCount:u=5,addRowLabel:c="New row",addColumnLabel:d="Add property",showNewRow:h=!0,renderTextValue:f,renderObjectValue:m,editingDisabled:g=!1,uncontrolledEditing:v=!1,disableSearch:y=!1,disableSorting:w=!1,disableGrouping:b=!1,belowToolbar:C}){const[S,k]=x.useState([]),[E,N]=x.useState(!0),[O,T]=x.useState(""),[j,A]=x.useState(!1),z=x.useCallback((q,W)=>q.length!==W.length?!1:q.every((Ne,je)=>Ne===W[je]),[]),D=x.useCallback((q,W)=>{const Ne=Object.keys(q).sort(),je=Object.keys(W).sort();return z(Ne,je)?Ne.every(be=>q[be]===W[be]):!1},[z]),L=x.useCallback((q,W)=>q.length!==W.length?!1:q.every((Ne,je)=>{const be=W[je];return Ne.id===be.id&&!!Ne.desc==!!be.desc}),[]),H=x.useCallback((q,W)=>q.length!==W.length?!1:q.every((Ne,je)=>Ne===W[je]),[]),K=x.useRef(e);x.useEffect(()=>{K.current=e},[e]);const _=x.useMemo(()=>t.columns.map(q=>q.id).filter(Boolean),[t.columns]),Q=x.useCallback((q,W)=>{const Ne=q.filter(be=>W.includes(be)),je=W.filter(be=>!Ne.includes(be));return[...Ne,...je]},[]),M=x.useRef([]),oe=x.useMemo(()=>{const q=Q(n.columnOrder??[],_);return z(q,M.current)?M.current:(M.current=q,q)},[z,_,Q,n.columnOrder]),F=x.useCallback(q=>f?f(q):q,[f]),R=x.useCallback(q=>m?m(q):eT(q)?q.details.label??q.details.pageName:tT(q)?`Command: ${q.details.id}`:q.type,[m]),I=x.useMemo(()=>new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),[]),V=x.useCallback((q,W)=>{if(W==null)return"";if(q.type==="object"){const Ne=XN.safeParse(W);if(Ne.success){const je=Ne.data;return eT(je)?je.details.label??je.details.pageName:tT(je)?`Command: ${je.details.id}`:je.type}return String(W)}return typeof W=="string"?W:String(W)},[]),Y=x.useCallback((q,W)=>{if(q.type==="object"){const je=XN.safeParse(W);return je.success?R(je.data):W==null?"":String(W)}if(W==null)return"";const Ne=typeof W=="string"?W:String(W);return F(Ne)},[R,F]),G=x.useRef(s);x.useEffect(()=>{G.current=s},[s]);const me=x.useRef(Y);x.useEffect(()=>{me.current=Y},[Y]);const we=x.useCallback((q,W,Ne)=>{const be=(K.current??[]).map((Ye,ht)=>ht===q?{...Ye,[W]:Ne}:Ye);G.current(be)},[]),qe=x.useMemo(()=>JSON.stringify(t.columns),[t.columns]),ut=x.useRef(null);(!ut.current||ut.current.signature!==qe)&&(ut.current={signature:qe,columns:t.columns.map(q=>({id:q.id,accessorKey:q.id,header:q.name,sortingFn:(W,Ne,je)=>{const be=V(q,W.getValue(je)),Ye=V(q,Ne.getValue(je));return!be&&!Ye?0:be?Ye?I.compare(be,Ye):-1:1},cell:({getValue:W,row:Ne,cell:je})=>{if(je.getIsGrouped())return me.current(q,W());if(q.type==="object"){const Ye=W();return p.jsx("div",{className:"text-sm",children:Ye?me.current(q,Ye):p.jsx("span",{className:"text-xs text-muted-foreground",children:"Add object"})})}if(q.type==="select"){const Ye=typeof W()=="string"?W():"";return v?p.jsxs("select",{defaultValue:Ye,className:"w-full bg-transparent text-sm focus-visible:outline-none",children:[p.jsx("option",{value:"",children:"—"}),(q.options??[]).map(ht=>p.jsx("option",{value:ht,children:ht},ht))]}):p.jsxs("select",{value:Ye,onChange:g?void 0:ht=>we(Ne.index,q.id,ht.target.value),disabled:g,className:"w-full bg-transparent text-sm focus-visible:outline-none",children:[p.jsx("option",{value:"",children:"—"}),(q.options??[]).map(ht=>p.jsx("option",{value:ht,children:ht},ht))]})}const be=typeof W()=="string"?W():W()===null||W()===void 0?"":String(W());return v?p.jsx("input",{defaultValue:be,className:"w-full bg-transparent text-sm text-foreground focus-visible:outline-none"}):p.jsx("input",{value:be,onChange:g?void 0:Ye=>we(Ne.index,q.id,Ye.target.value),readOnly:g,className:"w-full bg-transparent text-sm text-foreground focus-visible:outline-none"})},aggregatedCell:({getValue:W})=>me.current(q,W())}))});const rn=ut.current.columns,Le=x.useCallback(q=>{const W={sorting:q.sorting??n.sorting,grouping:q.grouping??n.grouping,columnOrder:q.columnOrder??n.columnOrder,columnVisibility:q.columnVisibility??n.columnVisibility};L(W.sorting,n.sorting)&&H(W.grouping,n.grouping)&&z(W.columnOrder,n.columnOrder)&&D(W.columnVisibility,n.columnVisibility)||r(W)},[z,H,L,D,r,n]),Dt=wQ({data:e,columns:rn,state:{sorting:n.sorting,columnFilters:S,grouping:n.grouping,columnOrder:oe,columnVisibility:n.columnVisibility,expanded:E,globalFilter:O},onSortingChange:q=>{if(w)return;const W=typeof q=="function"?q(n.sorting):q;Le({sorting:W})},onColumnFiltersChange:k,onGroupingChange:q=>{if(b)return;const W=typeof q=="function"?q(n.grouping):q;Le({grouping:W})},onColumnOrderChange:q=>{const W=typeof q=="function"?q(oe):q;Le({columnOrder:W})},onColumnVisibilityChange:q=>{const W=typeof q=="function"?q(n.columnVisibility):q;Le({columnVisibility:W})},onExpandedChange:N,onGlobalFilterChange:T,getRowId:i,getCoreRowModel:lQ(),getFilteredRowModel:hQ(),getSortedRowModel:gQ(),getGroupedRowModel:pQ(),getExpandedRowModel:aQ(),enableGrouping:!b,enableSorting:!w,groupedColumnMode:"remove",autoResetExpanded:!1,initialState:{expanded:!0}}),sn=Dt.getAllColumns(),ct=sn.filter(q=>q.getCanSort()),ur=sn.filter(q=>q.getCanGroup()),Mr=Dt.getVisibleLeafColumns(),dt=e.length===0,on=!!l,Li=!!o,hc=h&&Li,Kn=dt&&Mr.length===1?"min-w-[240px] max-w-[320px] w-[260px]":"min-w-[200px]",Qn=n.sorting[0],An=(Qn==null?void 0:Qn.id)??"",U=n.grouping[0]??"",ie=x.useMemo(()=>{if(!An||ct.some(Ne=>Ne.id===An))return ct;const W=sn.find(Ne=>Ne.id===An);return W?[...ct,W]:ct},[An,sn,ct]),Ae=x.useMemo(()=>{if(!U||ur.some(Ne=>Ne.id===U))return ur;const W=sn.find(Ne=>Ne.id===U);return W?[...ur,W]:ur},[U,sn,ur]),Fe=()=>{Le({sorting:[],grouping:[]}),k([]),N(!0),y||T("")},We=(q,W)=>{const Ne=[...oe],je=Ne.indexOf(q);if(je===-1)return;const be=W==="up"?je-1:je+1;if(be<0||be>=Ne.length)return;const[Ye]=Ne.splice(je,1);Ne.splice(be,0,Ye),Le({columnOrder:Ne})},gn=q=>{Le({columnVisibility:{...n.columnVisibility,[q]:!(n.columnVisibility[q]??!0)}})};return p.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-3",children:[p.jsx(bQ,{globalFilter:O,onGlobalFilterChange:T,sorting:n.sorting,grouping:n.grouping,onSortingChange:q=>Le({sorting:q}),onGroupingChange:q=>{Le({grouping:q}),N(!0)},sortableColumns:ie,groupableColumns:Ae,onClear:Fe,onColumnsOpen:()=>A(!0),rowCount:Dt.getFilteredRowModel().rows.length,disableSearch:y,disableSorting:w,disableGrouping:b}),C,j?p.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:p.jsxs("div",{className:"w-full max-w-lg border border-border bg-background",children:[p.jsxs("div",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[p.jsx("h4",{className:"text-sm font-semibold",children:"Manage columns"}),p.jsx(ae,{type:"button",size:"sm",variant:"ghost",onClick:()=>A(!1),children:"Close"})]}),p.jsx("div",{className:"max-h-[60vh] overflow-auto px-4 py-3",children:p.jsx("div",{className:"flex flex-col gap-2",children:oe.length===0?p.jsx("div",{className:"border border-border px-3 py-6 text-center text-sm text-muted-foreground",children:"No columns to display."}):oe.map((q,W)=>{const Ne=sn.find(ht=>ht.id===q);if(!Ne)return null;const je=Ne.getIsVisible(),be=W===0,Ye=W===oe.length-1;return p.jsxs("div",{className:"flex items-center gap-2 border border-border px-3 py-2 text-xs",children:[p.jsx("input",{type:"checkbox",checked:je,onChange:()=>gn(q)}),p.jsx("span",{className:"flex-1 truncate",children:q}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(ae,{type:"button",size:"icon",variant:"ghost",disabled:be,onClick:()=>We(q,"up"),children:p.jsx(KH,{className:"h-4 w-4"})}),p.jsx(ae,{type:"button",size:"icon",variant:"ghost",disabled:Ye,onClick:()=>We(q,"down"),children:p.jsx(Mo,{className:"h-4 w-4"})}),a?p.jsx(ae,{type:"button",size:"icon",variant:"ghost",onClick:()=>a(q),children:p.jsx(ic,{className:"h-4 w-4 text-destructive"})}):null]})]},q)})})}),p.jsxs("div",{className:"flex justify-between border-t border-border px-4 py-3",children:[p.jsxs("div",{className:"flex gap-2",children:[p.jsx(ae,{type:"button",size:"sm",variant:"ghost",onClick:()=>{Le({columnOrder:_,columnVisibility:{}})},children:"Reset columns"}),l?p.jsxs(ae,{type:"button",size:"sm",variant:"ghost",onClick:()=>l(),children:[p.jsx($n,{className:"mr-1 h-3 w-3"}),"Add column"]}):null]}),p.jsx(ae,{type:"button",size:"sm",onClick:()=>A(!1),children:"Done"})]})]})}):null,p.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:U?p.jsx("div",{className:"flex min-h-0 flex-col gap-3",children:Dt.getGroupedRowModel().rows.length===0?p.jsx("div",{className:"border border-border px-3 py-10 text-center text-sm text-muted-foreground",children:"No rows to display."}):Dt.getGroupedRowModel().rows.map(q=>{const W=q.groupingValue===void 0||q.groupingValue===null?"(empty)":String(q.groupingValue),Ne=q.getLeafRows();return p.jsxs("div",{className:"border border-border",children:[p.jsxs("button",{type:"button",onClick:q.getToggleExpandedHandler(),className:"flex w-full items-center gap-2 border-b border-border bg-muted px-3 py-2 text-left text-xs font-medium text-foreground",children:[q.getIsExpanded()?p.jsx(Mo,{className:"h-4 w-4"}):p.jsx(Au,{className:"h-4 w-4"}),p.jsx("span",{children:W}),p.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",Ne.length,")"]})]}),q.getIsExpanded()&&p.jsxs("table",{className:"w-full border-collapse text-sm",children:[p.jsx("thead",{className:"sticky top-0 bg-muted",children:Dt.getHeaderGroups().map(je=>p.jsxs("tr",{children:[je.headers.map(be=>p.jsx("th",{className:mt("border-b border-border px-3 py-2 text-left font-medium text-foreground",be.column.getCanSort()&&"cursor-pointer select-none",Kn),onClick:!w&&be.column.getCanSort()?be.column.getToggleSortingHandler():void 0,children:p.jsxs("div",{className:"flex items-center gap-1",children:[be.isPlaceholder?null:Ca(be.column.columnDef.header,be.getContext()),w?null:{asc:p.jsx(sm,{className:"h-3 w-3"}),desc:p.jsx(tw,{className:"h-3 w-3"})}[be.column.getIsSorted()]??null]})},be.id)),on?p.jsx("th",{className:"border-b border-border px-3 py-2 text-left text-xs text-muted-foreground",children:p.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 text-muted-foreground hover:text-foreground",onClick:()=>l==null?void 0:l(),children:[p.jsx($n,{className:"h-3 w-3"}),d]})}):null]},je.id))}),p.jsx("tbody",{children:Ne.length===0?p.jsx("tr",{children:p.jsx("td",{colSpan:Dt.getVisibleLeafColumns().length,className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No rows to display."})}):Ne.map(je=>p.jsxs("tr",{className:"border-b border-border last:border-0",children:[je.getVisibleCells().map(be=>p.jsx("td",{className:mt("h-10 px-3 py-2 align-top",Kn),children:Ca(be.column.columnDef.cell,be.getContext())},be.id)),on?p.jsx("td",{className:"h-10 px-3 py-2"}):null]},je.id))})]})]},q.id)})}):p.jsx("div",{className:"min-h-0 border border-border",children:p.jsxs("table",{className:"w-full border-collapse text-sm",children:[p.jsx("thead",{className:"sticky top-0 bg-muted",children:Dt.getHeaderGroups().map(q=>p.jsxs("tr",{children:[q.headers.map(W=>p.jsx("th",{className:mt("border-b border-border px-3 py-2 text-left font-medium text-foreground",W.column.getCanSort()&&"cursor-pointer select-none",Kn),onClick:!w&&W.column.getCanSort()?W.column.getToggleSortingHandler():void 0,children:p.jsxs("div",{className:"flex items-center gap-1",children:[W.isPlaceholder?null:Ca(W.column.columnDef.header,W.getContext()),w?null:{asc:p.jsx(sm,{className:"h-3 w-3"}),desc:p.jsx(tw,{className:"h-3 w-3"})}[W.column.getIsSorted()]??null]})},W.id)),on?p.jsx("th",{className:"border-b border-border px-3 py-2 text-left text-xs text-muted-foreground",children:p.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 text-muted-foreground hover:text-foreground",onClick:()=>l==null?void 0:l(),children:[p.jsx($n,{className:"h-3 w-3"}),d]})}):null]},q.id))}),p.jsx("tbody",{children:dt?Array.from({length:u},(q,W)=>{const Ne=W===0;return p.jsxs("tr",{className:"border-b border-border last:border-0",children:[Mr.map((je,be)=>p.jsx("td",{className:mt("h-10 px-3 py-2 align-top text-xs text-muted-foreground",Kn),children:Ne&&be===0&&Li?p.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 text-muted-foreground hover:text-foreground",onClick:()=>o==null?void 0:o(),children:[p.jsx($n,{className:"h-3 w-3"}),c]}):null},`${je.id}-${be}`)),on?p.jsx("td",{className:"h-10 px-3 py-2"}):null]},`empty-${W}`)}):Dt.getRowModel().rows.length===0?p.jsx("tr",{children:p.jsx("td",{colSpan:Mr.length+(on?1:0),className:"px-3 py-10 text-center text-sm text-muted-foreground",children:"No rows to display."})}):p.jsxs(p.Fragment,{children:[Dt.getRowModel().rows.map(q=>p.jsxs("tr",{className:"border-b border-border last:border-0",children:[q.getVisibleCells().map(W=>p.jsx("td",{className:mt("h-10 px-3 py-2 align-top",Kn),children:W.getIsGrouped()?p.jsxs("button",{type:"button",onClick:q.getToggleExpandedHandler(),className:"flex items-center gap-1 text-left text-xs font-medium text-muted-foreground",children:[q.getIsExpanded()?p.jsx(Mo,{className:"h-4 w-4"}):p.jsx(Au,{className:"h-4 w-4"}),Ca(W.column.columnDef.cell,W.getContext()),p.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",q.subRows.length,")"]})]}):W.getIsAggregated()?Ca(W.column.columnDef.aggregatedCell??W.column.columnDef.cell,W.getContext()):W.getIsPlaceholder()?null:Ca(W.column.columnDef.cell,W.getContext())},W.id)),on?p.jsx("td",{className:"h-10 px-3 py-2"}):null]},q.id)),hc?p.jsxs("tr",{className:"border-b border-border last:border-0",children:[Mr.map((q,W)=>p.jsx("td",{className:mt("h-10 px-3 py-2 align-top text-xs text-muted-foreground",Kn),children:W===0?p.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 text-muted-foreground hover:text-foreground",onClick:()=>o==null?void 0:o(),children:[p.jsx($n,{className:"h-3 w-3"}),c]}):null},`${q.id}-new-${W}`)),on?p.jsx("td",{className:"h-10 px-3 py-2"}):null]}):null]})})]})})})]})}const eG=e=>!e||!e.id?[]:[{id:e.id,desc:!!e.desc}],tG=e=>e?[e]:[],nG=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[],rG=e=>!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([,t])=>typeof t=="boolean")),Hc=(e,t)=>{if(!e||!t)return!1;const n=e.sorting[0],r=t.sorting[0];if(!!n!=!!r||n&&r&&(n.id!==r.id||!!n.desc!=!!r.desc))return!1;const s=e.grouping[0]??"",i=t.grouping[0]??"";if(s!==i||e.columnOrder.length!==t.columnOrder.length||e.columnOrder.some((a,u)=>a!==t.columnOrder[u]))return!1;const o=Object.keys(e.columnVisibility).sort(),l=Object.keys(t.columnVisibility).sort();if(o.length!==l.length)return!1;for(let a=0;a<o.length;a+=1){const u=o[a];if(u!==l[a]||e.columnVisibility[u]!==t.columnVisibility[u])return!1}return!0},nT=e=>{const t=o=>{try{return JSON.parse(o)}catch{return null}},n=t(e);if(!n)return{error:"Invalid JSON",payload:null,format:"object"};let r=n,s="object";if(Array.isArray(n))s="array",r={data:n};else if(typeof n=="object"&&n!==null){const o=n;if(typeof o.content=="string"){const l=t(o.content);Array.isArray(l)?(s="array",r={data:l}):typeof l=="object"&&l!==null&&(s="object",r=l)}}else return{error:"JSON must be an object or array.",payload:null,format:s};const i=YQ.safeParse(r);return i.success?{error:null,payload:i.data,format:s}:{error:"JSON must be an object or array.",payload:null,format:s}},sG=({active:e,content:t,lastSaved:n,headerTags:r,setContent:s,setIsDirty:i,setLastEditAt:o,writeDoc:l})=>{const[a,u]=x.useState(null),[c,d]=x.useState(null),[h,f]=x.useState(null),[m,g]=x.useState(null),[v,y]=x.useState(""),[w,b]=x.useState(""),[C,S]=x.useState({columns:[{id:"name",name:"Name",type:"text"}]}),k=x.useRef(null),E=x.useRef(null),N=x.useRef(null),O=x.useRef(null),T=x.useRef(null),j=x.useRef("object"),A=x.useRef(!1),z=x.useRef(null);x.useEffect(()=>{var sn;if(!e||e.type!=="json"||z.current===t)return;const{error:I,payload:V,format:Y}=nT(t);if(!V){y(I??"Invalid JSON"),u(null),d(null),f(null),g(null),T.current=null,j.current="object",A.current=!1;return}if(!Array.isArray(V.data)){y("JSON `data` must be an array of objects."),u(null),d(null),f(null),g(null),T.current=null,j.current="object",A.current=!1;return}if(!V.data.every(ct=>ct&&typeof ct=="object"&&!Array.isArray(ct))){y("JSON `data` must be an array of objects."),u(null),d(null),f(null),g(null),T.current=null,j.current="object",A.current=!1;return}y(""),u(V.data);const G=V.metadata?AI.safeParse(V.metadata):null,me=V.schema?PI.safeParse(V.schema):null,we=G!=null&&G.success?G.data:void 0,qe=me!=null&&me.success?me.data:void 0;d(qe??null),T.current={...V,metadata:we,schema:qe},j.current=Y,A.current=!!((sn=qe==null?void 0:qe.columns)!=null&&sn.length);const ut={sorting:eG(we==null?void 0:we.sortBy),grouping:tG(we==null?void 0:we.groupBy),columnOrder:nG(we==null?void 0:we.columnOrder),columnVisibility:rG(we==null?void 0:we.columnVisibility)},rn=N.current,Le=O.current,Dt=rn&&Le&&!Hc(rn,Le);f(ct=>ct&&Hc(ct,ut)?ct:ut),g(ct=>Dt||ct&&Hc(ct,ut)?ct:ut)},[e,t]),x.useEffect(()=>{if(c&&c.columns.length>0)return;if(!a){w!==""&&(b(""),S({columns:[{id:"name",name:"Name",type:"text"}]}));return}const I=[];a.forEach((Y,G)=>{const me=Object.keys(Y);if(G===0){I.push(...me);return}me.forEach(we=>{I.includes(we)||I.push(we)})});const V=I.join("|");V!==w&&(b(V),S(V.length>0?{columns:I.map(Y=>({id:Y,name:Y,type:"text"}))}:{columns:[{id:"name",name:"Name",type:"text"}]}))},[w,a,c]);const D=x.useMemo(()=>c&&c.columns.length>0?c:C,[C,c]),L=x.useCallback((I,V)=>I.length!==V.length?!1:I.every((Y,G)=>Y===V[G]),[]),H=x.useCallback((I,V)=>{const Y=I.filter(me=>V.includes(me)),G=V.filter(me=>!Y.includes(me));return[...Y,...G]},[]),K=x.useCallback((I,V)=>{if(I.columnOrder.length===0)return I;const Y=V.columns.map(me=>me.id),G=H(I.columnOrder,Y);return L(G,I.columnOrder)?I:{...I,columnOrder:G}},[L,H]);x.useEffect(()=>{if(!m)return;const I=K(m,D);I!==m&&g(I)},[D,K,m]),x.useEffect(()=>{k.current=a},[a]),x.useEffect(()=>{E.current=D},[D]),x.useEffect(()=>{N.current=h},[h]),x.useEffect(()=>{O.current=m},[m]);const _=x.useCallback((I,V)=>{if(!e||e.type!=="json")return;const Y=T.current??{},G=(V==null?void 0:V.nextSchema)??null,me={...Y??{},data:I};G&&G.columns.length>0?me.schema=G:delete me.schema;const we=j.current==="array"&&!me.metadata&&!me.schema,qe=JSON.stringify(we?I:me,null,2);z.current=qe,s(qe),y(""),o(Date.now()),i(qe!==n),u(I),G&&G.columns.length>0&&(d(G),A.current=!0,j.current="object"),T.current=me},[e,n,s,i,o]),Q=x.useCallback(I=>{_(I)},[_]),M=x.useCallback(()=>{const I=E.current??D,V={};I.columns.forEach(G=>{V[G.id]=G.type==="object"?null:""});const Y=k.current??a??[];_([...Y,V])},[_,D,a]),oe=x.useCallback(async I=>{if(!e||e.type!=="json")return;const Y=nT(t).payload,G=T.current??Y??{},me={...G??{},data:Array.isArray(G.data)?G.data:a??[],metadata:{...(G==null?void 0:G.metadata)??{},sortBy:I.sorting[0]?{id:I.sorting[0].id,desc:!!I.sorting[0].desc}:null,groupBy:I.grouping[0]??null,columnOrder:I.columnOrder.length>0?I.columnOrder:null,columnVisibility:Object.keys(I.columnVisibility).length>0?I.columnVisibility:null}},we=JSON.stringify(me,null,2);s(we),i(we!==n),z.current=we,await l(we,{tags:r,pinned:void 0}),f(I),g(I),T.current=me,j.current="object"},[e,t,r,a,n,s,i,l]),F=x.useCallback((I,V)=>{const G=I.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)+/g,"")||"column";let me=G,we=1;for(;V.includes(me);)me=`${G}-${we}`,we+=1;return me},[]),R=x.useCallback(I=>I.split(",").map(V=>V.trim()).filter(V=>V.length>0),[]);return{jsonError:v,jsonData:a,tableDefaults:h,tableView:m,setTableView:g,effectiveSchema:D,tableSchema:c,handleTableRowsChange:Q,handleAddRow:M,commitTableUpdate:_,persistTableView:oe,createColumnId:F,parseColumnOptions:R,viewEquals:Hc}},iG=()=>{const{main:{tableDefaults:e,tableView:t,setTableView:n,persistTableView:r,jsonData:s,effectiveSchema:i,handleTableRowsChange:o,handleAddRow:l,deleteTableColumn:a,jsonError:u,content:c,setContent:d,setLastEditAt:h}}=Tr(),[f,m]=x.useState(!1),v=e&&t&&!Hc(e,t)?p.jsxs("div",{className:"flex flex-wrap items-center gap-2 border border-warning bg-warning px-3 py-1.5 text-xs text-warning-foreground",children:[p.jsx("span",{children:"View changes are temporary."}),p.jsx(ae,{type:"button",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>r(t),children:"Save as default"}),p.jsx(ae,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-xs",onClick:()=>n(e),children:"Reset"})]}):null;return p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:t?p.jsx(XQ,{rows:s??[],schema:i,view:t,onViewChange:n,onRowsChange:o,onAddRow:l,onAddColumn:()=>m(!0),onDeleteColumn:a,addRowLabel:"New row",addColumnLabel:"Add property",belowToolbar:v}):p.jsx("div",{className:"rounded-md border border-border bg-card px-3 py-6 text-sm text-muted-foreground",children:"Loading table…"})}),f?p.jsx(kK,{open:f,onOpenChange:m}):null,u?p.jsx("div",{className:"text-sm text-destructive",children:u}):null,null]})};var _I={exports:{}},II={};/**
|
|
479
|
+
* @license React
|
|
480
|
+
* use-sync-external-store-shim.production.js
|
|
481
|
+
*
|
|
482
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
483
|
+
*
|
|
484
|
+
* This source code is licensed under the MIT license found in the
|
|
485
|
+
* LICENSE file in the root directory of this source tree.
|
|
486
|
+
*/var Uu=x;function oG(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var lG=typeof Object.is=="function"?Object.is:oG,aG=Uu.useState,uG=Uu.useEffect,cG=Uu.useLayoutEffect,dG=Uu.useDebugValue;function fG(e,t){var n=t(),r=aG({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return cG(function(){s.value=n,s.getSnapshot=t,Fx(s)&&i({inst:s})},[e,n,t]),uG(function(){return Fx(s)&&i({inst:s}),e(function(){Fx(s)&&i({inst:s})})},[e]),dG(n),n}function Fx(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!lG(e,n)}catch{return!0}}function hG(e,t){return t()}var pG=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?hG:fG;II.useSyncExternalStore=Uu.useSyncExternalStore!==void 0?Uu.useSyncExternalStore:pG;_I.exports=II;var g1=_I.exports;function un(e){this.content=e}un.prototype={constructor:un,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,s=r.find(e),i=r.content.slice();return s==-1?i.push(n||e,t):(i[s+1]=t,n&&(i[s]=n)),new un(i)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new un(n)},addToStart:function(e,t){return new un([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new un(n)},addBefore:function(e,t,n){var r=this.remove(t),s=r.content.slice(),i=r.find(e);return s.splice(i==-1?s.length:i,0,t,n),new un(s)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=un.from(e),e.size?new un(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=un.from(e),e.size?new un(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=un.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}};un.from=function(e){if(e instanceof un)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new un(t)};function DI(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let s=e.child(r),i=t.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)n++;return n}if(s.content.size||i.content.size){let o=DI(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function LI(e,t,n,r){for(let s=e.childCount,i=t.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=e.child(--s),l=t.child(--i),a=o.nodeSize;if(o==l){n-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let u=0,c=Math.min(o.text.length,l.text.length);for(;u<c&&o.text[o.text.length-u-1]==l.text[l.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(o.content.size||l.content.size){let u=LI(o.content,l.content,n-1,r-1);if(u)return u}n-=a,r-=a}}class J{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,s=0,i){for(let o=0,l=0;l<n;o++){let a=this.content[o],u=l+a.nodeSize;if(u>t&&r(a,s+l,i||null,o)!==!1&&a.content.size){let c=l+1;a.nodesBetween(Math.max(0,t-c),Math.min(a.content.size,n-c),r,s+c)}l=u}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,s){let i="",o=!0;return this.nodesBetween(t,n,(l,a)=>{let u=l.isText?l.text.slice(Math.max(t,a)-a,n-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=u},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<t.content.length;i++)s.push(t.content[i]);return new J(s,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],s=0;if(n>t)for(let i=0,o=0;o<n;i++){let l=this.content[i],a=o+l.nodeSize;a>t&&((o<t||a>n)&&(l.isText?l=l.cut(Math.max(0,t-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,t-o-1),Math.min(l.content.size,n-o-1))),r.push(l),s+=l.nodeSize),o=a}return new J(r,s)}cutByIndex(t,n){return t==n?J.empty:t==0&&n==this.content.length?this:new J(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[t]=n,new J(s,i)}addToStart(t){return new J([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new J(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.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(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];t(s,r,n),r+=s.nodeSize}}findDiffStart(t,n=0){return DI(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return LI(this,t,n,r)}findIndex(t){if(t==0)return Rh(0,t);if(t==this.size)return Rh(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=t)return i==t?Rh(n+1,i):Rh(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return J.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new J(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return J.empty;let n,r=0;for(let s=0;s<t.length;s++){let i=t[s];r+=i.nodeSize,s&&i.isText&&t[s-1].sameMarkup(i)?(n||(n=t.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new J(n||t,r)}static from(t){if(!t)return J.empty;if(t instanceof J)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new J([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}J.empty=new J([],0);const Bx={index:0,offset:0};function Rh(e,t){return Bx.index=e,Bx.offset=t,Bx}function km(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!km(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!km(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}let ft=class Nw{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let s=0;s<t.length;s++){let i=t[s];if(this.eq(i))return t;if(this.type.excludes(i.type))n||(n=t.slice(0,s));else{if(i.type.excludes(this.type))return t;!r&&i.type.rank>this.type.rank&&(n||(n=t.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&km(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return Nw.none;if(t instanceof Nw)return[t];let n=t.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};ft.none=[];class Sm extends Error{}class ue{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=zI(this.content,t+this.openStart,n);return r&&new ue(r,this.openStart,this.openEnd)}removeBetween(t,n){return new ue($I(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return ue.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ue(J.fromJSON(t,n.content),r,s)}static maxOpen(t,n=!0){let r=0,s=0;for(let i=t.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=t.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new ue(t,r,s)}}ue.empty=new ue(J.empty,0,0);function $I(e,t,n){let{index:r,offset:s}=e.findIndex(t),i=e.maybeChild(r),{index:o,offset:l}=e.findIndex(n);if(s==t||i.isText){if(l!=n&&!e.child(o).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy($I(i.content,t-s-1,n-s-1)))}function zI(e,t,n,r){let{index:s,offset:i}=e.findIndex(t),o=e.maybeChild(s);if(i==t||o.isText)return r&&!r.canReplace(s,s,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=zI(o.content,t-i-1,n,o);return l&&e.replaceChild(s,o.copy(l))}function mG(e,t,n){if(n.openStart>e.depth)throw new Sm("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Sm("Inconsistent open depths");return FI(e,t,n,0)}function FI(e,t,n,r){let s=e.index(r),i=e.node(r);if(s==t.index(r)&&r<e.depth-n.openStart){let o=FI(e,t,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let o=e.parent,l=o.content;return Ll(o,l.cut(0,e.parentOffset).append(n.content).append(l.cut(t.parentOffset)))}else{let{start:o,end:l}=gG(n,e);return Ll(i,VI(e,o,l,t,r))}else return Ll(i,Cm(e,t,r))}function BI(e,t){if(!t.type.compatibleContent(e.type))throw new Sm("Cannot join "+t.type.name+" onto "+e.type.name)}function Tw(e,t,n){let r=e.node(n);return BI(r,t.node(n)),r}function Dl(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function ud(e,t,n,r){let s=(t||e).node(n),i=0,o=t?t.index(n):s.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(Dl(e.nodeAfter,r),i++));for(let l=i;l<o;l++)Dl(s.child(l),r);t&&t.depth==n&&t.textOffset&&Dl(t.nodeBefore,r)}function Ll(e,t){return e.type.checkContent(t),e.copy(t)}function VI(e,t,n,r,s){let i=e.depth>s&&Tw(e,t,s+1),o=r.depth>s&&Tw(n,r,s+1),l=[];return ud(null,e,s,l),i&&o&&t.index(s)==n.index(s)?(BI(i,o),Dl(Ll(i,VI(e,t,n,r,s+1)),l)):(i&&Dl(Ll(i,Cm(e,t,s+1)),l),ud(t,n,s,l),o&&Dl(Ll(o,Cm(n,r,s+1)),l)),ud(r,null,s,l),new J(l)}function Cm(e,t,n){let r=[];if(ud(null,e,n,r),e.depth>n){let s=Tw(e,t,n+1);Dl(Ll(s,Cm(e,t,n+1)),r)}return ud(t,null,n,r),new J(r)}function gG(e,t){let n=t.depth-e.openStart,s=t.node(n).copy(e.content);for(let i=n-1;i>=0;i--)s=t.node(i).copy(J.from(s));return{start:s.resolveNoCache(e.openStart+n),end:s.resolveNoCache(s.content.size-e.openEnd-n)}}class Yd{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=t.child(n);return r?t.child(n).cut(r):s}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<t;i++)s+=r.child(i).nodeSize;return s}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return ft.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),s=t.maybeChild(n);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=t.parent.maybeChild(t.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new Em(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,i=n;for(let o=t;;){let{index:l,offset:a}=o.content.findIndex(i),u=i-a;if(r.push(o,l,s+a),!u||(o=o.child(l),o.isText))break;i=u-1,s+=a+1}return new Yd(n,r,i)}static resolveCached(t,n){let r=rT.get(t);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else rT.set(t,r=new yG);let s=r.elts[r.i]=Yd.resolve(t,n);return r.i=(r.i+1)%xG,s}}class yG{constructor(){this.elts=[],this.i=0}}const xG=12,rT=new WeakMap;class Em{constructor(t,n,r){this.$from=t,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 vG=Object.create(null);let jo=class Rw{constructor(t,n,r,s=ft.none){this.type=t,this.attrs=n,this.marks=s,this.content=r||J.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,s=0){this.content.nodesBetween(t,n,r,s,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,s){return this.content.textBetween(t,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&km(this.attrs,n||t.defaultAttrs||vG)&&ft.sameSet(this.marks,r||ft.none)}copy(t=null){return t==this.content?this:new Rw(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Rw(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return ue.empty;let s=this.resolve(t),i=this.resolve(n),o=r?0:s.sharedDepth(n),l=s.start(o),u=s.node(o).content.cut(s.pos-l,i.pos-l);return new ue(u,s.depth-o,i.depth-o)}replace(t,n,r){return mG(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(s==t||n.isText)return n;t-=s+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(t){return Yd.resolveCached(this,t)}resolveNoCache(t){return Yd.resolve(this,t)}rangeHasMark(t,n,r){let s=!1;return n>t&&this.nodesBetween(t,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),HI(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=J.empty,s=0,i=r.childCount){let o=this.contentMatchAt(t).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(t,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(t).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=ft.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!ft.sameSet(t,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 t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,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(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let s=J.fromJSON(t,n.content),i=t.nodeType(n.type).create(n.attrs,s,r);return i.type.checkAttrs(i.attrs),i}};jo.prototype.text=void 0;class Nm extends jo{constructor(t,n,r,s){if(super(t,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):HI(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Nm(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Nm(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function HI(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class Yl{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new wG(t,n);if(r.next==null)return Yl.empty;let s=UI(r);r.next&&r.err("Unexpected trailing text");let i=TG(NG(s));return RG(i,r),i}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let s=this;for(let i=n;s&&i<r;i++)s=s.matchType(t.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(t,r);if(a&&(!n||a.validEnd))return J.from(l.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:c,next:d}=o.next[u];if(!(c.isText||c.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let h=i(d,l.concat(c));if(h)return h}}return null}return i(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(t)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let s=0;s<r.next.length;s++)t.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),t.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+t.indexOf(r.next[o].next);return i}).join(`
|
|
487
|
+
`)}}Yl.empty=new Yl(!0);class wG{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.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(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function UI(e){let t=[];do t.push(bG(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function bG(e){let t=[];do t.push(kG(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function kG(e){let t=EG(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=SG(e,t);else break;return t}function sT(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function SG(e,t){let n=sT(e),r=n;return e.eat(",")&&(e.next!="}"?r=sT(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function CG(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(t)&&s.push(o)}return s.length==0&&e.err("No node type or group '"+t+"' found"),s}function EG(e){if(e.eat("(")){let t=UI(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=CG(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function NG(e){let t=[[]];return s(i(e,0),n()),t;function n(){return t.push([])-1}function r(o,l,a){let u={term:a,to:l};return t[o].push(u),u}function s(o,l){o.forEach(a=>a.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((a,u)=>a.concat(i(u,l)),[]);if(o.type=="seq")for(let a=0;;a++){let u=i(o.exprs[a],l);if(a==o.exprs.length-1)return u;s(u,l=n())}else if(o.type=="star"){let a=n();return r(l,a),s(i(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=n();return s(i(o.expr,l),a),s(i(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let a=l;for(let u=0;u<o.min;u++){let c=n();s(i(o.expr,a),c),a=c}if(o.max==-1)s(i(o.expr,a),a);else for(let u=o.min;u<o.max;u++){let c=n();r(a,c),s(i(o.expr,a),c),a=c}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function qI(e,t){return t-e}function iT(e,t){let n=[];return r(t),n.sort(qI);function r(s){let i=e[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:l,to:a}=i[o];!l&&n.indexOf(a)==-1&&r(a)}}}function TG(e){let t=Object.create(null);return n(iT(e,0));function n(r){let s=[];r.forEach(o=>{e[o].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let c=0;c<s.length;c++)s[c][0]==l&&(u=s[c][1]);iT(e,a).forEach(c=>{u||s.push([l,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let i=t[r.join(",")]=new Yl(r.indexOf(e.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(qI);i.next.push({type:s[o][0],next:t[l.join(",")]||n(l)})}return i}}function RG(e,t){for(let n=0,r=[e];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:a,next:u}=s.next[l];o.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(u)==-1&&r.push(u)}i&&t.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function WI(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function KI(e,t){let n=Object.create(null);for(let r in e){let s=t&&t[r];if(s===void 0){let i=e[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function QI(e,t,n,r){for(let s in t)if(!(s in e))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${s}`);for(let s in e){let i=e[s];i.validate&&i.validate(t[s])}}function GI(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new OG(e,r,t[r]);return n}let oT=class JI{constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=GI(t,r.attrs),this.defaultAttrs=WI(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Yl.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:KI(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new jo(this,this.computeAttrs(t),J.from(n),ft.setFrom(r))}createChecked(t=null,n,r){return n=J.from(n),this.checkContent(n),new jo(this,this.computeAttrs(t),n,ft.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=J.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(J.empty,!0);return i?new jo(this,t,n.append(i),ft.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){QI(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:ft.none:t}static compile(t,n){let r=Object.create(null);t.forEach((i,o)=>r[i]=new JI(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function MG(e,t,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}class OG{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?MG(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class ry{constructor(t,n,r,s){this.name=t,this.rank=n,this.schema=r,this.spec=s,this.attrs=GI(t,s.attrs),this.excluded=null;let i=WI(this.attrs);this.instance=i?new ft(this,i):null}create(t=null){return!t&&this.instance?this.instance:new ft(this,KI(this.attrs,t))}static compile(t,n){let r=Object.create(null),s=0;return t.forEach((i,o)=>r[i]=new ry(i,s++,n,o)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}checkAttrs(t){QI(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}let ZI=class{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in t)n[s]=t[s];n.nodes=un.from(t.nodes),n.marks=un.from(t.marks||{}),this.nodes=oT.compile(this.spec.nodes,this),this.marks=ry.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=Yl.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?lT(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:lT(this,o.split(" "))}this.nodeFromJSON=s=>jo.fromJSON(this,s),this.markFromJSON=s=>ft.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,s){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof oT){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,s)}text(t,n){let r=this.nodes.text;return new Nm(r,r.defaultAttrs,t,ft.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}};function lT(e,t){let n=[];for(let r=0;r<t.length;r++){let s=t[r],i=e.marks[s],o=i;if(i)n.push(i);else for(let l in e.marks){let a=e.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function jG(e){return e.tag!=null}function PG(e){return e.style!=null}class Ci{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(jG(s))this.tags.push(s);else if(PG(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=t.nodes[s.node];return i.contentMatch.matchType(i)})}parse(t,n={}){let r=new uT(this,n,!1);return r.addAll(t,ft.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new uT(this,n,!0);return r.addAll(t,ft.none,n.from,n.to),ue.maxOpen(r.finish())}matchTag(t,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(IG(t,i.tag)&&(i.namespace===void 0||t.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(t);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(t,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(t)!=0||o.context&&!r.matchesContext(o.context)||l.length>t.length&&(l.charCodeAt(t.length)!=61||l.slice(t.length+1)!=n))){if(o.getAttrs){let a=o.getAttrs(n);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(t){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let l=n[o];if((l.priority==null?50:l.priority)<i)break}n.splice(o,0,s)}for(let s in t.marks){let i=t.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=cT(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in t.nodes){let i=t.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=cT(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Ci(t,Ci.schemaRules(t)))}}const YI={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},AG={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},XI={ol:!0,ul:!0},Xd=1,Mw=2,cd=4;function aT(e,t,n){return t!=null?(t?Xd:0)|(t==="full"?Mw:0):e&&e.whitespace=="pre"?Xd|Mw:n&~cd}class Mh{constructor(t,n,r,s,i,o){this.type=t,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=ft.none,this.match=i||(o&cd?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(J.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(t.type))?(this.match=r,s):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Xd)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=J.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(J.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!YI.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class uT{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=aT(null,n.preserveWhitespace,0)|(r?cd:0);s?i=new Mh(s.type,s.attrs,ft.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new Mh(null,null,ft.none,!0,null,o):i=new Mh(t.schema.topNodeType,null,ft.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let r=t.nodeValue,s=this.top,i=s.options&Mw?"full":this.localPreserveWS||(s.options&Xd)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
488
|
+
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(o.text(l[a]),n,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=t.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(t)}else this.findInside(t)}addElement(t,n,r){let s=this.localPreserveWS,i=this.top;(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let o=t.nodeName.toLowerCase(),l;XI.hasOwnProperty(o)&&this.parser.normalizeLists&&_G(t);let a=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(l=this.parser.matchTag(t,this,r));e:if(a?a.ignore:AG.hasOwnProperty(o))this.findInside(t),this.ignoreFallback(t,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(t=a.skip);let u,c=this.needsBlock;if(YI.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,n);break e}let d=a&&a.skip?n:this.readStyles(t,n);d&&this.addAll(t,d),u&&this.sync(i),this.needsBlock=c}else{let u=this.readStyles(t,n);u&&this.addElementByRule(t,a,u,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(t,n){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
|
|
489
|
+
`),n)}ignoreFallback(t,n){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(t,n){let r=t.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(u=>!a.clearMark(u)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(t,n,r,s){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,t.nodeName=="BR")||this.leafFallback(t,r);else{let a=this.enter(o,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(t);else if(s)this.addElement(t,r,s);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=t;typeof n.contentElement=="string"?a=t.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(t):n.contentElement&&(a=n.contentElement),this.findAround(t,a,!0),this.addAll(a,r),this.findAround(t,a,!1)}i&&this.sync(l)&&this.open--}addAll(t,n,r,s){let i=r||0;for(let o=r?t.childNodes[r]:t.firstChild,l=s==null?null:t.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(o,n);this.findAtPoint(t,i)}findPlace(t,n,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],u=a.findWrapping(t);if(u&&(!s||s.length>u.length+l)&&(s=u,i=a,!u.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],null,n,!1);return n}insertNode(t,n,r){if(t.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let s=this.findPlace(t,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(t.type));let o=ft.none;for(let l of s.concat(t.marks))(i.type?i.type.allowsMarkType(l.type):dT(l.type,t.type))&&(o=l.addToSet(o));return i.content.push(t.mark(o)),!0}return!1}enter(t,n,r,s){let i=this.findPlace(t.create(n),r,!1);return i&&(i=this.enterInner(t,n,r,!0,s)),i}enterInner(t,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(t);let l=aT(t,i,o.options);o.options&cd&&o.content.length==0&&(l|=cd);let a=ft.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):dT(u.type,t))?(a=u.addToSet(a),!1):!0),this.nodes.push(new Mh(t,n,a,s,null,l)),this.open++,r}closeExtra(t=!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(t));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(t){for(let n=this.open;n>=0;n--){if(this.nodes[n]==t)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Xd)}return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)t+=r[s].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,r){if(t!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&t.nodeType==1&&t.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let u=n[l];if(u==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let c=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;a--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.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 _G(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&XI.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function IG(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function cT(e){let t={};for(let n in e)t[n]=e[n];return t}function dT(e,t){let n=t.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(e))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:u,next:c}=l.edge(a);if(u==t||i.indexOf(c)<0&&o(c))return!0}};if(o(s.contentMatch))return!0}}class da{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=Vx(n).createDocumentFragment());let s=r,i=[];return t.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let u=o.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(i[l][0])||u.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let u=o.marks[a++],c=this.serializeMark(u,o.isInline,n);c&&(i.push([u,s]),s.appendChild(c.dom),s=c.contentDOM||c.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(t,n){let{dom:r,contentDOM:s}=xp(Vx(n),this.nodes[t.type.name](t),null,t.attrs);if(s){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,s)}return r}serializeNode(t,n={}){let r=this.serializeNodeInner(t,n);for(let s=t.marks.length-1;s>=0;s--){let i=this.serializeMark(t.marks[s],t.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(t,n,r={}){let s=this.marks[t.type.name];return s&&xp(Vx(r),s(t,n),null,t.attrs)}static renderSpec(t,n,r=null,s){return xp(t,n,r,s)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new da(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=fT(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return fT(t.marks)}}function fT(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Vx(e){return e.document||window.document}const hT=new WeakMap;function DG(e){let t=hT.get(e);return t===void 0&&hT.set(e,t=LG(e)),t}function LG(e){let t=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")t||(t=[]),t.push(r);else for(let s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(e),t}function xp(e,t,n,r){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let s=t[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=DG(r))&&i.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let l,a=n?e.createElementNS(n,s):e.createElement(s),u=t[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let h=d.indexOf(" ");h>0?a.setAttributeNS(d.slice(0,h),d.slice(h+1),u[d]):d=="style"&&a.style?a.style.cssText=u[d]:a.setAttribute(d,u[d])}}for(let d=c;d<t.length;d++){let h=t[d];if(h===0){if(d<t.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:f,contentDOM:m}=xp(e,h,n,r);if(a.appendChild(f),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const eD=65535,tD=Math.pow(2,16);function $G(e,t){return e+t*tD}function pT(e){return e&eD}function zG(e){return(e-(e&eD))/tD}const nD=1,rD=2,vp=4,sD=8;class Ow{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&sD)>0}get deletedBefore(){return(this.delInfo&(nD|vp))>0}get deletedAfter(){return(this.delInfo&(rD|vp))>0}get deletedAcross(){return(this.delInfo&vp)>0}}class pr{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&pr.empty)return pr.empty}recover(t){let n=0,r=pT(t);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+zG(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>t)break;let u=this.ranges[l+i],c=this.ranges[l+o],d=a+u;if(t<=d){let h=u?t==a?-1:t==d?1:n:n,f=a+s+(h<0?0:c);if(r)return f;let m=t==(n<0?a:d)?null:$G(l/3,t-a),g=t==a?rD:t==d?nD:vp;return(n<0?t!=a:t!=d)&&(g|=sD),new Ow(f,g,m)}s+=c-u}return r?t+s:new Ow(t+s,0,null)}touches(t,n){let r=0,s=pT(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>t)break;let u=this.ranges[l+i],c=a+u;if(t<=c&&l==s*3)return!0;r+=this.ranges[l+o]-u}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),u=this.ranges[s+n],c=this.ranges[s+r];t(l,l+u,a,a+c),i+=c-u}}invert(){return new pr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?pr.empty:new pr(t<0?[0,-t,0]:[0,0,t])}}pr.empty=new pr([]);class ef{constructor(t,n,r=0,s=t?t.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=t||[],this.ownData=!(t||n)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new ef(this._maps,this.mirror,t,n)}appendMap(t,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(t){for(let n=0,r=this._maps.length;n<t._maps.length;n++){let s=t.getMirror(n);this.appendMap(t._maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this._maps.length+t._maps.length;n>=0;n--){let s=t.getMirror(n);this.appendMap(t._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let t=new ef;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this._maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(t,n);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,t=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,t=l.pos}return r?t:new Ow(t,s,null)}}const Hx=Object.create(null);class jn{getMap(){return pr.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Hx[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in Hx)throw new RangeError("Duplicate use of step JSON ID "+t);return Hx[t]=n,n.prototype.jsonID=t,n}}class Ft{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Ft(t,null)}static fail(t){return new Ft(null,t)}static fromReplace(t,n,r,s){try{return Ft.ok(t.replace(n,r,s))}catch(i){if(i instanceof Sm)return Ft.fail(i.message);throw i}}}function y1(e,t,n){let r=[];for(let s=0;s<e.childCount;s++){let i=e.child(s);i.content.size&&(i=i.copy(y1(i.content,t,i))),i.isInline&&(i=t(i,n,s)),r.push(i)}return J.fromArray(r)}class yo extends jn{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new ue(y1(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return Ft.fromReplace(t,this.from,this.to,i)}invert(){return new fs(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new yo(n.pos,r.pos,this.mark)}merge(t){return t instanceof yo&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new yo(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new yo(n.from,n.to,t.markFromJSON(n.mark))}}jn.jsonID("addMark",yo);class fs extends jn{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new ue(y1(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),t),n.openStart,n.openEnd);return Ft.fromReplace(t,this.from,this.to,r)}invert(){return new yo(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new fs(n.pos,r.pos,this.mark)}merge(t){return t instanceof fs&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new fs(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new fs(n.from,n.to,t.markFromJSON(n.mark))}}jn.jsonID("removeMark",fs);class xo extends jn{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Ft.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Ft.fromReplace(t,this.pos,this.pos+1,new ue(J.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new xo(this.pos,n.marks[s]);return new xo(this.pos,this.mark)}}return new Xl(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new xo(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new xo(n.pos,t.markFromJSON(n.mark))}}jn.jsonID("addNodeMark",xo);class Xl extends jn{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Ft.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Ft.fromReplace(t,this.pos,this.pos+1,new ue(J.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new xo(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Xl(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Xl(n.pos,t.markFromJSON(n.mark))}}jn.jsonID("removeNodeMark",Xl);class Yt extends jn{constructor(t,n,r,s=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=s}apply(t){return this.structure&&jw(t,this.from,this.to)?Ft.fail("Structure replace would overwrite content"):Ft.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new pr([this.from,this.to-this.from,this.slice.size])}invert(t){return new Yt(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Yt(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(t){if(!(t instanceof Yt)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?ue.empty:new ue(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Yt(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?ue.empty:new ue(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Yt(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Yt(n.from,n.to,ue.fromJSON(t,n.slice),!!n.structure)}}jn.jsonID("replace",Yt);class tn extends jn{constructor(t,n,r,s,i,o,l=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(t){if(this.structure&&(jw(t,this.from,this.gapFrom)||jw(t,this.gapTo,this.to)))return Ft.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Ft.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Ft.fromReplace(t,this.from,this.to,r):Ft.fail("Content does not fit in gap")}getMap(){return new pr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new tn(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new tn(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,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 tn(n.from,n.to,n.gapFrom,n.gapTo,ue.fromJSON(t,n.slice),n.insert,!!n.structure)}}jn.jsonID("replaceAround",tn);function jw(e,t,n){let r=e.resolve(t),s=n-t,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function FG(e,t,n,r){let s=[],i=[],o,l;e.doc.nodesBetween(t,n,(a,u,c)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let h=Math.max(u,t),f=Math.min(u+a.nodeSize,n),m=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(o&&o.to==h&&o.mark.eq(d[g])?o.to=f:s.push(o=new fs(h,f,d[g])));l&&l.to==h?l.to=f:i.push(l=new yo(h,f,r))}}),s.forEach(a=>e.step(a)),i.forEach(a=>e.step(a))}function BG(e,t,n,r){let s=[],i=0;e.doc.nodesBetween(t,n,(o,l)=>{if(!o.isInline)return;i++;let a=null;if(r instanceof ry){let u=o.marks,c;for(;c=r.isInSet(u);)(a||(a=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let u=Math.min(l+o.nodeSize,n);for(let c=0;c<a.length;c++){let d=a[c],h;for(let f=0;f<s.length;f++){let m=s[f];m.step==i-1&&d.eq(s[f].style)&&(h=m)}h?(h.to=u,h.step=i):s.push({style:d,from:Math.max(l,t),to:u,step:i})}}}),s.forEach(o=>e.step(new fs(o.from,o.to,o.style)))}function x1(e,t,n,r=n.contentMatch,s=!0){let i=e.doc.nodeAt(t),o=[],l=t+1;for(let a=0;a<i.childCount;a++){let u=i.child(a),c=l+u.nodeSize,d=r.matchType(u.type);if(!d)o.push(new Yt(l,c,ue.empty));else{r=d;for(let h=0;h<u.marks.length;h++)n.allowsMarkType(u.marks[h].type)||e.step(new fs(l,c,u.marks[h]));if(s&&u.isText&&n.whitespace!="pre"){let h,f=/\r?\n|\r/g,m;for(;h=f.exec(u.text);)m||(m=new ue(J.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),o.push(new Yt(l+h.index,l+h.index+h[0].length,m))}}l=c}if(!r.validEnd){let a=r.fillBefore(J.empty,!0);e.replace(l,l,new ue(a,0,0))}for(let a=o.length-1;a>=0;a--)e.step(o[a])}function VG(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function uc(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth,s=0,i=0;;--r){let o=e.$from.node(r),l=e.$from.index(r)+s,a=e.$to.indexAfter(r)-i;if(r<e.depth&&o.canReplace(l,a,n))return r;if(r==0||o.type.spec.isolating||!VG(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function HG(e,t,n){let{$from:r,$to:s,depth:i}=t,o=r.before(i+1),l=s.after(i+1),a=o,u=l,c=J.empty,d=0;for(let m=i,g=!1;m>n;m--)g||r.index(m)>0?(g=!0,c=J.from(r.node(m).copy(c)),d++):a--;let h=J.empty,f=0;for(let m=i,g=!1;m>n;m--)g||s.after(m+1)<s.end(m)?(g=!0,h=J.from(s.node(m).copy(h)),f++):u++;e.step(new tn(a,u,o,l,new ue(c.append(h),d,f),c.size-d,!0))}function v1(e,t,n=null,r=e){let s=UG(e,t),i=s&&qG(r,t);return i?s.map(mT).concat({type:t,attrs:n}).concat(i.map(mT)):null}function mT(e){return{type:e,attrs:null}}function UG(e,t){let{parent:n,startIndex:r,endIndex:s}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let o=i.length?i[0]:t;return n.canReplaceWith(r,s,o)?i:null}function qG(e,t){let{parent:n,startIndex:r,endIndex:s}=e,i=n.child(r),o=t.contentMatch.findWrapping(i.type);if(!o)return null;let a=(o.length?o[o.length-1]:t).contentMatch;for(let u=r;a&&u<s;u++)a=a.matchType(n.child(u).type);return!a||!a.validEnd?null:o}function WG(e,t,n){let r=J.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let l=n[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=J.from(n[o].type.create(n[o].attrs,r))}let s=t.start,i=t.end;e.step(new tn(s,i,s,i,new ue(r,0,0),n.length,!0))}function KG(e,t,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(o,l)=>{let a=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,a)&&QG(e.doc,e.mapping.slice(i).map(l),r)){let u=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!m?u=!1:!f&&m&&(u=!0)}u===!1&&oD(e,o,l,i),x1(e,e.mapping.slice(i).map(l,1),r,void 0,u===null);let c=e.mapping.slice(i),d=c.map(l,1),h=c.map(l+o.nodeSize,1);return e.step(new tn(d,h,d+1,h-1,new ue(J.from(r.create(a,null,o.marks)),0,0),1,!0)),u===!0&&iD(e,o,l,i),!1}})}function iD(e,t,n,r){t.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let a=e.mapping.slice(r).map(n+1+i+o.index);e.replaceWith(a,a+1,t.type.schema.linebreakReplacement.create())}}})}function oD(e,t,n,r){t.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=e.mapping.slice(r).map(n+1+i);e.replaceWith(o,o+1,t.type.schema.text(`
|
|
490
|
+
`))}})}function QG(e,t,n){let r=e.resolve(t),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function GG(e,t,n,r,s){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new tn(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new ue(J.from(o),0,0),1,!0))}function Ei(e,t,n=1,r){let s=e.resolve(t),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let u=s.depth-1,c=n-2;u>i;u--,c--){let d=s.node(u),h=s.index(u);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(h,d.childCount),m=r&&r[c+1];m&&(f=f.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[c]||d;if(!d.canReplace(h+1,d.childCount)||!g.type.validContent(f))return!1}let l=s.indexAfter(i),a=r&&r[0];return s.node(i).canReplaceWith(l,l,a?a.type:s.node(i+1).type)}function JG(e,t,n=1,r){let s=e.doc.resolve(t),i=J.empty,o=J.empty;for(let l=s.depth,a=s.depth-n,u=n-1;l>a;l--,u--){i=J.from(s.node(l).copy(i));let c=r&&r[u];o=J.from(c?c.type.create(c.attrs,o):s.node(l).copy(o))}e.step(new Yt(t,t,new ue(i.append(o),n,n),!0))}function sl(e,t){let n=e.resolve(t),r=n.index();return lD(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function ZG(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let s=0;s<t.childCount;s++){let i=t.child(s),o=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(i.marks))return!1}return n.validEnd}function lD(e,t){return!!(e&&t&&!e.isLeaf&&ZG(e,t))}function sy(e,t,n=-1){let r=e.resolve(t);for(let s=r.depth;;s--){let i,o,l=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(s+1),l++,o=r.node(s).maybeChild(l)):(i=r.node(s).maybeChild(l-1),o=r.node(s+1)),i&&!i.isTextblock&&lD(i,o)&&r.node(s).canReplace(l,l+1))return t;if(s==0)break;t=n<0?r.before(s):r.after(s)}}function YG(e,t,n){let r=null,{linebreakReplacement:s}=e.doc.type.schema,i=e.doc.resolve(t-n),o=i.node().type;if(s&&o.inlineContent){let c=o.whitespace=="pre",d=!!o.contentMatch.matchType(s);c&&!d?r=!1:!c&&d&&(r=!0)}let l=e.steps.length;if(r===!1){let c=e.doc.resolve(t+n);oD(e,c.node(),c.before(),l)}o.inlineContent&&x1(e,t+n-1,o,i.node().contentMatchAt(i.index()),r==null);let a=e.mapping.slice(l),u=a.map(t-n);if(e.step(new Yt(u,a.map(t+n,-1),ue.empty,!0)),r===!0){let c=e.doc.resolve(u);iD(e,c.node(),c.before(),e.steps.length)}return e}function XG(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function aD(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),u=r.node(o),c=!1;if(i==1)c=u.canReplace(a,a,s);else{let d=u.contentMatchAt(a).findWrapping(s.firstChild.type);c=d&&u.canReplaceWith(a,a,d[0])}if(c)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function iy(e,t,n=t,r=ue.empty){if(t==n&&!r.size)return null;let s=e.resolve(t),i=e.resolve(n);return uD(s,i,r)?new Yt(t,n,r):new eJ(s,i,r).fit()}function uD(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class eJ{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=J.empty;for(let s=0;s<=t.depth;s++){let i=t.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(t.indexAfter(s))})}for(let s=t.depth;s>0;s--)this.placed=J.from(t.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(t<0?this.$to:r.doc.resolve(t));if(!s)return null;let i=this.placed,o=r.depth,l=s.depth;for(;o&&l&&i.childCount==1;)i=i.firstChild.content,o--,l--;let a=new ue(i,o,l);return t>-1?new tn(r.pos,t,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new Yt(r.pos,s.pos,a):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<t;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){t=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=Ux(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:u}=this.frontier[l],c,d=null;if(n==1&&(o?u.matchType(o.type)||(d=u.fillBefore(J.from(o),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(n==2&&o&&(c=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:c};if(i&&u.matchType(i.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,s=Ux(t,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new ue(t,n+1,Math.max(r,s.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,s=Ux(t,n);if(s.childCount<=1&&n>0){let i=t.size-n<=n+s.size;this.unplaced=new ue(Uc(t,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ue(Uc(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-t,u=0,c=[],{match:d,type:h}=this.frontier[n];if(s){for(let g=0;g<s.childCount;g++)c.push(s.child(g));d=d.matchFragment(s)}let f=l.size+t-(o.content.size-o.openEnd);for(;u<l.childCount;){let g=l.child(u),v=d.matchType(g.type);if(!v)break;u++,(u>1||a==0||g.content.size)&&(d=v,c.push(cD(g.mark(h.allowedMarks(g.marks)),u==1?a:0,u==l.childCount?f:-1)))}let m=u==l.childCount;m||(f=-1),this.placed=qc(this.placed,n,J.from(c)),this.frontier[n].match=d,m&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,v=l;g<f;g++){let y=v.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),v=y.content}this.unplaced=m?t==0?ue.empty:new ue(Uc(o.content,t-1,1),t-1,f<0?o.openEnd:t-1):new ue(Uc(o.content,t,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!qx(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),o=qx(t,n,s,r,i);if(o){for(let l=n-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],c=qx(t,l,u,a,!0);if(!c||c.childCount)continue e}return{depth:n,fit:o,move:i?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=qc(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let s=t.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,t.index(r));this.openFrontierNode(s.type,s.attrs,i)}return t}openFrontierNode(t,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(t),this.placed=qc(this.placed,this.depth,J.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(J.empty,!0);n.childCount&&(this.placed=qc(this.placed,this.frontier.length,n))}}function Uc(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Uc(e.firstChild.content,t-1,n)))}function qc(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(qc(e.lastChild.content,t-1,n)))}function Ux(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function cD(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,cD(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(J.empty,!0)))),e.copy(r)}function qx(e,t,n,r,s){let i=e.node(t),o=s?e.indexAfter(t):e.index(t);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,o);return l&&!tJ(n,i.content,o)?l:null}function tJ(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function nJ(e){return e.spec.defining||e.spec.definingForContent}function rJ(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let s=e.doc.resolve(t),i=e.doc.resolve(n);if(uD(s,i,r))return e.step(new Yt(t,n,r));let o=fD(s,i);o[o.length-1]==0&&o.pop();let l=-(s.depth+1);o.unshift(l);for(let h=s.depth,f=s.pos-1;h>0;h--,f--){let m=s.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(h)>-1?l=h:s.before(h)==f&&o.splice(1,0,-h)}let a=o.indexOf(l),u=[],c=r.openStart;for(let h=r.content,f=0;;f++){let m=h.firstChild;if(u.push(m),f==r.openStart)break;h=m.content}for(let h=c-1;h>=0;h--){let f=u[h],m=nJ(f.type);if(m&&!f.sameMarkup(s.node(Math.abs(l)-1)))c=h;else if(m||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+c+1)%(r.openStart+1),m=u[f];if(m)for(let g=0;g<o.length;g++){let v=o[(g+a)%o.length],y=!0;v<0&&(y=!1,v=-v);let w=s.node(v-1),b=s.index(v-1);if(w.canReplaceWith(b,b,m.type,m.marks))return e.replace(s.before(v),y?i.after(v):n,new ue(dD(r.content,0,r.openStart,f),f,r.openEnd))}}let d=e.steps.length;for(let h=o.length-1;h>=0&&(e.replace(t,n,r),!(e.steps.length>d));h--){let f=o[h];f<0||(t=s.before(f),n=i.after(f))}}function dD(e,t,n,r,s){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(dD(i.content,t+1,n,r,i)))}if(t>r){let i=s.contentMatchAt(0),o=i.fillBefore(e).append(e);e=o.append(i.matchFragment(o).fillBefore(J.empty,!0))}return e}function sJ(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let s=XG(e.doc,t,r.type);s!=null&&(t=n=s)}e.replaceRange(t,n,new ue(J.from(r),0,0))}function iJ(e,t,n){let r=e.doc.resolve(t),s=e.doc.resolve(n),i=fD(r,s);for(let o=0;o<i.length;o++){let l=i[o],a=o==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return e.delete(r.start(l),s.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),s.indexAfter(l-1))))return e.delete(r.before(l),s.after(l))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}function fD(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let s=r;s>=0;s--){let i=e.start(s);if(i<e.pos-(e.depth-s)||t.end(s)>t.pos+(t.depth-s)||e.node(s).type.spec.isolating||t.node(s).type.spec.isolating)break;(i==t.start(s)||s==e.depth&&s==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&s&&t.start(s-1)==i-1)&&n.push(s)}return n}class ou extends jn{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return Ft.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return Ft.fromReplace(t,this.pos,this.pos+1,new ue(J.from(s),0,n.isLeaf?0:1))}getMap(){return pr.empty}invert(t){return new ou(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new ou(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ou(n.pos,n.attr,n.value)}}jn.jsonID("attr",ou);class tf extends jn{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return Ft.ok(r)}getMap(){return pr.empty}invert(t){return new tf(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new tf(n.attr,n.value)}}jn.jsonID("docAttr",tf);let qu=class extends Error{};qu=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};qu.prototype=Object.create(Error.prototype);qu.prototype.constructor=qu;qu.prototype.name="TransformError";class hD{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new ef}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new qu(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let s=this.mapping.maps[r];r&&(t=s.map(t,1),n=s.map(n,-1)),s.forEach((i,o,l,a)=>{t=Math.min(t,l),n=Math.max(n,a)})}return t==1e9?null:{from:t,to:n}}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=ue.empty){let s=iy(this.doc,t,n,r);return s&&this.step(s),this}replaceWith(t,n,r){return this.replace(t,n,new ue(J.from(r),0,0))}delete(t,n){return this.replace(t,n,ue.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return rJ(this,t,n,r),this}replaceRangeWith(t,n,r){return sJ(this,t,n,r),this}deleteRange(t,n){return iJ(this,t,n),this}lift(t,n){return HG(this,t,n),this}join(t,n=1){return YG(this,t,n),this}wrap(t,n){return WG(this,t,n),this}setBlockType(t,n=t,r,s=null){return KG(this,t,n,r,s),this}setNodeMarkup(t,n,r=null,s){return GG(this,t,n,r,s),this}setNodeAttribute(t,n,r){return this.step(new ou(t,n,r)),this}setDocAttribute(t,n){return this.step(new tf(t,n)),this}addNodeMark(t,n){return this.step(new xo(t,n)),this}removeNodeMark(t,n){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n instanceof ft)n.isInSet(r.marks)&&this.step(new Xl(t,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new Xl(t,i)),s=i.removeFromSet(s);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(t,n=1,r){return JG(this,t,n,r),this}addMark(t,n,r){return FG(this,t,n,r),this}removeMark(t,n,r){return BG(this,t,n,r),this}clearIncompatible(t,n,r){return x1(this,t,n,r),this}}const Wx=Object.create(null);class Pe{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new pD(t.min(n),t.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 t=this.ranges;for(let n=0;n<t.length;n++)if(t[n].$from.pos!=t[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,n=ue.empty){let r=n.content.lastChild,s=null;for(let l=0;l<n.openEnd;l++)s=r,r=r.lastChild;let i=t.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:u}=o[l],c=t.mapping.slice(i);t.replaceRange(c.map(a.pos),c.map(u.pos),l?ue.empty:n),l==0&&xT(t,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(t,n){let r=t.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:l}=s[i],a=t.mapping.slice(r),u=a.map(o.pos),c=a.map(l.pos);i?t.deleteRange(u,c):(t.replaceRangeWith(u,c,n),xT(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let s=t.parent.inlineContent?new _e(t):_a(t.node(0),t.parent,t.pos,t.index(),n,r);if(s)return s;for(let i=t.depth-1;i>=0;i--){let o=n<0?_a(t.node(0),t.node(i),t.before(i+1),t.index(i),n,r):_a(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,n,r);if(o)return o}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new vr(t.node(0))}static atStart(t){return _a(t,t,0,0,1)||new vr(t)}static atEnd(t){return _a(t,t,t.content.size,t.childCount,-1)||new vr(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Wx[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in Wx)throw new RangeError("Duplicate use of selection JSON ID "+t);return Wx[t]=n,n.prototype.jsonID=t,n}getBookmark(){return _e.between(this.$anchor,this.$head).getBookmark()}}Pe.prototype.visible=!0;class pD{constructor(t,n){this.$from=t,this.$to=n}}let gT=!1;function yT(e){!gT&&!e.parent.inlineContent&&(gT=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class _e extends Pe{constructor(t,n=t){yT(t),yT(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return Pe.near(r);let s=t.resolve(n.map(this.anchor));return new _e(s.parent.inlineContent?s:r,r)}replace(t,n=ue.empty){if(super.replace(t,n),n==ue.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof _e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new oy(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new _e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let s=t.resolve(n);return new this(s,r==n?s:t.resolve(r))}static between(t,n,r){let s=t.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=Pe.findFrom(n,r,!0)||Pe.findFrom(n,-r,!0);if(i)n=i.$head;else return Pe.near(n,r)}return t.parent.inlineContent||(s==0?t=n:(t=(Pe.findFrom(t,-r,!0)||Pe.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=s<0&&(t=n))),new _e(t,n)}}Pe.jsonID("text",_e);class oy{constructor(t,n){this.anchor=t,this.head=n}map(t){return new oy(t.map(this.anchor),t.map(this.head))}resolve(t){return _e.between(t.resolve(this.anchor),t.resolve(this.head))}}class Te extends Pe{constructor(t){let n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);super(t,r),this.node=n}map(t,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),i=t.resolve(s);return r?Pe.near(i):new Te(i)}content(){return new ue(J.from(this.node),0,0)}eq(t){return t instanceof Te&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new w1(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Te(t.resolve(n.anchor))}static create(t,n){return new Te(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}Te.prototype.visible=!1;Pe.jsonID("node",Te);class w1{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new oy(r,r):new w1(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&Te.isSelectable(r)?new Te(n):Pe.near(n)}}class vr extends Pe{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=ue.empty){if(n==ue.empty){t.delete(0,t.doc.content.size);let r=Pe.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new vr(t)}map(t){return new vr(t)}eq(t){return t instanceof vr}getBookmark(){return oJ}}Pe.jsonID("all",vr);const oJ={map(){return this},resolve(e){return new vr(e)}};function _a(e,t,n,r,s,i=!1){if(t.inlineContent)return _e.create(e,n);for(let o=r-(s>0?0:1);s>0?o<t.childCount:o>=0;o+=s){let l=t.child(o);if(l.isAtom){if(!i&&Te.isSelectable(l))return Te.create(e,n-(s<0?l.nodeSize:0))}else{let a=_a(e,l,n+s,s<0?l.childCount:0,s,i);if(a)return a}n+=l.nodeSize*s}return null}function xT(e,t,n){let r=e.steps.length-1;if(r<t)return;let s=e.steps[r];if(!(s instanceof Yt||s instanceof tn))return;let i=e.mapping.maps[r],o;i.forEach((l,a,u,c)=>{o==null&&(o=c)}),e.setSelection(Pe.near(e.doc.resolve(o),n))}const vT=1,Oh=2,wT=4;class lJ extends hD{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.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(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|vT)&~Oh,this.storedMarks=null,this}get selectionSet(){return(this.updated&vT)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=Oh,this}ensureMarks(t){return ft.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Oh)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~Oh,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let r=this.selection;return n&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ft.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,r){let s=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(s.text(t),!0):this.deleteSelection();{if(r==null&&(r=n),!t)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(t,i)),!this.selection.empty&&this.selection.to==n+t.length&&this.setSelection(Pe.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=wT,this}get scrolledIntoView(){return(this.updated&wT)>0}}function bT(e,t){return!t||!e?e:e.bind(t)}class Wc{constructor(t,n,r){this.name=t,this.init=bT(n.init,r),this.apply=bT(n.apply,r)}}const aJ=[new Wc("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Wc("selection",{init(e,t){return e.selection||Pe.atStart(t.doc)},apply(e){return e.selection}}),new Wc("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Wc("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class Kx{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=aJ.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 Wc(r.key,r.spec.state,r))})}}class Za{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let n=[t],r=this.applyInner(t),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=s?s[o].n:0,u=s?s[o].state:this,c=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,u,r);if(c&&r.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",t),!s){s=[];for(let d=0;d<this.config.plugins.length;d++)s.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),i=!0}s&&(s[o]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Za(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new lJ(this)}static create(t){let n=new Kx(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new Za(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(t,r);return r}reconfigure(t){let n=new Kx(this.schema,t.plugins),r=n.fields,s=new Za(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(t,s)}return s}toJSON(t){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=t[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.key]))}return n}static fromJSON(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let s=new Kx(t.schema,t.plugins),i=new Za(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=jo.fromJSON(t.schema,n.doc);else if(o.name=="selection")i.selection=Pe.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],u=a.spec.state;if(a.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[o.name]=u.fromJSON.call(a,t,n[l],i);return}}i[o.name]=o.init(t,i)}}),i}}function mD(e,t,n){for(let r in e){let s=e[r];s instanceof Function?s=s.bind(t):r=="handleDOMEvents"&&(s=mD(s,t,{})),n[r]=s}return n}class bt{constructor(t){this.spec=t,this.props={},t.props&&mD(t.props,this,this.props),this.key=t.key?t.key.key:gD("plugin")}getState(t){return t[this.key]}}const Qx=Object.create(null);function gD(e){return e in Qx?e+"$"+ ++Qx[e]:(Qx[e]=0,e+"$")}class St{constructor(t="key"){this.key=gD(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const b1=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function yD(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const xD=(e,t,n)=>{let r=yD(e,n);if(!r)return!1;let s=k1(r);if(!s){let o=r.blockRange(),l=o&&uc(o);return l==null?!1:(t&&t(e.tr.lift(o,l).scrollIntoView()),!0)}let i=s.nodeBefore;if(TD(e,s,t,-1))return!0;if(r.parent.content.size==0&&(Wu(i,"end")||Te.isSelectable(i)))for(let o=r.depth;;o--){let l=iy(e.doc,r.before(o),r.after(o),ue.empty);if(l&&l.slice.size<l.to-l.from){if(t){let a=e.tr.step(l);a.setSelection(Wu(i,"end")?Pe.findFrom(a.doc.resolve(a.mapping.map(s.pos,-1)),-1):Te.create(a.doc,s.pos-i.nodeSize)),t(a.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(t&&t(e.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},uJ=(e,t,n)=>{let r=yD(e,n);if(!r)return!1;let s=k1(r);return s?vD(e,s,t):!1},cJ=(e,t,n)=>{let r=bD(e,n);if(!r)return!1;let s=S1(r);return s?vD(e,s,t):!1};function vD(e,t,n){let r=t.nodeBefore,s=r,i=t.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let c=s.lastChild;if(!c)return!1;s=c}let o=t.nodeAfter,l=o,a=t.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let c=l.firstChild;if(!c)return!1;l=c}let u=iy(e.doc,i,a,ue.empty);if(!u||u.from!=i||u instanceof Yt&&u.slice.size>=a-i)return!1;if(n){let c=e.tr.step(u);c.setSelection(_e.create(c.doc,i)),n(c.scrollIntoView())}return!0}function Wu(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const wD=(e,t,n)=>{let{$head:r,empty:s}=e.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=k1(r)}let o=i&&i.nodeBefore;return!o||!Te.isSelectable(o)?!1:(t&&t(e.tr.setSelection(Te.create(e.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function k1(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function bD(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const kD=(e,t,n)=>{let r=bD(e,n);if(!r)return!1;let s=S1(r);if(!s)return!1;let i=s.nodeAfter;if(TD(e,s,t,1))return!0;if(r.parent.content.size==0&&(Wu(i,"start")||Te.isSelectable(i))){let o=iy(e.doc,r.before(),r.after(),ue.empty);if(o&&o.slice.size<o.to-o.from){if(t){let l=e.tr.step(o);l.setSelection(Wu(i,"start")?Pe.findFrom(l.doc.resolve(l.mapping.map(s.pos)),1):Te.create(l.doc,l.mapping.map(s.pos))),t(l.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(t&&t(e.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},SD=(e,t,n)=>{let{$head:r,empty:s}=e.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=S1(r)}let o=i&&i.nodeAfter;return!o||!Te.isSelectable(o)?!1:(t&&t(e.tr.setSelection(Te.create(e.doc,i.pos)).scrollIntoView()),!0)};function S1(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const dJ=(e,t)=>{let n=e.selection,r=n instanceof Te,s;if(r){if(n.node.isTextblock||!sl(e.doc,n.from))return!1;s=n.from}else if(s=sy(e.doc,n.from,-1),s==null)return!1;if(t){let i=e.tr.join(s);r&&i.setSelection(Te.create(i.doc,s-e.doc.resolve(s).nodeBefore.nodeSize)),t(i.scrollIntoView())}return!0},fJ=(e,t)=>{let n=e.selection,r;if(n instanceof Te){if(n.node.isTextblock||!sl(e.doc,n.to))return!1;r=n.to}else if(r=sy(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},hJ=(e,t)=>{let{$from:n,$to:r}=e.selection,s=n.blockRange(r),i=s&&uc(s);return i==null?!1:(t&&t(e.tr.lift(s,i).scrollIntoView()),!0)},CD=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
491
|
+
`).scrollIntoView()),!0)};function C1(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const pJ=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=C1(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(t){let l=n.after(),a=e.tr.replaceWith(l,l,o.createAndFill());a.setSelection(Pe.near(a.doc.resolve(l),1)),t(a.scrollIntoView())}return!0},ED=(e,t)=>{let n=e.selection,{$from:r,$to:s}=n;if(n instanceof vr||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=C1(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,l=e.tr.insert(o,i.createAndFill());l.setSelection(_e.create(l.doc,o+1)),t(l.scrollIntoView())}return!0},ND=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Ei(e.doc,i))return t&&t(e.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&uc(r);return s==null?!1:(t&&t(e.tr.lift(r,s).scrollIntoView()),!0)};function mJ(e){return(t,n)=>{let{$from:r,$to:s}=t.selection;if(t.selection instanceof Te&&t.selection.node.isBlock)return!r.parentOffset||!Ei(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],o,l,a=!1,u=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){a=r.end(f)==r.pos+(r.depth-f),u=r.start(f)==r.pos-(r.depth-f),l=C1(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),i.unshift(a&&l?{type:l}:null),o=f;break}else{if(f==1)return!1;i.unshift(null)}let c=t.tr;(t.selection instanceof _e||t.selection instanceof vr)&&c.deleteSelection();let d=c.mapping.map(r.pos),h=Ei(c.doc,d,i.length,i);if(h||(i[0]=l?{type:l}:null,h=Ei(c.doc,d,i.length,i)),!h)return!1;if(c.split(d,i.length,i),!a&&u&&r.node(o).type!=l){let f=c.mapping.map(r.before(o)),m=c.doc.resolve(f);l&&r.node(o-1).canReplaceWith(m.index(),m.index()+1,l)&&c.setNodeMarkup(c.mapping.map(r.before(o)),l)}return n&&n(c.scrollIntoView()),!0}}const gJ=mJ(),yJ=(e,t)=>{let{$from:n,to:r}=e.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),t&&t(e.tr.setSelection(Te.create(e.doc,s))),!0)};function xJ(e,t,n){let r=t.nodeBefore,s=t.nodeAfter,i=t.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(i,i+1)||!(s.isTextblock||sl(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function TD(e,t,n,r){let s=t.nodeBefore,i=t.nodeAfter,o,l,a=s.type.spec.isolating||i.type.spec.isolating;if(!a&&xJ(e,t,n))return!0;let u=!a&&t.parent.canReplace(t.index(),t.index()+1);if(u&&(o=(l=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&l.matchType(o[0]||i.type).validEnd){if(n){let f=t.pos+i.nodeSize,m=J.empty;for(let y=o.length-1;y>=0;y--)m=J.from(o[y].create(null,m));m=J.from(s.copy(m));let g=e.tr.step(new tn(t.pos-1,f,t.pos,f,new ue(m,1,0),o.length,!0)),v=g.doc.resolve(f+2*o.length);v.nodeAfter&&v.nodeAfter.type==s.type&&sl(g.doc,v.pos)&&g.join(v.pos),n(g.scrollIntoView())}return!0}let c=i.type.spec.isolating||r>0&&a?null:Pe.findFrom(t,1),d=c&&c.$from.blockRange(c.$to),h=d&&uc(d);if(h!=null&&h>=t.depth)return n&&n(e.tr.lift(d,h).scrollIntoView()),!0;if(u&&Wu(i,"start",!0)&&Wu(s,"end")){let f=s,m=[];for(;m.push(f),!f.isTextblock;)f=f.lastChild;let g=i,v=1;for(;!g.isTextblock;g=g.firstChild)v++;if(f.canReplace(f.childCount,f.childCount,g.content)){if(n){let y=J.empty;for(let b=m.length-1;b>=0;b--)y=J.from(m[b].copy(y));let w=e.tr.step(new tn(t.pos-m.length,t.pos+i.nodeSize,t.pos+v,t.pos+i.nodeSize-v,new ue(y,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function RD(e){return function(t,n){let r=t.selection,s=e<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(t.tr.setSelection(_e.create(t.doc,e<0?s.start(i):s.end(i)))),!0):!1}}const vJ=RD(-1),wJ=RD(1);function bJ(e,t=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),l=o&&v1(o,e,t);return l?(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0):!1}}function kT(e,t=null){return function(n,r){let s=!1;for(let i=0;i<n.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(o,l,(a,u)=>{if(s)return!1;if(!(!a.isTextblock||a.hasMarkup(e,t)))if(a.type==e)s=!0;else{let c=n.doc.resolve(u),d=c.index();s=c.parent.canReplaceWith(d,d+1,e)}})}if(!s)return!1;if(r){let i=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[o];i.setBlockType(l,a,e,t)}r(i.scrollIntoView())}return!0}}function E1(...e){return function(t,n,r){for(let s=0;s<e.length;s++)if(e[s](t,n,r))return!0;return!1}}E1(b1,xD,wD);E1(b1,kD,SD);E1(CD,ED,ND,gJ);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function kJ(e,t=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i);if(!o)return!1;let l=r?n.tr:null;return SJ(l,o,e,t)?(r&&r(l.scrollIntoView()),!0):!1}}function SJ(e,t,n,r=null){let s=!1,i=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let a=o.resolve(t.start-2);i=new Em(a,a,t.depth),t.endIndex<t.parent.childCount&&(t=new Em(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),s=!0}let l=v1(i,n,r,t);return l?(e&&CJ(e,t,l,s,n),!0):!1}function CJ(e,t,n,r,s){let i=J.empty;for(let c=n.length-1;c>=0;c--)i=J.from(n[c].type.create(n[c].attrs,i));e.step(new tn(t.start-(r?2:0),t.end,t.start,t.end,new ue(i,0,0),n.length,!0));let o=0;for(let c=0;c<n.length;c++)n[c].type==s&&(o=c+1);let l=n.length-o,a=t.start+n.length-(r?2:0),u=t.parent;for(let c=t.startIndex,d=t.endIndex,h=!0;c<d;c++,h=!1)!h&&Ei(e.doc,a,l)&&(e.split(a,l),a+=2*l),a+=u.child(c).nodeSize;return e}function EJ(e){return function(t,n){let{$from:r,$to:s}=t.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==e);return i?n?r.node(i.depth-1).type==e?NJ(t,n,e,i):TJ(t,n,i):!0:!1}}function NJ(e,t,n,r){let s=e.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new tn(i-1,o,i,o,new ue(J.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Em(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const l=uc(r);if(l==null)return!1;s.lift(r,l);let a=s.doc.resolve(s.mapping.map(i,-1)-1);return sl(s.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&s.join(a.pos),t(s.scrollIntoView()),!0}function TJ(e,t,n){let r=e.tr,s=n.parent;for(let f=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)f-=s.child(m).nodeSize,r.delete(f-1,f+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==s.childCount,u=i.node(-1),c=i.index(-1);if(!u.canReplace(c+(l?0:1),c+1,o.content.append(a?J.empty:J.from(s))))return!1;let d=i.pos,h=d+o.nodeSize;return r.step(new tn(d-(l?1:0),h+(a?1:0),d+1,h-1,new ue((l?J.empty:J.from(s.copy(J.empty))).append(a?J.empty:J.from(s.copy(J.empty))),l?0:1,a?0:1),l?0:1)),t(r.scrollIntoView()),!0}function RJ(e){return function(t,n){let{$from:r,$to:s}=t.selection,i=r.blockRange(s,u=>u.childCount>0&&u.firstChild.type==e);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let l=i.parent,a=l.child(o-1);if(a.type!=e)return!1;if(n){let u=a.lastChild&&a.lastChild.type==l.type,c=J.from(u?e.create():null),d=new ue(J.from(e.create(null,J.from(l.type.create(null,c)))),u?3:1,0),h=i.start,f=i.end;n(t.tr.step(new tn(h-(u?3:1),f,h,f,d,1,!0)).scrollIntoView())}return!0}}const cn=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Ku=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let Pw=null;const ci=function(e,t,n){let r=Pw||(Pw=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},MJ=function(){Pw=null},ea=function(e,t,n,r){return n&&(ST(e,t,n,r,-1)||ST(e,t,n,r,1))},OJ=/^(img|br|input|textarea|hr)$/i;function ST(e,t,n,r,s){for(var i;;){if(e==n&&t==r)return!0;if(t==(s<0?0:Br(e))){let o=e.parentNode;if(!o||o.nodeType!=1||$f(e)||OJ.test(e.nodeName)||e.contentEditable=="false")return!1;t=cn(e)+(s<0?0:1),e=o}else if(e.nodeType==1){let o=e.childNodes[t+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)t+=s;else return!1;else e=o,t=s<0?Br(e):0}else return!1}}function Br(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function jJ(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=Br(e)}else if(e.parentNode&&!$f(e))t=cn(e),e=e.parentNode;else return null}}function PJ(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!$f(e))t=cn(e)+1,e=e.parentNode;else return null}}function AJ(e,t,n){for(let r=t==0,s=t==Br(e);r||s;){if(e==n)return!0;let i=cn(e);if(e=e.parentNode,!e)return!1;r=r&&i==0,s=s&&i==Br(e)}}function $f(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const ly=function(e){return e.focusNode&&ea(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function ml(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function _J(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function IJ(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Br(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Br(r.startContainer),r.startOffset)}}}const Ks=typeof navigator<"u"?navigator:null,CT=typeof document<"u"?document:null,il=Ks&&Ks.userAgent||"",Aw=/Edge\/(\d+)/.exec(il),MD=/MSIE \d/.exec(il),_w=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(il),sr=!!(MD||_w||Aw),Po=MD?document.documentMode:_w?+_w[1]:Aw?+Aw[1]:0,Ur=!sr&&/gecko\/(\d+)/i.test(il);Ur&&+(/Firefox\/(\d+)/.exec(il)||[0,0])[1];const Iw=!sr&&/Chrome\/(\d+)/.exec(il),Xt=!!Iw,OD=Iw?+Iw[1]:0,pn=!sr&&!!Ks&&/Apple Computer/.test(Ks.vendor),Qu=pn&&(/Mobile\/\w+/.test(il)||!!Ks&&Ks.maxTouchPoints>2),Dr=Qu||(Ks?/Mac/.test(Ks.platform):!1),jD=Ks?/Win/.test(Ks.platform):!1,wi=/Android \d/.test(il),zf=!!CT&&"webkitFontSmoothing"in CT.documentElement.style,DJ=zf?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function LJ(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function ei(e,t){return typeof e=="number"?e:e[t]}function $J(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function ET(e,t,n){let r=e.someProp("scrollThreshold")||0,s=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=Ku(o);continue}let l=o,a=l==i.body,u=a?LJ(i):$J(l),c=0,d=0;if(t.top<u.top+ei(r,"top")?d=-(u.top-t.top+ei(s,"top")):t.bottom>u.bottom-ei(r,"bottom")&&(d=t.bottom-t.top>u.bottom-u.top?t.top+ei(s,"top")-u.top:t.bottom-u.bottom+ei(s,"bottom")),t.left<u.left+ei(r,"left")?c=-(u.left-t.left+ei(s,"left")):t.right>u.right-ei(r,"right")&&(c=t.right-u.right+ei(s,"right")),c||d)if(a)i.defaultView.scrollBy(c,d);else{let f=l.scrollLeft,m=l.scrollTop;d&&(l.scrollTop+=d),c&&(l.scrollLeft+=c);let g=l.scrollLeft-f,v=l.scrollTop-m;t={left:t.left-g,top:t.top-v,right:t.right-g,bottom:t.bottom-v}}let h=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:Ku(o)}}function zJ(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,s;for(let i=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let l=e.root.elementFromPoint(i,o);if(!l||l==e.dom||!e.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,s=a.top;break}}return{refDOM:r,refTop:s,stack:PD(e.dom)}}function PD(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Ku(r));return t}function FJ({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;AD(n,r==0?0:r-t)}function AD(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:s,left:i}=e[n];r.scrollTop!=s+t&&(r.scrollTop=s+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Ea=null;function BJ(e){if(e.setActive)return e.setActive();if(Ea)return e.focus(Ea);let t=PD(e);e.focus(Ea==null?{get preventScroll(){return Ea={preventScroll:!0},!0}}:void 0),Ea||(Ea=!1,AD(t,0))}function _D(e,t){let n,r=2e8,s,i=0,o=t.top,l=t.top,a,u;for(let c=e.firstChild,d=0;c;c=c.nextSibling,d++){let h;if(c.nodeType==1)h=c.getClientRects();else if(c.nodeType==3)h=ci(c).getClientRects();else continue;for(let f=0;f<h.length;f++){let m=h[f];if(m.top<=o&&m.bottom>=l){o=Math.max(m.bottom,o),l=Math.min(m.top,l);let g=m.left>t.left?m.left-t.left:m.right<t.left?t.left-m.right:0;if(g<r){n=c,r=g,s=g&&n.nodeType==3?{left:m.right<t.left?m.right:m.left,top:t.top}:t,c.nodeType==1&&g&&(i=d+(t.left>=(m.left+m.right)/2?1:0));continue}}else m.top>t.top&&!a&&m.left<=t.left&&m.right>=t.left&&(a=c,u={left:Math.max(m.left,Math.min(m.right,t.left)),top:m.top});!n&&(t.left>=m.right&&t.top>=m.top||t.left>=m.left&&t.top>=m.bottom)&&(i=d+1)}}return!n&&a&&(n=a,s=u,r=0),n&&n.nodeType==3?VJ(n,s):!n||r&&n.nodeType==1?{node:e,offset:i}:_D(n,s)}function VJ(e,t){let n=e.nodeValue.length,r=document.createRange(),s;for(let i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);let o=qi(r,1);if(o.top!=o.bottom&&N1(t,o)){s={node:e,offset:i+(t.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:e,offset:0}}function N1(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function HJ(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function UJ(e,t,n){let{node:r,offset:s}=_D(t,n),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return e.docView.posFromDOM(r,s,i)}function qJ(e,t,n,r){let s=-1;for(let i=t,o=!1;i!=e.dom;){let l=e.docView.nearestDesc(i,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&a.left>r.left||a.top>r.top?s=l.posBefore:(!o&&a.right<r.left||a.bottom<r.top)&&(s=l.posAfter),o=!0),!l.contentDOM&&s<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return s>-1?s:e.docView.posFromDOM(t,n,-1)}function ID(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=e.childNodes[i];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let u=l[a];if(N1(t,u))return ID(o,t,u)}}if((i=(i+1)%r)==s)break}return e}function WJ(e,t){let n=e.dom.ownerDocument,r,s=0,i=IJ(n,t.left,t.top);i&&({node:r,offset:s}=i);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),l;if(!o||!e.dom.contains(o.nodeType!=1?o.parentNode:o)){let u=e.dom.getBoundingClientRect();if(!N1(t,u)||(o=ID(e.dom,t,u),!o))return null}if(pn)for(let u=o;r&&u;u=Ku(u))u.draggable&&(r=void 0);if(o=HJ(o,t),r){if(Ur&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let c=r.childNodes[s],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=t.left&&d.bottom>t.top&&s++}let u;zf&&s&&r.nodeType==1&&(u=r.childNodes[s-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=t.top&&s--,r==e.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?l=e.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(l=qJ(e,r,s,t))}l==null&&(l=UJ(e,o,t));let a=e.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function NT(e){return e.top<e.bottom||e.left<e.right}function qi(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(NT(r))return r}return Array.prototype.find.call(n,NT)||e.getBoundingClientRect()}const KJ=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function DD(e,t,n){let{node:r,offset:s,atom:i}=e.docView.domFromPos(t,n<0?-1:1),o=zf||Ur;if(r.nodeType==3)if(o&&(KJ.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let a=qi(ci(r,s,s),n);if(Ur&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let u=qi(ci(r,s-1,s-1),-1);if(u.top==a.top){let c=qi(ci(r,s,s+1),-1);if(c.top!=a.top)return Mc(c,c.left<u.left)}}return a}else{let a=s,u=s,c=n<0?1:-1;return n<0&&!s?(u++,c=-1):n>=0&&s==r.nodeValue.length?(a--,c=1):n<0?a--:u++,Mc(qi(ci(r,a,u),c),c<0)}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==Br(r))){let a=r.childNodes[s-1];if(a.nodeType==1)return Gx(a.getBoundingClientRect(),!1)}if(i==null&&s<Br(r)){let a=r.childNodes[s];if(a.nodeType==1)return Gx(a.getBoundingClientRect(),!0)}return Gx(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==Br(r))){let a=r.childNodes[s-1],u=a.nodeType==3?ci(a,Br(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return Mc(qi(u,1),!1)}if(i==null&&s<Br(r)){let a=r.childNodes[s];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let u=a?a.nodeType==3?ci(a,0,o?0:1):a.nodeType==1?a:null:null;if(u)return Mc(qi(u,-1),!0)}return Mc(qi(r.nodeType==3?ci(r):r,-n),n>=0)}function Mc(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Gx(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function LD(e,t,n){let r=e.state,s=e.root.activeElement;r!=t&&e.updateState(t),s!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),s!=e.dom&&s&&s.focus()}}function QJ(e,t,n){let r=t.selection,s=n=="up"?r.$from:r.$to;return LD(e,t,()=>{let{node:i}=e.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let l=e.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let o=DD(e,s.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=ci(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<a.length;u++){let c=a[u];if(c.bottom>c.top+1&&(n=="up"?o.top-c.top>(c.bottom-o.top)*2:c.bottom-o.bottom>(o.bottom-c.top)*2))return!1}}return!0})}const GJ=/[\u0590-\u08ac]/;function JJ(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,l=e.domSelection();return l?!GJ.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:o:LD(e,t,()=>{let{focusNode:a,focusOffset:u,anchorNode:c,anchorOffset:d}=e.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",n,"character");let f=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:m,focusOffset:g}=e.domSelectionRange(),v=m&&!f.contains(m.nodeType==1?m:m.parentNode)||a==m&&u==g;try{l.collapse(c,d),a&&(a!=c||u!=d)&&l.extend&&l.extend(a,u)}catch{}return h!=null&&(l.caretBidiLevel=h),v}):r.pos==r.start()||r.pos==r.end()}let TT=null,RT=null,MT=!1;function ZJ(e,t,n){return TT==t&&RT==n?MT:(TT=t,RT=n,MT=n=="up"||n=="down"?QJ(e,t,n):JJ(e,t,n))}const qr=0,OT=1,bl=2,Qs=3;class Ff{constructor(t,n,r,s){this.parent=t,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=qr,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;n<this.children.length;n++)t+=this.children[n].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let n=0,r=this.posAtStart;;n++){let s=this.children[n];if(s==t)return r;r+=s.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(t,n,r){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode))if(r<0){let i,o;if(t==this.contentDOM)i=t.childNodes[n-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(t==this.contentDOM)i=t.childNodes[n];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(t==this.dom&&this.contentDOM)s=n>cn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=t;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==t.childNodes.length)for(let i=t;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,s=t;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(t.nodeType==1?t:t.parentNode):o==t))r=!1;else return i}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let s=t;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==t&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let l=s.children[o];if(l.size){s=l;break}}return s}if(t<i)return s.descAt(t-r-s.border);r=i}}domFromPos(t,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],l=i+o.size;if(l>t||o instanceof zD){s=t-i;break}i=l}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof $D&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?cn(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?cn(i.dom):this.contentDOM.childNodes.length}}}parseRange(t,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let o=r,l=0;;l++){let a=this.children[l],u=o+a.size;if(s==-1&&t<=u){let c=o+a.border;if(t>=c&&n<=u-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,n,c);t=o;for(let d=l;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){s=cn(h.dom)+1;break}t-=h.size}s==-1&&(s=0)}if(s>-1&&(u>n||l==this.children.length-1)){n=u;for(let c=l+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=cn(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:t,to:n,fromOffset:s,toOffset:i}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[t<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(t)}domAfterPos(t){let{node:n,offset:r}=this.domFromPos(t,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]}setSelection(t,n,r,s=!1){let i=Math.min(t,n),o=Math.max(t,n);for(let f=0,m=0;f<this.children.length;f++){let g=this.children[f],v=m+g.size;if(i>m&&o<v)return g.setSelection(t-m-g.border,n-m-g.border,r,s);m=v}let l=this.domFromPos(t,t?-1:1),a=n==t?l:this.domFromPos(n,n?-1:1),u=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((Ur||pn)&&t==n){let{node:f,offset:m}=l;if(f.nodeType==3){if(d=!!(m&&f.nodeValue[m-1]==`
|
|
492
|
+
`),d&&m==f.nodeValue.length)for(let g=f,v;g;g=g.parentNode){if(v=g.nextSibling){v.nodeName=="BR"&&(l=a={node:v.parentNode,offset:cn(v)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=f.childNodes[m-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Ur&&c.focusNode&&c.focusNode!=a.node&&c.focusNode.nodeType==1){let f=c.focusNode.childNodes[c.focusOffset];f&&f.contentEditable=="false"&&(s=!0)}if(!(s||d&&pn)&&ea(l.node,l.offset,c.anchorNode,c.anchorOffset)&&ea(a.node,a.offset,c.focusNode,c.focusOffset))return;let h=!1;if((u.extend||t==n)&&!(d&&Ur)){u.collapse(l.node,l.offset);try{t!=n&&u.extend(a.node,a.offset),h=!0}catch{}}if(!h){if(t>n){let m=l;l=a,a=m}let f=document.createRange();f.setEnd(a.node,a.offset),f.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(f)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?t<=o&&n>=r:t<o&&n>r){let l=r+i.border,a=o-i.border;if(t>=l&&n<=a){this.dirty=t==r||n==o?bl:OT,t==l&&n==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Qs:i.markDirty(t-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?bl:Qs}r=o}this.dirty=bl}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?bl:OT;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class $D extends Ff{constructor(t,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(t,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(t){return this.dirty==qr&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.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 YJ extends Ff{constructor(t,n,r,s){super(t,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class ta extends Ff{constructor(t,n,r,s,i){super(t,[],r,s),this.mark=n,this.spec=i}static create(t,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=da.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ta(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Qs||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=Qs&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=qr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=qr}}slice(t,n,r){let s=ta.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=Lw(i,n,o,r)),t>0&&(i=Lw(i,0,t,r));for(let l=0;l<i.length;l++)i[l].parent=s;return s.children=i,s}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Ao extends Ff{constructor(t,n,r,s,i,o,l,a,u){super(t,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=l}static create(t,n,r,s,i,o){let l=i.nodeViews[n.type.name],a,u=l&&l(n,i,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,s),c=u&&u.dom,d=u&&u.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=da.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let h=c;return c=VD(c,r,n),u?a=new XJ(t,n,r,s,c,d||null,h,u,i,o+1):n.isText?new ay(t,n,r,s,c,h,i):new Ao(t,n,r,s,c,d||null,h,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.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)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>J.empty)}return t}matchesNode(t,n,r){return this.dirty==qr&&t.eq(this.node)&&Tm(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let r=this.node.inlineContent,s=n,i=t.composing?this.localCompositionInfo(t,n):null,o=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new tZ(this,o&&o.node,t);sZ(this.node,this.innerDeco,(u,c,d)=>{u.spec.marks?a.syncToMarks(u.spec.marks,r,t,c):u.type.side>=0&&!d&&a.syncToMarks(c==this.node.childCount?ft.none:this.node.child(c).marks,r,t,c),a.placeWidget(u,t,s)},(u,c,d,h)=>{a.syncToMarks(u.marks,r,t,h);let f;a.findNodeMatch(u,c,d,h)||l&&t.state.selection.from>s&&t.state.selection.to<s+u.nodeSize&&(f=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(u,c,d,f,t)||a.updateNextNode(u,c,d,t,h,s)||a.addNode(u,c,d,t,s),s+=u.nodeSize}),a.syncToMarks([],r,t,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==bl)&&(o&&this.protectLocalComposition(t,o),FD(this.contentDOM,this.children,t),Qu&&iZ(this.dom))}localCompositionInfo(t,n){let{from:r,to:s}=t.state.selection;if(!(t.state.selection instanceof _e)||r<n||s>n+this.node.content.size)return null;let i=t.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,l=oZ(this.node.content,o,r-n,s-n);return l<0?null:{node:i,pos:l,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new YJ(this,i,n,s);t.input.compositionNodes.push(o),this.children=Lw(this.children,r,r+s.length,t,o)}update(t,n,r,s){return this.dirty==Qs||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,r,s),!0)}updateInner(t,n,r,s){this.updateOuterDeco(n),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=qr}updateOuterDeco(t){if(Tm(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=BD(this.dom,this.nodeDOM,Dw(this.outerDeco,this.node,n),Dw(t,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}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 jT(e,t,n,r,s){VD(r,t,e);let i=new Ao(void 0,e,t,n,r,r,r,s,0);return i.contentDOM&&i.updateChildren(s,0),i}class ay extends Ao{constructor(t,n,r,s,i,o,l){super(t,n,r,s,i,null,o,l,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,r,s){return this.dirty==Qs||this.dirty!=qr&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=qr||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=t,this.dirty=qr,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,r){let s=this.node.cut(t,n),i=document.createTextNode(s.text);return new ay(this.parent,s,this.outerDeco,this.innerDeco,i,i,r)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Qs)}get domAtom(){return!1}isText(t){return this.node.text==t}}class zD extends Ff{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==qr&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class XJ extends Ao{constructor(t,n,r,s,i,o,l,a,u,c){super(t,n,r,s,i,o,l,u,c),this.spec=a}update(t,n,r,s){if(this.dirty==Qs)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let i=this.spec.update(t,n,r);return i&&this.updateInner(t,n,r,s),i}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,r,s){this.spec.setSelection?this.spec.setSelection(t,n,r.root):super.setSelection(t,n,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function FD(e,t,n){let r=e.firstChild,s=!1;for(let i=0;i<t.length;i++){let o=t[i],l=o.dom;if(l.parentNode==e){for(;l!=r;)r=PT(r),s=!0;r=r.nextSibling}else s=!0,e.insertBefore(l,r);if(o instanceof ta){let a=r?r.previousSibling:e.lastChild;FD(o.contentDOM,o.children,n),r=a?a.nextSibling:e.firstChild}}for(;r;)r=PT(r),s=!0;s&&n.trackWrites==e&&(n.trackWrites=null)}const dd=function(e){e&&(this.nodeName=e)};dd.prototype=Object.create(null);const kl=[new dd];function Dw(e,t,n){if(e.length==0)return kl;let r=n?kl[0]:new dd,s=[r];for(let i=0;i<e.length;i++){let o=e[i].type.attrs;if(o){o.nodeName&&s.push(r=new dd(o.nodeName));for(let l in o){let a=o[l];a!=null&&(n&&s.length==1&&s.push(r=new dd(t.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return s}function BD(e,t,n,r){if(n==kl&&r==kl)return t;let s=t;for(let i=0;i<r.length;i++){let o=r[i],l=n[i];if(i){let a;l&&l.nodeName==o.nodeName&&s!=e&&(a=s.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(s),l=kl[0]),s=a}eZ(s,l||kl[0],o)}return s}function eZ(e,t,n){for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&e.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&e.classList.add(s[i]);e.classList.length==0&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(t.style);)e.style.removeProperty(s[1])}n.style&&(e.style.cssText+=n.style)}}function VD(e,t,n){return BD(e,e,kl,Dw(t,n,e.nodeType!=1))}function Tm(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function PT(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class tZ{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=nZ(t.node.content,t)}destroyBetween(t,n){if(t!=n){for(let r=t;r<n;r++)this.top.children[r].destroy();this.top.children.splice(t,n-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,n,r,s){let i=0,o=this.stack.length>>1,l=Math.min(o,t.length);for(;i<l&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(t[i])&&t[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=qr,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<t.length;){this.stack.push(this.top,this.index+1);let a=-1,u=this.top.children.length;s<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let c=this.index;c<u;c++){let d=this.top.children[c];if(d.matchesMark(t[o])&&!this.isLocked(d.dom)){a=c;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let c=ta.create(this.top,t[o],n,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}}findNodeMatch(t,n,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(t,n,r))i=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let u=this.top.children[l];if(u.matchesNode(t,n,r)&&!this.preMatch.matched.has(u)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(t,n,r,s,i){let o=this.top.children[s];return o.dirty==Qs&&o.dom==o.contentDOM&&(o.dirty=bl),o.update(t,n,r,i)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(t){for(;;){let n=t.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}t=n}}updateNextNode(t,n,r,s,i,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof Ao){let u=this.preMatch.matched.get(a);if(u!=null&&u!=i)return!1;let c=a.dom,d,h=this.isLocked(c)&&!(t.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==t.text&&a.dirty!=Qs&&Tm(n,a.outerDeco));if(!h&&a.update(t,n,r,s))return this.destroyBetween(this.index,l),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(a,t,n,r,s,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=bl,d.updateChildren(s,o+1),d.dirty=qr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,n,r,s,i,o){if(t.dirty||n.isAtom||!t.children.length||!t.node.content.eq(n.content)||!Tm(r,t.outerDeco)||!s.eq(t.innerDeco))return null;let l=Ao.create(this.top,n,r,s,i,o);if(l.contentDOM){l.children=t.children,t.children=[];for(let a of l.children)a.parent=l}return t.destroy(),l}addNode(t,n,r,s,i){let o=Ao.create(this.top,t,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(t,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(t)&&(t==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new $D(this.top,t,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],n=this.top;for(;t instanceof ta;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof ay)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((pn||Xt)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(t,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new zD(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function nZ(e,t){let n=t,r=n.children.length,s=e.childCount,i=new Map,o=[];e:for(;s>0;){let l;for(;;)if(r){let u=n.children[r-1];if(u instanceof ta)n=u,r=u.children.length;else{l=u,r--;break}}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=e.child(s-1))break;--s,i.set(l,s),o.push(l)}}return{index:s,matched:i,matches:o.reverse()}}function rZ(e,t){return e.type.side-t.type.side}function sZ(e,t,n,r){let s=t.locals(e),i=0;if(s.length==0){for(let u=0;u<e.childCount;u++){let c=e.child(u);r(c,s,t.forChild(i,c),u),i+=c.nodeSize}return}let o=0,l=[],a=null;for(let u=0;;){let c,d;for(;o<s.length&&s[o].to==i;){let v=s[o++];v.widget&&(c?(d||(d=[c])).push(v):c=v)}if(c)if(d){d.sort(rZ);for(let v=0;v<d.length;v++)n(d[v],u,!!a)}else n(c,u,!!a);let h,f;if(a)f=-1,h=a,a=null;else if(u<e.childCount)f=u,h=e.child(u++);else break;for(let v=0;v<l.length;v++)l[v].to<=i&&l.splice(v--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)l.push(s[o++]);let m=i+h.nodeSize;if(h.isText){let v=m;o<s.length&&s[o].from<v&&(v=s[o].from);for(let y=0;y<l.length;y++)l[y].to<v&&(v=l[y].to);v<m&&(a=h.cut(v-i),h=h.cut(0,v-i),m=v,f=-1)}else for(;o<s.length&&s[o].to<m;)o++;let g=h.isInline&&!h.isLeaf?l.filter(v=>!v.inline):l.slice();r(h,g,t.forChild(i,h),f),i=m}}function iZ(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function oZ(e,t,n,r){for(let s=0,i=0;s<e.childCount&&i<=r;){let o=e.child(s++),l=i;if(i+=o.nodeSize,!o.isText)continue;let a=o.text;for(;s<e.childCount;){let u=e.child(s++);if(i+=u.nodeSize,!u.isText)break;a+=u.text}if(i>=n){if(i>=r&&a.slice(r-t.length-l,r-l)==t)return r-t.length;let u=l<r?a.lastIndexOf(t,r-l-1):-1;if(u>=0&&u+t.length+l>=n)return l+u;if(n==r&&a.length>=r+t.length-l&&a.slice(r-l,r-l+t.length)==t)return r}}return-1}function Lw(e,t,n,r,s){let i=[];for(let o=0,l=0;o<e.length;o++){let a=e[o],u=l,c=l+=a.size;u>=n||c<=t?i.push(a):(u<t&&i.push(a.slice(0,t-u,r)),s&&(i.push(s),s=void 0),c>n&&i.push(a.slice(n-u,a.size,r)))}return i}function T1(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let s=e.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,u;if(ly(n)){for(a=o;s&&!s.node;)s=s.parent;let d=s.node;if(s&&d.isAtom&&Te.isSelectable(d)&&s.parent&&!(d.isInline&&AJ(n.focusNode,n.focusOffset,s.dom))){let h=s.posBefore;u=new Te(o==h?l:r.resolve(h))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,h=o;for(let f=0;f<n.rangeCount;f++){let m=n.getRangeAt(f);d=Math.min(d,e.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,e.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[a,o]=h==e.state.selection.anchor?[h,d]:[d,h],l=r.resolve(o)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let c=r.resolve(a);if(!u){let d=t=="pointer"||e.state.selection.head<l.pos&&!i?1:-1;u=R1(e,c,l,d)}return u}function HD(e){return e.editable?e.hasFocus():qD(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Ni(e,t=!1){let n=e.state.selection;if(UD(e,n),!!HD(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Xt){let r=e.domSelectionRange(),s=e.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&ea(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)aZ(e);else{let{anchor:r,head:s}=n,i,o;AT&&!(n instanceof _e)&&(n.$from.parent.inlineContent||(i=_T(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=_T(e,n.to))),e.docView.setSelection(r,s,e,t),AT&&(i&&IT(i),o&&IT(o)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&lZ(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const AT=pn||Xt&&OD<63;function _T(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(pn&&s&&s.contentEditable=="false")return Jx(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return Jx(s);if(i)return Jx(i)}}function Jx(e){return e.contentEditable="true",pn&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function IT(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function lZ(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!HD(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function aZ(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName=="IMG";r?t.collapse(n.parentNode,cn(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&sr&&Po<=11&&(n.disabled=!0,n.disabled=!1)}function UD(e,t){if(t instanceof Te){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(DT(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else DT(e)}function DT(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function R1(e,t,n,r){return e.someProp("createSelectionBetween",s=>s(e,t,n))||_e.between(t,n,r)}function LT(e){return e.editable&&!e.hasFocus()?!1:qD(e)}function qD(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function uZ(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return ea(t.node,t.offset,n.anchorNode,n.anchorOffset)}function $w(e,t){let{$anchor:n,$head:r}=e.selection,s=t>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?e.doc.resolve(t>0?s.after():s.before()):null:s;return i&&Pe.findFrom(i,t)}function Gi(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function $T(e,t,n){let r=e.state.selection;if(r instanceof _e)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=e.state.doc.resolve(s.pos+i.nodeSize*(t<0?-1:1));return Gi(e,new _e(r.$anchor,o))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let s=$w(e.state,t);return s&&s instanceof Te?Gi(e,s):!1}else if(!(Dr&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let l=t<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=e.docView.descAt(l))&&!o.contentDOM?Te.isSelectable(i)?Gi(e,new Te(t<0?e.state.doc.resolve(s.pos-i.nodeSize):s)):zf?Gi(e,new _e(e.state.doc.resolve(t<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Te&&r.node.isInline)return Gi(e,new _e(t>0?r.$to:r.$from));{let s=$w(e.state,t);return s?Gi(e,s):!1}}}function Rm(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function fd(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function Na(e,t){return t<0?cZ(e):dZ(e)}function cZ(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let s,i,o=!1;for(Ur&&n.nodeType==1&&r<Rm(n)&&fd(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(fd(l,-1))s=n,i=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(WD(n))break;{let l=n.previousSibling;for(;l&&fd(l,-1);)s=n.parentNode,i=cn(l),l=l.previousSibling;if(l)n=l,r=Rm(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}o?zw(e,n,r):s&&zw(e,s,i)}function dZ(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let s=Rm(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let l=n.childNodes[r];if(fd(l,1))i=n,o=++r;else break}else{if(WD(n))break;{let l=n.nextSibling;for(;l&&fd(l,1);)i=l.parentNode,o=cn(l)+1,l=l.nextSibling;if(l)n=l,r=0,s=Rm(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}i&&zw(e,i,o)}function WD(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function fZ(e,t){for(;e&&t==e.childNodes.length&&!$f(e);)t=cn(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=0}}function hZ(e,t){for(;e&&!t&&!$f(e);)t=cn(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=e.childNodes.length}}function zw(e,t,n){if(t.nodeType!=3){let i,o;(o=fZ(t,n))?(t=o,n=0):(i=hZ(t,n))&&(t=i,n=i.nodeValue.length)}let r=e.domSelection();if(!r)return;if(ly(r)){let i=document.createRange();i.setEnd(t,n),i.setStart(t,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:s}=e;setTimeout(()=>{e.state==s&&Ni(e)},50)}function zT(e,t){let n=e.state.doc.resolve(t);if(!(Xt||jD)&&n.parent.inlineContent){let s=e.coordsAtPos(t);if(t>n.start()){let i=e.coordsAtPos(t-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(t<n.end()){let i=e.coordsAtPos(t+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function FT(e,t,n){let r=e.state.selection;if(r instanceof _e&&!r.empty||n.indexOf("s")>-1||Dr&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let o=$w(e.state,t);if(o&&o instanceof Te)return Gi(e,o)}if(!s.parent.inlineContent){let o=t<0?s:i,l=r instanceof vr?Pe.near(o,t):Pe.findFrom(o,t);return l?Gi(e,l):!1}return!1}function BT(e,t){if(!(e.state.selection instanceof _e))return!0;let{$head:n,$anchor:r,empty:s}=e.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=e.state.tr;return t<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),e.dispatch(o),!0}return!1}function VT(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function pZ(e){if(!pn||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;VT(e,r,"true"),setTimeout(()=>VT(e,r,"false"),20)}return!1}function mZ(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function gZ(e,t){let n=t.keyCode,r=mZ(t);if(n==8||Dr&&n==72&&r=="c")return BT(e,-1)||Na(e,-1);if(n==46&&!t.shiftKey||Dr&&n==68&&r=="c")return BT(e,1)||Na(e,1);if(n==13||n==27)return!0;if(n==37||Dr&&n==66&&r=="c"){let s=n==37?zT(e,e.state.selection.from)=="ltr"?-1:1:-1;return $T(e,s,r)||Na(e,s)}else if(n==39||Dr&&n==70&&r=="c"){let s=n==39?zT(e,e.state.selection.from)=="ltr"?1:-1:1;return $T(e,s,r)||Na(e,s)}else{if(n==38||Dr&&n==80&&r=="c")return FT(e,-1,r)||Na(e,-1);if(n==40||Dr&&n==78&&r=="c")return pZ(e)||FT(e,1,r)||Na(e,1);if(r==(Dr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function M1(e,t){e.someProp("transformCopied",f=>{t=f(t,e)});let n=[],{content:r,openStart:s,openEnd:i}=t;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=e.someProp("clipboardSerializer")||da.fromSchema(e.state.schema),l=YD(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let u=a.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=ZD[u.nodeName.toLowerCase()]);){for(let f=c.length-1;f>=0;f--){let m=l.createElement(c[f]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),d++}u=a.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${s} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let h=e.someProp("clipboardTextSerializer",f=>f(t,e))||t.content.textBetween(0,t.content.size,`
|
|
493
|
+
|
|
494
|
+
`);return{dom:a,text:h,slice:t}}function KD(e,t,n,r,s){let i=s.parent.type.spec.code,o,l;if(!n&&!t)return null;let a=!!t&&(r||i||!n);if(a){if(e.someProp("transformPastedText",h=>{t=h(t,i||r,e)}),i)return l=new ue(J.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
495
|
+
`))),0,0),e.someProp("transformPasted",h=>{l=h(l,e,!0)}),l;let d=e.someProp("clipboardTextParser",h=>h(t,s,r,e));if(d)l=d;else{let h=s.marks(),{schema:f}=e.state,m=da.fromSchema(f);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(g=>{let v=o.appendChild(document.createElement("p"));g&&v.appendChild(m.serializeNode(f.text(g,h)))})}}else e.someProp("transformPastedHTML",d=>{n=d(n,e)}),o=wZ(n),zf&&bZ(o);let u=o&&o.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(l||(l=(e.someProp("clipboardParser")||e.someProp("domParser")||Ci.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||c),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!yZ.test(h.parentNode.nodeName)?{ignore:!0}:null}})),c)l=kZ(HT(l,+c[1],+c[2]),c[4]);else if(l=ue.maxOpen(xZ(l.content,s),!0),l.openStart||l.openEnd){let d=0,h=0;for(let f=l.content.firstChild;d<l.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=l.content.lastChild;h<l.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);l=HT(l,d,h)}return e.someProp("transformPasted",d=>{l=d(l,e,a)}),l}const yZ=/^(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 xZ(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let s=t.node(n).contentMatchAt(t.index(n)),i,o=[];if(e.forEach(l=>{if(!o)return;let a=s.findWrapping(l.type),u;if(!a)return o=null;if(u=o.length&&i.length&&GD(a,i,l,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=JD(o[o.length-1],i.length));let c=QD(l,a);o.push(c),s=s.matchType(c.type),i=a}}),o)return J.from(o)}return e}function QD(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,J.from(e));return e}function GD(e,t,n,r,s){if(s<e.length&&s<t.length&&e[s]==t[s]){let i=GD(e,t,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==e.length-1?n.type:e[s+1]))return r.copy(r.content.append(J.from(QD(n,e,s+1))))}}function JD(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,JD(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(J.empty,!0);return e.copy(n.append(r))}function Fw(e,t,n,r,s,i){let o=t<0?e.firstChild:e.lastChild,l=o.content;return e.childCount>1&&(i=0),s<r-1&&(l=Fw(l,t,n,r,s+1,i)),s>=n&&(l=t<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(J.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(l))}function HT(e,t,n){return t<e.openStart&&(e=new ue(Fw(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new ue(Fw(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const ZD={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 UT=null;function YD(){return UT||(UT=document.implementation.createHTMLDocument("title"))}let Zx=null;function vZ(e){let t=window.trustedTypes;return t?(Zx||(Zx=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Zx.createHTML(e)):e}function wZ(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=YD().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),s;if((s=r&&ZD[r[1].toLowerCase()])&&(e=s.map(i=>"<"+i+">").join("")+e+s.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=vZ(e),s)for(let i=0;i<s.length;i++)n=n.querySelector(s[i])||n;return n}function bZ(e){let t=e.querySelectorAll(Xt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function kZ(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:s,openStart:i,openEnd:o}=e;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;s=J.from(a.create(r[l+1],s)),i++,o++}return new ue(s,i,o)}const Hn={},Un={},SZ={touchstart:!0,touchmove:!0};class CZ{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 EZ(e){for(let t in Hn){let n=Hn[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{TZ(e,r)&&!O1(e,r)&&(e.editable||!(r.type in Un))&&n(e,r)},SZ[t]?{passive:!0}:void 0)}pn&&e.dom.addEventListener("input",()=>null),Bw(e)}function vo(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function NZ(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function Bw(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>O1(e,r))})}function O1(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function TZ(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function RZ(e,t){!O1(e,t)&&Hn[t.type]&&(e.editable||!(t.type in Un))&&Hn[t.type](e,t)}Un.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!eL(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(wi&&Xt&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),Qu&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",s=>s(e,ml(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||gZ(e,n)?n.preventDefault():vo(e,"key")};Un.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};Un.keypress=(e,t)=>{let n=t;if(eL(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Dr&&n.metaKey)return;if(e.someProp("handleKeyPress",s=>s(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof _e)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!e.someProp("handleTextInput",o=>o(e,r.$from.pos,r.$to.pos,s,i))&&e.dispatch(i()),n.preventDefault()}};function uy(e){return{left:e.clientX,top:e.clientY}}function MZ(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function j1(e,t,n,r,s){if(r==-1)return!1;let i=e.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(e.someProp(t,l=>o>i.depth?l(e,n,i.nodeAfter,i.before(o),s,!0):l(e,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function lu(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function OZ(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&Te.isSelectable(r)?(lu(e,new Te(n)),!0):!1}function jZ(e,t){if(t==-1)return!1;let n=e.state.selection,r,s;n instanceof Te&&(r=n.node);let i=e.state.doc.resolve(t);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(Te.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(lu(e,Te.create(e.state.doc,s)),!0):!1}function PZ(e,t,n,r,s){return j1(e,"handleClickOn",t,n,r)||e.someProp("handleClick",i=>i(e,t,r))||(s?jZ(e,n):OZ(e,n))}function AZ(e,t,n,r){return j1(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",s=>s(e,t,r))}function _Z(e,t,n,r){return j1(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",s=>s(e,t,r))||IZ(e,n,r)}function IZ(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(lu(e,_e.create(r,0,r.content.size)),!0):!1;let s=r.resolve(t);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)lu(e,_e.create(r,l+1,l+1+o.content.size));else if(Te.isSelectable(o))lu(e,Te.create(r,l));else continue;return!0}}function P1(e){return Mm(e)}const XD=Dr?"metaKey":"ctrlKey";Hn.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=P1(e),s=Date.now(),i="singleClick";s-e.input.lastClick.time<500&&MZ(n,e.input.lastClick)&&!n[XD]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type=="singleClick"?i="doubleClick":e.input.lastClick.type=="doubleClick"&&(i="tripleClick")),e.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=e.posAtCoords(uy(n));o&&(i=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new DZ(e,o,n,!!r)):(i=="doubleClick"?AZ:_Z)(e,o.pos,o.inside,n)?n.preventDefault():vo(e,"pointer"))};class DZ{constructor(t,n,r,s){this.view=t,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[XD],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=t.state.doc.nodeAt(n.inside),o=n.inside;else{let c=t.state.doc.resolve(n.pos);i=c.parent,o=c.depth?c.before():0}const l=s?null:r.target,a=l?t.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:u}=t.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof Te&&u.from<=o&&u.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ur&&!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()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),vo(t,"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(()=>Ni(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(uy(t))),this.updateAllowDefault(t),this.allowDefault||!n?vo(this.view,"pointer"):PZ(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||pn&&this.mightDrag&&!this.mightDrag.node.isAtom||Xt&&!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)?(lu(this.view,Pe.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):vo(this.view,"pointer")}move(t){this.updateAllowDefault(t),vo(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}Hn.touchstart=e=>{e.input.lastTouch=Date.now(),P1(e),vo(e,"pointer")};Hn.touchmove=e=>{e.input.lastTouch=Date.now(),vo(e,"pointer")};Hn.contextmenu=e=>P1(e);function eL(e,t){return e.composing?!0:pn&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const LZ=wi?5e3:-1;Un.compositionstart=Un.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof _e&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Xt&&jD&&$Z(e)))e.markCursor=e.state.storedMarks||n.marks(),Mm(e,!0),e.markCursor=null;else if(Mm(e,!t.selection.empty),Ur&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=e.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}e.input.composing=!0}tL(e,LZ)};function $Z(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Un.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,tL(e,20))};function tL(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Mm(e),t))}function nL(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=FZ());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function zZ(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=jJ(t.focusNode,t.focusOffset),r=PJ(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function FZ(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function Mm(e,t=!1){if(!(wi&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),nL(e),t||e.docView&&e.docView.dirty){let n=T1(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function BZ(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const nf=sr&&Po<15||Qu&&DJ<604;Hn.copy=Un.cut=(e,t)=>{let n=t,r=e.state.selection,s=n.type=="cut";if(r.empty)return;let i=nf?null:n.clipboardData,o=r.content(),{dom:l,text:a}=M1(e,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):BZ(e,l),s&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function VZ(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function HZ(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?rf(e,r.value,null,s,t):rf(e,r.textContent,r.innerHTML,s,t)},50)}function rf(e,t,n,r,s){let i=KD(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",a=>a(e,s,i||ue.empty)))return!0;if(!i)return!1;let o=VZ(i),l=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(i);return e.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function rL(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Un.paste=(e,t)=>{let n=t;if(e.composing&&!wi)return;let r=nf?null:n.clipboardData,s=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&rf(e,rL(r),r.getData("text/html"),s,n)?n.preventDefault():HZ(e,n)};class sL{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const UZ=Dr?"altKey":"ctrlKey";function iL(e,t){let n=e.someProp("dragCopies",r=>!r(t));return n??!t[UZ]}Hn.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=e.state.selection,i=s.empty?null:e.posAtCoords(uy(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof Te?s.to-1:s.to))){if(r&&r.mightDrag)o=Te.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=e.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=e.docView&&(o=Te.create(e.state.doc,d.posBefore))}}let l=(o||e.state.selection).content(),{dom:a,text:u,slice:c}=M1(e,l);(!n.dataTransfer.files.length||!Xt||OD>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(nf?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",nf||n.dataTransfer.setData("text/plain",u),e.dragging=new sL(c,iL(e,n),o)};Hn.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};Un.dragover=Un.dragenter=(e,t)=>t.preventDefault();Un.drop=(e,t)=>{try{qZ(e,t,e.dragging)}finally{e.dragging=null}};function qZ(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(uy(t));if(!r)return;let s=e.state.doc.resolve(r.pos),i=n&&n.slice;i?e.someProp("transformPasted",f=>{i=f(i,e,!1)}):i=KD(e,rL(t.dataTransfer),nf?null:t.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&iL(e,t));if(e.someProp("handleDrop",f=>f(e,t,i||ue.empty,o))){t.preventDefault();return}if(!i)return;t.preventDefault();let l=i?aD(e.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let a=e.state.tr;if(o){let{node:f}=n;f?f.replace(a):a.deleteSelection()}let u=a.mapping.map(l),c=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=a.doc;if(c?a.replaceRangeWith(u,u,i.content.firstChild):a.replaceRange(u,u,i),a.doc.eq(d))return;let h=a.doc.resolve(u);if(c&&Te.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new Te(h));else{let f=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((m,g,v,y)=>f=y),a.setSelection(R1(e,h,a.doc.resolve(f)))}e.focus(),e.dispatch(a.setMeta("uiEvent","drop"))}Hn.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Ni(e)},20))};Hn.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};Hn.beforeinput=(e,t)=>{if(Xt&&wi&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",i=>i(e,ml(8,"Backspace")))))return;let{$cursor:s}=e.state.selection;s&&s.pos>0&&e.dispatch(e.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let e in Un)Hn[e]=Un[e];function sf(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Om{constructor(t,n){this.toDOM=t,this.spec=n||$l,this.side=this.spec.side||0}map(t,n,r,s){let{pos:i,deleted:o}=t.mapResult(n.from+s,this.side<0?-1:1);return o?null:new zn(i-r,i-r,this)}valid(){return!0}eq(t){return this==t||t instanceof Om&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&sf(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class _o{constructor(t,n){this.attrs=t,this.spec=n||$l}map(t,n,r,s){let i=t.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=t.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new zn(i,o,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof _o&&sf(this.attrs,t.attrs)&&sf(this.spec,t.spec)}static is(t){return t.type instanceof _o}destroy(){}}class A1{constructor(t,n){this.attrs=t,this.spec=n||$l}map(t,n,r,s){let i=t.mapResult(n.from+s,1);if(i.deleted)return null;let o=t.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new zn(i.pos-r,o.pos-r,this)}valid(t,n){let{index:r,offset:s}=t.content.findIndex(n.from),i;return s==n.from&&!(i=t.child(r)).isText&&s+i.nodeSize==n.to}eq(t){return this==t||t instanceof A1&&sf(this.attrs,t.attrs)&&sf(this.spec,t.spec)}destroy(){}}class zn{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new zn(t,n,this.type)}eq(t,n=0){return this.type.eq(t.type)&&this.from+n==t.from&&this.to+n==t.to}map(t,n,r){return this.type.map(t,this,n,r)}static widget(t,n,r){return new zn(t,t,new Om(n,r))}static inline(t,n,r,s){return new zn(t,n,new _o(r,s))}static node(t,n,r,s){return new zn(t,n,new A1(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof _o}get widget(){return this.type instanceof Om}}const Ia=[],$l={};class Nt{constructor(t,n){this.local=t.length?t:Ia,this.children=n.length?n:Ia}static create(t,n){return n.length?jm(n,t,0,$l):En}find(t,n,r){let s=[];return this.findInner(t??0,n??1e9,s,0,r),s}findInner(t,n,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=t&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>t){let l=this.children[o]+1;this.children[o+2].findInner(t-l,n-l,r,s+l,i)}}map(t,n,r){return this==En||t.maps.length==0?this:this.mapInner(t,n,0,0,r||$l)}mapInner(t,n,r,s,i){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(t,r,s);a&&a.type.valid(n,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?WZ(this.children,o||[],t,n,r,s,i):o?new Nt(o.sort(zl),Ia):En}add(t,n){return n.length?this==En?Nt.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let s,i=0;t.forEach((l,a)=>{let u=a+r,c;if(c=lL(n,l,u)){for(s||(s=this.children.slice());i<s.length&&s[i]<a;)i+=3;s[i]==a?s[i+2]=s[i+2].addInner(l,c,u+1):s.splice(i,0,a,a+l.nodeSize,jm(c,l,u+1,$l)),i+=3}});let o=oL(i?aL(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(t,o[l])||o.splice(l--,1);return new Nt(o.length?this.local.concat(o).sort(zl):this.local,s||this.children)}remove(t){return t.length==0||this==En?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+n,a=r[i+1]+n;for(let c=0,d;c<t.length;c++)(d=t[c])&&d.from>l&&d.to<a&&(t[c]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[i+2].removeInner(o,l+1);u!=En?r[i+2]=u:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<t.length;i++)if(o=t[i])for(let l=0;l<s.length;l++)s[l].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new Nt(s,r):En}forChild(t,n){if(this==En)return this;if(n.isLeaf)return Nt.empty;let r,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=t){this.children[l]==t&&(r=this.children[l+2]);break}let i=t+1,o=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>i&&a.type instanceof _o){let u=Math.max(i,a.from)-i,c=Math.min(o,a.to)-i;u<c&&(s||(s=[])).push(a.copy(u,c))}}if(s){let l=new Nt(s.sort(zl),Ia);return r?new eo([l,r]):l}return r||En}eq(t){if(this==t)return!0;if(!(t instanceof Nt)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0}locals(t){return _1(this.localsInner(t))}localsInner(t){if(this==En)return Ia;if(t.inlineContent||!this.local.some(_o.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof _o||n.push(this.local[r]);return n}forEachSet(t){t(this)}}Nt.empty=new Nt([],[]);Nt.removeOverlap=_1;const En=Nt.empty;class eo{constructor(t){this.members=t}map(t,n){const r=this.members.map(s=>s.map(t,n,$l));return eo.from(r)}forChild(t,n){if(n.isLeaf)return Nt.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(t,n);i!=En&&(i instanceof eo?r=r.concat(i.members):r.push(i))}return eo.from(r)}eq(t){if(!(t instanceof eo)||t.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}locals(t){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(t);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?_1(r?n:n.sort(zl)):Ia}static from(t){switch(t.length){case 0:return En;case 1:return t[0];default:return new eo(t.every(n=>n instanceof Nt)?t:t.reduce((n,r)=>n.concat(r instanceof Nt?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function WZ(e,t,n,r,s,i,o){let l=e.slice();for(let u=0,c=i;u<n.maps.length;u++){let d=0;n.maps[u].forEach((h,f,m,g)=>{let v=g-m-(f-h);for(let y=0;y<l.length;y+=3){let w=l[y+1];if(w<0||h>w+c-d)continue;let b=l[y]+c-d;f>=b?l[y+1]=h<=b?-2:-1:h>=c&&v&&(l[y]+=v,l[y+1]+=v)}d+=v}),c=n.maps[u].map(c,-1)}let a=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){a=!0,l[u+1]=-1;continue}let c=n.map(e[u]+i),d=c-s;if(d<0||d>=r.content.size){a=!0;continue}let h=n.map(e[u+1]+i,-1),f=h-s,{index:m,offset:g}=r.content.findIndex(d),v=r.maybeChild(m);if(v&&g==d&&g+v.nodeSize==f){let y=l[u+2].mapInner(n,v,c+1,e[u]+i+1,o);y!=En?(l[u]=d,l[u+1]=f,l[u+2]=y):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=KZ(l,e,t,n,s,i,o),c=jm(u,r,0,o);t=c.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,h=0;d<c.children.length;d+=3){let f=c.children[d];for(;h<l.length&&l[h]<f;)h+=3;l.splice(h,0,c.children[d],c.children[d+1],c.children[d+2])}}return new Nt(t.sort(zl),l)}function oL(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let s=e[r];n.push(new zn(s.from+t,s.to+t,s.type))}return n}function KZ(e,t,n,r,s,i,o){function l(a,u){for(let c=0;c<a.local.length;c++){let d=a.local[c].map(r,s,u);d?n.push(d):o.onRemove&&o.onRemove(a.local[c].spec)}for(let c=0;c<a.children.length;c+=3)l(a.children[c+2],a.children[c]+u+1)}for(let a=0;a<e.length;a+=3)e[a+1]==-1&&l(e[a+2],t[a]+i+1);return n}function lL(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,s=null;for(let i=0,o;i<e.length;i++)(o=e[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),e[i]=null);return s}function aL(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function jm(e,t,n,r){let s=[],i=!1;t.forEach((l,a)=>{let u=lL(e,l,a+n);if(u){i=!0;let c=jm(u,l,n+a+1,r);c!=En&&s.push(a,a+l.nodeSize,c)}});let o=oL(i?aL(e):e,-n).sort(zl);for(let l=0;l<o.length;l++)o[l].type.valid(t,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||s.length?new Nt(o,s):En}function zl(e,t){return e.from-t.from||e.to-t.to}function _1(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let s=n+1;s<t.length;s++){let i=t[s];if(i.from==r.from){i.to!=r.to&&(t==e&&(t=e.slice()),t[s]=i.copy(i.from,r.to),qT(t,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),qT(t,s,r.copy(i.from,r.to)));break}}}return t}function qT(e,t,n){for(;t<e.length&&zl(n,e[t])>0;)t++;e.splice(t,0,n)}function Yx(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=En&&t.push(r)}),e.cursorWrapper&&t.push(Nt.create(e.state.doc,[e.cursorWrapper.deco])),eo.from(t)}const QZ={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},GZ=sr&&Po<=11;class JZ{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class ZZ{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new JZ,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);sr&&Po<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():pn&&t.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),GZ&&(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,QZ)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;n<t.length;n++)this.queue.push(t[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(LT(this.view)){if(this.suppressingSelectionUpdates)return Ni(this.view);if(sr&&Po<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&ea(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,r;for(let i=t.focusNode;i;i=Ku(i))n.add(i);for(let i=t.anchorNode;i;i=Ku(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&<(t)&&!this.ignoreSelectionChange(r),i=-1,o=-1,l=!1,a=[];if(t.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],a);d&&(i=i<0?d.from:Math.min(d.from,i),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(l=!0))}if(Ur&&a.length){let c=a.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,h]=c;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of c){let f=h.parentNode;f&&f.nodeName=="LI"&&(!d||eY(t,d)!=f)&&h.remove()}}}else if((Xt||pn)&&a.some(c=>c.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46)){for(let c of a)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&c.parentNode.removeChild(c)}}let u=null;i<0&&s&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&ly(r)&&(u=T1(t))&&u.eq(Pe.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Ni(t),this.currentSelection.set(r),t.scrollToSelection()):(i>-1||s)&&(i>-1&&(t.docView.markDirty(i,o),YZ(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,tY(t,a)),this.handleDOMChange(i,o,l,a),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||Ni(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let c=0;c<t.addedNodes.length;c++){let d=t.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let s=t.previousSibling,i=t.nextSibling;if(sr&&Po<=11&&t.addedNodes.length)for(let c=0;c<t.addedNodes.length;c++){let{previousSibling:d,nextSibling:h}=t.addedNodes[c];(!d||Array.prototype.indexOf.call(t.addedNodes,d)<0)&&(s=d),(!h||Array.prototype.indexOf.call(t.addedNodes,h)<0)&&(i=h)}let o=s&&s.parentNode==t.target?cn(s)+1:0,l=r.localPosFromDOM(t.target,o,-1),a=i&&i.parentNode==t.target?cn(i):t.target.childNodes.length,u=r.localPosFromDOM(t.target,a,1);return{from:l,to:u}}else return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=t.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let WT=new WeakMap,KT=!1;function YZ(e){if(!WT.has(e)&&(WT.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Ur,KT)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."),KT=!0}}function QT(e,t){let n=t.startContainer,r=t.startOffset,s=t.endContainer,i=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return ea(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function XZ(e,t){if(t.getComposedRanges){let s=t.getComposedRanges(e.root)[0];if(s)return QT(e,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?QT(e,n):null}function eY(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function tY(e,t){var n;let{focusNode:r,focusOffset:s}=e.domSelectionRange();for(let i of t)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=i.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(i,l.firstChild),r==i&&e.domSelection().collapse(i,s)}else i.parentNode.removeChild(i)}}function nY(e,t,n){let{node:r,fromOffset:s,toOffset:i,from:o,to:l}=e.docView.parseRange(t,n),a=e.domSelectionRange(),u,c=a.anchorNode;if(c&&e.dom.contains(c.nodeType==1?c:c.parentNode)&&(u=[{node:c,offset:a.anchorOffset}],ly(a)||u.push({node:a.focusNode,offset:a.focusOffset})),Xt&&e.input.lastKeyCode===8)for(let v=i;v>s;v--){let y=r.childNodes[v-1],w=y.pmViewDesc;if(y.nodeName=="BR"&&!w){i=v;break}if(!w||w.size)break}let d=e.state.doc,h=e.someProp("domParser")||Ci.fromSchema(e.state.schema),f=d.resolve(o),m=null,g=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:s,to:i,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:rY,context:f});if(u&&u[0].pos!=null){let v=u[0].pos,y=u[1]&&u[1].pos;y==null&&(y=v),m={anchor:v+o,head:y+o}}return{doc:g,sel:m,from:o,to:l}}function rY(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(pn&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||pn&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const sY=/^(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 iY(e,t,n,r,s){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let E=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,N=T1(e,E);if(N&&!e.state.selection.eq(N)){if(Xt&&wi&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",T=>T(e,ml(13,"Enter"))))return;let O=e.state.tr.setSelection(N);E=="pointer"?O.setMeta("pointer",!0):E=="key"&&O.scrollIntoView(),i&&O.setMeta("composition",i),e.dispatch(O)}return}let o=e.state.doc.resolve(t),l=o.sharedDepth(n);t=o.before(l+1),n=e.state.doc.resolve(n).after(l+1);let a=e.state.selection,u=nY(e,t,n),c=e.state.doc,d=c.slice(u.from,u.to),h,f;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(h=e.state.selection.to,f="end"):(h=e.state.selection.from,f="start"),e.input.lastKeyCode=null;let m=aY(d.content,u.doc.content,u.from,h,f);if(m&&e.input.domChangeCount++,(Qu&&e.input.lastIOSEnter>Date.now()-225||wi)&&s.some(E=>E.nodeType==1&&!sY.test(E.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",E=>E(e,ml(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&a instanceof _e&&!a.empty&&a.$head.sameParent(a.$anchor)&&!e.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:a.from,endA:a.to,endB:a.to};else{if(u.sel){let E=GT(e,e.state.doc,u.sel);if(E&&!E.eq(e.state.selection)){let N=e.state.tr.setSelection(E);i&&N.setMeta("composition",i),e.dispatch(N)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof _e&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=u.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),sr&&Po<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)==" "&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),v=u.doc.resolveNoCache(m.endB-u.from),y=c.resolve(m.start),w=g.sameParent(v)&&g.parent.inlineContent&&y.end()>=m.endA;if((Qu&&e.input.lastIOSEnter>Date.now()-225&&(!w||s.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!w&&g.pos<u.doc.content.size&&(!g.sameParent(v)||!g.parent.inlineContent)&&g.pos<v.pos&&!/\S/.test(u.doc.textBetween(g.pos,v.pos,"","")))&&e.someProp("handleKeyDown",E=>E(e,ml(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&lY(c,m.start,m.endA,g,v)&&e.someProp("handleKeyDown",E=>E(e,ml(8,"Backspace")))){wi&&Xt&&e.domObserver.suppressSelectionUpdates();return}Xt&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),wi&&!w&&g.start()!=v.start()&&v.parentOffset==0&&g.depth==v.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,v=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{e.someProp("handleKeyDown",function(E){return E(e,ml(13,"Enter"))})},20));let b=m.start,C=m.endA,S=E=>{let N=E||e.state.tr.replace(b,C,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let O=GT(e,N.doc,u.sel);O&&!(Xt&&e.composing&&O.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(O.head==b||O.head==N.mapping.map(C)-1)||sr&&O.empty&&O.head==b)&&N.setSelection(O)}return i&&N.setMeta("composition",i),N.scrollIntoView()},k;if(w)if(g.pos==v.pos){sr&&Po<=11&&g.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ni(e),20));let E=S(e.state.tr.delete(b,C)),N=c.resolve(m.start).marksAcross(c.resolve(m.endA));N&&E.ensureMarks(N),e.dispatch(E)}else if(m.endA==m.endB&&(k=oY(g.parent.content.cut(g.parentOffset,v.parentOffset),y.parent.content.cut(y.parentOffset,m.endA-y.start())))){let E=S(e.state.tr);k.type=="add"?E.addMark(b,C,k.mark):E.removeMark(b,C,k.mark),e.dispatch(E)}else if(g.parent.child(g.index()).isText&&g.index()==v.index()-(v.textOffset?0:1)){let E=g.parent.textBetween(g.parentOffset,v.parentOffset),N=()=>S(e.state.tr.insertText(E,b,C));e.someProp("handleTextInput",O=>O(e,b,C,E,N))||e.dispatch(N())}else e.dispatch(S());else e.dispatch(S())}function GT(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:R1(e,t.resolve(n.anchor),t.resolve(n.head))}function oY(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,s=n,i=r,o,l,a;for(let c=0;c<r.length;c++)s=r[c].removeFromSet(s);for(let c=0;c<n.length;c++)i=n[c].removeFromSet(i);if(s.length==1&&i.length==0)l=s[0],o="add",a=c=>c.mark(l.addToSet(c.marks));else if(s.length==0&&i.length==1)l=i[0],o="remove",a=c=>c.mark(l.removeFromSet(c.marks));else return null;let u=[];for(let c=0;c<t.childCount;c++)u.push(a(t.child(c)));if(J.from(u).eq(e))return{mark:l,type:o}}function lY(e,t,n,r,s){if(n-t<=s.pos-r.pos||Xx(r,!0,!1)<s.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==t+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=e.resolve(Xx(i,!0,!0));return!o.parent.isTextblock||o.pos>n||Xx(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Xx(e,t,n){let r=e.depth,s=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,s++,t=!1;if(n){let i=e.node(r).maybeChild(e.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function aY(e,t,n,r,s){let i=e.findDiffStart(t,n);if(i==null)return null;let{a:o,b:l}=e.findDiffEnd(t,n+e.size,n+t.size);if(s=="end"){let a=Math.max(0,i-Math.min(o,l));r-=o+a-i}if(o<i&&e.size<t.size){let a=r<=i&&r>=o?i-r:0;i-=a,i&&i<t.size&&JT(t.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-o),o=i}else if(l<i){let a=r<=i&&r>=l?i-r:0;i-=a,i&&i<e.size&&JT(e.textBetween(i-1,i+1))&&(i+=a?1:-1),o=i+(o-l),l=i}return{start:i,endA:o,endB:l}}function JT(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class uL{constructor(t,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 CZ,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(tR),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=XT(this),YT(this),this.nodeViews=eR(this),this.docView=jT(this.state.doc,ZT(this),Yx(this),this.dom,this),this.domObserver=new ZZ(this,(r,s,i,o)=>iY(this,r,s,i,o)),this.domObserver.start(),EZ(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&Bw(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(tR),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var r;let s=this.state,i=!1,o=!1;t.storedMarks&&this.composing&&(nL(this),o=!0),this.state=t;let l=s.plugins!=t.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let f=eR(this);cY(f,this.nodeViews)&&(this.nodeViews=f,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Bw(this),this.editable=XT(this),YT(this);let a=Yx(this),u=ZT(this),c=s.plugins!=t.plugins&&!s.doc.eq(t.doc)?"reset":t.scrollToSelection>s.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(t.doc,u,a);(d||!t.selection.eq(s.selection))&&(o=!0);let h=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&zJ(this);if(o){this.domObserver.stop();let f=d&&(sr||Xt)&&!this.composing&&!s.selection.empty&&!t.selection.empty&&uY(s.selection,t.selection);if(d){let m=Xt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=zZ(this)),(i||!this.docView.update(t.doc,u,a,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=jT(t.doc,u,a,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&uZ(this))?Ni(this,f):(UD(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,s),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():h&&FJ(h)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.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&&ET(this,n.getBoundingClientRect(),t)}else ET(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.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,t)}}updateDraggedNode(t,n){let r=t.node,s=-1;if(this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new sL(t.slice,t.move,s<0?void 0:Te.create(this.state.doc,s))}someProp(t,n){let r=this._props&&this._props[t],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[t];if(l!=null&&(s=n?n(l):l))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let l=i[o].props[t];if(l!=null&&(s=n?n(l):l))return s}}hasFocus(){if(sr){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&BJ(this.dom),Ni(this),this.domObserver.start()}get root(){let t=this._root;if(t==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 t||document}updateRoot(){this._root=null}posAtCoords(t){return WJ(this,t)}coordsAtPos(t,n=1){return DD(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let s=this.docView.posFromDOM(t,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(t,n){return ZJ(this,n||this.state,t)}pasteHTML(t,n){return rf(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return rf(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return M1(this,t)}destroy(){this.docView&&(NZ(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Yx(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,MJ())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return RZ(this,t)}domSelectionRange(){let t=this.domSelection();return t?pn&&this.root.nodeType===11&&_J(this.dom.ownerDocument)==this.dom&&XZ(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}uL.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function ZT(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[zn.node(0,e.state.doc.content.size,t)]}function YT(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:zn.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function XT(e){return!e.someProp("editable",t=>t(e.state)===!1)}function uY(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function eR(e){let t=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(t,s)||(t[s]=r[s])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function cY(e,t){let n=0,r=0;for(let s in e){if(e[s]!=t[s])return!0;n++}for(let s in t)r++;return n!=r}function tR(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Wo={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:"'"},Pm={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},dY=typeof navigator<"u"&&/Mac/.test(navigator.platform),fY=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var dn=0;dn<10;dn++)Wo[48+dn]=Wo[96+dn]=String(dn);for(var dn=1;dn<=24;dn++)Wo[dn+111]="F"+dn;for(var dn=65;dn<=90;dn++)Wo[dn]=String.fromCharCode(dn+32),Pm[dn]=String.fromCharCode(dn);for(var ev in Wo)Pm.hasOwnProperty(ev)||(Pm[ev]=Wo[ev]);function hY(e){var t=dY&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||fY&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Pm:Wo)[e.keyCode]||e.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 pY=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),mY=typeof navigator<"u"&&/Win/.test(navigator.platform);function gY(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let l=0;l<t.length-1;l++){let a=t[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))pY?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function yY(e){let t=Object.create(null);for(let n in e)t[gY(n)]=e[n];return t}function tv(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function xY(e){return new bt({props:{handleKeyDown:I1(e)}})}function I1(e){let t=yY(e);return function(n,r){let s=hY(r),i,o=t[tv(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=t[tv(s,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(mY&&r.ctrlKey&&r.altKey)&&(i=Wo[r.keyCode])&&i!=s){let l=t[tv(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var vY=Object.defineProperty,D1=(e,t)=>{for(var n in t)vY(e,n,{get:t[n],enumerable:!0})};function cy(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:s}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,i=n.storedMarks,n}}}var dy=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:s}=n,i=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([o,l])=>[o,(...u)=>{const c=l(...u)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o=[],l=!!e,a=e||s.tr,u=()=>(!l&&t&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),o.every(d=>d===!0)),c={...Object.fromEntries(Object.entries(n).map(([d,h])=>[d,(...m)=>{const g=this.buildProps(a,t),v=h(...m)(g);return o.push(v),c}])),run:u};return c}createCan(e){const{rawCommands:t,state:n}=this,r=!1,s=e||n.tr,i=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(t).map(([l,a])=>[l,(...u)=>a(...u)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o={tr:e,editor:r,view:i,state:cy({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...u)=>a(...u)(o)]))}};return o}},es={};D1(es,{blur:()=>wY,clearContent:()=>bY,clearNodes:()=>kY,command:()=>SY,createParagraphNear:()=>CY,cut:()=>EY,deleteCurrentNode:()=>NY,deleteNode:()=>TY,deleteRange:()=>RY,deleteSelection:()=>MY,enter:()=>OY,exitCode:()=>jY,extendMarkRange:()=>PY,first:()=>AY,focus:()=>IY,forEach:()=>DY,insertContent:()=>LY,insertContentAt:()=>FY,joinBackward:()=>HY,joinDown:()=>VY,joinForward:()=>UY,joinItemBackward:()=>qY,joinItemForward:()=>WY,joinTextblockBackward:()=>KY,joinTextblockForward:()=>QY,joinUp:()=>BY,keyboardShortcut:()=>JY,lift:()=>ZY,liftEmptyBlock:()=>YY,liftListItem:()=>XY,newlineInCode:()=>eX,resetAttributes:()=>tX,scrollIntoView:()=>nX,selectAll:()=>rX,selectNodeBackward:()=>sX,selectNodeForward:()=>iX,selectParentNode:()=>oX,selectTextblockEnd:()=>lX,selectTextblockStart:()=>aX,setContent:()=>uX,setMark:()=>MX,setMeta:()=>OX,setNode:()=>jX,setNodeSelection:()=>PX,setTextDirection:()=>AX,setTextSelection:()=>_X,sinkListItem:()=>IX,splitBlock:()=>DX,splitListItem:()=>LX,toggleList:()=>$X,toggleMark:()=>zX,toggleNode:()=>FX,toggleWrap:()=>BX,undoInputRule:()=>VX,unsetAllMarks:()=>HX,unsetMark:()=>UX,unsetTextDirection:()=>qX,updateAttributes:()=>WX,wrapIn:()=>KX,wrapInList:()=>QX});var wY=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),bY=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),kY=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:s}=r;return n&&s.forEach(({$from:i,$to:o})=>{e.doc.nodesBetween(i.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:u,mapping:c}=t,d=u.resolve(c.map(a)),h=u.resolve(c.map(a+l.nodeSize)),f=d.blockRange(h);if(!f)return;const m=uc(f);if(l.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());t.setNodeMarkup(f.start,g)}(m||m===0)&&t.lift(f,m)})}),!0},SY=e=>t=>e(t),CY=()=>({state:e,dispatch:t})=>ED(e,t),EY=(e,t)=>({editor:n,tr:r})=>{const{state:s}=n,i=s.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const o=r.mapping.map(t);return r.insert(o,i.content),r.setSelection(new _e(r.doc.resolve(Math.max(o-1,0)))),!0},NY=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const s=e.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(t){const l=s.before(i),a=s.after(i);e.delete(l,a).scrollIntoView()}return!0}return!1};function Bt(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var TY=e=>({tr:t,state:n,dispatch:r})=>{const s=Bt(e,n.schema),i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const a=i.before(o),u=i.after(o);t.delete(a,u).scrollIntoView()}return!0}return!1},RY=e=>({tr:t,dispatch:n})=>{const{from:r,to:s}=e;return n&&t.delete(r,s),!0},MY=()=>({state:e,dispatch:t})=>b1(e,t),OY=()=>({commands:e})=>e.keyboardShortcut("Enter"),jY=()=>({state:e,dispatch:t})=>pJ(e,t);function L1(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function Am(e,t,n={strict:!0}){const r=Object.keys(t);return r.length?r.every(s=>n.strict?t[s]===e[s]:L1(t[s])?t[s].test(e[s]):t[s]===e[s]):!0}function cL(e,t,n={}){return e.find(r=>r.type===t&&Am(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function nR(e,t,n={}){return!!cL(e,t,n)}function $1(e,t,n){var r;if(!e||!t)return;let s=e.parent.childAfter(e.parentOffset);if((!s.node||!s.node.marks.some(c=>c.type===t))&&(s=e.parent.childBefore(e.parentOffset)),!s.node||!s.node.marks.some(c=>c.type===t)||(n=n||((r=s.node.marks[0])==null?void 0:r.attrs),!cL([...s.node.marks],t,n)))return;let o=s.index,l=e.start()+s.offset,a=o+1,u=l+s.node.nodeSize;for(;o>0&&nR([...e.parent.child(o-1).marks],t,n);)o-=1,l-=e.parent.child(o).nodeSize;for(;a<e.parent.childCount&&nR([...e.parent.child(a).marks],t,n);)u+=e.parent.child(a).nodeSize,a+=1;return{from:l,to:u}}function Di(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var PY=(e,t={})=>({tr:n,state:r,dispatch:s})=>{const i=Di(e,r.schema),{doc:o,selection:l}=n,{$from:a,from:u,to:c}=l;if(s){const d=$1(a,i,t);if(d&&d.from<=u&&d.to>=c){const h=_e.create(o,d.from,d.to);n.setSelection(h)}}return!0},AY=e=>t=>{const n=typeof e=="function"?e(t):e;for(let r=0;r<n.length;r+=1)if(n[r](t))return!0;return!1};function z1(e){return e instanceof _e}function bi(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function dL(e,t=null){if(!t)return null;const n=Pe.atStart(e),r=Pe.atEnd(e);if(t==="start"||t===!0)return n;if(t==="end")return r;const s=n.from,i=r.to;return t==="all"?_e.create(e,bi(0,s,i),bi(e.content.size,s,i)):_e.create(e,bi(t,s,i),bi(t,s,i))}function rR(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function _m(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function _Y(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var IY=(e=null,t={})=>({editor:n,view:r,tr:s,dispatch:i})=>{t={scrollIntoView:!0,...t};const o=()=>{(_m()||rR())&&r.dom.focus(),_Y()&&!_m()&&!rR()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t!=null&&t.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(i&&e===null&&!z1(n.state.selection))return o(),!0;const l=dL(s.doc,e)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||s.setSelection(l),a&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},DY=(e,t)=>n=>e.every((r,s)=>t(r,{...n,index:s})),LY=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),fL=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&fL(r)}return e};function Kc(e){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,"text/html").body;return fL(n)}function of(e,t,n){if(e instanceof jo||e instanceof J)return e;n={slice:!0,parseOptions:{},...n};const r=typeof e=="object"&&e!==null,s=typeof e=="string";if(r)try{if(Array.isArray(e)&&e.length>0)return J.fromArray(e.map(l=>t.nodeFromJSON(l)));const o=t.nodeFromJSON(e);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",i),of("",t,n)}if(s){if(n.errorOnInvalidContent){let o=!1,l="";const a=new ZI({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(o=!0,l=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?Ci.fromSchema(a).parseSlice(Kc(e),n.parseOptions):Ci.fromSchema(a).parse(Kc(e),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=Ci.fromSchema(t);return n.slice?i.parseSlice(Kc(e),n.parseOptions).content:i.parse(Kc(e),n.parseOptions)}return of("",t,n)}function $Y(e,t,n){const r=e.steps.length-1;if(r<t)return;const s=e.steps[r];if(!(s instanceof Yt||s instanceof tn))return;const i=e.mapping.maps[r];let o=0;i.forEach((l,a,u,c)=>{o===0&&(o=c)}),e.setSelection(Pe.near(e.doc.resolve(o),n))}var zY=e=>!("type"in e),FY=(e,t,n)=>({tr:r,dispatch:s,editor:i})=>{var o;if(s){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=v=>{i.emit("contentError",{editor:i,error:v,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{of(t,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(v){a(v)}try{l=of(t,i.schema,{parseOptions:u,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(v){return a(v),!1}let{from:c,to:d}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},h=!0,f=!0;if((zY(l)?l:[l]).forEach(v=>{v.check(),h=h?v.isText&&v.marks.length===0:!1,f=f?v.isBlock:!1}),c===d&&f){const{parent:v}=r.doc.resolve(c);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(c-=1,d+=1)}let g;if(h){if(Array.isArray(t))g=t.map(v=>v.text||"").join("");else if(t instanceof J){let v="";t.forEach(y=>{y.text&&(v+=y.text)}),g=v}else typeof t=="object"&&t&&t.text?g=t.text:g=t;r.insertText(g,c,d)}else{g=l;const v=r.doc.resolve(c),y=v.node(),w=v.parentOffset===0,b=y.isText||y.isTextblock,C=y.content.size>0;w&&b&&C&&(c=Math.max(0,c-1)),r.replaceWith(c,d,g)}n.updateSelection&&$Y(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:g})}return!0},BY=()=>({state:e,dispatch:t})=>dJ(e,t),VY=()=>({state:e,dispatch:t})=>fJ(e,t),HY=()=>({state:e,dispatch:t})=>xD(e,t),UY=()=>({state:e,dispatch:t})=>kD(e,t),qY=()=>({state:e,dispatch:t,tr:n})=>{try{const r=sy(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},WY=()=>({state:e,dispatch:t,tr:n})=>{try{const r=sy(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},KY=()=>({state:e,dispatch:t})=>uJ(e,t),QY=()=>({state:e,dispatch:t})=>cJ(e,t);function hL(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function GY(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let r,s,i,o;for(let l=0;l<t.length-1;l+=1){const a=t[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))_m()||hL()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var JY=e=>({editor:t,view:n,tr:r,dispatch:s})=>{const i=GY(e).split(/-(?!$)/),o=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=t.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,l))});return a==null||a.steps.forEach(u=>{const c=u.map(r.mapping);c&&s&&r.maybeStep(c)}),!0};function Ko(e,t,n={}){const{from:r,to:s,empty:i}=e.selection,o=t?Bt(t,e.schema):null,l=[];e.doc.nodesBetween(r,s,(d,h)=>{if(d.isText)return;const f=Math.max(r,h),m=Math.min(s,h+d.nodeSize);l.push({node:d,from:f,to:m})});const a=s-r,u=l.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Am(d.node.attrs,n,{strict:!1}));return i?!!u.length:u.reduce((d,h)=>d+h.to-h.from,0)>=a}var ZY=(e,t={})=>({state:n,dispatch:r})=>{const s=Bt(e,n.schema);return Ko(n,s,t)?hJ(n,r):!1},YY=()=>({state:e,dispatch:t})=>ND(e,t),XY=e=>({state:t,dispatch:n})=>{const r=Bt(e,t.schema);return EJ(r)(t,n)},eX=()=>({state:e,dispatch:t})=>CD(e,t);function fy(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function sR(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((r,s)=>(n.includes(s)||(r[s]=e[s]),r),{})}var tX=(e,t)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const l=fy(typeof e=="string"?e:e.name,r.schema);if(!l)return!1;l==="node"&&(i=Bt(e,r.schema)),l==="mark"&&(o=Di(e,r.schema));let a=!1;return n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(c,d)=>{i&&i===c.type&&(a=!0,s&&n.setNodeMarkup(d,void 0,sR(c.attrs,t))),o&&c.marks.length&&c.marks.forEach(h=>{o===h.type&&(a=!0,s&&n.addMark(d,d+c.nodeSize,o.create(sR(h.attrs,t))))})})}),a},nX=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),rX=()=>({tr:e,dispatch:t})=>{if(t){const n=new vr(e.doc);e.setSelection(n)}return!0},sX=()=>({state:e,dispatch:t})=>wD(e,t),iX=()=>({state:e,dispatch:t})=>SD(e,t),oX=()=>({state:e,dispatch:t})=>yJ(e,t),lX=()=>({state:e,dispatch:t})=>wJ(e,t),aX=()=>({state:e,dispatch:t})=>vJ(e,t);function Vw(e,t,n={},r={}){return of(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var uX=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:l})=>{const{doc:a}=i;if(r.preserveWhitespace!=="full"){const u=Vw(e,s.schema,r,{errorOnInvalidContent:t??s.options.enableContentCheck});return o&&i.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},e,{parseOptions:r,errorOnInvalidContent:t??s.options.enableContentCheck})};function pL(e,t){const n=Di(t,e.schema),{from:r,to:s,empty:i}=e.selection,o=[];i?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,s,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function mL(e,t){const n=new hD(e);return t.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function cX(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function dX(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function fX(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function hy(e){return t=>fX(t.$from,e)}function ke(e,t,n){return e.config[t]===void 0&&e.parent?ke(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?ke(e.parent,t,n):null}):e.config[t]}function py(e){return e.map(t=>{const n={name:t.name,options:t.options,storage:t.storage},r=ke(t,"addExtensions",n);return r?[t,...py(r())]:t}).flat(10)}function F1(e,t){const n=da.fromSchema(t).serializeFragment(e),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function gL(e){return typeof e=="function"}function ot(e,t=void 0,...n){return gL(e)?t?e.bind(t)(...n):e(...n):e}function hX(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Gu(e){const t=e.filter(s=>s.type==="extension"),n=e.filter(s=>s.type==="node"),r=e.filter(s=>s.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:r}}function yL(e){const t=[],{nodeExtensions:n,markExtensions:r}=Gu(e),s=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage,extensions:s},a=ke(o,"addGlobalAttributes",l);if(!a)return;a().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([h,f])=>{t.push({type:d,name:h,attribute:{...i,...f}})})})})}),s.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage},a=ke(o,"addAttributes",l);if(!a)return;const u=a();Object.entries(u).forEach(([c,d])=>{const h={...i,...d};typeof(h==null?void 0:h.default)=="function"&&(h.default=h.default()),h!=null&&h.isRequired&&(h==null?void 0:h.default)===void 0&&delete h.default,t.push({type:o.name,name:c,attribute:h})})}),t}function Vt(...e){return e.filter(t=>!!t).reduce((t,n)=>{const r={...t};return Object.entries(n).forEach(([s,i])=>{if(!r[s]){r[s]=i;return}if(s==="class"){const l=i?String(i).split(" "):[],a=r[s]?r[s].split(" "):[],u=l.filter(c=>!a.includes(c));r[s]=[...a,...u].join(" ")}else if(s==="style"){const l=i?i.split(";").map(c=>c.trim()).filter(Boolean):[],a=r[s]?r[s].split(";").map(c=>c.trim()).filter(Boolean):[],u=new Map;a.forEach(c=>{const[d,h]=c.split(":").map(f=>f.trim());u.set(d,h)}),l.forEach(c=>{const[d,h]=c.split(":").map(f=>f.trim());u.set(d,h)}),r[s]=Array.from(u.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else r[s]=i}),r},{})}function lf(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,r)=>Vt(n,r),{})}function pX(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function iR(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;const s=t.reduce((i,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(n):pX(n.getAttribute(o.name));return l==null?i:{...i,[o.name]:l}},{});return{...r,...s}}}}function oR(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&hX(n)?!1:n!=null))}function lR(e){var t,n;const r={};return!((t=e==null?void 0:e.attribute)!=null&&t.isRequired)&&"default"in((e==null?void 0:e.attribute)||{})&&(r.default=e.attribute.default),((n=e==null?void 0:e.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function xL(e,t){var n;const r=yL(e),{nodeExtensions:s,markExtensions:i}=Gu(e),o=(n=s.find(u=>ke(u,"topNode")))==null?void 0:n.name,l=Object.fromEntries(s.map(u=>{const c=r.filter(y=>y.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:t},h=e.reduce((y,w)=>{const b=ke(w,"extendNodeSchema",d);return{...y,...b?b(u):{}}},{}),f=oR({...h,content:ot(ke(u,"content",d)),marks:ot(ke(u,"marks",d)),group:ot(ke(u,"group",d)),inline:ot(ke(u,"inline",d)),atom:ot(ke(u,"atom",d)),selectable:ot(ke(u,"selectable",d)),draggable:ot(ke(u,"draggable",d)),code:ot(ke(u,"code",d)),whitespace:ot(ke(u,"whitespace",d)),linebreakReplacement:ot(ke(u,"linebreakReplacement",d)),defining:ot(ke(u,"defining",d)),isolating:ot(ke(u,"isolating",d)),attrs:Object.fromEntries(c.map(lR))}),m=ot(ke(u,"parseHTML",d));m&&(f.parseDOM=m.map(y=>iR(y,c)));const g=ke(u,"renderHTML",d);g&&(f.toDOM=y=>g({node:y,HTMLAttributes:lf(y,c)}));const v=ke(u,"renderText",d);return v&&(f.toText=v),[u.name,f]})),a=Object.fromEntries(i.map(u=>{const c=r.filter(v=>v.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:t},h=e.reduce((v,y)=>{const w=ke(y,"extendMarkSchema",d);return{...v,...w?w(u):{}}},{}),f=oR({...h,inclusive:ot(ke(u,"inclusive",d)),excludes:ot(ke(u,"excludes",d)),group:ot(ke(u,"group",d)),spanning:ot(ke(u,"spanning",d)),code:ot(ke(u,"code",d)),attrs:Object.fromEntries(c.map(lR))}),m=ot(ke(u,"parseHTML",d));m&&(f.parseDOM=m.map(v=>iR(v,c)));const g=ke(u,"renderHTML",d);return g&&(f.toDOM=v=>g({mark:v,HTMLAttributes:lf(v,c)})),[u.name,f]}));return new ZI({topNode:o,nodes:l,marks:a})}function mX(e){const t=e.filter((n,r)=>e.indexOf(n)!==r);return Array.from(new Set(t))}function Im(e){return e.sort((n,r)=>{const s=ke(n,"priority")||100,i=ke(r,"priority")||100;return s>i?-1:s<i?1:0})}function B1(e){const t=Im(py(e)),n=mX(t.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.`),t}function gX(e,t){const n=B1(e);return xL(n,t)}function yX(e,t){const n=gX(t),r=Kc(e);return Ci.fromSchema(n).parse(r).toJSON()}function vL(e,t,n){const{from:r,to:s}=t,{blockSeparator:i=`
|
|
496
|
+
|
|
497
|
+
`,textSerializers:o={}}=n||{};let l="";return e.nodesBetween(r,s,(a,u,c,d)=>{var h;a.isBlock&&u>r&&(l+=i);const f=o==null?void 0:o[a.type.name];if(f)return c&&(l+=f({node:a,pos:u,parent:c,index:d,range:t})),!1;a.isText&&(l+=(h=a==null?void 0:a.text)==null?void 0:h.slice(Math.max(r,u)-u,s-u))}),l}function wL(e,t){const n={from:0,to:e.content.size};return vL(e,n,t)}function V1(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}function xX(e,t){const n=Bt(t,e.schema),{from:r,to:s}=e.selection,i=[];e.doc.nodesBetween(r,s,l=>{i.push(l)});const o=i.reverse().find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function bL(e,t){const n=fy(typeof t=="string"?t:t.name,e.schema);return n==="node"?xX(e,t):n==="mark"?pL(e,t):{}}function vX(e,t=JSON.stringify){const n={};return e.filter(r=>{const s=t(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function wX(e){const t=vX(e);return t.length===1?t:t.filter((n,r)=>!t.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function kL(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=n[i];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const u=t.slice(i).map(l,-1),c=t.slice(i).map(a),d=t.invert().map(u,-1),h=t.invert().map(c);r.push({oldRange:{from:d,to:h},newRange:{from:u,to:c}})})}),wX(r)}function H1(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(s=>{const i=n.resolve(e),o=$1(i,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(e,t,(s,i)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}var bX=(e,t,n,r=20)=>{const s=e.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const l=s.node(i);(l==null?void 0:l.type.name)===t?o=l:i-=1}return[o,i]};function jh(e,t){return t.nodes[e]||t.marks[e]||null}function wp(e,t,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=e.find(i=>i.type===t&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var kX=(e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(s,i,o,l)=>{var a,u;const c=((u=(a=s.type.spec).toText)==null?void 0:u.call(a,{node:s,pos:i,parent:o,index:l}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?c:c.slice(0,Math.max(0,r-i))}),n};function Hw(e,t,n={}){const{empty:r,ranges:s}=e.selection,i=t?Di(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Am(d.attrs,n,{strict:!1}));let o=0;const l=[];if(s.forEach(({$from:d,$to:h})=>{const f=d.pos,m=h.pos;e.doc.nodesBetween(f,m,(g,v)=>{if(!g.isText&&!g.marks.length)return;const y=Math.max(f,v),w=Math.min(m,v+g.nodeSize),b=w-y;o+=b,l.push(...g.marks.map(C=>({mark:C,from:y,to:w})))})}),o===0)return!1;const a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Am(d.mark.attrs,n,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),u=l.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,h)=>d+h.to-h.from,0);return(a>0?a+u:a)>=o}function SX(e,t,n={}){if(!t)return Ko(e,null,n)||Hw(e,null,n);const r=fy(t,e.schema);return r==="node"?Ko(e,t,n):r==="mark"?Hw(e,t,n):!1}var CX=(e,t)=>{const{$from:n,$to:r,$anchor:s}=e.selection;if(t){const i=hy(l=>l.type.name===t)(e.selection);if(!i)return!1;const o=e.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},EX=e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function aR(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function uR(e,t){const{nodeExtensions:n}=Gu(t),r=n.find(o=>o.name===e);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=ot(ke(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function my(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(e.type.name==="hardBreak")return!0;if(e.isText)return/^\s*$/m.test((r=e.text)!=null?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let s=!0;return e.content.forEach(i=>{s!==!1&&(my(i,{ignoreWhitespace:n,checkChildren:t})||(s=!1))}),s}return!1}function SL(e){return e instanceof Te}var CL=class EL{constructor(t){this.position=t}static fromJSON(t){return new EL(t.position)}toJSON(){return{position:this.position}}};function NX(e,t){const n=t.mapping.mapResult(e.position);return{position:new CL(n.pos),mapResult:n}}function TX(e){return new CL(e)}function NL(e,t,n){const s=e.state.doc.content.size,i=bi(t,0,s),o=bi(n,0,s),l=e.coordsAtPos(i),a=e.coordsAtPos(o,-1),u=Math.min(l.top,a.top),c=Math.max(l.bottom,a.bottom),d=Math.min(l.left,a.left),h=Math.max(l.right,a.right),f=h-d,m=c-u,y={top:u,bottom:c,left:d,right:h,width:f,height:m,x:d,y:u};return{...y,toJSON:()=>y}}function RX(e,t,n){var r;const{selection:s}=t;let i=null;if(z1(s)&&(i=s.$cursor),i){const l=(r=e.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(u=>u.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:l,$to:a})=>{let u=l.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(l.pos,a.pos,(c,d,h)=>{if(u)return!1;if(c.isInline){const f=!h||h.type.allowsMarkType(n),m=!!n.isInSet(c.marks)||!c.marks.some(g=>g.type.excludes(n));u=f&&m}return!u}),u})}var MX=(e,t={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:l}=i,a=Di(e,r.schema);if(s)if(o){const u=pL(r,a);n.addStoredMark(a.create({...u,...t}))}else l.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;r.doc.nodesBetween(c,d,(h,f)=>{const m=Math.max(f,c),g=Math.min(f+h.nodeSize,d);h.marks.find(y=>y.type===a)?h.marks.forEach(y=>{a===y.type&&n.addMark(m,g,a.create({...y.attrs,...t}))}):n.addMark(m,g,a.create(t))})});return RX(r,n,a)},OX=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),jX=(e,t={})=>({state:n,dispatch:r,chain:s})=>{const i=Bt(e,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:l})=>kT(i,{...o,...t})(n)?!0:l.clearNodes()).command(({state:l})=>kT(i,{...o,...t})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},PX=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,s=bi(e,0,r.content.size),i=Te.create(r,s);t.setSelection(i)}return!0},AX=(e,t)=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=r;let o,l;return typeof t=="number"?(o=t,l=t):t&&"from"in t&&"to"in t?(o=t.from,l=t.to):(o=i.from,l=i.to),s&&n.doc.nodesBetween(o,l,(a,u)=>{a.isText||n.setNodeMarkup(u,void 0,{...a.attrs,dir:e})}),!0},_X=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,{from:s,to:i}=typeof e=="number"?{from:e,to:e}:e,o=_e.atStart(r).from,l=_e.atEnd(r).to,a=bi(s,o,l),u=bi(i,o,l),c=_e.create(r,a,u);t.setSelection(c)}return!0},IX=e=>({state:t,dispatch:n})=>{const r=Bt(e,t.schema);return RJ(r)(t,n)};function cR(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(s=>t==null?void 0:t.includes(s.type.name));e.tr.ensureMarks(r)}}var DX=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:s})=>{const{selection:i,doc:o}=t,{$from:l,$to:a}=i,u=s.extensionManager.attributes,c=wp(u,l.node().type.name,l.node().attrs);if(i instanceof Te&&i.node.isBlock)return!l.parentOffset||!Ei(o,l.pos)?!1:(r&&(e&&cR(n,s.extensionManager.splittableMarks),t.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,h=l.depth===0?void 0:cX(l.node(-1).contentMatchAt(l.indexAfter(-1)));let f=d&&h?[{type:h,attrs:c}]:void 0,m=Ei(t.doc,t.mapping.map(l.pos),1,f);if(!f&&!m&&Ei(t.doc,t.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(m=!0,f=h?[{type:h,attrs:c}]:void 0),r){if(m&&(i instanceof _e&&t.deleteSelection(),t.split(t.mapping.map(l.pos),1,f),h&&!d&&!l.parentOffset&&l.parent.type!==h)){const g=t.mapping.map(l.before()),v=t.doc.resolve(g);l.node(-1).canReplaceWith(v.index(),v.index()+1,h)&&t.setNodeMarkup(t.mapping.map(l.before()),h)}e&&cR(n,s.extensionManager.splittableMarks),t.scrollIntoView()}return m},LX=(e,t={})=>({tr:n,state:r,dispatch:s,editor:i})=>{var o;const l=Bt(e,r.schema),{$from:a,$to:u}=r.selection,c=r.selection.node;if(c&&c.isBlock||a.depth<2||!a.sameParent(u))return!1;const d=a.node(-1);if(d.type!==l)return!1;const h=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(s){let y=J.empty;const w=a.index(-1)?1:a.index(-2)?2:3;for(let N=a.depth-w;N>=a.depth-3;N-=1)y=J.from(a.node(N).copy(y));const b=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,C={...wp(h,a.node().type.name,a.node().attrs),...t},S=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(C))||void 0;y=y.append(J.from(l.createAndFill(null,S)||void 0));const k=a.before(a.depth-(w-1));n.replace(k,a.after(-b),new ue(y,4-w,0));let E=-1;n.doc.nodesBetween(k,n.doc.content.size,(N,O)=>{if(E>-1)return!1;N.isTextblock&&N.content.size===0&&(E=O+1)}),E>-1&&n.setSelection(_e.near(n.doc.resolve(E))),n.scrollIntoView()}return!0}const f=u.pos===a.end()?d.contentMatchAt(0).defaultType:null,m={...wp(h,d.type.name,d.attrs),...t},g={...wp(h,a.node().type.name,a.node().attrs),...t};n.delete(a.pos,u.pos);const v=f?[{type:l,attrs:m},{type:f,attrs:g}]:[{type:l,attrs:m}];if(!Ei(n.doc,a.pos,2))return!1;if(s){const{selection:y,storedMarks:w}=r,{splittableMarks:b}=i.extensionManager,C=w||y.$to.parentOffset&&y.$from.marks();if(n.split(a.pos,2,v).scrollIntoView(),!C||!s)return!0;const S=C.filter(k=>b.includes(k.type.name));n.ensureMarks(S)}return!0},nv=(e,t)=>{const n=hy(o=>o.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=e.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&sl(e.doc,n.pos)&&e.join(n.pos),!0},rv=(e,t)=>{const n=hy(o=>o.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=e.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&sl(e.doc,r)&&e.join(r),!0},$X=(e,t,n,r={})=>({editor:s,tr:i,state:o,dispatch:l,chain:a,commands:u,can:c})=>{const{extensions:d,splittableMarks:h}=s.extensionManager,f=Bt(e,o.schema),m=Bt(t,o.schema),{selection:g,storedMarks:v}=o,{$from:y,$to:w}=g,b=y.blockRange(w),C=v||g.$to.parentOffset&&g.$from.marks();if(!b)return!1;const S=hy(k=>uR(k.type.name,d))(g);if(b.depth>=1&&S&&b.depth-S.depth<=1){if(S.node.type===f)return u.liftListItem(m);if(uR(S.node.type.name,d)&&f.validContent(S.node.content)&&l)return a().command(()=>(i.setNodeMarkup(S.pos,f),!0)).command(()=>nv(i,f)).command(()=>rv(i,f)).run()}return!n||!C||!l?a().command(()=>c().wrapInList(f,r)?!0:u.clearNodes()).wrapInList(f,r).command(()=>nv(i,f)).command(()=>rv(i,f)).run():a().command(()=>{const k=c().wrapInList(f,r),E=C.filter(N=>h.includes(N.type.name));return i.ensureMarks(E),k?!0:u.clearNodes()}).wrapInList(f,r).command(()=>nv(i,f)).command(()=>rv(i,f)).run()},zX=(e,t={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=Di(e,r.schema);return Hw(r,o,t)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,t)},FX=(e,t,n={})=>({state:r,commands:s})=>{const i=Bt(e,r.schema),o=Bt(t,r.schema),l=Ko(r,i,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?s.setNode(o,a):s.setNode(i,{...a,...n})},BX=(e,t={})=>({state:n,commands:r})=>{const s=Bt(e,n.schema);return Ko(n,s,t)?r.lift(s):r.wrapIn(s,t)},VX=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let i;if(s.spec.isInputRules&&(i=s.getState(e))){if(t){const o=e.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,e.schema.text(i.text,a))}else o.delete(i.from,i.to)}return!0}}return!1},HX=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:s}=n;return r||t&&s.forEach(i=>{e.removeMark(i.$from.pos,i.$to.pos)}),!0},UX=(e,t={})=>({tr:n,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=t,{selection:l}=n,a=Di(e,r.schema),{$from:u,empty:c,ranges:d}=l;if(!s)return!0;if(c&&o){let{from:h,to:f}=l;const m=(i=u.marks().find(v=>v.type===a))==null?void 0:i.attrs,g=$1(u,a,m);g&&(h=g.from,f=g.to),n.removeMark(h,f,a)}else d.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,a)});return n.removeStoredMark(a),!0},qX=e=>({tr:t,state:n,dispatch:r})=>{const{selection:s}=n;let i,o;return typeof e=="number"?(i=e,o=e):e&&"from"in e&&"to"in e?(i=e.from,o=e.to):(i=s.from,o=s.to),r&&t.doc.nodesBetween(i,o,(l,a)=>{if(l.isText)return;const u={...l.attrs};delete u.dir,t.setNodeMarkup(a,void 0,u)}),!0},WX=(e,t={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const l=fy(typeof e=="string"?e:e.name,r.schema);if(!l)return!1;l==="node"&&(i=Bt(e,r.schema)),l==="mark"&&(o=Di(e,r.schema));let a=!1;return n.selection.ranges.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;let h,f,m,g;n.selection.empty?r.doc.nodesBetween(c,d,(v,y)=>{i&&i===v.type&&(a=!0,m=Math.max(y,c),g=Math.min(y+v.nodeSize,d),h=y,f=v)}):r.doc.nodesBetween(c,d,(v,y)=>{y<c&&i&&i===v.type&&(a=!0,m=Math.max(y,c),g=Math.min(y+v.nodeSize,d),h=y,f=v),y>=c&&y<=d&&(i&&i===v.type&&(a=!0,s&&n.setNodeMarkup(y,void 0,{...v.attrs,...t})),o&&v.marks.length&&v.marks.forEach(w=>{if(o===w.type&&(a=!0,s)){const b=Math.max(y,c),C=Math.min(y+v.nodeSize,d);n.addMark(b,C,o.create({...w.attrs,...t}))}}))}),f&&(h!==void 0&&s&&n.setNodeMarkup(h,void 0,{...f.attrs,...t}),o&&f.marks.length&&f.marks.forEach(v=>{o===v.type&&s&&n.addMark(m,g,o.create({...v.attrs,...t}))}))}),a},KX=(e,t={})=>({state:n,dispatch:r})=>{const s=Bt(e,n.schema);return bJ(s,t)(n,r)},QX=(e,t={})=>({state:n,dispatch:r})=>{const s=Bt(e,n.schema);return kJ(s,t)(n,r)},GX=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(r=>r.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(r=>r!==t):delete this.callbacks[e]),this}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},gy=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=(t=e.undoable)!=null?t:!0}},JX=(e,t)=>{if(L1(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,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 Ph(e){var t;const{editor:n,from:r,to:s,text:i,rules:o,plugin:l}=e,{view:a}=n;if(a.composing)return!1;const u=a.state.doc.resolve(r);if(u.parent.type.spec.code||(t=u.nodeBefore||u.nodeAfter)!=null&&t.marks.find(h=>h.type.spec.code))return!1;let c=!1;const d=kX(u)+i;return o.forEach(h=>{if(c)return;const f=JX(d,h.find);if(!f)return;const m=a.state.tr,g=cy({state:a.state,transaction:m}),v={from:r-(f[0].length-i.length),to:s},{commands:y,chain:w,can:b}=new dy({editor:n,state:g});h.handler({state:g,range:v,match:f,commands:y,chain:w,can:b})===null||!m.steps.length||(h.undoable&&m.setMeta(l,{transform:m,from:r,to:s,text:i}),a.dispatch(m),c=!0)}),c}function ZX(e){const{editor:t,rules:n}=e,r=new bt({state:{init(){return null},apply(s,i,o){const l=s.getMeta(r);if(l)return l;const a=s.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:c}=a;typeof c=="string"?c=c:c=F1(J.from(c),o.schema);const{from:d}=a,h=d+c.length;Ph({editor:t,from:d,to:h,text:c,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,l){return Ph({editor:t,from:i,to:o,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&Ph({editor:t,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?Ph({editor:t,from:o.pos,to:o.pos,text:`
|
|
498
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function YX(e){return Object.prototype.toString.call(e).slice(8,-1)}function Ah(e){return YX(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function TL(e,t){const n={...e};return Ah(e)&&Ah(t)&&Object.keys(t).forEach(r=>{Ah(t[r])&&Ah(e[r])?n[r]=TL(e[r],t[r]):n[r]=t[r]}),n}var U1=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...ot(ke(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ot(ke(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>TL(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},fa=class RL extends U1{constructor(){super(...arguments),this.type="mark"}static create(t={}){const n=typeof t=="function"?t():t;return new RL(n)}static handleExit({editor:t,mark:n}){const{tr:r}=t.state,s=t.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(u=>(u==null?void 0:u.type.name)===n.name))return!1;const a=o.find(u=>(u==null?void 0:u.type.name)===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",s.pos),t.view.dispatch(r),!0}return!1}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}};function XX(e){return typeof e=="number"}var eee=class{constructor(e){this.find=e.find,this.handler=e.handler}},tee=(e,t,n)=>{if(L1(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=e,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function nee(e){const{editor:t,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:l}=e,{commands:a,chain:u,can:c}=new dy({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,s,(f,m)=>{var g,v,y,w,b;if((v=(g=f.type)==null?void 0:g.spec)!=null&&v.code||!(f.isText||f.isTextblock||f.isInline))return;const C=(b=(w=(y=f.content)==null?void 0:y.size)!=null?w:f.nodeSize)!=null?b:0,S=Math.max(r,m),k=Math.min(s,m+C);if(S>=k)return;const E=f.isText?f.text||"":f.textBetween(S-m,k-m,void 0,"");tee(E,i.find,o).forEach(O=>{if(O.index===void 0)return;const T=S+O.index+1,j=T+O[0].length,A={from:n.tr.mapping.map(T),to:n.tr.mapping.map(j)},z=i.handler({state:n,range:A,match:O,commands:a,chain:u,can:c,pasteEvent:o,dropEvent:l});d.push(z)})}),d.every(f=>f!==null)}var _h=null,ree=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData("text/html",e),n};function see(e){const{editor:t,rules:n}=e;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:c,from:d,to:h,rule:f,pasteEvt:m})=>{const g=c.tr,v=cy({state:c,transaction:g});if(!(!nee({editor:t,state:v,from:Math.max(d-1,0),to:h.b-1,rule:f,pasteEvent:m,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(c=>new bt({view(d){const h=m=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(m.target)?d.dom.parentElement:null,r&&(_h=t)},f=()=>{_h&&(_h=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(d,h)=>{if(i=r===d.dom.parentElement,l=h,!i){const f=_h;f!=null&&f.isEditable&&setTimeout(()=>{const m=f.state.selection;m&&f.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(d,h)=>{var f;const m=(f=h.clipboardData)==null?void 0:f.getData("text/html");return o=h,s=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(d,h,f)=>{const m=d[0],g=m.getMeta("uiEvent")==="paste"&&!s,v=m.getMeta("uiEvent")==="drop"&&!i,y=m.getMeta("applyPasteRules"),w=!!y;if(!g&&!v&&!w)return;if(w){let{text:S}=y;typeof S=="string"?S=S:S=F1(J.from(S),f.schema);const{from:k}=y,E=k+S.length,N=ree(S);return a({rule:c,state:f,from:k,to:{b:E},pasteEvt:N})}const b=h.doc.content.findDiffStart(f.doc.content),C=h.doc.content.findDiffEnd(f.doc.content);if(!(!XX(b)||!C||b===C.b))return a({rule:c,state:f,from:b,to:C,pasteEvt:o})}}))}var yy=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=B1(e),this.schema=xL(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:jh(t.name,this.schema)},r=ke(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){const{editor:e}=this;return Im([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:jh(r.name,this.schema)},i=[],o=ke(r,"addKeyboardShortcuts",s);let l={};if(r.type==="mark"&&ke(r,"exitable",s)&&(l.ArrowRight=()=>fa.handleExit({editor:e,mark:r})),o){const h=Object.fromEntries(Object.entries(o()).map(([f,m])=>[f,()=>m({editor:e})]));l={...l,...h}}const a=xY(l);i.push(a);const u=ke(r,"addInputRules",s);if(aR(r,e.options.enableInputRules)&&u){const h=u();if(h&&h.length){const f=ZX({editor:e,rules:h}),m=Array.isArray(f)?f:[f];i.push(...m)}}const c=ke(r,"addPasteRules",s);if(aR(r,e.options.enablePasteRules)&&c){const h=c();if(h&&h.length){const f=see({editor:e,rules:h});i.push(...f)}}const d=ke(r,"addProseMirrorPlugins",s);if(d){const h=d();i.push(...h)}return i})}get attributes(){return yL(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Gu(this.extensions);return Object.fromEntries(t.filter(n=>!!ke(n,"addNodeView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Bt(n.name,this.schema)},i=ke(n,"addNodeView",s);if(!i)return[];const o=i();if(!o)return[];const l=(a,u,c,d,h)=>{const f=lf(a,r);return o({node:a,view:u,getPos:c,decorations:d,innerDecorations:h,editor:e,extension:n,HTMLAttributes:f})};return[n.name,l]}))}dispatchTransaction(e){const{editor:t}=this;return Im([...this.extensions].reverse()).reduceRight((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:t,type:jh(s.name,this.schema)},o=ke(s,"dispatchTransaction",i);return o?l=>{o.call(i,{transaction:l,next:r})}:r},e)}get markViews(){const{editor:e}=this,{markExtensions:t}=Gu(this.extensions);return Object.fromEntries(t.filter(n=>!!ke(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Di(n.name,this.schema)},i=ke(n,"addMarkView",s);if(!i)return[];const o=(l,a,u)=>{const c=lf(l,r);return i()({mark:l,view:a,inline:u,editor:e,extension:n,HTMLAttributes:c,updateAttributes:d=>{xee(l,e,d)}})};return[n.name,o]}))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(t=>[t.name,t.storage])),e.forEach(t=>{var n;const r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:jh(t.name,this.schema)};t.type==="mark"&&((n=ot(ke(t,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(t.name);const s=ke(t,"onBeforeCreate",r),i=ke(t,"onCreate",r),o=ke(t,"onUpdate",r),l=ke(t,"onSelectionUpdate",r),a=ke(t,"onTransaction",r),u=ke(t,"onFocus",r),c=ke(t,"onBlur",r),d=ke(t,"onDestroy",r);s&&this.editor.on("beforeCreate",s),i&&this.editor.on("create",i),o&&this.editor.on("update",o),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),u&&this.editor.on("focus",u),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};yy.resolve=B1;yy.sort=Im;yy.flatten=py;var iee={};D1(iee,{ClipboardTextSerializer:()=>OL,Commands:()=>jL,Delete:()=>PL,Drop:()=>AL,Editable:()=>_L,FocusEvents:()=>DL,Keymap:()=>LL,Paste:()=>$L,Tabindex:()=>zL,TextDirection:()=>FL,focusEventsPluginKey:()=>IL});var Ct=class ML extends U1{constructor(){super(...arguments),this.type="extension"}static create(t={}){const n=typeof t=="function"?t():t;return new ML(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}},OL=Ct.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new bt({key:new St("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:s}=t,{ranges:i}=s,o=Math.min(...i.map(c=>c.$from.pos)),l=Math.max(...i.map(c=>c.$to.pos)),a=V1(n);return vL(r,{from:o,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),jL=Ct.create({name:"commands",addCommands(){return{...es}}}),PL=Ct.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,s;const i=()=>{var o,l,a,u;if((u=(a=(l=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,e))!=null?u:e.getMeta("y-sync$"))return;const c=mL(e.before,[e,...t]);kL(c).forEach(f=>{c.mapping.mapResult(f.oldRange.from).deletedAfter&&c.mapping.mapResult(f.oldRange.to).deletedBefore&&c.before.nodesBetween(f.oldRange.from,f.oldRange.to,(m,g)=>{const v=g+m.nodeSize-2,y=f.oldRange.from<=g&&v<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:v,newFrom:c.mapping.map(g),newTo:c.mapping.map(v),deletedRange:f.oldRange,newRange:f.newRange,partial:!y,editor:this.editor,transaction:e,combinedTransform:c})})});const h=c.mapping;c.steps.forEach((f,m)=>{var g,v;if(f instanceof fs){const y=h.slice(m).map(f.from,-1),w=h.slice(m).map(f.to),b=h.invert().map(y,-1),C=h.invert().map(w),S=(g=c.doc.nodeAt(y-1))==null?void 0:g.marks.some(E=>E.eq(f.mark)),k=(v=c.doc.nodeAt(w))==null?void 0:v.marks.some(E=>E.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:b,to:C},newRange:{from:y,to:w},partial:!!(k||S),editor:this.editor,transaction:e,combinedTransform:c})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),AL=Ct.create({name:"drop",addProseMirrorPlugins(){return[new bt({key:new St("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),_L=Ct.create({name:"editable",addProseMirrorPlugins(){return[new bt({key:new St("editable"),props:{editable:()=>this.editor.options.editable}})]}}),IL=new St("focusEvents"),DL=Ct.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new bt({key:IL,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),LL=Ct.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:u}=l,{empty:c,$anchor:d}=a,{pos:h,parent:f}=d,m=d.parent.isTextblock&&h>0?l.doc.resolve(h-1):d,g=m.parent.type.spec.isolating,v=d.pos-d.parentOffset,y=g&&m.parent.childCount===1?v===d.pos:Pe.atStart(u).from===h;return!c||!f.type.isTextblock||f.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return _m()||hL()?i:s},addProseMirrorPlugins(){return[new bt({key:new St("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(g=>g.getMeta("composition")))return;const r=e.some(g=>g.docChanged)&&!t.doc.eq(n.doc),s=e.some(g=>g.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:l}=t.selection,a=Pe.atStart(t.doc).from,u=Pe.atEnd(t.doc).to;if(i||!(o===a&&l===u)||!my(n.doc))return;const h=n.tr,f=cy({state:n,transaction:h}),{commands:m}=new dy({editor:this.editor,state:f});if(m.clearNodes(),!!h.steps.length)return h}})]}}),$L=Ct.create({name:"paste",addProseMirrorPlugins(){return[new bt({key:new St("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),zL=Ct.create({name:"tabindex",addProseMirrorPlugins(){return[new bt({key:new St("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),FL=Ct.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=Gu(this.extensions);return[{types:e.filter(t=>t.name!=="text").map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{const n=t.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return[new bt({key:new St("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),oee=class Qc{constructor(t,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,this.editor=n,this.currentNode=s}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 t;return(t=this.actualDepth)!=null?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){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},t)}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 t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new Qc(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new Qc(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new Qc(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,l=this.pos+r+(i?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!s&&!o&&a.depth<=this.depth)return;const u=new Qc(a,this.editor,s,s||o?n:null);s&&(u.actualDepth=this.depth+1),t.push(u)}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===t)if(Object.keys(n).length>0){const i=s.node.attrs,o=Object.keys(n);for(let l=0;l<o.length;l+=1){const a=o[l];if(i[a]!==n[a])break}}else r=s;s=s.parent}return r}querySelector(t,n={}){return this.querySelectorAll(t,n,!0)[0]||null}querySelectorAll(t,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(n);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===t&&i.every(a=>n[a]===o.node.attrs[a])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(t,n,r))))}),s}setAttribute(t){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}},lee=`.ProseMirror {
|
|
499
|
+
position: relative;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.ProseMirror {
|
|
503
|
+
word-wrap: break-word;
|
|
504
|
+
white-space: pre-wrap;
|
|
505
|
+
white-space: break-spaces;
|
|
506
|
+
-webkit-font-variant-ligatures: none;
|
|
507
|
+
font-variant-ligatures: none;
|
|
508
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.ProseMirror [contenteditable="false"] {
|
|
512
|
+
white-space: normal;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
516
|
+
white-space: pre-wrap;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.ProseMirror pre {
|
|
520
|
+
white-space: pre-wrap;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
img.ProseMirror-separator {
|
|
524
|
+
display: inline !important;
|
|
525
|
+
border: none !important;
|
|
526
|
+
margin: 0 !important;
|
|
527
|
+
width: 0 !important;
|
|
528
|
+
height: 0 !important;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.ProseMirror-gapcursor {
|
|
532
|
+
display: none;
|
|
533
|
+
pointer-events: none;
|
|
534
|
+
position: absolute;
|
|
535
|
+
margin: 0;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.ProseMirror-gapcursor:after {
|
|
539
|
+
content: "";
|
|
540
|
+
display: block;
|
|
541
|
+
position: absolute;
|
|
542
|
+
top: -2px;
|
|
543
|
+
width: 20px;
|
|
544
|
+
border-top: 1px solid black;
|
|
545
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
@keyframes ProseMirror-cursor-blink {
|
|
549
|
+
to {
|
|
550
|
+
visibility: hidden;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.ProseMirror-hideselection *::selection {
|
|
555
|
+
background: transparent;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
559
|
+
background: transparent;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.ProseMirror-hideselection * {
|
|
563
|
+
caret-color: transparent;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
567
|
+
display: block;
|
|
568
|
+
}`;function aee(e,t,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return t&&s.setAttribute("nonce",t),s.setAttribute("data-tiptap-style",""),s.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(s),s}var uee=class extends GX{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!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:NX,createMappablePosition:TX},this.setOptions(e),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:s,moved:i})=>this.options.onDrop(r,s,i)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=dL(t,this.options.autofocus);this.editorState=Za.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){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(e),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 e=this.editorView.dom;e!=null&&e.editor&&delete e.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(e){console.warn("Failed to remove CSS element:",e)}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=aee(lee,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&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:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const n=gL(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(i))}),t.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;const r=[...this.options.enableCoreExtensions?[_L,OL.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),jL,DL,LL,zL,AL,$L,PL,FL.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new yy(r,this)}createCommandManager(){this.commandManager=new dy({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Vw(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,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()}}),e=Vw(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r;this.editorView=new uL(e,{...t,attributes:{role:"textbox",...t==null?void 0:t.attributes},dispatchTransaction:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.prependClass(),this.injectCSS();const o=this.view.dom;o.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(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var c;return(c=this.capturedTransaction)==null?void 0:c.step(u)});return}const{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),s=n.includes(e),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!s)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const o=n.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),l=o==null?void 0:o.getMeta("focus"),a=o==null?void 0:o.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:o}),a&&this.emit("blur",{editor:this,event:a.event,transaction:o}),!(e.getMeta("preventUpdate")||!n.some(u=>u.docChanged)||i.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return bL(this.state,e)}isActive(e,t){const n=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return SX(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return F1(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
|
|
569
|
+
|
|
570
|
+
`,textSerializers:n={}}=e||{};return wL(this.state.doc,{blockSeparator:t,textSerializers:{...V1(this.schema),...n}})}get isEmpty(){return my(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new oee(t,this)}get $doc(){return this.$pos(0)}};function Ju(e){return new gy({find:e.find,handler:({state:t,range:n,match:r})=>{const s=ot(e.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=t,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),u=n.from+l.indexOf(o),c=u+o.length;if(H1(n.from,n.to,t.doc).filter(f=>f.mark.type.excluded.find(g=>g===e.type&&g!==f.mark.type)).filter(f=>f.to>u).length)return null;c<n.to&&i.delete(c,n.to),u>n.from&&i.delete(n.from+a,u);const h=n.from+a+o.length;i.addMark(n.from+a,h,e.type.create(s||{})),i.removeStoredMark(e.type)}},undoable:e.undoable})}function cee(e){return new gy({find:e.find,handler:({state:t,range:n,match:r})=>{const s=ot(e.getAttributes,void 0,r)||{},{tr:i}=t,o=n.from;let l=n.to;const a=e.type.create(s);if(r[1]){const u=r[0].lastIndexOf(r[1]);let c=o+u;c>l?c=l:l=c+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,o+r[0].length-1),i.replaceWith(c,l,a)}else if(r[0]){const u=e.type.isInline?o:o-1;i.insert(u,e.type.create(s)).delete(i.mapping.map(o),i.mapping.map(l))}i.scrollIntoView()},undoable:e.undoable})}function Uw(e){return new gy({find:e.find,handler:({state:t,range:n,match:r})=>{const s=t.doc.resolve(n.from),i=ot(e.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)},undoable:e.undoable})}function Zu(e){return new gy({find:e.find,handler:({state:t,range:n,match:r,chain:s})=>{const i=ot(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),a=o.doc.resolve(n.from).blockRange(),u=a&&v1(a,e.type,i);if(!u)return null;if(o.wrap(a,u),e.keepMarks&&e.editor){const{selection:d,storedMarks:h}=t,{splittableMarks:f}=e.editor.extensionManager,m=h||d.$to.parentOffset&&d.$from.marks();if(m){const g=m.filter(v=>f.includes(v.type.name));o.ensureMarks(g)}}if(e.keepAttributes){const d=e.type.name==="bulletList"||e.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(d,i).run()}const c=o.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&sl(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&o.join(n.from-1)},undoable:e.undoable})}function dee(e,t){const{selection:n}=e,{$from:r}=n;if(n instanceof Te){const i=r.index();return r.parent.canReplaceWith(i,i+1,t)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(t))return!0;s-=1}return!1}var fee={};D1(fee,{createAtomBlockMarkdownSpec:()=>hee,createBlockMarkdownSpec:()=>pee,createInlineMarkdownSpec:()=>yee,parseAttributes:()=>q1,parseIndentedBlocks:()=>qw,renderNestedMarkdownContent:()=>K1,serializeAttributes:()=>W1});function q1(e){if(!(e!=null&&e.trim()))return{};const t={},n=[],r=e.replace(/["']([^"']*)["']/g,u=>(n.push(u),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const u=s.map(c=>c.trim().slice(1));t.class=u.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(t.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,u,c])=>{var d;const h=parseInt(((d=c.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),f=n[h];f&&(t[u]=f.slice(1,-1))});const a=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 a&&a.split(/\s+/).filter(Boolean).forEach(c=>{c.match(/^[a-zA-Z][\w-]*$/)&&(t[c]=!0)}),t}function W1(e){if(!e||Object.keys(e).length===0)return"";const t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(r=>t.push(`.${r}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?t.push(n):r!==!1&&r!=null&&t.push(`${n}="${String(r)}"`))}),t.join(" ")}function hee(e){const{nodeName:t,name:n,parseAttributes:r=q1,serializeAttributes:s=W1,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:l}=e,a=n||t,u=c=>{if(!l)return c;const d={};return l.forEach(h=>{h in c&&(d[h]=c[h])}),d};return{parseMarkdown:(c,d)=>{const h={...i,...c.attributes};return d.createNode(t,h,[])},markdownTokenizer:{name:t,level:"block",start(c){var d;const h=new RegExp(`^:::${a}(?:\\s|$)`,"m"),f=(d=c.match(h))==null?void 0:d.index;return f!==void 0?f:-1},tokenize(c,d,h){const f=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=c.match(f);if(!m)return;const g=m[1]||"",v=r(g);if(!o.find(w=>!(w in v)))return{type:t,raw:m[0],attributes:v}}},renderMarkdown:c=>{const d=u(c.attrs||{}),h=s(d),f=h?` {${h}}`:"";return`:::${a}${f} :::`}}}function pee(e){const{nodeName:t,name:n,getContent:r,parseAttributes:s=q1,serializeAttributes:i=W1,defaultAttributes:o={},content:l="block",allowedAttributes:a}=e,u=n||t,c=d=>{if(!a)return d;const h={};return a.forEach(f=>{f in d&&(h[f]=d[f])}),h};return{parseMarkdown:(d,h)=>{let f;if(r){const g=r(d);f=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?f=h.parseChildren(d.tokens||[]):f=h.parseInline(d.tokens||[]);const m={...o,...d.attributes};return h.createNode(t,m,f)},markdownTokenizer:{name:t,level:"block",start(d){var h;const f=new RegExp(`^:::${u}`,"m"),m=(h=d.match(f))==null?void 0:h.index;return m!==void 0?m:-1},tokenize(d,h,f){var m;const g=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=d.match(g);if(!v)return;const[y,w=""]=v,b=s(w);let C=1;const S=y.length;let k="";const E=/^:::([\w-]*)(\s.*)?/gm,N=d.slice(S);for(E.lastIndex=0;;){const O=E.exec(N);if(O===null)break;const T=O.index,j=O[1];if(!((m=O[2])!=null&&m.endsWith(":::"))){if(j)C+=1;else if(C-=1,C===0){const A=N.slice(0,T);k=A.trim();const z=d.slice(0,S+T+O[0].length);let D=[];if(k)if(l==="block")for(D=f.blockTokens(A),D.forEach(L=>{L.text&&(!L.tokens||L.tokens.length===0)&&(L.tokens=f.inlineTokens(L.text))});D.length>0;){const L=D[D.length-1];if(L.type==="paragraph"&&(!L.text||L.text.trim()===""))D.pop();else break}else D=f.inlineTokens(k);return{type:t,raw:z,attributes:b,content:k,tokens:D}}}}}},renderMarkdown:(d,h)=>{const f=c(d.attrs||{}),m=i(f),g=m?` {${m}}`:"",v=h.renderChildren(d.content||[],`
|
|
571
|
+
|
|
572
|
+
`);return`:::${u}${g}
|
|
573
|
+
|
|
574
|
+
${v}
|
|
575
|
+
|
|
576
|
+
:::`}}}function mee(e){if(!e.trim())return{};const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(e);for(;r!==null;){const[,s,i,o]=r;t[s]=i||o,r=n.exec(e)}return t}function gee(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t}="${n}"`).join(" ")}function yee(e){const{nodeName:t,name:n,getContent:r,parseAttributes:s=mee,serializeAttributes:i=gee,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:a}=e,u=n||t,c=h=>{if(!a)return h;const f={};return a.forEach(m=>{const g=typeof m=="string"?m:m.name,v=typeof m=="string"?void 0:m.skipIfDefault;if(g in h){const y=h[g];if(v!==void 0&&y===v)return;f[g]=y}}),f},d=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,f)=>{const m={...o,...h.attributes};if(l)return f.createNode(t,m);const g=r?r(h):h.content||"";return g?f.createNode(t,m,[f.createTextNode(g)]):f.createNode(t,m,[])},markdownTokenizer:{name:t,level:"inline",start(h){const f=l?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),m=h.match(f),g=m==null?void 0:m.index;return g!==void 0?g:-1},tokenize(h,f,m){const g=l?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),v=h.match(g);if(!v)return;let y="",w="";if(l){const[,C]=v;w=C}else{const[,C,S]=v;w=C,y=S||""}const b=s(w.trim());return{type:t,raw:v[0],content:y.trim(),attributes:b}}},renderMarkdown:h=>{let f="";r?f=r(h):h.content&&h.content.length>0&&(f=h.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const m=c(h.attrs||{}),g=i(m),v=g?` ${g}`:"";return l?`[${u}${v}]`:`[${u}${v}]${f}[/${u}]`}}}function qw(e,t,n){var r,s,i,o;const l=e.split(`
|
|
577
|
+
`),a=[];let u="",c=0;const d=t.baseIndentSize||2;for(;c<l.length;){const h=l[c],f=h.match(t.itemPattern);if(!f){if(a.length>0)break;if(h.trim()===""){c+=1,u=`${u}${h}
|
|
578
|
+
`;continue}else return}const m=t.extractItemData(f),{indentLevel:g,mainContent:v}=m;u=`${u}${h}
|
|
579
|
+
`;const y=[v];for(c+=1;c<l.length;){const S=l[c];if(S.trim()===""){const E=l.slice(c+1).findIndex(T=>T.trim()!=="");if(E===-1)break;if((((s=(r=l[c+1+E].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>g){y.push(S),u=`${u}${S}
|
|
580
|
+
`,c+=1;continue}else break}if((((o=(i=S.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>g)y.push(S),u=`${u}${S}
|
|
581
|
+
`,c+=1;else break}let w;const b=y.slice(1);if(b.length>0){const S=b.map(k=>k.slice(g+d)).join(`
|
|
582
|
+
`);S.trim()&&(t.customNestedParser?w=t.customNestedParser(S):w=n.blockTokens(S))}const C=t.createToken(m,w);a.push(C)}if(a.length!==0)return{items:a,raw:u}}function K1(e,t,n,r){if(!e||!Array.isArray(e.content))return"";const s=typeof n=="function"?n(r):n,[i,...o]=e.content,l=t.renderChildren([i]),a=[`${s}${l}`];return o&&o.length>0&&o.forEach(u=>{const c=t.renderChildren([u]);if(c){const d=c.split(`
|
|
583
|
+
`).map(h=>h?t.indent(h):"").join(`
|
|
584
|
+
`);a.push(d)}}),a.join(`
|
|
585
|
+
`)}function xee(e,t,n={}){const{state:r}=t,{doc:s,tr:i}=r,o=e;s.descendants((l,a)=>{const u=i.mapping.map(a),c=i.mapping.map(a)+l.nodeSize;let d=null;if(l.marks.forEach(f=>{if(f!==o)return!1;d=f}),!d)return;let h=!1;if(Object.keys(n).forEach(f=>{n[f]!==d.attrs[f]&&(h=!0)}),h){const f=e.type.create({...e.attrs,...n});i.removeMark(u,c,e.type),i.addMark(u,c,f)}}),i.docChanged&&t.view.dispatch(i)}var Rr=class BL extends U1{constructor(){super(...arguments),this.type="node"}static create(t={}){const n=typeof t=="function"?t():t;return new BL(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}};function na(e){return new eee({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:s})=>{const i=ot(e.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=t,l=r[r.length-1],a=r[0];let u=n.to;if(l){const c=a.search(/\S/),d=n.from+a.indexOf(l),h=d+l.length;if(H1(n.from,n.to,t.doc).filter(m=>m.mark.type.excluded.find(v=>v===e.type&&v!==m.mark.type)).filter(m=>m.to>d).length)return null;h<n.to&&o.delete(h,n.to),d>n.from&&o.delete(n.from+c,d),u=n.from+c+l.length,o.addMark(n.from+c,u,e.type.create(i||{})),o.removeStoredMark(e.type)}}})}const{getOwnPropertyNames:vee,getOwnPropertySymbols:wee}=Object,{hasOwnProperty:bee}=Object.prototype;function sv(e,t){return function(r,s,i){return e(r,s,i)&&t(r,s,i)}}function Ih(e){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return e(n,r,s);const{cache:i}=s,o=i.get(n),l=i.get(r);if(o&&l)return o===r&&l===n;i.set(n,r),i.set(r,n);const a=e(n,r,s);return i.delete(n),i.delete(r),a}}function kee(e){return e!=null?e[Symbol.toStringTag]:void 0}function dR(e){return vee(e).concat(wee(e))}const See=Object.hasOwn||((e,t)=>bee.call(e,t));function ha(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const Cee="__v",Eee="__o",Nee="_owner",{getOwnPropertyDescriptor:fR,keys:hR}=Object;function Tee(e,t){return e.byteLength===t.byteLength&&Dm(new Uint8Array(e),new Uint8Array(t))}function Ree(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Mee(e,t){return e.byteLength===t.byteLength&&Dm(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Oee(e,t){return ha(e.getTime(),t.getTime())}function jee(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Pee(e,t){return e===t}function pR(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const s=new Array(r),i=e.entries();let o,l,a=0;for(;(o=i.next())&&!o.done;){const u=t.entries();let c=!1,d=0;for(;(l=u.next())&&!l.done;){if(s[d]){d++;continue}const h=o.value,f=l.value;if(n.equals(h[0],f[0],a,d,e,t,n)&&n.equals(h[1],f[1],h[0],f[0],e,t,n)){c=s[d]=!0;break}d++}if(!c)return!1;a++}return!0}const Aee=ha;function _ee(e,t,n){const r=hR(e);let s=r.length;if(hR(t).length!==s)return!1;for(;s-- >0;)if(!VL(e,t,n,r[s]))return!1;return!0}function Oc(e,t,n){const r=dR(e);let s=r.length;if(dR(t).length!==s)return!1;let i,o,l;for(;s-- >0;)if(i=r[s],!VL(e,t,n,i)||(o=fR(e,i),l=fR(t,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function Iee(e,t){return ha(e.valueOf(),t.valueOf())}function Dee(e,t){return e.source===t.source&&e.flags===t.flags}function mR(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const s=new Array(r),i=e.values();let o,l;for(;(o=i.next())&&!o.done;){const a=t.values();let u=!1,c=0;for(;(l=a.next())&&!l.done;){if(!s[c]&&n.equals(o.value,l.value,o.value,l.value,e,t,n)){u=s[c]=!0;break}c++}if(!u)return!1}return!0}function Dm(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Lee(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function VL(e,t,n,r){return(r===Nee||r===Eee||r===Cee)&&(e.$$typeof||t.$$typeof)?!0:See(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const $ee="[object ArrayBuffer]",zee="[object Arguments]",Fee="[object Boolean]",Bee="[object DataView]",Vee="[object Date]",Hee="[object Error]",Uee="[object Map]",qee="[object Number]",Wee="[object Object]",Kee="[object RegExp]",Qee="[object Set]",Gee="[object String]",Jee={"[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},Zee="[object URL]",Yee=Object.prototype.toString;function Xee({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:u,areRegExpsEqual:c,areSetsEqual:d,areTypedArraysEqual:h,areUrlsEqual:f,unknownTagComparators:m}){return function(v,y,w){if(v===y)return!0;if(v==null||y==null)return!1;const b=typeof v;if(b!==typeof y)return!1;if(b!=="object")return b==="number"?l(v,y,w):b==="function"?i(v,y,w):!1;const C=v.constructor;if(C!==y.constructor)return!1;if(C===Object)return a(v,y,w);if(Array.isArray(v))return t(v,y,w);if(C===Date)return r(v,y,w);if(C===RegExp)return c(v,y,w);if(C===Map)return o(v,y,w);if(C===Set)return d(v,y,w);const S=Yee.call(v);if(S===Vee)return r(v,y,w);if(S===Kee)return c(v,y,w);if(S===Uee)return o(v,y,w);if(S===Qee)return d(v,y,w);if(S===Wee)return typeof v.then!="function"&&typeof y.then!="function"&&a(v,y,w);if(S===Zee)return f(v,y,w);if(S===Hee)return s(v,y,w);if(S===zee)return a(v,y,w);if(Jee[S])return h(v,y,w);if(S===$ee)return e(v,y,w);if(S===Bee)return n(v,y,w);if(S===Fee||S===qee||S===Gee)return u(v,y,w);if(m){let k=m[S];if(!k){const E=kee(v);E&&(k=m[E])}if(k)return k(v,y,w)}return!1}}function ete({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Tee,areArraysEqual:n?Oc:Ree,areDataViewsEqual:Mee,areDatesEqual:Oee,areErrorsEqual:jee,areFunctionsEqual:Pee,areMapsEqual:n?sv(pR,Oc):pR,areNumbersEqual:Aee,areObjectsEqual:n?Oc:_ee,arePrimitiveWrappersEqual:Iee,areRegExpsEqual:Dee,areSetsEqual:n?sv(mR,Oc):mR,areTypedArraysEqual:n?sv(Dm,Oc):Dm,areUrlsEqual:Lee,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const s=Ih(r.areArraysEqual),i=Ih(r.areMapsEqual),o=Ih(r.areObjectsEqual),l=Ih(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:l})}return r}function tte(e){return function(t,n,r,s,i,o,l){return e(t,n,l)}}function nte({circular:e,comparator:t,createState:n,equals:r,strict:s}){if(n)return function(l,a){const{cache:u=e?new WeakMap:void 0,meta:c}=n();return t(l,a,{cache:u,equals:r,meta:c,strict:s})};if(e)return function(l,a){return t(l,a,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(l,a){return t(l,a,i)}}const rte=ol();ol({strict:!0});ol({circular:!0});ol({circular:!0,strict:!0});ol({createInternalComparator:()=>ha});ol({strict:!0,createInternalComparator:()=>ha});ol({circular:!0,createInternalComparator:()=>ha});ol({circular:!0,createInternalComparator:()=>ha,strict:!0});function ol(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:s=!1}=e,i=ete(e),o=Xee(i),l=n?n(o):tte(o);return nte({circular:t,comparator:o,createState:r,equals:l,strict:s})}var HL={exports:{}},UL={};/**
|
|
586
|
+
* @license React
|
|
587
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
588
|
+
*
|
|
589
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
590
|
+
*
|
|
591
|
+
* This source code is licensed under the MIT license found in the
|
|
592
|
+
* LICENSE file in the root directory of this source tree.
|
|
593
|
+
*/var xy=x,ste=g1;function ite(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ote=typeof Object.is=="function"?Object.is:ite,lte=ste.useSyncExternalStore,ate=xy.useRef,ute=xy.useEffect,cte=xy.useMemo,dte=xy.useDebugValue;UL.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=ate(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=cte(function(){function a(f){if(!u){if(u=!0,c=f,f=r(f),s!==void 0&&o.hasValue){var m=o.value;if(s(m,f))return d=m}return d=f}if(m=d,ote(c,f))return m;var g=r(f);return s!==void 0&&s(m,g)?(c=f,m):(c=f,d=g)}var u=!1,c,d,h=n===void 0?null:n;return[function(){return a(t())},h===null?void 0:function(){return a(h())}]},[t,n,r,s]);var l=lte(e,i[0],i[1]);return ute(function(){o.hasValue=!0,o.value=l},[l]),dte(l),l};HL.exports=UL;var fte=HL.exports;let Ww,Kw;if(typeof WeakMap<"u"){let e=new WeakMap;Ww=t=>e.get(t),Kw=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;Ww=r=>{for(let s=0;s<e.length;s+=2)if(e[s]==r)return e[s+1]},Kw=(r,s)=>(n==10&&(n=0),e[n++]=r,e[n++]=s)}var fi=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,s=t/this.width|0;let i=r+1,o=s+1;for(let l=1;i<this.width&&this.map[t+l]==n;l++)i++;for(let l=1;o<this.height&&this.map[t+this.width*l]==n;l++)o++;return{left:r,top:s,right:i,bottom:o}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:s,top:i,bottom:o}=this.findCell(e);return t=="horiz"?(n<0?r==0:s==this.width)?null:this.map[i*this.width+(n<0?r-1:s)]:(n<0?i==0:o==this.height)?null:this.map[r+this.width*(n<0?i-1:o)]}rectBetween(e,t){const{left:n,right:r,top:s,bottom:i}=this.findCell(e),{left:o,right:l,top:a,bottom:u}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(s,a),right:Math.max(r,l),bottom:Math.max(i,u)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let s=e.left;s<e.right;s++){const i=r*this.width+s,o=this.map[i];n[o]||(n[o]=!0,!(s==e.left&&s&&this.map[i-1]==o||r==e.top&&r&&this.map[i-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,s=0;;r++){const i=s+n.child(r).nodeSize;if(r==e){let o=t+e*this.width;const l=(e+1)*this.width;for(;o<l&&this.map[o]<s;)o++;return o==l?i-1:this.map[o]}s=i}}static get(e){return Ww(e)||Kw(e,hte(e))}};function hte(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=pte(e),n=e.childCount,r=[];let s=0,i=null;const o=[];for(let u=0,c=t*n;u<c;u++)r[u]=0;for(let u=0,c=0;u<n;u++){const d=e.child(u);c++;for(let m=0;;m++){for(;s<r.length&&r[s]!=0;)s++;if(m==d.childCount)break;const g=d.child(m),{colspan:v,rowspan:y,colwidth:w}=g.attrs;for(let b=0;b<y;b++){if(b+u>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:c,n:y-b});break}const C=s+b*t;for(let S=0;S<v;S++){r[C+S]==0?r[C+S]=c:(i||(i=[])).push({type:"collision",row:u,pos:c,n:v-S});const k=w&&w[S];if(k){const E=(C+S)%t*2,N=o[E];N==null||N!=k&&o[E+1]==1?(o[E]=k,o[E+1]=1):N==k&&o[E+1]++}}}s+=v,c+=g.nodeSize}const h=(u+1)*t;let f=0;for(;s<h;)r[s++]==0&&f++;f&&(i||(i=[])).push({type:"missing",row:u,n:f}),c++}(t===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new fi(t,n,r,i);let a=!1;for(let u=0;!a&&u<o.length;u+=2)o[u]!=null&&o[u+1]<n&&(a=!0);return a&&mte(l,o,e),l}function pte(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const s=e.child(r);let i=0;if(n)for(let o=0;o<r;o++){const l=e.child(o);for(let a=0;a<l.childCount;a++){const u=l.child(a);o+u.attrs.rowspan>r&&(i+=u.attrs.colspan)}}for(let o=0;o<s.childCount;o++){const l=s.child(o);i+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}t==-1?t=i:t!=i&&(t=Math.max(t,i))}return t}function mte(e,t,n){e.problems||(e.problems=[]);const r={};for(let s=0;s<e.map.length;s++){const i=e.map[s];if(r[i])continue;r[i]=!0;const o=n.nodeAt(i);if(!o)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=o.attrs;for(let u=0;u<a.colspan;u++){const c=t[(s+u)%e.width*2];c!=null&&(!a.colwidth||a.colwidth[u]!=c)&&((l||(l=gte(a)))[u]=c)}l&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function gte(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function Q1(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],s=r.spec.tableRole;s&&(t[s]=r)}}return t}new St("selectingCells");function yte(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function qL(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function xte(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const n=yte(t.$head)||vte(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function vte(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if(r=="cell"||r=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if(r=="cell"||r=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function gR(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function WL(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function KL(e,t,n){const r=e.node(-1),s=fi.get(r),i=e.start(-1),o=s.nextCell(e.pos-i,t,n);return o==null?null:e.node(0).resolve(i+o)}function yR(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(s=>s>0)||(r.colwidth=null)),r}var Us=class si extends Pe{constructor(t,n=t){const r=t.node(-1),s=fi.get(r),i=t.start(-1),o=s.rectBetween(t.pos-i,n.pos-i),l=t.node(0),a=s.cellsInRect(o).filter(c=>c!=n.pos-i);a.unshift(n.pos-i);const u=a.map(c=>{const d=r.nodeAt(c);if(!d)throw new RangeError(`No cell with offset ${c} found`);const h=i+c+1;return new pD(l.resolve(h),l.resolve(h+d.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=t,this.$headCell=n}map(t,n){const r=t.resolve(n.map(this.$anchorCell.pos)),s=t.resolve(n.map(this.$headCell.pos));if(gR(r)&&gR(s)&&WL(r,s)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?si.rowSelection(r,s):i&&this.isColSelection()?si.colSelection(r,s):new si(r,s)}return _e.between(r,s)}content(){const t=this.$anchorCell.node(-1),n=fi.get(t),r=this.$anchorCell.start(-1),s=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let a=s.top;a<s.bottom;a++){const u=[];for(let c=a*n.width+s.left,d=s.left;d<s.right;d++,c++){const h=n.map[c];if(i[h])continue;i[h]=!0;const f=n.findCell(h);let m=t.nodeAt(h);if(!m)throw new RangeError(`No cell with offset ${h} found`);const g=s.left-f.left,v=f.right-s.right;if(g>0||v>0){let y=m.attrs;if(g>0&&(y=yR(y,0,g)),v>0&&(y=yR(y,y.colspan-v,v)),f.left<s.left){if(m=m.type.createAndFill(y),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else m=m.type.create(y,m.content)}if(f.top<s.top||f.bottom>s.bottom){const y={...m.attrs,rowspan:Math.min(f.bottom,s.bottom)-Math.max(f.top,s.top)};f.top<s.top?m=m.type.createAndFill(y):m=m.type.create(y,m.content)}u.push(m)}o.push(t.child(a).copy(J.from(u)))}const l=this.isColSelection()&&this.isRowSelection()?t:o;return new ue(J.from(l),1,1)}replace(t,n=ue.empty){const r=t.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){const{$from:l,$to:a}=s[o],u=t.mapping.slice(r);t.replace(u.map(l.pos),u.map(a.pos),o?ue.empty:n)}const i=Pe.findFrom(t.doc.resolve(t.mapping.slice(r).map(this.to)),-1);i&&t.setSelection(i)}replaceWith(t,n){this.replace(t,new ue(J.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),r=fi.get(n),s=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let o=0;o<i.length;o++)t(n.nodeAt(i[o]),s+i[o])}isColSelection(){const t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;const r=t+this.$anchorCell.nodeAfter.attrs.rowspan,s=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const r=t.node(-1),s=fi.get(r),i=t.start(-1),o=s.findCell(t.pos-i),l=s.findCell(n.pos-i),a=t.node(0);return o.top<=l.top?(o.top>0&&(t=a.resolve(i+s.map[o.left])),l.bottom<s.height&&(n=a.resolve(i+s.map[s.width*(s.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(i+s.map[l.left])),o.bottom<s.height&&(t=a.resolve(i+s.map[s.width*(s.height-1)+o.right-1]))),new si(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=fi.get(t),r=this.$anchorCell.start(-1),s=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(s,i)>0)return!1;const o=s+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==n.width}eq(t){return t instanceof si&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const r=t.node(-1),s=fi.get(r),i=t.start(-1),o=s.findCell(t.pos-i),l=s.findCell(n.pos-i),a=t.node(0);return o.left<=l.left?(o.left>0&&(t=a.resolve(i+s.map[o.top*s.width])),l.right<s.width&&(n=a.resolve(i+s.map[s.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(i+s.map[l.top*s.width])),o.right<s.width&&(t=a.resolve(i+s.map[s.width*(o.top+1)-1]))),new si(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new si(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new si(t.resolve(n),t.resolve(r))}getBookmark(){return new wte(this.$anchorCell.pos,this.$headCell.pos)}};Us.prototype.visible=!1;Pe.jsonID("cell",Us);var wte=class QL{constructor(t,n){this.anchor=t,this.head=n}map(t){return new QL(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),r=t.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&WL(n,r)?new Us(n,r):Pe.near(r,1)}};new St("fix-tables");function GL(e){const t=e.selection,n=xte(e),r=n.node(-1),s=n.start(-1),i=fi.get(r);return{...t instanceof Us?i.rectBetween(t.$anchorCell.pos-s,t.$headCell.pos-s):i.findCell(n.pos-s),tableStart:s,map:i,table:r}}function bte(e){return function(t,n){if(!qL(t))return!1;if(n){const r=Q1(t.schema),s=GL(t),i=t.tr,o=s.map.cellsInRect(e=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:e=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),l=o.map(a=>s.table.nodeAt(a));for(let a=0;a<o.length;a++)l[a].type==r.header_cell&&i.setNodeMarkup(s.tableStart+o[a],r.cell,l[a].attrs);if(i.steps.length===0)for(let a=0;a<o.length;a++)i.setNodeMarkup(s.tableStart+o[a],r.header_cell,l[a].attrs);n(i)}return!0}}function xR(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let s=0;s<r.length;s++){const i=t.table.nodeAt(r[s]);if(i&&i.type!==n.header_cell)return!1}return!0}function G1(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?bte(e):function(n,r){if(!qL(n))return!1;if(r){const s=Q1(n.schema),i=GL(n),o=n.tr,l=xR("row",i,s),a=xR("column",i,s),u=(e==="column"?l:e==="row"&&a)?1:0,c=e=="column"?{left:0,top:u,right:1,bottom:i.map.height}:e=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,d=e=="column"?a?s.cell:s.header_cell:e=="row"?l?s.cell:s.header_cell:s.cell;i.map.cellsInRect(c).forEach(h=>{const f=h+i.tableStart,m=o.doc.nodeAt(f);m&&o.setNodeMarkup(f,d,m.attrs)}),r(o)}return!0}}G1("row",{useDeprecatedLogic:!0});G1("column",{useDeprecatedLogic:!0});G1("cell",{useDeprecatedLogic:!0});function Dh(e,t){const n=e.selection;if(!(n instanceof Us))return!1;if(t){const r=e.tr,s=Q1(e.schema).cell.createAndFill().content;n.forEachCell((i,o)=>{i.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new ue(s,0,0))}),r.docChanged&&t(r)}return!0}I1({ArrowLeft:Lh("horiz",-1),ArrowRight:Lh("horiz",1),ArrowUp:Lh("vert",-1),ArrowDown:Lh("vert",1),"Shift-ArrowLeft":$h("horiz",-1),"Shift-ArrowRight":$h("horiz",1),"Shift-ArrowUp":$h("vert",-1),"Shift-ArrowDown":$h("vert",1),Backspace:Dh,"Mod-Backspace":Dh,Delete:Dh,"Mod-Delete":Dh});function bp(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Lh(e,t){return(n,r,s)=>{if(!s)return!1;const i=n.selection;if(i instanceof Us)return bp(n,r,Pe.near(i.$headCell,t));if(e!="horiz"&&!i.empty)return!1;const o=JL(s,e,t);if(o==null)return!1;if(e=="horiz")return bp(n,r,Pe.near(n.doc.resolve(i.head+t),t));{const l=n.doc.resolve(o),a=KL(l,e,t);let u;return a?u=Pe.near(a,1):t<0?u=Pe.near(n.doc.resolve(l.before(-1)),-1):u=Pe.near(n.doc.resolve(l.after(-1)),1),bp(n,r,u)}}}function $h(e,t){return(n,r,s)=>{if(!s)return!1;const i=n.selection;let o;if(i instanceof Us)o=i;else{const a=JL(s,e,t);if(a==null)return!1;o=new Us(n.doc.resolve(a))}const l=KL(o.$headCell,e,t);return l?bp(n,r,new Us(o.$anchorCell,l)):!1}}function JL(e,t,n){if(!(e.state.selection instanceof _e))return null;const{$head:r}=e.state.selection;for(let s=r.depth-1;s>=0;s--){const i=r.node(s);if((n<0?r.index(s):r.indexAfter(s))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const o=r.before(s),l=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(l)?o:null}}return null}new St("tableColumnResizing");function kte(e,t){const n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),s=Math.min(e.left,t.left),o=Math.max(e.right,t.right)-s,l=r-n,a=s,u=n;return new DOMRect(a,u,o,l)}var Ste=class{constructor({editor:e,element:t,view:n,updateDelay:r=250,resizeDelay:s=60,shouldShow:i,appendTo:o,getReferencedVirtualElement:l,options:a}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:c,state:d,from:h,to:f})=>{const{doc:m,selection:g}=d,{empty:v}=g,y=!m.textBetween(h,f).length&&z1(d.selection),w=this.element.contains(document.activeElement);return!(!(c.hasFocus()||w)||v||y||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:c})=>{var d;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}c!=null&&c.relatedTarget&&((d=this.element.parentNode)!=null&&d.contains(c.relatedTarget))||(c==null?void 0:c.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(c,d)=>{const h=!(d!=null&&d.selection.eq(c.state.selection)),f=!(d!=null&&d.doc.eq(c.state.doc));!h&&!f||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(c,h,f,d)},this.updateDelay))},this.updateHandler=(c,d,h,f)=>{const{composing:m}=c;if(m||!d&&!h)return;if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:c})=>{const d=c.getMeta("bubbleMenu");d==="updatePosition"?this.updatePosition():d&&typeof d=="object"&&d.type==="updateOptions"&&this.updateOptions(d.options)};var u;this.editor=e,this.element=t,this.view=n,this.updateDelay=r,this.resizeDelay=s,this.appendTo=o,this.scrollTarget=(u=a==null?void 0:a.scrollTarget)!=null?u:window,this.getReferencedVirtualElement=l,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,i&&(this.shouldShow=i),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(s1(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(r1(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(n1(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(hm(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(i1(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(q2(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(o1(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(W2(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,t,n;const{selection:r}=this.editor.state,s=(e=this.getReferencedVirtualElement)==null?void 0:e.call(this);if(s)return s;if(!((n=(t=this.view)==null?void 0:t.dom)!=null&&n.parentNode))return;const i=NL(this.view,r.from,r.to);let o={getBoundingClientRect:()=>i,getClientRects:()=>[i]};if(r instanceof Te){let l=this.view.nodeDOM(r.from);const a=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");a&&(l=a),l&&(o={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(r instanceof Us){const{$anchorCell:l,$headCell:a}=r,u=l?l.pos:a.pos,c=a?a.pos:l.pos,d=this.view.nodeDOM(u),h=this.view.nodeDOM(c);if(!d||!h)return;const f=d===h?d.getBoundingClientRect():kte(d.getBoundingClientRect(),h.getBoundingClientRect());o={getBoundingClientRect:()=>f,getClientRects:()=>[f]}}return o}updatePosition(){const e=this.virtualElement;e&&l1(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:n,strategy:r,middlewareData:s})=>{var i,o;if((i=s.hide)!=null&&i.referenceHidden||(o=s.hide)!=null&&o.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${t}px`,this.element.style.top=`${n}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}const s=!(t!=null&&t.selection.eq(e.state.selection)),i=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,s,i,t)}getShouldShow(e){var t;const{state:n}=this.view,{selection:r}=n,{ranges:s}=r,i=Math.min(...s.map(a=>a.$from.pos)),o=Math.max(...s.map(a=>a.$to.pos));return((t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:e,from:i,to:o}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){var t;if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){const n=(t=e.options.scrollTarget)!=null?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},J1=e=>new bt({key:typeof e.pluginKey=="string"?new St(e.pluginKey):e.pluginKey,view:t=>new Ste({view:t,...e})});Ct.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[J1({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var Cte=class{constructor({editor:e,element:t,view:n,updateDelay:r=250,resizeDelay:s=60,options:i,appendTo:o,shouldShow:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:u,state:c})=>{const{selection:d}=c,{$anchor:h,empty:f}=d,m=h.depth===1,g=h.parent.isTextblock&&!h.parent.type.spec.code&&!h.parent.textContent&&h.parent.childCount===0&&!this.getTextContent(h.parent);return!(!u.hasFocus()||!f||!m||!g||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(u,c,d,h)=>{const{composing:f}=u;if(f||!c&&!d)return;if(!this.getShouldShow(h)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var c;if(this.preventHide){this.preventHide=!1;return}u!=null&&u.relatedTarget&&((c=this.element.parentNode)!=null&&c.contains(u.relatedTarget))||(u==null?void 0:u.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:u})=>{const c=u.getMeta("floatingMenu");c==="updatePosition"?this.updatePosition():c&&typeof c=="object"&&c.type==="updateOptions"&&this.updateOptions(c.options)},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)};var a;this.editor=e,this.element=t,this.view=n,this.updateDelay=r,this.resizeDelay=s,this.appendTo=o,this.scrollTarget=(a=i==null?void 0:i.scrollTarget)!=null?a:window,this.floatingUIOptions={...this.floatingUIOptions,...i},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return wL(e,{textSerializers:V1(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(s1(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(r1(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(n1(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(hm(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(i1(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(q2(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(o1(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(W2(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}getShouldShow(e){var t;const{state:n}=this.view,{selection:r}=n,{ranges:s}=r,i=Math.min(...s.map(a=>a.$from.pos)),o=Math.max(...s.map(a=>a.$to.pos));return(t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,view:this.view,state:n,oldState:e,from:i,to:o})}updateOptions(e){var t;if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){const n=(t=e.options.scrollTarget)!=null?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){const{selection:e}=this.editor.state,t=NL(this.view,e.from,e.to);l1({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:r,y:s,strategy:i,middlewareData:o})=>{var l,a;if((l=o.hide)!=null&&l.referenceHidden||(a=o.hide)!=null&&a.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=i,this.element.style.left=`${r}px`,this.element.style.top=`${s}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const n=!(t!=null&&t.selection.eq(e.state.selection)),r=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,n,r,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Z1=e=>new bt({key:typeof e.pluginKey=="string"?new St(e.pluginKey):e.pluginKey,view:t=>new Cte({view:t,...e})});Ct.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta("floatingMenu","updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[Z1({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var Ete=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},Nte=({contentComponent:e})=>{const t=g1.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return p.jsx(p.Fragment,{children:Object.values(t)})};function Tte(){const e=new Set;let t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:vP.createPortal(r.reactElement,r.element,n)},e.forEach(s=>s())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(s=>s())}}}var Rte=class extends Wr.Component{constructor(e){var t;super(e),this.editorContentRef=Wr.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((t=e.editor)!=null&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;const t=this.props.editor;if(t&&!t.isDestroyed&&((e=t.view.dom)!=null&&e.parentNode)){if(t.contentComponent)return;const n=this.editorContentRef.current;n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n}),t.contentComponent=Tte(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;const t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!((e=t.view.dom)!=null&&e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:e,innerRef:t,...n}=this.props;return p.jsxs(p.Fragment,{children:[p.jsx("div",{ref:Ete(t,this.editorContentRef),...n}),(e==null?void 0:e.contentComponent)&&p.jsx(Nte,{contentComponent:e.contentComponent})]})}},Mte=x.forwardRef((e,t)=>{const n=Wr.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return Wr.createElement(Rte,{key:n,innerRef:t,...e})}),ZL=Wr.memo(Mte),Ote=typeof window<"u"?x.useLayoutEffect:x.useEffect,jte=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const t=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",t),()=>{n.off("transaction",t)}}}};function Pte(e){var t;const[n]=x.useState(()=>new jte(e.editor)),r=fte.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,(t=e.equalityFn)!=null?t:rte);return Ote(()=>n.watch(e.editor),[e.editor,n]),x.useDebugValue(r),r}var Ate=!1,Qw=typeof window>"u",_te=Qw||!!(typeof window<"u"&&window.next),Ite=class YL{constructor(t){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=t,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(t){this.editor=t,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Qw||_te?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const t={...this.options.current,onBeforeCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onBeforeCreate)==null?void 0:i.call(s,...r)},onBlur:(...r)=>{var s,i;return(i=(s=this.options.current).onBlur)==null?void 0:i.call(s,...r)},onCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onCreate)==null?void 0:i.call(s,...r)},onDestroy:(...r)=>{var s,i;return(i=(s=this.options.current).onDestroy)==null?void 0:i.call(s,...r)},onFocus:(...r)=>{var s,i;return(i=(s=this.options.current).onFocus)==null?void 0:i.call(s,...r)},onSelectionUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onSelectionUpdate)==null?void 0:i.call(s,...r)},onTransaction:(...r)=>{var s,i;return(i=(s=this.options.current).onTransaction)==null?void 0:i.call(s,...r)},onUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onUpdate)==null?void 0:i.call(s,...r)},onContentError:(...r)=>{var s,i;return(i=(s=this.options.current).onContentError)==null?void 0:i.call(s,...r)},onDrop:(...r)=>{var s,i;return(i=(s=this.options.current).onDrop)==null?void 0:i.call(s,...r)},onPaste:(...r)=>{var s,i;return(i=(s=this.options.current).onPaste)==null?void 0:i.call(s,...r)},onDelete:(...r)=>{var s,i;return(i=(s=this.options.current).onDelete)==null?void 0:i.call(s,...r)}};return new uee(t)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}static compareOptions(t,n){return Object.keys(t).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&t.extensions&&n.extensions?t.extensions.length!==n.extensions.length?!1:t.extensions.every((s,i)=>{var o;return s===((o=n.extensions)==null?void 0:o[i])}):t[r]===n[r])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?YL.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(t){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=t;return}if(this.previousDeps.length===t.length&&this.previousDeps.every((r,s)=>r===t[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=t}scheduleDestroy(){const t=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===t){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===t&&this.setEditor(null))},1)}};function Dte(e={},t=[]){const n=x.useRef(e);n.current=e;const[r]=x.useState(()=>new Ite(n)),s=g1.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return x.useDebugValue(s),x.useEffect(r.onRender(t)),Pte({editor:s,selector:({transactionNumber:i})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&i===0?0:i+1}),s}var Y1=x.createContext({editor:null});Y1.Consumer;var vy=()=>x.useContext(Y1),Lte=x.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),$te=()=>x.useContext(Lte);Wr.forwardRef((e,t)=>{const{onDragStart:n}=$te(),r=e.as||"div";return p.jsx(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});Wr.createContext({markViewContentRef:()=>{}});var zte=Wr.forwardRef(({pluginKey:e="bubbleMenu",editor:t,updateDelay:n,resizeDelay:r,appendTo:s,shouldShow:i=null,getReferencedVirtualElement:o,options:l,children:a,...u},c)=>{const d=x.useRef(document.createElement("div"));typeof c=="function"?c(d.current):c&&(c.current=d.current);const{editor:h}=vy(),f=t||h,m={updateDelay:n,resizeDelay:r,appendTo:s,pluginKey:e,shouldShow:i,getReferencedVirtualElement:o,options:l},g=x.useRef(m);g.current=m;const[v,y]=x.useState(!1),w=x.useRef(!0);return x.useEffect(()=>{if(f!=null&&f.isDestroyed)return;if(!f){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const b=d.current;b.style.visibility="hidden",b.style.position="absolute";const C=J1({...g.current,editor:f,element:b});f.registerPlugin(C);const S=g.current.pluginKey;return w.current=!0,y(!0),()=>{y(!1),f.unregisterPlugin(S),window.requestAnimationFrame(()=>{b.parentNode&&b.parentNode.removeChild(b)})}},[f]),x.useEffect(()=>{if(!(!v||!f||f.isDestroyed)){if(w.current){w.current=!1;return}f.view.dispatch(f.state.tr.setMeta("bubbleMenu",{type:"updateOptions",options:g.current}))}},[v,f,n,r,i,l,s,o]),Zo.createPortal(p.jsx("div",{...u,children:a}),d.current)}),Fte=Wr.forwardRef(({pluginKey:e="floatingMenu",editor:t,updateDelay:n,resizeDelay:r,appendTo:s,shouldShow:i=null,options:o,children:l,...a},u)=>{const c=x.useRef(document.createElement("div"));typeof u=="function"?u(c.current):u&&(u.current=c.current);const{editor:d}=vy(),h=t||d,f={updateDelay:n,resizeDelay:r,appendTo:s,pluginKey:e,shouldShow:i,options:o},m=x.useRef(f);m.current=f;const[g,v]=x.useState(!1),y=x.useRef(!0);return x.useEffect(()=>{if(h!=null&&h.isDestroyed)return;if(!h){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const w=c.current;w.style.visibility="hidden",w.style.position="absolute";const b=Z1({...m.current,editor:h,element:w});h.registerPlugin(b);const C=m.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),h.unregisterPlugin(C),window.requestAnimationFrame(()=>{w.parentNode&&w.parentNode.removeChild(w)})}},[h]),x.useEffect(()=>{if(!(!g||!h||h.isDestroyed)){if(y.current){y.current=!1;return}h.view.dispatch(h.state.tr.setMeta("floatingMenu",{type:"updateOptions",options:m.current}))}},[g,h,n,r,i,o,s]),Zo.createPortal(p.jsx("div",{...a,children:l}),c.current)}),X1=x.createContext({editor:null,isReady:!1});X1.displayName="TiptapContext";var wy=()=>x.useContext(X1);function XL({instance:e,children:t}){var n;const[r,s]=x.useState((n=e==null?void 0:e.isInitialized)!=null?n:!1);x.useEffect(()=>{if(!e){s(!1);return}if(e.isInitialized){s(!0);return}const l=()=>{s(!0)};return e.on("create",l),()=>{e.off("create",l)}},[e]);const i=x.useMemo(()=>({editor:e,isReady:r}),[e,r]),o=x.useMemo(()=>({editor:e}),[e]);return p.jsx(Y1.Provider,{value:o,children:p.jsx(X1.Provider,{value:i,children:t})})}XL.displayName="Tiptap";function e$({...e}){const{editor:t}=wy();return p.jsx(ZL,{editor:t,...e})}e$.displayName="Tiptap.Content";function t$({children:e}){const{isReady:t}=wy();return t?null:e}t$.displayName="Tiptap.Loading";function n$({children:e,...t}){const{editor:n}=wy();return n?p.jsx(zte,{editor:n,...t,children:e}):null}n$.displayName="Tiptap.BubbleMenu";function r$({children:e,...t}){const{editor:n}=wy();return n?p.jsx(Fte,{...t,editor:n,children:e}):null}r$.displayName="Tiptap.FloatingMenu";var Bte=Object.assign(XL,{Content:e$,Loading:t$,BubbleMenu:n$,FloatingMenu:r$}),Vte=Wr.forwardRef(({pluginKey:e="bubbleMenu",editor:t,updateDelay:n,resizeDelay:r,appendTo:s,shouldShow:i=null,getReferencedVirtualElement:o,options:l,children:a,...u},c)=>{const d=x.useRef(document.createElement("div"));typeof c=="function"?c(d.current):c&&(c.current=d.current);const{editor:h}=vy(),f=t||h,m={updateDelay:n,resizeDelay:r,appendTo:s,pluginKey:e,shouldShow:i,getReferencedVirtualElement:o,options:l},g=x.useRef(m);g.current=m;const[v,y]=x.useState(!1),w=x.useRef(!0);return x.useEffect(()=>{if(f!=null&&f.isDestroyed)return;if(!f){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const b=d.current;b.style.visibility="hidden",b.style.position="absolute";const C=J1({...g.current,editor:f,element:b});f.registerPlugin(C);const S=g.current.pluginKey;return w.current=!0,y(!0),()=>{y(!1),f.unregisterPlugin(S),window.requestAnimationFrame(()=>{b.parentNode&&b.parentNode.removeChild(b)})}},[f]),x.useEffect(()=>{if(!(!v||!f||f.isDestroyed)){if(w.current){w.current=!1;return}f.view.dispatch(f.state.tr.setMeta("bubbleMenu",{type:"updateOptions",options:g.current}))}},[v,f,n,r,i,l,s,o]),Zo.createPortal(p.jsx("div",{...u,children:a}),d.current)});Wr.forwardRef(({pluginKey:e="floatingMenu",editor:t,updateDelay:n,resizeDelay:r,appendTo:s,shouldShow:i=null,options:o,children:l,...a},u)=>{const c=x.useRef(document.createElement("div"));typeof u=="function"?u(c.current):u&&(u.current=c.current);const{editor:d}=vy(),h=t||d,f={updateDelay:n,resizeDelay:r,appendTo:s,pluginKey:e,shouldShow:i,options:o},m=x.useRef(f);m.current=f;const[g,v]=x.useState(!1),y=x.useRef(!0);return x.useEffect(()=>{if(h!=null&&h.isDestroyed)return;if(!h){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const w=c.current;w.style.visibility="hidden",w.style.position="absolute";const b=Z1({...m.current,editor:h,element:w});h.registerPlugin(b);const C=m.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),h.unregisterPlugin(C),window.requestAnimationFrame(()=>{w.parentNode&&w.parentNode.removeChild(w)})}},[h]),x.useEffect(()=>{if(!(!g||!h||h.isDestroyed)){if(y.current){y.current=!1;return}h.view.dispatch(h.state.tr.setMeta("floatingMenu",{type:"updateOptions",options:m.current}))}},[g,h,n,r,i,o,s]),Zo.createPortal(p.jsx("div",{...a,children:l}),c.current)});const Xr=e=>`tiptap-bubble-button${e?" is-active":""}`;function Hte({editor:e}){const t=x.useCallback(()=>{const n=e.getAttributes("link").href,r=window.prompt("Enter URL",n??"");if(r===null)return;const s=r.trim();if(!s){e.chain().focus().extendMarkRange("link").unsetLink().run();return}e.chain().focus().extendMarkRange("link").setLink({href:s}).run()},[e]);return p.jsxs(Vte,{editor:e,options:{offset:8},shouldShow:({editor:n,state:r})=>{if(!n.isEditable)return!1;const{empty:s}=r.selection;return!s||n.isActive("link")},className:"tiptap-bubble-menu",children:[p.jsx("button",{type:"button",className:Xr(e.isActive("bold")),onClick:()=>e.chain().focus().toggleBold().run(),"aria-label":"Toggle bold",children:p.jsx(VH,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:Xr(e.isActive("italic")),onClick:()=>e.chain().focus().toggleItalic().run(),"aria-label":"Toggle italic",children:p.jsx(MU,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:Xr(e.isActive("strike")),onClick:()=>e.chain().focus().toggleStrike().run(),"aria-label":"Toggle strikethrough",children:p.jsx(f6,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:Xr(e.isActive("code")),onClick:()=>e.chain().focus().toggleCode().run(),"aria-label":"Toggle inline code",children:p.jsx(Mk,{className:"h-4 w-4"})}),p.jsx("span",{className:"tiptap-bubble-separator","aria-hidden":"true"}),p.jsx("button",{type:"button",className:Xr(e.isActive("heading",{level:2})),onClick:()=>e.chain().focus().toggleHeading({level:2}).run(),"aria-label":"Toggle heading level 2",children:p.jsx(CU,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:Xr(e.isActive("heading",{level:3})),onClick:()=>e.chain().focus().toggleHeading({level:3}).run(),"aria-label":"Toggle heading level 3",children:p.jsx(NU,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:Xr(e.isActive("bulletList")),onClick:()=>e.chain().focus().toggleBulletList().run(),"aria-label":"Toggle bullet list",children:p.jsx(HA,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:Xr(e.isActive("orderedList")),onClick:()=>e.chain().focus().toggleOrderedList().run(),"aria-label":"Toggle ordered list",children:p.jsx($U,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:Xr(e.isActive("blockquote")),onClick:()=>e.chain().focus().toggleBlockquote().run(),"aria-label":"Toggle blockquote",children:p.jsx(ZU,{className:"h-4 w-4"})}),p.jsx("span",{className:"tiptap-bubble-separator","aria-hidden":"true"}),p.jsx("button",{type:"button",className:Xr(e.isActive("link")),onClick:t,"aria-label":"Add or edit link",children:p.jsx(IU,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:Xr(),onClick:()=>e.chain().focus().extendMarkRange("link").unsetLink().run(),"aria-label":"Remove link",disabled:!e.isActive("link"),children:p.jsx(m6,{className:"h-4 w-4"})})]})}const Ute=()=>{const{main:{editor:e}}=Tr();return p.jsx("div",{className:"min-h-0 flex-1",children:p.jsxs(Bte,{instance:e,children:[e?p.jsx(Hte,{editor:e}):null,p.jsx(ZL,{editor:e,className:"tiptap-editor tiptap-content h-full"})]})})},qte=e=>{if(e.toLowerCase().endsWith(".prompt.txt"))return e.slice(0,-11);if(e.toLowerCase().endsWith(".prompt.yaml"))return e.slice(0,-12);const t=e.lastIndexOf(".");return t>0?e.slice(0,t):e},Wte=()=>{const{main:{content:e,setContent:t,setIsDirty:n,setLastEditAt:r,active:s}}=Tr(),{prompts:i,activeVersion:o}=x.useMemo(()=>{try{const f=JSON.parse(e);if(Array.isArray(f))return{prompts:f.length>0?f:[""],activeVersion:f.length};if(f&&typeof f=="object"){const m=f.prompts&&Array.isArray(f.prompts)&&f.prompts.length>0?f.prompts:[""],g=typeof f.activeVersion=="number"&&f.activeVersion>0?Math.min(f.activeVersion,m.length):m.length;return{prompts:m,activeVersion:g}}return{prompts:[""],activeVersion:1}}catch{return{prompts:[""],activeVersion:1}}},[e]),l=o-1,[a,u]=x.useState(l);x.useEffect(()=>{u(f=>i.length===0?0:f>=0&&f<i.length?f:l)},[l,i.length]);const c=i[a]??"",d=qte((s==null?void 0:s.name)??"prompt"),h=()=>{const f=i[i.length-1]??"",m=[...i,f],g=m.length;t(JSON.stringify({prompts:m,activeVersion:g})),n(!0),r(Date.now()),u(m.length-1)};return p.jsxs("div",{className:"flex min-h-0 flex-1 gap-3",children:[p.jsxs("aside",{className:"flex w-48 shrink-0 flex-col overflow-hidden rounded-md border border-border bg-card",children:[p.jsx("div",{className:"border-b border-border px-3 py-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Versions"}),p.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2",children:p.jsx("ul",{className:"space-y-1",children:i.map((f,m)=>{const g=m===a,v=m===l,y=`${d} ${i.length-m}`;return p.jsx("li",{children:p.jsxs("button",{type:"button",className:`flex w-full items-center justify-between rounded-md px-2 py-1 text-left text-xs transition-colors ${g?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/40 hover:text-foreground"}`,onClick:()=>{u(m),m===l||(t(JSON.stringify({prompts:i,activeVersion:m+1})),n(!0),r(Date.now()))},children:[p.jsx("span",{children:y}),v?p.jsx("span",{className:"text-[10px] font-semibold text-primary",children:"ACTIVE"}):null]})},m)})})}),p.jsx("div",{className:"border-t border-border px-2 py-2",children:p.jsx("button",{type:"button",className:"w-full rounded-md px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-accent/40 hover:text-foreground",onClick:h,children:"+ Add version"})})]}),p.jsx("div",{className:"min-h-0 flex-1",children:p.jsx("textarea",{className:"h-full min-h-0 w-full border border-input bg-background px-3 py-2 font-mono text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:c,onChange:f=>{const m=f.target.value,g=[...i];g[a]=m,t(JSON.stringify({prompts:g,activeVersion:o})),n(!0),r(Date.now())},placeholder:"Select a version to edit"})})]})},cc={0:"None",1:"Urgent",2:"High",3:"Medium",4:"Low"},s$=[{type:"folder",label:"Folder",icon:sc},{type:"markdown",label:"Markdown",icon:ua},{type:"prompt",label:"Prompt",icon:VU},{type:"json",label:"Data Table",icon:oU},{type:"app",label:"React App",icon:eU},{type:"tasks",label:"Task Board",icon:u6}],i$=s$.filter(e=>e.type!=="folder"),o$=e=>s$.find(t=>t.type===e);function l$(e,t){const n=[],r=new Map,s=o=>{const l=r.get(o);if(l)return l;const a=o.split("/"),c={type:"folder",name:a[a.length-1],path:o,children:[]};if(r.set(o,c),a.length>1){const d=a.slice(0,-1).join("/");s(d).children.push(c)}else n.push(c);return c};for(const o of t)s(o);for(const o of e){const l=o.name.lastIndexOf("/");if(l===-1)n.push({type:"doc",doc:o});else{const a=o.name.slice(0,l);s(a).children.push({type:"doc",doc:o})}}const i=o=>{o.sort((l,a)=>l.type==="folder"&&a.type==="doc"?-1:l.type==="doc"&&a.type==="folder"?1:l.type==="folder"&&a.type==="folder"?l.name.localeCompare(a.name):l.type==="doc"&&a.type==="doc"?l.doc.pinned&&!a.doc.pinned?-1:!l.doc.pinned&&a.doc.pinned?1:(l.doc.displayName??l.doc.name).localeCompare(a.doc.displayName??a.doc.name):0);for(const l of o)l.type==="folder"&&i(l.children)};return i(n),n}function Kte(){const{activeProject:e}=Ht(),t=nt.useUtils(),n=(e==null?void 0:e.id)??"",r=nt.docs.list.useQuery({projectId:n},{enabled:!!e,refetchInterval:5e3,refetchOnWindowFocus:!1}),s=x.useMemo(()=>{var a;return((a=r.data)==null?void 0:a.docs)??[]},[r.data]),i=x.useMemo(()=>{var a;return((a=r.data)==null?void 0:a.folders)??[]},[r.data]),o=x.useCallback(a=>{t.docs.list.setData({projectId:n},u=>{if(u)return{...u,docs:a(u.docs)}})},[t,n]),l=x.useCallback(()=>{t.docs.list.invalidate({projectId:n}).catch(()=>{})},[t,n]);return{docsQuery:r,docs:s,folders:i,updateDocsCache:o,invalidateDocs:l}}const a$=x.createContext(null);function u$(){const e=x.useContext(a$);if(!e)throw new Error("useDocPicker requires DocPickerProvider");return e.pickDoc}const Qte=({type:e})=>{const t=o$(e),n=t==null?void 0:t.icon;return n?p.jsx(n,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):null},Gte=({doc:e,depth:t,onSelect:n})=>{const r=e.name.includes("/")?e.name.slice(e.name.lastIndexOf("/")+1):e.name;return p.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent",style:{paddingLeft:`${8+t*16}px`},onClick:()=>n(e.name),children:[p.jsx(Qte,{type:e.type}),p.jsx("span",{className:"truncate",children:e.displayName??r})]})},Jte=({node:e,depth:t,expanded:n,toggleExpanded:r,onSelect:s})=>{const i=n.has(e.path);return p.jsxs("div",{children:[p.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent",style:{paddingLeft:`${8+t*16}px`},onClick:()=>r(e.path),children:[i?p.jsx(Mo,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):p.jsx(Au,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),p.jsx(sc,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),p.jsx("span",{className:"truncate",children:e.name})]}),i&&p.jsx(c$,{items:e.children,depth:t+1,expanded:n,toggleExpanded:r,onSelect:s})]})},c$=({items:e,depth:t,expanded:n,toggleExpanded:r,onSelect:s})=>p.jsx(p.Fragment,{children:e.map(i=>i.type==="folder"?p.jsx(Jte,{node:i,depth:t,expanded:n,toggleExpanded:r,onSelect:s},i.path):p.jsx(Gte,{doc:i.doc,depth:t,onSelect:s},i.doc.name))}),Zte=({onSelect:e,onClose:t})=>{const{docs:n,folders:r}=Kte(),[s,i]=x.useState(""),[o,l]=x.useState(()=>new Set),a=x.useRef(null),u=x.useCallback(h=>{l(f=>{const m=new Set(f);return m.has(h)?m.delete(h):m.add(h),m})},[]),c=x.useMemo(()=>{if(!s.trim())return n;const h=s.toLowerCase();return n.filter(f=>f.name.toLowerCase().includes(h)||(f.displayName??"").toLowerCase().includes(h))},[n,s]),d=x.useMemo(()=>l$(c,s.trim()?[]:r),[c,r,s]);return p.jsx(el,{open:!0,onOpenChange:h=>!h&&t(),children:p.jsxs(Ii,{className:"flex max-h-[70vh] max-w-sm flex-col gap-0 p-0",children:[p.jsxs(tl,{className:"border-b border-border px-4 py-3",children:[p.jsx(nl,{className:"text-sm",children:"Link document"}),p.jsx(If,{className:"sr-only",children:"Pick a document to link"})]}),p.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-4 py-2",children:[p.jsx(Ok,{className:"h-3.5 w-3.5 text-muted-foreground"}),p.jsx("input",{ref:a,className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground",placeholder:"Search docs...",value:s,onChange:h=>i(h.target.value),autoFocus:!0})]}),p.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:d.length===0?p.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:"No documents found"}):p.jsx(c$,{items:d,depth:0,expanded:o,toggleExpanded:u,onSelect:e})})]})})},Yte=({children:e})=>{const t=x.useRef(null),[n,r]=x.useState(!1),s=x.useCallback(()=>new Promise(a=>{t.current=a,r(!0)}),[]),i=x.useCallback(a=>{var u;(u=t.current)==null||u.call(t,a),t.current=null,r(!1)},[]),o=x.useCallback(()=>{var a;(a=t.current)==null||a.call(t,null),t.current=null,r(!1)},[]),l=x.useMemo(()=>({pickDoc:s}),[s]);return p.jsxs(a$.Provider,{value:l,children:[e,n&&p.jsx(Zte,{onSelect:i,onClose:o})]})},Xte=["docs","agents","code","settings","commands"];function ene(e){try{return decodeURIComponent(e)}catch{return e}}function tne(e){try{const t=atob(e),n=Uint8Array.from(t,r=>r.charCodeAt(0));return new TextDecoder().decode(n)}catch{return null}}function nne(e){const t=new TextEncoder().encode(e);let n="";return t.forEach(r=>{n+=String.fromCharCode(r)}),btoa(n)}function vR(e){return e.split("/").map(t=>encodeURIComponent(t)).join("/")}function eS(e){const t=e.replace(/^\/+/,"").split("/").filter(Boolean),n=t[0]||null,r=t[1]||null;let s="docs";r&&Xte.includes(r)&&(s=r);let i=0,o=null,l=null,a=0,u=null;return s==="docs"&&t.length>=3?(i=parseInt(t[2],10)||0,t.length>=4&&(o=t.slice(3).map(ene).join("/"))):s==="agents"&&t.length>=3?l=t[2]:s==="code"&&t.length>=3&&(a=parseInt(t[2],10)||0,t.length>=4&&(u=tne(t[3]))),{projectId:n,tab:s,sidebarTab:s==="docs"||s==="agents"||s==="code"?s:"docs",panel:s==="settings"?"settings":s==="commands"?"commands":"docs",docDirIndex:i,docName:o,agentId:l,codeDirIndex:a,codeFilePath:u}}function by(){const e=Tf(),t=Lg(),n=x.useMemo(()=>eS(e.pathname),[e.pathname]),r=x.useCallback((a,u,c=0)=>{t(`/${a}/docs/${c}/${vR(u)}`,{replace:!0})},[t]),s=x.useCallback((a,u)=>{t(`/${a}/agents/${u}`,{replace:!0})},[t]),i=x.useCallback((a,u,c=0)=>{t(`/${a}/code/${c}/${nne(u)}`,{replace:!0})},[t]),o=x.useCallback((a,u)=>{t(`/${a}/${u}`,{replace:!0})},[t]),l=x.useCallback((a,u,c=0)=>`${a}/docs/${c}/${vR(u)}`,[]);return{...n,navigateToDoc:r,navigateToAgent:s,navigateToCodeFile:i,navigateToTab:o,encodeDocPath:l}}const rne={1:"text-red-500",2:"text-orange-500",3:"text-yellow-500",4:"text-blue-400"},sne=({docName:e,onClick:t})=>{const n=e.includes("/")?e.slice(e.lastIndexOf("/")+1):e;return p.jsxs("button",{type:"button",className:"flex items-center gap-1 truncate rounded bg-accent/60 px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground",onClick:r=>{r.stopPropagation(),t==null||t()},children:[p.jsx(ua,{className:"h-2.5 w-2.5 shrink-0"}),p.jsx("span",{className:"truncate",children:n})]})},ine=({task:e,globalIndex:t,onDragStart:n,onClick:r,onNavigateDoc:s})=>{var a;const i=e.status==="done",o=e.status==="cancelled",l=e.priority??0;return p.jsxs("div",{className:`cursor-grab rounded-md border border-border bg-card px-3 py-2 text-sm shadow-sm hover:border-foreground/20 ${i||o?"opacity-60":""}`,draggable:!0,onDragStart:u=>n(u,t),onClick:r,children:[p.jsx("span",{className:i||o?"line-through":"",children:e.label}),(l>0||(((a=e.tags)==null?void 0:a.length)??0)>0||e.linkedDoc)&&p.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[l>0&&p.jsx("span",{className:`text-[10px] font-medium ${rne[l]??"text-muted-foreground"}`,children:cc[l]}),(e.tags??[]).map(u=>p.jsx("span",{className:"rounded-full bg-accent px-1.5 py-0.5 text-[10px] text-muted-foreground",children:u},u)),e.linkedDoc&&p.jsx(sne,{docName:e.linkedDoc,onClick:()=>s(e.linkedDoc)})]})]})},one=({task:e,index:t,statuses:n,onUpdate:r,onRemove:s,onClose:i})=>{const[o,l]=x.useState(!1),[a,u]=x.useState(e.label),[c,d]=x.useState(""),h=x.useRef(null),f=u$(),m=()=>{l(!1);const w=a.trim();w&&w!==e.label?r(t,{label:w}):u(e.label)},g=()=>{const w=c.trim().toLowerCase();if(!w)return;const b=e.tags??[];b.includes(w)||r(t,{tags:[...b,w]}),d("")},v=w=>{r(t,{tags:(e.tags??[]).filter(b=>b!==w)})},y=async()=>{const w=await f();w&&r(t,{linkedDoc:w})};return p.jsx(el,{open:!0,onOpenChange:w=>!w&&i(),children:p.jsxs(Ii,{className:"max-w-sm",children:[p.jsxs(tl,{children:[p.jsx(nl,{className:"text-base",children:o?p.jsx("input",{ref:h,className:"w-full bg-transparent text-base font-semibold outline-none",value:a,onChange:w=>u(w.target.value),onBlur:m,onKeyDown:w=>{w.key==="Enter"&&m(),w.key==="Escape"&&(u(e.label),l(!1))},autoFocus:!0}):p.jsx("button",{type:"button",className:"w-full text-left",onClick:()=>{u(e.label),l(!0),setTimeout(()=>{var w;return(w=h.current)==null?void 0:w.focus()},0)},children:e.label})}),p.jsx(If,{className:"sr-only",children:"Edit task details"})]}),p.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"w-16 text-xs text-muted-foreground",children:"Status"}),p.jsx("select",{className:"h-7 flex-1 rounded border border-border bg-background px-2 text-xs",value:e.status??"todo",onChange:w=>r(t,{status:w.target.value}),children:n.map(w=>p.jsx("option",{value:w,children:w},w))})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"w-16 text-xs text-muted-foreground",children:"Priority"}),p.jsx("select",{className:"h-7 flex-1 rounded border border-border bg-background px-2 text-xs",value:e.priority??0,onChange:w=>r(t,{priority:Number(w.target.value)}),children:[0,1,2,3,4].map(w=>p.jsx("option",{value:w,children:cc[w]},w))})]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("span",{className:"w-16 shrink-0 pt-1 text-xs text-muted-foreground",children:"Tags"}),p.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-1",children:[(e.tags??[]).map(w=>p.jsxs("span",{className:"flex items-center gap-0.5 rounded-full bg-accent px-1.5 py-0.5 text-[11px]",children:[w,p.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:()=>v(w),children:p.jsx(Gr,{className:"h-2.5 w-2.5"})})]},w)),p.jsx("input",{className:"h-5 w-20 bg-transparent text-xs outline-none placeholder:text-muted-foreground",placeholder:"+ tag",value:c,onChange:w=>d(w.target.value),onKeyDown:w=>{w.key==="Enter"&&g()},onBlur:g})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"w-16 text-xs text-muted-foreground",children:"Doc"}),p.jsxs("div",{className:"flex flex-1 items-center gap-1",children:[e.linkedDoc?p.jsxs("span",{className:"flex items-center gap-1 rounded bg-accent/60 px-2 py-0.5 text-xs",children:[p.jsx(ua,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),p.jsx("span",{className:"truncate",children:e.linkedDoc.includes("/")?e.linkedDoc.slice(e.linkedDoc.lastIndexOf("/")+1):e.linkedDoc}),p.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:()=>r(t,{linkedDoc:void 0}),children:p.jsx(Gr,{className:"h-2.5 w-2.5"})})]}):null,p.jsxs(ae,{variant:"ghost",size:"sm",className:"h-6 gap-1 text-xs text-muted-foreground",onClick:y,children:[p.jsx(VA,{className:"h-3 w-3"}),e.linkedDoc?"Change":"Link"]})]})]}),p.jsx("div",{className:"flex justify-end border-t border-border pt-3",children:p.jsxs(ae,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-xs text-destructive hover:text-destructive",onClick:()=>{s(t),i()},children:[p.jsx(ic,{className:"h-3.5 w-3.5"}),"Delete"]})})]})]})})},lne=({status:e,tasks:t,globalIndices:n,onDragStart:r,onDrop:s,onDragOver:i,onAdd:o,onCardClick:l,onNavigateDoc:a})=>{const[u,c]=x.useState(!1),[d,h]=x.useState(""),f=x.useRef(null),m=()=>{c(!0),h(""),setTimeout(()=>{var v;return(v=f.current)==null?void 0:v.focus()},0)},g=()=>{const v=d.trim();v&&o(v,e),c(!1),h("")};return p.jsxs("div",{className:"flex w-64 shrink-0 flex-col rounded-lg border border-border bg-muted/30",onDragOver:i,onDrop:v=>s(v,e),children:[p.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[p.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:e}),p.jsx("span",{className:"text-xs text-muted-foreground",children:t.length})]}),p.jsx("div",{className:"flex min-h-[40px] flex-1 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:t.map((v,y)=>p.jsx(ine,{task:v,globalIndex:n[y],onDragStart:r,onClick:()=>l(n[y]),onNavigateDoc:a},`${n[y]}-${v.label}`))}),p.jsx("div",{className:"border-t border-border px-2 py-1.5",children:u?p.jsx("input",{ref:f,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",placeholder:"Task name...",value:d,onChange:v=>h(v.target.value),onBlur:g,onKeyDown:v=>{v.key==="Enter"&&g(),v.key==="Escape"&&c(!1)}}):p.jsxs(ae,{variant:"ghost",size:"sm",className:"h-7 w-full justify-start gap-1 text-xs text-muted-foreground",onClick:m,children:[p.jsx($n,{className:"h-3.5 w-3.5"}),"Add"]})})]})},ane=({tasks:e,statuses:t,onUpdate:n,onRemove:r,onAdd:s,onAddStatus:i})=>{const o=x.useRef(null),[l,a]=x.useState(!1),[u,c]=x.useState(""),d=x.useRef(null),[h,f]=x.useState(null),{activeProject:m}=Ht(),{navigateToDoc:g}=by(),v=x.useCallback(N=>{m&&g(m.id,N)},[m,g]),y=x.useCallback((N,O)=>{o.current=O,N.dataTransfer.effectAllowed="move"},[]),w=x.useCallback(N=>{N.preventDefault()},[]),b=x.useCallback((N,O)=>{const T=o.current;if(T===null)return;o.current=null;const j=e[T];!j||(j.status??"todo")===O||n(T,{status:O})},[e,n]),C=()=>{a(!0),c(""),setTimeout(()=>{var N;return(N=d.current)==null?void 0:N.focus()},0)},S=()=>{const N=u.trim().toLowerCase();a(!1),!(!N||t.includes(N))&&i(N)},k=new Map;for(const N of t)k.set(N,[]);e.forEach((N,O)=>{const T=N.status??"todo";k.has(T)||k.set(T,[]),k.get(T).push({task:N,index:O})});const E=h!==null?e[h]:null;return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex flex-1 gap-3 overflow-x-auto pb-2",children:[t.map(N=>{const O=k.get(N)??[];return p.jsx(lne,{status:N,tasks:O.map(T=>T.task),globalIndices:O.map(T=>T.index),onDragStart:y,onDrop:b,onDragOver:w,onAdd:s,onCardClick:f,onNavigateDoc:v},N)}),p.jsx("div",{className:"flex w-64 shrink-0 items-start",children:l?p.jsx("div",{className:"w-full rounded-lg border border-dashed border-border p-3",children:p.jsx("input",{ref:d,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",placeholder:"Column name...",value:u,onChange:N=>c(N.target.value),onBlur:S,onKeyDown:N=>{N.key==="Enter"&&S(),N.key==="Escape"&&a(!1)}})}):p.jsxs(ae,{variant:"ghost",className:"h-auto w-full justify-start gap-1 rounded-lg border border-dashed border-border px-3 py-2 text-xs text-muted-foreground",onClick:C,children:[p.jsx($n,{className:"h-3.5 w-3.5"}),"Add column"]})})]}),E&&h!==null&&p.jsx(one,{task:E,index:h,statuses:t,onUpdate:n,onRemove:r,onClose:()=>f(null)})]})},une={1:"text-red-500",2:"text-orange-500",3:"text-yellow-500",4:"text-blue-400"},cne=({priority:e})=>{if(!e)return null;const t=une[e]??"text-muted-foreground";return p.jsx("span",{className:`shrink-0 text-[10px] font-medium ${t}`,children:cc[e]})},dne=({tag:e})=>p.jsx("span",{className:"shrink-0 rounded-full bg-accent px-1.5 py-0.5 text-[10px] text-muted-foreground",children:e}),fne=({docName:e,onClick:t})=>{const n=e.includes("/")?e.slice(e.lastIndexOf("/")+1):e;return p.jsxs("button",{type:"button",className:"flex shrink-0 items-center gap-1 truncate rounded bg-accent/60 px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground",onClick:r=>{r.stopPropagation(),t()},children:[p.jsx(ua,{className:"h-2.5 w-2.5 shrink-0"}),p.jsx("span",{className:"truncate",children:n})]})},hne=({task:e,index:t,statuses:n,onToggleDone:r,onUpdate:s,onRemove:i,dragHandlers:o,onNavigateDoc:l})=>{const a=e.status==="done",u=e.status==="cancelled",[c,d]=x.useState(!1),[h,f]=x.useState(e.label),[m,g]=x.useState(!1),v=x.useRef(null),[y,w]=x.useState(""),b=x.useRef(null),C=u$(),S=()=>{f(e.label),d(!0),setTimeout(()=>{var T;return(T=v.current)==null?void 0:T.focus()},0)},k=()=>{d(!1);const T=h.trim();T&&T!==e.label?s(t,{label:T}):f(e.label)},E=()=>{const T=y.trim().toLowerCase();if(!T)return;const j=e.tags??[];j.includes(T)||s(t,{tags:[...j,T]}),w("")},N=T=>{s(t,{tags:(e.tags??[]).filter(j=>j!==T)})},O=async()=>{const T=await C();T&&s(t,{linkedDoc:T})};return p.jsxs("div",{className:u?"opacity-50":"",children:[p.jsxs("div",{className:"group flex items-center gap-2 rounded-md border border-transparent px-2 py-1.5 hover:border-border hover:bg-accent/30",draggable:!0,onDragStart:T=>o.onDragStart(T,t),onDragOver:T=>o.onDragOver(T),onDragEnd:o.onDragEnd,children:[p.jsx(wU,{className:"h-3.5 w-3.5 shrink-0 cursor-grab text-muted-foreground opacity-0 group-hover:opacity-100"}),p.jsx("input",{type:"checkbox",checked:a,onChange:()=>r(t),className:"h-4 w-4 shrink-0 cursor-pointer rounded border-border"}),c?p.jsx("input",{ref:v,className:"min-w-0 flex-1 bg-transparent text-sm outline-none",value:h,onChange:T=>f(T.target.value),onBlur:k,onKeyDown:T=>{T.key==="Enter"&&k(),T.key==="Escape"&&(f(e.label),d(!1))}}):p.jsx("button",{type:"button",className:`min-w-0 flex-1 truncate text-left text-sm ${a||u?"text-muted-foreground line-through":""}`,onDoubleClick:S,onClick:()=>g(T=>!T),children:e.label}),p.jsx(cne,{priority:e.priority??0}),(e.tags??[]).map(T=>p.jsx(dne,{tag:T},T)),e.linkedDoc&&p.jsx(fne,{docName:e.linkedDoc,onClick:()=>l(e.linkedDoc)}),p.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:e.status??"todo"}),p.jsx(ae,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100",onClick:()=>i(t),children:p.jsx(ic,{className:"h-3.5 w-3.5"})})]}),m&&p.jsxs("div",{className:"ml-[52px] flex flex-wrap items-center gap-2 pb-2 pt-1",children:[p.jsx("select",{className:"h-6 rounded border border-border bg-background px-1.5 text-[11px]",value:e.priority??0,onChange:T=>s(t,{priority:Number(T.target.value)}),children:[0,1,2,3,4].map(T=>p.jsx("option",{value:T,children:cc[T]},T))}),p.jsx("select",{className:"h-6 rounded border border-border bg-background px-1.5 text-[11px]",value:e.status??"todo",onChange:T=>s(t,{status:T.target.value}),children:n.map(T=>p.jsx("option",{value:T,children:T},T))}),p.jsxs("div",{className:"flex items-center gap-1",children:[(e.tags??[]).map(T=>p.jsxs("span",{className:"flex items-center gap-0.5 rounded-full bg-accent px-1.5 py-0.5 text-[10px]",children:[T,p.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:()=>N(T),children:p.jsx(Gr,{className:"h-2.5 w-2.5"})})]},T)),p.jsx("input",{ref:b,className:"h-5 w-16 bg-transparent text-[11px] outline-none placeholder:text-muted-foreground",placeholder:"+ tag",value:y,onChange:T=>w(T.target.value),onKeyDown:T=>{T.key==="Enter"&&E()},onBlur:E})]}),p.jsxs("div",{className:"flex items-center gap-1",children:[e.linkedDoc?p.jsxs("span",{className:"flex items-center gap-1 rounded bg-accent/60 px-1.5 py-0.5 text-[11px]",children:[p.jsx(ua,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),p.jsx("span",{className:"truncate",children:e.linkedDoc.includes("/")?e.linkedDoc.slice(e.linkedDoc.lastIndexOf("/")+1):e.linkedDoc}),p.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:()=>s(t,{linkedDoc:void 0}),children:p.jsx(Gr,{className:"h-2.5 w-2.5"})})]}):null,p.jsxs(ae,{variant:"ghost",size:"sm",className:"h-5 gap-1 px-1 text-[11px] text-muted-foreground",onClick:O,children:[p.jsx(VA,{className:"h-3 w-3"}),e.linkedDoc?"Change":"Link doc"]})]})]})]})},pne=({groups:e,statuses:t,onToggleDone:n,onUpdate:r,onRemove:s,onAdd:i})=>{var w;const[o,l]=x.useState(""),a=x.useRef(null),{activeProject:u}=Ht(),{navigateToDoc:c}=by(),d=x.useCallback(b=>{u&&c(u.id,b)},[u,c]),h=()=>{const b=o.trim();b&&(i(b),l(""))},f=x.useCallback((b,C)=>{a.current=C,b.dataTransfer.effectAllowed="move"},[]),m=x.useCallback(b=>{b.preventDefault()},[]),g=x.useCallback(()=>{a.current=null},[]),v={onDragStart:f,onDragOver:m,onDragEnd:g},y=e.length>1||((w=e[0])==null?void 0:w.key)!=="__all__";return p.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[p.jsx("div",{className:"flex-1 space-y-3 overflow-y-auto",children:e.map(b=>p.jsxs("div",{children:[y&&p.jsxs("div",{className:"mb-1 flex items-center gap-2 px-2",children:[p.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:b.label}),p.jsx("span",{className:"text-[10px] text-muted-foreground",children:b.tasks.length})]}),p.jsx("div",{className:"space-y-0.5",children:b.tasks.map(({task:C,index:S})=>p.jsx(hne,{task:C,index:S,statuses:t,onToggleDone:n,onUpdate:r,onRemove:s,dragHandlers:v,onNavigateDoc:d},`${S}-${C.label}`))})]},b.key))}),p.jsxs("div",{className:"flex items-center gap-2 border-t border-border pt-2",children:[p.jsx($n,{className:"h-4 w-4 text-muted-foreground"}),p.jsx("input",{className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground",placeholder:"Add a task...",value:o,onChange:b=>l(b.target.value),onKeyDown:b=>{b.key==="Enter"&&h()}})]})]})},iv=["todo","in progress","done"];function ul(e){const t={tasks:[],statuses:iv,view:{},error:"",payload:{data:[],statuses:iv}};if(!e.trim())return t;try{let n=JSON.parse(e);if(Array.isArray(n)&&(n={data:n}),!n||!Array.isArray(n.data))return{...t,error:"Invalid tasks format"};const r=n.data.map(o=>({...o,label:String(o.label??""),status:o.status?String(o.status):"todo",priority:typeof o.priority=="number"?o.priority:0,tags:Array.isArray(o.tags)?o.tags.map(String):[]})),s=Array.isArray(n.statuses)?n.statuses.map(String):iv,i=n.view??{};return{tasks:r,statuses:s,view:i,error:"",payload:{...n,data:r,statuses:s,view:i}}}catch{return{...t,error:"Invalid JSON"}}}function mne(e,t){var s,i,o,l;const n=(i=(s=t.filters)==null?void 0:s.status)==null?void 0:i.exclude,r=(l=(o=t.filters)==null?void 0:o.priority)==null?void 0:l.exclude;return e.filter(a=>!(n!=null&&n.includes(a.status??"todo")||r!=null&&r.includes(a.priority??0)))}function d$(e,t){return!e||t==="board"&&e==="status"?"label":e}function wR(e,t,n,r){const s=t??"label";return[...e].sort((o,l)=>{let a=0;if(s==="priority")a=(o.task.priority??0)-(l.task.priority??0);else if(s==="status"){const u=r.indexOf(o.task.status??"todo"),c=r.indexOf(l.task.status??"todo");a=(u===-1?999:u)-(c===-1?999:c)}else a=(o.task.label??"").localeCompare(l.task.label??"");return n?-a:a})}function gne(e,t,n,r){var c;const{groupBy:s,sortDesc:i}=t,o=d$(t.sortBy,r),l=e.map((d,h)=>({task:d,index:h}));if(!s)return[{key:"__all__",label:"",tasks:wR(l,o,i??!1,n)}];const a=new Map,u=[];for(const d of l){let h;s==="status"?h=[d.task.status??"todo"]:s==="priority"?h=[String(d.task.priority??0)]:h=(c=d.task.tags)!=null&&c.length?d.task.tags:["untagged"];for(const f of h)a.has(f)||(a.set(f,[]),u.push(f)),a.get(f).push(d)}return s==="status"?u.sort((d,h)=>{const f=n.indexOf(d),m=n.indexOf(h);return(f===-1?999:f)-(m===-1?999:m)}):s==="priority"?u.sort((d,h)=>Number(d)-Number(h)):u.sort((d,h)=>d.localeCompare(h)),u.map(d=>{const h=s==="priority"?cc[Number(d)]??d:d;return{key:d,label:h,tasks:wR(a.get(d)??[],o,i??!1,n)}})}function yne({content:e,setContent:t,setIsDirty:n,setLastEditAt:r,lastSaved:s}){const[i,o]=x.useState("list"),l=x.useMemo(()=>ul(e),[e]),{tasks:a,statuses:u,view:c,error:d}=l,h=x.useCallback(O=>{const T=JSON.stringify(O,null,2);t(T),n(T!==(s??"")),r(Date.now())},[s,t,n,r]),f=x.useCallback((O,T)=>{const j=ul(e).payload;h({...j,data:O,statuses:T??j.statuses})},[e,h]),m=x.useCallback(O=>{const T=ul(e).payload,j={...T.view??{},...O};h({...T,view:j})},[e,h]),g=x.useCallback((O,T="todo")=>{const j=ul(e).payload,A=j.statuses.includes(T)?j.statuses:[...j.statuses,T];f([...a,{label:O,status:T,priority:0,tags:[]}],A)},[f,e,a]),v=x.useCallback((O,T)=>{const j=a.map((A,z)=>z===O?{...A,...T}:A);if(T.status){const A=ul(e).payload,z=A.statuses.includes(T.status)?A.statuses:[...A.statuses,T.status];f(j,z)}else f(j)},[f,e,a]),y=x.useCallback(O=>{f(a.filter((T,j)=>j!==O))},[f,a]),w=x.useCallback(O=>{const T=a[O];if(!T)return;const j=T.status==="done"?"todo":"done";v(O,{status:j})},[a,v]),b=x.useCallback(O=>{if(u.includes(O))return;const T=ul(e).payload;h({...T,statuses:[...T.statuses,O]})},[e,h,u]),C=x.useCallback(O=>{const T=ul(e).payload,j=T.statuses.filter(z=>z!==O);if(j.length===0)return;const A=T.data.map(z=>(z.status??"todo")===O?{...z,status:j[0]}:z);h({...T,data:A,statuses:j})},[e,h]),S=x.useMemo(()=>mne(a,c),[a,c]),k=x.useMemo(()=>gne(S,c,u,i),[S,c,u,i]),E=x.useMemo(()=>{const O=new Set;for(const T of a)for(const j of T.tags??[])O.add(j);return[...O].sort()},[a]),N=d$(c.sortBy,i);return{tasks:a,filteredTasks:S,groups:k,error:d,statuses:u,view:c,resolvedSortBy:N,updateView:m,allTags:E,viewMode:i,setViewMode:o,addTask:g,updateTask:v,removeTask:y,toggleDone:w,addStatus:b,removeStatus:C}}const Gw=({trigger:e,children:t})=>{const[n,r]=x.useState(!1),s=x.useRef(null);return x.useEffect(()=>{if(!n)return;const i=o=>{s.current&&!s.current.contains(o.target)&&r(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),p.jsxs("div",{ref:s,className:"relative",children:[p.jsx("div",{onClick:()=>r(i=>!i),children:e}),n&&p.jsx("div",{className:"absolute left-0 top-full z-50 mt-1 min-w-[160px] rounded-md border border-border bg-popover p-1 shadow-md",children:t})]})},hd=({label:e,active:t,onClick:n})=>p.jsx("button",{type:"button",className:`flex w-full items-center rounded-sm px-2 py-1 text-left text-xs hover:bg-accent ${t?"font-medium text-foreground":"text-muted-foreground"}`,onClick:n,children:e}),bR=[{value:null,label:"None"},{value:"status",label:"Status"},{value:"priority",label:"Priority"},{value:"tag",label:"Tag"}],kR=[{value:"label",label:"Name"},{value:"priority",label:"Priority"},{value:"status",label:"Status"}],xne=({view:e,statuses:t,updateView:n})=>{var a,u,c,d;const r=((u=(a=e.filters)==null?void 0:a.status)==null?void 0:u.exclude)??[],s=((d=(c=e.filters)==null?void 0:c.priority)==null?void 0:d.exclude)??[],i=h=>{const f=r.includes(h)?r.filter(m=>m!==h):[...r,h];n({filters:{...e.filters,status:f.length?{exclude:f}:void 0}})},o=h=>{const f=s.includes(h)?s.filter(m=>m!==h):[...s,h];n({filters:{...e.filters,priority:f.length?{exclude:f}:void 0}})},l=r.length>0||s.length>0;return p.jsxs(Gw,{trigger:p.jsxs(ae,{variant:"ghost",size:"sm",className:`h-7 gap-1 text-xs ${l?"text-foreground":""}`,children:[p.jsx($A,{className:"h-3.5 w-3.5"}),"Filter",l&&p.jsx("span",{className:"rounded-full bg-primary px-1 text-[10px] text-primary-foreground",children:r.length+s.length})]}),children:[p.jsx("div",{className:"px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Status"}),t.map(h=>p.jsx(hd,{label:h,active:!r.includes(h),onClick:()=>i(h)},h)),p.jsx("div",{className:"my-1 border-t border-border"}),p.jsx("div",{className:"px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Priority"}),[0,1,2,3,4].map(h=>p.jsx(hd,{label:cc[h],active:!s.includes(h),onClick:()=>o(h)},h))]})},vne=()=>{var C,S;const{main:{content:e,setContent:t,setIsDirty:n,setLastEditAt:r}}=Tr(),{tasks:s,filteredTasks:i,groups:o,error:l,viewMode:a,setViewMode:u,addTask:c,updateTask:d,removeTask:h,toggleDone:f,statuses:m,addStatus:g,view:v,resolvedSortBy:y,updateView:w}=yne({content:e,setContent:t,setIsDirty:n,setLastEditAt:r});if(l)return p.jsx("div",{className:"text-sm text-destructive",children:l});const b=((C=kR.find(k=>k.value===y))==null?void 0:C.label)??"Name";return p.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[p.jsxs(ae,{variant:a==="list"?"secondary":"ghost",size:"sm",className:"h-7 gap-1 text-xs",onClick:()=>u("list"),children:[p.jsx(HA,{className:"h-3.5 w-3.5"}),"List"]}),p.jsxs(ae,{variant:a==="board"?"secondary":"ghost",size:"sm",className:"h-7 gap-1 text-xs",onClick:()=>u("board"),children:[p.jsx(jU,{className:"h-3.5 w-3.5"}),"Board"]}),p.jsx("div",{className:"mx-1 h-4 w-px bg-border"}),a==="list"&&p.jsx(Gw,{trigger:p.jsxs(ae,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-xs",children:[p.jsx(zA,{className:"h-3.5 w-3.5"}),v.groupBy?(S=bR.find(k=>k.value===v.groupBy))==null?void 0:S.label:"Group"]}),children:bR.map(k=>p.jsx(hd,{label:k.label,active:v.groupBy===k.value,onClick:()=>w({groupBy:k.value})},k.label))}),p.jsxs(Gw,{trigger:p.jsxs(ae,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-xs",children:[v.sortDesc?p.jsx(LH,{className:"h-3.5 w-3.5"}):p.jsx(_H,{className:"h-3.5 w-3.5"}),b]}),children:[kR.filter(k=>!(a==="board"&&k.value==="status")).map(k=>p.jsx(hd,{label:k.label,active:y===k.value,onClick:()=>w({sortBy:k.value})},k.label)),p.jsx("div",{className:"my-1 border-t border-border"}),p.jsx(hd,{label:v.sortDesc?"Ascending":"Descending",onClick:()=>w({sortDesc:!v.sortDesc})})]}),p.jsx(xne,{view:v,statuses:m,updateView:w}),s.length!==i.length&&p.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[i.length,"/",s.length]})]}),a==="list"?p.jsx(pne,{groups:o,statuses:m,onToggleDone:f,onUpdate:d,onRemove:h,onAdd:c}):p.jsx(ane,{tasks:i,statuses:m,onUpdate:d,onRemove:h,onAdd:c,onAddStatus:g})]})},wne=()=>{const{main:{active:e}}=Tr();return p.jsxs("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-hidden p-4",children:[p.jsx(vK,{}),p.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-3",children:[(e==null?void 0:e.type)==="markdown"?p.jsx(Ute,{}):null,(e==null?void 0:e.type)==="prompt"?p.jsx(Wte,{}):null,(e==null?void 0:e.type)==="json"?p.jsx(iG,{}):null,(e==null?void 0:e.type)==="app"?p.jsx(bK,{docName:e.name}):null,(e==null?void 0:e.type)==="tasks"?p.jsx(vne,{}):null]})]})};function SR(e){const t=new Date(e),n=new Date;return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()?t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):t.toLocaleDateString([],{month:"short",day:"numeric",year:t.getFullYear()!==n.getFullYear()?"numeric":void 0})}const bne=({agentId:e,currentName:t,open:n,onOpenChange:r})=>{const[s,i]=x.useState(t??""),{updateAgent:o}=Pf(),l=a=>{a.preventDefault();const u=s.trim();u&&(o({agentId:e,name:u}),r(!1))};return p.jsx(el,{open:n,onOpenChange:r,children:p.jsxs(Ii,{className:"max-w-sm",children:[p.jsx(tl,{children:p.jsx(nl,{children:"Rename agent"})}),p.jsxs("form",{onSubmit:l,className:"flex flex-col gap-3 pt-2",children:[p.jsx("input",{autoFocus:!0,value:s,onChange:a=>i(a.target.value),placeholder:"Agent name",className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:ring-2 focus:ring-ring"}),p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx(ae,{type:"button",variant:"ghost",size:"sm",onClick:()=>r(!1),children:"Cancel"}),p.jsx(ae,{type:"submit",size:"sm",disabled:!s.trim(),children:"Save"})]})]})]})})},kne=({agent:e})=>{const t=e.updatedAt&&e.updatedAt!==e.createdAt;return p.jsxs("span",{className:"flex flex-col text-[10px] text-muted-foreground",children:[p.jsxs("span",{children:["Created ",SR(e.createdAt)]}),t&&p.jsxs("span",{children:["Updated ",SR(e.updatedAt)]})]})},CR=({agent:e,isActive:t,onSelect:n,onArchive:r,onRename:s,onDelete:i})=>p.jsxs("div",{className:`group flex cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 text-sm transition-colors ${t?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onClick:n,children:[p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("span",{className:"block truncate text-sm font-medium text-foreground",children:e.name??"New agent"}),p.jsx("span",{className:"block text-[10px] text-muted-foreground font-mono",children:e.id.split("-")[0]}),p.jsx(kne,{agent:e})]}),p.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 pt-0.5",children:[p.jsx("button",{type:"button",className:"opacity-0 transition-opacity group-hover:opacity-100",onClick:o=>{o.stopPropagation(),s()},title:"Rename",children:p.jsx(UU,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})}),p.jsx("button",{type:"button",className:"opacity-0 transition-opacity group-hover:opacity-100",onClick:r,title:e.archived?"Unarchive":"Archive",children:p.jsx(rm,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})}),e.archived&&i&&p.jsx("button",{type:"button",className:"opacity-0 transition-opacity group-hover:opacity-100",onClick:i,title:"Delete",children:p.jsx(ic,{className:"h-3 w-3 text-muted-foreground hover:text-destructive"})})]})]}),Sne=({selectedId:e,onSelect:t})=>{const{agents:n,isLoading:r,createAgent:s,archiveAgent:i,deleteAgent:o}=Pf(),[l,a]=x.useState(!1),[u,c]=x.useState(null),d=x.useMemo(()=>n.filter(y=>!y.archived),[n]),h=x.useMemo(()=>n.filter(y=>y.archived),[n]),f=()=>{s(void 0,{onSuccess:y=>t(y.id)})},m=(y,w)=>{w.stopPropagation(),i(y)},g=(y,w)=>{w.stopPropagation(),window.confirm("Are you sure you want to delete this conversation? This action cannot be undone.")&&o(y)},v=y=>{c(y)};return r?p.jsx("div",{className:"flex flex-1 items-center justify-center text-xs text-muted-foreground",children:"Loading…"}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[p.jsxs("div",{className:"flex items-center justify-between pb-2",children:[p.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Conversations"}),p.jsx(ae,{type:"button",variant:"ghost",size:"sm",onClick:f,className:"h-6 w-6 p-0",children:p.jsx($n,{className:"h-3.5 w-3.5"})})]}),p.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[d.length===0&&!l?p.jsxs("div",{className:"py-8 text-center text-xs text-muted-foreground",children:[p.jsx("p",{children:"No agents yet"}),p.jsx("button",{type:"button",onClick:f,className:"mt-1 text-xs text-primary hover:underline",children:"Create one"})]}):p.jsx("div",{className:"space-y-1",children:d.map(y=>p.jsx(CR,{agent:y,isActive:y.id===e,onSelect:()=>t(y.id),onArchive:w=>m(y.id,w),onRename:()=>v(y)},y.id))}),h.length>0&&p.jsxs("div",{className:"mt-3",children:[p.jsxs("div",{className:"flex items-center justify-between pb-2",children:[p.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Archived"}),p.jsx(ae,{type:"button",variant:"ghost",className:"h-auto px-0 py-0 text-xs font-medium text-muted-foreground hover:text-foreground",onClick:()=>a(y=>!y),children:l?"Hide":"Show"})]}),l&&p.jsx("div",{className:"space-y-1 opacity-60",children:h.map(y=>p.jsx(CR,{agent:y,isActive:y.id===e,onSelect:()=>t(y.id),onArchive:w=>m(y.id,w),onRename:()=>v(y),onDelete:w=>g(y.id,w)},y.id))})]})]})]}),u&&p.jsx(bne,{agentId:u.id,currentName:u.name,open:!!u,onOpenChange:y=>{y||c(null)}})]})};function Cne(e){const t=[],n=new Map,r=i=>{const o=n.get(i);if(o)return o;const l=i.split("/"),u={name:l[l.length-1],path:i,children:[]};return n.set(i,u),l.length>1?r(l.slice(0,-1).join("/")).children.push(u):t.push(u),u};for(const i of e)r(i);const s=i=>{i.sort((o,l)=>o.name.localeCompare(l.name));for(const o of i)s(o.children)};return s(t),t}const f$=({node:e,depth:t,selected:n,onSelect:r,expanded:s,onToggle:i})=>{const o=s.has(e.path),l=n===e.path,a=e.children.length>0;return p.jsxs(p.Fragment,{children:[p.jsxs("button",{type:"button",className:`flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-left text-sm ${l?"bg-primary/10 text-primary":"hover:bg-accent/40"}`,style:{paddingLeft:`${t*16+8}px`},onClick:()=>r(e.path),children:[a?p.jsx("span",{className:"shrink-0",onClick:u=>{u.stopPropagation(),i(e.path)},children:o?p.jsx(Mo,{className:"h-3 w-3 text-muted-foreground"}):p.jsx(Au,{className:"h-3 w-3 text-muted-foreground"})}):p.jsx("span",{className:"h-3 w-3 shrink-0"}),p.jsx(sc,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),p.jsx("span",{className:"truncate",children:e.name})]}),o?e.children.map(u=>p.jsx(f$,{node:u,depth:t+1,selected:n,onSelect:r,expanded:s,onToggle:i},u.path)):null]})},Ene=({doc:e,folders:t,onMove:n,onClose:r})=>{const s=e.name.includes("/")?e.name.slice(0,e.name.lastIndexOf("/")):"",[i,o]=x.useState(s),[l,a]=x.useState(()=>{const g=new Set;if(s){const v=s.split("/");for(let y=1;y<=v.length;y++)g.add(v.slice(0,y).join("/"))}return g}),[u,c]=x.useState(!1),d=Cne(t),h=g=>{a(v=>{const y=new Set(v);return y.has(g)?y.delete(g):y.add(g),y})},f=async()=>{if(i===s){r();return}c(!0);try{await n(e,i),r()}catch{c(!1)}},m=e.name.includes("/")?e.name.slice(e.name.lastIndexOf("/")+1):e.name;return p.jsx("div",{className:"fixed inset-0 z-30 flex items-center justify-center bg-black/40 p-4",children:p.jsxs("div",{className:"w-full max-w-sm rounded-lg border border-border bg-card p-5 shadow-xl",children:[p.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[p.jsxs("h3",{className:"text-base font-semibold",children:['Move "',e.displayName??m,'"']}),p.jsx("button",{type:"button",className:"text-sm text-muted-foreground hover:text-foreground",onClick:r,children:"Close"})]}),p.jsxs("div",{className:"mb-4 max-h-64 overflow-y-auto rounded-md border border-border p-1",children:[p.jsxs("button",{type:"button",className:`flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-left text-sm ${i===""?"bg-primary/10 text-primary":"hover:bg-accent/40"}`,onClick:()=>o(""),children:[p.jsx(sc,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),p.jsx("span",{className:"truncate font-medium",children:"/ (root)"})]}),d.map(g=>p.jsx(f$,{node:g,depth:1,selected:i,onSelect:o,expanded:l,onToggle:h},g.path))]}),p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx(ae,{type:"button",variant:"ghost",onClick:r,children:"Cancel"}),p.jsx(ae,{type:"button",onClick:f,disabled:u||i===s,children:u?"Moving…":"Move"})]})]})})},Nne=({open:e,onOpenChange:t,parentFolder:n,folders:r,onCreate:s})=>{const[i,o]=x.useState(""),[l,a]=x.useState(""),u=x.useRef(null);x.useEffect(()=>{e&&(o(""),a(""),setTimeout(()=>{var h;return(h=u.current)==null?void 0:h.focus()},0))},[e]);const c=async()=>{const h=i.trim();if(!h){t(!1);return}const f=n?`${n}/${h}`:h;if(r.includes(f)){a("Folder already exists");return}a("");try{await s(f),t(!1)}catch(m){a(String(m))}};if(!e)return null;const d=n||"Root";return p.jsx("div",{className:"fixed inset-0 z-30 flex items-center justify-center bg-black/40 p-4",children:p.jsxs("div",{className:"w-full max-w-md rounded-lg border border-border bg-card p-5 shadow-xl",children:[p.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[p.jsx("h3",{className:"text-base font-semibold",children:"New Folder"}),p.jsx("button",{type:"button",className:"text-sm text-muted-foreground hover:text-foreground",onClick:()=>t(!1),children:"Close"})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"text-sm text-muted-foreground",children:["Parent folder:"," ",p.jsx("span",{className:"font-mono text-foreground",children:d})]}),p.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[p.jsx("span",{className:"text-muted-foreground",children:"Folder name"}),p.jsx("input",{ref:u,className:"h-9 rounded-md border border-input bg-background px-3 text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:i,onChange:h=>{o(h.target.value),l&&a("")},onKeyDown:h=>{h.key==="Enter"&&c(),h.key==="Escape"&&t(!1)},placeholder:"Folder name"})]}),l?p.jsx("div",{className:"text-sm text-destructive",children:l}):null]}),p.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[p.jsx(ae,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),p.jsx(ae,{type:"button",onClick:c,disabled:!i.trim(),children:"Create"})]})]})})},tS=({open:e,setOpen:t,ref:n})=>{x.useEffect(()=>{if(!e)return;const r=i=>{n.current&&(n.current.contains(i.target)||t(!1))},s=i=>{i.key==="Escape"&&t(!1)};return document.addEventListener("mousedown",r),document.addEventListener("keydown",s),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",s)}},[e,n,t])},h$=(e,t=0)=>{let n=t;for(const r of e)if(r.type==="folder"){const s=h$(r.children,t+1);n=Math.max(n,s)}return n},p$=({depth:e,indentWidth:t})=>e===0?null:p.jsx("div",{className:"flex shrink-0 self-stretch","aria-hidden":!0,children:Array.from({length:e},(n,r)=>p.jsx("span",{className:"border-l border-border/50",style:{width:`${t}px`}},r))}),Tne=({doc:e,active:t,navigate:n,encodePath:r,runCommandAction:s,onMoveDoc:i,depth:o,indentWidth:l})=>{const[a,u]=x.useState(!1),c=x.useRef(null);tS({open:a,setOpen:u,ref:c});const d=(t==null?void 0:t.name)===e.name,h=e.name.includes("/")?e.name.slice(e.name.lastIndexOf("/")+1):e.name;return p.jsxs("li",{className:`flex items-stretch rounded-md ${d?"glassy-highlight":"hover:bg-accent/40"} ${a?"bg-accent/40":""}`,children:[p.jsx(p$,{depth:o,indentWidth:l}),p.jsxs("div",{className:"flex min-w-0 flex-1 items-center px-2 py-1.5",children:[p.jsx(ae,{onClick:()=>n(`/${r(e.name)}`,{replace:!0}),variant:"ghost",className:"min-w-0 flex-1 justify-start rounded-md bg-transparent px-0 hover:bg-transparent",children:p.jsxs("span",{className:"flex items-center gap-2 truncate",children:[e.pinned?p.jsx(UA,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):null,p.jsxs("span",{className:"flex flex-col items-start gap-0.5 truncate leading-tight",children:[p.jsx("span",{className:"truncate",children:e.displayName??h}),p.jsx("span",{className:"truncate text-[10px] text-muted-foreground",children:h})]})]})}),p.jsxs("div",{className:"relative",ref:a?c:null,children:[p.jsx(ae,{type:"button",size:"icon",variant:"ghost",className:"h-6 w-6 shrink-0 rounded-md bg-transparent hover:bg-transparent",onClick:()=>u(f=>!f),children:p.jsx(DA,{className:"h-3.5 w-3.5"})}),a?p.jsxs("div",{className:"absolute right-0 z-20 mt-1 w-36 rounded-md border border-border bg-card p-1 text-sm shadow-lg",children:[e.type!=="prompt"?p.jsx("button",{type:"button",className:"flex w-full items-center rounded px-2 py-1 text-left hover:bg-accent",onClick:async()=>{u(!1),await s(jk,{activeDoc:e})},children:e.pinned?"Unpin":"Pin"}):null,p.jsx("button",{type:"button",className:"flex w-full items-center rounded px-2 py-1 text-left hover:bg-accent",onClick:async()=>{u(!1),await s(Pk,{activeDoc:e})},children:"Archive"}),p.jsx("button",{type:"button",className:"flex w-full items-center rounded px-2 py-1 text-left hover:bg-accent",onClick:async()=>{u(!1),await s(Ak,{activeDoc:e})},children:"Delete"}),p.jsx("div",{className:"my-1 border-t border-border"}),p.jsx("button",{type:"button",className:"flex w-full items-center rounded px-2 py-1 text-left hover:bg-accent",onClick:()=>{u(!1),i(e)},children:"Move…"})]}):null]})]})]})},Rne=({node:e,depth:t,...n})=>{const r=n.expanded.has(e.path),[s,i]=x.useState(!1),o=x.useRef(null);return tS({open:s,setOpen:i,ref:o}),p.jsxs("li",{children:[p.jsxs("div",{className:"flex items-stretch rounded-md hover:bg-accent/40",children:[p.jsx(p$,{depth:t,indentWidth:n.indentWidth}),p.jsxs("div",{className:"flex min-w-0 flex-1 items-center px-2 py-1.5",children:[p.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-1.5 text-left text-sm",onClick:()=>n.toggleExpanded(e.path),children:[r?p.jsx(Mo,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):p.jsx(Au,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),p.jsx(sc,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),p.jsx("span",{className:"truncate",children:e.name})]}),p.jsxs("div",{className:"relative flex shrink-0 items-center",ref:s?o:null,children:[p.jsx(ae,{type:"button",size:"icon",variant:"ghost",className:"h-6 w-6 rounded-md bg-transparent hover:bg-transparent",onClick:()=>i(l=>!l),children:p.jsx(DA,{className:"h-3.5 w-3.5"})}),s?p.jsxs("div",{className:"absolute right-0 top-full z-20 mt-1 w-44 rounded-md border border-border bg-card p-1 text-sm shadow-lg",children:[i$.map(l=>p.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1 text-left hover:bg-accent",onClick:()=>{i(!1),n.openFor(l.type,e.path)},children:[n.renderDocTypeIcon(l.type),"New ",l.label]},l.type)),p.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1 text-left hover:bg-accent",onClick:()=>{i(!1),n.onOpenCreateFolderDialog(e.path)},children:[n.renderDocTypeIcon("folder"),"New Subfolder"]}),p.jsx("div",{className:"my-1 border-t border-border"}),p.jsx("button",{type:"button",className:"flex w-full items-center rounded px-2 py-1 text-left text-destructive hover:bg-accent",onClick:async()=>{i(!1),await n.deleteFolder(e.path)},children:"Delete Folder"})]}):null]})]})]}),r?p.jsx("ul",{children:p.jsx(m$,{items:e.children,depth:t+1,...n})}):null]})},m$=({items:e,depth:t,...n})=>p.jsx(p.Fragment,{children:e.map(r=>r.type==="folder"?p.jsx(Rne,{node:r,depth:t,...n},r.path):p.jsx(Tne,{doc:r.doc,active:n.active,navigate:n.navigate,encodePath:n.encodePath,runCommandAction:n.runCommandAction,onMoveDoc:n.onMoveDoc,depth:t,indentWidth:n.indentWidth},r.doc.name))}),Mne=({docs:e,folders:t,active:n,navigate:r,encodePath:s,runCommandAction:i,openFor:o,createFolder:l,deleteFolder:a,moveDoc:u})=>{const[c,d]=x.useState(()=>new Set),[h,f]=x.useState(!1);x.useEffect(()=>{if(n!=null&&n.name.includes("/")){const D=n.name.split("/"),L=new Set;for(let H=0;H<D.length-1;H++){const K=D.slice(0,H+1).join("/");L.add(K)}d(H=>new Set([...H,...L]))}},[n==null?void 0:n.name]);const[m,g]=x.useState(null),v=D=>{const L=o$(D),H=L==null?void 0:L.icon;return H?p.jsx(H,{className:"h-4 w-4"}):null},y=D=>{d(L=>{const H=new Set(L);return H.has(D)?H.delete(D):H.add(D),H})},w=l$(e,t),C=x.useMemo(()=>h$(w),[w])<4?16:8,S=()=>{d(new Set)},k=D=>{g(D),D&&d(L=>new Set([...L,D])),f(!0)},E=async D=>{await l(D),d(L=>new Set([...L,D]))},[N,O]=x.useState(null),T={active:n,navigate:r,encodePath:s,runCommandAction:i,openFor:o,expanded:c,toggleExpanded:y,onOpenCreateFolderDialog:k,onMoveDoc:O,deleteFolder:a,renderDocTypeIcon:v,indentWidth:C},[j,A]=x.useState(!1),z=x.useRef(null);return tS({open:j,setOpen:A,ref:z}),p.jsxs("div",{children:[p.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Docs"}),c.size>0?p.jsx(ae,{type:"button",size:"icon",variant:"ghost",className:"h-5 w-5 rounded-md bg-transparent hover:bg-transparent",onClick:S,title:"Collapse all",children:p.jsx(GH,{className:"h-3 w-3"})}):null]}),p.jsxs("div",{className:"relative flex",ref:z,children:[p.jsx(ae,{type:"button",size:"icon",variant:"ghost",onClick:()=>o("markdown"),title:"New document",children:p.jsx($n,{className:"h-4 w-4"})}),p.jsx(ae,{type:"button",size:"icon",variant:"ghost",onClick:()=>A(D=>!D),"aria-expanded":j,"aria-haspopup":"menu",children:p.jsx(Mo,{className:"h-4 w-4"})}),j?p.jsxs("div",{className:"absolute right-0 top-full z-20 mt-1 w-44 rounded-md border border-border bg-popover p-1 text-sm shadow-lg",children:[p.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1 text-left hover:bg-accent",onClick:()=>{A(!1),k(null)},children:[v("folder"),"New Folder"]}),i$.map(D=>p.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1 text-left hover:bg-accent",onClick:()=>{A(!1),o(D.type)},children:[v(D.type),"New ",D.label]},D.type))]}):null]})]}),p.jsx("ul",{className:"space-y-0.5",children:p.jsx(m$,{items:w,depth:0,...T})}),N?p.jsx(Ene,{doc:N,folders:t,onMove:u,onClose:()=>O(null)}):null,h?p.jsx(Nne,{open:h,onOpenChange:f,parentFolder:m,folders:t,onCreate:E}):null]})};function One(e,t){const n=[],r=new Map,s=o=>{const l=r.get(o);if(l)return l;const a=o.split("/"),c={type:"folder",name:a[a.length-1],path:o,children:[]};if(r.set(o,c),a.length>1){const d=a.slice(0,-1).join("/");s(d).children.push(c)}else n.push(c);return c};for(const o of t)s(o);for(const o of e){const l=o.lastIndexOf("/"),a=l===-1?o:o.slice(l+1),u={type:"file",path:o,name:a};if(l===-1)n.push(u);else{const c=o.slice(0,l);s(c).children.push(u)}}const i=o=>{o.sort((l,a)=>l.type==="folder"&&a.type==="file"?-1:l.type==="file"&&a.type==="folder"?1:l.name.localeCompare(a.name));for(const l of o)l.type==="folder"&&i(l.children)};return i(n),n}const jne=({name:e,path:t,depth:n,isActive:r,onSelect:s})=>p.jsxs("li",{className:`flex cursor-pointer items-center gap-1.5 rounded-md px-2 py-1 text-sm ${r?"glassy-highlight text-foreground":"text-muted-foreground hover:bg-accent/40"}`,style:{paddingLeft:`${n*12+8}px`},onClick:()=>s(t),children:[p.jsx(mU,{className:"h-3.5 w-3.5 shrink-0"}),p.jsx("span",{className:"truncate",children:e})]}),Pne=({node:e,depth:t,expanded:n,toggleExpanded:r,activeFile:s,onSelectFile:i})=>{const o=n.has(e.path);return p.jsxs("li",{children:[p.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-left text-sm hover:bg-accent/40",style:{paddingLeft:`${t*12+8}px`},onClick:()=>r(e.path),children:[o?p.jsx(Mo,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):p.jsx(Au,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),p.jsx(sc,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),p.jsx("span",{className:"truncate",children:e.name})]}),o?p.jsx("ul",{children:p.jsx(g$,{items:e.children,depth:t+1,expanded:n,toggleExpanded:r,activeFile:s,onSelectFile:i})}):null]})},g$=({items:e,depth:t,expanded:n,toggleExpanded:r,activeFile:s,onSelectFile:i})=>p.jsx(p.Fragment,{children:e.map(o=>o.type==="folder"?p.jsx(Pne,{node:o,depth:t,expanded:n,toggleExpanded:r,activeFile:s,onSelectFile:i},o.path):p.jsx(jne,{name:o.name,path:o.path,depth:t,isActive:s===o.path,onSelect:i},o.path))}),Ane=({files:e,folders:t,activeFile:n,onSelectFile:r})=>{const[s,i]=x.useState(()=>new Set);x.useEffect(()=>{if(n!=null&&n.includes("/")){const a=n.split("/"),u=new Set;for(let c=0;c<a.length-1;c++){const d=a.slice(0,c+1).join("/");u.add(d)}i(c=>new Set([...c,...u]))}},[n]);const o=a=>{i(u=>{const c=new Set(u);return c.has(a)?c.delete(a):c.add(a),c})},l=One(e,t);return l.length===0?p.jsx("div",{className:"py-4 text-center text-xs text-muted-foreground",children:"No code files found"}):p.jsxs("div",{children:[p.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[p.jsx(Mk,{className:"h-3.5 w-3.5 text-muted-foreground"}),p.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Code"})]}),p.jsx("ul",{className:"space-y-0.5",children:p.jsx(g$,{items:l,depth:0,expanded:s,toggleExpanded:o,activeFile:n,onSelectFile:r})})]})},_ne=()=>{var o;const{activeProject:e}=Ht(),t=(e==null?void 0:e.id)??"",n=nt.code.list.useQuery({projectId:t},{enabled:!!e,refetchInterval:1e4,refetchOnWindowFocus:!1}),r=x.useMemo(()=>{var l;return((l=n.data)==null?void 0:l.files)??[]},[n.data]),s=x.useMemo(()=>{var l;return((l=n.data)==null?void 0:l.folders)??[]},[n.data]),i=((o=n.data)==null?void 0:o.hasCodeDir)??!1;return{files:r,folders:s,hasCodeDir:i,isLoading:n.isLoading}},Ine=({text:e})=>{const t=x.useRef(null),n=x.useRef(null);return x.useLayoutEffect(()=>{const r=t.current,s=n.current;if(!r||!s)return;const i=20;s.style.fontSize=`${i}px`;const o=Math.min(1,r.clientWidth/s.scrollWidth);s.style.fontSize=`${Math.floor(i*o)}px`},[e]),p.jsx("div",{ref:t,className:"overflow-hidden shrink-0",children:p.jsx("span",{ref:n,className:"block whitespace-nowrap font-bold leading-tight",children:e})})},ov=e=>`rounded-md px-2.5 py-1 text-xs font-semibold uppercase tracking-wide transition-colors ${e?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"}`,Dne=({active:e,onChange:t,showCode:n})=>p.jsx("div",{className:"flex items-center gap-3",children:p.jsxs("div",{className:"flex gap-1",children:[p.jsx("button",{type:"button",onClick:()=>t("docs"),className:ov(e==="docs"),children:"Docs"}),p.jsx("button",{type:"button",onClick:()=>t("agents"),className:ov(e==="agents"),children:"Agents"}),n?p.jsx("button",{type:"button",onClick:()=>t("code"),className:ov(e==="code"),children:"Code"}):null]})}),Lne=({activeTab:e,onTabChange:t,selectedAgentId:n,onSelectAgent:r,activeCodeFile:s,onSelectCodeFile:i})=>{const{sidebar:{tags:o,systemTagStatus:l,runCommandAction:a,active:u,navigate:c,encodePath:d,docs:h,folders:f,createFolder:m,deleteFolder:g,moveDoc:v}}=Tr(),{activeProject:y}=Ht(),{onOpenChange:w}=f_(),{openFor:b}=a2(),{files:C,folders:S,hasCodeDir:k}=_ne(),[E,N]=x.useState([]),[O,T]=x.useState(!0),j=()=>N([]),A=L=>{N(H=>H.includes(L)?H.filter(K=>K!==L):[...H,L].sort())},z=x.useMemo(()=>E.length===0?h:h.filter(L=>E.every(H=>{var K;return(K=L.tags)==null?void 0:K.includes(H)})),[h,E]),D=o.length>0||!!l;return p.jsx("aside",{className:"flex h-screen w-64 flex-col border-r border-border p-4 pt-10",children:p.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3",children:[y?p.jsx(Ine,{text:y.name}):null,p.jsx(Dne,{active:e,onChange:t,showCode:k}),e==="docs"?p.jsxs(p.Fragment,{children:[p.jsxs("button",{type:"button",className:"flex h-9 w-full shrink-0 items-center justify-between rounded-md border border-input bg-background px-3 text-sm text-muted-foreground transition-colors hover:bg-accent/40",onClick:()=>w(!0),"aria-label":"Open command palette",children:[p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(Ok,{className:"h-4 w-4"}),p.jsx("span",{children:"Search"})]}),p.jsx("span",{className:"rounded-md border border-border px-1.5 py-0.5 font-mono text-[10px] uppercase",children:Ja?"⌘ K":"Ctrl K"})]}),p.jsxs("section",{className:"flex min-h-0 flex-[0_1_auto] flex-col",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Tags"}),E.length>0?p.jsx(ae,{type:"button",variant:"ghost",className:"h-auto px-0 py-0 text-xs font-medium text-muted-foreground hover:text-foreground",onClick:j,children:"Clear"}):p.jsx(ae,{type:"button",variant:"ghost",className:"h-auto px-0 py-0 text-xs font-medium text-muted-foreground hover:text-foreground",onClick:()=>T(L=>!L),children:O?"Show":"Hide"})]}),!O&&D?p.jsx("div",{className:"mt-2 min-h-0 flex-1 overflow-y-auto pr-1",children:o.length>0?p.jsx("ul",{className:"flex flex-wrap gap-2",children:o.map(L=>p.jsx("li",{className:`rounded-full border px-2 py-1 text-xs ${E.includes(L)?"border-primary bg-primary/10 text-primary":"border-border bg-muted text-muted-foreground"}`,children:p.jsx("button",{type:"button",className:"text-left",onClick:()=>A(L),children:L})},L))}):l?p.jsx("div",{className:"text-xs text-muted-foreground",children:l}):null}):null]}),p.jsx("section",{className:"flex min-h-0 flex-[1_1_auto] flex-col",children:p.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:p.jsx(Mne,{docs:z,folders:f,active:u,navigate:c,encodePath:d,runCommandAction:a,openFor:b,createFolder:m,deleteFolder:g,moveDoc:v})})})]}):e==="code"?p.jsx("section",{className:"flex min-h-0 flex-[1_1_auto] flex-col",children:p.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:p.jsx(Ane,{files:C,folders:S,activeFile:s,onSelectFile:i})})}):p.jsx(Sne,{selectedId:n,onSelect:r})]})})},y$=["shift","alt","meta","mod","ctrl","control"],$ne={esc:"escape",return:"enter",left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function Io(e){return($ne[e.trim()]||e.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function x$(e){return y$.includes(e)}function lv(e,t=","){return e.toLowerCase().split(t)}function av(e,t="+",n=">",r=!1,s,i){let o=[],l=!1;e=e.trim(),e.includes(n)?(l=!0,o=e.toLocaleLowerCase().split(n).map(c=>Io(c))):o=e.toLocaleLowerCase().split(t).map(c=>Io(c));const a={alt:o.includes("alt"),ctrl:o.includes("ctrl")||o.includes("control"),shift:o.includes("shift"),meta:o.includes("meta"),mod:o.includes("mod"),useKey:r},u=o.filter(c=>!y$.includes(c));return{...a,keys:u,description:s,isSequence:l,hotkey:e,metadata:i}}typeof document<"u"&&(document.addEventListener("keydown",e=>{e.code!==void 0&&v$([Io(e.code)])}),document.addEventListener("keyup",e=>{e.code!==void 0&&w$([Io(e.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{ki.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{ki.clear()},0)}));const ki=new Set;function nS(e){return Array.isArray(e)}function zne(e,t=","){return(nS(e)?e:e.split(t)).every(n=>ki.has(n.trim().toLowerCase()))}function v$(e){const t=Array.isArray(e)?e:[e];ki.has("meta")&&ki.forEach(n=>{x$(n)||ki.delete(n.toLowerCase())}),t.forEach(n=>{ki.add(n.toLowerCase())})}function w$(e){const t=Array.isArray(e)?e:[e];e==="meta"?ki.clear():t.forEach(n=>{ki.delete(n.toLowerCase())})}function Fne(e,t,n){(typeof n=="function"&&n(e,t)||n===!0)&&e.preventDefault()}function Bne(e,t,n){return typeof n=="function"?n(e,t):n===!0||n===void 0}const Vne=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"];function Hne(e){return b$(e,Vne)}function b$(e,t=!1){const{target:n,composed:r}=e;let s,i;return Une(n)&&r?(s=e.composedPath()[0]&&e.composedPath()[0].tagName,i=e.composedPath()[0]&&e.composedPath()[0].role):(s=n&&n.tagName,i=n&&n.role),nS(t)?!!(s&&t&&t.some(o=>o.toLowerCase()===s.toLowerCase()||o===i)):!!(s&&t&&t)}function Une(e){return!!e.tagName&&!e.tagName.startsWith("-")&&e.tagName.includes("-")}function qne(e,t){return e.length===0&&t?!1:t?e.some(n=>t.includes(n))||e.includes("*"):!0}const Wne=(e,t,n=!1)=>{const{alt:r,meta:s,mod:i,shift:o,ctrl:l,keys:a,useKey:u}=t,{code:c,key:d,ctrlKey:h,metaKey:f,shiftKey:m,altKey:g}=e,v=Io(c);if(u&&(a==null?void 0:a.length)===1&&a.includes(d.toLowerCase()))return!0;if(!(a!=null&&a.includes(v))&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(v))return!1;if(!n){if(r!==g&&v!=="alt"||o!==m&&v!=="shift")return!1;if(i){if(!f&&!h)return!1}else if(s!==f&&v!=="meta"&&v!=="os"||l!==h&&v!=="ctrl"&&v!=="control")return!1}return a&&a.length===1&&a.includes(v)?!0:a&&a.length>0?a.includes(v)?zne(a):!1:!a||a.length===0},Kne=x.createContext(void 0),Qne=()=>x.useContext(Kne);function k$(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce((n,r)=>n&&k$(e[r],t[r]),!0):e===t}const Gne=x.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),Jne=()=>x.useContext(Gne);function Zne(e){const t=x.useRef(void 0);return k$(t.current,e)||(t.current=e),t.current}const ER=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},Yne=typeof window<"u"?x.useLayoutEffect:x.useEffect;function Xne(e,t,n,r){const s=x.useRef(null),i=x.useRef(!1),o=Array.isArray(n)?Array.isArray(r)?void 0:r:n,l=nS(e)?e.join(o==null?void 0:o.delimiter):e,a=Array.isArray(n)?n:Array.isArray(r)?r:void 0,u=x.useCallback(t,a??[]),c=x.useRef(u);a?c.current=u:c.current=t;const d=Zne(o),{activeScopes:h}=Jne(),f=Qne();return Yne(()=>{if((d==null?void 0:d.enabled)===!1||!qne(h,d==null?void 0:d.scopes))return;let m=[],g;const v=(C,S=!1)=>{var k;if(!(Hne(C)&&!b$(C,d==null?void 0:d.enableOnFormTags))){if(s.current!==null){const E=s.current.getRootNode();if((E instanceof Document||E instanceof ShadowRoot)&&E.activeElement!==s.current&&!s.current.contains(E.activeElement)){ER(C);return}}(k=C.target)!=null&&k.isContentEditable&&!(d!=null&&d.enableOnContentEditable)||lv(l,d==null?void 0:d.delimiter).forEach(E=>{var O,T,j,A;if(E.includes((d==null?void 0:d.splitKey)??"+")&&E.includes((d==null?void 0:d.sequenceSplitKey)??">")){console.warn(`Hotkey ${E} contains both ${(d==null?void 0:d.splitKey)??"+"} and ${(d==null?void 0:d.sequenceSplitKey)??">"} which is not supported.`);return}const N=av(E,d==null?void 0:d.splitKey,d==null?void 0:d.sequenceSplitKey,d==null?void 0:d.useKey,d==null?void 0:d.description,d==null?void 0:d.metadata);if(N.isSequence){g=setTimeout(()=>{m=[]},(d==null?void 0:d.sequenceTimeoutMs)??1e3);const z=N.useKey?C.key:Io(C.code);if(x$(z.toLowerCase()))return;m.push(z);const D=(O=N.keys)==null?void 0:O[m.length-1];if(z!==D){m=[],g&&clearTimeout(g);return}m.length===((T=N.keys)==null?void 0:T.length)&&(c.current(C,N),g&&clearTimeout(g),m=[])}else if(Wne(C,N,d==null?void 0:d.ignoreModifiers)||(j=N.keys)!=null&&j.includes("*")){if((A=d==null?void 0:d.ignoreEventWhen)!=null&&A.call(d,C)||S&&i.current)return;if(Fne(C,N,d==null?void 0:d.preventDefault),!Bne(C,N,d==null?void 0:d.enabled)){ER(C);return}c.current(C,N),S||(i.current=!0)}})}},y=C=>{C.code!==void 0&&(v$(Io(C.code)),((d==null?void 0:d.keydown)===void 0&&(d==null?void 0:d.keyup)!==!0||d!=null&&d.keydown)&&v(C))},w=C=>{C.code!==void 0&&(w$(Io(C.code)),i.current=!1,d!=null&&d.keyup&&v(C,!0))},b=s.current||(o==null?void 0:o.document)||document;return b.addEventListener("keyup",w,o==null?void 0:o.eventListenerOptions),b.addEventListener("keydown",y,o==null?void 0:o.eventListenerOptions),f&&lv(l,d==null?void 0:d.delimiter).forEach(C=>{f.addHotkey(av(C,d==null?void 0:d.splitKey,d==null?void 0:d.sequenceSplitKey,d==null?void 0:d.useKey,d==null?void 0:d.description,d==null?void 0:d.metadata))}),()=>{b.removeEventListener("keyup",w,o==null?void 0:o.eventListenerOptions),b.removeEventListener("keydown",y,o==null?void 0:o.eventListenerOptions),f&&lv(l,d==null?void 0:d.delimiter).forEach(C=>{f.removeHotkey(av(C,d==null?void 0:d.splitKey,d==null?void 0:d.sequenceSplitKey,d==null?void 0:d.useKey,d==null?void 0:d.description,d==null?void 0:d.metadata))}),m=[],g&&clearTimeout(g)}},[l,d,h]),s}var ere=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"}),tre="VisuallyHidden",S$=x.forwardRef((e,t)=>p.jsx(On.span,{...e,ref:t,style:{...ere,...e.style}}));S$.displayName=tre;var nre=S$,[ky]=Ug("Tooltip",[Xg]),Sy=Xg(),C$="TooltipProvider",rre=700,Jw="tooltip.open",[sre,rS]=ky(C$),E$=e=>{const{__scopeTooltip:t,delayDuration:n=rre,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=e,o=x.useRef(!0),l=x.useRef(!1),a=x.useRef(0);return x.useEffect(()=>{const u=a.current;return()=>window.clearTimeout(u)},[]),p.jsx(sre,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(a.current),o.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:x.useCallback(u=>{l.current=u},[]),disableHoverableContent:s,children:i})};E$.displayName=C$;var af="Tooltip",[ire,Cy]=ky(af),N$=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:l}=e,a=rS(af,e.__scopeTooltip),u=Sy(t),[c,d]=x.useState(null),h=ms(),f=x.useRef(0),m=o??a.disableHoverableContent,g=l??a.delayDuration,v=x.useRef(!1),[y,w]=Ik({prop:r,defaultProp:s??!1,onChange:E=>{E?(a.onOpen(),document.dispatchEvent(new CustomEvent(Jw))):a.onClose(),i==null||i(E)},caller:af}),b=x.useMemo(()=>y?v.current?"delayed-open":"instant-open":"closed",[y]),C=x.useCallback(()=>{window.clearTimeout(f.current),f.current=0,v.current=!1,w(!0)},[w]),S=x.useCallback(()=>{window.clearTimeout(f.current),f.current=0,w(!1)},[w]),k=x.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{v.current=!0,w(!0),f.current=0},g)},[g,w]);return x.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),p.jsx(sI,{...u,children:p.jsx(ire,{scope:t,contentId:h,open:y,stateAttribute:b,trigger:c,onTriggerChange:d,onTriggerEnter:x.useCallback(()=>{a.isOpenDelayedRef.current?k():C()},[a.isOpenDelayedRef,k,C]),onTriggerLeave:x.useCallback(()=>{m?S():(window.clearTimeout(f.current),f.current=0)},[S,m]),onOpen:C,onClose:S,disableHoverableContent:m,children:n})})};N$.displayName=af;var Zw="TooltipTrigger",T$=x.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Cy(Zw,n),i=rS(Zw,n),o=Sy(n),l=x.useRef(null),a=Nr(t,l,s.onTriggerChange),u=x.useRef(!1),c=x.useRef(!1),d=x.useCallback(()=>u.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),p.jsx(c1,{asChild:!0,...o,children:p.jsx(On.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:a,onPointerMove:Wt(e.onPointerMove,h=>{h.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),c.current=!0)}),onPointerLeave:Wt(e.onPointerLeave,()=>{s.onTriggerLeave(),c.current=!1}),onPointerDown:Wt(e.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Wt(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:Wt(e.onBlur,s.onClose),onClick:Wt(e.onClick,s.onClose)})})});T$.displayName=Zw;var ore="TooltipPortal",[qde,lre]=ky(ore,{forceMount:void 0}),Yu="TooltipContent",R$=x.forwardRef((e,t)=>{const n=lre(Yu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=e,o=Cy(Yu,e.__scopeTooltip);return p.jsx(ca,{present:r||o.open,children:o.disableHoverableContent?p.jsx(M$,{side:s,...i,ref:t}):p.jsx(are,{side:s,...i,ref:t})})}),are=x.forwardRef((e,t)=>{const n=Cy(Yu,e.__scopeTooltip),r=rS(Yu,e.__scopeTooltip),s=x.useRef(null),i=Nr(t,s),[o,l]=x.useState(null),{trigger:a,onClose:u}=n,c=s.current,{onPointerInTransitChange:d}=r,h=x.useCallback(()=>{l(null),d(!1)},[d]),f=x.useCallback((m,g)=>{const v=m.currentTarget,y={x:m.clientX,y:m.clientY},w=hre(y,v.getBoundingClientRect()),b=pre(y,w),C=mre(g.getBoundingClientRect()),S=yre([...b,...C]);l(S),d(!0)},[d]);return x.useEffect(()=>()=>h(),[h]),x.useEffect(()=>{if(a&&c){const m=v=>f(v,c),g=v=>f(v,a);return a.addEventListener("pointerleave",m),c.addEventListener("pointerleave",g),()=>{a.removeEventListener("pointerleave",m),c.removeEventListener("pointerleave",g)}}},[a,c,f,h]),x.useEffect(()=>{if(o){const m=g=>{const v=g.target,y={x:g.clientX,y:g.clientY},w=(a==null?void 0:a.contains(v))||(c==null?void 0:c.contains(v)),b=!gre(y,o);w?h():b&&(h(),u())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[a,c,o,u,h]),p.jsx(M$,{...e,ref:i})}),[ure,cre]=ky(af,{isInside:!1}),dre=F9("TooltipContent"),M$=x.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=e,a=Cy(Yu,n),u=Sy(n),{onClose:c}=a;return x.useEffect(()=>(document.addEventListener(Jw,c),()=>document.removeEventListener(Jw,c)),[c]),x.useEffect(()=>{if(a.trigger){const d=h=>{const f=h.target;f!=null&&f.contains(a.trigger)&&c()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[a.trigger,c]),p.jsx(qg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:p.jsxs(iI,{"data-state":a.stateAttribute,...u,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(dre,{children:r}),p.jsx(ure,{scope:n,isInside:!0,children:p.jsx(nre,{id:a.contentId,role:"tooltip",children:s||r})})]})})});R$.displayName=Yu;var O$="TooltipArrow",fre=x.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Sy(n);return cre(O$,n).isInside?null:p.jsx(oI,{...s,...r,ref:t})});fre.displayName=O$;function hre(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function pre(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function mre(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function gre(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const l=t[i],a=t[o],u=l.x,c=l.y,d=a.x,h=a.y;c>r!=h>r&&n<(d-u)*(r-c)/(h-c)+u&&(s=!s)}return s}function yre(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),xre(t)}function xre(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var vre=E$,wre=N$,bre=T$,j$=R$;const kre=vre,kp=wre,Sp=bre,pd=x.forwardRef(({className:e,sideOffset:t=4,...n},r)=>p.jsx(j$,{ref:r,sideOffset:t,className:mt("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95",e),...n}));pd.displayName=j$.displayName;const Sre=Ja?"⌘":"Ctrl",Cre=({name:e,emoji:t,isActive:n,shortcut:r,onClick:s})=>p.jsxs(kp,{children:[p.jsx(Sp,{asChild:!0,children:p.jsx("button",{type:"button",onClick:s,className:mt("flex h-10 w-10 items-center justify-center rounded-lg text-lg transition-colors",n?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50"),"aria-label":e,children:t??e.charAt(0)})}),p.jsx(pd,{side:"right",children:p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx("span",{children:e}),r?p.jsx("kbd",{className:"rounded border border-border bg-muted px-1 py-0.5 font-mono text-[10px]",children:r}):null]})})]}),Ere=({panel:e,onPanelChange:t})=>{const{projects:n,activeProject:r,setActiveProjectId:s,openCreateProject:i}=Ht();return Xne(Array.from({length:9},(o,l)=>`mod+${l+1}`).join(","),o=>{o.preventDefault();const l=Number(o.key)-1,a=n[l];a&&s(a.id)},{enableOnFormTags:!1}),n.length<=1?null:p.jsx(kre,{delayDuration:200,children:p.jsxs("aside",{className:"flex h-full w-14 flex-col",children:[p.jsx("div",{className:"h-10 shrink-0"}),p.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center gap-1 border-t border-r border-border py-3",children:[n.map((o,l)=>p.jsx(Cre,{name:o.name,emoji:o.emoji,isActive:o.id===(r==null?void 0:r.id)&&e==="docs",shortcut:l<9?`${Sre}${l+1}`:null,onClick:()=>s(o.id)},o.id)),p.jsxs(kp,{children:[p.jsx(Sp,{asChild:!0,children:p.jsx("button",{type:"button",onClick:i,className:"flex h-10 w-10 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-accent/50","aria-label":"Add project",children:p.jsx($n,{className:"h-5 w-5"})})}),p.jsx(pd,{side:"right",children:"Add project"})]}),p.jsxs(kp,{children:[p.jsx(Sp,{asChild:!0,children:p.jsx("button",{type:"button",onClick:()=>t(e==="commands"?"docs":"commands"),className:mt("mt-auto flex h-10 w-10 items-center justify-center rounded-lg transition-colors",e==="commands"?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50"),"aria-label":"Commands",children:p.jsx(nU,{className:"h-5 w-5"})})}),p.jsx(pd,{side:"right",children:"Keyboard shortcuts"})]}),p.jsxs(kp,{children:[p.jsx(Sp,{asChild:!0,children:p.jsx("button",{type:"button",onClick:()=>t(e==="settings"?"docs":"settings"),className:mt("flex h-10 w-10 items-center justify-center rounded-lg transition-colors",e==="settings"?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50"),"aria-label":"Settings",children:p.jsx(WA,{className:"h-5 w-5"})})}),p.jsx(pd,{side:"right",children:"Settings"})]})]})]})})},Nre=()=>{const[e,t]=x.useState(""),n=async()=>{if(!("Notification"in window)){t("Notifications not supported in this browser");return}let r=Notification.permission;if(r==="default"&&(r=await Notification.requestPermission()),r!=="granted"){t("Notification permission denied");return}new Notification("Hyperdoc",{body:"Agent is waiting for your input",icon:"/favicon.png"}),t("Notification sent!"),setTimeout(()=>t(""),3e3)};return p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs(ae,{size:"sm",variant:"outline",onClick:n,children:[p.jsx(FH,{className:"mr-1.5 h-3.5 w-3.5"}),"Send Test Notification"]}),e&&p.jsx("span",{className:"text-xs text-muted-foreground",children:e})]})},Tre=()=>{var f,m;const e=nt.config.get.useQuery(),t=nt.useUtils(),n=nt.config.set.useMutation({onSuccess:()=>t.config.get.invalidate()}),[r,s]=x.useState(""),[i,o]=x.useState(!1),[l,a]=x.useState(!1),u=((f=e.data)==null?void 0:f.hasAnthropicApiKey)??!1,c=((m=e.data)==null?void 0:m.anthropicApiKey)??"",d=()=>{r.trim()&&(n.mutate({anthropicApiKey:r.trim()}),s(""),o(!1))},h=g=>{g.key==="Enter"&&d(),g.key==="Escape"&&(o(!1),s(""))};return i?p.jsx("div",{className:"space-y-2",children:p.jsxs("div",{className:"flex gap-2",children:[p.jsxs("div",{className:"relative flex-1",children:[p.jsx("input",{type:l?"text":"password",value:r,onChange:g=>s(g.target.value),onKeyDown:h,placeholder:"sk-ant-...",autoFocus:!0,className:"h-9 w-full rounded-md border border-border bg-background px-3 pr-9 font-mono text-sm focus:outline-none focus:ring-1 focus:ring-ring"}),p.jsx("button",{type:"button",onClick:()=>a(g=>!g),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:l?p.jsx(cU,{className:"h-3.5 w-3.5"}):p.jsx(fU,{className:"h-3.5 w-3.5"})})]}),p.jsx(ae,{size:"sm",onClick:d,disabled:!r.trim(),children:"Save"}),p.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>{o(!1),s("")},children:"Cancel"})]})}):p.jsxs("div",{className:"flex items-center gap-3",children:[u?p.jsxs(p.Fragment,{children:[p.jsx("code",{className:"rounded bg-muted px-2 py-1 font-mono text-xs text-muted-foreground",children:c}),p.jsx(Af,{className:"h-3.5 w-3.5 text-green-500"})]}):p.jsx("span",{className:"text-sm text-muted-foreground",children:"Not set"}),p.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>o(!0),children:u?"Change":"Set"})]})},Rre=()=>p.jsx("div",{className:"flex flex-1 flex-col items-center overflow-y-auto py-16",children:p.jsxs("div",{className:"w-full max-w-md space-y-6",children:[p.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[p.jsx(WA,{className:"h-6 w-6"}),p.jsx("h2",{className:"text-lg font-medium",children:"Settings"})]}),p.jsxs("div",{className:"space-y-4 rounded-lg border border-border p-4",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-sm font-medium",children:"Anthropic API Key"}),p.jsxs("p",{className:"text-xs text-muted-foreground",children:["Required for AI agent features. Get one at"," ",p.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:"console.anthropic.com"})]})]}),p.jsx(Tre,{})]}),p.jsxs("div",{className:"space-y-4 rounded-lg border border-border p-4",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-sm font-medium",children:"Notifications"}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Test browser notifications for agent alerts."})]}),p.jsx(Nre,{})]})]})}),Mre=({command:e})=>p.jsxs("div",{className:"flex items-center justify-between rounded-md px-3 py-2 text-sm hover:bg-accent/40",children:[p.jsx("span",{children:e.label}),p.jsx("kbd",{className:"rounded border border-border bg-muted px-2 py-1 font-mono text-xs text-muted-foreground",children:rw(e.shortcut)})]}),Ore=()=>{const e=x.useMemo(()=>a_().filter(t=>t.shortcut),[]);return p.jsx("div",{className:"flex flex-1 flex-col items-center overflow-y-auto py-16",children:p.jsxs("div",{className:"w-full max-w-md space-y-6",children:[p.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[p.jsx(AU,{className:"h-6 w-6"}),p.jsx("h2",{className:"text-lg font-medium",children:"Keyboard shortcuts"})]}),p.jsx("div",{className:"divide-y divide-border rounded-lg border border-border",children:e.map(t=>p.jsx(Mre,{command:t},t.id))})]})})};function jre(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Pre=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Are=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_re={};function NR(e,t){return(_re.jsx?Are:Pre).test(e)}const Ire=/[ \t\n\f\r]/g;function Dre(e){return typeof e=="object"?e.type==="text"?TR(e.value):!1:TR(e)}function TR(e){return e.replace(Ire,"")===""}class Bf{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Bf.prototype.normal={};Bf.prototype.property={};Bf.prototype.space=void 0;function P$(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Bf(n,r,t)}function Yw(e){return e.toLowerCase()}class ar{constructor(t,n){this.attribute=n,this.property=t}}ar.prototype.attribute="";ar.prototype.booleanish=!1;ar.prototype.boolean=!1;ar.prototype.commaOrSpaceSeparated=!1;ar.prototype.commaSeparated=!1;ar.prototype.defined=!1;ar.prototype.mustUseProperty=!1;ar.prototype.number=!1;ar.prototype.overloadedBoolean=!1;ar.prototype.property="";ar.prototype.spaceSeparated=!1;ar.prototype.space=void 0;let Lre=0;const ze=pa(),Lt=pa(),Xw=pa(),ne=pa(),pt=pa(),au=pa(),cr=pa();function pa(){return 2**++Lre}const eb=Object.freeze(Object.defineProperty({__proto__:null,boolean:ze,booleanish:Lt,commaOrSpaceSeparated:cr,commaSeparated:au,number:ne,overloadedBoolean:Xw,spaceSeparated:pt},Symbol.toStringTag,{value:"Module"})),uv=Object.keys(eb);class sS extends ar{constructor(t,n,r,s){let i=-1;if(super(t,n),RR(this,"space",s),typeof r=="number")for(;++i<uv.length;){const o=uv[i];RR(this,uv[i],(r&eb[o])===eb[o])}}}sS.prototype.defined=!0;function RR(e,t,n){n&&(e[t]=n)}function dc(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new sS(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Yw(r)]=r,n[Yw(i.attribute)]=r}return new Bf(t,n,e.space)}const A$=dc({properties:{ariaActiveDescendant:null,ariaAtomic:Lt,ariaAutoComplete:null,ariaBusy:Lt,ariaChecked:Lt,ariaColCount:ne,ariaColIndex:ne,ariaColSpan:ne,ariaControls:pt,ariaCurrent:null,ariaDescribedBy:pt,ariaDetails:null,ariaDisabled:Lt,ariaDropEffect:pt,ariaErrorMessage:null,ariaExpanded:Lt,ariaFlowTo:pt,ariaGrabbed:Lt,ariaHasPopup:null,ariaHidden:Lt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:pt,ariaLevel:ne,ariaLive:null,ariaModal:Lt,ariaMultiLine:Lt,ariaMultiSelectable:Lt,ariaOrientation:null,ariaOwns:pt,ariaPlaceholder:null,ariaPosInSet:ne,ariaPressed:Lt,ariaReadOnly:Lt,ariaRelevant:null,ariaRequired:Lt,ariaRoleDescription:pt,ariaRowCount:ne,ariaRowIndex:ne,ariaRowSpan:ne,ariaSelected:Lt,ariaSetSize:ne,ariaSort:null,ariaValueMax:ne,ariaValueMin:ne,ariaValueNow:ne,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function _$(e,t){return t in e?e[t]:t}function I$(e,t){return _$(e,t.toLowerCase())}const $re=dc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:au,acceptCharset:pt,accessKey:pt,action:null,allow:null,allowFullScreen:ze,allowPaymentRequest:ze,allowUserMedia:ze,alt:null,as:null,async:ze,autoCapitalize:null,autoComplete:pt,autoFocus:ze,autoPlay:ze,blocking:pt,capture:null,charSet:null,checked:ze,cite:null,className:pt,cols:ne,colSpan:null,content:null,contentEditable:Lt,controls:ze,controlsList:pt,coords:ne|au,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ze,defer:ze,dir:null,dirName:null,disabled:ze,download:Xw,draggable:Lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ze,formTarget:null,headers:pt,height:ne,hidden:Xw,high:ne,href:null,hrefLang:null,htmlFor:pt,httpEquiv:pt,id:null,imageSizes:null,imageSrcSet:null,inert:ze,inputMode:null,integrity:null,is:null,isMap:ze,itemId:null,itemProp:pt,itemRef:pt,itemScope:ze,itemType:pt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ze,low:ne,manifest:null,max:null,maxLength:ne,media:null,method:null,min:null,minLength:ne,multiple:ze,muted:ze,name:null,nonce:null,noModule:ze,noValidate:ze,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ze,optimum:ne,pattern:null,ping:pt,placeholder:null,playsInline:ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ze,referrerPolicy:null,rel:pt,required:ze,reversed:ze,rows:ne,rowSpan:ne,sandbox:pt,scope:null,scoped:ze,seamless:ze,selected:ze,shadowRootClonable:ze,shadowRootDelegatesFocus:ze,shadowRootMode:null,shape:null,size:ne,sizes:null,slot:null,span:ne,spellCheck:Lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ne,step:null,style:null,tabIndex:ne,target:null,title:null,translate:null,type:null,typeMustMatch:ze,useMap:null,value:Lt,width:ne,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:pt,axis:null,background:null,bgColor:null,border:ne,borderColor:null,bottomMargin:ne,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ze,declare:ze,event:null,face:null,frame:null,frameBorder:null,hSpace:ne,leftMargin:ne,link:null,longDesc:null,lowSrc:null,marginHeight:ne,marginWidth:ne,noResize:ze,noHref:ze,noShade:ze,noWrap:ze,object:null,profile:null,prompt:null,rev:null,rightMargin:ne,rules:null,scheme:null,scrolling:Lt,standby:null,summary:null,text:null,topMargin:ne,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ne,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ze,disableRemotePlayback:ze,prefix:null,property:null,results:ne,security:null,unselectable:null},space:"html",transform:I$}),zre=dc({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:cr,accentHeight:ne,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ne,amplitude:ne,arabicForm:null,ascent:ne,attributeName:null,attributeType:null,azimuth:ne,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ne,by:null,calcMode:null,capHeight:ne,className:pt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ne,diffuseConstant:ne,direction:null,display:null,dur:null,divisor:ne,dominantBaseline:null,download:ze,dx:null,dy:null,edgeMode:null,editable:null,elevation:ne,enableBackground:null,end:null,event:null,exponent:ne,externalResourcesRequired:null,fill:null,fillOpacity:ne,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:au,g2:au,glyphName:au,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ne,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ne,horizOriginX:ne,horizOriginY:ne,id:null,ideographic:ne,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ne,k:ne,k1:ne,k2:ne,k3:ne,k4:ne,kernelMatrix:cr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ne,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ne,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ne,overlineThickness:ne,paintOrder:null,panose1:null,path:null,pathLength:ne,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:pt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ne,pointsAtY:ne,pointsAtZ:ne,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:cr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:cr,rev:cr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:cr,requiredFeatures:cr,requiredFonts:cr,requiredFormats:cr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ne,specularExponent:ne,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ne,strikethroughThickness:ne,string:null,stroke:null,strokeDashArray:cr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ne,strokeOpacity:ne,strokeWidth:null,style:null,surfaceScale:ne,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:cr,tabIndex:ne,tableValues:null,target:null,targetX:ne,targetY:ne,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:cr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ne,underlineThickness:ne,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ne,values:null,vAlphabetic:ne,vMathematical:ne,vectorEffect:null,vHanging:ne,vIdeographic:ne,version:null,vertAdvY:ne,vertOriginX:ne,vertOriginY:ne,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ne,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:_$}),D$=dc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),L$=dc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:I$}),$$=dc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Fre={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Bre=/[A-Z]/g,MR=/-[a-z]/g,Vre=/^data[-\w.:]+$/i;function Hre(e,t){const n=Yw(t);let r=t,s=ar;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Vre.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(MR,qre);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!MR.test(i)){let o=i.replace(Bre,Ure);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=sS}return new s(r,t)}function Ure(e){return"-"+e.toLowerCase()}function qre(e){return e.charAt(1).toUpperCase()}const Wre=P$([A$,$re,D$,L$,$$],"html"),iS=P$([A$,zre,D$,L$,$$],"svg");function Kre(e){return e.join(" ").trim()}var oS={},OR=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Qre=/\n/g,Gre=/^\s*/,Jre=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Zre=/^:\s*/,Yre=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Xre=/^[;\s]*/,ese=/^\s+|\s+$/g,tse=`
|
|
594
|
+
`,jR="/",PR="*",gl="",nse="comment",rse="declaration";function sse(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(m){var g=m.match(Qre);g&&(n+=g.length);var v=m.lastIndexOf(tse);r=~v?m.length-v:r+m.length}function i(){var m={line:n,column:r};return function(g){return g.position=new o(m),u(),g}}function o(m){this.start=m,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function l(m){var g=new Error(t.source+":"+n+":"+r+": "+m);if(g.reason=m,g.filename=t.source,g.line=n,g.column=r,g.source=e,!t.silent)throw g}function a(m){var g=m.exec(e);if(g){var v=g[0];return s(v),e=e.slice(v.length),g}}function u(){a(Gre)}function c(m){var g;for(m=m||[];g=d();)g!==!1&&m.push(g);return m}function d(){var m=i();if(!(jR!=e.charAt(0)||PR!=e.charAt(1))){for(var g=2;gl!=e.charAt(g)&&(PR!=e.charAt(g)||jR!=e.charAt(g+1));)++g;if(g+=2,gl===e.charAt(g-1))return l("End of comment missing");var v=e.slice(2,g-2);return r+=2,s(v),e=e.slice(g),r+=2,m({type:nse,comment:v})}}function h(){var m=i(),g=a(Jre);if(g){if(d(),!a(Zre))return l("property missing ':'");var v=a(Yre),y=m({type:rse,property:AR(g[0].replace(OR,gl)),value:v?AR(v[0].replace(OR,gl)):gl});return a(Xre),y}}function f(){var m=[];c(m);for(var g;g=h();)g!==!1&&(m.push(g),c(m));return m}return u(),f()}function AR(e){return e?e.replace(ese,gl):gl}var ise=sse,ose=Rp&&Rp.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(oS,"__esModule",{value:!0});oS.default=ase;const lse=ose(ise);function ase(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,lse.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:l}=i;s?t(o,l,i):l&&(n=n||{},n[o]=l)}),n}var Ey={};Object.defineProperty(Ey,"__esModule",{value:!0});Ey.camelCase=void 0;var use=/^--[a-zA-Z0-9_-]+$/,cse=/-([a-z])/g,dse=/^[^-]+$/,fse=/^-(webkit|moz|ms|o|khtml)-/,hse=/^-(ms)-/,pse=function(e){return!e||dse.test(e)||use.test(e)},mse=function(e,t){return t.toUpperCase()},_R=function(e,t){return"".concat(t,"-")},gse=function(e,t){return t===void 0&&(t={}),pse(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(hse,_R):e=e.replace(fse,_R),e.replace(cse,mse))};Ey.camelCase=gse;var yse=Rp&&Rp.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},xse=yse(oS),vse=Ey;function tb(e,t){var n={};return!e||typeof e!="string"||(0,xse.default)(e,function(r,s){r&&s&&(n[(0,vse.camelCase)(r,t)]=s)}),n}tb.default=tb;var wse=tb;const bse=yg(wse),z$=F$("end"),lS=F$("start");function F$(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function kse(e){const t=lS(e),n=z$(e);if(t&&n)return{start:t,end:n}}function md(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?IR(e.position):"start"in e||"end"in e?IR(e):"line"in e||"column"in e?nb(e):""}function nb(e){return DR(e&&e.line)+":"+DR(e&&e.column)}function IR(e){return nb(e&&e.start)+"-"+nb(e&&e.end)}function DR(e){return e&&typeof e=="number"?e:1}class Pn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(o=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const a=r.indexOf(":");a===-1?i.ruleId=r:(i.source=r.slice(0,a),i.ruleId=r.slice(a+1))}if(!i.place&&i.ancestors&&i.ancestors){const a=i.ancestors[i.ancestors.length-1];a&&(i.place=a.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=md(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Pn.prototype.file="";Pn.prototype.name="";Pn.prototype.reason="";Pn.prototype.message="";Pn.prototype.stack="";Pn.prototype.column=void 0;Pn.prototype.line=void 0;Pn.prototype.ancestors=void 0;Pn.prototype.cause=void 0;Pn.prototype.fatal=void 0;Pn.prototype.place=void 0;Pn.prototype.ruleId=void 0;Pn.prototype.source=void 0;const aS={}.hasOwnProperty,Sse=new Map,Cse=/[A-Z]/g,Ese=new Set(["table","tbody","thead","tfoot","tr"]),Nse=new Set(["td","th"]),B$="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Tse(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Ise(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=_se(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?iS:Wre,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=V$(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function V$(e,t,n){if(t.type==="element")return Rse(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Mse(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return jse(e,t,n);if(t.type==="mdxjsEsm")return Ose(e,t);if(t.type==="root")return Pse(e,t,n);if(t.type==="text")return Ase(e,t)}function Rse(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=iS,e.schema=s),e.ancestors.push(t);const i=U$(e,t.tagName,!1),o=Dse(e,t);let l=cS(e,t);return Ese.has(t.tagName)&&(l=l.filter(function(a){return typeof a=="string"?!Dre(a):!0})),H$(e,o,i,t),uS(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function Mse(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}uf(e,t.position)}function Ose(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);uf(e,t.position)}function jse(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=iS,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:U$(e,t.name,!0),o=Lse(e,t),l=cS(e,t);return H$(e,o,i,t),uS(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function Pse(e,t,n){const r={};return uS(r,cS(e,t)),e.create(t,e.Fragment,r,n)}function Ase(e,t){return t.value}function H$(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function uS(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function _se(e,t,n){return r;function r(s,i,o,l){const u=Array.isArray(o.children)?n:t;return l?u(i,o,l):u(i,o)}}function Ise(e,t){return n;function n(r,s,i,o){const l=Array.isArray(i.children),a=lS(r);return t(s,i,o,l,{columnNumber:a?a.column-1:void 0,fileName:e,lineNumber:a?a.line:void 0},void 0)}}function Dse(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&aS.call(t.properties,s)){const i=$se(e,s,t.properties[s]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&Nse.has(t.tagName)?r=l:n[o]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Lse(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else uf(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else uf(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function cS(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:Sse;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const a=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(a){const u=s.get(a)||0;o=a+"-"+u,s.set(a,u+1)}}const l=V$(e,i,o);l!==void 0&&n.push(l)}return n}function $se(e,t,n){const r=Hre(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?jre(n):Kre(n)),r.property==="style"){let s=typeof n=="object"?n:zse(e,String(n));return e.stylePropertyNameCase==="css"&&(s=Fse(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?Fre[r.property]||r.property:r.attribute,n]}}function zse(e,t){try{return bse(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Pn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=B$+"#cannot-parse-style-attribute",s}}function U$(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,o;for(;++i<s.length;){const l=NR(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=o}else r=NR(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return aS.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);uf(e)}function uf(e,t){const n=new Pn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=B$+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Fse(e){const t={};let n;for(n in e)aS.call(e,n)&&(t[Bse(n)]=e[n]);return t}function Bse(e){let t=e.replace(Cse,Vse);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Vse(e){return"-"+e.toLowerCase()}const cv={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Hse={};function Use(e,t){const n=Hse,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return q$(e,r,s)}function q$(e,t,n){if(qse(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return LR(e.children,t,n)}return Array.isArray(e)?LR(e,t,n):""}function LR(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=q$(e[s],t,n);return r.join("")}function qse(e){return!!(e&&typeof e=="object")}const $R=document.createElement("i");function dS(e){const t="&"+e+";";$R.innerHTML=t;const n=$R.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Gs(e,t,n,r){const s=e.length;let i=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function zr(e,t){return e.length>0?(Gs(e,e.length,0,t),e):t}const zR={}.hasOwnProperty;function Wse(e){const t={};let n=-1;for(;++n<e.length;)Kse(t,e[n]);return t}function Kse(e,t){let n;for(n in t){const s=(zR.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){zR.call(s,o)||(s[o]=[]);const l=i[o];Qse(s[o],Array.isArray(l)?l:l?[l]:[])}}}function Qse(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Gs(e,0,0,r)}function W$(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function uu(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const $s=ll(/[A-Za-z]/),gr=ll(/[\dA-Za-z]/),Gse=ll(/[#-'*+\--9=?A-Z^-~]/);function rb(e){return e!==null&&(e<32||e===127)}const sb=ll(/\d/),Jse=ll(/[\dA-Fa-f]/),Zse=ll(/[!-/:-@[-`{-~]/);function Ie(e){return e!==null&&e<-2}function ir(e){return e!==null&&(e<0||e===32)}function rt(e){return e===-2||e===-1||e===32}const Yse=ll(new RegExp("\\p{P}|\\p{S}","u")),Xse=ll(/\s/);function ll(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function fc(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&gr(e.charCodeAt(n+1))&&gr(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),s=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function yt(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(a){return rt(a)?(e.enter(n),l(a)):t(a)}function l(a){return rt(a)&&i++<s?(e.consume(a),l):(e.exit(n),t(a))}}const eie={tokenize:tie};function tie(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),yt(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),i(l)}function i(l){const a=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=a),n=a,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Ie(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const nie={tokenize:rie},FR={tokenize:sie};function rie(e){const t=this,n=[];let r=0,s,i,o;return l;function l(b){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,a,u)(b)}return u(b)}function a(b){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&w();const C=t.events.length;let S=C,k;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){k=t.events[S][1].end;break}y(r);let E=C;for(;E<t.events.length;)t.events[E][1].end={...k},E++;return Gs(t.events,S+1,0,t.events.slice(C)),t.events.length=E,u(b)}return l(b)}function u(b){if(r===n.length){if(!s)return h(b);if(s.currentConstruct&&s.currentConstruct.concrete)return m(b);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(FR,c,d)(b)}function c(b){return s&&w(),y(r),h(b)}function d(b){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(b)}function h(b){return t.containerState={},e.attempt(FR,f,m)(b)}function f(b){return r++,n.push([t.currentConstruct,t.containerState]),h(b)}function m(b){if(b===null){s&&w(),y(0),e.consume(b);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),g(b)}function g(b){if(b===null){v(e.exit("chunkFlow"),!0),y(0),e.consume(b);return}return Ie(b)?(e.consume(b),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(b),g)}function v(b,C){const S=t.sliceStream(b);if(C&&S.push(null),b.previous=i,i&&(i.next=b),i=b,s.defineSkip(b.start),s.write(S),t.parser.lazy[b.start.line]){let k=s.events.length;for(;k--;)if(s.events[k][1].start.offset<o&&(!s.events[k][1].end||s.events[k][1].end.offset>o))return;const E=t.events.length;let N=E,O,T;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){if(O){T=t.events[N][1].end;break}O=!0}for(y(r),k=E;k<t.events.length;)t.events[k][1].end={...T},k++;Gs(t.events,N+1,0,t.events.slice(E)),t.events.length=k}}function y(b){let C=n.length;for(;C-- >b;){const S=n[C];t.containerState=S[1],S[0].exit.call(t,e)}n.length=b}function w(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function sie(e,t,n){return yt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function BR(e){if(e===null||ir(e)||Xse(e))return 1;if(Yse(e))return 2}function fS(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const ib={name:"attention",resolveAll:iie,tokenize:oie};function iie(e,t){let n=-1,r,s,i,o,l,a,u,c;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;a=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},h={...e[n][1].start};VR(d,-a),VR(h,a),o={type:a>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},l={type:a>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},i={type:a>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:a>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=zr(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=zr(u,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=zr(u,fS(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=zr(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=zr(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,Gs(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function oie(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=BR(r);let i;return o;function o(a){return i=a,e.enter("attentionSequence"),l(a)}function l(a){if(a===i)return e.consume(a),l;const u=e.exit("attentionSequence"),c=BR(a),d=!c||c===2&&s||n.includes(a),h=!s||s===2&&c||n.includes(r);return u._open=!!(i===42?d:d&&(s||!h)),u._close=!!(i===42?h:h&&(c||!d)),t(a)}}function VR(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const lie={name:"autolink",tokenize:aie};function aie(e,t,n){let r=0;return s;function s(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(f){return $s(f)?(e.consume(f),o):f===64?n(f):u(f)}function o(f){return f===43||f===45||f===46||gr(f)?(r=1,l(f)):u(f)}function l(f){return f===58?(e.consume(f),r=0,a):(f===43||f===45||f===46||gr(f))&&r++<32?(e.consume(f),l):(r=0,u(f))}function a(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||rb(f)?n(f):(e.consume(f),a)}function u(f){return f===64?(e.consume(f),c):Gse(f)?(e.consume(f),u):n(f)}function c(f){return gr(f)?d(f):n(f)}function d(f){return f===46?(e.consume(f),r=0,c):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):h(f)}function h(f){if((f===45||gr(f))&&r++<63){const m=f===45?h:d;return e.consume(f),m}return n(f)}}const Ny={partial:!0,tokenize:uie};function uie(e,t,n){return r;function r(i){return rt(i)?yt(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||Ie(i)?t(i):n(i)}}const K$={continuation:{tokenize:die},exit:fie,name:"blockQuote",tokenize:cie};function cie(e,t,n){const r=this;return s;function s(o){if(o===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return rt(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function die(e,t,n){const r=this;return s;function s(o){return rt(o)?yt(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(K$,t,n)(o)}}function fie(e){e.exit("blockQuote")}const Q$={name:"characterEscape",tokenize:hie};function hie(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return Zse(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const G$={name:"characterReference",tokenize:pie};function pie(e,t,n){const r=this;let s=0,i,o;return l;function l(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),a}function a(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=gr,c(d))}function u(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=Jse,c):(e.enter("characterReferenceValue"),i=7,o=sb,c(d))}function c(d){if(d===59&&s){const h=e.exit("characterReferenceValue");return o===gr&&!dS(r.sliceSerialize(h))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&s++<i?(e.consume(d),c):n(d)}}const HR={partial:!0,tokenize:gie},UR={concrete:!0,name:"codeFenced",tokenize:mie};function mie(e,t,n){const r=this,s={partial:!0,tokenize:S};let i=0,o=0,l;return a;function a(k){return u(k)}function u(k){const E=r.events[r.events.length-1];return i=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,l=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(k)}function c(k){return k===l?(o++,e.consume(k),c):o<3?n(k):(e.exit("codeFencedFenceSequence"),rt(k)?yt(e,d,"whitespace")(k):d(k))}function d(k){return k===null||Ie(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(HR,g,C)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(k))}function h(k){return k===null||Ie(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(k)):rt(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),yt(e,f,"whitespace")(k)):k===96&&k===l?n(k):(e.consume(k),h)}function f(k){return k===null||Ie(k)?d(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||Ie(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(k)):k===96&&k===l?n(k):(e.consume(k),m)}function g(k){return e.attempt(s,C,v)(k)}function v(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),y}function y(k){return i>0&&rt(k)?yt(e,w,"linePrefix",i+1)(k):w(k)}function w(k){return k===null||Ie(k)?e.check(HR,g,C)(k):(e.enter("codeFlowValue"),b(k))}function b(k){return k===null||Ie(k)?(e.exit("codeFlowValue"),w(k)):(e.consume(k),b)}function C(k){return e.exit("codeFenced"),t(k)}function S(k,E,N){let O=0;return T;function T(L){return k.enter("lineEnding"),k.consume(L),k.exit("lineEnding"),j}function j(L){return k.enter("codeFencedFence"),rt(L)?yt(k,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):A(L)}function A(L){return L===l?(k.enter("codeFencedFenceSequence"),z(L)):N(L)}function z(L){return L===l?(O++,k.consume(L),z):O>=o?(k.exit("codeFencedFenceSequence"),rt(L)?yt(k,D,"whitespace")(L):D(L)):N(L)}function D(L){return L===null||Ie(L)?(k.exit("codeFencedFence"),E(L)):N(L)}}}function gie(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const dv={name:"codeIndented",tokenize:xie},yie={partial:!0,tokenize:vie};function xie(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),yt(e,i,"linePrefix",5)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?a(u):Ie(u)?e.attempt(yie,o,a)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||Ie(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function a(u){return e.exit("codeIndented"),t(u)}}function vie(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):Ie(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):yt(e,i,"linePrefix",5)(o)}function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):Ie(o)?s(o):n(o)}}const wie={name:"codeText",previous:kie,resolve:bie,tokenize:Sie};function bie(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function kie(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Sie(e,t,n){let r=0,s,i;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),l(d)}function l(d){return d===96?(e.consume(d),r++,l):(e.exit("codeTextSequence"),a(d))}function a(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),a):d===96?(i=e.enter("codeTextSequence"),s=0,c(d)):Ie(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),a):(e.enter("codeTextData"),u(d))}function u(d){return d===null||d===32||d===96||Ie(d)?(e.exit("codeTextData"),a(d)):(e.consume(d),u)}function c(d){return d===96?(e.consume(d),s++,c):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(i.type="codeTextData",u(d))}}class Cie{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&jc(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),jc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),jc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);jc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);jc(this.left,n.reverse())}}}function jc(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function J$(e){const t={};let n=-1,r,s,i,o,l,a,u;const c=new Cie(e);for(;++n<c.length;){for(;n in t;)n=t[n];if(r=c.get(n),n&&r[1].type==="chunkFlow"&&c.get(n-1)[1].type==="listItemPrefix"&&(a=r[1]._tokenizer.events,i=0,i<a.length&&a[i][1].type==="lineEndingBlank"&&(i+=2),i<a.length&&a[i][1].type==="content"))for(;++i<a.length&&a[i][1].type!=="content";)a[i][1].type==="chunkText"&&(a[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Eie(c,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=c.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(c.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...c.get(s)[1].start},l=c.slice(s,n),l.unshift(r),c.splice(s,n-s+1,l))}}return Gs(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function Eie(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,a=[],u={};let c,d,h=-1,f=n,m=0,g=0;const v=[g];for(;f;){for(;e.get(++s)[1]!==f;);i.push(s),f._tokenizer||(c=r.sliceStream(f),f.next||c.push(null),d&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(c),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=n;++h<l.length;)l[h][0]==="exit"&&l[h-1][0]==="enter"&&l[h][1].type===l[h-1][1].type&&l[h][1].start.line!==l[h][1].end.line&&(g=h+1,v.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):v.pop(),h=v.length;h--;){const y=l.slice(v[h],v[h+1]),w=i.pop();a.push([w,w+y.length-1]),e.splice(w,2,y)}for(a.reverse(),h=-1;++h<a.length;)u[m+a[h][0]]=m+a[h][1],m+=a[h][1]-a[h][0]-1;return u}const Nie={resolve:Rie,tokenize:Mie},Tie={partial:!0,tokenize:Oie};function Rie(e){return J$(e),e}function Mie(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):Ie(l)?e.check(Tie,o,i)(l):(e.consume(l),s)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function Oie(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),yt(e,i,"linePrefix")}function i(o){if(o===null||Ie(o))return n(o);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function Z$(e,t,n,r,s,i,o,l,a){const u=a||Number.POSITIVE_INFINITY;let c=0;return d;function d(y){return y===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(y),e.exit(i),h):y===null||y===32||y===41||rb(y)?n(y):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),g(y))}function h(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===62?(e.exit("chunkString"),e.exit(l),h(y)):y===null||y===60||Ie(y)?n(y):(e.consume(y),y===92?m:f)}function m(y){return y===60||y===62||y===92?(e.consume(y),f):f(y)}function g(y){return!c&&(y===null||y===41||ir(y))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(y)):c<u&&y===40?(e.consume(y),c++,g):y===41?(e.consume(y),c--,g):y===null||y===32||y===40||rb(y)?n(y):(e.consume(y),y===92?v:g)}function v(y){return y===40||y===41||y===92?(e.consume(y),g):g(y)}}function Y$(e,t,n,r,s,i){const o=this;let l=0,a;return u;function u(f){return e.enter(r),e.enter(s),e.consume(f),e.exit(s),e.enter(i),c}function c(f){return l>999||f===null||f===91||f===93&&!a||f===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(e.exit(i),e.enter(s),e.consume(f),e.exit(s),e.exit(r),t):Ie(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||Ie(f)||l++>999?(e.exit("chunkString"),c(f)):(e.consume(f),a||(a=!rt(f)),f===92?h:d)}function h(f){return f===91||f===92||f===93?(e.consume(f),l++,d):d(f)}}function X$(e,t,n,r,s,i){let o;return l;function l(h){return h===34||h===39||h===40?(e.enter(r),e.enter(s),e.consume(h),e.exit(s),o=h===40?41:h,a):n(h)}function a(h){return h===o?(e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===o?(e.exit(i),a(o)):h===null?n(h):Ie(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),yt(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===o||h===null||Ie(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?d:c)}function d(h){return h===o||h===92?(e.consume(h),c):c(h)}}function gd(e,t){let n;return r;function r(s){return Ie(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):rt(s)?yt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const jie={name:"definition",tokenize:Aie},Pie={partial:!0,tokenize:_ie};function Aie(e,t,n){const r=this;let s;return i;function i(f){return e.enter("definition"),o(f)}function o(f){return Y$.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function l(f){return s=uu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),a):n(f)}function a(f){return ir(f)?gd(e,u)(f):u(f)}function u(f){return Z$(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function c(f){return e.attempt(Pie,d,d)(f)}function d(f){return rt(f)?yt(e,h,"whitespace")(f):h(f)}function h(f){return f===null||Ie(f)?(e.exit("definition"),r.parser.defined.push(s),t(f)):n(f)}}function _ie(e,t,n){return r;function r(l){return ir(l)?gd(e,s)(l):n(l)}function s(l){return X$(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return rt(l)?yt(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Ie(l)?t(l):n(l)}}const Iie={name:"hardBreakEscape",tokenize:Die};function Die(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return Ie(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const Lie={name:"headingAtx",resolve:$ie,tokenize:zie};function $ie(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Gs(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function zie(e,t,n){let r=0;return s;function s(c){return e.enter("atxHeading"),i(c)}function i(c){return e.enter("atxHeadingSequence"),o(c)}function o(c){return c===35&&r++<6?(e.consume(c),o):c===null||ir(c)?(e.exit("atxHeadingSequence"),l(c)):n(c)}function l(c){return c===35?(e.enter("atxHeadingSequence"),a(c)):c===null||Ie(c)?(e.exit("atxHeading"),t(c)):rt(c)?yt(e,l,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function a(c){return c===35?(e.consume(c),a):(e.exit("atxHeadingSequence"),l(c))}function u(c){return c===null||c===35||ir(c)?(e.exit("atxHeadingText"),l(c)):(e.consume(c),u)}}const Fie=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],qR=["pre","script","style","textarea"],Bie={concrete:!0,name:"htmlFlow",resolveTo:Uie,tokenize:qie},Vie={partial:!0,tokenize:Kie},Hie={partial:!0,tokenize:Wie};function Uie(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function qie(e,t,n){const r=this;let s,i,o,l,a;return u;function u(R){return c(R)}function c(R){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(R),d}function d(R){return R===33?(e.consume(R),h):R===47?(e.consume(R),i=!0,g):R===63?(e.consume(R),s=3,r.interrupt?t:M):$s(R)?(e.consume(R),o=String.fromCharCode(R),v):n(R)}function h(R){return R===45?(e.consume(R),s=2,f):R===91?(e.consume(R),s=5,l=0,m):$s(R)?(e.consume(R),s=4,r.interrupt?t:M):n(R)}function f(R){return R===45?(e.consume(R),r.interrupt?t:M):n(R)}function m(R){const I="CDATA[";return R===I.charCodeAt(l++)?(e.consume(R),l===I.length?r.interrupt?t:A:m):n(R)}function g(R){return $s(R)?(e.consume(R),o=String.fromCharCode(R),v):n(R)}function v(R){if(R===null||R===47||R===62||ir(R)){const I=R===47,V=o.toLowerCase();return!I&&!i&&qR.includes(V)?(s=1,r.interrupt?t(R):A(R)):Fie.includes(o.toLowerCase())?(s=6,I?(e.consume(R),y):r.interrupt?t(R):A(R)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):i?w(R):b(R))}return R===45||gr(R)?(e.consume(R),o+=String.fromCharCode(R),v):n(R)}function y(R){return R===62?(e.consume(R),r.interrupt?t:A):n(R)}function w(R){return rt(R)?(e.consume(R),w):T(R)}function b(R){return R===47?(e.consume(R),T):R===58||R===95||$s(R)?(e.consume(R),C):rt(R)?(e.consume(R),b):T(R)}function C(R){return R===45||R===46||R===58||R===95||gr(R)?(e.consume(R),C):S(R)}function S(R){return R===61?(e.consume(R),k):rt(R)?(e.consume(R),S):b(R)}function k(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),a=R,E):rt(R)?(e.consume(R),k):N(R)}function E(R){return R===a?(e.consume(R),a=null,O):R===null||Ie(R)?n(R):(e.consume(R),E)}function N(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||ir(R)?S(R):(e.consume(R),N)}function O(R){return R===47||R===62||rt(R)?b(R):n(R)}function T(R){return R===62?(e.consume(R),j):n(R)}function j(R){return R===null||Ie(R)?A(R):rt(R)?(e.consume(R),j):n(R)}function A(R){return R===45&&s===2?(e.consume(R),H):R===60&&s===1?(e.consume(R),K):R===62&&s===4?(e.consume(R),oe):R===63&&s===3?(e.consume(R),M):R===93&&s===5?(e.consume(R),Q):Ie(R)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(Vie,F,z)(R)):R===null||Ie(R)?(e.exit("htmlFlowData"),z(R)):(e.consume(R),A)}function z(R){return e.check(Hie,D,F)(R)}function D(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),L}function L(R){return R===null||Ie(R)?z(R):(e.enter("htmlFlowData"),A(R))}function H(R){return R===45?(e.consume(R),M):A(R)}function K(R){return R===47?(e.consume(R),o="",_):A(R)}function _(R){if(R===62){const I=o.toLowerCase();return qR.includes(I)?(e.consume(R),oe):A(R)}return $s(R)&&o.length<8?(e.consume(R),o+=String.fromCharCode(R),_):A(R)}function Q(R){return R===93?(e.consume(R),M):A(R)}function M(R){return R===62?(e.consume(R),oe):R===45&&s===2?(e.consume(R),M):A(R)}function oe(R){return R===null||Ie(R)?(e.exit("htmlFlowData"),F(R)):(e.consume(R),oe)}function F(R){return e.exit("htmlFlow"),t(R)}}function Wie(e,t,n){const r=this;return s;function s(o){return Ie(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function Kie(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Ny,t,n)}}const Qie={name:"htmlText",tokenize:Gie};function Gie(e,t,n){const r=this;let s,i,o;return l;function l(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),a}function a(M){return M===33?(e.consume(M),u):M===47?(e.consume(M),S):M===63?(e.consume(M),b):$s(M)?(e.consume(M),N):n(M)}function u(M){return M===45?(e.consume(M),c):M===91?(e.consume(M),i=0,m):$s(M)?(e.consume(M),w):n(M)}function c(M){return M===45?(e.consume(M),f):n(M)}function d(M){return M===null?n(M):M===45?(e.consume(M),h):Ie(M)?(o=d,K(M)):(e.consume(M),d)}function h(M){return M===45?(e.consume(M),f):d(M)}function f(M){return M===62?H(M):M===45?h(M):d(M)}function m(M){const oe="CDATA[";return M===oe.charCodeAt(i++)?(e.consume(M),i===oe.length?g:m):n(M)}function g(M){return M===null?n(M):M===93?(e.consume(M),v):Ie(M)?(o=g,K(M)):(e.consume(M),g)}function v(M){return M===93?(e.consume(M),y):g(M)}function y(M){return M===62?H(M):M===93?(e.consume(M),y):g(M)}function w(M){return M===null||M===62?H(M):Ie(M)?(o=w,K(M)):(e.consume(M),w)}function b(M){return M===null?n(M):M===63?(e.consume(M),C):Ie(M)?(o=b,K(M)):(e.consume(M),b)}function C(M){return M===62?H(M):b(M)}function S(M){return $s(M)?(e.consume(M),k):n(M)}function k(M){return M===45||gr(M)?(e.consume(M),k):E(M)}function E(M){return Ie(M)?(o=E,K(M)):rt(M)?(e.consume(M),E):H(M)}function N(M){return M===45||gr(M)?(e.consume(M),N):M===47||M===62||ir(M)?O(M):n(M)}function O(M){return M===47?(e.consume(M),H):M===58||M===95||$s(M)?(e.consume(M),T):Ie(M)?(o=O,K(M)):rt(M)?(e.consume(M),O):H(M)}function T(M){return M===45||M===46||M===58||M===95||gr(M)?(e.consume(M),T):j(M)}function j(M){return M===61?(e.consume(M),A):Ie(M)?(o=j,K(M)):rt(M)?(e.consume(M),j):O(M)}function A(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),s=M,z):Ie(M)?(o=A,K(M)):rt(M)?(e.consume(M),A):(e.consume(M),D)}function z(M){return M===s?(e.consume(M),s=void 0,L):M===null?n(M):Ie(M)?(o=z,K(M)):(e.consume(M),z)}function D(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||ir(M)?O(M):(e.consume(M),D)}function L(M){return M===47||M===62||ir(M)?O(M):n(M)}function H(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function K(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),_}function _(M){return rt(M)?yt(e,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):Q(M)}function Q(M){return e.enter("htmlTextData"),o(M)}}const hS={name:"labelEnd",resolveAll:Xie,resolveTo:eoe,tokenize:toe},Jie={tokenize:noe},Zie={tokenize:roe},Yie={tokenize:soe};function Xie(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&Gs(e,0,e.length,n),e}function eoe(e,t){let n=e.length,r=0,s,i,o,l;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const a={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},c={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",a,t],["enter",u,t]],l=zr(l,e.slice(i+1,i+r+3)),l=zr(l,[["enter",c,t]]),l=zr(l,fS(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),l=zr(l,[["exit",c,t],e[o-2],e[o-1],["exit",u,t]]),l=zr(l,e.slice(o+1)),l=zr(l,[["exit",a,t]]),Gs(e,i,e.length,l),e}function toe(e,t,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(h){return i?i._inactive?d(h):(o=r.parser.defined.includes(uu(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),a):n(h)}function a(h){return h===40?e.attempt(Jie,c,o?c:d)(h):h===91?e.attempt(Zie,c,o?u:d)(h):o?c(h):d(h)}function u(h){return e.attempt(Yie,c,d)(h)}function c(h){return t(h)}function d(h){return i._balanced=!0,n(h)}}function noe(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),s}function s(d){return ir(d)?gd(e,i)(d):i(d)}function i(d){return d===41?c(d):Z$(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return ir(d)?gd(e,a)(d):c(d)}function l(d){return n(d)}function a(d){return d===34||d===39||d===40?X$(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function u(d){return ir(d)?gd(e,c)(d):c(d)}function c(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function roe(e,t,n){const r=this;return s;function s(l){return Y$.call(r,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(uu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function soe(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const ioe={name:"labelStartImage",resolveAll:hS.resolveAll,tokenize:ooe};function ooe(e,t,n){const r=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const loe={name:"labelStartLink",resolveAll:hS.resolveAll,tokenize:aoe};function aoe(e,t,n){const r=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const fv={name:"lineEnding",tokenize:uoe};function uoe(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),yt(e,t,"linePrefix")}}const Cp={name:"thematicBreak",tokenize:coe};function coe(e,t,n){let r=0,s;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return s=u,l(u)}function l(u){return u===s?(e.enter("thematicBreakSequence"),a(u)):r>=3&&(u===null||Ie(u))?(e.exit("thematicBreak"),t(u)):n(u)}function a(u){return u===s?(e.consume(u),r++,a):(e.exit("thematicBreakSequence"),rt(u)?yt(e,l,"whitespace")(u):l(u))}}const Gn={continuation:{tokenize:poe},exit:goe,name:"list",tokenize:hoe},doe={partial:!0,tokenize:yoe},foe={partial:!0,tokenize:moe};function hoe(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(f){const m=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:sb(f)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Cp,n,u)(f):u(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(f)}return n(f)}function a(f){return sb(f)&&++o<10?(e.consume(f),a):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),u(f)):n(f)}function u(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(Ny,r.interrupt?n:c,e.attempt(doe,h,d))}function c(f){return r.containerState.initialBlankLine=!0,i++,h(f)}function d(f){return rt(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),h):n(f)}function h(f){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function poe(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ny,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,yt(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!rt(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(foe,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,yt(e,e.attempt(Gn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function moe(e,t,n){const r=this;return yt(e,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function goe(e){e.exit(this.containerState.type)}function yoe(e,t,n){const r=this;return yt(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!rt(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const WR={name:"setextUnderline",resolveTo:xoe,tokenize:voe};function xoe(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function voe(e,t,n){const r=this;let s;return i;function i(u){let c=r.events.length,d;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){d=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),s=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),rt(u)?yt(e,a,"lineSuffix")(u):a(u))}function a(u){return u===null||Ie(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const woe={tokenize:boe};function boe(e){const t=this,n=e.attempt(Ny,r,e.attempt(this.parser.constructs.flowInitial,s,yt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(Nie,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const koe={resolveAll:tz()},Soe=ez("string"),Coe=ez("text");function ez(e){return{resolveAll:tz(e==="text"?Eoe:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,o,l);return o;function o(c){return u(c)?i(c):l(c)}function l(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),a}function a(c){return u(c)?(n.exit("data"),i(c)):(n.consume(c),a)}function u(c){if(c===null)return!0;const d=s[c];let h=-1;if(d)for(;++h<d.length;){const f=d[h];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function tz(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function Eoe(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,o=-1,l=0,a;for(;i--;){const u=s[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(u===-2)a=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||a||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const Noe={42:Gn,43:Gn,45:Gn,48:Gn,49:Gn,50:Gn,51:Gn,52:Gn,53:Gn,54:Gn,55:Gn,56:Gn,57:Gn,62:K$},Toe={91:jie},Roe={[-2]:dv,[-1]:dv,32:dv},Moe={35:Lie,42:Cp,45:[WR,Cp],60:Bie,61:WR,95:Cp,96:UR,126:UR},Ooe={38:G$,92:Q$},joe={[-5]:fv,[-4]:fv,[-3]:fv,33:ioe,38:G$,42:ib,60:[lie,Qie],91:loe,92:[Iie,Q$],93:hS,95:ib,96:wie},Poe={null:[ib,koe]},Aoe={null:[42,95]},_oe={null:[]},Ioe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Aoe,contentInitial:Toe,disable:_oe,document:Noe,flow:Moe,flowInitial:Roe,insideSpan:Poe,string:Ooe,text:joe},Symbol.toStringTag,{value:"Module"}));function Doe(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let o=[],l=[];const a={attempt:E(S),check:E(k),consume:w,enter:b,exit:C,interrupt:E(k,{interrupt:!0})},u={code:null,containerState:{},defineSkip:g,events:[],now:m,parser:e,previous:null,sliceSerialize:h,sliceStream:f,write:d};let c=t.tokenize.call(u,a);return t.resolveAll&&i.push(t),u;function d(j){return o=zr(o,j),v(),o[o.length-1]!==null?[]:(N(t,0),u.events=fS(i,u.events,u),u.events)}function h(j,A){return $oe(f(j),A)}function f(j){return Loe(o,j)}function m(){const{_bufferIndex:j,_index:A,line:z,column:D,offset:L}=r;return{_bufferIndex:j,_index:A,line:z,column:D,offset:L}}function g(j){s[j.line]=j.column,T()}function v(){let j;for(;r._index<o.length;){const A=o[r._index];if(typeof A=="string")for(j=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===j&&r._bufferIndex<A.length;)y(A.charCodeAt(r._bufferIndex));else y(A)}}function y(j){c=c(j)}function w(j){Ie(j)?(r.line++,r.column=1,r.offset+=j===-3?2:1,T()):j!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=j}function b(j,A){const z=A||{};return z.type=j,z.start=m(),u.events.push(["enter",z,u]),l.push(z),z}function C(j){const A=l.pop();return A.end=m(),u.events.push(["exit",A,u]),A}function S(j,A){N(j,A.from)}function k(j,A){A.restore()}function E(j,A){return z;function z(D,L,H){let K,_,Q,M;return Array.isArray(D)?F(D):"tokenize"in D?F([D]):oe(D);function oe(Y){return G;function G(me){const we=me!==null&&Y[me],qe=me!==null&&Y.null,ut=[...Array.isArray(we)?we:we?[we]:[],...Array.isArray(qe)?qe:qe?[qe]:[]];return F(ut)(me)}}function F(Y){return K=Y,_=0,Y.length===0?H:R(Y[_])}function R(Y){return G;function G(me){return M=O(),Q=Y,Y.partial||(u.currentConstruct=Y),Y.name&&u.parser.constructs.disable.null.includes(Y.name)?V():Y.tokenize.call(A?Object.assign(Object.create(u),A):u,a,I,V)(me)}}function I(Y){return j(Q,M),L}function V(Y){return M.restore(),++_<K.length?R(K[_]):H}}}function N(j,A){j.resolveAll&&!i.includes(j)&&i.push(j),j.resolve&&Gs(u.events,A,u.events.length-A,j.resolve(u.events.slice(A),u)),j.resolveTo&&(u.events=j.resolveTo(u.events,u))}function O(){const j=m(),A=u.previous,z=u.currentConstruct,D=u.events.length,L=Array.from(l);return{from:D,restore:H};function H(){r=j,u.previous=A,u.currentConstruct=z,u.events.length=D,l=L,T()}}function T(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function Loe(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(r,i)];else{if(o=e.slice(n,s),r>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}i>0&&o.push(e[s].slice(0,i))}return o}function $oe(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
|
|
595
|
+
`;break}case-3:{o=`\r
|
|
596
|
+
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,r.push(o)}return r.join("")}function zoe(e){const r={constructs:Wse([Ioe,...(e||{}).extensions||[]]),content:s(eie),defined:[],document:s(nie),flow:s(woe),lazy:{},string:s(Soe),text:s(Coe)};return r;function s(i){return o;function o(l){return Doe(r,i,l)}}}function Foe(e){for(;!J$(e););return e}const KR=/[\0\t\n\r]/g;function Boe(){let e=1,t="",n=!0,r;return s;function s(i,o,l){const a=[];let u,c,d,h,f;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(KR.lastIndex=d,u=KR.exec(i),h=u&&u.index!==void 0?u.index:i.length,f=i.charCodeAt(h),!u){t=i.slice(d);break}if(f===10&&d===h&&r)a.push(-3),r=void 0;else switch(r&&(a.push(-5),r=void 0),d<h&&(a.push(i.slice(d,h)),e+=h-d),f){case 0:{a.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,a.push(-2);e++<c;)a.push(-1);break}case 10:{a.push(-4),e=1;break}default:r=!0,e=1}d=h+1}return l&&(r&&a.push(-5),t&&a.push(t),a.push(null)),a}}const Voe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Hoe(e){return e.replace(Voe,Uoe)}function Uoe(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return W$(n.slice(i?2:1),i?16:10)}return dS(n)||e}const nz={}.hasOwnProperty;function qoe(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Woe(n)(Foe(zoe(n).document().write(Boe()(e,t,!0))))}function Woe(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(dt),autolinkProtocol:O,autolinkEmail:O,atxHeading:i(sn),blockQuote:i(qe),characterEscape:O,characterReference:O,codeFenced:i(ut),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(ut,o),codeText:i(rn,o),codeTextData:O,data:O,codeFlowValue:O,definition:i(Le),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Dt),hardBreakEscape:i(ct),hardBreakTrailing:i(ct),htmlFlow:i(ur,o),htmlFlowData:O,htmlText:i(ur,o),htmlTextData:O,image:i(Mr),label:o,link:i(dt),listItem:i(Li),listItemValue:h,listOrdered:i(on,d),listUnordered:i(on),paragraph:i(hc),reference:R,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(sn),strong:i(Kn),thematicBreak:i(An)},exit:{atxHeading:a(),atxHeadingSequence:S,autolink:a(),autolinkEmail:we,autolinkProtocol:me,blockQuote:a(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:V,characterReferenceMarkerNumeric:V,characterReferenceValue:Y,characterReference:G,codeFenced:a(v),codeFencedFence:g,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:T,codeIndented:a(y),codeText:a(L),codeTextData:T,data:T,definition:a(),definitionDestinationString:C,definitionLabelString:w,definitionTitleString:b,emphasis:a(),hardBreakEscape:a(A),hardBreakTrailing:a(A),htmlFlow:a(z),htmlFlowData:T,htmlText:a(D),htmlTextData:T,image:a(K),label:Q,labelText:_,lineEnding:j,link:a(H),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:I,resourceDestinationString:M,resourceTitleString:oe,resource:F,setextHeading:a(N),setextHeadingLineSequence:E,setextHeadingText:k,strong:a(),thematicBreak:a()}};rz(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(U){let ie={type:"root",children:[]};const Ae={stack:[ie],tokenStack:[],config:t,enter:l,exit:u,buffer:o,resume:c,data:n},Fe=[];let We=-1;for(;++We<U.length;)if(U[We][1].type==="listOrdered"||U[We][1].type==="listUnordered")if(U[We][0]==="enter")Fe.push(We);else{const gn=Fe.pop();We=s(U,gn,We)}for(We=-1;++We<U.length;){const gn=t[U[We][0]];nz.call(gn,U[We][1].type)&&gn[U[We][1].type].call(Object.assign({sliceSerialize:U[We][2].sliceSerialize},Ae),U[We][1])}if(Ae.tokenStack.length>0){const gn=Ae.tokenStack[Ae.tokenStack.length-1];(gn[1]||QR).call(Ae,void 0,gn[0])}for(ie.position={start:Fi(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:Fi(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},We=-1;++We<t.transforms.length;)ie=t.transforms[We](ie)||ie;return ie}function s(U,ie,Ae){let Fe=ie-1,We=-1,gn=!1,q,W,Ne,je;for(;++Fe<=Ae;){const be=U[Fe];switch(be[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{be[0]==="enter"?We++:We--,je=void 0;break}case"lineEndingBlank":{be[0]==="enter"&&(q&&!je&&!We&&!Ne&&(Ne=Fe),je=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:je=void 0}if(!We&&be[0]==="enter"&&be[1].type==="listItemPrefix"||We===-1&&be[0]==="exit"&&(be[1].type==="listUnordered"||be[1].type==="listOrdered")){if(q){let Ye=Fe;for(W=void 0;Ye--;){const ht=U[Ye];if(ht[1].type==="lineEnding"||ht[1].type==="lineEndingBlank"){if(ht[0]==="exit")continue;W&&(U[W][1].type="lineEndingBlank",gn=!0),ht[1].type="lineEnding",W=Ye}else if(!(ht[1].type==="linePrefix"||ht[1].type==="blockQuotePrefix"||ht[1].type==="blockQuotePrefixWhitespace"||ht[1].type==="blockQuoteMarker"||ht[1].type==="listItemIndent"))break}Ne&&(!W||Ne<W)&&(q._spread=!0),q.end=Object.assign({},W?U[W][1].start:be[1].end),U.splice(W||Fe,0,["exit",q,be[2]]),Fe++,Ae++}if(be[1].type==="listItemPrefix"){const Ye={type:"listItem",_spread:!1,start:Object.assign({},be[1].start),end:void 0};q=Ye,U.splice(Fe,0,["enter",Ye,be[2]]),Fe++,Ae++,Ne=void 0,je=!0}}}return U[ie][1]._spread=gn,Ae}function i(U,ie){return Ae;function Ae(Fe){l.call(this,U(Fe),Fe),ie&&ie.call(this,Fe)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(U,ie,Ae){this.stack[this.stack.length-1].children.push(U),this.stack.push(U),this.tokenStack.push([ie,Ae||void 0]),U.position={start:Fi(ie.start),end:void 0}}function a(U){return ie;function ie(Ae){U&&U.call(this,Ae),u.call(this,Ae)}}function u(U,ie){const Ae=this.stack.pop(),Fe=this.tokenStack.pop();if(Fe)Fe[0].type!==U.type&&(ie?ie.call(this,U,Fe[0]):(Fe[1]||QR).call(this,U,Fe[0]));else throw new Error("Cannot close `"+U.type+"` ("+md({start:U.start,end:U.end})+"): it’s not open");Ae.position.end=Fi(U.end)}function c(){return Use(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function h(U){if(this.data.expectingFirstListItemValue){const ie=this.stack[this.stack.length-2];ie.start=Number.parseInt(this.sliceSerialize(U),10),this.data.expectingFirstListItemValue=void 0}}function f(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.lang=U}function m(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.meta=U}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.value=U.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.value=U.replace(/(\r?\n|\r)$/g,"")}function w(U){const ie=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=ie,Ae.identifier=uu(this.sliceSerialize(U)).toLowerCase()}function b(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.title=U}function C(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.url=U}function S(U){const ie=this.stack[this.stack.length-1];if(!ie.depth){const Ae=this.sliceSerialize(U).length;ie.depth=Ae}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function E(U){const ie=this.stack[this.stack.length-1];ie.depth=this.sliceSerialize(U).codePointAt(0)===61?1:2}function N(){this.data.setextHeadingSlurpLineEnding=void 0}function O(U){const Ae=this.stack[this.stack.length-1].children;let Fe=Ae[Ae.length-1];(!Fe||Fe.type!=="text")&&(Fe=Qn(),Fe.position={start:Fi(U.start),end:void 0},Ae.push(Fe)),this.stack.push(Fe)}function T(U){const ie=this.stack.pop();ie.value+=this.sliceSerialize(U),ie.position.end=Fi(U.end)}function j(U){const ie=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ae=ie.children[ie.children.length-1];Ae.position.end=Fi(U.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ie.type)&&(O.call(this,U),T.call(this,U))}function A(){this.data.atHardBreak=!0}function z(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.value=U}function D(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.value=U}function L(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.value=U}function H(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=ie,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function K(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=ie,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function _(U){const ie=this.sliceSerialize(U),Ae=this.stack[this.stack.length-2];Ae.label=Hoe(ie),Ae.identifier=uu(ie).toLowerCase()}function Q(){const U=this.stack[this.stack.length-1],ie=this.resume(),Ae=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ae.type==="link"){const Fe=U.children;Ae.children=Fe}else Ae.alt=ie}function M(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.url=U}function oe(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.title=U}function F(){this.data.inReference=void 0}function R(){this.data.referenceType="collapsed"}function I(U){const ie=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=ie,Ae.identifier=uu(this.sliceSerialize(U)).toLowerCase(),this.data.referenceType="full"}function V(U){this.data.characterReferenceType=U.type}function Y(U){const ie=this.sliceSerialize(U),Ae=this.data.characterReferenceType;let Fe;Ae?(Fe=W$(ie,Ae==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Fe=dS(ie);const We=this.stack[this.stack.length-1];We.value+=Fe}function G(U){const ie=this.stack.pop();ie.position.end=Fi(U.end)}function me(U){T.call(this,U);const ie=this.stack[this.stack.length-1];ie.url=this.sliceSerialize(U)}function we(U){T.call(this,U);const ie=this.stack[this.stack.length-1];ie.url="mailto:"+this.sliceSerialize(U)}function qe(){return{type:"blockquote",children:[]}}function ut(){return{type:"code",lang:null,meta:null,value:""}}function rn(){return{type:"inlineCode",value:""}}function Le(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Dt(){return{type:"emphasis",children:[]}}function sn(){return{type:"heading",depth:0,children:[]}}function ct(){return{type:"break"}}function ur(){return{type:"html",value:""}}function Mr(){return{type:"image",title:null,url:"",alt:null}}function dt(){return{type:"link",title:null,url:"",children:[]}}function on(U){return{type:"list",ordered:U.type==="listOrdered",start:null,spread:U._spread,children:[]}}function Li(U){return{type:"listItem",spread:U._spread,checked:null,children:[]}}function hc(){return{type:"paragraph",children:[]}}function Kn(){return{type:"strong",children:[]}}function Qn(){return{type:"text",value:""}}function An(){return{type:"thematicBreak"}}}function Fi(e){return{line:e.line,column:e.column,offset:e.offset}}function rz(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?rz(e,r):Koe(e,r)}}function Koe(e,t){let n;for(n in t)if(nz.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function QR(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+md({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+md({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+md({start:t.start,end:t.end})+") is still open")}function Qoe(e){const t=this;t.parser=n;function n(r){return qoe(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Goe(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Joe(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
597
|
+
`}]}function Zoe(e,t){const n=t.value?t.value+`
|
|
598
|
+
`:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function Yoe(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Xoe(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ele(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=fc(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=i+1,l+=1,e.footnoteCounts.set(r,l);const a={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,a);const u={type:"element",tagName:"sup",properties:{},children:[a]};return e.patch(t,u),e.applyData(t,u)}function tle(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nle(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function sz(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function rle(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return sz(e,t);const s={src:fc(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function sle(e,t){const n={src:fc(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function ile(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function ole(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return sz(e,t);const s={href:fc(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function lle(e,t){const n={href:fc(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function ale(e,t,n){const r=e.all(t),s=n?ule(n):iz(t),i={},o=[];if(typeof t.checked=="boolean"){const c=r[0];let d;c&&c.type==="element"&&c.tagName==="p"?d=c:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const c=r[l];(s||l!==0||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
|
|
599
|
+
`}),c.type==="element"&&c.tagName==="p"&&!s?o.push(...c.children):o.push(c)}const a=r[r.length-1];a&&(s||a.type!=="element"||a.tagName!=="p")&&o.push({type:"text",value:`
|
|
600
|
+
`});const u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)}function ule(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=iz(n[r])}return t}function iz(e){const t=e.spread;return t??e.children.length>1}function cle(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const o=r[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function dle(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fle(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function hle(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ple(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=lS(t.children[1]),a=z$(t.children[t.children.length-1]);l&&a&&(o.position={start:l,end:a}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function mle(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let a=-1;const u=[];for(;++a<l;){const d=t.children[a],h={},f=o?o[a]:void 0;f&&(h.align=f);let m={type:"element",tagName:i,properties:h,children:[]};d&&(m.children=e.all(d),e.patch(d,m),m=e.applyData(d,m)),u.push(m)}const c={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,c),e.applyData(t,c)}function gle(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const GR=9,JR=32;function yle(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(ZR(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(ZR(t.slice(s),s>0,!1)),i.join("")}function ZR(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===GR||i===JR;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===GR||i===JR;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function xle(e,t){const n={type:"text",value:yle(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function vle(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const wle={blockquote:Goe,break:Joe,code:Zoe,delete:Yoe,emphasis:Xoe,footnoteReference:ele,heading:tle,html:nle,imageReference:rle,image:sle,inlineCode:ile,linkReference:ole,link:lle,listItem:ale,list:cle,paragraph:dle,root:fle,strong:hle,table:ple,tableCell:gle,tableRow:mle,text:xle,thematicBreak:vle,toml:zh,yaml:zh,definition:zh,footnoteDefinition:zh};function zh(){}const oz=-1,Ty=0,yd=1,Lm=2,pS=3,mS=4,gS=5,yS=6,lz=7,az=8,YR=typeof self=="object"?self:globalThis,ble=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,o]=t[s];switch(i){case Ty:case oz:return n(o,s);case yd:{const l=n([],s);for(const a of o)l.push(r(a));return l}case Lm:{const l=n({},s);for(const[a,u]of o)l[r(a)]=r(u);return l}case pS:return n(new Date(o),s);case mS:{const{source:l,flags:a}=o;return n(new RegExp(l,a),s)}case gS:{const l=n(new Map,s);for(const[a,u]of o)l.set(r(a),r(u));return l}case yS:{const l=n(new Set,s);for(const a of o)l.add(r(a));return l}case lz:{const{name:l,message:a}=o;return n(new YR[l](a),s)}case az:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new YR[i](o),s)};return r},XR=e=>ble(new Map,e)(0),Ta="",{toString:kle}={},{keys:Sle}=Object,Pc=e=>{const t=typeof e;if(t!=="object"||!e)return[Ty,t];const n=kle.call(e).slice(8,-1);switch(n){case"Array":return[yd,Ta];case"Object":return[Lm,Ta];case"Date":return[pS,Ta];case"RegExp":return[mS,Ta];case"Map":return[gS,Ta];case"Set":return[yS,Ta];case"DataView":return[yd,n]}return n.includes("Array")?[yd,n]:n.includes("Error")?[lz,n]:[Lm,n]},Fh=([e,t])=>e===Ty&&(t==="function"||t==="symbol"),Cle=(e,t,n,r)=>{const s=(o,l)=>{const a=r.push(o)-1;return n.set(l,a),a},i=o=>{if(n.has(o))return n.get(o);let[l,a]=Pc(o);switch(l){case Ty:{let c=o;switch(a){case"bigint":l=az,c=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+a);c=null;break;case"undefined":return s([oz],o)}return s([l,c],o)}case yd:{if(a){let h=o;return a==="DataView"?h=new Uint8Array(o.buffer):a==="ArrayBuffer"&&(h=new Uint8Array(o)),s([a,[...h]],o)}const c=[],d=s([l,c],o);for(const h of o)c.push(i(h));return d}case Lm:{if(a)switch(a){case"BigInt":return s([a,o.toString()],o);case"Boolean":case"Number":case"String":return s([a,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const c=[],d=s([l,c],o);for(const h of Sle(o))(e||!Fh(Pc(o[h])))&&c.push([i(h),i(o[h])]);return d}case pS:return s([l,o.toISOString()],o);case mS:{const{source:c,flags:d}=o;return s([l,{source:c,flags:d}],o)}case gS:{const c=[],d=s([l,c],o);for(const[h,f]of o)(e||!(Fh(Pc(h))||Fh(Pc(f))))&&c.push([i(h),i(f)]);return d}case yS:{const c=[],d=s([l,c],o);for(const h of o)(e||!Fh(Pc(h)))&&c.push(i(h));return d}}const{message:u}=o;return s([l,{name:a,message:u}],o)};return i},eM=(e,{json:t,lossy:n}={})=>{const r=[];return Cle(!(t||n),!!t,new Map,r)(e),r},$m=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?XR(eM(e,t)):structuredClone(e):(e,t)=>XR(eM(e,t));function Ele(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Nle(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Tle(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Ele,r=e.options.footnoteBackLabel||Nle,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let a=-1;for(;++a<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[a]);if(!u)continue;const c=e.all(u),d=String(u.identifier).toUpperCase(),h=fc(d.toLowerCase());let f=0;const m=[],g=e.footnoteCounts.get(d);for(;g!==void 0&&++f<=g;){m.length>0&&m.push({type:"text",value:" "});let w=typeof n=="string"?n:n(a,f);typeof w=="string"&&(w={type:"text",value:w}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(a,f),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const v=c[c.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const w=v.children[v.children.length-1];w&&w.type==="text"?w.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...m)}else c.push(...m);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(c,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...$m(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
601
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
|
|
602
|
+
`}]}}const uz=function(e){if(e==null)return jle;if(typeof e=="function")return Ry(e);if(typeof e=="object")return Array.isArray(e)?Rle(e):Mle(e);if(typeof e=="string")return Ole(e);throw new Error("Expected function, string, or object as test")};function Rle(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=uz(e[n]);return Ry(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function Mle(e){const t=e;return Ry(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function Ole(e){return Ry(t);function t(n){return n&&n.type===e}}function Ry(e){return t;function t(n,r,s){return!!(Ple(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function jle(){return!0}function Ple(e){return e!==null&&typeof e=="object"&&"type"in e}const cz=[],Ale=!0,tM=!1,_le="skip";function Ile(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=uz(s),o=r?-1:1;l(e,void 0,[])();function l(a,u,c){const d=a&&typeof a=="object"?a:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(a.type+(f?"<"+f+">":""))+")"})}return h;function h(){let f=cz,m,g,v;if((!t||i(a,u,c[c.length-1]||void 0))&&(f=Dle(n(a,c)),f[0]===tM))return f;if("children"in a&&a.children){const y=a;if(y.children&&f[0]!==_le)for(g=(r?y.children.length:-1)+o,v=c.concat(y);g>-1&&g<y.children.length;){const w=y.children[g];if(m=l(w,g,v)(),m[0]===tM)return m;g=typeof m[1]=="number"?m[1]:g+o}}return f}}}function Dle(e){return Array.isArray(e)?e:typeof e=="number"?[Ale,e]:e==null?cz:[e]}function dz(e,t,n,r){let s,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,s=n):(i=t,o=n,s=r),Ile(e,i,l,s);function l(a,u){const c=u[u.length-1],d=c?c.children.indexOf(a):void 0;return o(a,d,c)}}const ob={}.hasOwnProperty,Lle={};function $le(e,t){const n=t||Lle,r=new Map,s=new Map,i=new Map,o={...wle,...n.handlers},l={all:u,applyData:Fle,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:a,options:n,patch:zle,wrap:Vle};return dz(e,function(c){if(c.type==="definition"||c.type==="footnoteDefinition"){const d=c.type==="definition"?r:s,h=String(c.identifier).toUpperCase();d.has(h)||d.set(h,c)}}),l;function a(c,d){const h=c.type,f=l.handlers[h];if(ob.call(l.handlers,h)&&f)return f(l,c,d);if(l.options.passThrough&&l.options.passThrough.includes(h)){if("children"in c){const{children:g,...v}=c,y=$m(v);return y.children=l.all(c),y}return $m(c)}return(l.options.unknownHandler||Ble)(l,c,d)}function u(c){const d=[];if("children"in c){const h=c.children;let f=-1;for(;++f<h.length;){const m=l.one(h[f],c);if(m){if(f&&h[f-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=nM(m.value)),!Array.isArray(m)&&m.type==="element")){const g=m.children[0];g&&g.type==="text"&&(g.value=nM(g.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function zle(e,t){e.position&&(t.position=kse(e))}function Fle(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,$m(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function Ble(e,t){const n=t.data||{},r="value"in t&&!(ob.call(n,"hProperties")||ob.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Vle(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
603
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
604
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
605
|
+
`}),n}function nM(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function rM(e,t){const n=$le(e,t),r=n.one(e,void 0),s=Tle(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
|
|
606
|
+
`},s),i}function Hle(e,t){return e&&"run"in e?async function(n,r){const s=rM(n,{file:r,...t});await e.run(s,r)}:function(n,r){return rM(n,{file:r,...e||t})}}function sM(e){if(e)throw e}var Ep=Object.prototype.hasOwnProperty,fz=Object.prototype.toString,iM=Object.defineProperty,oM=Object.getOwnPropertyDescriptor,lM=function(t){return typeof Array.isArray=="function"?Array.isArray(t):fz.call(t)==="[object Array]"},aM=function(t){if(!t||fz.call(t)!=="[object Object]")return!1;var n=Ep.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Ep.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Ep.call(t,s)},uM=function(t,n){iM&&n.name==="__proto__"?iM(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},cM=function(t,n){if(n==="__proto__")if(Ep.call(t,n)){if(oM)return oM(t,n).value}else return;return t[n]},Ule=function e(){var t,n,r,s,i,o,l=arguments[0],a=1,u=arguments.length,c=!1;for(typeof l=="boolean"&&(c=l,l=arguments[1]||{},a=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});a<u;++a)if(t=arguments[a],t!=null)for(n in t)r=cM(l,n),s=cM(t,n),l!==s&&(c&&s&&(aM(s)||(i=lM(s)))?(i?(i=!1,o=r&&lM(r)?r:[]):o=r&&aM(r)?r:{},uM(l,{name:n,newValue:e(c,o,s)})):typeof s<"u"&&uM(l,{name:n,newValue:s}));return l};const hv=yg(Ule);function lb(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function qle(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...s);function l(a,...u){const c=e[++i];let d=-1;if(a){o(a);return}for(;++d<s.length;)(u[d]===null||u[d]===void 0)&&(u[d]=s[d]);s=u,c?Wle(c,l)(...u):o(null,...u)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function Wle(e,t){let n;return r;function r(...o){const l=e.length>o.length;let a;l&&o.push(s);try{a=e.apply(this,o)}catch(u){const c=u;if(l&&n)throw c;return s(c)}l||(a&&a.then&&typeof a.then=="function"?a.then(i,s):a instanceof Error?s(a):i(a))}function s(o,...l){n||(n=!0,t(o,...l))}function i(o){s(null,o)}}const Rs={basename:Kle,dirname:Qle,extname:Gle,join:Jle,sep:"/"};function Kle(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Vf(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(r=s):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Qle(e){if(Vf(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Gle(e){Vf(e);let t=e.length,n=-1,r=0,s=-1,i=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function Jle(...e){let t=-1,n;for(;++t<e.length;)Vf(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Zle(n)}function Zle(e){Vf(e);const t=e.codePointAt(0)===47;let n=Yle(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Yle(e,t){let n="",r=0,s=-1,i=0,o=-1,l,a;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(s===o-1||i===1))if(s!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(a=n.lastIndexOf("/"),a!==n.length-1){a<0?(n="",r=0):(n=n.slice(0,a),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,i=0}else l===46&&i>-1?i++:i=-1}return n}function Vf(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Xle={cwd:eae};function eae(){return"/"}function ab(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function tae(e){if(typeof e=="string")e=new URL(e);else if(!ab(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return nae(e)}function nae(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const pv=["history","path","basename","stem","extname","dirname"];class hz{constructor(t){let n;t?ab(t)?n={path:t}:typeof t=="string"||rae(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Xle.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<pv.length;){const i=pv[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)pv.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Rs.basename(this.path):void 0}set basename(t){gv(t,"basename"),mv(t,"basename"),this.path=Rs.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Rs.dirname(this.path):void 0}set dirname(t){dM(this.basename,"dirname"),this.path=Rs.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Rs.extname(this.path):void 0}set extname(t){if(mv(t,"extname"),dM(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Rs.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ab(t)&&(t=tae(t)),gv(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Rs.basename(this.path,this.extname):void 0}set stem(t){gv(t,"stem"),mv(t,"stem"),this.path=Rs.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new Pn(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function mv(e,t){if(e&&e.includes(Rs.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Rs.sep+"`")}function gv(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function dM(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function rae(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const sae=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},iae={}.hasOwnProperty;class xS extends sae{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=qle()}copy(){const t=new xS;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(hv(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(vv("data",this.frozen),this.namespace[t]=n,this):iae.call(this.namespace,t)&&this.namespace[t]||void 0:t?(vv("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Bh(t),r=this.parser||this.Parser;return yv("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),yv("process",this.parser||this.Parser),xv("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const l=Bh(t),a=r.parse(l);r.run(a,l,function(c,d,h){if(c||!d||!h)return u(c);const f=d,m=r.stringify(f,h);aae(m)?h.value=m:h.result=m,u(c,h)});function u(c,d){c||!d?o(c):i?i(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),yv("processSync",this.parser||this.Parser),xv("processSync",this.compiler||this.Compiler),this.process(t,s),hM("processSync","process",n),r;function s(i,o){n=!0,sM(i),r=o}}run(t,n,r){fM(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,l){const a=Bh(n);s.run(t,a,u);function u(c,d,h){const f=d||t;c?l(c):o?o(f):r(void 0,f,h)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),hM("runSync","run",r),s;function i(o,l){sM(o),s=l,r=!0}}stringify(t,n){this.freeze();const r=Bh(n),s=this.compiler||this.Compiler;return xv("stringify",s),fM(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(vv("use",this.frozen),t!=null)if(typeof t=="function")a(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")a(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...d]=u;a(c,d)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(s.settings=hv(!0,s.settings,u.settings))}function l(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const d=u[c];i(d)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function a(u,c){let d=-1,h=-1;for(;++d<r.length;)if(r[d][0]===u){h=d;break}if(h===-1)r.push([u,...c]);else if(c.length>0){let[f,...m]=c;const g=r[h][1];lb(g)&&lb(f)&&(f=hv(!0,g,f)),r[h]=[u,f,...m]}}}}const oae=new xS().freeze();function yv(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function xv(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function vv(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function fM(e){if(!lb(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function hM(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Bh(e){return lae(e)?e:new hz(e)}function lae(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function aae(e){return typeof e=="string"||uae(e)}function uae(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const cae="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",pM=[],mM={allowDangerousHtml:!0},dae=/^(https?|ircs?|mailto|xmpp)$/i,fae=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function hae(e){const t=pae(e),n=mae(e);return gae(t.runSync(t.parse(n),n),e)}function pae(e){const t=e.rehypePlugins||pM,n=e.remarkPlugins||pM,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...mM}:mM;return oae().use(Qoe).use(n).use(Hle,r).use(t)}function mae(e){const t=e.children||"",n=new hz;return typeof t=="string"&&(n.value=t),n}function gae(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,a=t.urlTransform||yae;for(const c of fae)Object.hasOwn(t,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+cae+c.id,void 0);return dz(e,u),Tse(e,{Fragment:p.Fragment,components:s,ignoreInvalidStyle:!0,jsx:p.jsx,jsxs:p.jsxs,passKeys:!0,passNode:!0});function u(c,d,h){if(c.type==="raw"&&h&&typeof d=="number")return o?h.children.splice(d,1):h.children[d]={type:"text",value:c.value},d;if(c.type==="element"){let f;for(f in cv)if(Object.hasOwn(cv,f)&&Object.hasOwn(c.properties,f)){const m=c.properties[f],g=cv[f];(g===null||g.includes(c.tagName))&&(c.properties[f]=a(String(m||""),f,c))}}if(c.type==="element"){let f=n?!n.includes(c.tagName):i?i.includes(c.tagName):!1;if(!f&&r&&typeof d=="number"&&(f=!r(c,d,h)),f&&h&&typeof d=="number")return l&&c.children?h.children.splice(d,1,...c.children):h.children.splice(d,1),d}}}function yae(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||dae.test(e.slice(0,t))?e:""}const xae="Connection to agent lost. Send a follow-up message to continue.",vae="prose prose-sm prose-neutral dark:prose-invert max-w-none break-words [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-black/10 [&_pre]:p-2 [&_pre]:dark:bg-black/30 [&_code]:rounded [&_code]:bg-black/10 [&_code]:px-1 [&_code]:py-0.5 [&_code]:text-[13px] [&_code]:dark:bg-black/30 [&_p]:my-1.5 [&_ul]:my-1.5 [&_ol]:my-1.5 [&_li]:my-0.5 [&_h1]:text-base [&_h2]:text-sm [&_h3]:text-sm [&_h1]:mt-3 [&_h2]:mt-2 [&_h3]:mt-2";function gM(e){try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&typeof t.message=="string")return t.message}catch{}return e}const wae=({stale:e})=>p.jsx("div",{className:"mr-auto flex items-start py-2",children:p.jsxs("div",{className:"relative ml-3.5",children:[p.jsx("div",{className:"absolute inset-0 h-7 w-7 rounded-full blur-sm animate-pulse",style:{background:e?"rgba(245,158,11,0.08)":"rgba(0,0,0,0.02)"}}),p.jsx("div",{className:"h-6 w-6 rounded-full backdrop-blur-sm animate-pulse",style:e?{background:"radial-gradient(circle at 30% 30%, rgba(245,158,11,0.6), rgba(245,158,11,0.15))",border:"1px solid rgba(245,158,11,0.4)",boxShadow:"inset 0 0.5px 0 rgba(255,255,255,0.15), 0 0 8px rgba(245,158,11,0.15)"}:{background:`
|
|
607
|
+
radial-gradient(circle at 30% 30%, rgba(255,255,255,0.3), rgba(255,255,255,0.05)),
|
|
608
|
+
conic-gradient(from 0deg at 50% 50%,
|
|
609
|
+
rgba(255,0,150,0.03),
|
|
610
|
+
rgba(0,255,255,0.03),
|
|
611
|
+
rgba(255,255,0,0.03),
|
|
612
|
+
rgba(255,0,150,0.03))
|
|
613
|
+
`,border:"1px solid rgba(255,255,255,0.1)",boxShadow:"inset 0 0.5px 0 rgba(255,255,255,0.15), 0 0 8px rgba(0,0,0,0.08)"}}),p.jsx("div",{className:"absolute inset-0.5 h-5 w-5 rounded-full animate-ping [animation-duration:2s]",style:{background:e?"rgba(245,158,11,0.05)":"rgba(0,0,0,0.01)"}})]})}),wv=({content:e})=>p.jsx("div",{className:"mb-1 mr-auto max-w-[80%] text-xs text-muted-foreground/60",children:p.jsx("p",{className:"whitespace-pre-wrap leading-relaxed",children:e})}),bv=({content:e})=>p.jsx("div",{className:"mr-auto max-w-[65%] rounded-xl bg-muted px-3.5 py-2.5 text-sm",children:p.jsx("div",{className:vae,children:p.jsx(hae,{children:e})})}),bae=({agent:e,flowState:t,stale:n,streamingSteps:r=[],isStreamThinking:s=!1})=>{if(e.messages.length===0&&t.type==="idle")return p.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Send a message to start a conversation."});const i=t.type==="streaming"||t.type==="waiting_permission"||t.type==="interrupting",o=i?t.accumulated:"",l=(t.type==="sending"||t.type==="streaming"||t.type==="interrupting")&&"message"in t?t.message:"",a=l&&e.messages.slice(-3).some(h=>h.role==="user"&&gM(h.content).trim()===l.trim()),u=l&&!a&&t.type!=="idle",c=e.messages.map((h,f)=>{if(h.role!=="assistant")return{...h,isStep:!1};if(h.isThinking)return{...h,isStep:!0};const m=f<e.messages.length-1&&e.messages[f+1].role==="assistant";return{...h,isStep:m}}),d=t.type==="sending"||t.type==="streaming"||t.type==="interrupting";return p.jsxs("div",{className:"space-y-2",children:[c.map((h,f)=>h.role==="user"?p.jsx("div",{className:"ml-auto max-w-[65%] rounded-xl bg-primary px-3.5 py-2.5 text-sm text-primary-foreground",children:p.jsx("p",{className:"whitespace-pre-wrap",children:gM(h.content)})},f):h.isStep?p.jsx(wv,{content:h.content},f):p.jsx(bv,{content:h.content},f)),u&&p.jsx("div",{className:"ml-auto max-w-[65%] rounded-xl bg-primary px-3.5 py-2.5 text-sm text-primary-foreground",children:p.jsx("p",{className:"whitespace-pre-wrap",children:l})}),r.map((h,f)=>h.isThinking?p.jsx(wv,{content:h.content},`step-${f}`):p.jsx(bv,{content:h.content},`step-${f}`)),i&&o&&(s?p.jsx(wv,{content:o}):p.jsx(bv,{content:o})),d&&p.jsx(wae,{stale:n}),t.type==="error"&&(t.error===xae?p.jsxs("div",{className:"flex items-center gap-2.5 rounded-xl border border-amber-500/50 bg-amber-500/10 px-4 py-3 text-sm text-amber-700 dark:text-amber-400",children:[p.jsx(y6,{className:"h-4 w-4 flex-shrink-0"}),p.jsx("span",{children:t.error})]}):p.jsx("div",{className:"mr-auto max-w-[65%] rounded-xl border border-destructive bg-destructive/10 px-3.5 py-2.5 text-sm text-destructive",children:t.error}))]})},kae=({onSend:e,onInterrupt:t,flowState:n,disabled:r,pendingMessage:s,onEditPending:i,onCancelPending:o,onSendQueuedNow:l})=>{const[a,u]=x.useState(""),c=x.useRef(null),d=n.type==="sending"||n.type==="streaming"||n.type==="interrupting",h=()=>{!a.trim()||r||(e(a.trim()),u(""))},f=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),d&&t?a.trim()?h():s&&l?l():t():h())},m=()=>{var v;s&&(u(s),i==null||i(),(v=c.current)==null||v.focus())};x.useEffect(()=>{const v=c.current;v&&(v.style.height="auto",v.style.height=Math.min(v.scrollHeight,160)+"px")},[a]);const g=d&&!a.trim()&&!s;return p.jsxs("div",{className:"flex flex-col gap-1.5",children:[s&&p.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-muted/60 px-3 py-1.5",children:[p.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground/70",children:"Queued"}),p.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:s}),p.jsx("button",{type:"button",onClick:m,className:"flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground",children:p.jsx(WU,{className:"h-3 w-3"})}),p.jsx("button",{type:"button",onClick:o,className:"flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:text-destructive",children:p.jsx(Gr,{className:"h-3.5 w-3.5"})})]}),p.jsxs("div",{className:"flex items-end gap-2",children:[p.jsx("textarea",{ref:c,value:a,onChange:v=>u(v.target.value),onKeyDown:f,placeholder:d?"Type to interrupt…":"Type a message…",className:"min-h-[40px] max-h-[160px] flex-1 resize-none rounded-xl border border-input bg-background px-3 py-2.5 text-sm leading-snug placeholder:text-muted-foreground/60 focus:outline-none focus:ring-1 focus:ring-ring",rows:1,autoFocus:!0,disabled:r}),g?p.jsx("button",{type:"button",onClick:t,className:"flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-full bg-destructive text-destructive-foreground transition-opacity hover:opacity-90",children:p.jsx(KA,{className:"h-3 w-3 fill-current"})}):p.jsx("button",{type:"button",onClick:h,disabled:!a.trim()||r,className:"flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground transition-opacity hover:opacity-90 disabled:opacity-30",children:d?p.jsx(om,{className:"h-4 w-4 animate-spin"}):p.jsx(s6,{className:"h-3.5 w-3.5"})})]})]})},Sae={Write:"create/overwrite a file",Edit:"edit a file",MultiEdit:"edit multiple files",Bash:"run a terminal command",Read:"read a file",Glob:"search for files",Grep:"search in files"};function Cae(e){const t=e.split("/");return t.length<=3?e:"…/"+t.slice(-3).join("/")}function pz(e,t){const n=t.file_path,r=t.command,s=Sae[e]||e;return n?`${s}: ${Cae(n)}`:r?`${s}: ${r.length>50?r.slice(0,50)+"…":r}`:s}const Eae=({agentId:e,permission:t,onRespond:n})=>{const[r,s]=x.useState(!1),{respondToPermission:i}=_A(e),o=x.useCallback(a=>{n(t.permissionId,a),i({agentId:e,permissionId:t.permissionId,behavior:a,...a==="deny"?{message:"Permission denied by user"}:{}})},[e,t.permissionId,n,i]);x.useEffect(()=>{const a=u=>{u.key==="Enter"&&!r&&(u.preventDefault(),o("allow"))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[r,o]);const l=pz(t.toolName,t.input);return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-yellow-500/30 bg-yellow-500/5 px-3 py-2",children:[p.jsx("span",{className:"inline-block h-2 w-2 flex-shrink-0 animate-pulse rounded-full bg-yellow-500"}),p.jsx("span",{className:"flex-1 truncate text-xs text-foreground/80",children:l}),p.jsx("button",{type:"button",onClick:()=>s(!0),className:"flex-shrink-0 text-[10px] text-muted-foreground underline-offset-2 hover:underline",children:"details"}),p.jsxs("div",{className:"flex flex-shrink-0 items-center gap-1",children:[p.jsx("span",{className:"text-[10px] text-muted-foreground mr-2",children:"Press Enter to allow"}),p.jsxs(ae,{type:"button",variant:"ghost",size:"sm",onClick:()=>o("deny"),className:"h-6 px-2 text-xs text-red-500 hover:text-red-600",children:[p.jsx(Gr,{className:"mr-0.5 h-3 w-3"}),"Deny"]}),p.jsxs(ae,{type:"button",size:"sm",onClick:()=>o("allow"),className:"h-6 px-2 text-xs",children:[p.jsx(Af,{className:"mr-0.5 h-3 w-3"}),"Allow"]})]})]}),p.jsx(el,{open:r,onOpenChange:s,children:p.jsxs(Ii,{className:"max-w-lg",children:[p.jsx(tl,{children:p.jsxs(nl,{className:"text-sm",children:["Permission: ",t.toolName]})}),p.jsx("pre",{className:"max-h-64 overflow-auto rounded-md bg-muted p-3 font-mono text-[11px] text-muted-foreground",children:JSON.stringify(t.input,null,2)}),t.decisionReason&&p.jsx("p",{className:"text-xs text-muted-foreground",children:t.decisionReason})]})})]})},Nae=({permission:e})=>{const t=e.status==="allowed",n=pz(e.toolName,e.input);return p.jsxs("div",{className:`flex items-center gap-2 rounded-lg px-3 py-1.5 text-xs ${t?"border border-green-500/20 bg-green-500/5 text-green-600 dark:text-green-400":"border border-red-500/20 bg-red-500/5 text-red-600 dark:text-red-400"}`,children:[t?p.jsx(Af,{className:"h-3 w-3"}):p.jsx(Gr,{className:"h-3 w-3"}),p.jsxs("span",{className:"truncate",children:[t?"Allowed":"Denied",": ",n]})]})},Tae=({agentId:e,permissions:t,onPermissionRespond:n})=>{if(t.length===0)return null;const r=t.filter(i=>i.status!=="pending"),s=t.find(i=>i.status==="pending");return p.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.map(i=>p.jsx(Nae,{permission:i},i.permissionId)),s&&p.jsx(Eae,{agentId:e,permission:s,onRespond:n},s.permissionId)]})},Rae=({agentId:e,mode:t})=>{const{setPermissionMode:n}=Pf(),r=t==="acceptEdits",s=()=>n({agentId:e,mode:r?"default":"acceptEdits"});return p.jsx("button",{type:"button",onClick:s,className:`rounded-full px-2.5 py-0.5 text-[11px] font-medium transition-colors ${r?"bg-green-500/15 text-green-600 hover:bg-green-500/25 dark:text-green-400":"bg-muted text-muted-foreground hover:bg-muted/80"}`,title:r?"Auto-accepting file edits — click to require approval":"Click to auto-accept file edits",children:r?"auto-accept edits: on":"auto-accept edits: off"})},Mae=()=>({type:"idle"}),Oae=e=>({type:"sending",message:e}),yM=(e,t)=>({type:"streaming",message:e,accumulated:t}),xM=(e,t,n)=>({type:"waiting_permission",permissionId:e,accumulated:t,toolName:n}),kv=e=>({type:"error",error:e}),vM=()=>({type:"idle"}),wM=(e,t)=>({type:"interrupting",message:e,accumulated:t}),jae=20,Pae=({agentId:e})=>{const{data:t,isLoading:n}=NH(e),{sendMessage:r,interruptAgent:s,deleteAgent:i,archiveAgent:o}=Pf(),{permissions:l}=_A(e),[a,u]=x.useState(Mae()),c=x.useRef(""),[d,h]=x.useState([]),[f,m]=x.useState([]),[g,v]=x.useState(!1),y=x.useRef(new Set),w=x.useRef(null),[b,C]=x.useState(null),S=x.useRef(null),k=x.useRef(()=>{}),E=x.useRef(0),[N,O]=x.useState(0),T=x.useCallback(()=>{const R=w.current;R&&(R.scrollTop=R.scrollHeight)},[]);x.useEffect(()=>{T()},[t==null?void 0:t.messages.length,a,T]),x.useEffect(()=>{for(const R of l)y.current.has(R.permissionId)||(y.current.add(R.permissionId),h(I=>[...I,{...R,status:"pending"}]),u(xM(R.permissionId,c.current,R.toolName)))},[l]);const j=x.useCallback(R=>{S.current=R,C(R)},[]),A=x.useCallback(()=>{const R=S.current;R&&(j(null),setTimeout(()=>k.current(R),100))},[j]),z=x.useCallback(R=>{c.current="",y.current.clear(),h([]),m([]),v(!1),E.current=Date.now(),O(0),u(Oae(R)),r({agentId:e,message:R,onStream:I=>{if(E.current=Date.now(),I.type!=="heartbeat")if(I.type==="permission_request"){if(y.current.has(I.permissionId))return;y.current.add(I.permissionId);const V={permissionId:I.permissionId,toolName:I.toolName,toolUseID:I.toolUseID,input:I.input,decisionReason:I.decisionReason,blockedPath:I.blockedPath,status:"pending"};h(Y=>[...Y,V]),u(xM(I.permissionId,c.current,I.toolName))}else if(I.type==="permission_auto_allowed"){const V=`auto-${I.toolUseID}`;y.current.has(V)||(y.current.add(V),h(Y=>[...Y,{permissionId:V,toolName:I.toolName,toolUseID:I.toolUseID,input:I.input,status:"allowed"}]))}else I.type==="step_complete"?m(V=>[...V,{content:I.content,isThinking:I.isThinking}]):I.type==="text_delta"?(c.current=I.accumulated||"",v(I.isThinking??!1),u(yM(R,I.accumulated||""))):I.type==="complete"?(c.current="",u(vM())):I.type==="disconnected"?u(kv("Connection to agent lost. Send a follow-up message to continue.")):I.type==="error"&&u(kv(I.error))}},{onSuccess:()=>{c.current="",m([]),v(!1),u(vM()),A()},onError:I=>{if(S.current){A();return}u(kv(I instanceof Error?I.message:"Failed to send message"))}})},[e,r,A]);x.useEffect(()=>{k.current=z},[z]);const D=a.type==="sending"||a.type==="streaming"||a.type==="interrupting";x.useEffect(()=>{if(!D){O(0);return}const R=setInterval(()=>{const I=E.current;I!==0&&O(Math.floor((Date.now()-I)/1e3))},2e3);return()=>clearInterval(R)},[D]);const L=x.useCallback(R=>{if(!D){z(R);return}j(R),a.type==="streaming"&&(u(wM(a.message,a.accumulated)),s(e))},[D,a,z,s,e,j]),H=x.useCallback(()=>{u(R=>R.type==="streaming"?wM(R.message,R.accumulated):R),s(e)},[s,e]),K=x.useCallback(()=>{j(null)},[j]),_=x.useCallback(()=>{j(null)},[j]),Q=x.useCallback(()=>{const R=S.current;R&&(j(null),k.current(R))},[j]),M=x.useCallback(()=>{t&&window.confirm("Are you sure you want to delete this conversation? This action cannot be undone.")&&i(e)},[t,i,e]),oe=x.useCallback(()=>{t&&o(e)},[t,o,e]),F=x.useCallback((R,I)=>{const V=I==="allow"?"allowed":"denied";h(Y=>Y.map(G=>G.permissionId===R?{...G,status:V}:G)),u(yM("",c.current))},[]);return n?p.jsx("main",{className:"flex min-h-0 flex-1 items-center justify-center text-sm text-muted-foreground",children:"Loading…"}):t?p.jsxs("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:[(t==null?void 0:t.archived)&&p.jsxs("div",{className:"flex items-center justify-between border-b border-border px-6 py-3",children:[p.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[p.jsx(rm,{className:"h-4 w-4"}),p.jsx("span",{children:"This conversation is archived"})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs(ae,{variant:"ghost",size:"sm",onClick:oe,className:"h-8 px-3 text-xs",children:[p.jsx(rm,{className:"h-3 w-3 mr-1"}),"Unarchive"]}),p.jsxs(ae,{variant:"ghost",size:"sm",onClick:M,className:"h-8 px-3 text-xs text-destructive hover:text-destructive",children:[p.jsx(ic,{className:"h-3 w-3 mr-1"}),"Delete"]})]})]}),p.jsx("div",{ref:w,className:"min-h-0 flex-1 overflow-y-auto px-6 py-4",children:p.jsx(bae,{agent:t,flowState:a,stale:D&&N>=jae,streamingSteps:f,isStreamThinking:g})}),p.jsx("div",{className:"flex-shrink-0 border-t border-border px-6 py-3",children:p.jsxs("div",{className:"flex flex-col gap-2",children:[p.jsx(Tae,{agentId:e,permissions:d,onPermissionRespond:F}),p.jsx(kae,{onSend:L,onInterrupt:H,flowState:a,disabled:a.type==="waiting_permission",pendingMessage:b,onEditPending:K,onCancelPending:_,onSendQueuedNow:Q}),p.jsx("div",{className:"flex items-center",children:p.jsx(Rae,{agentId:e,mode:t.permissionMode})})]})})]}):p.jsx("main",{className:"flex min-h-0 flex-1 items-center justify-center text-sm text-muted-foreground",children:"Agent not found"})},Aae=()=>p.jsx("main",{className:"flex min-h-0 flex-1 items-center justify-center text-sm text-muted-foreground",children:"Select or create an agent to start chatting."}),mz=x.createContext(null),_ae=mz.Provider,Iae=()=>{const e=x.useContext(mz);if(!e)throw new Error("useMetadataDialogContext must be used within MetadataDialogProvider.");return e},gz=({open:e,onClose:t})=>{x.useEffect(()=>{if(!e)return;const n=r=>{r.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n)}},[t,e])},Dae=()=>{var s,i;const{dialogs:{infoInspector:e,active:t}}=Tr(),{open:n,setOpen:r}=Iae();return gz({open:n,onClose:()=>r(!1)}),!n||!t?null:p.jsx("div",{className:"fixed inset-0 z-40 flex items-center justify-center bg-black/40 p-4",onClick:()=>r(!1),children:p.jsxs("div",{className:"w-full max-w-lg rounded-lg border border-border bg-card p-5 shadow-xl",role:"dialog","aria-modal":"true","aria-label":"Document info",onClick:o=>o.stopPropagation(),children:[p.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[p.jsx("h3",{className:"text-base font-semibold",children:"Document info"}),p.jsx("button",{type:"button",className:"text-sm text-muted-foreground hover:text-foreground",onClick:()=>r(!1),children:"Close"})]}),e?p.jsx("div",{className:"space-y-4",children:e.type==="markdown"?p.jsxs(p.Fragment,{children:[p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-muted-foreground",children:"Metadata (JSON)"}),p.jsx("pre",{className:"max-h-64 overflow-auto rounded-md border border-border bg-muted p-3 text-xs text-foreground",children:(s=e.metadata)!=null&&s.json?JSON.stringify(e.metadata.json,null,2):e.metadata?"—":"No metadata header found."}),(i=e.metadata)!=null&&i.error?p.jsx("div",{className:"mt-2 text-xs text-destructive",children:e.metadata.error}):null]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-muted-foreground",children:"Markdown"}),p.jsx("pre",{className:"max-h-64 overflow-auto rounded-md border border-border bg-muted p-3 text-xs text-foreground",children:e.rawMarkdown||"—"})]})]}):p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-muted-foreground",children:"JSON"}),p.jsx("pre",{className:"max-h-64 overflow-auto rounded-md border border-border bg-muted p-3 text-xs text-foreground",children:e.prettyJson??e.rawJson??"—"}),e.error?p.jsx("div",{className:"mt-2 text-xs text-destructive",children:e.error}):null]})}):null]})})};function Lae(){var T,j;const{activeProject:e}=Ht(),t=(e==null?void 0:e.id)??"",n=!!e,r=nt.zapper.status.useQuery({projectId:t},{refetchInterval:2e3,refetchOnWindowFocus:!1,enabled:n}),s=nt.zapper.tasks.useQuery({projectId:t},{refetchInterval:1e4,refetchOnWindowFocus:!1,enabled:n}),i=nt.zapper.profiles.useQuery({projectId:t},{refetchInterval:5e3,refetchOnWindowFocus:!1,enabled:n}),o=nt.useUtils(),l=()=>o.zapper.status.invalidate({projectId:t}),a=()=>o.zapper.profiles.invalidate({projectId:t}),u=nt.zapper.startAll.useMutation({onSuccess:l}),c=nt.zapper.stopAll.useMutation({onSuccess:l}),d=nt.zapper.start.useMutation({onSuccess:l}),h=nt.zapper.stop.useMutation({onSuccess:l}),f=nt.zapper.restart.useMutation({onSuccess:l}),m=nt.zapper.runTask.useMutation(),g=nt.zapper.showLogs.useMutation(),v=nt.zapper.launch.useMutation(),y=nt.zapper.links.useQuery({projectId:t},{refetchOnWindowFocus:!1,enabled:n}),w=nt.zapper.enableProfile.useMutation({onSuccess:()=>{l(),a()}}),b=nt.zapper.disableProfile.useMutation({onSuccess:()=>{l(),a()}}),C=x.useMemo(()=>{var A;return((A=r.data)==null?void 0:A.services)??[]},[r.data]),S=x.useMemo(()=>s.data??[],[s.data]),k=x.useMemo(()=>{var A;return((A=y.data)==null?void 0:A.projectLinks)??[]},[y.data]),E=x.useMemo(()=>{var A;return((A=y.data)==null?void 0:A.serviceLinks)??{}},[y.data]),N=x.useMemo(()=>{var A;return((A=i.data)==null?void 0:A.profiles)??[]},[i.data]),O=((T=i.data)==null?void 0:T.activeProfile)??null;return{available:((j=r.data)==null?void 0:j.available)??!1,services:C,tasks:S,projectLinks:k,serviceLinks:E,profiles:N,activeProfile:O,isLoading:r.isLoading,startAll:()=>u.mutate({projectId:t}),stopAll:()=>c.mutate({projectId:t}),start:A=>d.mutate({projectId:t,service:A}),stop:A=>h.mutate({projectId:t,service:A}),restart:A=>f.mutate({projectId:t,service:A}),runTask:A=>m.mutate({projectId:t,task:A}),showLogs:A=>g.mutate({projectId:t,service:A}),launch:A=>v.mutate({url:A}),enableProfile:A=>w.mutate({projectId:t,profile:A}),disableProfile:()=>b.mutate({projectId:t}),isStartingAll:u.isPending,isStoppingAll:c.isPending,isPending:u.isPending||c.isPending||d.isPending||h.isPending||f.isPending||w.isPending||b.isPending}}const $ae=(e,t)=>mt("h-2 w-2 shrink-0 rounded-full",t?e==="up"?"bg-green-500":e==="pending"?"bg-yellow-500":"bg-red-500":"bg-muted-foreground/40"),Ac="h-5 w-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/60 transition-colors",zae=({name:e,status:t,enabled:n,onStart:r,onStop:s,onRestart:i,onShowLogs:o,onLaunch:l})=>p.jsxs("li",{className:"group flex items-center gap-2 rounded-md px-1.5 py-1 text-sm hover:bg-accent/30",children:[p.jsx("span",{className:$ae(t,n)}),p.jsx("span",{className:mt("flex-1 truncate",!n&&"text-muted-foreground/50"),children:e}),p.jsxs("span",{className:"flex gap-0.5 opacity-0 transition-opacity group-hover:opacity-100",children:[l&&p.jsx("button",{type:"button",className:Ac,onClick:l,"aria-label":`Open ${e}`,children:p.jsx(LA,{className:"h-3 w-3"})}),p.jsx("button",{type:"button",className:Ac,onClick:o,"aria-label":`Logs ${e}`,children:p.jsx(t6,{className:"h-3 w-3"})}),t==="up"||t==="pending"?p.jsxs(p.Fragment,{children:[p.jsx("button",{type:"button",className:Ac,onClick:s,"aria-label":`Stop ${e}`,children:p.jsx(KA,{className:"h-3 w-3"})}),p.jsx("button",{type:"button",className:Ac,onClick:i,"aria-label":`Restart ${e}`,children:p.jsx(XU,{className:"h-3 w-3"})})]}):p.jsx("button",{type:"button",className:Ac,onClick:r,"aria-label":`Start ${e}`,children:p.jsx(qA,{className:"h-3 w-3"})})]})]}),bM=({title:e,services:t,serviceLinks:n,onStart:r,onStop:s,onRestart:i,onShowLogs:o,onLaunch:l})=>p.jsxs("section",{children:[p.jsx("h3",{className:"mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:e}),p.jsx("ul",{className:"space-y-0.5",children:t.map(a=>{const u=n[a.name];return p.jsx(zae,{name:a.name,status:a.status,enabled:a.enabled,linkUrl:u,onStart:()=>r(a.name),onStop:()=>s(a.name),onRestart:()=>i(a.name),onShowLogs:()=>o(a.name),onLaunch:u?()=>l(u):void 0},a.name)})})]}),Fae=({name:e,onRun:t})=>p.jsx("li",{children:p.jsxs("button",{type:"button",className:"group flex w-full items-center gap-2 rounded-md px-1.5 py-1 text-sm hover:bg-accent/30",onClick:t,children:[p.jsx("span",{className:"flex-1 truncate text-left",children:e}),p.jsx(qA,{className:"h-3 w-3 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100"})]})}),Bae="rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors cursor-pointer select-none",Vae=({profiles:e,active:t,onEnable:n,onDisable:r,disabled:s})=>p.jsxs("section",{children:[p.jsx("h3",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Profiles"}),p.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(i=>{const o=i===t;return p.jsx("button",{type:"button",disabled:s,onClick:()=>o?r():n(i),className:mt(Bae,o?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground hover:border-foreground/30 hover:text-foreground"),children:i},i)})})]}),Hae=()=>{const{available:e,services:t,tasks:n,projectLinks:r,serviceLinks:s,profiles:i,activeProfile:o,isLoading:l,startAll:a,stopAll:u,start:c,stop:d,restart:h,runTask:f,showLogs:m,launch:g,enableProfile:v,disableProfile:y,isStartingAll:w,isStoppingAll:b,isPending:C}=Lae();if(l)return p.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading…"});if(!e)return p.jsx("div",{className:"text-sm text-muted-foreground",children:"No zap.yaml found"});const S=t.filter(N=>N.type==="native"),k=t.filter(N=>N.type==="docker"),E=S.length>0||k.length>0;return p.jsxs("div",{className:"flex flex-col gap-4",children:[E&&p.jsxs("div",{className:"flex gap-1.5",children:[p.jsxs(ae,{variant:"muted",size:"xs",disabled:C,onClick:a,children:[w&&p.jsx(om,{className:"h-3 w-3 animate-spin"}),"Start all"]}),p.jsxs(ae,{variant:"muted",size:"xs",disabled:C,onClick:u,children:[b&&p.jsx(om,{className:"h-3 w-3 animate-spin"}),"Stop all"]})]}),r.length>0&&p.jsxs("section",{children:[p.jsx("h3",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Links"}),p.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.map(N=>p.jsxs("button",{type:"button",onClick:()=>g(N.url),className:"inline-flex items-center gap-1 text-xs text-primary underline-offset-2 hover:underline",children:[N.name,p.jsx(LA,{className:"h-3 w-3"})]},N.name))})]}),i.length>0&&p.jsx(Vae,{profiles:i,active:o,onEnable:v,onDisable:y,disabled:C}),S.length>0&&p.jsx(bM,{title:"Native",services:S,serviceLinks:s,onStart:c,onStop:d,onRestart:h,onShowLogs:m,onLaunch:g}),k.length>0&&p.jsx(bM,{title:"Docker",services:k,serviceLinks:s,onStart:c,onStop:d,onRestart:h,onShowLogs:m,onLaunch:g}),n.length>0&&p.jsxs("section",{children:[p.jsx("h3",{className:"mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Tasks"}),p.jsx("ul",{className:"space-y-0.5",children:n.map(N=>p.jsx(Fae,{name:N.name,onRun:()=>f(N.name)},N.name))})]})]})},Uae=({open:e,onClose:t})=>(gz({open:e,onClose:t}),e?p.jsx("div",{className:"fixed inset-0 z-40 flex items-center justify-center bg-black/40 p-4",onClick:t,children:p.jsxs("div",{className:"w-full max-w-md rounded-lg border border-border bg-card p-5 shadow-xl",role:"dialog","aria-modal":"true","aria-label":"Zapper",onClick:n=>n.stopPropagation(),children:[p.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[p.jsx("h3",{className:"text-base font-semibold",children:"Zapper"}),p.jsx("button",{type:"button",className:"text-sm text-muted-foreground hover:text-foreground",onClick:t,children:"Close"})]}),p.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:p.jsx(Hae,{})})]})}):null),qae=()=>{const e=Lg(),t=Tf(),n=_i(),{activeProject:r}=Ht(),s=r==null?void 0:r.id;return x.useEffect(()=>s?n.getQueryCache().subscribe(o=>{if((o==null?void 0:o.type)!=="updated")return;const l=o.query.state.error;if(!l||!EH(l))return;const{tab:a}=eS(t.pathname);e(`/${s}/${a}`,{replace:!0})}):void 0,[n,e,s,t.pathname]),null};var zm=(e,t)=>{if(e==="slot")return 0;if(e instanceof Function)return e(t);const{children:n,...r}=t??{};if(e==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},Wae=/^\s*>\s$/,Kae=Rr.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return zm("blockquote",{...Vt(this.options.HTMLAttributes,e),children:zm("slot",{})})},parseMarkdown:(e,t)=>t.createNode("blockquote",void 0,t.parseChildren(e.tokens||[])),renderMarkdown:(e,t)=>{if(!e.content)return"";const n=">",r=[];return e.content.forEach(s=>{const l=t.renderChildren([s]).split(`
|
|
614
|
+
`).map(a=>a.trim()===""?n:`${n} ${a}`);r.push(l.join(`
|
|
615
|
+
`))}),r.join(`
|
|
616
|
+
${n}
|
|
617
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Zu({find:Wae,type:this.type})]}}),Qae=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Gae=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Jae=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Zae=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Yae=fa.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return zm("strong",{...Vt(this.options.HTMLAttributes,e),children:zm("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ju({find:Qae,type:this.type}),Ju({find:Jae,type:this.type})]},addPasteRules(){return[na({find:Gae,type:this.type}),na({find:Zae,type:this.type})]}}),Xae=/(^|[^`])`([^`]+)`(?!`)$/,eue=/(^|[^`])`([^`]+)`(?!`)/g,tue=fa.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",Vt(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ju({find:Xae,type:this.type})]},addPasteRules(){return[na({find:eue,type:this.type})]}}),Sv=4,nue=/^```([a-z]+)?[\s\n]$/,rue=/^~~~([a-z]+)?[\s\n]$/,sue=Rr.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Sv,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((t=e.firstElementChild)==null?void 0:t.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:e,HTMLAttributes:t}){return["pre",Vt(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n;return((n=e.raw)==null?void 0:n.startsWith("```"))===!1&&e.codeBlockStyle!=="indented"?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r="";const s=((n=e.attrs)==null?void 0:n.language)||"";return e.content?r=[`\`\`\`${s}`,t.renderChildren(e.content),"```"].join(`
|
|
618
|
+
`):r=`\`\`\`${s}
|
|
619
|
+
|
|
620
|
+
\`\`\``,r},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=(t=this.options.tabSize)!=null?t:Sv,{state:r}=e,{selection:s}=r,{$from:i,empty:o}=s;if(i.parent.type!==this.type)return!1;const l=" ".repeat(n);return o?e.commands.insertContent(l):e.commands.command(({tr:a})=>{const{from:u,to:c}=s,f=r.doc.textBetween(u,c,`
|
|
621
|
+
`,`
|
|
622
|
+
`).split(`
|
|
623
|
+
`).map(m=>l+m).join(`
|
|
624
|
+
`);return a.replaceWith(u,c,r.schema.text(f)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=(t=this.options.tabSize)!=null?t:Sv,{state:r}=e,{selection:s}=r,{$from:i,empty:o}=s;return i.parent.type!==this.type?!1:o?e.commands.command(({tr:l})=>{var a;const{pos:u}=i,c=i.start(),d=i.end(),f=r.doc.textBetween(c,d,`
|
|
625
|
+
`,`
|
|
626
|
+
`).split(`
|
|
627
|
+
`);let m=0,g=0;const v=u-c;for(let k=0;k<f.length;k+=1){if(g+f[k].length>=v){m=k;break}g+=f[k].length+1}const w=((a=f[m].match(/^ */))==null?void 0:a[0])||"",b=Math.min(w.length,n);if(b===0)return!0;let C=c;for(let k=0;k<m;k+=1)C+=f[k].length+1;return l.delete(C,C+b),u-C<=b&&l.setSelection(_e.create(l.doc,C)),!0}):e.commands.command(({tr:l})=>{const{from:a,to:u}=s,h=r.doc.textBetween(a,u,`
|
|
628
|
+
`,`
|
|
629
|
+
`).split(`
|
|
630
|
+
`).map(f=>{var m;const g=((m=f.match(/^ */))==null?void 0:m[0])||"",v=Math.min(g.length,n);return f.slice(v)}).join(`
|
|
631
|
+
`);return l.replaceWith(a,u,r.schema.text(h)),!0})},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
632
|
+
|
|
633
|
+
`);return!i||!o?!1:e.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:s,empty:i}=n;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const l=s.after();return l===void 0?!1:r.nodeAt(l)?e.commands.command(({tr:u})=>(u.setSelection(Pe.near(r.resolve(l))),!0)):e.commands.exitCode()}}},addInputRules(){return[Uw({find:nue,type:this.type,getAttributes:e=>({language:e[1]})}),Uw({find:rue,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new bt({key:new St("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s==null?void 0:s.mode;if(!n||!i)return!1;const{tr:o,schema:l}=e.state,a=l.text(n.replace(/\r\n?/g,`
|
|
634
|
+
`));return o.replaceSelectionWith(this.type.create({language:i},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(_e.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),e.dispatch(o),!0}}})]}}),iue=Rr.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
635
|
+
|
|
636
|
+
`):""}),oue=Rr.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",Vt(this.options.HTMLAttributes,e)]},renderText(){return`
|
|
637
|
+
`},renderMarkdown:()=>`
|
|
638
|
+
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:s,storedMarks:i}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=i||s.$to.parentOffset&&s.$from.marks();return t().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&a&&o){const d=a.filter(h=>l.includes(h.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),lue=Rr.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(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,Vt(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;const r=(n=e.attrs)!=null&&n.level?parseInt(e.attrs.level,10):1,s="#".repeat(r);return e.content?`${s} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>Uw({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),aue=Rr.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",Vt(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!dee(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:r}=n,s=e();return SL(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:l})=>{if(l){const{$to:a}=o.selection,u=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?o.setSelection(_e.create(o.doc,a.pos+1)):a.nodeAfter.isBlock?o.setSelection(Te.create(o.doc,a.pos)):o.setSelection(_e.create(o.doc,a.pos));else{const c=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=c==null?void 0:c.create();d&&(o.insert(u,d),o.setSelection(_e.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[cee({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),uue=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,cue=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,due=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,fue=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,hue=fa.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",Vt(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ju({find:uue,type:this.type}),Ju({find:due,type:this.type})]},addPasteRules(){return[na({find:cue,type:this.type}),na({find:fue,type:this.type})]}});const pue="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",mue="ελ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",ub="numeric",cb="ascii",db="alpha",xd="asciinumeric",Gc="alphanumeric",fb="domain",yz="emoji",gue="scheme",yue="slashscheme",Cv="whitespace";function xue(e,t){return e in t||(t[e]=[]),t[e]}function Sl(e,t,n){t[ub]&&(t[xd]=!0,t[Gc]=!0),t[cb]&&(t[xd]=!0,t[db]=!0),t[xd]&&(t[Gc]=!0),t[db]&&(t[Gc]=!0),t[Gc]&&(t[fb]=!0),t[yz]&&(t[fb]=!0);for(const r in t){const s=xue(r,n);s.indexOf(e)<0&&s.push(e)}}function vue(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function Xn(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Xn.groups={};Xn.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let r=0;r<t.jr.length;r++){const s=t.jr[r][0],i=t.jr[r][1];if(i&&s.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let s=0;s<e.length;s++)this.tt(e[s],t,n,r)},tr(e,t,n,r){r=r||Xn.groups;let s;return t&&t.j?s=t:(s=new Xn(t),n&&r&&Sl(t,n,r)),this.jr.push([e,s]),s},ts(e,t,n,r){let s=this;const i=e.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(e[o]);return s.tt(e[i-1],t,n,r)},tt(e,t,n,r){r=r||Xn.groups;const s=this;if(t&&t.j)return s.j[e]=t,t;const i=t;let o,l=s.go(e);if(l?(o=new Xn,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new Xn,i){if(r)if(o.t&&typeof o.t=="string"){const a=Object.assign(vue(o.t,r),n);Sl(i,a,r)}else n&&Sl(i,n,r);o.t=i}return s.j[e]=o,o}};const Be=(e,t,n,r,s)=>e.ta(t,n,r,s),Mt=(e,t,n,r,s)=>e.tr(t,n,r,s),kM=(e,t,n,r,s)=>e.ts(t,n,r,s),ee=(e,t,n,r,s)=>e.tt(t,n,r,s),ii="WORD",hb="UWORD",xz="ASCIINUMERICAL",vz="ALPHANUMERICAL",cf="LOCALHOST",pb="TLD",mb="UTLD",Np="SCHEME",Da="SLASH_SCHEME",vS="NUM",gb="WS",wS="NL",vd="OPENBRACE",wd="CLOSEBRACE",Fm="OPENBRACKET",Bm="CLOSEBRACKET",Vm="OPENPAREN",Hm="CLOSEPAREN",Um="OPENANGLEBRACKET",qm="CLOSEANGLEBRACKET",Wm="FULLWIDTHLEFTPAREN",Km="FULLWIDTHRIGHTPAREN",Qm="LEFTCORNERBRACKET",Gm="RIGHTCORNERBRACKET",Jm="LEFTWHITECORNERBRACKET",Zm="RIGHTWHITECORNERBRACKET",Ym="FULLWIDTHLESSTHAN",Xm="FULLWIDTHGREATERTHAN",eg="AMPERSAND",tg="APOSTROPHE",ng="ASTERISK",Ji="AT",rg="BACKSLASH",sg="BACKTICK",ig="CARET",to="COLON",bS="COMMA",og="DOLLAR",Ms="DOT",lg="EQUALS",kS="EXCLAMATION",Pr="HYPHEN",bd="PERCENT",ag="PIPE",ug="PLUS",cg="POUND",kd="QUERY",SS="QUOTE",wz="FULLWIDTHMIDDLEDOT",CS="SEMI",Os="SLASH",Sd="TILDE",dg="UNDERSCORE",bz="EMOJI",fg="SYM";var kz=Object.freeze({__proto__:null,ALPHANUMERICAL:vz,AMPERSAND:eg,APOSTROPHE:tg,ASCIINUMERICAL:xz,ASTERISK:ng,AT:Ji,BACKSLASH:rg,BACKTICK:sg,CARET:ig,CLOSEANGLEBRACKET:qm,CLOSEBRACE:wd,CLOSEBRACKET:Bm,CLOSEPAREN:Hm,COLON:to,COMMA:bS,DOLLAR:og,DOT:Ms,EMOJI:bz,EQUALS:lg,EXCLAMATION:kS,FULLWIDTHGREATERTHAN:Xm,FULLWIDTHLEFTPAREN:Wm,FULLWIDTHLESSTHAN:Ym,FULLWIDTHMIDDLEDOT:wz,FULLWIDTHRIGHTPAREN:Km,HYPHEN:Pr,LEFTCORNERBRACKET:Qm,LEFTWHITECORNERBRACKET:Jm,LOCALHOST:cf,NL:wS,NUM:vS,OPENANGLEBRACKET:Um,OPENBRACE:vd,OPENBRACKET:Fm,OPENPAREN:Vm,PERCENT:bd,PIPE:ag,PLUS:ug,POUND:cg,QUERY:kd,QUOTE:SS,RIGHTCORNERBRACKET:Gm,RIGHTWHITECORNERBRACKET:Zm,SCHEME:Np,SEMI:CS,SLASH:Os,SLASH_SCHEME:Da,SYM:fg,TILDE:Sd,TLD:pb,UNDERSCORE:dg,UTLD:mb,UWORD:hb,WORD:ii,WS:gb});const ti=/[a-z]/,_c=new RegExp("\\p{L}","u"),Ev=new RegExp("\\p{Emoji}","u"),ni=/\d/,Nv=/\s/,SM="\r",Tv=`
|
|
639
|
+
`,wue="️",bue="",Rv="";let Vh=null,Hh=null;function kue(e=[]){const t={};Xn.groups=t;const n=new Xn;Vh==null&&(Vh=CM(pue)),Hh==null&&(Hh=CM(mue)),ee(n,"'",tg),ee(n,"{",vd),ee(n,"}",wd),ee(n,"[",Fm),ee(n,"]",Bm),ee(n,"(",Vm),ee(n,")",Hm),ee(n,"<",Um),ee(n,">",qm),ee(n,"(",Wm),ee(n,")",Km),ee(n,"「",Qm),ee(n,"」",Gm),ee(n,"『",Jm),ee(n,"』",Zm),ee(n,"<",Ym),ee(n,">",Xm),ee(n,"&",eg),ee(n,"*",ng),ee(n,"@",Ji),ee(n,"`",sg),ee(n,"^",ig),ee(n,":",to),ee(n,",",bS),ee(n,"$",og),ee(n,".",Ms),ee(n,"=",lg),ee(n,"!",kS),ee(n,"-",Pr),ee(n,"%",bd),ee(n,"|",ag),ee(n,"+",ug),ee(n,"#",cg),ee(n,"?",kd),ee(n,'"',SS),ee(n,"/",Os),ee(n,";",CS),ee(n,"~",Sd),ee(n,"_",dg),ee(n,"\\",rg),ee(n,"・",wz);const r=Mt(n,ni,vS,{[ub]:!0});Mt(r,ni,r);const s=Mt(r,ti,xz,{[xd]:!0}),i=Mt(r,_c,vz,{[Gc]:!0}),o=Mt(n,ti,ii,{[cb]:!0});Mt(o,ni,s),Mt(o,ti,o),Mt(s,ni,s),Mt(s,ti,s);const l=Mt(n,_c,hb,{[db]:!0});Mt(l,ti),Mt(l,ni,i),Mt(l,_c,l),Mt(i,ni,i),Mt(i,ti),Mt(i,_c,i);const a=ee(n,Tv,wS,{[Cv]:!0}),u=ee(n,SM,gb,{[Cv]:!0}),c=Mt(n,Nv,gb,{[Cv]:!0});ee(n,Rv,c),ee(u,Tv,a),ee(u,Rv,c),Mt(u,Nv,c),ee(c,SM),ee(c,Tv),Mt(c,Nv,c),ee(c,Rv,c);const d=Mt(n,Ev,bz,{[yz]:!0});ee(d,"#"),Mt(d,Ev,d),ee(d,wue,d);const h=ee(d,bue);ee(h,"#"),Mt(h,Ev,d);const f=[[ti,o],[ni,s]],m=[[ti,null],[_c,l],[ni,i]];for(let g=0;g<Vh.length;g++)Bi(n,Vh[g],pb,ii,f);for(let g=0;g<Hh.length;g++)Bi(n,Hh[g],mb,hb,m);Sl(pb,{tld:!0,ascii:!0},t),Sl(mb,{utld:!0,alpha:!0},t),Bi(n,"file",Np,ii,f),Bi(n,"mailto",Np,ii,f),Bi(n,"http",Da,ii,f),Bi(n,"https",Da,ii,f),Bi(n,"ftp",Da,ii,f),Bi(n,"ftps",Da,ii,f),Sl(Np,{scheme:!0,ascii:!0},t),Sl(Da,{slashscheme:!0,ascii:!0},t),e=e.sort((g,v)=>g[0]>v[0]?1:-1);for(let g=0;g<e.length;g++){const v=e[g][0],w=e[g][1]?{[gue]:!0}:{[yue]:!0};v.indexOf("-")>=0?w[fb]=!0:ti.test(v)?ni.test(v)?w[xd]=!0:w[cb]=!0:w[ub]=!0,kM(n,v,v,w)}return kM(n,"localhost",cf,{ascii:!0}),n.jd=new Xn(fg),{start:n,tokens:Object.assign({groups:t},kz)}}function Sz(e,t){const n=Sue(t.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,s=[];let i=0,o=0;for(;o<r;){let l=e,a=null,u=0,c=null,d=-1,h=-1;for(;o<r&&(a=l.go(n[o]));)l=a,l.accepts()?(d=0,h=0,c=l):d>=0&&(d+=n[o].length,h++),u+=n[o].length,i+=n[o].length,o++;i-=d,o-=h,u-=d,s.push({t:c.t,v:t.slice(i-u,i),s:i-u,e:i})}return s}function Sue(e){const t=[],n=e.length;let r=0;for(;r<n;){let s=e.charCodeAt(r),i,o=s<55296||s>56319||r+1===n||(i=e.charCodeAt(r+1))<56320||i>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function Bi(e,t,n,r,s){let i;const o=t.length;for(let l=0;l<o-1;l++){const a=t[l];e.j[a]?i=e.j[a]:(i=new Xn(r),i.jr=s.slice(),e.j[a]=i),e=i}return i=new Xn(n),i.jr=s.slice(),e.j[t[o-1]]=i,i}function CM(e){const t=[],n=[];let r=0,s="0123456789";for(;r<e.length;){let i=0;for(;s.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(""));for(let o=parseInt(e.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(e[r]),r++}return t}const df={defaultProtocol:"http",events:null,format:EM,formatHref:EM,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ES(e,t=null){let n=Object.assign({},df);e&&(n=Object.assign(n,e instanceof ES?e.o:e));const r=n.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=s}ES.prototype={o:df,ignoreTags:[],defaultRender(e){return e},check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=t!=null;let s=this.o[e];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:df[e],typeof s=="function"&&r&&(s=s(t,n))):typeof s=="function"&&r&&(s=s(t,n.t,n)),s)},getObj(e,t,n){let r=this.o[e];return typeof r=="function"&&t!=null&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}};function EM(e){return e}function Cz(e,t){this.t="token",this.v=e,this.tk=t}Cz.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=df.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),s=e.get("tagName",n,t),i=this.toFormattedString(e),o={},l=e.get("className",n,t),a=e.get("target",n,t),u=e.get("rel",n,t),c=e.getObj("attributes",n,t),d=e.getObj("events",n,t);return o.href=r,l&&(o.class=l),a&&(o.target=a),u&&(o.rel=u),c&&Object.assign(o,c),{tagName:s,attributes:o,content:i,eventListeners:d}}};function My(e,t){class n extends Cz{constructor(s,i){super(s,i),this.t=e}}for(const r in t)n.prototype[r]=t[r];return n.t=e,n}const NM=My("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),TM=My("text"),Cue=My("nl"),Uh=My("url",{isLink:!0,toHref(e=df.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==cf&&e[1].t===to}}),jr=e=>new Xn(e);function Eue({groups:e}){const t=e.domain.concat([eg,ng,Ji,rg,sg,ig,og,lg,Pr,vS,bd,ag,ug,cg,Os,fg,Sd,dg]),n=[tg,to,bS,Ms,kS,bd,kd,SS,CS,Um,qm,vd,wd,Bm,Fm,Vm,Hm,Wm,Km,Qm,Gm,Jm,Zm,Ym,Xm],r=[eg,tg,ng,rg,sg,ig,og,lg,Pr,vd,wd,bd,ag,ug,cg,kd,Os,fg,Sd,dg],s=jr(),i=ee(s,Sd);Be(i,r,i),Be(i,e.domain,i);const o=jr(),l=jr(),a=jr();Be(s,e.domain,o),Be(s,e.scheme,l),Be(s,e.slashscheme,a),Be(o,r,i),Be(o,e.domain,o);const u=ee(o,Ji);ee(i,Ji,u),ee(l,Ji,u),ee(a,Ji,u);const c=ee(i,Ms);Be(c,r,i),Be(c,e.domain,i);const d=jr();Be(u,e.domain,d),Be(d,e.domain,d);const h=ee(d,Ms);Be(h,e.domain,d);const f=jr(NM);Be(h,e.tld,f),Be(h,e.utld,f),ee(u,cf,f);const m=ee(d,Pr);ee(m,Pr,m),Be(m,e.domain,d),Be(f,e.domain,d),ee(f,Ms,h),ee(f,Pr,m);const g=ee(f,to);Be(g,e.numeric,NM);const v=ee(o,Pr),y=ee(o,Ms);ee(v,Pr,v),Be(v,e.domain,o),Be(y,r,i),Be(y,e.domain,o);const w=jr(Uh);Be(y,e.tld,w),Be(y,e.utld,w),Be(w,e.domain,o),Be(w,r,i),ee(w,Ms,y),ee(w,Pr,v),ee(w,Ji,u);const b=ee(w,to),C=jr(Uh);Be(b,e.numeric,C);const S=jr(Uh),k=jr();Be(S,t,S),Be(S,n,k),Be(k,t,S),Be(k,n,k),ee(w,Os,S),ee(C,Os,S);const E=ee(l,to),N=ee(a,to),O=ee(N,Os),T=ee(O,Os);Be(l,e.domain,o),ee(l,Ms,y),ee(l,Pr,v),Be(a,e.domain,o),ee(a,Ms,y),ee(a,Pr,v),Be(E,e.domain,S),ee(E,Os,S),ee(E,kd,S),Be(T,e.domain,S),Be(T,t,S),ee(T,Os,S);const j=[[vd,wd],[Fm,Bm],[Vm,Hm],[Um,qm],[Wm,Km],[Qm,Gm],[Jm,Zm],[Ym,Xm]];for(let A=0;A<j.length;A++){const[z,D]=j[A],L=ee(S,z);ee(k,z,L),ee(L,D,S);const H=jr(Uh);Be(L,t,H);const K=jr();Be(L,n),Be(H,t,H),Be(H,n,K),Be(K,t,H),Be(K,n,K),ee(H,D,S),ee(K,D,S)}return ee(s,cf,w),ee(s,wS,Cue),{start:s,tokens:kz}}function Nue(e,t,n){let r=n.length,s=0,i=[],o=[];for(;s<r;){let l=e,a=null,u=null,c=0,d=null,h=-1;for(;s<r&&!(a=l.go(n[s].t));)o.push(n[s++]);for(;s<r&&(u=a||l.go(n[s].t));)a=null,l=u,l.accepts()?(h=0,d=l):h>=0&&h++,s++,c++;if(h<0)s-=c,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push(Mv(TM,t,o)),o=[]),s-=h,c-=h;const f=d.t,m=n.slice(s-c,s);i.push(Mv(f,t,m))}}return o.length>0&&i.push(Mv(TM,t,o)),i}function Mv(e,t,n){const r=n[0].s,s=n[n.length-1].e,i=t.slice(r,s);return new e(i,n)}const Tue=typeof console<"u"&&console&&console.warn||(()=>{}),Rue="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",vt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Mue(){return Xn.groups={},vt.scanner=null,vt.parser=null,vt.tokenQueue=[],vt.pluginQueue=[],vt.customSchemes=[],vt.initialized=!1,vt}function RM(e,t=!1){if(vt.initialized&&Tue(`linkifyjs: already initialized - will not register custom scheme "${e}" ${Rue}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format.
|
|
640
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
641
|
+
2. Cannot start or end with "-"
|
|
642
|
+
3. "-" cannot repeat`);vt.customSchemes.push([e,t])}function Oue(){vt.scanner=kue(vt.customSchemes);for(let e=0;e<vt.tokenQueue.length;e++)vt.tokenQueue[e][1]({scanner:vt.scanner});vt.parser=Eue(vt.scanner.tokens);for(let e=0;e<vt.pluginQueue.length;e++)vt.pluginQueue[e][1]({scanner:vt.scanner,parser:vt.parser});return vt.initialized=!0,vt}function NS(e){return vt.initialized||Oue(),Nue(vt.parser.start,e,Sz(vt.scanner.start,e))}NS.scan=Sz;function Ez(e,t=null,n=null){if(t&&typeof t=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new ES(n),s=NS(e),i=[];for(let o=0;o<s.length;o++){const l=s[o];l.isLink&&(!t||l.t===t)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}var TS="[\0- -\u2029 ]",jue=new RegExp(TS),Pue=new RegExp(`${TS}$`),Aue=new RegExp(TS,"g");function _ue(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function Iue(e){return new bt({key:new St("autolink"),appendTransaction:(t,n,r)=>{const s=t.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=t.some(u=>u.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,l=mL(n.doc,[...t]);if(kL(l).forEach(({newRange:u})=>{const c=dX(r.doc,u,f=>f.isTextblock);let d,h;if(c.length>1)d=c[0],h=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(c.length){const f=r.doc.textBetween(u.from,u.to," "," ");if(!Pue.test(f))return;d=c[0],h=r.doc.textBetween(d.pos,u.to,void 0," ")}if(d&&h){const f=h.split(jue).filter(Boolean);if(f.length<=0)return!1;const m=f[f.length-1],g=d.pos+h.lastIndexOf(m);if(!m)return!1;const v=NS(m).map(y=>y.toObject(e.defaultProtocol));if(!_ue(v))return!1;v.filter(y=>y.isLink).map(y=>({...y,from:g+y.start+1,to:g+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>e.validate(y.value)).filter(y=>e.shouldAutoLink(y.value)).forEach(y=>{H1(y.from,y.to,r.doc).some(w=>w.mark.type===e.type)||o.addMark(y.from,y.to,e.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function Due(e){return new bt({key:new St("handleClickLink"),props:{handleClick:(t,n,r)=>{var s,i;if(r.button!==0||!t.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const a=r.target;if(!a)return!1;const u=e.editor.view.dom;o=a.closest("a"),o&&!u.contains(o)&&(o=null)}if(!o)return!1;let l=!1;if(e.enableClickSelection&&(l=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){const a=bL(t.state,e.type.name),u=(s=o.href)!=null?s:a.href,c=(i=o.target)!=null?i:a.target;u&&(window.open(u,c),l=!0)}return l}}})}function Lue(e){return new bt({key:new St("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{shouldAutoLink:s}=e,{state:i}=t,{selection:o}=i,{empty:l}=o;if(l)return!1;let a="";r.content.forEach(c=>{a+=c.textContent});const u=Ez(a,{defaultProtocol:e.defaultProtocol}).find(c=>c.isLink&&c.value===a);return!a||!u||s!==void 0&&!s(u.value)?!1:e.editor.commands.setMark(e.type,{href:u.href})}}})}function cl(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!e||e.replace(Aue,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var $ue=fa.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(e=>{if(typeof e=="string"){RM(e);return}RM(e.scheme,e.optionalSlashes)})},onDestroy(){Mue()},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:(e,t)=>!!cl(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;const s=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:n=>!!cl(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!cl(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Vt(this.options.HTMLAttributes,e),0]:["a",Vt(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n;const r=((n=e.attrs)==null?void 0:n.href)||"";return`[${t.renderChildren(e)}](${r})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:r=>!!cl(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!cl(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[na({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,s=Ez(e).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!cl(o,n),protocols:n,defaultProtocol:r}));s.length&&s.forEach(i=>{this.options.shouldAutoLink(i.value)&&t.push({text:i.value,data:{href:i.href},index:i.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)==null?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(Iue({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!cl(s,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(Due({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(Lue({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),zue=Object.defineProperty,Fue=(e,t)=>{for(var n in t)zue(e,n,{get:t[n],enumerable:!0})},Bue="listItem",MM="textStyle",OM=/^\s*([-+*])\s$/,Nz=Rr.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:e}){return["ul",Vt(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>e.type!=="list"||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
643
|
+
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Bue,this.editor.getAttributes(MM)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Zu({find:OM,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Zu({find:OM,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(MM),editor:this.editor})),[e]}}),Tz=Rr.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",Vt(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{if(e.type!=="list_item")return[];let n=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(s=>s.type==="paragraph"))n=t.parseChildren(e.tokens);else{const s=e.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(n=[{type:"paragraph",content:t.parseInline(s.tokens)}],e.tokens.length>1){const o=e.tokens.slice(1),l=t.parseChildren(o);n.push(...l)}}else n=t.parseChildren(e.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(e,t,n)=>K1(e,t,r=>{var s,i;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((i=(s=r.meta)==null?void 0:s.parentAttrs)==null?void 0:i.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)}}}),Vue={};Fue(Vue,{findListItemPos:()=>Hf,getNextListDepth:()=>RS,handleBackspace:()=>yb,handleDelete:()=>xb,hasListBefore:()=>Rz,hasListItemAfter:()=>Hue,hasListItemBefore:()=>Mz,listItemHasSubList:()=>Oz,nextListIsDeeper:()=>jz,nextListIsHigher:()=>Pz});var Hf=(e,t)=>{const{$from:n}=t.selection,r=Bt(e,t.schema);let s=null,i=n.depth,o=n.pos,l=null;for(;i>0&&l===null;)s=n.node(i),s.type===r?l=i:(i-=1,o-=1);return l===null?null:{$pos:t.doc.resolve(o),depth:l}},RS=(e,t)=>{const n=Hf(e,t);if(!n)return!1;const[,r]=bX(t,e,n.$pos.pos+4);return r},Rz=(e,t,n)=>{const{$anchor:r}=e.selection,s=Math.max(0,r.pos-2),i=e.doc.resolve(s).node();return!(!i||!n.includes(i.type.name))},Mz=(e,t)=>{var n;const{$anchor:r}=t.selection,s=t.doc.resolve(r.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==e)},Oz=(e,t,n)=>{if(!n)return!1;const r=Bt(e,t.schema);let s=!1;return n.descendants(i=>{i.type===r&&(s=!0)}),s},yb=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!Ko(e.state,t)&&Rz(e.state,t,n)){const{$anchor:l}=e.state.selection,a=e.state.doc.resolve(l.before()-1),u=[];a.node().descendants((h,f)=>{h.type.name===t&&u.push({node:h,pos:f})});const c=u.at(-1);if(!c)return!1;const d=e.state.doc.resolve(a.start()+c.pos+1);return e.chain().cut({from:l.start()-1,to:l.end()+1},d.end()).joinForward().run()}if(!Ko(e.state,t)||!EX(e.state))return!1;const r=Hf(t,e.state);if(!r)return!1;const i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=Oz(t,e.state,i);return Mz(t,e.state)&&!o?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},jz=(e,t)=>{const n=RS(e,t),r=Hf(e,t);return!r||!n?!1:n>r.depth},Pz=(e,t)=>{const n=RS(e,t),r=Hf(e,t);return!r||!n?!1:n<r.depth},xb=(e,t)=>{if(!Ko(e.state,t)||!CX(e.state,t))return!1;const{selection:n}=e.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:jz(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():Pz(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},Hue=(e,t)=>{var n;const{$anchor:r}=t.selection,s=t.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==e)},Az=Ct.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&xb(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&xb(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&yb(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&yb(e,n,r)&&(t=!0)}),t}}}}),jM=/^(\s*)(\d+)\.\s+(.*)$/,Uue=/^\s/;function que(e){const t=[];let n=0,r=0;for(;n<e.length;){const s=e[n],i=s.match(jM);if(!i)break;const[,o,l,a]=i,u=o.length;let c=a,d=n+1;const h=[s];for(;d<e.length;){const f=e[d];if(f.match(jM))break;if(f.trim()==="")h.push(f),c+=`
|
|
644
|
+
`,d+=1;else if(f.match(Uue))h.push(f),c+=`
|
|
645
|
+
${f.slice(u+2)}`,d+=1;else break}t.push({indent:u,number:parseInt(l,10),content:c.trim(),raw:h.join(`
|
|
646
|
+
`)}),r=d,n=d}return[t,r]}function _z(e,t,n){var r;const s=[];let i=0;for(;i<e.length;){const o=e[i];if(o.indent===t){const l=o.content.split(`
|
|
647
|
+
`),a=((r=l[0])==null?void 0:r.trim())||"",u=[];a&&u.push({type:"paragraph",raw:a,tokens:n.inlineTokens(a)});const c=l.slice(1).join(`
|
|
648
|
+
`).trim();if(c){const f=n.blockTokens(c);u.push(...f)}let d=i+1;const h=[];for(;d<e.length&&e[d].indent>t;)h.push(e[d]),d+=1;if(h.length>0){const f=Math.min(...h.map(g=>g.indent)),m=_z(h,f,n);u.push({type:"list",ordered:!0,start:h[0].number,items:m,raw:h.map(g=>g.raw).join(`
|
|
649
|
+
`)})}s.push({type:"list_item",raw:o.raw,tokens:u}),i=d}else i+=1}return s}function Wue(e,t){return e.map(n=>{if(n.type!=="list_item")return t.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...t.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=t.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=t.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var Kue="listItem",PM="textStyle",AM=/^(\d+)\.\s$/,Iz=Rr.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:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",Vt(this.options.HTMLAttributes,n),0]:["ol",Vt(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{if(e.type!=="list"||!e.ordered)return[];const n=e.start||1,r=e.items?Wue(e.items,t):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
650
|
+
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{const t=e.match(/^(\s*)(\d+)\.\s+/),n=t==null?void 0:t.index;return n!==void 0?n:-1},tokenize:(e,t,n)=>{var r;const s=e.split(`
|
|
651
|
+
`),[i,o]=que(s);if(i.length===0)return;const l=_z(i,0,n);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:l,raw:s.slice(0,o).join(`
|
|
652
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Kue,this.editor.getAttributes(PM)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Zu({find:AM,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Zu({find:AM,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(PM)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),Que=/^\s*(\[([( |x])?\])\s$/,Gue=Rr.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:e=>{const t=e.getAttribute("data-checked");return t===""||t==="true"},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",Vt(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{const n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){const r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;const s=`- [${(n=e.attrs)!=null&&n.checked?"x":" "}] `;return K1(e,t,s)},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),u=d=>{var h,f;l.ariaLabel=((f=(h=this.options.a11y)==null?void 0:h.checkboxLabel)==null?void 0:f.call(h,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};u(e),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:h}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const m=n();if(typeof m!="number")return!1;const g=f.doc.nodeAt(m);return f.setNodeMarkup(m,void 0,{...g==null?void 0:g.attrs,checked:h}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,h)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,h])=>{s.setAttribute(d,h)}),s.dataset.checked=e.attrs.checked,l.checked=e.attrs.checked,i.append(l,o),s.append(i,a),Object.entries(t).forEach(([d,h])=>{s.setAttribute(d,h)});let c=new Set(Object.keys(t));return{dom:s,contentDOM:a,update:d=>{if(d.type!==this.type)return!1;s.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,u(d);const h=r.extensionManager.attributes,f=lf(d,h),m=new Set(Object.keys(f)),g=this.options.HTMLAttributes;return c.forEach(v=>{m.has(v)||(v in g?s.setAttribute(v,g[v]):s.removeAttribute(v))}),Object.entries(f).forEach(([v,y])=>{y==null?v in g?s.setAttribute(v,g[v]):s.removeAttribute(v):s.setAttribute(v,y)}),c=m,!0}}}},addInputRules(){return[Zu({find:Que,type:this.type,getAttributes:e=>({checked:e[e.length-1]==="x"})})]}}),Jue=Rr.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:e}){return["ul",Vt(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
653
|
+
`):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;const n=(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:t.index;return n!==void 0?n:-1},tokenize(e,t,n){const r=i=>{const o=qw(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(i)},s=qw(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ct.create({name:"listKit",addExtensions(){const e=[];return this.options.bulletList!==!1&&e.push(Nz.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(Tz.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(Az.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Iz.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Gue.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Jue.configure(this.options.taskList)),e}});var _M=" ",Zue=" ",Yue=Rr.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",Vt(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const n=e.tokens||[];if(n.length===1&&n[0].type==="image")return t.parseChildren([n[0]]);const r=t.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===_M||r[0].text===Zue)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,r)},renderMarkdown:(e,t)=>{if(!e)return"";const n=Array.isArray(e.content)?e.content:[];return n.length===0?_M:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Xue=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,ece=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,tce=fa.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",Vt(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ju({find:Xue,type:this.type})]},addPasteRules(){return[na({find:ece,type:this.type})]}}),nce=Rr.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),rce=fa.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",Vt(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,t,n){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!s)return;const i=s[2].trim();return{type:"underline",raw:s[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function sce(e={}){return new bt({view(t){return new ice(t,e)}})}class ice{constructor(t,n){var r;this.editorView=t,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(s=>{let i=o=>{this[s](o)};return t.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,l=i.height/s.offsetHeight;if(n){let d=t.nodeBefore,h=t.nodeAfter;if(d||h){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let m=f.getBoundingClientRect(),g=d?m.bottom:m.top;d&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*l;r={left:m.left,right:m.right,top:g-v,bottom:g+v}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:d.left-h,right:d.left+h,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,c;if(!a||a==document.body&&getComputedStyle(a).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=a.getBoundingClientRect(),h=d.width/a.offsetWidth,f=d.height/a.offsetHeight;u=d.left-a.scrollLeft*h,c=d.top-a.scrollTop*f}this.element.style.left=(r.left-u)/o+"px",this.element.style.top=(r.top-c)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,t):s;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=aD(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}class Pt extends Pe{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return Pt.valid(r)?new Pt(r):Pe.near(r)}content(){return ue.empty}eq(t){return t instanceof Pt&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Pt(t.resolve(n.pos))}getBookmark(){return new MS(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!oce(t)||!lce(t))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(t.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(t,n,r=!1){e:for(;;){if(!r&&Pt.valid(t))return t;let s=t.pos,i=null;for(let o=t.depth;;o--){let l=t.node(o);if(n>0?t.indexAfter(o)<l.childCount:t.index(o)>0){i=l.child(n>0?t.indexAfter(o):t.index(o)-1);break}else if(o==0)return null;s+=n;let a=t.doc.resolve(s);if(Pt.valid(a))return a}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!Te.isSelectable(i)){t=t.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let l=t.doc.resolve(s);if(Pt.valid(l))return l}return null}}}Pt.prototype.visible=!1;Pt.findFrom=Pt.findGapCursorFrom;Pe.jsonID("gapcursor",Pt);class MS{constructor(t){this.pos=t}map(t){return new MS(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return Pt.valid(n)?new Pt(n):Pe.near(n)}}function Dz(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function oce(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||Dz(s.type))return!0;if(s.inlineContent)return!1}}return!0}function lce(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||Dz(s.type))return!0;if(s.inlineContent)return!1}}return!0}function ace(){return new bt({props:{decorations:fce,createSelectionBetween(e,t,n){return t.pos==n.pos&&Pt.valid(n)?new Pt(n):null},handleClick:cce,handleKeyDown:uce,handleDOMEvents:{beforeinput:dce}}})}const uce=I1({ArrowLeft:qh("horiz",-1),ArrowRight:qh("horiz",1),ArrowUp:qh("vert",-1),ArrowDown:qh("vert",1)});function qh(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,s,i){let o=r.selection,l=t>0?o.$to:o.$from,a=o.empty;if(o instanceof _e){if(!i.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(t>0?l.after():l.before())}let u=Pt.findGapCursorFrom(l,t,a);return u?(s&&s(r.tr.setSelection(new Pt(u))),!0):!1}}function cce(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Pt.valid(r))return!1;let s=e.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&Te.isSelectable(e.state.doc.nodeAt(s.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Pt(r))),!0)}function dce(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof Pt))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let s=J.empty;for(let o=r.length-1;o>=0;o--)s=J.from(r[o].createAndFill(null,s));let i=e.state.tr.replace(n.pos,n.pos,new ue(s,0,0));return i.setSelection(_e.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function fce(e){if(!(e.selection instanceof Pt))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Nt.create(e.doc,[zn.widget(e.selection.head,t,{key:"gapcursor"})])}var hg=200,nn=function(){};nn.prototype.append=function(t){return t.length?(t=nn.from(t),!this.length&&t||t.length<hg&&this.leafAppend(t)||this.length<hg&&t.leafPrepend(this)||this.appendInner(t)):this};nn.prototype.prepend=function(t){return t.length?nn.from(t).append(this):this};nn.prototype.appendInner=function(t){return new hce(this,t)};nn.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?nn.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};nn.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};nn.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};nn.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(t(i,o))},n,r),s};nn.from=function(t){return t instanceof nn?t:t&&t.length?new Lz(t):nn.empty};var Lz=function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new t(this.values.slice(s,i))},t.prototype.getInner=function(s){return this.values[s]},t.prototype.forEachInner=function(s,i,o,l){for(var a=i;a<o;a++)if(s(this.values[a],l+a)===!1)return!1},t.prototype.forEachInvertedInner=function(s,i,o,l){for(var a=i-1;a>=o;a--)if(s(this.values[a],l+a)===!1)return!1},t.prototype.leafAppend=function(s){if(this.length+s.length<=hg)return new t(this.values.concat(s.flatten()))},t.prototype.leafPrepend=function(s){if(this.length+s.length<=hg)return new t(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(nn);nn.empty=new Lz([]);var hce=function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,s,i,o){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(i,l),o)===!1||i>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,i)-l,o+l)===!1)return!1},t.prototype.forEachInvertedInner=function(r,s,i,o){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(i,l)-l,o+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(s,l),i,o)===!1)return!1},t.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},t.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new t(this.left,s)},t.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new t(s,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(nn);const pce=500;class cs{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=t.tr,l,a,u=[],c=[];return this.items.forEach((d,h)=>{if(!d.step){s||(s=this.remapping(r,h+1),i=s.maps.length),i--,c.push(d);return}if(s){c.push(new js(d.map));let f=d.step.map(s.slice(i)),m;f&&o.maybeStep(f).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],u.push(new js(m,void 0,void 0,u.length+c.length))),i--,m&&s.appendMap(m,i)}else o.maybeStep(d.step);if(d.selection)return l=s?d.selection.map(s.slice(i)):d.selection,a=new cs(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(t,n,r,s){let i=[],o=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let c=0;c<t.steps.length;c++){let d=t.steps[c].invert(t.docs[c]),h=new js(t.mapping.maps[c],d,n),f;(f=a&&a.merge(h))&&(h=f,c?i.pop():l=l.slice(0,l.length-1)),i.push(h),n&&(o++,n=void 0),s||(a=h)}let u=o-r.depth;return u>gce&&(l=mce(l,u),o-=u),new cs(l.append(i),o)}remapping(t,n){let r=new ef;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=t?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},t,n),r}addMaps(t){return this.eventCount==0?this:new cs(this.items.append(t.map(n=>new js(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=t.mapping,o=t.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},s);let a=n;this.items.forEach(h=>{let f=i.getMirror(--a);if(f==null)return;o=Math.min(o,f);let m=i.maps[f];if(h.step){let g=t.steps[f].invert(t.docs[f]),v=h.selection&&h.selection.map(i.slice(a+1,f));v&&l++,r.push(new js(m,g,v))}else r.push(new js(m))},s);let u=[];for(let h=n;h<o;h++)u.push(new js(i.maps[h]));let c=this.items.slice(0,s).append(u).append(r),d=new cs(c,l);return d.emptyItemCount()>pce&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,s=[],i=0;return this.items.forEach((o,l)=>{if(l>=t)s.push(o),o.selection&&i++;else if(o.step){let a=o.step.map(n.slice(r)),u=a&&a.getMap();if(r--,u&&n.appendMap(u,r),a){let c=o.selection&&o.selection.map(n.slice(r));c&&i++;let d=new js(u.invert(),a,c),h,f=s.length-1;(h=s.length&&s[f].merge(d))?s[f]=h:s.push(d)}}else o.map&&r--},this.items.length,0),new cs(nn.from(s.reverse()),i)}}cs.empty=new cs(nn.empty,0);function mce(e,t){let n;return e.forEach((r,s)=>{if(r.selection&&t--==0)return n=s,!1}),e.slice(n)}class js{constructor(t,n,r,s){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=s}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new js(n.getMap().invert(),n,this.selection)}}}class Zi{constructor(t,n,r,s,i){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const gce=20;function yce(e,t,n,r){let s=n.getMeta(Fl),i;if(s)return s.historyState;n.getMeta(wce)&&(e=new Zi(e.done,e.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(o&&o.getMeta(Fl))return o.getMeta(Fl).redo?new Zi(e.done.addTransform(n,void 0,r,Tp(t)),e.undone,IM(n.mapping.maps),e.prevTime,e.prevComposition):new Zi(e.done,e.undone.addTransform(n,void 0,r,Tp(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=e.prevTime==0||!o&&e.prevComposition!=l&&(e.prevTime<(n.time||0)-r.newGroupDelay||!xce(n,e.prevRanges)),u=o?Ov(e.prevRanges,n.mapping):IM(n.mapping.maps);return new Zi(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,Tp(t)),cs.empty,u,n.time,l??e.prevComposition)}else return(i=n.getMeta("rebased"))?new Zi(e.done.rebased(n,i),e.undone.rebased(n,i),Ov(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Zi(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Ov(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function xce(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<t.length;i+=2)r<=t[i+1]&&s>=t[i]&&(n=!0)}),n}function IM(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,s,i,o)=>t.push(i,o));return t}function Ov(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let s=t.map(e[r],1),i=t.map(e[r+1],-1);s<=i&&n.push(s,i)}return n}function vce(e,t,n){let r=Tp(t),s=Fl.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),l=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),s,r),a=new Zi(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(Fl,{redo:n,historyState:a})}let jv=!1,DM=null;function Tp(e){let t=e.plugins;if(DM!=t){jv=!1,DM=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){jv=!0;break}}return jv}const Fl=new St("history"),wce=new St("closeHistory");function bce(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new bt({key:Fl,state:{init(){return new Zi(cs.empty,cs.empty,null,0,-1)},apply(t,n,r){return yce(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,s=r=="historyUndo"?zz:r=="historyRedo"?Fz:null;return!s||!t.editable?!1:(n.preventDefault(),s(t.state,t.dispatch))}}}})}function $z(e,t){return(n,r)=>{let s=Fl.getState(n);if(!s||(e?s.undone:s.done).eventCount==0)return!1;if(r){let i=vce(s,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const zz=$z(!1,!0),Fz=$z(!0,!0);Ct.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(t=>t!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{const t=(e==null?void 0:e.node)||this.editor.state.doc;if(((e==null?void 0:e.mode)||this.options.mode)==="textSize"){const r=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(r)}return t.nodeSize},this.storage.words=e=>{const t=(e==null?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new bt({key:new St("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;const s=this.options.limit;if(s==null||s===0){e=!0;return}const i=this.storage.characters({node:r.doc});if(i>s){const o=i-s,l=0,a=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(l,a);return e=!0,u}e=!0},filterTransaction:(t,n)=>{const r=this.options.limit;if(!t.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),i=this.storage.characters({node:t.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!t.getMeta("paste"))return!1;const l=t.selection.$head.pos,a=i-r,u=l-a,c=l;return t.deleteRange(u,c),!(this.storage.characters({node:t.doc})>r)}})]}});var kce=Ct.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[sce(this.options)]}});Ct.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new bt({key:new St("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=t,i=[];if(!n||!r)return Nt.create(e,[]);let o=0;this.options.mode==="deepest"&&e.descendants((a,u)=>{if(a.isText)return;if(!(s>=u&&s<=u+a.nodeSize-1))return!1;o+=1});let l=0;return e.descendants((a,u)=>{if(a.isText||!(s>=u&&s<=u+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(zn.node(u,u+a.nodeSize,{class:this.options.className}))}),Nt.create(e,i)}}})]}});var Sce=Ct.create({name:"gapCursor",addProseMirrorPlugins(){return[ace()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=ot(ke(e,"allowGapCursor",n)))!=null?t:null}}}),LM="placeholder";function Cce(e){return e.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}Ct.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:LM,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const e=this.options.dataAttribute?`data-${Cce(this.options.dataAttribute)}`:`data-${LM}`;return[new bt({key:new St("placeholder"),props:{decorations:({doc:t,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:s}=n,i=[];if(!r)return null;const o=this.editor.isEmpty;return t.descendants((l,a)=>{const u=s>=a&&s<=a+l.nodeSize,c=!l.isLeaf&&my(l);if((u||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];o&&d.push(this.options.emptyEditorClass);const h=zn.node(a,a+l.nodeSize,{class:d.join(" "),[e]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:a,hasAnchor:u}):this.options.placeholder});i.push(h)}return this.options.includeChildren}),Nt.create(t,i)}}})]}});Ct.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new bt({key:new St("selection"),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||SL(n.selection)||e.view.dragging?null:Nt.create(n.doc,[zn.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function $M({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(t==null?void 0:t.type)===e}var Ece=Ct.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var e;const t=new St(this.name),n=this.options.node||((e=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new bt({key:t,appendTransaction:(s,i,o)=>{const{doc:l,tr:a,schema:u}=o,c=t.getState(o),d=l.content.size,h=u.nodes[n];if(c)return a.insert(d,h.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!$M({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!$M({node:o,types:r})}}})]}}),Nce=Ct.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>zz(e,t),redo:()=>({state:e,dispatch:t})=>Fz(e,t)}},addProseMirrorPlugins(){return[bce(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()}}}),Tce=Ct.create({name:"starterKit",addExtensions(){var e,t,n,r;const s=[];return this.options.bold!==!1&&s.push(Yae.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(Kae.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(Nz.configure(this.options.bulletList)),this.options.code!==!1&&s.push(tue.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(sue.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(iue.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(kce.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(Sce.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(oue.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(lue.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(Nce.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(aue.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(hue.configure(this.options.italic)),this.options.listItem!==!1&&s.push(Tz.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(Az.configure((e=this.options)==null?void 0:e.listKeymap)),this.options.link!==!1&&s.push($ue.configure((t=this.options)==null?void 0:t.link)),this.options.orderedList!==!1&&s.push(Iz.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(Yue.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(tce.configure(this.options.strike)),this.options.text!==!1&&s.push(nce.configure(this.options.text)),this.options.underline!==!1&&s.push(rce.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(Ece.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),Rce=Tce;function OS(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ma=OS();function Bz(e){ma=e}var Cd={exec:()=>null};function tt(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(Fn.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,t)};return r}var Mce=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Fn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Oce=/^(?:[ \t]*(?:\n|$))+/,jce=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Pce=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Uf=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ace=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,jS=/(?:[*+-]|\d{1,9}[.)])/,Vz=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Hz=tt(Vz).replace(/bull/g,jS).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),_ce=tt(Vz).replace(/bull/g,jS).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),PS=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ice=/^[^\n]+/,AS=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Dce=tt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",AS).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Lce=tt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,jS).getRegex(),Oy="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",_S=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,$ce=tt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",_S).replace("tag",Oy).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Uz=tt(PS).replace("hr",Uf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Oy).getRegex(),zce=tt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Uz).getRegex(),IS={blockquote:zce,code:jce,def:Dce,fences:Pce,heading:Ace,hr:Uf,html:$ce,lheading:Hz,list:Lce,newline:Oce,paragraph:Uz,table:Cd,text:Ice},zM=tt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Uf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Oy).getRegex(),Fce={...IS,lheading:_ce,table:zM,paragraph:tt(PS).replace("hr",Uf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",zM).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Oy).getRegex()},Bce={...IS,html:tt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",_S).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Cd,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:tt(PS).replace("hr",Uf).replace("heading",` *#{1,6} *[^
|
|
654
|
+
]`).replace("lheading",Hz).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Vce=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Hce=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,qz=/^( {2,}|\\)\n(?!\s*$)/,Uce=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,jy=/[\p{P}\p{S}]/u,DS=/[\s\p{P}\p{S}]/u,Wz=/[^\s\p{P}\p{S}]/u,qce=tt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,DS).getRegex(),Kz=/(?!~)[\p{P}\p{S}]/u,Wce=/(?!~)[\s\p{P}\p{S}]/u,Kce=/(?:[^\s\p{P}\p{S}]|~)/u,Qce=tt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Mce?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Qz=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Gce=tt(Qz,"u").replace(/punct/g,jy).getRegex(),Jce=tt(Qz,"u").replace(/punct/g,Kz).getRegex(),Gz="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Zce=tt(Gz,"gu").replace(/notPunctSpace/g,Wz).replace(/punctSpace/g,DS).replace(/punct/g,jy).getRegex(),Yce=tt(Gz,"gu").replace(/notPunctSpace/g,Kce).replace(/punctSpace/g,Wce).replace(/punct/g,Kz).getRegex(),Xce=tt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Wz).replace(/punctSpace/g,DS).replace(/punct/g,jy).getRegex(),ede=tt(/\\(punct)/,"gu").replace(/punct/g,jy).getRegex(),tde=tt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),nde=tt(_S).replace("(?:-->|$)","-->").getRegex(),rde=tt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",nde).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),pg=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,sde=tt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",pg).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Jz=tt(/^!?\[(label)\]\[(ref)\]/).replace("label",pg).replace("ref",AS).getRegex(),Zz=tt(/^!?\[(ref)\](?:\[\])?/).replace("ref",AS).getRegex(),ide=tt("reflink|nolink(?!\\()","g").replace("reflink",Jz).replace("nolink",Zz).getRegex(),FM=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,LS={_backpedal:Cd,anyPunctuation:ede,autolink:tde,blockSkip:Qce,br:qz,code:Hce,del:Cd,emStrongLDelim:Gce,emStrongRDelimAst:Zce,emStrongRDelimUnd:Xce,escape:Vce,link:sde,nolink:Zz,punctuation:qce,reflink:Jz,reflinkSearch:ide,tag:rde,text:Uce,url:Cd},ode={...LS,link:tt(/^!?\[(label)\]\((.*?)\)/).replace("label",pg).getRegex(),reflink:tt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",pg).getRegex()},vb={...LS,emStrongRDelimAst:Yce,emStrongLDelim:Jce,url:tt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",FM).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:tt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",FM).getRegex()},lde={...vb,br:tt(qz).replace("{2,}","*").getRegex(),text:tt(vb.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Wh={normal:IS,gfm:Fce,pedantic:Bce},Ic={normal:LS,gfm:vb,breaks:lde,pedantic:ode},ade={"&":"&","<":"<",">":">",'"':""","'":"'"},BM=e=>ade[e];function oi(e,t){if(t){if(Fn.escapeTest.test(e))return e.replace(Fn.escapeReplace,BM)}else if(Fn.escapeTestNoEncode.test(e))return e.replace(Fn.escapeReplaceNoEncode,BM);return e}function VM(e){try{e=encodeURI(e).replace(Fn.percentDecode,"%")}catch{return null}return e}function HM(e,t){var i;let n=e.replace(Fn.findPipe,(o,l,a)=>{let u=!1,c=l;for(;--c>=0&&a[c]==="\\";)u=!u;return u?"|":" |"}),r=n.split(Fn.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(Fn.slashPipe,"|");return r}function Dc(e,t,n){let r=e.length;if(r===0)return"";let s=0;for(;s<r&&e.charAt(r-s-1)===t;)s++;return e.slice(0,r-s)}function ude(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function UM(e,t,n,r,s){let i=t.href,o=t.title||null,l=e[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let a={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,a}function cde(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let s=r[1];return t.split(`
|
|
655
|
+
`).map(i=>{let o=i.match(n.other.beginningSpace);if(o===null)return i;let[l]=o;return l.length>=s.length?i.slice(s.length):i}).join(`
|
|
656
|
+
`)}var mg=class{constructor(e){it(this,"options");it(this,"rules");it(this,"lexer");this.options=e||ma}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Dc(n,`
|
|
657
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=cde(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=Dc(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Dc(t[0],`
|
|
658
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Dc(t[0],`
|
|
659
|
+
`).split(`
|
|
660
|
+
`),r="",s="",i=[];for(;n.length>0;){let o=!1,l=[],a;for(a=0;a<n.length;a++)if(this.rules.other.blockquoteStart.test(n[a]))l.push(n[a]),o=!0;else if(!o)l.push(n[a]);else break;n=n.slice(a);let u=l.join(`
|
|
661
|
+
`),c=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
662
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
663
|
+
${u}`:u,s=s?`${s}
|
|
664
|
+
${c}`:c;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=d,n.length===0)break;let h=i.at(-1);if((h==null?void 0:h.type)==="code")break;if((h==null?void 0:h.type)==="blockquote"){let f=h,m=f.raw+`
|
|
665
|
+
`+n.join(`
|
|
666
|
+
`),g=this.blockquote(m);i[i.length-1]=g,r=r.substring(0,r.length-f.raw.length)+g.raw,s=s.substring(0,s.length-f.text.length)+g.text;break}else if((h==null?void 0:h.type)==="list"){let f=h,m=f.raw+`
|
|
667
|
+
`+n.join(`
|
|
668
|
+
`),g=this.list(m);i[i.length-1]=g,r=r.substring(0,r.length-h.raw.length)+g.raw,s=s.substring(0,s.length-f.raw.length)+g.raw,n=m.substring(i.at(-1).raw.length).split(`
|
|
669
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(e){var n,r;let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim(),i=s.length>1,o={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");let l=this.rules.other.listItemRegex(s),a=!1;for(;e;){let c=!1,d="",h="";if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let f=t[2].split(`
|
|
670
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,y=>" ".repeat(3*y.length)),m=e.split(`
|
|
671
|
+
`,1)[0],g=!f.trim(),v=0;if(this.options.pedantic?(v=2,h=f.trimStart()):g?v=t[1].length+1:(v=t[2].search(this.rules.other.nonSpaceChar),v=v>4?1:v,h=f.slice(v),v+=t[1].length),g&&this.rules.other.blankLine.test(m)&&(d+=m+`
|
|
672
|
+
`,e=e.substring(m.length+1),c=!0),!c){let y=this.rules.other.nextBulletRegex(v),w=this.rules.other.hrRegex(v),b=this.rules.other.fencesBeginRegex(v),C=this.rules.other.headingBeginRegex(v),S=this.rules.other.htmlBeginRegex(v);for(;e;){let k=e.split(`
|
|
673
|
+
`,1)[0],E;if(m=k,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),E=m):E=m.replace(this.rules.other.tabCharGlobal," "),b.test(m)||C.test(m)||S.test(m)||y.test(m)||w.test(m))break;if(E.search(this.rules.other.nonSpaceChar)>=v||!m.trim())h+=`
|
|
674
|
+
`+E.slice(v);else{if(g||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||b.test(f)||C.test(f)||w.test(f))break;h+=`
|
|
675
|
+
`+m}!g&&!m.trim()&&(g=!0),d+=k+`
|
|
676
|
+
`,e=e.substring(k.length+1),f=E.slice(v)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(a=!0)),o.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),o.raw+=d}let u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let c of o.items){if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),c.task){if(c.text=c.text.replace(this.rules.other.listReplaceTask,""),((n=c.tokens[0])==null?void 0:n.type)==="text"||((r=c.tokens[0])==null?void 0:r.type)==="paragraph"){c.tokens[0].raw=c.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),c.tokens[0].text=c.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}}let d=this.rules.other.listTaskCheckbox.exec(c.raw);if(d){let h={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};c.checked=h.checked,o.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=h.raw+c.tokens[0].raw,c.tokens[0].text=h.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(h)):c.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):c.tokens.unshift(h)}}if(!o.loose){let d=c.tokens.filter(f=>f.type==="space"),h=d.length>0&&d.some(f=>this.rules.other.anyLine.test(f.raw));o.loose=h}}if(o.loose)for(let c of o.items){c.loose=!0;for(let d of c.tokens)d.type==="text"&&(d.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:r,title:s}}}table(e){var o;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=HM(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=t[3])!=null&&o.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
677
|
+
`):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let l of r)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<n.length;l++)i.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:i.align[l]});for(let l of s)i.rows.push(HM(l,i.header.length).map((a,u)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:i.align[u]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
678
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=Dc(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=ude(t[2],"()");if(i===-2)return;if(i>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let r=t[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),UM(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=t[r.toLowerCase()];if(!s){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return UM(n,s,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,l=s,a=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+s);(r=u.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(o=[...i].length,r[3]||r[4]){l+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){a+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+a);let c=[...r[0]][0].length,d=e.slice(0,s+r.index+c+o);if(Math.min(s,o)%2){let f=d.slice(1,-1);return{type:"em",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}let h=d.slice(2,-2);return{type:"strong",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let r,s;if(t[2]==="@")r=t[0],s="mailto:"+r;else{let i;do i=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(i!==t[0]);r=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},as=class wb{constructor(t){it(this,"tokens");it(this,"options");it(this,"state");it(this,"inlineQueue");it(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||ma,this.options.tokenizer=this.options.tokenizer||new mg,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Fn,block:Wh.normal,inline:Ic.normal};this.options.pedantic?(n.block=Wh.pedantic,n.inline=Ic.pedantic):this.options.gfm&&(n.block=Wh.gfm,this.options.breaks?n.inline=Ic.breaks:n.inline=Ic.gfm),this.tokenizer.rules=n}static get rules(){return{block:Wh,inline:Ic}}static lex(t,n){return new wb(n).lex(t)}static lexInline(t,n){return new wb(n).inlineTokens(t)}lex(t){t=t.replace(Fn.carriageReturn,`
|
|
679
|
+
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var s,i,o;for(this.options.pedantic&&(t=t.replace(Fn.tabCharGlobal," ").replace(Fn.spaceLine,""));t;){let l;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(u=>(l=u.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);let u=n.at(-1);l.raw.length===1&&u!==void 0?u.raw+=`
|
|
680
|
+
`:n.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
|
|
681
|
+
`)?"":`
|
|
682
|
+
`)+l.raw,u.text+=`
|
|
683
|
+
`+l.text,this.inlineQueue.at(-1).src=u.text):n.push(l);continue}if(l=this.tokenizer.fences(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.heading(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.hr(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.blockquote(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.list(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.html(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.def(t)){t=t.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
|
|
684
|
+
`)?"":`
|
|
685
|
+
`)+l.raw,u.text+=`
|
|
686
|
+
`+l.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},n.push(l));continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),n.push(l);continue}let a=t;if((o=this.options.extensions)!=null&&o.startBlock){let u=1/0,c=t.slice(1),d;this.options.extensions.startBlock.forEach(h=>{d=h.call({lexer:this},c),typeof d=="number"&&d>=0&&(u=Math.min(u,d))}),u<1/0&&u>=0&&(a=t.substring(0,u+1))}if(this.state.top&&(l=this.tokenizer.paragraph(a))){let u=n.at(-1);r&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=(u.raw.endsWith(`
|
|
687
|
+
`)?"":`
|
|
688
|
+
`)+l.raw,u.text+=`
|
|
689
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(l),r=a.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
|
|
690
|
+
`)?"":`
|
|
691
|
+
`)+l.raw,u.text+=`
|
|
692
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(l);continue}if(t){let u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var a,u,c,d,h;let r=t,s=null;if(this.tokens.links){let f=Object.keys(this.tokens.links);if(f.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)f.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((u=(a=this.options.hooks)==null?void 0:a.emStrongMask)==null?void 0:u.call({lexer:this},r))??r;let o=!1,l="";for(;t;){o||(l=""),o=!1;let f;if((d=(c=this.options.extensions)==null?void 0:c.inline)!=null&&d.some(g=>(f=g.call({lexer:this},t,n))?(t=t.substring(f.raw.length),n.push(f),!0):!1))continue;if(f=this.tokenizer.escape(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.tag(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.link(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(f.raw.length);let g=n.at(-1);f.type==="text"&&(g==null?void 0:g.type)==="text"?(g.raw+=f.raw,g.text+=f.text):n.push(f);continue}if(f=this.tokenizer.emStrong(t,r,l)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.codespan(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.br(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.del(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.autolink(t)){t=t.substring(f.raw.length),n.push(f);continue}if(!this.state.inLink&&(f=this.tokenizer.url(t))){t=t.substring(f.raw.length),n.push(f);continue}let m=t;if((h=this.options.extensions)!=null&&h.startInline){let g=1/0,v=t.slice(1),y;this.options.extensions.startInline.forEach(w=>{y=w.call({lexer:this},v),typeof y=="number"&&y>=0&&(g=Math.min(g,y))}),g<1/0&&g>=0&&(m=t.substring(0,g+1))}if(f=this.tokenizer.inlineText(m)){t=t.substring(f.raw.length),f.raw.slice(-1)!=="_"&&(l=f.raw.slice(-1)),o=!0;let g=n.at(-1);(g==null?void 0:g.type)==="text"?(g.raw+=f.raw,g.text+=f.text):n.push(f);continue}if(t){let g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return n}},gg=class{constructor(e){it(this,"options");it(this,"parser");this.options=e||ma}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let r=(i=(t||"").match(Fn.notSpaceStart))==null?void 0:i[0],s=e.replace(Fn.endingNewline,"")+`
|
|
693
|
+
`;return r?'<pre><code class="language-'+oi(r)+'">'+(n?s:oi(s,!0))+`</code></pre>
|
|
694
|
+
`:"<pre><code>"+(n?s:oi(s,!0))+`</code></pre>
|
|
695
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
696
|
+
${this.parser.parse(e)}</blockquote>
|
|
697
|
+
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
698
|
+
`}hr(e){return`<hr>
|
|
699
|
+
`}list(e){let t=e.ordered,n=e.start,r="";for(let o=0;o<e.items.length;o++){let l=e.items[o];r+=this.listitem(l)}let s=t?"ol":"ul",i=t&&n!==1?' start="'+n+'"':"";return"<"+s+i+`>
|
|
700
|
+
`+r+"</"+s+`>
|
|
701
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
702
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
703
|
+
`}table(e){let t="",n="";for(let s=0;s<e.header.length;s++)n+=this.tablecell(e.header[s]);t+=this.tablerow({text:n});let r="";for(let s=0;s<e.rows.length;s++){let i=e.rows[s];n="";for(let o=0;o<i.length;o++)n+=this.tablecell(i[o]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
704
|
+
<thead>
|
|
705
|
+
`+t+`</thead>
|
|
706
|
+
`+r+`</table>
|
|
707
|
+
`}tablerow({text:e}){return`<tr>
|
|
708
|
+
${e}</tr>
|
|
709
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
710
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${oi(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),s=VM(e);if(s===null)return r;e=s;let i='<a href="'+e+'"';return t&&(i+=' title="'+oi(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=VM(e);if(s===null)return oi(n);e=s;let i=`<img src="${e}" alt="${n}"`;return t&&(i+=` title="${oi(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:oi(e.text)}},$S=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},us=class bb{constructor(t){it(this,"options");it(this,"renderer");it(this,"textRenderer");this.options=t||ma,this.options.renderer=this.options.renderer||new gg,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new $S}static parse(t,n){return new bb(n).parse(t)}static parseInline(t,n){return new bb(n).parseInline(t)}parse(t){var r,s;let n="";for(let i=0;i<t.length;i++){let o=t[i];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[o.type]){let a=o,u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){n+=u||"";continue}}let l=o;switch(l.type){case"space":{n+=this.renderer.space(l);break}case"hr":{n+=this.renderer.hr(l);break}case"heading":{n+=this.renderer.heading(l);break}case"code":{n+=this.renderer.code(l);break}case"table":{n+=this.renderer.table(l);break}case"blockquote":{n+=this.renderer.blockquote(l);break}case"list":{n+=this.renderer.list(l);break}case"checkbox":{n+=this.renderer.checkbox(l);break}case"html":{n+=this.renderer.html(l);break}case"def":{n+=this.renderer.def(l);break}case"paragraph":{n+=this.renderer.paragraph(l);break}case"text":{n+=this.renderer.text(l);break}default:{let a='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(t,n=this.renderer){var s,i;let r="";for(let o=0;o<t.length;o++){let l=t[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[l.type]){let u=this.options.extensions.renderers[l.type].call({parser:this},l);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){r+=u||"";continue}}let a=l;switch(a.type){case"escape":{r+=n.text(a);break}case"html":{r+=n.html(a);break}case"link":{r+=n.link(a);break}case"image":{r+=n.image(a);break}case"checkbox":{r+=n.checkbox(a);break}case"strong":{r+=n.strong(a);break}case"em":{r+=n.em(a);break}case"codespan":{r+=n.codespan(a);break}case"br":{r+=n.br(a);break}case"del":{r+=n.del(a);break}case"text":{r+=n.text(a);break}default:{let u='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}},Gh,Jc=(Gh=class{constructor(e){it(this,"options");it(this,"block");this.options=e||ma}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?as.lex:as.lexInline}provideParser(){return this.block?us.parse:us.parseInline}},it(Gh,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),it(Gh,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Gh),dde=class{constructor(...e){it(this,"defaults",OS());it(this,"options",this.setOptions);it(this,"parse",this.parseMarkdown(!0));it(this,"parseInline",this.parseMarkdown(!1));it(this,"Parser",us);it(this,"Renderer",gg);it(this,"TextRenderer",$S);it(this,"Lexer",as);it(this,"Tokenizer",mg);it(this,"Hooks",Jc);this.use(...e)}walkTokens(e,t){var r,s;let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let o=i;for(let l of o.header)n=n.concat(this.walkTokens(l.tokens,t));for(let l of o.rows)for(let a of l)n=n.concat(this.walkTokens(a.tokens,t));break}case"list":{let o=i;n=n.concat(this.walkTokens(o.items,t));break}default:{let o=i;(s=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{let a=o[l].flat(1/0);n=n.concat(this.walkTokens(a,t))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=t.renderers[s.name];i?t.renderers[s.name]=function(...o){let l=s.renderer.apply(this,o);return l===!1&&(l=i.apply(this,o)),l}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[s.level];i?i.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),r.extensions=t),n.renderer){let s=this.defaults.renderer||new gg(this.defaults);for(let i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,l=n.renderer[o],a=s[o];s[o]=(...u)=>{let c=l.apply(s,u);return c===!1&&(c=a.apply(s,u)),c||""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new mg(this.defaults);for(let i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,l=n.tokenizer[o],a=s[o];s[o]=(...u)=>{let c=l.apply(s,u);return c===!1&&(c=a.apply(s,u)),c}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new Jc;for(let i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,l=n.hooks[o],a=s[o];Jc.passThroughHooks.has(i)?s[o]=u=>{if(this.defaults.async&&Jc.passThroughHooksRespectAsync.has(i))return(async()=>{let d=await l.call(s,u);return a.call(s,d)})();let c=l.call(s,u);return a.call(s,c)}:s[o]=(...u)=>{if(this.defaults.async)return(async()=>{let d=await l.apply(s,u);return d===!1&&(d=await a.apply(s,u)),d})();let c=l.apply(s,u);return c===!1&&(c=a.apply(s,u)),c}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(o){let l=[];return l.push(i.call(this,o)),s&&(l=l.concat(s.call(this,o))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return as.lex(e,t??this.defaults)}parser(e,t){return us.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},s={...this.defaults,...r},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(t):t,l=await(s.hooks?await s.hooks.provideLexer():e?as.lex:as.lexInline)(o,s),a=s.hooks?await s.hooks.processAllTokens(l):l;s.walkTokens&&await Promise.all(this.walkTokens(a,s.walkTokens));let u=await(s.hooks?await s.hooks.provideParser():e?us.parse:us.parseInline)(a,s);return s.hooks?await s.hooks.postprocess(u):u})().catch(i);try{s.hooks&&(t=s.hooks.preprocess(t));let o=(s.hooks?s.hooks.provideLexer():e?as.lex:as.lexInline)(t,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let l=(s.hooks?s.hooks.provideParser():e?us.parse:us.parseInline)(o,s);return s.hooks&&(l=s.hooks.postprocess(l)),l}catch(o){return i(o)}}}onError(e,t){return n=>{if(n.message+=`
|
|
711
|
+
Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+oi(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},ra=new dde;function lt(e,t){return ra.parse(e,t)}lt.options=lt.setOptions=function(e){return ra.setOptions(e),lt.defaults=ra.defaults,Bz(lt.defaults),lt};lt.getDefaults=OS;lt.defaults=ma;lt.use=function(...e){return ra.use(...e),lt.defaults=ra.defaults,Bz(lt.defaults),lt};lt.walkTokens=function(e,t){return ra.walkTokens(e,t)};lt.parseInline=ra.parseInline;lt.Parser=us;lt.parser=us.parse;lt.Renderer=gg;lt.TextRenderer=$S;lt.Lexer=as;lt.lexer=as.lex;lt.Tokenizer=mg;lt.Hooks=Jc;lt.parse=lt;lt.options;lt.setOptions;lt.use;lt.walkTokens;lt.parseInline;us.parse;as.lex;function fde(e,t){const r=t.split(`
|
|
712
|
+
`).flatMap(s=>[s,""]).map(s=>`${e}${s}`).join(`
|
|
713
|
+
`);return r.slice(0,r.length-1)}function hde(e,t){const n=[];return Array.from(e.keys()).forEach(r=>{(!t||!t.marks||!t.marks.map(s=>s.type).includes(r))&&n.push(r)}),n}function pde(e,t){const n=[];return Array.from(t.entries()).forEach(([r,s])=>{e.has(r)||n.push({type:r,mark:s})}),n}function mde(e,t,n,r){const s=!n,i=n&&n.type==="text"&&(!n.marks||n.marks.length===0),o=n&&n.type==="text"&&n.marks&&!r(t,new Map(n.marks.map(a=>[a.type,a]))),l=[];if(s||i||o)if(n&&n.type==="text"&&n.marks){const a=new Map(n.marks.map(u=>[u.type,u]));Array.from(e.keys()).forEach(u=>{a.has(u)||l.push(u)})}else(s||i)&&l.push(...Array.from(e.keys()));return l}function gde(e,t){let n="";return Array.from(e.keys()).reverse().forEach(r=>{const s=e.get(r),i=t(r,s);i&&(n=i+n)}),e.clear(),n}function yde(e,t,n){let r="";return Array.from(e.entries()).forEach(([s,i])=>{const o=n(s,i);o&&(r+=o),t.set(s,i)}),r}function Pv(e){const n=(e.raw||e.text||"").match(/^(\s*)[-+*]\s+\[([ xX])\]\s+/);return n?{isTask:!0,checked:n[2].toLowerCase()==="x",indentLevel:n[1].length}:{isTask:!1,indentLevel:0}}function Kh(e,t){return typeof e!="string"?"json":t}var xde=class{constructor(e){this.baseExtensions=[],this.extensions=[],this.lastParseResult=null;var t,n,r,s,i;this.markedInstance=(t=e==null?void 0:e.marked)!=null?t:lt,this.lexer=new this.markedInstance.Lexer,this.indentStyle=(r=(n=e==null?void 0:e.indentation)==null?void 0:n.style)!=null?r:"space",this.indentSize=(i=(s=e==null?void 0:e.indentation)==null?void 0:s.size)!=null?i:2,this.baseExtensions=(e==null?void 0:e.extensions)||[],e!=null&&e.markedOptions&&typeof this.markedInstance.setOptions=="function"&&this.markedInstance.setOptions(e.markedOptions),this.registry=new Map,this.nodeTypeRegistry=new Map,e!=null&&e.extensions&&(this.baseExtensions=e.extensions,py(e.extensions).forEach(l=>this.registerExtension(l,!1))),this.lexer=new this.markedInstance.Lexer}get instance(){return this.markedInstance}get indentCharacter(){return this.indentStyle==="space"?" ":" "}get indentString(){return this.indentCharacter.repeat(this.indentSize)}hasMarked(){return!!this.markedInstance}registerExtension(e,t=!0){var n,r;this.extensions.push(e);const s=e.name,i=ke(e,"markdownTokenName")||s,o=ke(e,"parseMarkdown"),l=ke(e,"renderMarkdown"),a=ke(e,"markdownTokenizer"),u=(n=ke(e,"markdownOptions"))!=null?n:null,c=(r=u==null?void 0:u.indentsContent)!=null?r:!1,d={tokenName:i,nodeName:s,parseMarkdown:o,renderMarkdown:l,isIndenting:c,tokenizer:a};if(i&&o){const h=this.registry.get(i)||[];h.push(d),this.registry.set(i,h)}if(l){const h=this.nodeTypeRegistry.get(s)||[];h.push(d),this.nodeTypeRegistry.set(s,h)}a&&this.hasMarked()&&(this.registerTokenizer(a),t&&(this.lexer=new this.markedInstance.Lexer))}registerTokenizer(e){if(!this.hasMarked())return;const{name:t,start:n,level:r="inline",tokenize:s}=e,l={inlineTokens:c=>this.lexer.inlineTokens(c),blockTokens:c=>this.lexer.blockTokens(c)};let a;n?a=typeof n=="function"?n:c=>c.indexOf(n):a=c=>{const d=s(c,[],l);return d&&d.raw?c.indexOf(d.raw):-1};const u={name:t,level:r,start:a,tokenizer:(c,d)=>{const h=s(c,d,l);if(h&&h.type)return{...h,type:h.type||t,raw:h.raw||"",tokens:h.tokens||[]}},childTokens:[]};this.markedInstance.use({extensions:[u]})}getHandlersForToken(e){try{return this.registry.get(e)||[]}catch{return[]}}getHandlerForToken(e){const t=this.getHandlersForToken(e);if(t.length>0)return t[0];const n=this.getHandlersForNodeType(e);return n.length>0?n[0]:void 0}getHandlersForNodeType(e){try{return this.nodeTypeRegistry.get(e)||[]}catch{return[]}}serialize(e){return e?Array.isArray(e)?this.renderNodes(e,e):this.renderNodes(e,e):""}parse(e){if(!this.hasMarked())throw new Error("No marked instance available for parsing");const t=this.markedInstance.lexer(e);return{type:"doc",content:this.parseTokens(t)}}parseTokens(e){return e.map(t=>this.parseToken(t)).filter(t=>t!==null).flatMap(t=>Array.isArray(t)?t:[t])}parseToken(e){if(!e.type)return null;if(e.type==="list")return this.parseListToken(e);const t=this.getHandlersForToken(e.type),n=this.createParseHelpers();if(t.find(s=>{if(!s.parseMarkdown)return!1;const i=s.parseMarkdown(e,n),o=this.normalizeParseResult(i);return o&&(!Array.isArray(o)||o.length>0)?(this.lastParseResult=o,!0):!1})&&this.lastParseResult){const s=this.lastParseResult;return this.lastParseResult=null,s}return this.parseFallbackToken(e)}parseListToken(e){if(!e.items||e.items.length===0)return this.parseTokenWithHandlers(e);const t=e.items.some(l=>Pv(l).isTask),n=e.items.some(l=>!Pv(l).isTask);if(!t||!n||this.getHandlersForToken("taskList").length===0)return this.parseTokenWithHandlers(e);const r=[];let s=[],i=null;for(let l=0;l<e.items.length;l+=1){const a=e.items[l],{isTask:u,checked:c,indentLevel:d}=Pv(a);let h=a;if(u){const g=(a.raw||a.text||"").split(`
|
|
714
|
+
`),v=g[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),y=v?v[2]:"";let w=[];if(g.length>1&&g.slice(1).join(`
|
|
715
|
+
`).trim()){const C=g.slice(1),S=C.filter(k=>k.trim());if(S.length>0){const k=Math.min(...S.map(O=>O.length-O.trimStart().length)),N=C.map(O=>O.trim()?O.slice(k):"").join(`
|
|
716
|
+
`).trim();N&&(w=this.markedInstance.lexer(`${N}
|
|
717
|
+
`))}}h={type:"taskItem",raw:"",mainContent:y,indentLevel:d,checked:c??!1,text:y,tokens:this.lexer.inlineTokens(y),nestedTokens:w}}const f=u?"taskList":"list";i!==f?(s.length>0&&r.push({type:i,items:s}),s=[h],i=f):s.push(h)}s.length>0&&r.push({type:i,items:s});const o=[];for(let l=0;l<r.length;l+=1){const a=r[l],u={...e,type:a.type,items:a.items},c=this.parseToken(u);c&&(Array.isArray(c)?o.push(...c):o.push(c))}return o.length>0?o:null}parseTokenWithHandlers(e){if(!e.type)return null;const t=this.getHandlersForToken(e.type),n=this.createParseHelpers();if(t.find(s=>{if(!s.parseMarkdown)return!1;const i=s.parseMarkdown(e,n),o=this.normalizeParseResult(i);return o&&(!Array.isArray(o)||o.length>0)?(this.lastParseResult=o,!0):!1})&&this.lastParseResult){const s=this.lastParseResult;return this.lastParseResult=null,s}return this.parseFallbackToken(e)}createParseHelpers(){return{parseInline:e=>this.parseInlineTokens(e),parseChildren:e=>this.parseTokens(e),createTextNode:(e,t)=>({type:"text",text:e,marks:t||void 0}),createNode:(e,t,n)=>{const r={type:e,attrs:t||void 0,content:n||void 0};return(!t||Object.keys(t).length===0)&&delete r.attrs,r},applyMark:(e,t,n)=>({mark:e,content:t,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(e){var t,n,r,s;const i=[];for(let o=0;o<e.length;o+=1){const l=e[o];if(l.type==="text")i.push({type:"text",text:l.text||""});else if(l.type==="html"){const a=((n=(t=l.raw)!=null?t:l.text)!=null?n:"").toString(),u=/^<\/[\s]*[\w-]+/i.test(a),c=a.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!u&&c&&!/\/>$/.test(a)){const h=c[1],f=this.escapeRegex(h),m=new RegExp(`^<\\/\\s*${f}\\b`,"i");let g=-1;const v=[a];for(let y=o+1;y<e.length;y+=1){const w=e[y],b=((s=(r=w.raw)!=null?r:w.text)!=null?s:"").toString();if(v.push(b),w.type==="html"&&m.test(b)){g=y;break}}if(g!==-1){const y=v.join(""),w={type:"html",raw:y,text:y,block:!1},b=this.parseHTMLToken(w);if(b){const C=this.normalizeParseResult(b);Array.isArray(C)?i.push(...C):C&&i.push(C)}o=g;continue}}const d=this.parseHTMLToken(l);if(d){const h=this.normalizeParseResult(d);Array.isArray(h)?i.push(...h):h&&i.push(h)}}else if(l.type){const a=this.getHandlerForToken(l.type);if(a&&a.parseMarkdown){const u=this.createParseHelpers(),c=a.parseMarkdown(l,u);if(this.isMarkResult(c)){const d=this.applyMarkToContent(c.mark,c.content,c.attrs);i.push(...d)}else{const d=this.normalizeParseResult(c);Array.isArray(d)?i.push(...d):d&&i.push(d)}}else l.tokens&&i.push(...this.parseInlineTokens(l.tokens))}}return i}applyMarkToContent(e,t,n){return t.map(r=>{if(r.type==="text"){const s=r.marks||[],i=n?{type:e,attrs:n}:{type:e};return{...r,marks:[...s,i]}}return{...r,content:r.content?this.applyMarkToContent(e,r.content,n):void 0}})}isMarkResult(e){return e&&typeof e=="object"&&"mark"in e}normalizeParseResult(e){return e?this.isMarkResult(e)?e.content:e:null}parseFallbackToken(e){switch(e.type){case"paragraph":return{type:"paragraph",content:e.tokens?this.parseInlineTokens(e.tokens):[]};case"heading":return{type:"heading",attrs:{level:e.depth||1},content:e.tokens?this.parseInlineTokens(e.tokens):[]};case"text":return{type:"text",text:e.text||""};case"html":return this.parseHTMLToken(e);case"space":return null;default:return e.tokens?this.parseTokens(e.tokens):null}}parseHTMLToken(e){const t=e.text||e.raw||"";if(!t.trim())return null;if(typeof window>"u")return e.block?{type:"paragraph",content:[{type:"text",text:t}]}:{type:"text",text:t};try{const n=yX(t,this.baseExtensions);return n.type==="doc"&&n.content?e.block?n.content:n.content.length===1&&n.content[0].type==="paragraph"&&n.content[0].content?n.content[0].content:n.content:n}catch(n){throw new Error(`Failed to parse HTML in markdown: ${n}`)}}renderNodeToMarkdown(e,t,n=0,r=0){var s;if(e.type==="text")return e.text||"";if(!e.type)return"";const i=this.getHandlerForToken(e.type);if(!i)return"";const o={renderChildren:(u,c)=>{const d=i.isIndenting?r+1:r;return!Array.isArray(u)&&u.content?this.renderNodes(u.content,e,c||"",n,d):this.renderNodes(u,e,c||"",n,d)},indent:u=>this.indentString+u,wrapInBlock:fde},l={index:n,level:r,parentType:t==null?void 0:t.type,meta:{parentAttrs:t==null?void 0:t.attrs}};return((s=i.renderMarkdown)==null?void 0:s.call(i,e,o,l))||""}renderNodes(e,t,n="",r=0,s=0){return Array.isArray(e)?this.renderNodesWithMarkBoundaries(e,t,n,s):e.type?this.renderNodeToMarkdown(e,t,r,s):""}renderNodesWithMarkBoundaries(e,t,n="",r=0){const s=[],i=new Map;return e.forEach((o,l)=>{const a=l<e.length-1?e[l+1]:null;if(o.type)if(o.type==="text"){let u=o.text||"";const c=new Map((o.marks||[]).map(y=>[y.type,y])),d=pde(i,c),h=hde(c,a);let f="";if(h.length>0){const y=u.match(/(\s+)$/);y&&(f=y[1],u=u.slice(0,-f.length))}h.forEach(y=>{const w=c.get(y),b=this.getMarkClosing(y,w);b&&(u+=b),i.has(y)&&i.delete(y)});let m="";if(d.length>0){const y=u.match(/^(\s+)/);y&&(m=y[1],u=u.slice(m.length))}d.forEach(({type:y,mark:w})=>{const b=this.getMarkOpening(y,w);b&&(u=b+u),h.includes(y)||i.set(y,w)}),u=m+u;const g=mde(i,c,a,this.markSetsEqual.bind(this));let v="";if(g.length>0){const y=u.match(/(\s+)$/);y&&(v=y[1],u=u.slice(0,-v.length))}g.forEach(y=>{const w=i.get(y),b=this.getMarkClosing(y,w);b&&(u+=b),i.delete(y)}),u+=v,u+=f,s.push(u)}else{const u=new Map(i),c=gde(i,this.getMarkClosing.bind(this)),d=this.renderNodeToMarkdown(o,t,l,r),h=o.type==="hardBreak"?"":yde(u,i,this.getMarkOpening.bind(this));s.push(c+d+h)}}),s.join(n)}getMarkOpening(e,t){const n=this.getHandlersForNodeType(e),r=n.length>0?n[0]:void 0;if(!r||!r.renderMarkdown)return"";const s="__TIPTAP_MARKDOWN_PLACEHOLDER__",i={type:e,attrs:t.attrs||{},content:[{type:"text",text:s}]};try{const o=r.renderMarkdown(i,{renderChildren:()=>s,indent:a=>a,wrapInBlock:(a,u)=>a+u},{index:0,level:0,parentType:"text",meta:{}}),l=o.indexOf(s);return l>=0?o.substring(0,l):""}catch(o){throw new Error(`Failed to get mark opening for ${e}: ${o}`)}}getMarkClosing(e,t){const n=this.getHandlersForNodeType(e),r=n.length>0?n[0]:void 0;if(!r||!r.renderMarkdown)return"";const s="__TIPTAP_MARKDOWN_PLACEHOLDER__",i={type:e,attrs:t.attrs||{},content:[{type:"text",text:s}]};try{const o=r.renderMarkdown(i,{renderChildren:()=>s,indent:u=>u,wrapInBlock:(u,c)=>u+c},{index:0,level:0,parentType:"text",meta:{}}),l=o.indexOf(s),a=l+s.length;return l>=0?o.substring(a):""}catch(o){throw new Error(`Failed to get mark closing for ${e}: ${o}`)}}markSetsEqual(e,t){return e.size!==t.size?!1:Array.from(e.keys()).every(n=>t.has(n))}},qM=xde,vde=Ct.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(e,t)=>{if(!(t!=null&&t.contentType)||Kh(e,t==null?void 0:t.contentType)!=="markdown"||!this.editor.markdown)return es.setContent(e,t);const r=this.editor.markdown.parse(e);return es.setContent(r,t)},insertContent:(e,t)=>{if(!(t!=null&&t.contentType)||Kh(e,t==null?void 0:t.contentType)!=="markdown"||!this.editor.markdown)return es.insertContent(e,t);const r=this.editor.markdown.parse(e);return es.insertContent(r,t)},insertContentAt:(e,t,n)=>{if(!(n!=null&&n.contentType)||Kh(t,n==null?void 0:n.contentType)!=="markdown"||!this.editor.markdown)return es.insertContentAt(e,t,n);const s=this.editor.markdown.parse(t);return es.insertContentAt(e,s,n)}}},addStorage(){return{manager:new qM({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new qM({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||Kh(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const t=this.editor.markdown.parse(this.editor.options.content);this.editor.options.content=t}});const wde=()=>{const[e,t]=x.useState(!1);return{open:e,setOpen:t}},bde=({active:e,isDirty:t,conflict:n,lastEditAt:r,autosave:s,autosaveTimeoutRef:i,saveStatusStartRef:o,setSaveStatus:l})=>{x.useEffect(()=>{if(!e||!t||n||!r)return;const a=350;return i.current&&clearTimeout(i.current),l("saving"),o.current=Date.now(),i.current=setTimeout(()=>{s().catch(()=>{}),i.current=null},a),()=>{i.current&&(clearTimeout(i.current),i.current=null)}},[e,s,i,n,t,r,o,l])},kde=({docs:e,active:t,setActive:n,status:r,setStatus:s})=>{const{activeProject:i}=Ht(),{tab:o,docName:l,navigateToDoc:a}=by(),u=(i==null?void 0:i.id)??"";return x.useEffect(()=>{if(o!=="docs"||!l||(t==null?void 0:t.name)===l)return;const d=e.find(h=>h.name===l);if(!d){r!==`Doc not found: ${l}`&&s(`Doc not found: ${l}`);return}r&&s(""),n(d)},[t==null?void 0:t.name,l,e,n,s,r,o]),x.useEffect(()=>{if(o!=="docs"||l||!u||e.length===0)return;const d=e[0];a(u,d.name)},[l,e,a,u,o]),{encodePath:x.useCallback(d=>`${u}/docs/0/${d.split("/").map(encodeURIComponent).join("/")}`,[u]),currentPathDoc:o==="docs"?l:null}},Sde=({editor:e,active:t,content:n,setIsDirty:r,setLastEditAt:s,setMarkdownInEditor:i,pendingNormalizeRef:o,lastEditorContentRef:l})=>{x.useEffect(()=>{e&&(!t||t.type!=="markdown"||n&&l.current!==n&&(i(n),l.current=n,o.current=!0))},[t,n,e,l,o,i]),x.useEffect(()=>{if(!e||!t||t.type!=="markdown")return;const a=()=>{if(o.current){o.current=!1,r(!1);return}s(Date.now()),r(!0)};return e.on("update",a),()=>{e.off("update",a)}},[t,e,o,r,s])},Cde=/^\uFEFF?\s*<!--\s*hyperdoc:([A-Za-z0-9+/=]+)\s*-->\s*(?:\r?\n|$)/i,Ede=/^\uFEFF?\s*<!--\s*hyperdoc:[A-Za-z0-9+/=]+\s*-->\s*(?:\r?\n|$)/i,Nde=/^\s*<!--\s*title:\s*.+?\s*-->\s*(?:\r?\n|$)/i,Tde=e=>e.replace(/^\uFEFF/,""),Rde=e=>{if(!e)return e;const t=e.match(/^\s*(?:\r?\n)/);return t?e.slice(t[0].length):e},Qh=(e,t)=>{if(e.length!==t.length)return!1;const n=[...e].sort(),r=[...t].sort();return n.every((s,i)=>s===r[i])},Mde=Fr({bundleUrl:Zt().trim().min(1).optional(),bundlePath:Zt().trim().min(1).optional(),cssUrl:Zt().trim().min(1).optional(),cssPath:Zt().trim().min(1).optional(),mountId:Zt().trim().min(1),bundleType:jI(["module","classic"]).optional(),backgroundColor:Zt().trim().optional(),metadata:Fr({tags:Hu(Zt()).optional(),pinned:yp().optional()}).optional()}).passthrough().superRefine((e,t)=>{!e.bundleUrl&&!e.bundlePath&&t.addIssue({code:re.custom,message:"Provide bundleUrl or bundlePath."})}),Ode=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`client_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`,jde=()=>typeof crypto<"u"&&"randomUUID"in crypto?`hyperdoc-${crypto.randomUUID()}`:`hyperdoc-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`,Pde=({openCreateDialog:e,openMetadataDialog:t,setAgentsSidebarOpen:n,createAgent:r,openZapper:s})=>{const{apiRoot:i,activeProject:o,openCreateProject:l}=Ht(),[a,u]=x.useState(null),[c,d]=x.useState(""),[h,f]=x.useState(""),[m,g]=x.useState(""),v=x.useRef(!1),y=x.useRef(""),w=x.useRef(""),[b,C]=x.useState("idle"),S=x.useRef(null),k=x.useRef(null),E=x.useRef(null),[N,O]=x.useState(null),[T,j]=x.useState(null),[A,z]=x.useState(""),[D,L]=x.useState(!1),[H,K]=x.useState(!1),[_,Q]=x.useState(null),[M,oe]=x.useState([]),[F,R]=x.useState([]),I=Lg(),V=x.useRef(null),Y=x.useRef(!1),G=x.useRef(Ode()),[me,we]=x.useState(null),{open:qe,setOpen:ut}=wde(),rn=x.useMemo(()=>a_(),[]),Le=Dte({extensions:[Rce.configure({codeBlock:{languageClassPrefix:"language-"}}),vde.configure({markedOptions:{breaks:!0}})],content:"",editorProps:{attributes:{class:"h-full min-h-0 w-full border border-input bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2"}}}),Dt=_i(),sn=x.useCallback(async $=>{const B=await fetch(`${i}/doc/${encodeURIComponent($)}`,{cache:"no-store"});if(B.status===404)throw new Rk("Doc not found");if(!B.ok)throw new Error(B.statusText);return(B.headers.get("content-type")??"").includes("application/json")?await B.json():{content:await B.text()}},[i]),{docs:ct,folders:ur,docsQuery:Mr,updateDocsCache:dt,invalidateDocs:on}=u_(),{tags:Li,errorMessage:hc,invalidateTags:Kn}=u2(),{encodePath:Qn}=kde({docs:ct,active:a,setActive:u,status:h,setStatus:f});x.useEffect(()=>{Mr.error&&f(String(Mr.error))},[Mr.error]);const An=x.useCallback(()=>{if(!Le)return"";const $=Le;return $.getMarkdown?$.getMarkdown():""},[Le]),U=x.useCallback($=>{var ve;if(!Le)return;const B=Le;if((((ve=B.getMarkdown)==null?void 0:ve.call(B))??"")===$)return;const{from:Z,to:fe}=Le.state.selection;if(B.markdown){const le=B.markdown.parse($);Le.commands.setContent(le,{emitUpdate:!1})}else Le.commands.setContent($,{emitUpdate:!1});try{const le=Le.state.doc.content.size,Ee=Math.min(Z,le),Ke=Math.min(fe,le);Ee>=0&&Ke>=0&&Le.commands.setTextSelection({from:Ee,to:Ke})}catch{}},[Le]),ie=x.useCallback($=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem($)==="1"}catch{return!1}},[]),Ae=x.useCallback(($,B)=>{const X=$.trim();if(!X)return"";const Z=Ee=>Ee.toLowerCase().replace(/[\s_]+/g,"-").replace(/-{2,}/g,"-").replace(/^-|-$/g,""),fe=X.toLowerCase();let ve=X;const le=[".app.json",".table.json",".prompt.yaml",".yaml",".json",".md"];for(const Ee of le)if(fe.endsWith(Ee)){ve=X.slice(0,X.length-Ee.length);break}return B==="app"?`${Z(ve)}.app.json`:B==="prompt"?`${Z(ve)}.prompt.yaml`:B==="json"?`${Z(ve)}.table.json`:`${Z(ve)}.md`},[]),Fe=x.useCallback($=>$.endsWith(".app.json")?$.slice(0,-9):$.endsWith(".table.json")?$.slice(0,-11):$.endsWith(".prompt.yaml")?$.slice(0,-12):$.replace(/\.(md|json|yaml)$/i,""),[]),We=x.useCallback(($,B)=>Ae($,B),[Ae]),gn=x.useCallback($=>{try{const B=atob($),X=Uint8Array.from(B,Z=>Z.charCodeAt(0));return new TextDecoder().decode(X)}catch{return null}},[]),q=x.useCallback($=>{const B=new TextEncoder().encode($);let X="";return B.forEach(Z=>{X+=String.fromCharCode(Z)}),btoa(X)},[]),W=x.useCallback($=>{const B=$.match(Cde);if(!B)return null;const X=gn(B[1]);if(!X)return null;try{const Z=JSON.parse(X);if(!Z||typeof Z!="object"||Array.isArray(Z))return null;const fe=typeof Z.title=="string"?Z.title:null,ve=Array.isArray(Z.tags)?Z.tags.filter(Ee=>typeof Ee=="string"):[],le=Z.pinned===!0;return{title:fe,tags:ve,pinned:le}}catch{return null}},[gn]),Ne=x.useCallback($=>{let B="",X=!1,Z=!1,fe=!1,ve=!1;for(let le=0;le<$.length;le+=1){const Ee=$[le],Ke=$[le+1];if(fe){Ee===`
|
|
718
|
+
`&&(fe=!1,B+=Ee);continue}if(ve){Ee==="*"&&Ke==="/"&&(ve=!1,le+=1);continue}if(X){if(B+=Ee,Z){Z=!1;continue}if(Ee==="\\"){Z=!0;continue}Ee==='"'&&(X=!1);continue}if(Ee==='"'){X=!0,B+=Ee;continue}if(Ee==="/"&&Ke==="/"){fe=!0,le+=1;continue}if(Ee==="/"&&Ke==="*"){ve=!0,le+=1;continue}B+=Ee}return B},[]),je=x.useCallback($=>{let B="",X=!1,Z=!1;for(let fe=0;fe<$.length;fe+=1){const ve=$[fe];if(X){if(B+=ve,Z){Z=!1;continue}if(ve==="\\"){Z=!0;continue}ve==='"'&&(X=!1);continue}if(ve==='"'){X=!0,B+=ve;continue}if(ve===","){let le=fe+1;for(;le<$.length&&/\s/.test($[le]);)le+=1;if($[le]==="}"||$[le]==="]")continue}B+=ve}return B},[]),be=x.useCallback($=>{const B=$.replace(/^\uFEFF/,"");try{const X=JSON.parse(B);return!X||typeof X!="object"||Array.isArray(X)?null:X}catch{try{const X=je(Ne(B)),Z=JSON.parse(X);return!Z||typeof Z!="object"||Array.isArray(Z)?null:Z}catch{return null}}},[Ne,je]),Ye=x.useCallback($=>{const B=be($);if(!B)return null;const X=B.metadata;if(!X||typeof X!="object"||Array.isArray(X))return{tags:[]};const Z=X,fe=Array.isArray(Z.tags)?Z.tags.filter(le=>typeof le=="string"):[],ve=Z.pinned===!0;return{tags:fe,pinned:ve}},[be]),ht=x.useCallback(($,B)=>{const X=be($);if(!X)return{config:null,error:"Invalid JSON."};const Z=Mde.safeParse(X);if(!Z.success)return{config:null,error:Z.error.issues.map(Ee=>Ee.message).join(" ")||"Invalid app config."};let fe;if(Z.data.bundleUrl)fe=Z.data.bundleUrl;else if(Z.data.bundlePath){const le=Z.data.bundlePath.replace(/^\/+/,"");fe=B?`${B}/${le}`:Z.data.bundlePath}else fe="";let ve;if(Z.data.cssUrl)ve=Z.data.cssUrl;else if(Z.data.cssPath){const le=Z.data.cssPath.replace(/^\/+/,"");ve=B?`${B}/${le}`:Z.data.cssPath}return{config:{bundleUrl:fe,cssUrl:ve,mountId:Z.data.mountId,bundleType:Z.data.bundleType,backgroundColor:Z.data.backgroundColor,metadata:Z.data.metadata},error:null}},[be]),zS=x.useCallback(($,B)=>{var X,Z;return B==="markdown"||B==="prompt"?((X=W($))==null?void 0:X.tags)??[]:B==="json"||B==="app"?((Z=Ye($))==null?void 0:Z.tags)??[]:[]},[Ye,W]),Py=x.useCallback($=>{const B=JSON.stringify({v:1,title:$.title,tags:$.tags,...$.pinned?{pinned:!0}:{}});return`<!-- hyperdoc:${q(B)} -->
|
|
719
|
+
|
|
720
|
+
`},[q]),qf=x.useCallback($=>{let B=$.replace(/^\uFEFF/,""),X="";for(;B!==X;)X=B,B=B.replace(Ede,"").replace(Nde,"");return Rde(B)},[]),Ay=x.useCallback(($,B,X)=>{if(B==="markdown"||B==="prompt"){const Z=Tde(qf($));return`${Py({title:null,tags:X.tags,pinned:X.pinned})}${Z}`}if(B==="json"||B==="app"){const Z=be($);if(!Z)return null;const fe=Z.metadata,ve=fe&&typeof fe=="object"&&!Array.isArray(fe)?{...fe}:{};X.tags.length>0?ve.tags=X.tags:delete ve.tags,X.pinned?ve.pinned=!0:delete ve.pinned;const le={...Z};return Object.keys(ve).length>0?le.metadata=ve:delete le.metadata,JSON.stringify(le,null,2)}return $},[Py,be,qf]),FS=x.useCallback($=>{const B=$.trim().toLowerCase();return!B||!/^[a-z]+$/.test(B)?"":B},[]),BS=x.useCallback($=>{const B=$.map(X=>FS(X)).filter(X=>X.length>0);return Array.from(new Set(B)).sort()},[FS]),ga=Mf({queryKey:["doc",o==null?void 0:o.id,a==null?void 0:a.name],queryFn:()=>sn((a==null?void 0:a.name)??""),enabled:!!(a!=null&&a.name),refetchInterval:!1,refetchOnWindowFocus:!1});x.useEffect(()=>{ga.error&&f(String(ga.error))},[ga.error]),x.useEffect(()=>{var Ee;if(!a||!ga.data||D)return;const $=ga.data,B=$.content??"",X=$.metadata??null,Z=B===c,fe=a.type==="markdown"||a.type==="prompt"?(X==null?void 0:X.tags)??[]:zS(B,a.type);Qh(fe,M)||oe(fe),typeof $.mtimeMs=="number"&&Q($.mtimeMs);const ve=y.current!==a.name;if(!ve&&Z)return;d(B),g(B),L(!1),K(!1),ve&&(j(null),z("")),a.type==="markdown"&&Le&&(U(B),w.current=B,v.current=!0);const le=a.type==="markdown"||a.type==="prompt"?X==null?void 0:X.pinned:(Ee=Ye(B))==null?void 0:Ee.pinned;le!==void 0&&(dt(Ke=>Ke.map(yn=>yn.name===a.name?{...yn,pinned:le}:yn)),u(Ke=>Ke&&Ke.name===a.name?{...Ke,pinned:le}:Ke)),y.current=a.name},[a,M,c,ga.data,Le,zS,D,Ye,U,dt]),Sde({editor:Le,active:a,content:c,setIsDirty:L,setLastEditAt:O,setMarkdownInEditor:U,pendingNormalizeRef:v,lastEditorContentRef:w}),x.useEffect(()=>{a||Q(null)},[a]);const VS=x.useMemo(()=>a?(a.displayName??Fe(a.name)).trim():"",[a,Fe]);x.useEffect(()=>{if(!a){F.length>0&&R([]);return}Qh(M,F)||R(M)},[a,M,VS,F]),x.useEffect(()=>{me&&(!a||a.name!==me.name||(requestAnimationFrame(()=>{var $;return($=V.current)==null?void 0:$.focus()}),we(null)))},[a,me]);const HS=x.useCallback(($,B)=>Qh($,B),[]),Ys=x.useCallback(async($,B)=>{if(!a)return null;const X=(B==null?void 0:B.name)??a.name,Z=(B==null?void 0:B.type)??a.type,fe=a.name===X,ve=(B==null?void 0:B.tags)??(fe?F:[]),le=(B==null?void 0:B.pinned)??(fe?a.pinned??!1:!1);let Ee=$;if(Z==="markdown"||Z==="prompt"){const vn=Ay(Ee,Z,{tags:ve,pinned:le});if(vn===null)return f("Cannot update metadata. JSON must be an object."),null;Ee=vn}else if((Z==="json"||Z==="app")&&((B==null?void 0:B.tags)!==void 0||(B==null?void 0:B.pinned)!==void 0)){const Qf=Ay($,Z,{tags:ve,pinned:le});if(Qf===null)return f("Cannot update metadata. JSON must be an object."),null;Ee=Qf}const Ke=Z==="markdown"||Z==="prompt"?qf(Ee):Ee,yn=250;fe&&(S.current&&(clearTimeout(S.current),S.current=null),k.current=Date.now(),C("saving")),Y.current=!0;const _n=(B==null?void 0:B.baseVersion)??(fe?_:null),xn=await fetch(`${i}/doc/${encodeURIComponent(X)}`,{method:"PUT",headers:{"Content-Type":"text/plain",..._n!=null?{"x-hyperdoc-base-version":String(_n)}:{},"x-hyperdoc-client-id":G.current},body:Ee});setTimeout(()=>{Y.current=!1},500);const Or=vn=>{if(!fe)return;const Qf=k.current??Date.now(),v3=Date.now()-Qf,w3=Math.max(0,yn-v3);S.current=setTimeout(()=>{C(vn),S.current=null},w3)};if(xn.status===409){try{const vn=await xn.json();fe&&typeof vn.mtimeMs=="number"&&Q(vn.mtimeMs)}catch{}return fe&&K(!0),f("Conflict: file changed on disk."),Or("idle"),null}if(!xn.ok)return f(`Save failed: ${xn.status}`),Or("idle"),null;const _y=await xn.json();return fe&&(Q(_y.mtimeMs??null),g(Ke),d(Ke),w.current=Ke,L(!1),K(!1)),Dt.setQueryData(["doc",o==null?void 0:o.id,X],vn=>({...vn??{content:Ke},content:Ke,mtimeMs:_y.mtimeMs??(vn==null?void 0:vn.mtimeMs),metadata:Z==="markdown"||Z==="prompt"?{tags:ve,pinned:le}:(vn==null?void 0:vn.metadata)??null})),Or("saved"),Ee},[a,o==null?void 0:o.id,i,Ay,_,F,Dt,qf]),{jsonError:Yz,jsonData:pc,tableDefaults:Xz,tableView:e3,setTableView:t3,effectiveSchema:mc,handleTableRowsChange:n3,handleAddRow:r3,commitTableUpdate:Wf,persistTableView:s3,createColumnId:US,parseColumnOptions:i3}=sG({active:a,content:c,lastSaved:m,headerTags:F,setContent:d,setIsDirty:L,setLastEditAt:O,writeDoc:Ys}),o3=x.useCallback(async $=>{if(!a)return;const B=We($,a.type);if(B===a.name)return;const X=await fetch(`${i}/doc/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:a.name,to:B})});if(!X.ok){f(`Rename failed: ${X.status}`);return}const Z=await X.json();u(fe=>fe&&{...fe,...Z}),dt(fe=>{const ve=fe.map(le=>le.name===a.name?{...le,...Z}:le);return ve.sort((le,Ee)=>(le.displayName??le.name).localeCompare(Ee.displayName??Ee.name)),ve}),I(`/${Qn(Z.name)}`,{replace:!0})},[a,i,We,Qn,I,dt]),l3=x.useCallback(async()=>{if(!a)return;const $=a.type==="markdown"&&Le?An():c,B=!HS(F,M);if(D||B){const Z=a.type==="markdown"||a.type==="prompt"||B?F:void 0;if(!await Ys($,{tags:Z,pinned:a.type==="markdown"||a.type==="prompt"?a.pinned??!1:void 0}))return}B&&(oe(F),Kn())},[a,M,c,Le,An,F,Kn,D,HS,Ys]),a3=x.useCallback(async()=>{if(!a||!D||H||ie("hyperdoc.disableAutosave"))return;const $=a.type==="markdown"&&Le?An():c;await Ys($,{pinned:a.type==="markdown"||a.type==="prompt"?a.pinned??!1:void 0})},[a,H,c,Le,An,D,ie,Ys]),qS=x.useCallback(async $=>{var B,X;try{const Z=(a==null?void 0:a.name)===$.name;let fe="",ve=null,le=[],Ee=$.pinned??!1;if(Z&&a)a.type==="markdown"?D?Le?fe=An():fe=c:fe=m:fe=c,le=F,Ee=a.pinned??Ee,ve=_;else{const _n=await fetch(`${i}/doc/${encodeURIComponent($.name)}`,{cache:"no-store"});if(!_n.ok){f(`Failed to fetch document: ${_n.statusText}`);return}const xn=await _n.json();if(fe=xn.content??"",ve=xn.mtimeMs??null,$.type==="markdown"||$.type==="prompt")le=((B=xn.metadata)==null?void 0:B.tags)??$.tags??[],Ee=((X=xn.metadata)==null?void 0:X.pinned)??Ee;else{const Or=Ye(fe);le=(Or==null?void 0:Or.tags)??$.tags??[],Ee=(Or==null?void 0:Or.pinned)??Ee}}const Ke=!Ee,yn=await Ys(fe,{name:$.name,type:$.type,tags:le,pinned:Ke,baseVersion:ve});if(!yn)return;dt(_n=>_n.map(xn=>xn.name===$.name?{...xn,pinned:Ke}:xn)),Z&&a&&(u(_n=>_n&&{..._n,pinned:Ke}),(a.type==="json"||a.type==="app"||a.type==="prompt")&&d(yn))}catch(Z){f(`Failed to toggle pinned: ${String(Z)}`)}},[a,i,c,_,Le,An,F,D,m,Ye,dt,Ys]),WS=x.useCallback(async $=>{try{const B=await fetch(`${i}/doc/${encodeURIComponent($.name)}/archive`,{method:"POST"});if(!B.ok){f(`Archive failed: ${B.statusText}`);return}dt(X=>X.filter(Z=>Z.name!==$.name)),(a==null?void 0:a.name)===$.name&&(u(null),I(`/${o==null?void 0:o.id}/docs`,{replace:!0}))}catch(B){f(`Archive failed: ${String(B)}`)}},[a,o==null?void 0:o.id,i,I,dt]),KS=x.useCallback(async $=>{try{const B=await fetch(`${i}/doc/${encodeURIComponent($.name)}`,{method:"DELETE"});if(!B.ok){f(`Delete failed: ${B.statusText}`);return}dt(X=>X.filter(Z=>Z.name!==$.name)),(a==null?void 0:a.name)===$.name&&(u(null),I(`/${o==null?void 0:o.id}/docs`,{replace:!0}))}catch(B){f(`Delete failed: ${String(B)}`)}},[a,o==null?void 0:o.id,i,I,dt]);bde({active:a,isDirty:D,conflict:H,lastEditAt:N,autosave:a3,autosaveTimeoutRef:E,saveStatusStartRef:k,setSaveStatus:C}),x.useEffect(()=>{!a||a.type!=="json"&&a.type!=="app"&&a.type!=="prompt"&&a.type!=="tasks"||L(c!==m)},[c,a,m]),x.useEffect(()=>{if(!a||a.type!=="app")return;const $=ht(c,`${i}/bundles`);j($.config),z($.error??"")},[a,i,c,ht]);const QS=x.useCallback(async()=>{if(!(o!=null&&o.id)){f("No active project found");return}try{const $=await fetch(`${i}/system/open-terminal`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!$.ok){const X=await $.json().catch(()=>({error:"Failed to parse error response"}));f(`Failed to open terminal: ${X.error||$.statusText}`);return}const B=await $.json();f(B.message||"Terminal opened successfully")}catch($){f(`Error opening terminal: ${$ instanceof Error?$.message:String($)}`),console.error("Error opening terminal:",$)}},[o==null?void 0:o.id,i,f]),GS=x.useMemo(()=>({activeDoc:a,announce:f,openCreateDialog:e,toggleDocPinned:qS,archiveDoc:WS,deleteDoc:KS,setAgentsSidebarOpen:n,createAgent:r,openInTerminal:QS,openZapper:s,openCreateProject:l}),[a,WS,r,KS,e,l,QS,s,n,qS]),Kf=x.useCallback(async($,B)=>{if(!$)return;const X={...GS,...B};await $(X)},[GS]),JS=x.useCallback($=>{ut(!1),I(`/${Qn($.name)}`,{replace:!0})},[Qn,I,ut]),ZS=x.useCallback($=>{ut(!1),Kf($.run)},[Kf,ut]),u3=x.useMemo(()=>{const $=new Set([...Li,...F]);return Array.from($).sort()},[F,Li]),c3=x.useCallback(async $=>{if(!a)return!1;const B=BS($);if(Qh(B,M))return!0;const X=M;oe(B),R(B),dt(ve=>ve.map(le=>le.name===a.name?{...le,tags:B}:le));const Z=a.type==="markdown"&&Le?An():c;return await Ys(Z,{tags:B,pinned:a.type==="markdown"?a.pinned??!1:void 0})?(Kn(),!0):(oe(X),R(X),dt(ve=>ve.map(le=>le.name===a.name?{...le,tags:X}:le)),!1)},[a,M,c,Le,An,Kn,BS,dt,Ys]),d3=async $=>{const B=We($.title,$.type),X=$.folder?`${$.folder}/${B}`:B,fe=await(async le=>{const Ee=$.title.trim(),Ke=$.type==="markdown"?`${Py({title:Ee||null,tags:$.tags})}`:void 0,yn=$.type==="json"?JSON.stringify({data:[],schema:{columns:[{id:"name",name:"Name",type:"text"}]},...$.tags.length>0?{metadata:{tags:$.tags}}:{}},null,2):void 0,_n=$.type==="app"?JSON.stringify({bundleUrl:"",mountId:jde()},null,2):void 0,xn=$.type==="prompt"?"":void 0,Or=$.type==="tasks"?JSON.stringify({data:[],statuses:["todo","in progress","done"],...$.tags.length>0?{metadata:{tags:$.tags}}:{}},null,2):void 0;return await fetch(`${i}/docs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:Ee,name:le,type:$.type,content:$.type==="markdown"?Ke:$.type==="json"?yn:$.type==="app"?_n:$.type==="tasks"?Or:xn})})})(X);if(!fe.ok)throw new Error(`Create failed: ${fe.status}`);const ve=await fe.json();dt(le=>{const Ee=[...le,ve];return Ee.sort((Ke,yn)=>(Ke.displayName??Ke.name).localeCompare(yn.displayName??yn.name)),Ee}),$.tags.length>0&&Kn(),on(),I(`/${Qn(ve.name)}`,{replace:!0})},f3=async $=>{const B=await fetch(`${i}/folders`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$})});if(!B.ok)throw new Error(`Create folder failed: ${B.status}`);on()},h3=x.useCallback(async $=>{const B=await fetch(`${i}/folders/${encodeURIComponent($)}`,{method:"DELETE"});if(B.status===409){f("Cannot delete folder: it still contains documents. Move or delete them first.");return}if(!B.ok){f(`Delete folder failed: ${B.status}`);return}on()},[i,on]),p3=x.useCallback(async($,B)=>{const X=$.name.includes("/")?$.name.slice($.name.lastIndexOf("/")+1):$.name,Z=B?`${B}/${X}`:X;if(Z===$.name)return;const fe=await fetch(`${i}/doc/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:$.name,to:Z})});if(!fe.ok){f(`Move failed: ${fe.status}`);return}const ve=await fe.json();dt(le=>{const Ee=le.map(Ke=>Ke.name===$.name?{...Ke,...ve}:Ke);return Ee.sort((Ke,yn)=>(Ke.displayName??Ke.name).localeCompare(yn.displayName??yn.name)),Ee}),(a==null?void 0:a.name)===$.name&&(u(le=>le&&{...le,...ve}),I(`/${Qn(ve.name)}`,{replace:!0})),on()},[a,i,Qn,on,I,dt]),m3=x.useCallback($=>{const B=mc,X=B.columns.map(Ee=>Ee.id),Z=US($.name,X),fe={id:Z,name:$.name,type:$.type,...$.type==="select"?{options:$.options??[]}:{}},ve={columns:[...B.columns,fe]},le=(pc??[]).map(Ee=>({...Ee,[Z]:$.type==="object"?null:""}));Wf(le,{nextSchema:ve})},[Wf,US,mc,pc]),g3=x.useCallback($=>{const X={columns:mc.columns.filter(fe=>fe.id!==$)},Z=(pc??[]).map(fe=>{const{[$]:ve,...le}=fe;return le});Wf(Z,{nextSchema:X})},[Wf,mc,pc]),y3=x.useMemo(()=>{if(!a)return null;if(a.type==="markdown"||a.type==="prompt")return{type:"markdown",metadata:{base64:null,decoded:null,json:{tags:M,pinned:a.pinned??!1},error:null},rawMarkdown:c};if(a.type==="json")try{const $=JSON.parse(c);return{type:"json",prettyJson:JSON.stringify($,null,2),error:null,rawJson:c}}catch{return{type:"json",prettyJson:null,error:"Invalid JSON",rawJson:c}}if(a.type==="app"||a.type==="tasks")try{const $=JSON.parse(c);return{type:a.type,prettyJson:JSON.stringify($,null,2),error:null,rawJson:c}}catch{return{type:a.type,prettyJson:null,error:"Invalid JSON",rawJson:c}}return null},[a,M,c]),x3=x.useMemo(()=>({open:qe,onOpenChange:ut,activeDoc:a,commands:rn,onSelectDoc:JS,onRunCommand:ZS}),[a,rn,qe,JS,ZS,ut]);return{sidebar:{tags:Li,systemTagStatus:hc,runCommandAction:Kf,active:a,navigate:I,encodePath:Qn,docs:ct,folders:ur,createFolder:f3,deleteFolder:h3,moveDoc:p3},main:{active:a,editor:Le,tableDefaults:Xz,tableView:e3,setTableView:t3,persistTableView:s3,jsonData:pc,effectiveSchema:mc,handleTableRowsChange:n3,handleAddRow:r3,addTableColumn:m3,deleteTableColumn:g3,parseColumnOptions:i3,jsonError:Yz,content:c,setContent:d,setIsDirty:L,setLastEditAt:O,appConfig:T,appConfigError:A},dialogs:{infoInspector:y3,active:a,createDoc:d3},docHeader:{active:a,activeTitleLabel:VS,titleInputRef:V,deriveFileName:We,renameDoc:o3,save:l3,saveStatus:b,status:h,conflict:H,openMetadataDialog:t,runCommandAction:Kf,pinDocCommand:jk,archiveDocCommand:Pk,deleteDocCommand:Ak,availableHeaderTags:u3,headerTags:F,applyHeaderTags:c3},commandPalette:{commandPaletteValue:x3}}},Ade=e=>{const t=e.toLowerCase().split("+");return{mod:t.includes("mod"),shift:t.includes("shift"),alt:t.includes("alt"),key:t.filter(n=>!["mod","shift","alt"].includes(n))[0]}},_de=(e,t,n)=>{x.useEffect(()=>{const r=e.filter(i=>i.shortcut),s=i=>{for(const o of r){const l=Ade(o.shortcut);if(i.key.toLowerCase()!==l.key||l.mod&&!i.metaKey&&!i.ctrlKey||!l.mod&&(i.metaKey||i.ctrlKey)||l.shift!==i.shiftKey||l.alt!==i.altKey)continue;i.preventDefault();const a=t[o.id];a?a():o.run&&n&&n(o);return}};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[e,t,n])},Ide=()=>{const[e,t]=x.useState(!1),[n,r]=x.useState("markdown"),[s,i]=x.useState(void 0),o=x.useCallback((l,a)=>{r(l),i(a),t(!0)},[]);return{open:e,setOpen:t,docType:n,setDocType:r,folder:s,openFor:o}},Dde=()=>{const[e,t]=x.useState(!1),n=x.useCallback(()=>t(!0),[]);return{open:e,setOpen:t,openDialog:n}},Lde=()=>{const[e,t]=x.useState(!1),n=x.useCallback(()=>t(!0),[]);return{open:e,setOpen:t,openDialog:n}};function $de(){const e=Lg(),t=Tf(),n=nt.projects.list.useQuery(void 0,{refetchInterval:1e3}),r=x.useMemo(()=>n.data??[],[n.data]),s=x.useMemo(()=>eS(t.pathname),[t.pathname]),i=s.projectId,o=x.useMemo(()=>{var d,h;return i?r.find(f=>f.id===i)?i:((h=r[0])==null?void 0:h.id)??null:((d=r[0])==null?void 0:d.id)??null},[r,i]),l=s.sidebarTab;x.useEffect(()=>{if(r.length===0||i&&r.find(h=>h.id===i))return;const d=r[0];e(`/${d.id}/${l}`,{replace:!0})},[r,i,e,l]);const a=x.useCallback(d=>{e(`/${d}/${l}`,{replace:!0})},[e,l]),u=x.useMemo(()=>r.find(d=>d.id===o)??null,[r,o]),c=x.useMemo(()=>o?`/api/projects/${o}`:"/api/projects/_",[o]);return{projects:r,activeProject:u,activeProjectId:o,apiRoot:c,setActiveProjectId:a,isLoading:n.isLoading}}function zde(){const e=Ide(),t=Lde(),{activeProject:n}=Ht(),r=(n==null?void 0:n.id)??"",{sidebarTab:s,panel:i,agentId:o,codeFilePath:l,navigateToTab:a,navigateToAgent:u,navigateToCodeFile:c}=by(),[d,h]=x.useState(!1),{createAgent:f}=Pf(),m=x.useCallback(()=>{f(void 0,{onSuccess:S=>{u(r,S.id)}})},[f,u,r]),g=x.useCallback(S=>a(r,S),[a,r]),v=x.useCallback(S=>{S==="docs"?a(r,s):a(r,S)},[a,r,s]),y=x.useCallback(S=>u(r,S),[u,r]),w=x.useCallback(S=>c(r,S),[c,r]),b=Pde({openCreateDialog:e.openFor,openMetadataDialog:t.openDialog,setAgentsSidebarOpen:()=>{},createAgent:m,openZapper:()=>h(!0)}),C=x.useMemo(()=>({"commandPalette.open":()=>b.commandPalette.commandPaletteValue.onOpenChange(!b.commandPalette.commandPaletteValue.open),"sidebar.toggleTab":()=>g(s==="docs"?"agents":s==="agents"?"code":"docs")}),[b.commandPalette.commandPaletteValue,s,g]);return _de(b.commandPalette.commandPaletteValue.commands,C,b.commandPalette.commandPaletteValue.onRunCommand),p.jsx(zW,{value:e,children:p.jsx(_ae,{value:t,children:p.jsx(Yte,{children:p.jsx($W,{value:b,children:p.jsxs(k9,{value:b.commandPalette.commandPaletteValue,children:[p.jsx(qae,{}),p.jsxs("div",{className:"flex h-screen flex-col font-sans",children:[p.jsxs("div",{className:"flex min-h-0 flex-1",children:[p.jsxs("div",{className:"flex",children:[p.jsx(Ere,{panel:i,onPanelChange:v}),i==="docs"&&p.jsx(Lne,{activeTab:s,onTabChange:g,selectedAgentId:o,onSelectAgent:y,activeCodeFile:l,onSelectCodeFile:w})]}),i==="settings"?p.jsx(Rre,{}):i==="commands"?p.jsx(Ore,{}):s==="code"&&l?p.jsx(IW,{filePath:l}):s==="code"?p.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"Select a file to view"}):s==="docs"?p.jsx(wne,{}):o?p.jsx(Pae,{agentId:o},o):p.jsx(Aae,{})]}),p.jsx(_W,{}),p.jsx(Dae,{}),p.jsx(Uae,{open:d,onClose:()=>h(!1)}),p.jsx(FW,{})]})]})})})})})}function Fde(){const e=$de(),t=Dde(),n=x.useMemo(()=>({...e,openCreateProject:t.openDialog}),[e,t.openDialog]);return e.isLoading?p.jsx("div",{className:"flex h-screen items-center justify-center font-sans text-muted-foreground",children:"Loading projects…"}):e.projects.length===0?p.jsx("div",{className:"flex h-screen items-center justify-center font-sans text-muted-foreground",children:"No projects found. Add projects to ~/.hyperdoc/projects.json"}):e.activeProject?p.jsxs(CH,{value:n,children:[p.jsx(zde,{},e.activeProject.id),p.jsx(dK,{controller:t})]}):null}const WM=document.getElementById("root"),KM=new gB;WM&&wP(WM).render(p.jsx(nt.Provider,{client:SH,queryClient:KM,children:p.jsx(yB,{client:KM,children:p.jsx(U5,{children:p.jsx(B5,{children:p.jsx(jP,{path:"/*",element:p.jsx(Fde,{})})})})})}));
|