@maplab/hyperdoc 0.3.0 → 0.4.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 +163 -27
- package/dist/index.js.map +1 -1
- package/dist/web/assets/index-BTUlbGUk.js +725 -0
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-DMxgWNcj.js +0 -720
|
@@ -0,0 +1,725 @@
|
|
|
1
|
+
var j3=Object.defineProperty;var tC=e=>{throw TypeError(e)};var M3=(e,t,n)=>t in e?j3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ot=(e,t,n)=>M3(e,typeof t!="symbol"?t+"":t,n),Dy=(e,t,n)=>t.has(e)||tC("Cannot "+n);var A=(e,t,n)=>(Dy(e,t,"read from private field"),n?n.call(e):t.get(e)),he=(e,t,n)=>t.has(e)?tC("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),oe=(e,t,n,r)=>(Dy(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Me=(e,t,n)=>(Dy(e,t,"access private method"),n);var Zf=(e,t,n,r)=>({set _(s){oe(e,t,s,n)},get _(){return A(e,t,r)}});function O3(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 Mp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var dM={exports:{}},vg={},fM={exports:{}},qe={};/**
|
|
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 Cf=Symbol.for("react.element"),P3=Symbol.for("react.portal"),A3=Symbol.for("react.fragment"),_3=Symbol.for("react.strict_mode"),I3=Symbol.for("react.profiler"),D3=Symbol.for("react.provider"),L3=Symbol.for("react.context"),$3=Symbol.for("react.forward_ref"),z3=Symbol.for("react.suspense"),F3=Symbol.for("react.memo"),B3=Symbol.for("react.lazy"),nC=Symbol.iterator;function V3(e){return e===null||typeof e!="object"?null:(e=nC&&e[nC]||e["@@iterator"],typeof e=="function"?e:null)}var hM={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},pM=Object.assign,mM={};function rc(e,t,n){this.props=e,this.context=t,this.refs=mM,this.updater=n||hM}rc.prototype.isReactComponent={};rc.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")};rc.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function gM(){}gM.prototype=rc.prototype;function Eb(e,t,n){this.props=e,this.context=t,this.refs=mM,this.updater=n||hM}var Nb=Eb.prototype=new gM;Nb.constructor=Eb;pM(Nb,rc.prototype);Nb.isPureReactComponent=!0;var rC=Array.isArray,yM=Object.prototype.hasOwnProperty,Tb={current:null},xM={key:!0,ref:!0,__self:!0,__source:!0};function vM(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)yM.call(t,r)&&!xM.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:Cf,type:e,key:i,ref:o,props:s,_owner:Tb.current}}function H3(e,t){return{$$typeof:Cf,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Rb(e){return typeof e=="object"&&e!==null&&e.$$typeof===Cf}function U3(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var sC=/\/+/g;function Ly(e,t){return typeof e=="object"&&e!==null&&e.key!=null?U3(""+e.key):t.toString(36)}function Yh(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 Cf:case P3:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+Ly(o,0):r,rC(s)?(n="",e!=null&&(n=e.replace(sC,"$&/")+"/"),Yh(s,t,n,"",function(u){return u})):s!=null&&(Rb(s)&&(s=H3(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(sC,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",rC(e))for(var l=0;l<e.length;l++){i=e[l];var a=r+Ly(i,l);o+=Yh(i,t,n,a,s)}else if(a=V3(e),typeof a=="function")for(e=a.call(e),l=0;!(i=e.next()).done;)i=i.value,a=r+Ly(i,l++),o+=Yh(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 Yf(e,t,n){if(e==null)return e;var r=[],s=0;return Yh(e,r,"","",function(i){return t.call(n,i,s++)}),r}function q3(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},Xh={transition:null},W3={ReactCurrentDispatcher:qn,ReactCurrentBatchConfig:Xh,ReactCurrentOwner:Tb};function wM(){throw Error("act(...) is not supported in production builds of React.")}qe.Children={map:Yf,forEach:function(e,t,n){Yf(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Yf(e,function(){t++}),t},toArray:function(e){return Yf(e,function(t){return t})||[]},only:function(e){if(!Rb(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};qe.Component=rc;qe.Fragment=A3;qe.Profiler=I3;qe.PureComponent=Eb;qe.StrictMode=_3;qe.Suspense=z3;qe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W3;qe.act=wM;qe.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=pM({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=Tb.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(a in t)yM.call(t,a)&&!xM.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:Cf,type:e.type,key:s,ref:i,props:r,_owner:o}};qe.createContext=function(e){return e={$$typeof:L3,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:D3,_context:e},e.Consumer=e};qe.createElement=vM;qe.createFactory=function(e){var t=vM.bind(null,e);return t.type=e,t};qe.createRef=function(){return{current:null}};qe.forwardRef=function(e){return{$$typeof:$3,render:e}};qe.isValidElement=Rb;qe.lazy=function(e){return{$$typeof:B3,_payload:{_status:-1,_result:e},_init:q3}};qe.memo=function(e,t){return{$$typeof:F3,type:e,compare:t===void 0?null:t}};qe.startTransition=function(e){var t=Xh.transition;Xh.transition={};try{e()}finally{Xh.transition=t}};qe.unstable_act=wM;qe.useCallback=function(e,t){return qn.current.useCallback(e,t)};qe.useContext=function(e){return qn.current.useContext(e)};qe.useDebugValue=function(){};qe.useDeferredValue=function(e){return qn.current.useDeferredValue(e)};qe.useEffect=function(e,t){return qn.current.useEffect(e,t)};qe.useId=function(){return qn.current.useId()};qe.useImperativeHandle=function(e,t,n){return qn.current.useImperativeHandle(e,t,n)};qe.useInsertionEffect=function(e,t){return qn.current.useInsertionEffect(e,t)};qe.useLayoutEffect=function(e,t){return qn.current.useLayoutEffect(e,t)};qe.useMemo=function(e,t){return qn.current.useMemo(e,t)};qe.useReducer=function(e,t,n){return qn.current.useReducer(e,t,n)};qe.useRef=function(e){return qn.current.useRef(e)};qe.useState=function(e){return qn.current.useState(e)};qe.useSyncExternalStore=function(e,t,n){return qn.current.useSyncExternalStore(e,t,n)};qe.useTransition=function(){return qn.current.useTransition()};qe.version="18.3.1";fM.exports=qe;var y=fM.exports;const Ur=xg(y),Ef=O3({__proto__:null,default:Ur},[y]);/**
|
|
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 K3=y,Q3=Symbol.for("react.element"),G3=Symbol.for("react.fragment"),J3=Object.prototype.hasOwnProperty,Z3=K3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Y3={key:!0,ref:!0,__self:!0,__source:!0};function bM(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)J3.call(t,r)&&!Y3.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:Q3,type:e,key:i,ref:o,props:s,_owner:Z3.current}}vg.Fragment=G3;vg.jsx=bM;vg.jsxs=bM;dM.exports=vg;var p=dM.exports,kM={exports:{}},Sr={},SM={exports:{}},CM={};/**
|
|
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 ie=M-1>>>1,V=_[ie];if(0<s(V,Q))_[ie]=Q,_[M]=V,M=ie;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 ie=0,V=_.length,R=V>>>1;ie<R;){var D=2*(ie+1)-1,F=_[D],Y=D+1,G=_[Y];if(0>s(F,M))Y<V&&0>s(G,F)?(_[ie]=G,_[Y]=M,ie=Y):(_[ie]=F,_[D]=M,ie=D);else if(Y<V&&0>s(G,M))_[ie]=G,_[Y]=M,ie=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,f=3,h=!1,m=!1,g=!1,v=typeof setTimeout=="function"?setTimeout:null,x=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,x(T),T=-1),h=!0;var M=f;try{for(b(Q),d=n(a);d!==null&&(!(d.expirationTime>Q)||_&&!j());){var ie=d.callback;if(typeof ie=="function"){d.callback=null,f=d.priorityLevel;var V=ie(d.expirationTime<=Q);Q=e.unstable_now(),typeof V=="function"?d.callback=V:d===n(a)&&r(a),b(Q)}else r(a);d=n(a)}if(d!==null)var R=!0;else{var D=n(u);D!==null&&K(C,D.startTime-Q),R=!1}return R}finally{d=null,f=M,h=!1}}var k=!1,E=null,T=-1,O=5,N=-1;function j(){return!(e.unstable_now()-N<O)}function P(){if(E!==null){var _=e.unstable_now();N=_;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(P)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,L=I.port2;I.port1.onmessage=P,z=function(){L.postMessage(null)}}else z=function(){v(P,0)};function H(_){E=_,k||(k=!0,z())}function K(_,Q){T=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||h||(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 f},e.unstable_getFirstCallbackNode=function(){return n(a)},e.unstable_next=function(_){switch(f){case 1:case 2:case 3:var Q=3;break;default:Q=f}var M=f;f=Q;try{return _()}finally{f=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=f;f=_;try{return Q()}finally{f=M}},e.unstable_scheduleCallback=function(_,Q,M){var ie=e.unstable_now();switch(typeof M=="object"&&M!==null?(M=M.delay,M=typeof M=="number"&&0<M?ie+M:ie):M=ie,_){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=M+V,_={id:c++,callback:Q,priorityLevel:_,startTime:M,expirationTime:V,sortIndex:-1},M>ie?(_.sortIndex=M,t(u,_),n(a)===null&&_===n(u)&&(g?(x(T),T=-1):g=!0,K(C,M-ie))):(_.sortIndex=V,t(a,_),m||h||(m=!0,H(S))),_},e.unstable_shouldYield=j,e.unstable_wrapCallback=function(_){var Q=f;return function(){var M=f;f=Q;try{return _.apply(this,arguments)}finally{f=M}}}})(CM);SM.exports=CM;var X3=SM.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 eF=y,vr=X3;function ne(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 EM=new Set,Rd={};function ia(e,t){Ru(e,t),Ru(e+"Capture",t)}function Ru(e,t){for(Rd[e]=t,e=0;e<t.length;e++)EM.add(t[e])}var _i=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Iv=Object.prototype.hasOwnProperty,tF=/^[: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]*$/,iC={},oC={};function nF(e){return Iv.call(oC,e)?!0:Iv.call(iC,e)?!1:tF.test(e)?oC[e]=!0:(iC[e]=!0,!1)}function rF(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 sF(e,t,n,r){if(t===null||typeof t>"u"||rF(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 pn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){pn[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];pn[t]=new Wn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){pn[e]=new Wn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){pn[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){pn[e]=new Wn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){pn[e]=new Wn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){pn[e]=new Wn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){pn[e]=new Wn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){pn[e]=new Wn(e,5,!1,e.toLowerCase(),null,!1,!1)});var jb=/[\-:]([a-z])/g;function Mb(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(jb,Mb);pn[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(jb,Mb);pn[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(jb,Mb);pn[t]=new Wn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){pn[e]=new Wn(e,1,!1,e.toLowerCase(),null,!1,!1)});pn.xlinkHref=new Wn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){pn[e]=new Wn(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ob(e,t,n,r){var s=pn.hasOwnProperty(t)?pn[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(sF(t,n,s,r)&&(n=null),r||s===null?nF(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 zi=eF.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Xf=Symbol.for("react.element"),Fa=Symbol.for("react.portal"),Ba=Symbol.for("react.fragment"),Pb=Symbol.for("react.strict_mode"),Dv=Symbol.for("react.profiler"),NM=Symbol.for("react.provider"),TM=Symbol.for("react.context"),Ab=Symbol.for("react.forward_ref"),Lv=Symbol.for("react.suspense"),$v=Symbol.for("react.suspense_list"),_b=Symbol.for("react.memo"),Ji=Symbol.for("react.lazy"),RM=Symbol.for("react.offscreen"),lC=Symbol.iterator;function vc(e){return e===null||typeof e!="object"?null:(e=lC&&e[lC]||e["@@iterator"],typeof e=="function"?e:null)}var jt=Object.assign,$y;function Fc(e){if($y===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);$y=t&&t[1]||""}return`
|
|
34
|
+
`+$y+e}var zy=!1;function Fy(e,t){if(!e||zy)return"";zy=!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{zy=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Fc(e):""}function iF(e){switch(e.tag){case 5:return Fc(e.type);case 16:return Fc("Lazy");case 13:return Fc("Suspense");case 19:return Fc("SuspenseList");case 0:case 2:case 15:return e=Fy(e.type,!1),e;case 11:return e=Fy(e.type.render,!1),e;case 1:return e=Fy(e.type,!0),e;default:return""}}function zv(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 Ba:return"Fragment";case Fa:return"Portal";case Dv:return"Profiler";case Pb:return"StrictMode";case Lv:return"Suspense";case $v:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case TM:return(e.displayName||"Context")+".Consumer";case NM:return(e._context.displayName||"Context")+".Provider";case Ab:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case _b:return t=e.displayName||null,t!==null?t:zv(e.type)||"Memo";case Ji:t=e._payload,e=e._init;try{return zv(e(t))}catch{}}return null}function oF(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 zv(t);case 8:return t===Pb?"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 zo(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function jM(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function lF(e){var t=jM(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 eh(e){e._valueTracker||(e._valueTracker=lF(e))}function MM(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=jM(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Op(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 Fv(e,t){var n=t.checked;return jt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function aC(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=zo(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 OM(e,t){t=t.checked,t!=null&&Ob(e,"checked",t,!1)}function Bv(e,t){OM(e,t);var n=zo(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")?Vv(e,t.type,n):t.hasOwnProperty("defaultValue")&&Vv(e,t.type,zo(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function uC(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 Vv(e,t,n){(t!=="number"||Op(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Bc=Array.isArray;function tu(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=""+zo(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 Hv(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ne(91));return jt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function cC(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ne(92));if(Bc(n)){if(1<n.length)throw Error(ne(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:zo(n)}}function PM(e,t){var n=zo(t.value),r=zo(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 dC(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function AM(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 Uv(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?AM(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var th,_M=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(th=th||document.createElement("div"),th.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=th.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function jd(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ed={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},aF=["Webkit","ms","Moz","O"];Object.keys(ed).forEach(function(e){aF.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ed[t]=ed[e]})});function IM(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ed.hasOwnProperty(e)&&ed[e]?(""+t).trim():t+"px"}function DM(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=IM(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var uF=jt({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 qv(e,t){if(t){if(uF[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ne(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ne(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ne(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ne(62))}}function Wv(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 Kv=null;function Ib(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Qv=null,nu=null,ru=null;function fC(e){if(e=Rf(e)){if(typeof Qv!="function")throw Error(ne(280));var t=e.stateNode;t&&(t=Cg(t),Qv(e.stateNode,e.type,t))}}function LM(e){nu?ru?ru.push(e):ru=[e]:nu=e}function $M(){if(nu){var e=nu,t=ru;if(ru=nu=null,fC(e),t)for(e=0;e<t.length;e++)fC(t[e])}}function zM(e,t){return e(t)}function FM(){}var By=!1;function BM(e,t,n){if(By)return e(t,n);By=!0;try{return zM(e,t,n)}finally{By=!1,(nu!==null||ru!==null)&&(FM(),$M())}}function Md(e,t){var n=e.stateNode;if(n===null)return null;var r=Cg(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(ne(231,t,typeof n));return n}var Gv=!1;if(_i)try{var wc={};Object.defineProperty(wc,"passive",{get:function(){Gv=!0}}),window.addEventListener("test",wc,wc),window.removeEventListener("test",wc,wc)}catch{Gv=!1}function cF(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 td=!1,Pp=null,Ap=!1,Jv=null,dF={onError:function(e){td=!0,Pp=e}};function fF(e,t,n,r,s,i,o,l,a){td=!1,Pp=null,cF.apply(dF,arguments)}function hF(e,t,n,r,s,i,o,l,a){if(fF.apply(this,arguments),td){if(td){var u=Pp;td=!1,Pp=null}else throw Error(ne(198));Ap||(Ap=!0,Jv=u)}}function oa(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 VM(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 hC(e){if(oa(e)!==e)throw Error(ne(188))}function pF(e){var t=e.alternate;if(!t){if(t=oa(e),t===null)throw Error(ne(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 hC(s),e;if(i===r)return hC(s),t;i=i.sibling}throw Error(ne(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(ne(189))}}if(n.alternate!==r)throw Error(ne(190))}if(n.tag!==3)throw Error(ne(188));return n.stateNode.current===n?e:t}function HM(e){return e=pF(e),e!==null?UM(e):null}function UM(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=UM(e);if(t!==null)return t;e=e.sibling}return null}var qM=vr.unstable_scheduleCallback,pC=vr.unstable_cancelCallback,mF=vr.unstable_shouldYield,gF=vr.unstable_requestPaint,Dt=vr.unstable_now,yF=vr.unstable_getCurrentPriorityLevel,Db=vr.unstable_ImmediatePriority,WM=vr.unstable_UserBlockingPriority,_p=vr.unstable_NormalPriority,xF=vr.unstable_LowPriority,KM=vr.unstable_IdlePriority,wg=null,Vs=null;function vF(e){if(Vs&&typeof Vs.onCommitFiberRoot=="function")try{Vs.onCommitFiberRoot(wg,e,void 0,(e.current.flags&128)===128)}catch{}}var fs=Math.clz32?Math.clz32:kF,wF=Math.log,bF=Math.LN2;function kF(e){return e>>>=0,e===0?32:31-(wF(e)/bF|0)|0}var nh=64,rh=4194304;function Vc(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 Ip(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=Vc(l):(i&=o,i!==0&&(r=Vc(i)))}else o=n&~s,o!==0?r=Vc(o):i!==0&&(r=Vc(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-fs(t),s=1<<n,r|=e[n],t&=~s;return r}function SF(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 CF(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-fs(i),l=1<<o,a=s[o];a===-1?(!(l&n)||l&r)&&(s[o]=SF(l,t)):a<=t&&(e.expiredLanes|=l),i&=~l}}function Zv(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function QM(){var e=nh;return nh<<=1,!(nh&4194240)&&(nh=64),e}function Vy(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Nf(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-fs(t),e[t]=n}function EF(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-fs(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function Lb(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-fs(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var ut=0;function GM(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var JM,$b,ZM,YM,XM,Yv=!1,sh=[],Co=null,Eo=null,No=null,Od=new Map,Pd=new Map,no=[],NF="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 mC(e,t){switch(e){case"focusin":case"focusout":Co=null;break;case"dragenter":case"dragleave":Eo=null;break;case"mouseover":case"mouseout":No=null;break;case"pointerover":case"pointerout":Od.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pd.delete(t.pointerId)}}function bc(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=Rf(t),t!==null&&$b(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function TF(e,t,n,r,s){switch(t){case"focusin":return Co=bc(Co,e,t,n,r,s),!0;case"dragenter":return Eo=bc(Eo,e,t,n,r,s),!0;case"mouseover":return No=bc(No,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return Od.set(i,bc(Od.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Pd.set(i,bc(Pd.get(i)||null,e,t,n,r,s)),!0}return!1}function eO(e){var t=xl(e.target);if(t!==null){var n=oa(t);if(n!==null){if(t=n.tag,t===13){if(t=VM(n),t!==null){e.blockedOn=t,XM(e.priority,function(){ZM(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 ep(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Xv(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Kv=r,n.target.dispatchEvent(r),Kv=null}else return t=Rf(n),t!==null&&$b(t),e.blockedOn=n,!1;t.shift()}return!0}function gC(e,t,n){ep(e)&&n.delete(t)}function RF(){Yv=!1,Co!==null&&ep(Co)&&(Co=null),Eo!==null&&ep(Eo)&&(Eo=null),No!==null&&ep(No)&&(No=null),Od.forEach(gC),Pd.forEach(gC)}function kc(e,t){e.blockedOn===t&&(e.blockedOn=null,Yv||(Yv=!0,vr.unstable_scheduleCallback(vr.unstable_NormalPriority,RF)))}function Ad(e){function t(s){return kc(s,e)}if(0<sh.length){kc(sh[0],e);for(var n=1;n<sh.length;n++){var r=sh[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Co!==null&&kc(Co,e),Eo!==null&&kc(Eo,e),No!==null&&kc(No,e),Od.forEach(t),Pd.forEach(t),n=0;n<no.length;n++)r=no[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<no.length&&(n=no[0],n.blockedOn===null);)eO(n),n.blockedOn===null&&no.shift()}var su=zi.ReactCurrentBatchConfig,Dp=!0;function jF(e,t,n,r){var s=ut,i=su.transition;su.transition=null;try{ut=1,zb(e,t,n,r)}finally{ut=s,su.transition=i}}function MF(e,t,n,r){var s=ut,i=su.transition;su.transition=null;try{ut=4,zb(e,t,n,r)}finally{ut=s,su.transition=i}}function zb(e,t,n,r){if(Dp){var s=Xv(e,t,n,r);if(s===null)Yy(e,t,r,Lp,n),mC(e,r);else if(TF(s,e,t,n,r))r.stopPropagation();else if(mC(e,r),t&4&&-1<NF.indexOf(e)){for(;s!==null;){var i=Rf(s);if(i!==null&&JM(i),i=Xv(e,t,n,r),i===null&&Yy(e,t,r,Lp,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Yy(e,t,r,null,n)}}var Lp=null;function Xv(e,t,n,r){if(Lp=null,e=Ib(r),e=xl(e),e!==null)if(t=oa(e),t===null)e=null;else if(n=t.tag,n===13){if(e=VM(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 Lp=e,null}function tO(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(yF()){case Db:return 1;case WM:return 4;case _p:case xF:return 16;case KM:return 536870912;default:return 16}default:return 16}}var yo=null,Fb=null,tp=null;function nO(){if(tp)return tp;var e,t=Fb,n=t.length,r,s="value"in yo?yo.value:yo.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 tp=s.slice(e,1<r?1-r:void 0)}function np(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 ih(){return!0}function yC(){return!1}function Cr(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)?ih:yC,this.isPropagationStopped=yC,this}return jt(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=ih)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ih)},persist:function(){},isPersistent:ih}),t}var sc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bb=Cr(sc),Tf=jt({},sc,{view:0,detail:0}),OF=Cr(Tf),Hy,Uy,Sc,bg=jt({},Tf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vb,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!==Sc&&(Sc&&e.type==="mousemove"?(Hy=e.screenX-Sc.screenX,Uy=e.screenY-Sc.screenY):Uy=Hy=0,Sc=e),Hy)},movementY:function(e){return"movementY"in e?e.movementY:Uy}}),xC=Cr(bg),PF=jt({},bg,{dataTransfer:0}),AF=Cr(PF),_F=jt({},Tf,{relatedTarget:0}),qy=Cr(_F),IF=jt({},sc,{animationName:0,elapsedTime:0,pseudoElement:0}),DF=Cr(IF),LF=jt({},sc,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),$F=Cr(LF),zF=jt({},sc,{data:0}),vC=Cr(zF),FF={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},BF={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"},VF={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function HF(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=VF[e])?!!t[e]:!1}function Vb(){return HF}var UF=jt({},Tf,{key:function(e){if(e.key){var t=FF[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=np(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?BF[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vb,charCode:function(e){return e.type==="keypress"?np(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?np(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),qF=Cr(UF),WF=jt({},bg,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wC=Cr(WF),KF=jt({},Tf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vb}),QF=Cr(KF),GF=jt({},sc,{propertyName:0,elapsedTime:0,pseudoElement:0}),JF=Cr(GF),ZF=jt({},bg,{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}),YF=Cr(ZF),XF=[9,13,27,32],Hb=_i&&"CompositionEvent"in window,nd=null;_i&&"documentMode"in document&&(nd=document.documentMode);var e4=_i&&"TextEvent"in window&&!nd,rO=_i&&(!Hb||nd&&8<nd&&11>=nd),bC=" ",kC=!1;function sO(e,t){switch(e){case"keyup":return XF.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function iO(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Va=!1;function t4(e,t){switch(e){case"compositionend":return iO(t);case"keypress":return t.which!==32?null:(kC=!0,bC);case"textInput":return e=t.data,e===bC&&kC?null:e;default:return null}}function n4(e,t){if(Va)return e==="compositionend"||!Hb&&sO(e,t)?(e=nO(),tp=Fb=yo=null,Va=!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 rO&&t.locale!=="ko"?null:t.data;default:return null}}var r4={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 SC(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!r4[e.type]:t==="textarea"}function oO(e,t,n,r){LM(r),t=$p(t,"onChange"),0<t.length&&(n=new Bb("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var rd=null,_d=null;function s4(e){yO(e,0)}function kg(e){var t=qa(e);if(MM(t))return e}function i4(e,t){if(e==="change")return t}var lO=!1;if(_i){var Wy;if(_i){var Ky="oninput"in document;if(!Ky){var CC=document.createElement("div");CC.setAttribute("oninput","return;"),Ky=typeof CC.oninput=="function"}Wy=Ky}else Wy=!1;lO=Wy&&(!document.documentMode||9<document.documentMode)}function EC(){rd&&(rd.detachEvent("onpropertychange",aO),_d=rd=null)}function aO(e){if(e.propertyName==="value"&&kg(_d)){var t=[];oO(t,_d,e,Ib(e)),BM(s4,t)}}function o4(e,t,n){e==="focusin"?(EC(),rd=t,_d=n,rd.attachEvent("onpropertychange",aO)):e==="focusout"&&EC()}function l4(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return kg(_d)}function a4(e,t){if(e==="click")return kg(t)}function u4(e,t){if(e==="input"||e==="change")return kg(t)}function c4(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ys=typeof Object.is=="function"?Object.is:c4;function Id(e,t){if(ys(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(!Iv.call(t,s)||!ys(e[s],t[s]))return!1}return!0}function NC(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function TC(e,t){var n=NC(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=NC(n)}}function uO(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?uO(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function cO(){for(var e=window,t=Op();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Op(e.document)}return t}function Ub(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 d4(e){var t=cO(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&uO(n.ownerDocument.documentElement,n)){if(r!==null&&Ub(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=TC(n,i);var o=TC(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 f4=_i&&"documentMode"in document&&11>=document.documentMode,Ha=null,e0=null,sd=null,t0=!1;function RC(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;t0||Ha==null||Ha!==Op(r)||(r=Ha,"selectionStart"in r&&Ub(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}),sd&&Id(sd,r)||(sd=r,r=$p(e0,"onSelect"),0<r.length&&(t=new Bb("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Ha)))}function oh(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ua={animationend:oh("Animation","AnimationEnd"),animationiteration:oh("Animation","AnimationIteration"),animationstart:oh("Animation","AnimationStart"),transitionend:oh("Transition","TransitionEnd")},Qy={},dO={};_i&&(dO=document.createElement("div").style,"AnimationEvent"in window||(delete Ua.animationend.animation,delete Ua.animationiteration.animation,delete Ua.animationstart.animation),"TransitionEvent"in window||delete Ua.transitionend.transition);function Sg(e){if(Qy[e])return Qy[e];if(!Ua[e])return e;var t=Ua[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in dO)return Qy[e]=t[n];return e}var fO=Sg("animationend"),hO=Sg("animationiteration"),pO=Sg("animationstart"),mO=Sg("transitionend"),gO=new Map,jC="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 Zo(e,t){gO.set(e,t),ia(t,[e])}for(var Gy=0;Gy<jC.length;Gy++){var Jy=jC[Gy],h4=Jy.toLowerCase(),p4=Jy[0].toUpperCase()+Jy.slice(1);Zo(h4,"on"+p4)}Zo(fO,"onAnimationEnd");Zo(hO,"onAnimationIteration");Zo(pO,"onAnimationStart");Zo("dblclick","onDoubleClick");Zo("focusin","onFocus");Zo("focusout","onBlur");Zo(mO,"onTransitionEnd");Ru("onMouseEnter",["mouseout","mouseover"]);Ru("onMouseLeave",["mouseout","mouseover"]);Ru("onPointerEnter",["pointerout","pointerover"]);Ru("onPointerLeave",["pointerout","pointerover"]);ia("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ia("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ia("onBeforeInput",["compositionend","keypress","textInput","paste"]);ia("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ia("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ia("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hc="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(" "),m4=new Set("cancel close invalid load scroll toggle".split(" ").concat(Hc));function MC(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,hF(r,t,void 0,e),e.currentTarget=null}function yO(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;MC(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;MC(s,l,u),i=a}}}if(Ap)throw e=Jv,Ap=!1,Jv=null,e}function yt(e,t){var n=t[o0];n===void 0&&(n=t[o0]=new Set);var r=e+"__bubble";n.has(r)||(xO(t,e,2,!1),n.add(r))}function Zy(e,t,n){var r=0;t&&(r|=4),xO(n,e,r,t)}var lh="_reactListening"+Math.random().toString(36).slice(2);function Dd(e){if(!e[lh]){e[lh]=!0,EM.forEach(function(n){n!=="selectionchange"&&(m4.has(n)||Zy(n,!1,e),Zy(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[lh]||(t[lh]=!0,Zy("selectionchange",!1,t))}}function xO(e,t,n,r){switch(tO(t)){case 1:var s=jF;break;case 4:s=MF;break;default:s=zb}n=s.bind(null,t,n,e),s=void 0,!Gv||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 Yy(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=xl(l),o===null)return;if(a=o.tag,a===5||a===6){r=i=o;continue e}l=l.parentNode}}r=r.return}BM(function(){var u=i,c=Ib(n),d=[];e:{var f=gO.get(e);if(f!==void 0){var h=Bb,m=e;switch(e){case"keypress":if(np(n)===0)break e;case"keydown":case"keyup":h=qF;break;case"focusin":m="focus",h=qy;break;case"focusout":m="blur",h=qy;break;case"beforeblur":case"afterblur":h=qy;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=xC;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=AF;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=QF;break;case fO:case hO:case pO:h=DF;break;case mO:h=JF;break;case"scroll":h=OF;break;case"wheel":h=YF;break;case"copy":case"cut":case"paste":h=$F;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=wC}var g=(t&4)!==0,v=!g&&e==="scroll",x=g?f!==null?f+"Capture":null:f;g=[];for(var w=u,b;w!==null;){b=w;var C=b.stateNode;if(b.tag===5&&C!==null&&(b=C,x!==null&&(C=Md(w,x),C!=null&&g.push(Ld(w,C,b)))),v)break;w=w.return}0<g.length&&(f=new h(f,m,null,n,c),d.push({event:f,listeners:g}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",f&&n!==Kv&&(m=n.relatedTarget||n.fromElement)&&(xl(m)||m[Ii]))break e;if((h||f)&&(f=c.window===c?c:(f=c.ownerDocument)?f.defaultView||f.parentWindow:window,h?(m=n.relatedTarget||n.toElement,h=u,m=m?xl(m):null,m!==null&&(v=oa(m),m!==v||m.tag!==5&&m.tag!==6)&&(m=null)):(h=null,m=u),h!==m)){if(g=xC,C="onMouseLeave",x="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(g=wC,C="onPointerLeave",x="onPointerEnter",w="pointer"),v=h==null?f:qa(h),b=m==null?f:qa(m),f=new g(C,w+"leave",h,n,c),f.target=v,f.relatedTarget=b,C=null,xl(c)===u&&(g=new g(x,w+"enter",m,n,c),g.target=b,g.relatedTarget=v,C=g),v=C,h&&m)t:{for(g=h,x=m,w=0,b=g;b;b=va(b))w++;for(b=0,C=x;C;C=va(C))b++;for(;0<w-b;)g=va(g),w--;for(;0<b-w;)x=va(x),b--;for(;w--;){if(g===x||x!==null&&g===x.alternate)break t;g=va(g),x=va(x)}g=null}else g=null;h!==null&&OC(d,f,h,g,!1),m!==null&&v!==null&&OC(d,v,m,g,!0)}}e:{if(f=u?qa(u):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var S=i4;else if(SC(f))if(lO)S=u4;else{S=l4;var k=o4}else(h=f.nodeName)&&h.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(S=a4);if(S&&(S=S(e,u))){oO(d,S,n,c);break e}k&&k(e,f,u),e==="focusout"&&(k=f._wrapperState)&&k.controlled&&f.type==="number"&&Vv(f,"number",f.value)}switch(k=u?qa(u):window,e){case"focusin":(SC(k)||k.contentEditable==="true")&&(Ha=k,e0=u,sd=null);break;case"focusout":sd=e0=Ha=null;break;case"mousedown":t0=!0;break;case"contextmenu":case"mouseup":case"dragend":t0=!1,RC(d,n,c);break;case"selectionchange":if(f4)break;case"keydown":case"keyup":RC(d,n,c)}var E;if(Hb)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else Va?sO(e,n)&&(T="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(rO&&n.locale!=="ko"&&(Va||T!=="onCompositionStart"?T==="onCompositionEnd"&&Va&&(E=nO()):(yo=c,Fb="value"in yo?yo.value:yo.textContent,Va=!0)),k=$p(u,T),0<k.length&&(T=new vC(T,e,null,n,c),d.push({event:T,listeners:k}),E?T.data=E:(E=iO(n),E!==null&&(T.data=E)))),(E=e4?t4(e,n):n4(e,n))&&(u=$p(u,"onBeforeInput"),0<u.length&&(c=new vC("onBeforeInput","beforeinput",null,n,c),d.push({event:c,listeners:u}),c.data=E))}yO(d,t)})}function Ld(e,t,n){return{instance:e,listener:t,currentTarget:n}}function $p(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Md(e,n),i!=null&&r.unshift(Ld(e,i,s)),i=Md(e,t),i!=null&&r.push(Ld(e,i,s))),e=e.return}return r}function va(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function OC(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=Md(n,i),a!=null&&o.unshift(Ld(n,a,l))):s||(a=Md(n,i),a!=null&&o.push(Ld(n,a,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var g4=/\r\n?/g,y4=/\u0000|\uFFFD/g;function PC(e){return(typeof e=="string"?e:""+e).replace(g4,`
|
|
38
|
+
`).replace(y4,"")}function ah(e,t,n){if(t=PC(t),PC(e)!==t&&n)throw Error(ne(425))}function zp(){}var n0=null,r0=null;function s0(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 i0=typeof setTimeout=="function"?setTimeout:void 0,x4=typeof clearTimeout=="function"?clearTimeout:void 0,AC=typeof Promise=="function"?Promise:void 0,v4=typeof queueMicrotask=="function"?queueMicrotask:typeof AC<"u"?function(e){return AC.resolve(null).then(e).catch(w4)}:i0;function w4(e){setTimeout(function(){throw e})}function Xy(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),Ad(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Ad(t)}function To(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 _C(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 ic=Math.random().toString(36).slice(2),$s="__reactFiber$"+ic,$d="__reactProps$"+ic,Ii="__reactContainer$"+ic,o0="__reactEvents$"+ic,b4="__reactListeners$"+ic,k4="__reactHandles$"+ic;function xl(e){var t=e[$s];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ii]||n[$s]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=_C(e);e!==null;){if(n=e[$s])return n;e=_C(e)}return t}e=n,n=e.parentNode}return null}function Rf(e){return e=e[$s]||e[Ii],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function qa(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ne(33))}function Cg(e){return e[$d]||null}var l0=[],Wa=-1;function Yo(e){return{current:e}}function vt(e){0>Wa||(e.current=l0[Wa],l0[Wa]=null,Wa--)}function mt(e,t){Wa++,l0[Wa]=e.current,e.current=t}var Fo={},jn=Yo(Fo),tr=Yo(!1),Vl=Fo;function ju(e,t){var n=e.type.contextTypes;if(!n)return Fo;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 Fp(){vt(tr),vt(jn)}function IC(e,t,n){if(jn.current!==Fo)throw Error(ne(168));mt(jn,t),mt(tr,n)}function vO(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(ne(108,oF(e)||"Unknown",s));return jt({},n,r)}function Bp(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Fo,Vl=jn.current,mt(jn,e),mt(tr,tr.current),!0}function DC(e,t,n){var r=e.stateNode;if(!r)throw Error(ne(169));n?(e=vO(e,t,Vl),r.__reactInternalMemoizedMergedChildContext=e,vt(tr),vt(jn),mt(jn,e)):vt(tr),mt(tr,n)}var gi=null,Eg=!1,ex=!1;function wO(e){gi===null?gi=[e]:gi.push(e)}function S4(e){Eg=!0,wO(e)}function Xo(){if(!ex&&gi!==null){ex=!0;var e=0,t=ut;try{var n=gi;for(ut=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}gi=null,Eg=!1}catch(s){throw gi!==null&&(gi=gi.slice(e+1)),qM(Db,Xo),s}finally{ut=t,ex=!1}}return null}var Ka=[],Qa=0,Vp=null,Hp=0,Ir=[],Dr=0,Hl=null,ki=1,Si="";function fl(e,t){Ka[Qa++]=Hp,Ka[Qa++]=Vp,Vp=e,Hp=t}function bO(e,t,n){Ir[Dr++]=ki,Ir[Dr++]=Si,Ir[Dr++]=Hl,Hl=e;var r=ki;e=Si;var s=32-fs(r)-1;r&=~(1<<s),n+=1;var i=32-fs(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,ki=1<<32-fs(t)+s|n<<s|r,Si=i+e}else ki=1<<i|n<<s|r,Si=e}function qb(e){e.return!==null&&(fl(e,1),bO(e,1,0))}function Wb(e){for(;e===Vp;)Vp=Ka[--Qa],Ka[Qa]=null,Hp=Ka[--Qa],Ka[Qa]=null;for(;e===Hl;)Hl=Ir[--Dr],Ir[Dr]=null,Si=Ir[--Dr],Ir[Dr]=null,ki=Ir[--Dr],Ir[Dr]=null}var gr=null,pr=null,St=!1,ss=null;function kO(e,t){var n=Fr(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 LC(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,gr=e,pr=To(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,gr=e,pr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Hl!==null?{id:ki,overflow:Si}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Fr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,gr=e,pr=null,!0):!1;default:return!1}}function a0(e){return(e.mode&1)!==0&&(e.flags&128)===0}function u0(e){if(St){var t=pr;if(t){var n=t;if(!LC(e,t)){if(a0(e))throw Error(ne(418));t=To(n.nextSibling);var r=gr;t&&LC(e,t)?kO(r,n):(e.flags=e.flags&-4097|2,St=!1,gr=e)}}else{if(a0(e))throw Error(ne(418));e.flags=e.flags&-4097|2,St=!1,gr=e}}}function $C(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;gr=e}function uh(e){if(e!==gr)return!1;if(!St)return $C(e),St=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!s0(e.type,e.memoizedProps)),t&&(t=pr)){if(a0(e))throw SO(),Error(ne(418));for(;t;)kO(e,t),t=To(t.nextSibling)}if($C(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ne(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){pr=To(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}pr=null}}else pr=gr?To(e.stateNode.nextSibling):null;return!0}function SO(){for(var e=pr;e;)e=To(e.nextSibling)}function Mu(){pr=gr=null,St=!1}function Kb(e){ss===null?ss=[e]:ss.push(e)}var C4=zi.ReactCurrentBatchConfig;function Cc(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(ne(309));var r=n.stateNode}if(!r)throw Error(ne(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(ne(284));if(!n._owner)throw Error(ne(290,e))}return e}function ch(e,t){throw e=Object.prototype.toString.call(t),Error(ne(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function zC(e){var t=e._init;return t(e._payload)}function CO(e){function t(x,w){if(e){var b=x.deletions;b===null?(x.deletions=[w],x.flags|=16):b.push(w)}}function n(x,w){if(!e)return null;for(;w!==null;)t(x,w),w=w.sibling;return null}function r(x,w){for(x=new Map;w!==null;)w.key!==null?x.set(w.key,w):x.set(w.index,w),w=w.sibling;return x}function s(x,w){return x=Oo(x,w),x.index=0,x.sibling=null,x}function i(x,w,b){return x.index=b,e?(b=x.alternate,b!==null?(b=b.index,b<w?(x.flags|=2,w):b):(x.flags|=2,w)):(x.flags|=1048576,w)}function o(x){return e&&x.alternate===null&&(x.flags|=2),x}function l(x,w,b,C){return w===null||w.tag!==6?(w=lx(b,x.mode,C),w.return=x,w):(w=s(w,b),w.return=x,w)}function a(x,w,b,C){var S=b.type;return S===Ba?c(x,w,b.props.children,C,b.key):w!==null&&(w.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Ji&&zC(S)===w.type)?(C=s(w,b.props),C.ref=Cc(x,w,b),C.return=x,C):(C=up(b.type,b.key,b.props,null,x.mode,C),C.ref=Cc(x,w,b),C.return=x,C)}function u(x,w,b,C){return w===null||w.tag!==4||w.stateNode.containerInfo!==b.containerInfo||w.stateNode.implementation!==b.implementation?(w=ax(b,x.mode,C),w.return=x,w):(w=s(w,b.children||[]),w.return=x,w)}function c(x,w,b,C,S){return w===null||w.tag!==7?(w=Il(b,x.mode,C,S),w.return=x,w):(w=s(w,b),w.return=x,w)}function d(x,w,b){if(typeof w=="string"&&w!==""||typeof w=="number")return w=lx(""+w,x.mode,b),w.return=x,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Xf:return b=up(w.type,w.key,w.props,null,x.mode,b),b.ref=Cc(x,null,w),b.return=x,b;case Fa:return w=ax(w,x.mode,b),w.return=x,w;case Ji:var C=w._init;return d(x,C(w._payload),b)}if(Bc(w)||vc(w))return w=Il(w,x.mode,b,null),w.return=x,w;ch(x,w)}return null}function f(x,w,b,C){var S=w!==null?w.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return S!==null?null:l(x,w,""+b,C);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Xf:return b.key===S?a(x,w,b,C):null;case Fa:return b.key===S?u(x,w,b,C):null;case Ji:return S=b._init,f(x,w,S(b._payload),C)}if(Bc(b)||vc(b))return S!==null?null:c(x,w,b,C,null);ch(x,b)}return null}function h(x,w,b,C,S){if(typeof C=="string"&&C!==""||typeof C=="number")return x=x.get(b)||null,l(w,x,""+C,S);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Xf:return x=x.get(C.key===null?b:C.key)||null,a(w,x,C,S);case Fa:return x=x.get(C.key===null?b:C.key)||null,u(w,x,C,S);case Ji:var k=C._init;return h(x,w,b,k(C._payload),S)}if(Bc(C)||vc(C))return x=x.get(b)||null,c(w,x,C,S,null);ch(w,C)}return null}function m(x,w,b,C){for(var S=null,k=null,E=w,T=w=0,O=null;E!==null&&T<b.length;T++){E.index>T?(O=E,E=null):O=E.sibling;var N=f(x,E,b[T],C);if(N===null){E===null&&(E=O);break}e&&E&&N.alternate===null&&t(x,E),w=i(N,w,T),k===null?S=N:k.sibling=N,k=N,E=O}if(T===b.length)return n(x,E),St&&fl(x,T),S;if(E===null){for(;T<b.length;T++)E=d(x,b[T],C),E!==null&&(w=i(E,w,T),k===null?S=E:k.sibling=E,k=E);return St&&fl(x,T),S}for(E=r(x,E);T<b.length;T++)O=h(E,x,T,b[T],C),O!==null&&(e&&O.alternate!==null&&E.delete(O.key===null?T:O.key),w=i(O,w,T),k===null?S=O:k.sibling=O,k=O);return e&&E.forEach(function(j){return t(x,j)}),St&&fl(x,T),S}function g(x,w,b,C){var S=vc(b);if(typeof S!="function")throw Error(ne(150));if(b=S.call(b),b==null)throw Error(ne(151));for(var k=S=null,E=w,T=w=0,O=null,N=b.next();E!==null&&!N.done;T++,N=b.next()){E.index>T?(O=E,E=null):O=E.sibling;var j=f(x,E,N.value,C);if(j===null){E===null&&(E=O);break}e&&E&&j.alternate===null&&t(x,E),w=i(j,w,T),k===null?S=j:k.sibling=j,k=j,E=O}if(N.done)return n(x,E),St&&fl(x,T),S;if(E===null){for(;!N.done;T++,N=b.next())N=d(x,N.value,C),N!==null&&(w=i(N,w,T),k===null?S=N:k.sibling=N,k=N);return St&&fl(x,T),S}for(E=r(x,E);!N.done;T++,N=b.next())N=h(E,x,T,N.value,C),N!==null&&(e&&N.alternate!==null&&E.delete(N.key===null?T:N.key),w=i(N,w,T),k===null?S=N:k.sibling=N,k=N);return e&&E.forEach(function(P){return t(x,P)}),St&&fl(x,T),S}function v(x,w,b,C){if(typeof b=="object"&&b!==null&&b.type===Ba&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Xf:e:{for(var S=b.key,k=w;k!==null;){if(k.key===S){if(S=b.type,S===Ba){if(k.tag===7){n(x,k.sibling),w=s(k,b.props.children),w.return=x,x=w;break e}}else if(k.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Ji&&zC(S)===k.type){n(x,k.sibling),w=s(k,b.props),w.ref=Cc(x,k,b),w.return=x,x=w;break e}n(x,k);break}else t(x,k);k=k.sibling}b.type===Ba?(w=Il(b.props.children,x.mode,C,b.key),w.return=x,x=w):(C=up(b.type,b.key,b.props,null,x.mode,C),C.ref=Cc(x,w,b),C.return=x,x=C)}return o(x);case Fa: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(x,w.sibling),w=s(w,b.children||[]),w.return=x,x=w;break e}else{n(x,w);break}else t(x,w);w=w.sibling}w=ax(b,x.mode,C),w.return=x,x=w}return o(x);case Ji:return k=b._init,v(x,w,k(b._payload),C)}if(Bc(b))return m(x,w,b,C);if(vc(b))return g(x,w,b,C);ch(x,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,w!==null&&w.tag===6?(n(x,w.sibling),w=s(w,b),w.return=x,x=w):(n(x,w),w=lx(b,x.mode,C),w.return=x,x=w),o(x)):n(x,w)}return v}var Ou=CO(!0),EO=CO(!1),Up=Yo(null),qp=null,Ga=null,Qb=null;function Gb(){Qb=Ga=qp=null}function Jb(e){var t=Up.current;vt(Up),e._currentValue=t}function c0(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 iu(e,t){qp=e,Qb=Ga=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(er=!0),e.firstContext=null)}function qr(e){var t=e._currentValue;if(Qb!==e)if(e={context:e,memoizedValue:t,next:null},Ga===null){if(qp===null)throw Error(ne(308));Ga=e,qp.dependencies={lanes:0,firstContext:e}}else Ga=Ga.next=e;return t}var vl=null;function Zb(e){vl===null?vl=[e]:vl.push(e)}function NO(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Zb(t)):(n.next=s.next,s.next=n),t.interleaved=n,Di(e,r)}function Di(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 Zi=!1;function Yb(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function TO(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 Ri(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ro(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ye&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Di(e,n)}return s=r.interleaved,s===null?(t.next=t,Zb(r)):(t.next=s.next,s.next=t),r.interleaved=t,Di(e,n)}function rp(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,Lb(e,n)}}function FC(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 Wp(e,t,n,r){var s=e.updateQueue;Zi=!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 f=l.lane,h=l.eventTime;if((r&f)===f){c!==null&&(c=c.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,g=l;switch(f=t,h=n,g.tag){case 1:if(m=g.payload,typeof m=="function"){d=m.call(h,d,f);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m=="function"?m.call(h,d,f):m,f==null)break e;d=jt({},d,f);break e;case 2:Zi=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else h={eventTime:h,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(u=c=h,a=d):c=c.next=h,o|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,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);ql|=o,e.lanes=o,e.memoizedState=d}}function BC(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(ne(191,s));s.call(r)}}}var jf={},Hs=Yo(jf),zd=Yo(jf),Fd=Yo(jf);function wl(e){if(e===jf)throw Error(ne(174));return e}function Xb(e,t){switch(mt(Fd,t),mt(zd,e),mt(Hs,jf),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Uv(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Uv(t,e)}vt(Hs),mt(Hs,t)}function Pu(){vt(Hs),vt(zd),vt(Fd)}function RO(e){wl(Fd.current);var t=wl(Hs.current),n=Uv(t,e.type);t!==n&&(mt(zd,e),mt(Hs,n))}function ek(e){zd.current===e&&(vt(Hs),vt(zd))}var Nt=Yo(0);function Kp(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 tx=[];function tk(){for(var e=0;e<tx.length;e++)tx[e]._workInProgressVersionPrimary=null;tx.length=0}var sp=zi.ReactCurrentDispatcher,nx=zi.ReactCurrentBatchConfig,Ul=0,Rt=null,Wt=null,en=null,Qp=!1,id=!1,Bd=0,E4=0;function wn(){throw Error(ne(321))}function nk(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ys(e[n],t[n]))return!1;return!0}function rk(e,t,n,r,s,i){if(Ul=i,Rt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,sp.current=e===null||e.memoizedState===null?j4:M4,e=n(r,s),id){i=0;do{if(id=!1,Bd=0,25<=i)throw Error(ne(301));i+=1,en=Wt=null,t.updateQueue=null,sp.current=O4,e=n(r,s)}while(id)}if(sp.current=Gp,t=Wt!==null&&Wt.next!==null,Ul=0,en=Wt=Rt=null,Qp=!1,t)throw Error(ne(300));return e}function sk(){var e=Bd!==0;return Bd=0,e}function js(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return en===null?Rt.memoizedState=en=e:en=en.next=e,en}function Wr(){if(Wt===null){var e=Rt.alternate;e=e!==null?e.memoizedState:null}else e=Wt.next;var t=en===null?Rt.memoizedState:en.next;if(t!==null)en=t,Wt=e;else{if(e===null)throw Error(ne(310));Wt=e,e={memoizedState:Wt.memoizedState,baseState:Wt.baseState,baseQueue:Wt.baseQueue,queue:Wt.queue,next:null},en===null?Rt.memoizedState=en=e:en=en.next=e}return en}function Vd(e,t){return typeof t=="function"?t(e):t}function rx(e){var t=Wr(),n=t.queue;if(n===null)throw Error(ne(311));n.lastRenderedReducer=e;var r=Wt,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((Ul&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,Rt.lanes|=c,ql|=c}u=u.next}while(u!==null&&u!==i);a===null?o=r:a.next=l,ys(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,Rt.lanes|=i,ql|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function sx(e){var t=Wr(),n=t.queue;if(n===null)throw Error(ne(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);ys(i,t.memoizedState)||(er=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function jO(){}function MO(e,t){var n=Rt,r=Wr(),s=t(),i=!ys(r.memoizedState,s);if(i&&(r.memoizedState=s,er=!0),r=r.queue,ik(AO.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||en!==null&&en.memoizedState.tag&1){if(n.flags|=2048,Hd(9,PO.bind(null,n,r,s,t),void 0,null),sn===null)throw Error(ne(349));Ul&30||OO(n,t,s)}return s}function OO(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Rt.updateQueue,t===null?(t={lastEffect:null,stores:null},Rt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function PO(e,t,n,r){t.value=n,t.getSnapshot=r,_O(t)&&IO(e)}function AO(e,t,n){return n(function(){_O(t)&&IO(e)})}function _O(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ys(e,n)}catch{return!0}}function IO(e){var t=Di(e,1);t!==null&&hs(t,e,1,-1)}function VC(e){var t=js();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Vd,lastRenderedState:e},t.queue=e,e=e.dispatch=R4.bind(null,Rt,e),[t.memoizedState,e]}function Hd(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Rt.updateQueue,t===null?(t={lastEffect:null,stores:null},Rt.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 DO(){return Wr().memoizedState}function ip(e,t,n,r){var s=js();Rt.flags|=e,s.memoizedState=Hd(1|t,n,void 0,r===void 0?null:r)}function Ng(e,t,n,r){var s=Wr();r=r===void 0?null:r;var i=void 0;if(Wt!==null){var o=Wt.memoizedState;if(i=o.destroy,r!==null&&nk(r,o.deps)){s.memoizedState=Hd(t,n,i,r);return}}Rt.flags|=e,s.memoizedState=Hd(1|t,n,i,r)}function HC(e,t){return ip(8390656,8,e,t)}function ik(e,t){return Ng(2048,8,e,t)}function LO(e,t){return Ng(4,2,e,t)}function $O(e,t){return Ng(4,4,e,t)}function zO(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 FO(e,t,n){return n=n!=null?n.concat([e]):null,Ng(4,4,zO.bind(null,t,e),n)}function ok(){}function BO(e,t){var n=Wr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&nk(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function VO(e,t){var n=Wr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&nk(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function HO(e,t,n){return Ul&21?(ys(n,t)||(n=QM(),Rt.lanes|=n,ql|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,er=!0),e.memoizedState=n)}function N4(e,t){var n=ut;ut=n!==0&&4>n?n:4,e(!0);var r=nx.transition;nx.transition={};try{e(!1),t()}finally{ut=n,nx.transition=r}}function UO(){return Wr().memoizedState}function T4(e,t,n){var r=Mo(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},qO(e))WO(t,n);else if(n=NO(e,t,n,r),n!==null){var s=Fn();hs(n,e,r,s),KO(n,t,r)}}function R4(e,t,n){var r=Mo(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(qO(e))WO(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,ys(l,o)){var a=t.interleaved;a===null?(s.next=s,Zb(t)):(s.next=a.next,a.next=s),t.interleaved=s;return}}catch{}finally{}n=NO(e,t,s,r),n!==null&&(s=Fn(),hs(n,e,r,s),KO(n,t,r))}}function qO(e){var t=e.alternate;return e===Rt||t!==null&&t===Rt}function WO(e,t){id=Qp=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function KO(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Lb(e,n)}}var Gp={readContext:qr,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},j4={readContext:qr,useCallback:function(e,t){return js().memoizedState=[e,t===void 0?null:t],e},useContext:qr,useEffect:HC,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ip(4194308,4,zO.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ip(4194308,4,e,t)},useInsertionEffect:function(e,t){return ip(4,2,e,t)},useMemo:function(e,t){var n=js();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=js();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=T4.bind(null,Rt,e),[r.memoizedState,e]},useRef:function(e){var t=js();return e={current:e},t.memoizedState=e},useState:VC,useDebugValue:ok,useDeferredValue:function(e){return js().memoizedState=e},useTransition:function(){var e=VC(!1),t=e[0];return e=N4.bind(null,e[1]),js().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Rt,s=js();if(St){if(n===void 0)throw Error(ne(407));n=n()}else{if(n=t(),sn===null)throw Error(ne(349));Ul&30||OO(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,HC(AO.bind(null,r,i,e),[e]),r.flags|=2048,Hd(9,PO.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=js(),t=sn.identifierPrefix;if(St){var n=Si,r=ki;n=(r&~(1<<32-fs(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Bd++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=E4++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},M4={readContext:qr,useCallback:BO,useContext:qr,useEffect:ik,useImperativeHandle:FO,useInsertionEffect:LO,useLayoutEffect:$O,useMemo:VO,useReducer:rx,useRef:DO,useState:function(){return rx(Vd)},useDebugValue:ok,useDeferredValue:function(e){var t=Wr();return HO(t,Wt.memoizedState,e)},useTransition:function(){var e=rx(Vd)[0],t=Wr().memoizedState;return[e,t]},useMutableSource:jO,useSyncExternalStore:MO,useId:UO,unstable_isNewReconciler:!1},O4={readContext:qr,useCallback:BO,useContext:qr,useEffect:ik,useImperativeHandle:FO,useInsertionEffect:LO,useLayoutEffect:$O,useMemo:VO,useReducer:sx,useRef:DO,useState:function(){return sx(Vd)},useDebugValue:ok,useDeferredValue:function(e){var t=Wr();return Wt===null?t.memoizedState=e:HO(t,Wt.memoizedState,e)},useTransition:function(){var e=sx(Vd)[0],t=Wr().memoizedState;return[e,t]},useMutableSource:jO,useSyncExternalStore:MO,useId:UO,unstable_isNewReconciler:!1};function es(e,t){if(e&&e.defaultProps){t=jt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function d0(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:jt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Tg={isMounted:function(e){return(e=e._reactInternals)?oa(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Fn(),s=Mo(e),i=Ri(r,s);i.payload=t,n!=null&&(i.callback=n),t=Ro(e,i,s),t!==null&&(hs(t,e,s,r),rp(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Fn(),s=Mo(e),i=Ri(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ro(e,i,s),t!==null&&(hs(t,e,s,r),rp(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Fn(),r=Mo(e),s=Ri(n,r);s.tag=2,t!=null&&(s.callback=t),t=Ro(e,s,r),t!==null&&(hs(t,e,r,n),rp(t,e,r))}};function UC(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?!Id(n,r)||!Id(s,i):!0}function QO(e,t,n){var r=!1,s=Fo,i=t.contextType;return typeof i=="object"&&i!==null?i=qr(i):(s=nr(t)?Vl:jn.current,r=t.contextTypes,i=(r=r!=null)?ju(e,s):Fo),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Tg,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function qC(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&&Tg.enqueueReplaceState(t,t.state,null)}function f0(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},Yb(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=qr(i):(i=nr(t)?Vl:jn.current,s.context=ju(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(d0(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&&Tg.enqueueReplaceState(s,s.state,null),Wp(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Au(e,t){try{var n="",r=t;do n+=iF(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 ix(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function h0(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var P4=typeof WeakMap=="function"?WeakMap:Map;function GO(e,t,n){n=Ri(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Zp||(Zp=!0,S0=r),h0(e,t)},n}function JO(e,t,n){n=Ri(-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(){h0(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){h0(e,t),typeof r!="function"&&(jo===null?jo=new Set([this]):jo.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function WC(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new P4;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=W4.bind(null,e,t,n),t.then(e,e))}function KC(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=Ri(-1,1),t.tag=2,Ro(n,t,1))),n.lanes|=1),e)}var A4=zi.ReactCurrentOwner,er=!1;function Dn(e,t,n,r){t.child=e===null?EO(t,null,n,r):Ou(t,e.child,n,r)}function GC(e,t,n,r,s){n=n.render;var i=t.ref;return iu(t,s),r=rk(e,t,n,r,i,s),n=sk(),e!==null&&!er?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Li(e,t,s)):(St&&n&&qb(t),t.flags|=1,Dn(e,t,r,s),t.child)}function JC(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!pk(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,ZO(e,t,i,r,s)):(e=up(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:Id,n(o,r)&&e.ref===t.ref)return Li(e,t,s)}return t.flags|=1,e=Oo(i,r),e.ref=t.ref,e.return=t,t.child=e}function ZO(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(Id(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,Li(e,t,s)}return p0(e,t,n,r,s)}function YO(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},mt(Za,dr),dr|=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,mt(Za,dr),dr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,mt(Za,dr),dr|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,mt(Za,dr),dr|=r;return Dn(e,t,s,n),t.child}function XO(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function p0(e,t,n,r,s){var i=nr(n)?Vl:jn.current;return i=ju(t,i),iu(t,s),n=rk(e,t,n,r,i,s),r=sk(),e!==null&&!er?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Li(e,t,s)):(St&&r&&qb(t),t.flags|=1,Dn(e,t,n,s),t.child)}function ZC(e,t,n,r,s){if(nr(n)){var i=!0;Bp(t)}else i=!1;if(iu(t,s),t.stateNode===null)op(e,t),QO(t,n,r),f0(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=qr(u):(u=nr(n)?Vl:jn.current,u=ju(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)&&qC(t,o,r,u),Zi=!1;var f=t.memoizedState;o.state=f,Wp(t,r,o,s),a=t.memoizedState,l!==r||f!==a||tr.current||Zi?(typeof c=="function"&&(d0(t,n,c,r),a=t.memoizedState),(l=Zi||UC(t,n,l,r,f,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,TO(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:es(t.type,l),o.props=u,d=t.pendingProps,f=o.context,a=n.contextType,typeof a=="object"&&a!==null?a=qr(a):(a=nr(n)?Vl:jn.current,a=ju(t,a));var h=n.getDerivedStateFromProps;(c=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==d||f!==a)&&qC(t,o,r,a),Zi=!1,f=t.memoizedState,o.state=f,Wp(t,r,o,s);var m=t.memoizedState;l!==d||f!==m||tr.current||Zi?(typeof h=="function"&&(d0(t,n,h,r),m=t.memoizedState),(u=Zi||UC(t,n,u,r,f,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&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===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&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return m0(e,t,n,r,i,s)}function m0(e,t,n,r,s,i){XO(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&DC(t,n,!1),Li(e,t,i);r=t.stateNode,A4.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ou(t,e.child,null,i),t.child=Ou(t,null,l,i)):Dn(e,t,l,i),t.memoizedState=r.state,s&&DC(t,n,!0),t.child}function eP(e){var t=e.stateNode;t.pendingContext?IC(e,t.pendingContext,t.pendingContext!==t.context):t.context&&IC(e,t.context,!1),Xb(e,t.containerInfo)}function YC(e,t,n,r,s){return Mu(),Kb(s),t.flags|=256,Dn(e,t,n,r),t.child}var g0={dehydrated:null,treeContext:null,retryLane:0};function y0(e){return{baseLanes:e,cachePool:null,transitions:null}}function tP(e,t,n){var r=t.pendingProps,s=Nt.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),mt(Nt,s&1),e===null)return u0(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=Il(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=y0(n),t.memoizedState=g0,e):lk(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return _4(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=Oo(s,a),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=Oo(l,i):(i=Il(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?y0(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=g0,r}return i=e.child,e=i.sibling,r=Oo(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 lk(e,t){return t=Mg({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function dh(e,t,n,r){return r!==null&&Kb(r),Ou(t,e.child,null,n),e=lk(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function _4(e,t,n,r,s,i,o){if(n)return t.flags&256?(t.flags&=-257,r=ix(Error(ne(422))),dh(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=Il(i,s,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Ou(t,e.child,null,o),t.child.memoizedState=y0(o),t.memoizedState=g0,i);if(!(t.mode&1))return dh(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(ne(419)),r=ix(i,r,void 0),dh(e,t,o,r)}if(l=(o&e.childLanes)!==0,er||l){if(r=sn,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,Di(e,s),hs(r,e,s,-1))}return hk(),r=ix(Error(ne(421))),dh(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=K4.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,pr=To(s.nextSibling),gr=t,St=!0,ss=null,e!==null&&(Ir[Dr++]=ki,Ir[Dr++]=Si,Ir[Dr++]=Hl,ki=e.id,Si=e.overflow,Hl=t),t=lk(t,r.children),t.flags|=4096,t)}function XC(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),c0(e.return,t,n)}function ox(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 nP(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(Dn(e,t,r.children,n),r=Nt.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&&XC(e,n,t);else if(e.tag===19)XC(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(mt(Nt,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&&Kp(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),ox(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&&Kp(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}ox(t,!0,n,null,i);break;case"together":ox(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function op(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Li(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ql|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ne(153));if(t.child!==null){for(e=t.child,n=Oo(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Oo(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function I4(e,t,n){switch(t.tag){case 3:eP(t),Mu();break;case 5:RO(t);break;case 1:nr(t.type)&&Bp(t);break;case 4:Xb(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;mt(Up,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(mt(Nt,Nt.current&1),t.flags|=128,null):n&t.child.childLanes?tP(e,t,n):(mt(Nt,Nt.current&1),e=Li(e,t,n),e!==null?e.sibling:null);mt(Nt,Nt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return nP(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),mt(Nt,Nt.current),r)break;return null;case 22:case 23:return t.lanes=0,YO(e,t,n)}return Li(e,t,n)}var rP,x0,sP,iP;rP=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}};x0=function(){};sP=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,wl(Hs.current);var i=null;switch(n){case"input":s=Fv(e,s),r=Fv(e,r),i=[];break;case"select":s=jt({},s,{value:void 0}),r=jt({},r,{value:void 0}),i=[];break;case"textarea":s=Hv(e,s),r=Hv(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=zp)}qv(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"&&(Rd.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"&&(Rd.hasOwnProperty(u)?(a!=null&&u==="onScroll"&&yt("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)}};iP=function(e,t,n,r){n!==r&&(t.flags|=4)};function Ec(e,t){if(!St)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 D4(e,t,n){var r=t.pendingProps;switch(Wb(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)&&Fp(),bn(t),null;case 3:return r=t.stateNode,Pu(),vt(tr),vt(jn),tk(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(uh(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ss!==null&&(N0(ss),ss=null))),x0(e,t),bn(t),null;case 5:ek(t);var s=wl(Fd.current);if(n=t.type,e!==null&&t.stateNode!=null)sP(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(ne(166));return bn(t),null}if(e=wl(Hs.current),uh(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[$s]=t,r[$d]=i,e=(t.mode&1)!==0,n){case"dialog":yt("cancel",r),yt("close",r);break;case"iframe":case"object":case"embed":yt("load",r);break;case"video":case"audio":for(s=0;s<Hc.length;s++)yt(Hc[s],r);break;case"source":yt("error",r);break;case"img":case"image":case"link":yt("error",r),yt("load",r);break;case"details":yt("toggle",r);break;case"input":aC(r,i),yt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},yt("invalid",r);break;case"textarea":cC(r,i),yt("invalid",r)}qv(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&&ah(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&ah(r.textContent,l,e),s=["children",""+l]):Rd.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&yt("scroll",r)}switch(n){case"input":eh(r),uC(r,i,!0);break;case"textarea":eh(r),dC(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=zp)}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=AM(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[$s]=t,e[$d]=r,rP(e,t,!1,!1),t.stateNode=e;e:{switch(o=Wv(n,r),n){case"dialog":yt("cancel",e),yt("close",e),s=r;break;case"iframe":case"object":case"embed":yt("load",e),s=r;break;case"video":case"audio":for(s=0;s<Hc.length;s++)yt(Hc[s],e);s=r;break;case"source":yt("error",e),s=r;break;case"img":case"image":case"link":yt("error",e),yt("load",e),s=r;break;case"details":yt("toggle",e),s=r;break;case"input":aC(e,r),s=Fv(e,r),yt("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=jt({},r,{value:void 0}),yt("invalid",e);break;case"textarea":cC(e,r),s=Hv(e,r),yt("invalid",e);break;default:s=r}qv(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var a=l[i];i==="style"?DM(e,a):i==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&_M(e,a)):i==="children"?typeof a=="string"?(n!=="textarea"||a!=="")&&jd(e,a):typeof a=="number"&&jd(e,""+a):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Rd.hasOwnProperty(i)?a!=null&&i==="onScroll"&&yt("scroll",e):a!=null&&Ob(e,i,a,o))}switch(n){case"input":eh(e),uC(e,r,!1);break;case"textarea":eh(e),dC(e);break;case"option":r.value!=null&&e.setAttribute("value",""+zo(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?tu(e,!!r.multiple,i,!1):r.defaultValue!=null&&tu(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=zp)}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)iP(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ne(166));if(n=wl(Fd.current),wl(Hs.current),uh(t)){if(r=t.stateNode,n=t.memoizedProps,r[$s]=t,(i=r.nodeValue!==n)&&(e=gr,e!==null))switch(e.tag){case 3:ah(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ah(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[$s]=t,t.stateNode=r}return bn(t),null;case 13:if(vt(Nt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(St&&pr!==null&&t.mode&1&&!(t.flags&128))SO(),Mu(),t.flags|=98560,i=!1;else if(i=uh(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(ne(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ne(317));i[$s]=t}else Mu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;bn(t),i=!1}else ss!==null&&(N0(ss),ss=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||Nt.current&1?Gt===0&&(Gt=3):hk())),t.updateQueue!==null&&(t.flags|=4),bn(t),null);case 4:return Pu(),x0(e,t),e===null&&Dd(t.stateNode.containerInfo),bn(t),null;case 10:return Jb(t.type._context),bn(t),null;case 17:return nr(t.type)&&Fp(),bn(t),null;case 19:if(vt(Nt),i=t.memoizedState,i===null)return bn(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)Ec(i,!1);else{if(Gt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Kp(e),o!==null){for(t.flags|=128,Ec(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 mt(Nt,Nt.current&1|2),t.child}e=e.sibling}i.tail!==null&&Dt()>_u&&(t.flags|=128,r=!0,Ec(i,!1),t.lanes=4194304)}else{if(!r)if(e=Kp(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ec(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!St)return bn(t),null}else 2*Dt()-i.renderingStartTime>_u&&n!==1073741824&&(t.flags|=128,r=!0,Ec(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=Dt(),t.sibling=null,n=Nt.current,mt(Nt,r?n&1|2:n&1),t):(bn(t),null);case 22:case 23:return fk(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?dr&1073741824&&(bn(t),t.subtreeFlags&6&&(t.flags|=8192)):bn(t),null;case 24:return null;case 25:return null}throw Error(ne(156,t.tag))}function L4(e,t){switch(Wb(t),t.tag){case 1:return nr(t.type)&&Fp(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Pu(),vt(tr),vt(jn),tk(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ek(t),null;case 13:if(vt(Nt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ne(340));Mu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return vt(Nt),null;case 4:return Pu(),null;case 10:return Jb(t.type._context),null;case 22:case 23:return fk(),null;case 24:return null;default:return null}}var fh=!1,Tn=!1,$4=typeof WeakSet=="function"?WeakSet:Set,pe=null;function Ja(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Pt(e,t,r)}else n.current=null}function v0(e,t,n){try{n()}catch(r){Pt(e,t,r)}}var eE=!1;function z4(e,t){if(n0=Dp,e=cO(),Ub(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,f=null;t:for(;;){for(var h;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),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++u===s&&(l=o),f===i&&++c===r&&(a=o),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(r0={focusedElem:e,selectionRange:n},Dp=!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,x=t.stateNode,w=x.getSnapshotBeforeUpdate(t.elementType===t.type?g:es(t.type,g),v);x.__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(ne(163))}}catch(C){Pt(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,pe=e;break}pe=t.return}return m=eE,eE=!1,m}function od(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&&v0(t,n,i)}s=s.next}while(s!==r)}}function Rg(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 w0(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 oP(e){var t=e.alternate;t!==null&&(e.alternate=null,oP(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[$s],delete t[$d],delete t[o0],delete t[b4],delete t[k4])),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 lP(e){return e.tag===5||e.tag===3||e.tag===4}function tE(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||lP(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 b0(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=zp));else if(r!==4&&(e=e.child,e!==null))for(b0(e,t,n),e=e.sibling;e!==null;)b0(e,t,n),e=e.sibling}function k0(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(k0(e,t,n),e=e.sibling;e!==null;)k0(e,t,n),e=e.sibling}var un=null,rs=!1;function Vi(e,t,n){for(n=n.child;n!==null;)aP(e,t,n),n=n.sibling}function aP(e,t,n){if(Vs&&typeof Vs.onCommitFiberUnmount=="function")try{Vs.onCommitFiberUnmount(wg,n)}catch{}switch(n.tag){case 5:Tn||Ja(n,t);case 6:var r=un,s=rs;un=null,Vi(e,t,n),un=r,rs=s,un!==null&&(rs?(e=un,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):un.removeChild(n.stateNode));break;case 18:un!==null&&(rs?(e=un,n=n.stateNode,e.nodeType===8?Xy(e.parentNode,n):e.nodeType===1&&Xy(e,n),Ad(e)):Xy(un,n.stateNode));break;case 4:r=un,s=rs,un=n.stateNode.containerInfo,rs=!0,Vi(e,t,n),un=r,rs=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)&&v0(n,t,o),s=s.next}while(s!==r)}Vi(e,t,n);break;case 1:if(!Tn&&(Ja(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Pt(n,t,l)}Vi(e,t,n);break;case 21:Vi(e,t,n);break;case 22:n.mode&1?(Tn=(r=Tn)||n.memoizedState!==null,Vi(e,t,n),Tn=r):Vi(e,t,n);break;default:Vi(e,t,n)}}function nE(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new $4),t.forEach(function(r){var s=Q4.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Jr(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:un=l.stateNode,rs=!1;break e;case 3:un=l.stateNode.containerInfo,rs=!0;break e;case 4:un=l.stateNode.containerInfo,rs=!0;break e}l=l.return}if(un===null)throw Error(ne(160));aP(i,o,s),un=null,rs=!1;var a=s.alternate;a!==null&&(a.return=null),s.return=null}catch(u){Pt(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)uP(t,e),t=t.sibling}function uP(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Jr(t,e),Ts(e),r&4){try{od(3,e,e.return),Rg(3,e)}catch(g){Pt(e,e.return,g)}try{od(5,e,e.return)}catch(g){Pt(e,e.return,g)}}break;case 1:Jr(t,e),Ts(e),r&512&&n!==null&&Ja(n,n.return);break;case 5:if(Jr(t,e),Ts(e),r&512&&n!==null&&Ja(n,n.return),e.flags&32){var s=e.stateNode;try{jd(s,"")}catch(g){Pt(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&&OM(s,i),Wv(l,o);var u=Wv(l,i);for(o=0;o<a.length;o+=2){var c=a[o],d=a[o+1];c==="style"?DM(s,d):c==="dangerouslySetInnerHTML"?_M(s,d):c==="children"?jd(s,d):Ob(s,c,d,u)}switch(l){case"input":Bv(s,i);break;case"textarea":PM(s,i);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?tu(s,!!i.multiple,h,!1):f!==!!i.multiple&&(i.defaultValue!=null?tu(s,!!i.multiple,i.defaultValue,!0):tu(s,!!i.multiple,i.multiple?[]:"",!1))}s[$d]=i}catch(g){Pt(e,e.return,g)}}break;case 6:if(Jr(t,e),Ts(e),r&4){if(e.stateNode===null)throw Error(ne(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(g){Pt(e,e.return,g)}}break;case 3:if(Jr(t,e),Ts(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Ad(t.containerInfo)}catch(g){Pt(e,e.return,g)}break;case 4:Jr(t,e),Ts(e);break;case 13:Jr(t,e),Ts(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(ck=Dt())),r&4&&nE(e);break;case 22:if(c=n!==null&&n.memoizedState!==null,e.mode&1?(Tn=(u=Tn)||c,Jr(t,e),Tn=u):Jr(t,e),Ts(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(f=pe,h=f.child,f.tag){case 0:case 11:case 14:case 15:od(4,f,f.return);break;case 1:Ja(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(g){Pt(r,n,g)}}break;case 5:Ja(f,f.return);break;case 22:if(f.memoizedState!==null){sE(d);continue}}h!==null?(h.return=f,pe=h):sE(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=IM("display",o))}catch(g){Pt(e,e.return,g)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(g){Pt(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:Jr(t,e),Ts(e),r&4&&nE(e);break;case 21:break;default:Jr(t,e),Ts(e)}}function Ts(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(lP(n)){var r=n;break e}n=n.return}throw Error(ne(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(jd(s,""),r.flags&=-33);var i=tE(e);k0(e,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=tE(e);b0(e,l,o);break;default:throw Error(ne(161))}}catch(a){Pt(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function F4(e,t,n){pe=e,cP(e)}function cP(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||fh;if(!o){var l=s.alternate,a=l!==null&&l.memoizedState!==null||Tn;l=fh;var u=Tn;if(fh=o,(Tn=a)&&!u)for(pe=s;pe!==null;)o=pe,a=o.child,o.tag===22&&o.memoizedState!==null?iE(s):a!==null?(a.return=o,pe=a):iE(s);for(;i!==null;)pe=i,cP(i),i=i.sibling;pe=s,fh=l,Tn=u}rE(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,pe=i):rE(e)}}function rE(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||Rg(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:es(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&BC(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}BC(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&&Ad(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ne(163))}Tn||t.flags&512&&w0(t)}catch(f){Pt(t,t.return,f)}}if(t===e){pe=null;break}if(n=t.sibling,n!==null){n.return=t.return,pe=n;break}pe=t.return}}function sE(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 iE(e){for(;pe!==null;){var t=pe;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Rg(4,t)}catch(a){Pt(t,n,a)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(a){Pt(t,s,a)}}var i=t.return;try{w0(t)}catch(a){Pt(t,i,a)}break;case 5:var o=t.return;try{w0(t)}catch(a){Pt(t,o,a)}}}catch(a){Pt(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 B4=Math.ceil,Jp=zi.ReactCurrentDispatcher,ak=zi.ReactCurrentOwner,Br=zi.ReactCurrentBatchConfig,Ye=0,sn=null,Bt=null,hn=0,dr=0,Za=Yo(0),Gt=0,Ud=null,ql=0,jg=0,uk=0,ld=null,Yn=null,ck=0,_u=1/0,fi=null,Zp=!1,S0=null,jo=null,hh=!1,xo=null,Yp=0,ad=0,C0=null,lp=-1,ap=0;function Fn(){return Ye&6?Dt():lp!==-1?lp:lp=Dt()}function Mo(e){return e.mode&1?Ye&2&&hn!==0?hn&-hn:C4.transition!==null?(ap===0&&(ap=QM()),ap):(e=ut,e!==0||(e=window.event,e=e===void 0?16:tO(e.type)),e):1}function hs(e,t,n,r){if(50<ad)throw ad=0,C0=null,Error(ne(185));Nf(e,n,r),(!(Ye&2)||e!==sn)&&(e===sn&&(!(Ye&2)&&(jg|=n),Gt===4&&ro(e,hn)),rr(e,r),n===1&&Ye===0&&!(t.mode&1)&&(_u=Dt()+500,Eg&&Xo()))}function rr(e,t){var n=e.callbackNode;CF(e,t);var r=Ip(e,e===sn?hn:0);if(r===0)n!==null&&pC(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&pC(n),t===1)e.tag===0?S4(oE.bind(null,e)):wO(oE.bind(null,e)),v4(function(){!(Ye&6)&&Xo()}),n=null;else{switch(GM(r)){case 1:n=Db;break;case 4:n=WM;break;case 16:n=_p;break;case 536870912:n=KM;break;default:n=_p}n=xP(n,dP.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function dP(e,t){if(lp=-1,ap=0,Ye&6)throw Error(ne(327));var n=e.callbackNode;if(ou()&&e.callbackNode!==n)return null;var r=Ip(e,e===sn?hn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Xp(e,r);else{t=r;var s=Ye;Ye|=2;var i=hP();(sn!==e||hn!==t)&&(fi=null,_u=Dt()+500,_l(e,t));do try{U4();break}catch(l){fP(e,l)}while(!0);Gb(),Jp.current=i,Ye=s,Bt!==null?t=0:(sn=null,hn=0,t=Gt)}if(t!==0){if(t===2&&(s=Zv(e),s!==0&&(r=s,t=E0(e,s))),t===1)throw n=Ud,_l(e,0),ro(e,r),rr(e,Dt()),n;if(t===6)ro(e,r);else{if(s=e.current.alternate,!(r&30)&&!V4(s)&&(t=Xp(e,r),t===2&&(i=Zv(e),i!==0&&(r=i,t=E0(e,i))),t===1))throw n=Ud,_l(e,0),ro(e,r),rr(e,Dt()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(ne(345));case 2:hl(e,Yn,fi);break;case 3:if(ro(e,r),(r&130023424)===r&&(t=ck+500-Dt(),10<t)){if(Ip(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Fn(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=i0(hl.bind(null,e,Yn,fi),t);break}hl(e,Yn,fi);break;case 4:if(ro(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-fs(r);i=1<<o,o=t[o],o>s&&(s=o),r&=~i}if(r=s,r=Dt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*B4(r/1960))-r,10<r){e.timeoutHandle=i0(hl.bind(null,e,Yn,fi),r);break}hl(e,Yn,fi);break;case 5:hl(e,Yn,fi);break;default:throw Error(ne(329))}}}return rr(e,Dt()),e.callbackNode===n?dP.bind(null,e):null}function E0(e,t){var n=ld;return e.current.memoizedState.isDehydrated&&(_l(e,t).flags|=256),e=Xp(e,t),e!==2&&(t=Yn,Yn=n,t!==null&&N0(t)),e}function N0(e){Yn===null?Yn=e:Yn.push.apply(Yn,e)}function V4(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(!ys(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 ro(e,t){for(t&=~uk,t&=~jg,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-fs(t),r=1<<n;e[n]=-1,t&=~r}}function oE(e){if(Ye&6)throw Error(ne(327));ou();var t=Ip(e,0);if(!(t&1))return rr(e,Dt()),null;var n=Xp(e,t);if(e.tag!==0&&n===2){var r=Zv(e);r!==0&&(t=r,n=E0(e,r))}if(n===1)throw n=Ud,_l(e,0),ro(e,t),rr(e,Dt()),n;if(n===6)throw Error(ne(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,hl(e,Yn,fi),rr(e,Dt()),null}function dk(e,t){var n=Ye;Ye|=1;try{return e(t)}finally{Ye=n,Ye===0&&(_u=Dt()+500,Eg&&Xo())}}function Wl(e){xo!==null&&xo.tag===0&&!(Ye&6)&&ou();var t=Ye;Ye|=1;var n=Br.transition,r=ut;try{if(Br.transition=null,ut=1,e)return e()}finally{ut=r,Br.transition=n,Ye=t,!(Ye&6)&&Xo()}}function fk(){dr=Za.current,vt(Za)}function _l(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,x4(n)),Bt!==null)for(n=Bt.return;n!==null;){var r=n;switch(Wb(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Fp();break;case 3:Pu(),vt(tr),vt(jn),tk();break;case 5:ek(r);break;case 4:Pu();break;case 13:vt(Nt);break;case 19:vt(Nt);break;case 10:Jb(r.type._context);break;case 22:case 23:fk()}n=n.return}if(sn=e,Bt=e=Oo(e.current,null),hn=dr=t,Gt=0,Ud=null,uk=jg=ql=0,Yn=ld=null,vl!==null){for(t=0;t<vl.length;t++)if(n=vl[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}vl=null}return e}function fP(e,t){do{var n=Bt;try{if(Gb(),sp.current=Gp,Qp){for(var r=Rt.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Qp=!1}if(Ul=0,en=Wt=Rt=null,id=!1,Bd=0,ak.current=null,n===null||n.return===null){Gt=1,Ud=t,Bt=null;break}e:{var i=e,o=n.return,l=n,a=t;if(t=hn,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 f=c.alternate;f?(c.updateQueue=f.updateQueue,c.memoizedState=f.memoizedState,c.lanes=f.lanes):(c.updateQueue=null,c.memoizedState=null)}var h=KC(o);if(h!==null){h.flags&=-257,QC(h,o,l,i,t),h.mode&1&&WC(i,u,t),t=h,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)){WC(i,u,t),hk();break e}a=Error(ne(426))}}else if(St&&l.mode&1){var v=KC(o);if(v!==null){!(v.flags&65536)&&(v.flags|=256),QC(v,o,l,i,t),Kb(Au(a,l));break e}}i=a=Au(a,l),Gt!==4&&(Gt=2),ld===null?ld=[i]:ld.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=GO(i,a,t);FC(i,x);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"&&(jo===null||!jo.has(b)))){i.flags|=65536,t&=-t,i.lanes|=t;var C=JO(i,l,t);FC(i,C);break e}}i=i.return}while(i!==null)}mP(n)}catch(S){t=S,Bt===n&&n!==null&&(Bt=n=n.return);continue}break}while(!0)}function hP(){var e=Jp.current;return Jp.current=Gp,e===null?Gp:e}function hk(){(Gt===0||Gt===3||Gt===2)&&(Gt=4),sn===null||!(ql&268435455)&&!(jg&268435455)||ro(sn,hn)}function Xp(e,t){var n=Ye;Ye|=2;var r=hP();(sn!==e||hn!==t)&&(fi=null,_l(e,t));do try{H4();break}catch(s){fP(e,s)}while(!0);if(Gb(),Ye=n,Jp.current=r,Bt!==null)throw Error(ne(261));return sn=null,hn=0,Gt}function H4(){for(;Bt!==null;)pP(Bt)}function U4(){for(;Bt!==null&&!mF();)pP(Bt)}function pP(e){var t=yP(e.alternate,e,dr);e.memoizedProps=e.pendingProps,t===null?mP(e):Bt=t,ak.current=null}function mP(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=L4(n,t),n!==null){n.flags&=32767,Bt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Gt=6,Bt=null;return}}else if(n=D4(n,t,dr),n!==null){Bt=n;return}if(t=t.sibling,t!==null){Bt=t;return}Bt=t=e}while(t!==null);Gt===0&&(Gt=5)}function hl(e,t,n){var r=ut,s=Br.transition;try{Br.transition=null,ut=1,q4(e,t,n,r)}finally{Br.transition=s,ut=r}return null}function q4(e,t,n,r){do ou();while(xo!==null);if(Ye&6)throw Error(ne(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(ne(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(EF(e,i),e===sn&&(Bt=sn=null,hn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||hh||(hh=!0,xP(_p,function(){return ou(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Br.transition,Br.transition=null;var o=ut;ut=1;var l=Ye;Ye|=4,ak.current=null,z4(e,n),uP(n,e),d4(r0),Dp=!!n0,r0=n0=null,e.current=n,F4(n),gF(),Ye=l,ut=o,Br.transition=i}else e.current=n;if(hh&&(hh=!1,xo=e,Yp=s),i=e.pendingLanes,i===0&&(jo=null),vF(n.stateNode),rr(e,Dt()),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(Zp)throw Zp=!1,e=S0,S0=null,e;return Yp&1&&e.tag!==0&&ou(),i=e.pendingLanes,i&1?e===C0?ad++:(ad=0,C0=e):ad=0,Xo(),null}function ou(){if(xo!==null){var e=GM(Yp),t=Br.transition,n=ut;try{if(Br.transition=null,ut=16>e?16:e,xo===null)var r=!1;else{if(e=xo,xo=null,Yp=0,Ye&6)throw Error(ne(331));var s=Ye;for(Ye|=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:od(8,c,i)}var d=c.child;if(d!==null)d.return=c,pe=d;else for(;pe!==null;){c=pe;var f=c.sibling,h=c.return;if(oP(c),c===u){pe=null;break}if(f!==null){f.return=h,pe=f;break}pe=h}}}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:od(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,pe=x;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:Rg(9,l)}}catch(S){Pt(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(Ye=s,Xo(),Vs&&typeof Vs.onPostCommitFiberRoot=="function")try{Vs.onPostCommitFiberRoot(wg,e)}catch{}r=!0}return r}finally{ut=n,Br.transition=t}}return!1}function lE(e,t,n){t=Au(n,t),t=GO(e,t,1),e=Ro(e,t,1),t=Fn(),e!==null&&(Nf(e,1,t),rr(e,t))}function Pt(e,t,n){if(e.tag===3)lE(e,e,n);else for(;t!==null;){if(t.tag===3){lE(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(jo===null||!jo.has(r))){e=Au(n,e),e=JO(t,e,1),t=Ro(t,e,1),e=Fn(),t!==null&&(Nf(t,1,e),rr(t,e));break}}t=t.return}}function W4(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Fn(),e.pingedLanes|=e.suspendedLanes&n,sn===e&&(hn&n)===n&&(Gt===4||Gt===3&&(hn&130023424)===hn&&500>Dt()-ck?_l(e,0):uk|=n),rr(e,t)}function gP(e,t){t===0&&(e.mode&1?(t=rh,rh<<=1,!(rh&130023424)&&(rh=4194304)):t=1);var n=Fn();e=Di(e,t),e!==null&&(Nf(e,t,n),rr(e,n))}function K4(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gP(e,n)}function Q4(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(ne(314))}r!==null&&r.delete(t),gP(e,n)}var yP;yP=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,I4(e,t,n);er=!!(e.flags&131072)}else er=!1,St&&t.flags&1048576&&bO(t,Hp,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;op(e,t),e=t.pendingProps;var s=ju(t,jn.current);iu(t,n),s=rk(null,t,r,e,s,n);var i=sk();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,Bp(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Yb(t),s.updater=Tg,t.stateNode=s,s._reactInternals=t,f0(t,r,e,n),t=m0(null,t,r,!0,i,n)):(t.tag=0,St&&i&&qb(t),Dn(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(op(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=J4(r),e=es(r,e),s){case 0:t=p0(null,t,r,e,n);break e;case 1:t=ZC(null,t,r,e,n);break e;case 11:t=GC(null,t,r,e,n);break e;case 14:t=JC(null,t,r,es(r.type,e),n);break e}throw Error(ne(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:es(r,s),p0(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:es(r,s),ZC(e,t,r,s,n);case 3:e:{if(eP(t),e===null)throw Error(ne(387));r=t.pendingProps,i=t.memoizedState,s=i.element,TO(e,t),Wp(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=Au(Error(ne(423)),t),t=YC(e,t,r,n,s);break e}else if(r!==s){s=Au(Error(ne(424)),t),t=YC(e,t,r,n,s);break e}else for(pr=To(t.stateNode.containerInfo.firstChild),gr=t,St=!0,ss=null,n=EO(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Mu(),r===s){t=Li(e,t,n);break e}Dn(e,t,r,n)}t=t.child}return t;case 5:return RO(t),e===null&&u0(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,s0(r,s)?o=null:i!==null&&s0(r,i)&&(t.flags|=32),XO(e,t),Dn(e,t,o,n),t.child;case 6:return e===null&&u0(t),null;case 13:return tP(e,t,n);case 4:return Xb(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ou(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:es(r,s),GC(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,mt(Up,r._currentValue),r._currentValue=o,i!==null)if(ys(i.value,o)){if(i.children===s.children&&!tr.current){t=Li(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=Ri(-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),c0(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(ne(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),c0(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,iu(t,n),s=qr(s),r=r(s),t.flags|=1,Dn(e,t,r,n),t.child;case 14:return r=t.type,s=es(r,t.pendingProps),s=es(r.type,s),JC(e,t,r,s,n);case 15:return ZO(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:es(r,s),op(e,t),t.tag=1,nr(r)?(e=!0,Bp(t)):e=!1,iu(t,n),QO(t,r,s),f0(t,r,s,n),m0(null,t,r,!0,e,n);case 19:return nP(e,t,n);case 22:return YO(e,t,n)}throw Error(ne(156,t.tag))};function xP(e,t){return qM(e,t)}function G4(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 Fr(e,t,n,r){return new G4(e,t,n,r)}function pk(e){return e=e.prototype,!(!e||!e.isReactComponent)}function J4(e){if(typeof e=="function")return pk(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ab)return 11;if(e===_b)return 14}return 2}function Oo(e,t){var n=e.alternate;return n===null?(n=Fr(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 up(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")pk(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Ba:return Il(n.children,s,i,t);case Pb:o=8,s|=8;break;case Dv:return e=Fr(12,n,t,s|2),e.elementType=Dv,e.lanes=i,e;case Lv:return e=Fr(13,n,t,s),e.elementType=Lv,e.lanes=i,e;case $v:return e=Fr(19,n,t,s),e.elementType=$v,e.lanes=i,e;case RM:return Mg(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case NM:o=10;break e;case TM:o=9;break e;case Ab:o=11;break e;case _b:o=14;break e;case Ji:o=16,r=null;break e}throw Error(ne(130,e==null?e:typeof e,""))}return t=Fr(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Il(e,t,n,r){return e=Fr(7,e,r,t),e.lanes=n,e}function Mg(e,t,n,r){return e=Fr(22,e,r,t),e.elementType=RM,e.lanes=n,e.stateNode={isHidden:!1},e}function lx(e,t,n){return e=Fr(6,e,null,t),e.lanes=n,e}function ax(e,t,n){return t=Fr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Z4(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=Vy(0),this.expirationTimes=Vy(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vy(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function mk(e,t,n,r,s,i,o,l,a){return e=new Z4(e,t,n,l,a),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Fr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yb(i),e}function Y4(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Fa,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function vP(e){if(!e)return Fo;e=e._reactInternals;e:{if(oa(e)!==e||e.tag!==1)throw Error(ne(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(ne(171))}if(e.tag===1){var n=e.type;if(nr(n))return vO(e,n,t)}return t}function wP(e,t,n,r,s,i,o,l,a){return e=mk(n,r,!0,e,s,i,o,l,a),e.context=vP(null),n=e.current,r=Fn(),s=Mo(n),i=Ri(r,s),i.callback=t??null,Ro(n,i,s),e.current.lanes=s,Nf(e,s,r),rr(e,r),e}function Og(e,t,n,r){var s=t.current,i=Fn(),o=Mo(s);return n=vP(n),t.context===null?t.context=n:t.pendingContext=n,t=Ri(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Ro(s,t,o),e!==null&&(hs(e,s,o,i),rp(e,s,o)),o}function em(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 aE(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function gk(e,t){aE(e,t),(e=e.alternate)&&aE(e,t)}function X4(){return null}var bP=typeof reportError=="function"?reportError:function(e){console.error(e)};function yk(e){this._internalRoot=e}Pg.prototype.render=yk.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ne(409));Og(e,t,null,null)};Pg.prototype.unmount=yk.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Wl(function(){Og(null,e,null,null)}),t[Ii]=null}};function Pg(e){this._internalRoot=e}Pg.prototype.unstable_scheduleHydration=function(e){if(e){var t=YM();e={blockedOn:null,target:e,priority:t};for(var n=0;n<no.length&&t!==0&&t<no[n].priority;n++);no.splice(n,0,e),n===0&&eO(e)}};function xk(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ag(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function uE(){}function e5(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=em(o);i.call(u)}}var o=wP(t,r,e,0,null,!1,!1,"",uE);return e._reactRootContainer=o,e[Ii]=o.current,Dd(e.nodeType===8?e.parentNode:e),Wl(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=em(a);l.call(u)}}var a=mk(e,0,!1,null,null,!1,!1,"",uE);return e._reactRootContainer=a,e[Ii]=a.current,Dd(e.nodeType===8?e.parentNode:e),Wl(function(){Og(t,a,n,r)}),a}function _g(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=em(o);l.call(a)}}Og(t,o,e,s)}else o=e5(n,t,e,s,r);return em(o)}JM=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Vc(t.pendingLanes);n!==0&&(Lb(t,n|1),rr(t,Dt()),!(Ye&6)&&(_u=Dt()+500,Xo()))}break;case 13:Wl(function(){var r=Di(e,1);if(r!==null){var s=Fn();hs(r,e,1,s)}}),gk(e,1)}};$b=function(e){if(e.tag===13){var t=Di(e,134217728);if(t!==null){var n=Fn();hs(t,e,134217728,n)}gk(e,134217728)}};ZM=function(e){if(e.tag===13){var t=Mo(e),n=Di(e,t);if(n!==null){var r=Fn();hs(n,e,t,r)}gk(e,t)}};YM=function(){return ut};XM=function(e,t){var n=ut;try{return ut=e,t()}finally{ut=n}};Qv=function(e,t,n){switch(t){case"input":if(Bv(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=Cg(r);if(!s)throw Error(ne(90));MM(r),Bv(r,s)}}}break;case"textarea":PM(e,n);break;case"select":t=n.value,t!=null&&tu(e,!!n.multiple,t,!1)}};zM=dk;FM=Wl;var t5={usingClientEntryPoint:!1,Events:[Rf,qa,Cg,LM,$M,dk]},Nc={findFiberByHostInstance:xl,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},n5={bundleType:Nc.bundleType,version:Nc.version,rendererPackageName:Nc.rendererPackageName,rendererConfig:Nc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:zi.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=HM(e),e===null?null:e.stateNode},findFiberByHostInstance:Nc.findFiberByHostInstance||X4,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 ph=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ph.isDisabled&&ph.supportsFiber)try{wg=ph.inject(n5),Vs=ph}catch{}}Sr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=t5;Sr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!xk(t))throw Error(ne(200));return Y4(e,t,null,n)};Sr.createRoot=function(e,t){if(!xk(e))throw Error(ne(299));var n=!1,r="",s=bP;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=mk(e,1,!1,null,null,n,!1,r,s),e[Ii]=t.current,Dd(e.nodeType===8?e.parentNode:e),new yk(t)};Sr.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(ne(188)):(e=Object.keys(e).join(","),Error(ne(268,e)));return e=HM(t),e=e===null?null:e.stateNode,e};Sr.flushSync=function(e){return Wl(e)};Sr.hydrate=function(e,t,n){if(!Ag(t))throw Error(ne(200));return _g(null,e,t,!0,n)};Sr.hydrateRoot=function(e,t,n){if(!xk(e))throw Error(ne(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=bP;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=wP(t,null,e,1,n??null,s,!1,i,o),e[Ii]=t.current,Dd(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 Pg(t)};Sr.render=function(e,t,n){if(!Ag(t))throw Error(ne(200));return _g(null,e,t,!1,n)};Sr.unmountComponentAtNode=function(e){if(!Ag(e))throw Error(ne(40));return e._reactRootContainer?(Wl(function(){_g(null,null,e,!1,function(){e._reactRootContainer=null,e[Ii]=null})}),!0):!1};Sr.unstable_batchedUpdates=dk;Sr.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Ag(n))throw Error(ne(200));if(e==null||e._reactInternals===void 0)throw Error(ne(38));return _g(e,t,n,!1,r)};Sr.version="18.3.1-next-f1338f8080-20240426";function kP(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(kP)}catch(e){console.error(e)}}kP(),kM.exports=Sr;var el=kM.exports;const SP=xg(el);var CP,cE=el;CP=cE.createRoot,cE.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 qd(){return qd=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},qd.apply(this,arguments)}var vo;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(vo||(vo={}));const dE="popstate";function r5(e){e===void 0&&(e={});function t(r,s){let{pathname:i,search:o,hash:l}=r.location;return T0("",{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:EP(s)}return i5(t,n,null,e)}function Jt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function vk(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function s5(){return Math.random().toString(36).substr(2,8)}function fE(e,t){return{usr:e.state,key:e.key,idx:t}}function T0(e,t,n,r){return n===void 0&&(n=null),qd({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?oc(t):t,{state:n,key:t&&t.key||r||s5()})}function EP(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 oc(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 i5(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,l=vo.Pop,a=null,u=c();u==null&&(u=0,o.replaceState(qd({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function d(){l=vo.Pop;let v=c(),x=v==null?null:v-u;u=v,a&&a({action:l,location:g.location,delta:x})}function f(v,x){l=vo.Push;let w=T0(g.location,v,x);u=c()+1;let b=fE(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 h(v,x){l=vo.Replace;let w=T0(g.location,v,x);u=c();let b=fE(w,u),C=g.createHref(w);o.replaceState(b,"",C),i&&a&&a({action:l,location:g.location,delta:0})}function m(v){let x=s.location.origin!=="null"?s.location.origin:s.location.href,w=typeof v=="string"?v:EP(v);return w=w.replace(/ $/,"%20"),Jt(x,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,x)}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(dE,d),a=v,()=>{s.removeEventListener(dE,d),a=null}},createHref(v){return t(s,v)},createURL:m,encodeLocation(v){let x=m(v);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:f,replace:h,go(v){return o.go(v)}};return g}var hE;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(hE||(hE={}));function o5(e,t,n){return n===void 0&&(n="/"),l5(e,t,n)}function l5(e,t,n,r){let s=typeof t=="string"?oc(t):t,i=RP(s.pathname||"/",n);if(i==null)return null;let o=NP(e);a5(o);let l=null;for(let a=0;l==null&&a<o.length;++a){let u=w5(i);l=y5(o[a],u)}return l}function NP(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("/")&&(Jt(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=Dl([r,a.relativePath]),c=n.concat(a);i.children&&i.children.length>0&&(Jt(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),NP(i.children,t,c,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:m5(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 TP(i.path))s(i,o,a)}),t}function TP(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=TP(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 a5(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:g5(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const u5=/^:[\w-]+$/,c5=3,d5=2,f5=1,h5=10,p5=-2,pE=e=>e==="*";function m5(e,t){let n=e.split("/"),r=n.length;return n.some(pE)&&(r+=p5),t&&(r+=d5),n.filter(s=>!pE(s)).reduce((s,i)=>s+(u5.test(i)?c5:i===""?f5:h5),r)}function g5(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 y5(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=x5({path:a.relativePath,caseSensitive:a.caseSensitive,end:u},c),f=a.route;if(!d)return null;Object.assign(s,d.params),o.push({params:s,pathname:Dl([i,d.pathname]),pathnameBase:T5(Dl([i,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(i=Dl([i,d.pathnameBase]))}return o}function x5(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=v5(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:f,isOptional:h}=c;if(f==="*"){let g=l[d]||"";o=i.slice(0,i.length-g.length).replace(/(.)\/+$/,"$1")}const m=l[d];return h&&!m?u[f]=void 0:u[f]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function v5(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),vk(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 w5(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return vk(!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 RP(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 b5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,k5=e=>b5.test(e);function S5(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?oc(e):e,i;if(n)if(k5(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),vk(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=mE(n.substring(1),"/"):i=mE(n,t)}else i=t;return{pathname:i,search:R5(r),hash:j5(s)}}function mE(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 ux(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 C5(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function E5(e,t){let n=C5(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function N5(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=oc(e):(s=qd({},e),Jt(!s.pathname||!s.pathname.includes("?"),ux("?","pathname","search",s)),Jt(!s.pathname||!s.pathname.includes("#"),ux("#","pathname","hash",s)),Jt(!s.search||!s.search.includes("#"),ux("#","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 f=o.split("/");for(;f[0]==="..";)f.shift(),d-=1;s.pathname=f.join("/")}l=d>=0?t[d]:"/"}let a=S5(s,l),u=o&&o!=="/"&&o.endsWith("/"),c=(i||o===".")&&n.endsWith("/");return!a.pathname.endsWith("/")&&(u||c)&&(a.pathname+="/"),a}const Dl=e=>e.join("/").replace(/\/\/+/g,"/"),T5=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),R5=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,j5=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function M5(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const jP=["post","put","patch","delete"];new Set(jP);const O5=["get",...jP];new Set(O5);/**
|
|
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 Wd(){return Wd=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},Wd.apply(this,arguments)}const wk=y.createContext(null),P5=y.createContext(null),Ig=y.createContext(null),Dg=y.createContext(null),lc=y.createContext({outlet:null,matches:[],isDataRoute:!1}),MP=y.createContext(null);function Lg(){return y.useContext(Dg)!=null}function Mf(){return Lg()||Jt(!1),y.useContext(Dg).location}function OP(e){y.useContext(Ig).static||y.useLayoutEffect(e)}function $g(){let{isDataRoute:e}=y.useContext(lc);return e?q5():A5()}function A5(){Lg()||Jt(!1);let e=y.useContext(wk),{basename:t,future:n,navigator:r}=y.useContext(Ig),{matches:s}=y.useContext(lc),{pathname:i}=Mf(),o=JSON.stringify(E5(s,n.v7_relativeSplatPath)),l=y.useRef(!1);return OP(()=>{l.current=!0}),y.useCallback(function(u,c){if(c===void 0&&(c={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let d=N5(u,JSON.parse(o),i,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:Dl([t,d.pathname])),(c.replace?r.replace:r.push)(d,c.state,c)},[t,r,o,i,e])}function _5(e,t){return I5(e,t)}function I5(e,t,n,r){Lg()||Jt(!1);let{navigator:s}=y.useContext(Ig),{matches:i}=y.useContext(lc),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let a=o?o.pathnameBase:"/";o&&o.route;let u=Mf(),c;if(t){var d;let v=typeof t=="string"?oc(t):t;a==="/"||(d=v.pathname)!=null&&d.startsWith(a)||Jt(!1),c=v}else c=u;let f=c.pathname||"/",h=f;if(a!=="/"){let v=a.replace(/^\//,"").split("/");h="/"+f.replace(/^\//,"").split("/").slice(v.length).join("/")}let m=o5(e,{pathname:h}),g=F5(m&&m.map(v=>Object.assign({},v,{params:Object.assign({},l,v.params),pathname:Dl([a,s.encodeLocation?s.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?a:Dl([a,s.encodeLocation?s.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),i,n,r);return t&&g?y.createElement(Dg.Provider,{value:{location:Wd({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:vo.Pop}},g):g}function D5(){let e=U5(),t=M5(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 y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},t),n?y.createElement("pre",{style:s},n):null,null)}const L5=y.createElement(D5,null);class $5 extends y.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?y.createElement(lc.Provider,{value:this.props.routeContext},y.createElement(MP.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function z5(e){let{routeContext:t,match:n,children:r}=e,s=y.useContext(wk);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),y.createElement(lc.Provider,{value:t},r)}function F5(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||Jt(!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:f,errors:h}=n,m=d.route.loader&&f[d.route.id]===void 0&&(!h||h[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,f)=>{let h,m=!1,g=null,v=null;n&&(h=l&&d.route.id?l[d.route.id]:void 0,g=d.route.errorElement||L5,a&&(u<0&&f===0?(W5("route-fallback"),m=!0,v=null):u===f&&(m=!0,v=d.route.hydrateFallbackElement||null)));let x=t.concat(o.slice(0,f+1)),w=()=>{let b;return h?b=g:m?b=v:d.route.Component?b=y.createElement(d.route.Component,null):d.route.element?b=d.route.element:b=c,y.createElement(z5,{match:d,routeContext:{outlet:c,matches:x,isDataRoute:n!=null},children:b})};return n&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?y.createElement($5,{location:n.location,revalidation:n.revalidation,component:g,error:h,children:w(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):w()},null)}var PP=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(PP||{}),AP=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}(AP||{});function B5(e){let t=y.useContext(wk);return t||Jt(!1),t}function V5(e){let t=y.useContext(P5);return t||Jt(!1),t}function H5(e){let t=y.useContext(lc);return t||Jt(!1),t}function _P(e){let t=H5(),n=t.matches[t.matches.length-1];return n.route.id||Jt(!1),n.route.id}function U5(){var e;let t=y.useContext(MP),n=V5(),r=_P();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function q5(){let{router:e}=B5(PP.UseNavigateStable),t=_P(AP.UseNavigateStable),n=y.useRef(!1);return OP(()=>{n.current=!0}),y.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,Wd({fromRouteId:t},i)))},[e,t])}const gE={};function W5(e,t,n){gE[e]||(gE[e]=!0)}function K5(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function IP(e){Jt(!1)}function Q5(e){let{basename:t="/",children:n=null,location:r,navigationType:s=vo.Pop,navigator:i,static:o=!1,future:l}=e;Lg()&&Jt(!1);let a=t.replace(/^\/*/,"/"),u=y.useMemo(()=>({basename:a,navigator:i,static:o,future:Wd({v7_relativeSplatPath:!1},l)}),[a,l,i,o]);typeof r=="string"&&(r=oc(r));let{pathname:c="/",search:d="",hash:f="",state:h=null,key:m="default"}=r,g=y.useMemo(()=>{let v=RP(c,a);return v==null?null:{location:{pathname:v,search:d,hash:f,state:h,key:m},navigationType:s}},[a,c,d,f,h,m,s]);return g==null?null:y.createElement(Ig.Provider,{value:u},y.createElement(Dg.Provider,{children:n,value:g}))}function G5(e){let{children:t,location:n}=e;return _5(R0(t),n)}new Promise(()=>{});function R0(e,t){t===void 0&&(t=[]);let n=[];return y.Children.forEach(e,(r,s)=>{if(!y.isValidElement(r))return;let i=[...t,s];if(r.type===y.Fragment){n.push.apply(n,R0(r.props.children,i));return}r.type!==IP&&Jt(!1),!r.props.index||!r.props.children||Jt(!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=R0(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 J5="6";try{window.__reactRouterVersion=J5}catch{}const Z5="startTransition",yE=Ef[Z5];function Y5(e){let{basename:t,children:n,future:r,window:s}=e,i=y.useRef();i.current==null&&(i.current=r5({window:s,v5Compat:!0}));let o=i.current,[l,a]=y.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},c=y.useCallback(d=>{u&&yE?yE(()=>a(d)):a(d)},[a,u]);return y.useLayoutEffect(()=>o.listen(c),[o,c]),y.useEffect(()=>K5(r),[r]),y.createElement(Q5,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}var xE;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(xE||(xE={}));var vE;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(vE||(vE={}));var la=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(){}},X5={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},oo,Cb,Zj,eB=(Zj=class{constructor(){he(this,oo,X5);he(this,Cb,!1)}setTimeoutProvider(e){oe(this,oo,e)}setTimeout(e,t){return A(this,oo).setTimeout(e,t)}clearTimeout(e){A(this,oo).clearTimeout(e)}setInterval(e,t){return A(this,oo).setInterval(e,t)}clearInterval(e){A(this,oo).clearInterval(e)}},oo=new WeakMap,Cb=new WeakMap,Zj),bl=new eB;function tB(e){setTimeout(e,0)}var Kl=typeof window>"u"||"Deno"in globalThis;function Nn(){}function nB(e,t){return typeof e=="function"?e(t):e}function j0(e){return typeof e=="number"&&e>=0&&e!==1/0}function DP(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Po(e,t){return typeof e=="function"?e(t):e}function Ar(e,t){return typeof e=="function"?e(t):e}function wE(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==bk(o,t.options))return!1}else if(!Kd(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 bE(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Bo(t.options.mutationKey)!==Bo(i))return!1}else if(!Kd(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function bk(e,t){return((t==null?void 0:t.queryKeyHashFn)||Bo)(e)}function Bo(e){return JSON.stringify(e,(t,n)=>M0(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Kd(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Kd(e[n],t[n])):!1}var rB=Object.prototype.hasOwnProperty;function kk(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=kE(e)&&kE(t);if(!r&&!(M0(e)&&M0(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],f=e[d],h=t[d];if(f===h){a[d]=f,(r?c<i:rB.call(e,d))&&u++;continue}if(f===null||h===null||typeof f!="object"||typeof h!="object"){a[d]=h;continue}const m=kk(f,h,n+1);a[d]=m,m===f&&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 kE(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function M0(e){if(!SE(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!SE(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function SE(e){return Object.prototype.toString.call(e)==="[object Object]"}function sB(e){return new Promise(t=>{bl.setTimeout(t,e)})}function O0(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?kk(e,t):t}function iB(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function oB(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var fr=Symbol();function LP(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===fr?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Sk(e,t){return typeof e=="function"?e(...t):!!e}function lB(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 El,lo,hu,Yj,aB=(Yj=class extends la{constructor(){super();he(this,El);he(this,lo);he(this,hu);oe(this,hu,t=>{if(!Kl&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){A(this,lo)||this.setEventListener(A(this,hu))}onUnsubscribe(){var t;this.hasListeners()||((t=A(this,lo))==null||t.call(this),oe(this,lo,void 0))}setEventListener(t){var n;oe(this,hu,t),(n=A(this,lo))==null||n.call(this),oe(this,lo,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){A(this,El)!==t&&(oe(this,El,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof A(this,El)=="boolean"?A(this,El):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},El=new WeakMap,lo=new WeakMap,hu=new WeakMap,Yj),Ck=new aB;function P0(){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 uB=tB;function cB(){let e=[],t=0,n=l=>{l()},r=l=>{l()},s=uB;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 _t=cB(),pu,ao,mu,Xj,dB=(Xj=class extends la{constructor(){super();he(this,pu,!0);he(this,ao);he(this,mu);oe(this,mu,t=>{if(!Kl&&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(){A(this,ao)||this.setEventListener(A(this,mu))}onUnsubscribe(){var t;this.hasListeners()||((t=A(this,ao))==null||t.call(this),oe(this,ao,void 0))}setEventListener(t){var n;oe(this,mu,t),(n=A(this,ao))==null||n.call(this),oe(this,ao,t(this.setOnline.bind(this)))}setOnline(t){A(this,pu)!==t&&(oe(this,pu,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return A(this,pu)}},pu=new WeakMap,ao=new WeakMap,mu=new WeakMap,Xj),tm=new dB;function fB(e){return Math.min(1e3*2**e,3e4)}function $P(e){return(e??"online")==="online"?tm.isOnline():!0}var A0=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function zP(e){let t=!1,n=0,r;const s=P0(),i=()=>s.status!=="pending",o=g=>{var v;if(!i()){const x=new A0(g);f(x),(v=e.onCancel)==null||v.call(e,x)}},l=()=>{t=!0},a=()=>{t=!1},u=()=>Ck.isFocused()&&(e.networkMode==="always"||tm.isOnline())&&e.canRun(),c=()=>$P(e.networkMode)&&e.canRun(),d=g=>{i()||(r==null||r(),s.resolve(g))},f=g=>{i()||(r==null||r(),s.reject(g))},h=()=>new Promise(g=>{var v;r=x=>{(i()||u())&&g(x)},(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(x){g=Promise.reject(x)}Promise.resolve(g).then(d).catch(x=>{var k;if(i())return;const w=e.retry??(Kl?0:3),b=e.retryDelay??fB,C=typeof b=="function"?b(n,x):b,S=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,x);if(t||!S){f(x);return}n++,(k=e.onFail)==null||k.call(e,n,x),sB(C).then(()=>u()?void 0:h()).then(()=>{t?f(x):m()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:l,continueRetry:a,canStart:c,start:()=>(c()?m():h().then(m),s)}}var Nl,eM,FP=(eM=class{constructor(){he(this,Nl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),j0(this.gcTime)&&oe(this,Nl,bl.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Kl?1/0:5*60*1e3))}clearGcTimeout(){A(this,Nl)&&(bl.clearTimeout(A(this,Nl)),oe(this,Nl,void 0))}},Nl=new WeakMap,eM),Tl,gu,Or,Rl,Xt,mf,jl,ts,ai,tM,hB=(tM=class extends FP{constructor(t){super();he(this,ts);he(this,Tl);he(this,gu);he(this,Or);he(this,Rl);he(this,Xt);he(this,mf);he(this,jl);oe(this,jl,!1),oe(this,mf,t.defaultOptions),this.setOptions(t.options),this.observers=[],oe(this,Rl,t.client),oe(this,Or,A(this,Rl).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,oe(this,Tl,EE(this.options)),this.state=t.state??A(this,Tl),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=A(this,Xt))==null?void 0:t.promise}setOptions(t){if(this.options={...A(this,mf),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=EE(this.options);n.data!==void 0&&(this.setState(CE(n.data,n.dataUpdatedAt)),oe(this,Tl,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&A(this,Or).remove(this)}setData(t,n){const r=O0(this.state.data,t,this.options);return Me(this,ts,ai).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Me(this,ts,ai).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=A(this,Xt))==null?void 0:r.promise;return(s=A(this,Xt))==null||s.cancel(t),n?n.then(Nn).catch(Nn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(A(this,Tl))}isActive(){return this.observers.some(t=>Ar(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===fr||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Po(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:!DP(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=A(this,Xt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=A(this,Xt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),A(this,Or).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(A(this,Xt)&&(A(this,jl)?A(this,Xt).cancel({revert:!0}):A(this,Xt).cancelRetry()),this.scheduleGc()),A(this,Or).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Me(this,ts,ai).call(this,{type:"invalidate"})}async fetch(t,n){var a,u,c,d,f,h,m,g,v,x,w,b;if(this.state.fetchStatus!=="idle"&&((a=A(this,Xt))==null?void 0:a.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(A(this,Xt))return A(this,Xt).continueRetry(),A(this,Xt).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:()=>(oe(this,jl,!0),r.signal)})},i=()=>{const C=LP(this.options,n),k=(()=>{const E={client:A(this,Rl),queryKey:this.queryKey,meta:this.meta};return s(E),E})();return oe(this,jl,!1),this.options.persister?this.options.persister(C,k,this):C(k)},l=(()=>{const C={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:A(this,Rl),state:this.state,fetchFn:i};return s(C),C})();(u=this.options.behavior)==null||u.onFetch(l,this),oe(this,gu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=l.fetchOptions)==null?void 0:c.meta))&&Me(this,ts,ai).call(this,{type:"fetch",meta:(d=l.fetchOptions)==null?void 0:d.meta}),oe(this,Xt,zP({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,onCancel:C=>{C instanceof A0&&C.revert&&this.setState({...A(this,gu),fetchStatus:"idle"}),r.abort()},onFail:(C,S)=>{Me(this,ts,ai).call(this,{type:"failed",failureCount:C,error:S})},onPause:()=>{Me(this,ts,ai).call(this,{type:"pause"})},onContinue:()=>{Me(this,ts,ai).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const C=await A(this,Xt).start();if(C===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(C),(h=(f=A(this,Or).config).onSuccess)==null||h.call(f,C,this),(g=(m=A(this,Or).config).onSettled)==null||g.call(m,C,this.state.error,this),C}catch(C){if(C instanceof A0){if(C.silent)return A(this,Xt).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw Me(this,ts,ai).call(this,{type:"error",error:C}),(x=(v=A(this,Or).config).onError)==null||x.call(v,C,this),(b=(w=A(this,Or).config).onSettled)==null||b.call(w,this.state.data,C,this),C}finally{this.scheduleGc()}}},Tl=new WeakMap,gu=new WeakMap,Or=new WeakMap,Rl=new WeakMap,Xt=new WeakMap,mf=new WeakMap,jl=new WeakMap,ts=new WeakSet,ai=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,...BP(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...CE(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return oe(this,gu,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),_t.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),A(this,Or).notify({query:this,type:"updated",action:t})})},tM);function BP(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:$P(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function CE(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function EE(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,Ke,gf,In,Ml,yu,xi,uo,yf,xu,vu,Ol,Pl,co,wu,it,Uc,_0,I0,D0,L0,$0,z0,F0,VP,nM,Of=(nM=class extends la{constructor(t,n){super();he(this,it);he(this,Jn);he(this,Ke);he(this,gf);he(this,In);he(this,Ml);he(this,yu);he(this,xi);he(this,uo);he(this,yf);he(this,xu);he(this,vu);he(this,Ol);he(this,Pl);he(this,co);he(this,wu,new Set);this.options=n,oe(this,Jn,t),oe(this,uo,null),oe(this,xi,P0()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(A(this,Ke).addObserver(this),NE(A(this,Ke),this.options)?Me(this,it,Uc).call(this):this.updateResult(),Me(this,it,L0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return B0(A(this,Ke),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return B0(A(this,Ke),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Me(this,it,$0).call(this),Me(this,it,z0).call(this),A(this,Ke).removeObserver(this)}setOptions(t){const n=this.options,r=A(this,Ke);if(this.options=A(this,Jn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ar(this.options.enabled,A(this,Ke))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Me(this,it,F0).call(this),A(this,Ke).setOptions(this.options),n._defaulted&&!Qd(this.options,n)&&A(this,Jn).getQueryCache().notify({type:"observerOptionsUpdated",query:A(this,Ke),observer:this});const s=this.hasListeners();s&&TE(A(this,Ke),r,this.options,n)&&Me(this,it,Uc).call(this),this.updateResult(),s&&(A(this,Ke)!==r||Ar(this.options.enabled,A(this,Ke))!==Ar(n.enabled,A(this,Ke))||Po(this.options.staleTime,A(this,Ke))!==Po(n.staleTime,A(this,Ke)))&&Me(this,it,_0).call(this);const i=Me(this,it,I0).call(this);s&&(A(this,Ke)!==r||Ar(this.options.enabled,A(this,Ke))!==Ar(n.enabled,A(this,Ke))||i!==A(this,co))&&Me(this,it,D0).call(this,i)}getOptimisticResult(t){const n=A(this,Jn).getQueryCache().build(A(this,Jn),t),r=this.createResult(n,t);return mB(this,r)&&(oe(this,In,r),oe(this,yu,this.options),oe(this,Ml,A(this,Ke).state)),r}getCurrentResult(){return A(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&&A(this,xi).status==="pending"&&A(this,xi).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){A(this,wu).add(t)}getCurrentQuery(){return A(this,Ke)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=A(this,Jn).defaultQueryOptions(t),r=A(this,Jn).getQueryCache().build(A(this,Jn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Me(this,it,Uc).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),A(this,In)))}createResult(t,n){var O;const r=A(this,Ke),s=this.options,i=A(this,In),o=A(this,Ml),l=A(this,yu),u=t!==r?t.state:A(this,gf),{state:c}=t;let d={...c},f=!1,h;if(n._optimisticResults){const N=this.hasListeners(),j=!N&&NE(t,n),P=N&&TE(t,r,n,s);(j||P)&&(d={...d,...BP(c.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:g,status:v}=d;h=d.data;let x=!1;if(n.placeholderData!==void 0&&h===void 0&&v==="pending"){let N;i!=null&&i.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(N=i.data,x=!0):N=typeof n.placeholderData=="function"?n.placeholderData((O=A(this,vu))==null?void 0:O.state.data,A(this,vu)):n.placeholderData,N!==void 0&&(v="success",h=O0(i==null?void 0:i.data,N,n),f=!0)}if(n.select&&h!==void 0&&!x)if(i&&h===(o==null?void 0:o.data)&&n.select===A(this,yf))h=A(this,xu);else try{oe(this,yf,n.select),h=n.select(h),h=O0(i==null?void 0:i.data,h,n),oe(this,xu,h),oe(this,uo,null)}catch(N){oe(this,uo,N)}A(this,uo)&&(m=A(this,uo),h=A(this,xu),g=Date.now(),v="error");const w=d.fetchStatus==="fetching",b=v==="pending",C=v==="error",S=b&&w,k=h!==void 0,T={status:v,fetchStatus:d.fetchStatus,isPending:b,isSuccess:v==="success",isError:C,isInitialLoading:S,isLoading:S,data:h,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:f,isRefetchError:C&&k,isStale:Ek(t,n),refetch:this.refetch,promise:A(this,xi),isEnabled:Ar(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const N=T.data!==void 0,j=T.status==="error"&&!N,P=L=>{j?L.reject(T.error):N&&L.resolve(T.data)},z=()=>{const L=oe(this,xi,T.promise=P0());P(L)},I=A(this,xi);switch(I.status){case"pending":t.queryHash===r.queryHash&&P(I);break;case"fulfilled":(j||T.data!==I.value)&&z();break;case"rejected":(!j||T.error!==I.reason)&&z();break}}return T}updateResult(){const t=A(this,In),n=this.createResult(A(this,Ke),this.options);if(oe(this,Ml,A(this,Ke).state),oe(this,yu,this.options),A(this,Ml).data!==void 0&&oe(this,vu,A(this,Ke)),Qd(n,t))return;oe(this,In,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!A(this,wu).size)return!0;const o=new Set(i??A(this,wu));return this.options.throwOnError&&o.add("error"),Object.keys(A(this,In)).some(l=>{const a=l;return A(this,In)[a]!==t[a]&&o.has(a)})};Me(this,it,VP).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Me(this,it,L0).call(this)}},Jn=new WeakMap,Ke=new WeakMap,gf=new WeakMap,In=new WeakMap,Ml=new WeakMap,yu=new WeakMap,xi=new WeakMap,uo=new WeakMap,yf=new WeakMap,xu=new WeakMap,vu=new WeakMap,Ol=new WeakMap,Pl=new WeakMap,co=new WeakMap,wu=new WeakMap,it=new WeakSet,Uc=function(t){Me(this,it,F0).call(this);let n=A(this,Ke).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Nn)),n},_0=function(){Me(this,it,$0).call(this);const t=Po(this.options.staleTime,A(this,Ke));if(Kl||A(this,In).isStale||!j0(t))return;const r=DP(A(this,In).dataUpdatedAt,t)+1;oe(this,Ol,bl.setTimeout(()=>{A(this,In).isStale||this.updateResult()},r))},I0=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(A(this,Ke)):this.options.refetchInterval)??!1},D0=function(t){Me(this,it,z0).call(this),oe(this,co,t),!(Kl||Ar(this.options.enabled,A(this,Ke))===!1||!j0(A(this,co))||A(this,co)===0)&&oe(this,Pl,bl.setInterval(()=>{(this.options.refetchIntervalInBackground||Ck.isFocused())&&Me(this,it,Uc).call(this)},A(this,co)))},L0=function(){Me(this,it,_0).call(this),Me(this,it,D0).call(this,Me(this,it,I0).call(this))},$0=function(){A(this,Ol)&&(bl.clearTimeout(A(this,Ol)),oe(this,Ol,void 0))},z0=function(){A(this,Pl)&&(bl.clearInterval(A(this,Pl)),oe(this,Pl,void 0))},F0=function(){const t=A(this,Jn).getQueryCache().build(A(this,Jn),this.options);if(t===A(this,Ke))return;const n=A(this,Ke);oe(this,Ke,t),oe(this,gf,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},VP=function(t){_t.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(A(this,In))}),A(this,Jn).getQueryCache().notify({query:A(this,Ke),type:"observerResultsUpdated"})})},nM);function pB(e,t){return Ar(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function NE(e,t){return pB(e,t)||e.state.data!==void 0&&B0(e,t,t.refetchOnMount)}function B0(e,t,n){if(Ar(t.enabled,e)!==!1&&Po(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Ek(e,t)}return!1}function TE(e,t,n,r){return(e!==t||Ar(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Ek(e,n)}function Ek(e,t){return Ar(t.enabled,e)!==!1&&e.isStaleByTime(Po(t.staleTime,e))}function mB(e,t){return!Qd(e.getCurrentResult(),t)}function nm(e){return{onFetch:(t,n)=>{var c,d,f,h,m;const r=t.options,s=(f=(d=(c=t.fetchOptions)==null?void 0:c.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,i=((h=t.state.data)==null?void 0:h.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=>{lB(b,()=>t.signal,()=>g=!0)},x=LP(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})(),T=await x(E),{maxPages:O}=t.options,N=S?oB:iB;return{pages:N(b.pages,T,O),pageParams:N(b.pageParams,C,O)}};if(s&&i.length){const b=s==="backward",C=b?HP:V0,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:V0(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 V0(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 HP(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 gB(e,t){return t?V0(e,t)!=null:!1}function yB(e,t){return!t||!e.getPreviousPageParam?!1:HP(e,t)!=null}var UP=class extends Of{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:nm()})}getOptimisticResult(e){return e.behavior=nm(),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",f=s&&a==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:gB(t,n.data),hasPreviousPage:yB(t,n.data),isFetchNextPageError:u,isFetchingNextPage:c,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:l&&!u&&!d,isRefetching:i&&!c&&!f}}},xf,Is,Cn,Al,Ds,Wi,rM,xB=(rM=class extends FP{constructor(t){super();he(this,Ds);he(this,xf);he(this,Is);he(this,Cn);he(this,Al);oe(this,xf,t.client),this.mutationId=t.mutationId,oe(this,Cn,t.mutationCache),oe(this,Is,[]),this.state=t.state||qP(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){A(this,Is).includes(t)||(A(this,Is).push(t),this.clearGcTimeout(),A(this,Cn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){oe(this,Is,A(this,Is).filter(n=>n!==t)),this.scheduleGc(),A(this,Cn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){A(this,Is).length||(this.state.status==="pending"?this.scheduleGc():A(this,Cn).remove(this))}continue(){var t;return((t=A(this,Al))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,a,u,c,d,f,h,m,g,v,x,w,b,C,S,k,E;const n=()=>{Me(this,Ds,Wi).call(this,{type:"continue"})},r={client:A(this,xf),meta:this.options.meta,mutationKey:this.options.mutationKey};oe(this,Al,zP({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(T,O)=>{Me(this,Ds,Wi).call(this,{type:"failed",failureCount:T,error:O})},onPause:()=>{Me(this,Ds,Wi).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>A(this,Cn).canRun(this)}));const s=this.state.status==="pending",i=!A(this,Al).canStart();try{if(s)n();else{Me(this,Ds,Wi).call(this,{type:"pending",variables:t,isPaused:i}),A(this,Cn).config.onMutate&&await A(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&&Me(this,Ds,Wi).call(this,{type:"pending",context:O,variables:t,isPaused:i})}const T=await A(this,Al).start();return await((u=(a=A(this,Cn).config).onSuccess)==null?void 0:u.call(a,T,t,this.state.context,this,r)),await((d=(c=this.options).onSuccess)==null?void 0:d.call(c,T,t,this.state.context,r)),await((h=(f=A(this,Cn).config).onSettled)==null?void 0:h.call(f,T,null,this.state.variables,this.state.context,this,r)),await((g=(m=this.options).onSettled)==null?void 0:g.call(m,T,null,t,this.state.context,r)),Me(this,Ds,Wi).call(this,{type:"success",data:T}),T}catch(T){try{await((x=(v=A(this,Cn).config).onError)==null?void 0:x.call(v,T,t,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((b=(w=this.options).onError)==null?void 0:b.call(w,T,t,this.state.context,r))}catch(O){Promise.reject(O)}try{await((S=(C=A(this,Cn).config).onSettled)==null?void 0:S.call(C,void 0,T,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,T,t,this.state.context,r))}catch(O){Promise.reject(O)}throw Me(this,Ds,Wi).call(this,{type:"error",error:T}),T}finally{A(this,Cn).runNext(this)}}},xf=new WeakMap,Is=new WeakMap,Cn=new WeakMap,Al=new WeakMap,Ds=new WeakSet,Wi=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),_t.batch(()=>{A(this,Is).forEach(r=>{r.onMutationUpdate(t)}),A(this,Cn).notify({mutation:this,type:"updated",action:t})})},rM);function qP(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var vi,ns,vf,sM,vB=(sM=class extends la{constructor(t={}){super();he(this,vi);he(this,ns);he(this,vf);this.config=t,oe(this,vi,new Set),oe(this,ns,new Map),oe(this,vf,0)}build(t,n,r){const s=new xB({client:t,mutationCache:this,mutationId:++Zf(this,vf)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){A(this,vi).add(t);const n=mh(t);if(typeof n=="string"){const r=A(this,ns).get(n);r?r.push(t):A(this,ns).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(A(this,vi).delete(t)){const n=mh(t);if(typeof n=="string"){const r=A(this,ns).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&A(this,ns).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=mh(t);if(typeof n=="string"){const r=A(this,ns).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=mh(t);if(typeof n=="string"){const s=(r=A(this,ns).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(){_t.batch(()=>{A(this,vi).forEach(t=>{this.notify({type:"removed",mutation:t})}),A(this,vi).clear(),A(this,ns).clear()})}getAll(){return Array.from(A(this,vi))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>bE(n,r))}findAll(t={}){return this.getAll().filter(n=>bE(t,n))}notify(t){_t.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return _t.batch(()=>Promise.all(t.map(n=>n.continue().catch(Nn))))}},vi=new WeakMap,ns=new WeakMap,vf=new WeakMap,sM);function mh(e){var t;return(t=e.options.scope)==null?void 0:t.id}var wi,fo,Zn,bi,Ai,cp,H0,iM,wB=(iM=class extends la{constructor(n,r){super();he(this,Ai);he(this,wi);he(this,fo);he(this,Zn);he(this,bi);oe(this,wi,n),this.setOptions(r),this.bindMethods(),Me(this,Ai,cp).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=A(this,wi).defaultMutationOptions(n),Qd(this.options,r)||A(this,wi).getMutationCache().notify({type:"observerOptionsUpdated",mutation:A(this,Zn),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Bo(r.mutationKey)!==Bo(this.options.mutationKey)?this.reset():((s=A(this,Zn))==null?void 0:s.state.status)==="pending"&&A(this,Zn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=A(this,Zn))==null||n.removeObserver(this)}onMutationUpdate(n){Me(this,Ai,cp).call(this),Me(this,Ai,H0).call(this,n)}getCurrentResult(){return A(this,fo)}reset(){var n;(n=A(this,Zn))==null||n.removeObserver(this),oe(this,Zn,void 0),Me(this,Ai,cp).call(this),Me(this,Ai,H0).call(this)}mutate(n,r){var s;return oe(this,bi,r),(s=A(this,Zn))==null||s.removeObserver(this),oe(this,Zn,A(this,wi).getMutationCache().build(A(this,wi),this.options)),A(this,Zn).addObserver(this),A(this,Zn).execute(n)}},wi=new WeakMap,fo=new WeakMap,Zn=new WeakMap,bi=new WeakMap,Ai=new WeakSet,cp=function(){var r;const n=((r=A(this,Zn))==null?void 0:r.state)??qP();oe(this,fo,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},H0=function(n){_t.batch(()=>{var r,s,i,o,l,a,u,c;if(A(this,bi)&&this.hasListeners()){const d=A(this,fo).variables,f=A(this,fo).context,h={client:A(this,wi),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(r=A(this,bi)).onSuccess)==null||s.call(r,n.data,d,f,h)}catch(m){Promise.reject(m)}try{(o=(i=A(this,bi)).onSettled)==null||o.call(i,n.data,null,d,f,h)}catch(m){Promise.reject(m)}}else if((n==null?void 0:n.type)==="error"){try{(a=(l=A(this,bi)).onError)==null||a.call(l,n.error,d,f,h)}catch(m){Promise.reject(m)}try{(c=(u=A(this,bi)).onSettled)==null||c.call(u,void 0,n.error,d,f,h)}catch(m){Promise.reject(m)}}}this.listeners.forEach(d=>{d(A(this,fo))})})},iM);function RE(e,t){const n=new Set(t);return e.filter(r=>!n.has(r))}function bB(e,t,n){const r=e.slice(0);return r[t]=n,r}var bu,cr,ku,Su,Pr,ho,wf,bf,kf,Sf,gn,U0,q0,W0,K0,Q0,oM,kB=(oM=class extends la{constructor(t,n,r){super();he(this,gn);he(this,bu);he(this,cr);he(this,ku);he(this,Su);he(this,Pr);he(this,ho);he(this,wf);he(this,bf);he(this,kf);he(this,Sf,[]);oe(this,bu,t),oe(this,Su,r),oe(this,ku,[]),oe(this,Pr,[]),oe(this,cr,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&A(this,Pr).forEach(t=>{t.subscribe(n=>{Me(this,gn,K0).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,A(this,Pr).forEach(t=>{t.destroy()})}setQueries(t,n){oe(this,ku,t),oe(this,Su,n),_t.batch(()=>{const r=A(this,Pr),s=Me(this,gn,W0).call(this,A(this,ku));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,f)=>d!==r[f]),u=l||a,c=u?!0:o.some((d,f)=>{const h=A(this,cr)[f];return!h||!Qd(d,h)});!u&&!c||(u&&(oe(this,Sf,s),oe(this,Pr,i)),oe(this,cr,o),this.hasListeners()&&(u&&(RE(r,i).forEach(d=>{d.destroy()}),RE(i,r).forEach(d=>{d.subscribe(f=>{Me(this,gn,K0).call(this,d,f)})})),Me(this,gn,Q0).call(this)))})}getCurrentResult(){return A(this,cr)}getQueries(){return A(this,Pr).map(t=>t.getCurrentQuery())}getObservers(){return A(this,Pr)}getOptimisticResult(t,n){const r=Me(this,gn,W0).call(this,t),s=r.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),i=r.map(o=>o.defaultedQueryOptions.queryHash);return[s,o=>Me(this,gn,q0).call(this,o??s,n,i),()=>Me(this,gn,U0).call(this,s,r)]}},bu=new WeakMap,cr=new WeakMap,ku=new WeakMap,Su=new WeakMap,Pr=new WeakMap,ho=new WeakMap,wf=new WeakMap,bf=new WeakMap,kf=new WeakMap,Sf=new WeakMap,gn=new WeakSet,U0=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)})})})},q0=function(t,n,r){if(n){const s=A(this,kf),i=r!==void 0&&s!==void 0&&(s.length!==r.length||r.some((o,l)=>o!==s[l]));return(!A(this,ho)||A(this,cr)!==A(this,bf)||i||n!==A(this,wf))&&(oe(this,wf,n),oe(this,bf,A(this,cr)),r!==void 0&&oe(this,kf,r),oe(this,ho,kk(A(this,ho),n(t)))),A(this,ho)}return t},W0=function(t){const n=new Map;A(this,Pr).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=A(this,bu).defaultQueryOptions(s),l=((a=n.get(i.queryHash))==null?void 0:a.shift())??new Of(A(this,bu),i);r.push({defaultedQueryOptions:i,observer:l})}),r},K0=function(t,n){const r=A(this,Pr).indexOf(t);r!==-1&&(oe(this,cr,bB(A(this,cr),r,n)),Me(this,gn,Q0).call(this))},Q0=function(){var t;if(this.hasListeners()){const n=A(this,ho),r=Me(this,gn,U0).call(this,A(this,cr),A(this,Sf)),s=Me(this,gn,q0).call(this,r,(t=A(this,Su))==null?void 0:t.combine);n!==s&&_t.batch(()=>{this.listeners.forEach(i=>{i(A(this,cr))})})}},oM),Ls,lM,SB=(lM=class extends la{constructor(t={}){super();he(this,Ls);this.config=t,oe(this,Ls,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??bk(s,n);let o=this.get(i);return o||(o=new hB({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){A(this,Ls).has(t.queryHash)||(A(this,Ls).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=A(this,Ls).get(t.queryHash);n&&(t.destroy(),n===t&&A(this,Ls).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){_t.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return A(this,Ls).get(t)}getAll(){return[...A(this,Ls).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>wE(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>wE(t,r)):n}notify(t){_t.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){_t.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){_t.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ls=new WeakMap,lM),Ot,po,mo,Cu,Eu,go,Nu,Tu,aM,CB=(aM=class{constructor(e={}){he(this,Ot);he(this,po);he(this,mo);he(this,Cu);he(this,Eu);he(this,go);he(this,Nu);he(this,Tu);oe(this,Ot,e.queryCache||new SB),oe(this,po,e.mutationCache||new vB),oe(this,mo,e.defaultOptions||{}),oe(this,Cu,new Map),oe(this,Eu,new Map),oe(this,go,0)}mount(){Zf(this,go)._++,A(this,go)===1&&(oe(this,Nu,Ck.subscribe(async e=>{e&&(await this.resumePausedMutations(),A(this,Ot).onFocus())})),oe(this,Tu,tm.subscribe(async e=>{e&&(await this.resumePausedMutations(),A(this,Ot).onOnline())})))}unmount(){var e,t;Zf(this,go)._--,A(this,go)===0&&((e=A(this,Nu))==null||e.call(this),oe(this,Nu,void 0),(t=A(this,Tu))==null||t.call(this),oe(this,Tu,void 0))}isFetching(e){return A(this,Ot).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return A(this,po).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=A(this,Ot).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=A(this,Ot).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Po(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return A(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=A(this,Ot).get(r.queryHash),i=s==null?void 0:s.state.data,o=nB(t,i);if(o!==void 0)return A(this,Ot).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return _t.batch(()=>A(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=A(this,Ot).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=A(this,Ot);_t.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=A(this,Ot);return _t.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=_t.batch(()=>A(this,Ot).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Nn).catch(Nn)}invalidateQueries(e,t={}){return _t.batch(()=>(A(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=_t.batch(()=>A(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=A(this,Ot).build(this,t);return n.isStaleByTime(Po(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=nm(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Nn).catch(Nn)}ensureInfiniteQueryData(e){return e.behavior=nm(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return tm.isOnline()?A(this,po).resumePausedMutations():Promise.resolve()}getQueryCache(){return A(this,Ot)}getMutationCache(){return A(this,po)}getDefaultOptions(){return A(this,mo)}setDefaultOptions(e){oe(this,mo,e)}setQueryDefaults(e,t){A(this,Cu).set(Bo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...A(this,Cu).values()],n={};return t.forEach(r=>{Kd(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){A(this,Eu).set(Bo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...A(this,Eu).values()],n={};return t.forEach(r=>{Kd(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...A(this,mo).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=bk(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===fr&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...A(this,mo).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){A(this,Ot).clear(),A(this,po).clear()}},Ot=new WeakMap,po=new WeakMap,mo=new WeakMap,Cu=new WeakMap,Eu=new WeakMap,go=new WeakMap,Nu=new WeakMap,Tu=new WeakMap,aM),WP=y.createContext(void 0),Fi=e=>{const t=y.useContext(WP);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},EB=({client:e,children:t})=>(y.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(WP.Provider,{value:e,children:t})),KP=y.createContext(!1),QP=()=>y.useContext(KP);KP.Provider;function NB(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var TB=y.createContext(NB()),GP=()=>y.useContext(TB),JP=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Sk(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},ZP=e=>{y.useEffect(()=>{e.clearReset()},[e])},YP=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Sk(n,[e.error,r])),Nk=(e,t)=>t.state.data===void 0,XP=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))}},eA=(e,t)=>e.isLoading&&e.isFetching&&!t,G0=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,rm=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function tA({queries:e,...t},n){const r=Fi(n),s=QP(),i=GP(),o=y.useMemo(()=>e.map(g=>{const v=r.defaultQueryOptions(g);return v._optimisticResults=s?"isRestoring":"optimistic",v}),[e,r,s]);o.forEach(g=>{XP(g);const v=r.getQueryCache().get(g.queryHash);JP(g,i,v)}),ZP(i);const[l]=y.useState(()=>new kB(r,o,t)),[a,u,c]=l.getOptimisticResult(o,t.combine),d=!s&&t.subscribed!==!1;y.useSyncExternalStore(y.useCallback(g=>d?l.subscribe(_t.batchCalls(g)):Nn,[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),y.useEffect(()=>{l.setQueries(o,t)},[o,t,l]);const h=a.some((g,v)=>G0(o[v],g))?a.flatMap((g,v)=>{const x=o[v];if(x){const w=new Of(r,x);if(G0(x,g))return rm(x,w,i);eA(g,s)&&rm(x,w,i)}return[]}):[];if(h.length>0)throw Promise.all(h);const m=a.find((g,v)=>{const x=o[v];return x&&YP({result:g,errorResetBoundary:i,throwOnError:x.throwOnError,query:r.getQueryCache().get(x.queryHash),suspense:x.suspense})});if(m!=null&&m.error)throw m.error;return u(c())}function zg(e,t,n){var f,h,m,g;const r=QP(),s=GP(),i=Fi(n),o=i.defaultQueryOptions(e);(h=(f=i.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||h.call(f,o);const l=i.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",XP(o),JP(o,s,l),ZP(s);const a=!i.getQueryCache().get(o.queryHash),[u]=y.useState(()=>new t(i,o)),c=u.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(y.useSyncExternalStore(y.useCallback(v=>{const x=d?u.subscribe(_t.batchCalls(v)):Nn;return u.updateResult(),x},[u,d]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),y.useEffect(()=>{u.setOptions(o)},[o,u]),G0(o,c))throw rm(o,u,s);if(YP({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&&!Kl&&eA(c,r)){const v=a?rm(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 Pf(e,t){return zg(e,Of,t)}function RB(e,t){return zg({...e,enabled:!0,suspense:!0,throwOnError:Nk,placeholderData:void 0},Of,t)}function jB(e,t){return zg({...e,enabled:!0,suspense:!0,throwOnError:Nk},UP,t)}function MB(e,t){return tA({...e,queries:e.queries.map(n=>({...n,suspense:!0,throwOnError:Nk,enabled:!0,placeholderData:void 0}))},t)}function OB(e,t){const n=Fi(t);n.getQueryState(e.queryKey)||n.prefetchQuery(e)}function PB(e,t){const n=Fi(t);n.getQueryState(e.queryKey)||n.prefetchInfiniteQuery(e)}function hi(e,t){const n=Fi(t),[r]=y.useState(()=>new wB(n,e));y.useEffect(()=>{r.setOptions(e)},[r,e]);const s=y.useSyncExternalStore(y.useCallback(o=>r.subscribe(_t.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=y.useCallback((o,l)=>{r.mutate(o,l).catch(Nn)},[r]);if(s.error&&Sk(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}function AB(e,t){return zg(e,UP,t)}function Ql(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function _B(){return Object.create(null)}const IB=typeof Symbol=="function"&&!!Symbol.asyncIterator;function nA(e){return IB&&Ql(e)&&Symbol.asyncIterator in e}var DB=Object.create,rA=Object.defineProperty,LB=Object.getOwnPropertyDescriptor,sA=Object.getOwnPropertyNames,$B=Object.getPrototypeOf,zB=Object.prototype.hasOwnProperty,Af=(e,t)=>function(){return t||(0,e[sA(e)[0]])((t={exports:{}}).exports,t),t.exports},FB=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var s=sA(t),i=0,o=s.length,l;i<o;i++)l=s[i],!zB.call(e,l)&&l!==n&&rA(e,l,{get:(a=>t[a]).bind(null,l),enumerable:!(r=LB(t,l))||r.enumerable});return e},Fg=(e,t,n)=>(n=e!=null?DB($B(e)):{},FB(rA(n,"default",{value:e,enumerable:!0}),e));const iA=()=>{},jE=e=>{Object.freeze&&Object.freeze(e)};function oA(e,t,n){var r;const s=t.join(".");return(r=n[s])!==null&&r!==void 0||(n[s]=new Proxy(iA,{get(i,o){if(!(typeof o!="string"||o==="then"))return oA(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)}),jE(u.args),jE(u.path),e(u)}})),n[s]}const Bg=e=>oA(e,[],_B()),Tk=e=>new Proxy(iA,{get(t,n){if(n!=="then")return e(n)}});var lA=Af({"../../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}}),BB=Af({"../../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}}),VB=Af({"../../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=BB();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=Af({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=VB();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}}),Rk=Af({"../../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}});Fg(Rk());Fg(aA());var gh=Fg(Rk());function HB(e,t){if("error"in e){const r=t.deserialize(e.error);return{ok:!1,error:(0,gh.default)((0,gh.default)({},e),{},{error:r})}}return{ok:!0,result:(0,gh.default)((0,gh.default)({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var cx=class extends Error{constructor(){super("Unable to transform response from server")}};function UB(e,t){let n;try{n=HB(e,t)}catch{throw new cx}if(!n.ok&&(!Ql(n.error.error)||typeof n.error.error.code!="number"))throw new cx;if(n.ok&&!Ql(n.result))throw new cx;return n}Fg(Rk());function Vg(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(qB,t)}};return t}function qB(e,t){return t(e)}function WB(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 KB=Object.create,uA=Object.defineProperty,QB=Object.getOwnPropertyDescriptor,cA=Object.getOwnPropertyNames,GB=Object.getPrototypeOf,JB=Object.prototype.hasOwnProperty,tl=(e,t)=>function(){return t||(0,e[cA(e)[0]])((t={exports:{}}).exports,t),t.exports},ZB=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var s=cA(t),i=0,o=s.length,l;i<o;i++)l=s[i],!JB.call(e,l)&&l!==n&&uA(e,l,{get:(a=>t[a]).bind(null,l),enumerable:!(r=QB(t,l))||r.enumerable});return e},aa=(e,t,n)=>(n=e!=null?KB(GB(e)):{},ZB(t||!e||!e.__esModule?uA(n,"default",{value:e,enumerable:!0}):n,e)),YB=tl({"../../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}}),XB=tl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(e,t){var n=YB();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}}),dA=tl({"../../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}}),eV=tl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=dA().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}}),tV=tl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=dA().default,r=eV();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}}),nV=tl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=tV();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}}),_f=tl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=nV();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}}),rV=aa(XB(),1),ME=aa(_f(),1);const sV=["cursor","direction"];function _s(e,t,n){const r=e.flatMap(s=>s.split("."));if(!t&&(!n||n==="any"))return r.length?[r]:[];if(n==="infinite"&&Ql(t)&&("direction"in t||"cursor"in t)){const{cursor:s,direction:i}=t,o=(0,rV.default)(t,sV);return[r,{input:o,type:"infinite"}]}return[r,(0,ME.default)((0,ME.default)({},typeof t<"u"&&t!==fr&&{input:t}),n&&n!=="any"&&{type:n})]}function dp(e){return _s(e,void 0,"any")}var iV=Object.create,fA=Object.defineProperty,oV=Object.getOwnPropertyDescriptor,hA=Object.getOwnPropertyNames,lV=Object.getPrototypeOf,aV=Object.prototype.hasOwnProperty,Ys=(e,t)=>function(){return t||(0,e[hA(e)[0]])((t={exports:{}}).exports,t),t.exports},uV=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var s=hA(t),i=0,o=s.length,l;i<o;i++)l=s[i],!aV.call(e,l)&&l!==n&&fA(e,l,{get:(a=>t[a]).bind(null,l),enumerable:!(r=oV(t,l))||r.enumerable});return e},Lt=(e,t,n)=>(n=e!=null?iV(lV(e)):{},uV(fA(n,"default",{value:e,enumerable:!0}),e)),pA=Ys({"../../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}}),cV=Ys({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=pA().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}}),dV=Ys({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=pA().default,r=cV();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}}),ua=Ys({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=dV();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}}),ks=Ys({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=ua();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 fV(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 Vg(l=>(n++,s.push(l),i(),{unsubscribe(){n--,o();const a=s.findIndex(u=>u===l);a>-1&&s.splice(a,1)}}))}}function hV(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=Vg(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 pV(e){return Vg(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 yh=Lt(ua()),wa=Lt(ks());function mV(e){return e instanceof sm}function gV(e){return Ql(e)&&Ql(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function yV(e,t){return typeof e=="string"?e:Ql(e)&&typeof e.message=="string"?e.message:t}var sm=class fp extends Error{constructor(t,n){var r,s;const i=n==null?void 0:n.cause;super(t,{cause:i}),(0,yh.default)(this,"cause",void 0),(0,yh.default)(this,"shape",void 0),(0,yh.default)(this,"data",void 0),(0,yh.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,fp.prototype)}static from(t,n={}){const r=t;return mV(r)?(n.meta&&(r.meta=(0,wa.default)((0,wa.default)({},r.meta),n.meta)),r):gV(r)?new fp(r.error.message,(0,wa.default)((0,wa.default)({},n),{},{result:r})):new fp(yV(r,"Unknown error"),(0,wa.default)((0,wa.default)({},n),{},{cause:r}))}};function xV(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 OE=e=>typeof e=="function";function vV(e){if(e)return e;if(typeof window<"u"&&OE(window.fetch))return window.fetch;if(typeof globalThis<"u"&&OE(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var ud=Lt(ks());function wV(e){return{url:e.url.toString(),fetch:e.fetch,transformer:xV(e.transformer),methodOverride:e.methodOverride}}function bV(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}const kV={query:"GET",mutation:"POST",subscription:"PATCH"};function mA(e){return"input"in e?e.transformer.input.serialize(e.input):bV(e.inputs.map(t=>e.transformer.input.serialize(t)))}const gA=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=mA(e);i!==void 0&&e.methodOverride!=="POST"&&s.push(`input=${encodeURIComponent(JSON.stringify(i))}`)}return s.length&&(r+="?"+s.join("&")),r},SV=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=mA(e);return t!==void 0?JSON.stringify(t):void 0},CV=e=>RV((0,ud.default)((0,ud.default)({},e),{},{contentTypeHeader:"application/json",getUrl:gA,getBody:SV}));var EV=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const NV=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 EV};async function TV(e){var t;NV(e.signal);const n=e.getUrl(e),r=e.getBody(e),s=(t=e.methodOverride)!==null&&t!==void 0?t:kV[e.type],i=await(async()=>{const l=await e.headers();return Symbol.iterator in l?Object.fromEntries(l):l})(),o=(0,ud.default)((0,ud.default)((0,ud.default)({},e.contentTypeHeader&&s!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{"trpc-accept":e.trpcAcceptHeader}:void 0),i);return vV(e.fetch)(n,{method:s,signal:e.signal,body:r,headers:o})}async function RV(e){const t={},n=await TV(e);t.response=n;const r=await n.json();return t.responseJSON=r,{json:r,meta:t}}Lt(ks());const PE=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function AE(e){let t=null,n=null;const r=()=>{clearTimeout(n),n=null,t=null};function s(l){const a=[[]];let u=0;for(;;){const f=l[u];if(!f)break;const h=a[a.length-1];if(f.aborted){var c;(c=f.reject)===null||c===void 0||c.call(f,new Error("Aborted")),u++;continue}if(e.validate(h.concat(f).map(g=>g.key))){h.push(f),u++;continue}if(h.length===0){var d;(d=f.reject)===null||d===void 0||d.call(f,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(h,m)=>{const g=u.items[m];try{var v;const w=await Promise.resolve(h);(v=g.resolve)===null||v===void 0||v.call(g,w)}catch(w){var x;(x=g.reject)===null||x===void 0||x.call(g,w)}g.batch=null,g.reject=null,g.resolve=null}));for(const h of u.items){var f;(f=h.reject)===null||f===void 0||f.call(h,new Error("Missing result")),h.batch=null}}).catch(d=>{for(const h of u.items){var f;(f=h.reject)===null||f===void 0||f.call(h,d),h.batch=null}})}}function o(l){var a;const u={aborted:!1,key:l,batch:null,resolve:PE,reject:PE},c=new Promise((d,f)=>{var h;u.reject=f,u.resolve=d,(h=t)!==null&&h!==void 0||(t=[]),t.push(u)});return(a=n)!==null&&a!==void 0||(n=setTimeout(i)),c}return{load:o}}function jV(...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 xh=Lt(ks());function MV(e){var t,n;const r=wV(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 f=d.map(g=>g.path).join(","),h=d.map(g=>g.input);return gA((0,xh.default)((0,xh.default)({},r),{},{type:c,path:f,inputs:h,signal:null})).length<=s},async fetch(d){const f=d.map(w=>w.path).join(","),h=d.map(w=>w.input),m=jV(...d.map(w=>w.signal)),g=await CV((0,xh.default)((0,xh.default)({},r),{},{path:f,inputs:h,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=AE(o("query")),a=AE(o("mutation")),u={query:l,mutation:a};return({op:c})=>Vg(d=>{/* istanbul ignore if -- @preserve */if(c.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const h=u[c.type].load(c);let m;return h.then(g=>{m=g;const v=UB(g.json,r.transformer.output);if(!v.ok){d.error(sm.from(v.error,{meta:g.meta}));return}d.next({context:g.meta,result:v.result}),d.complete()}).catch(g=>{d.error(sm.from(g,{meta:m==null?void 0:m.meta}))}),()=>{}})}}Lt(ks());const yA=(e,...t)=>typeof e=="function"?e(...t):e;Lt(ua());function OV(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}async function PV(e){const t=await yA(e.url);if(!e.connectionParams)return t;const r=`${t.includes("?")?"&":"?"}connectionParams=1`;return t+r}async function AV(e){const t={method:"connectionParams",data:await yA(e)};return JSON.stringify(t)}Lt(ua());var pl=Lt(ua());function _V(e){const{promise:t,resolve:n,reject:r}=OV();return e.addEventListener("open",()=>{e.removeEventListener("error",r),n()}),e.addEventListener("error",r),t}function IV(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 DV=class J0{constructor(t){var n;if((0,pl.default)(this,"id",++J0.connectCount),(0,pl.default)(this,"WebSocketPonyfill",void 0),(0,pl.default)(this,"urlOptions",void 0),(0,pl.default)(this,"keepAliveOpts",void 0),(0,pl.default)(this,"wsObservable",hV(null)),(0,pl.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=++J0.connectCount;const n=PV(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&&IV(r,t.keepAliveOpts),r.addEventListener("close",()=>{t.ws===r&&(t.ws=null)}),await _V(r),t.urlOptions.connectionParams&&r.send(await AV(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,pl.default)(DV,"connectCount",0);Lt(ua());Lt(ks());var dx=Lt(ua()),_E=Lt(ks()),Hg=class{constructor(e){(0,dx.default)(this,"links",void 0),(0,dx.default)(this,"runtime",void 0),(0,dx.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return pV({links:this.links,op:(0,_E.default)((0,_E.default)({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(fV())}async requestAsPromise(e){var t=this;try{const n=t.$request(e);return(await WB(n)).result.data}catch(n){throw sm.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 xA=Symbol.for("trpc_untypedClient"),LV={query:"query",mutate:"mutation",subscribe:"subscription"},$V=e=>LV[e];function vA(e){const t=Bg(({path:n,args:r})=>{const s=[...n],i=$V(s.pop()),o=s.join(".");return e[i](o,...r)});return Tk(n=>n===xA?e:t[n])}function zV(e){const t=new Hg(e);return vA(t)}function jk(e){return e[xA]}Lt(ks());Lt(ks());var FV=Ys({"../../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}});Lt(FV());Lt(ks());var BV=Ys({"../../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(f){return Promise.reject(f)}}),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 h=a.d.call(a.v);if(a.a)return c|=2,Promise.resolve(h).then(d,f)}else c|=1}catch(m){return f(m)}if(c===1)return u!==s?Promise.reject(u):Promise.resolve();if(u!==s)throw u}function f(h){return u=u!==s?new r(h,u):h,d()}return d()}}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),wA=Ys({"../../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}}),VV=Ys({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var n=wA();function r(s){return new n(s,0)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),HV=Ys({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var n=wA();function r(i){return function(){return new s(i.apply(this,arguments))}}function s(i){var o,l;function a(c,d){try{var f=i[c](d),h=f.value,m=h instanceof n;Promise.resolve(m?h.v:h).then(function(g){if(m){var v=c==="return"?"return":"next";if(!h.k||g.done)return a(v,g);g=i[v](g).value}u(f.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(f,h){var m={key:c,arg:d,resolve:f,reject:h,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}});Lt(BV());Lt(VV());Lt(HV());Lt(ks());function UV(e){return Bg(({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 fx;const qV=["client","ssrContext","ssrState","abortOnUnmount"],WV=(fx=y.createContext)===null||fx===void 0?void 0:fx.call(Ef,null),KV=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 QV(e){return Bg(t=>{const n=[...t.path],r=n.pop(),s=[...t.args],i=s.shift(),o=KV(r),l=_s(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(dp(n),i),getMutationDefaults:()=>e.getMutationDefaults(dp(n)),isMutating:()=>e.isMutating({mutationKey:dp(n)})}[r]()})}function GV(e){const t=vA(e.client),n=QV(e);return Tk(r=>{const s=r;return s==="client"?t:qV.includes(s)?e[s]:n[r]})}var JV=aa(_f(),1);function IE(e){const t=e instanceof Hg?e:jk(e);return Bg(n=>{const r=n.path,s=r.join("."),[i,o]=n.args;return(0,JV.default)({queryKey:_s(r,i,"query"),queryFn:()=>t.query(s,i,o==null?void 0:o.trpc)},o)})}var hx=aa(_f(),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,hx.default)((0,hx.default)((0,hx.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 ZV=tl({"../../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}}),YV=aa(ZV(),1);function Z0(e){return{path:e.path.join(".")}}function Tc(e){const t=Z0(e);return y.useMemo(()=>t,[t])}async function bA(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,YV.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 et=aa(_f(),1);function XV(e){const{client:t,queryClient:n}=e,r=t instanceof Hg?t:jk(t);return{infiniteQueryOptions:(s,i,o)=>{var l,a;const u=((l=i[1])===null||l===void 0?void 0:l.input)===fr,c=async d=>{var f;const h=(0,et.default)((0,et.default)({},o),{},{trpc:(0,et.default)((0,et.default)({},o==null?void 0:o.trpc),!(o==null||(f=o.trpc)===null||f===void 0)&&f.abortOnUnmount?{signal:d.signal}:{signal:null})});return await r.query(...Ln(i,h,{direction:d.direction,pageParam:d.pageParam}))};return Object.assign((0,et.default)((0,et.default)({},o),{},{initialData:o==null?void 0:o.initialData,queryKey:i,queryFn:u?fr:c,initialPageParam:(a=o==null?void 0:o.initialCursor)!==null&&a!==void 0?a:null}),{trpc:Z0({path:s})})},queryOptions:(s,i,o)=>{var l;const a=((l=i[1])===null||l===void 0?void 0:l.input)===fr,u=async c=>{var d;const f=(0,et.default)((0,et.default)({},o),{},{trpc:(0,et.default)((0,et.default)({},o==null?void 0:o.trpc),!(o==null||(d=o.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:c.signal}:{signal:null})}),h=await r.query(...Ln(i,f));return nA(h)?bA(h,n,i):h};return Object.assign((0,et.default)((0,et.default)({},o),{},{initialData:o==null?void 0:o.initialData,queryKey:i,queryFn:a?fr:u}),{trpc:Z0({path:s})})},fetchQuery:(s,i)=>n.fetchQuery((0,et.default)((0,et.default)({},i),{},{queryKey:s,queryFn:()=>r.query(...Ln(s,i))})),fetchInfiniteQuery:(s,i)=>{var o;return n.fetchInfiniteQuery((0,et.default)((0,et.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,et.default)((0,et.default)({},i),{},{queryKey:s,queryFn:()=>r.query(...Ln(s,i))})),prefetchInfiniteQuery:(s,i)=>{var o;return n.prefetchInfiniteQuery((0,et.default)((0,et.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,et.default)((0,et.default)({},i),{},{queryKey:s,queryFn:()=>r.query(...Ln(s,i))})),invalidateQueries:(s,i,o)=>n.invalidateQueries((0,et.default)((0,et.default)({},i),{},{queryKey:s}),o),resetQueries:(s,i,o)=>n.resetQueries((0,et.default)((0,et.default)({},i),{},{queryKey:s}),o),refetchQueries:(s,i,o)=>n.refetchQueries((0,et.default)((0,et.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,et.default)((0,et.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,et.default)((0,et.default)({},s),{},{exact:!0}))}}var ce=aa(_f());const DE=(e,t)=>new Proxy(e,{get(r,s){return t(s),r[s]}});function eH(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:WV,i=zV,o=S=>{var k;const{abortOnUnmount:E=!1,queryClient:T,ssrContext:O}=S,[N,j]=y.useState((k=S.ssrState)!==null&&k!==void 0?k:!1),P=S.client instanceof Hg?S.client:jk(S.client),z=y.useMemo(()=>XV({client:P,queryClient:T}),[P,T]),I=y.useMemo(()=>(0,ce.default)({abortOnUnmount:E,queryClient:T,client:P,ssrContext:O??null,ssrState:N},z),[E,P,z,T,O,N]);return y.useEffect(()=>{j(L=>L?"mounted":!1)},[]),p.jsx(s.Provider,{value:I,children:S.children})};function l(){const S=y.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:T,ssrState:O}=l();return O&&O!=="mounted"&&((E=T.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 T,O,N,j,P;const z=l(),{abortOnUnmount:I,client:L,ssrState:H,queryClient:K,prefetchQuery:_}=z,Q=_s(S,k,"query"),M=K.getQueryDefaults(Q),ie=k===fr;typeof window>"u"&&H==="prepass"&&(E==null||(T=E.trpc)===null||T===void 0?void 0:T.ssr)!==!1&&((O=E==null?void 0:E.enabled)!==null&&O!==void 0?O:M==null?void 0:M.enabled)!==!1&&!ie&&!K.getQueryCache().find({queryKey:Q})&&_(Q,E);const V=a(Q,(0,ce.default)((0,ce.default)({},M),E)),R=(N=(j=E==null||(P=E.trpc)===null||P===void 0?void 0:P.abortOnUnmount)!==null&&j!==void 0?j:void 0)!==null&&N!==void 0?N:I,D=Pf((0,ce.default)((0,ce.default)({},V),{},{queryKey:Q,queryFn:ie?k:async F=>{const Y=(0,ce.default)((0,ce.default)({},V),{},{trpc:(0,ce.default)((0,ce.default)({},V==null?void 0:V.trpc),R?{signal:F.signal}:{signal:null})}),G=await L.query(...Ln(Q,Y));return nA(G)?bA(G,K,Q):G}}),K);return D.trpc=Tc({path:S}),D}function c(S,k,E){var T,O,N;const j=l(),P=_s(S,k,"query"),z=k===fr,I=(T=(O=E==null||(N=E.trpc)===null||N===void 0?void 0:N.abortOnUnmount)!==null&&O!==void 0?O:void 0)!==null&&T!==void 0?T:j.abortOnUnmount;OB((0,ce.default)((0,ce.default)({},E),{},{queryKey:P,queryFn:z?k:L=>{const H={trpc:(0,ce.default)((0,ce.default)({},E==null?void 0:E.trpc),I?{signal:L.signal}:{})};return j.client.query(...Ln(P,H))}}))}function d(S,k,E){var T,O,N;const j=l(),P=_s(S,k,"query"),z=(T=(O=E==null||(N=E.trpc)===null||N===void 0?void 0:N.abortOnUnmount)!==null&&O!==void 0?O:void 0)!==null&&T!==void 0?T:j.abortOnUnmount,I=RB((0,ce.default)((0,ce.default)({},E),{},{queryKey:P,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(P,H))}}),j.queryClient);return I.trpc=Tc({path:S}),[I.data,I]}function f(S,k){const{client:E,queryClient:T}=l(),O=dp(S),N=T.defaultMutationOptions(T.getMutationDefaults(O)),j=hi((0,ce.default)((0,ce.default)({},k),{},{mutationKey:O,mutationFn:P=>E.mutation(...Ln([S,{input:P}],k)),onSuccess(...P){var z,I;return r({originalFn:()=>{var H,K,_;return(H=k==null||(K=k.onSuccess)===null||K===void 0?void 0:K.call(k,...P))!==null&&H!==void 0?H:N==null||(_=N.onSuccess)===null||_===void 0?void 0:_.call(N,...P)},queryClient:T,meta:(z=(I=k==null?void 0:k.meta)!==null&&I!==void 0?I:N==null?void 0:N.meta)!==null&&z!==void 0?z:{}})}}),T);return j.trpc=Tc({path:S}),j}const h={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 T;const O=(T=E==null?void 0:E.enabled)!==null&&T!==void 0?T:k!==fr,N=Bo(_s(S,k,"any")),{client:j}=l(),P=y.useRef(E);y.useEffect(()=>{P.current=E});const[z]=y.useState(new Set([])),I=y.useCallback(ie=>{z.add(ie)},[z]),L=y.useRef(null),H=y.useCallback(ie=>{const V=_.current,R=_.current=ie(V);let D=!1;for(const F of z)if(V[F]!==R[F]){D=!0;break}D&&M(DE(R,I))},[I,z]),K=y.useCallback(()=>{var ie;if((ie=L.current)===null||ie===void 0||ie.unsubscribe(),!O){H(()=>(0,ce.default)((0,ce.default)({},h),{},{reset:K}));return}H(()=>(0,ce.default)((0,ce.default)({},m),{},{reset:K}));const V=j.subscription(S.join("."),k??void 0,{onStarted:()=>{var R,D;(R=(D=P.current).onStarted)===null||R===void 0||R.call(D),H(F=>(0,ce.default)((0,ce.default)({},F),{},{status:"pending",error:null}))},onData:R=>{var D,F;(D=(F=P.current).onData)===null||D===void 0||D.call(F,R),H(Y=>(0,ce.default)((0,ce.default)({},Y),{},{status:"pending",data:R,error:null}))},onError:R=>{var D,F;(D=(F=P.current).onError)===null||D===void 0||D.call(F,R),H(Y=>(0,ce.default)((0,ce.default)({},Y),{},{status:"error",error:R}))},onConnectionStateChange:R=>{H(D=>{switch(R.state){case"idle":return(0,ce.default)((0,ce.default)({},D),{},{status:R.state,error:null,data:void 0});case"connecting":return(0,ce.default)((0,ce.default)({},D),{},{error:R.error,status:R.state});case"pending":return D}})},onComplete:()=>{var R,D;(R=(D=P.current).onComplete)===null||R===void 0||R.call(D),H(F=>(0,ce.default)((0,ce.default)({},F),{},{status:"idle",error:null,data:void 0}))}});L.current=V},[j,N,O,H]);y.useEffect(()=>(K(),()=>{var ie;(ie=L.current)===null||ie===void 0||ie.unsubscribe()}),[K]);const _=y.useRef(O?(0,ce.default)((0,ce.default)({},m),{},{reset:K}):(0,ce.default)((0,ce.default)({},h),{},{reset:K})),[Q,M]=y.useState(DE(_.current,I));return Q}function v(S,k,E){var T,O,N,j,P;const{client:z,ssrState:I,prefetchInfiniteQuery:L,queryClient:H,abortOnUnmount:K}=l(),_=_s(S,k,"infinite"),Q=H.getQueryDefaults(_),M=k===fr;typeof window>"u"&&I==="prepass"&&(E==null||(T=E.trpc)===null||T===void 0?void 0:T.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 ie=a(_,(0,ce.default)((0,ce.default)({},Q),E)),V=(N=E==null||(j=E.trpc)===null||j===void 0?void 0:j.abortOnUnmount)!==null&&N!==void 0?N:K,R=AB((0,ce.default)((0,ce.default)({},ie),{},{initialPageParam:(P=E.initialCursor)!==null&&P!==void 0?P:null,persister:E.persister,queryKey:_,queryFn:M?k:D=>{var F;const Y=(0,ce.default)((0,ce.default)({},ie),{},{trpc:(0,ce.default)((0,ce.default)({},ie==null?void 0:ie.trpc),V?{signal:D.signal}:{signal:null})});return z.query(...Ln(_,Y,{pageParam:(F=D.pageParam)!==null&&F!==void 0?F:E.initialCursor,direction:D.direction}))}}),H);return R.trpc=Tc({path:S}),R}function x(S,k,E){var T,O,N;const j=l(),P=_s(S,k,"infinite"),z=j.queryClient.getQueryDefaults(P),I=k===fr,L=a(P,(0,ce.default)((0,ce.default)({},z),E)),H=(T=E==null||(O=E.trpc)===null||O===void 0?void 0:O.abortOnUnmount)!==null&&T!==void 0?T:j.abortOnUnmount;PB((0,ce.default)((0,ce.default)({},E),{},{initialPageParam:(N=E.initialCursor)!==null&&N!==void 0?N:null,queryKey:P,queryFn:I?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(P,Q,{pageParam:(_=K.pageParam)!==null&&_!==void 0?_:E.initialCursor,direction:K.direction}))}}))}function w(S,k,E){var T,O,N;const j=l(),P=_s(S,k,"infinite"),z=j.queryClient.getQueryDefaults(P),I=a(P,(0,ce.default)((0,ce.default)({},z),E)),L=(T=E==null||(O=E.trpc)===null||O===void 0?void 0:O.abortOnUnmount)!==null&&T!==void 0?T:j.abortOnUnmount,H=jB((0,ce.default)((0,ce.default)({},E),{},{initialPageParam:(N=E.initialCursor)!==null&&N!==void 0?N:null,queryKey:P,queryFn:K=>{var _;const Q=(0,ce.default)((0,ce.default)({},I),{},{trpc:(0,ce.default)((0,ce.default)({},I==null?void 0:I.trpc),L?{signal:K.signal}:{})});return j.client.query(...Ln(P,Q,{pageParam:(_=K.pageParam)!==null&&_!==void 0?_:E.initialCursor,direction:K.direction}))}}),j.queryClient);return H.trpc=Tc({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:T,prefetchQuery:O,client:N}=l(),j=IE(N),P=S(j);if(typeof window>"u"&&E==="prepass")for(const I of P){var z;const L=I;((z=L.trpc)===null||z===void 0?void 0:z.ssr)!==!1&&!T.getQueryCache().find({queryKey:L.queryKey})&&O(L.queryKey,L)}return tA({queries:P.map(I=>(0,ce.default)((0,ce.default)({},I),{},{queryKey:I.queryKey})),combine:k==null?void 0:k.combine},T)},useSuspenseQueries:S=>{const{queryClient:k,client:E}=l(),T=IE(E),O=S(T),N=MB({queries:O.map(j=>(0,ce.default)((0,ce.default)({},j),{},{queryFn:j.queryFn,queryKey:j.queryKey}))},k);return[N.map(j=>j.data),N]},useMutation:f,useSubscription:g,useInfiniteQuery:v,usePrefetchInfiniteQuery:x,useSuspenseInfiniteQuery:w}}function tH(e){const t=UV(e);return Tk(n=>n==="useContext"||n==="useUtils"?()=>{const r=e.useUtils();return y.useMemo(()=>GV(r),[r])}:e.hasOwnProperty(n)?e[n]:t[n])}function nH(e){const t=eH();return tH(t)}class rH{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 kA{constructor(t){this.generateIdentifier=t,this.kv=new rH}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 sH extends kA{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 iH(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 oH(e,t){const n=iH(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 Iu(e,t){Object.entries(e).forEach(([n,r])=>t(r,n))}function hp(e,t){return e.indexOf(t)!==-1}function LE(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(t(r))return r}}class lH{constructor(){this.transfomers={}}register(t){this.transfomers[t.name]=t}findApplicable(t){return oH(this.transfomers,n=>n.isApplicable(t))}findByName(t){return this.transfomers[t]}}const aH=e=>Object.prototype.toString.call(e).slice(8,-1),SA=e=>typeof e>"u",uH=e=>e===null,Gd=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,Y0=e=>Gd(e)&&Object.keys(e).length===0,Vo=e=>Array.isArray(e),cH=e=>typeof e=="string",dH=e=>typeof e=="number"&&!isNaN(e),fH=e=>typeof e=="boolean",hH=e=>e instanceof RegExp,Jd=e=>e instanceof Map,Zd=e=>e instanceof Set,CA=e=>aH(e)==="Symbol",pH=e=>e instanceof Date&&!isNaN(e.valueOf()),EA=e=>e instanceof Error,$E=e=>typeof e=="number"&&isNaN(e),mH=e=>fH(e)||uH(e)||SA(e)||dH(e)||cH(e)||CA(e),gH=e=>typeof e=="bigint",yH=e=>e===1/0||e===-1/0,xH=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),vH=e=>e instanceof URL,X0=e=>e.replace(/\\/g,"\\\\").replace(/\./g,"\\."),px=e=>e.map(String).map(X0).join("."),cd=(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 Rs(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}const NA=[Rs(SA,"undefined",()=>null,()=>{}),Rs(gH,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):(console.error("Please add a BigInt polyfill."),e)),Rs(pH,"Date",e=>e.toISOString(),e=>new Date(e)),Rs(EA,"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}),Rs(hH,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),n=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,n)}),Rs(Zd,"set",e=>[...e.values()],e=>new Set(e)),Rs(Jd,"map",e=>[...e.entries()],e=>new Map(e)),Rs(e=>$E(e)||yH(e),"number",e=>$E(e)?"NaN":e>0?"Infinity":"-Infinity",Number),Rs(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),Rs(vH,"URL",e=>e.toString(),e=>new URL(e))];function Ug(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}const TA=Ug((e,t)=>CA(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}),wH=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),RA=Ug(xH,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const n=wH[t[1]];if(!n)throw new Error("Trying to deserialize unknown typed array");return new n(e)});function jA(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}const MA=Ug(jA,(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)}),OA=Ug((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)}),bH=[MA,TA,OA,RA],zE=(e,t)=>{const n=LE(bH,s=>s.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};const r=LE(NA,s=>s.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation}},PA={};NA.forEach(e=>{PA[e.annotation]=e});const kH=(e,t,n)=>{if(Vo(t))switch(t[0]){case"symbol":return TA.untransform(e,t,n);case"class":return MA.untransform(e,t,n);case"custom":return OA.untransform(e,t,n);case"typed-array":return RA.untransform(e,t,n);default:throw new Error("Unknown transformation: "+t)}else{const r=PA[t];if(!r)throw new Error("Unknown transformation: "+t);return r.untransform(e,n)}},Ya=(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 AA(e){if(hp(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(hp(e,"prototype"))throw new Error("prototype is not allowed as a property");if(hp(e,"constructor"))throw new Error("constructor is not allowed as a property")}const SH=(e,t)=>{AA(t);for(let n=0;n<t.length;n++){const r=t[n];if(Zd(e))e=Ya(e,+r);else if(Jd(e)){const s=+r,i=+t[++n]==0?"key":"value",o=Ya(e,s);switch(i){case"key":e=o;break;case"value":e=e.get(o);break}}else e=e[r]}return e},ew=(e,t,n)=>{if(AA(t),t.length===0)return n(e);let r=e;for(let i=0;i<t.length-1;i++){const o=t[i];if(Vo(r)){const l=+o;r=r[l]}else if(Gd(r))r=r[o];else if(Zd(r)){const l=+o;r=Ya(r,l)}else if(Jd(r)){if(i===t.length-2)break;const a=+o,u=+t[++i]==0?"key":"value",c=Ya(r,a);switch(u){case"key":r=c;break;case"value":r=r.get(c);break}}}const s=t[t.length-1];if(Vo(r)?r[+s]=n(r[+s]):Gd(r)&&(r[s]=n(r[s])),Zd(r)){const i=Ya(r,+s),o=n(i);i!==o&&(r.delete(i),r.add(o))}if(Jd(r)){const i=+t[t.length-2],o=Ya(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},_A=e=>e<1;function tw(e,t,n,r=[]){if(!e)return;const s=_A(n);if(!Vo(e)){Iu(e,(l,a)=>tw(l,t,n,[...r,...cd(a,s)]));return}const[i,o]=e;o&&Iu(o,(l,a)=>{tw(l,t,n,[...r,...cd(a,s)])}),t(i,r)}function CH(e,t,n,r){return tw(t,(s,i)=>{e=ew(e,i,o=>kH(o,s,r))},n),e}function EH(e,t,n){const r=_A(n);function s(i,o){const l=SH(e,cd(o,r));i.map(a=>cd(a,r)).forEach(a=>{e=ew(e,a,()=>l)})}if(Vo(t)){const[i,o]=t;i.forEach(l=>{e=ew(e,cd(l,r),()=>e)}),o&&Iu(o,s)}else Iu(t,s);return e}const NH=(e,t)=>Gd(e)||Vo(e)||Jd(e)||Zd(e)||EA(e)||jA(e,t);function TH(e,t,n){const r=n.get(e);r?r.push(t):n.set(e,[t])}function RH(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(px):n[px(i)]=o.map(px)}),r?Y0(n)?[r]:[r,n]:Y0(n)?void 0:n}const IA=(e,t,n,r,s=[],i=[],o=new Map)=>{const l=mH(e);if(!l){TH(e,s,t);const h=o.get(e);if(h)return r?{transformedValue:null}:h}if(!NH(e,n)){const h=zE(e,n),m=h?{transformedValue:h.value,annotations:[h.type]}:{transformedValue:e};return l||o.set(e,m),m}if(hp(i,e))return{transformedValue:null};const a=zE(e,n),u=(a==null?void 0:a.value)??e,c=Vo(u)?[]:{},d={};Iu(u,(h,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=IA(h,t,n,r,[...s,m],[...i,e],o);c[m]=g.transformedValue,Vo(g.annotations)?d[X0(m)]=g.annotations:Gd(g.annotations)&&Iu(g.annotations,(v,x)=>{d[X0(m)+"."+x]=v})});const f=Y0(d)?{transformedValue:c,annotations:a?[a.type]:void 0}:{transformedValue:c,annotations:a?[a.type,d]:d};return l||o.set(e,f),f};function DA(e){return Object.prototype.toString.call(e).slice(8,-1)}function FE(e){return DA(e)==="Array"}function jH(e){if(DA(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function MH(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 nw(e,t={}){if(FE(e))return e.map(s=>nw(s,t));if(!jH(e))return e;const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertySymbols(e);return[...n,...r].reduce((s,i)=>{if(i==="__proto__"||FE(t.props)&&!t.props.includes(i))return s;const o=e[i],l=nw(o,t);return MH(s,i,l,e,t.nonenumerable),s},{})}class Qe{constructor({dedupe:t=!1}={}){this.classRegistry=new sH,this.symbolRegistry=new kA(n=>n.description??""),this.customTransformerRegistry=new lH,this.allowedErrorProps=[],this.dedupe=t}serialize(t){const n=new Map,r=IA(t,n,this,this.dedupe),s={json:r.transformedValue};r.annotations&&(s.meta={...s.meta,values:r.annotations});const i=RH(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:nw(r);return s!=null&&s.values&&(i=CH(i,s.values,s.v??0,this)),s!=null&&s.referentialEqualities&&(i=EH(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)}}Qe.defaultInstance=new Qe;Qe.serialize=Qe.defaultInstance.serialize.bind(Qe.defaultInstance);Qe.deserialize=Qe.defaultInstance.deserialize.bind(Qe.defaultInstance);Qe.stringify=Qe.defaultInstance.stringify.bind(Qe.defaultInstance);Qe.parse=Qe.defaultInstance.parse.bind(Qe.defaultInstance);Qe.registerClass=Qe.defaultInstance.registerClass.bind(Qe.defaultInstance);Qe.registerSymbol=Qe.defaultInstance.registerSymbol.bind(Qe.defaultInstance);Qe.registerCustom=Qe.defaultInstance.registerCustom.bind(Qe.defaultInstance);Qe.allowErrorProps=Qe.defaultInstance.allowErrorProps.bind(Qe.defaultInstance);Qe.serialize;Qe.deserialize;Qe.stringify;Qe.parse;Qe.registerClass;Qe.registerCustom;Qe.registerSymbol;Qe.allowErrorProps;const Ue=nH(),OH=Ue.createClient({links:[MV({url:"/trpc",transformer:Qe})]}),LA=y.createContext(null),PH=LA.Provider,$t=()=>{const e=y.useContext(LA);if(!e)throw new Error("useProjectContext must be used within ProjectProvider.");return e};class Mk extends Error{constructor(n="Not found"){super(n);ot(this,"code","NOT_FOUND");this.name="NotFoundError"}}function AH(e){if(e instanceof Mk)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 If=()=>{var d;const{apiRoot:e,activeProject:t}=$t(),n=Fi(),r=Pf({queryKey:["agents",t==null?void 0:t.id],queryFn:async()=>{const f=await fetch(`${e}/agents?includeArchived=true`);if(!f.ok)throw new Error(f.statusText);return await f.json()},enabled:!!t,refetchInterval:5e3,refetchOnWindowFocus:!1}),s=hi({mutationFn:async f=>{const h=await fetch(`${e}/agents`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:f})});if(!h.ok)throw new Error(h.statusText);return await h.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["agents",t==null?void 0:t.id]})}}),i=hi({mutationFn:async({agentId:f,message:h,onStream:m})=>new Promise((x,w)=>{let b=!1,C=Date.now(),S=null,k=null;const E=()=>{S&&(clearInterval(S),S=null)},T=N=>{b||(b=!0,E(),x(N))},O=N=>{b||(b=!0,E(),w(N))};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/${f}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:h})}).then(async N=>{if(!N.ok)throw new Error(N.statusText);if(!N.body)throw new Error("No response body");k=N.body.getReader();const j=new TextDecoder;let P="";for(;;){const{done:z,value:I}=await k.read();if(z)break;C=Date.now(),P+=j.decode(I,{stream:!0});const L=P.split(`
|
|
68
|
+
`);P=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,f]}),T({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(N=>O(N instanceof Error?N:new Error(String(N))))}),onSuccess:(f,h)=>{n.invalidateQueries({queryKey:["agents",t==null?void 0:t.id]}),n.invalidateQueries({queryKey:["agent",t==null?void 0:t.id,h.agentId]})}}),o=hi({mutationFn:async f=>{const h=await fetch(`${e}/agents/${f}`,{method:"DELETE"});if(!h.ok)throw new Error(h.statusText);return await h.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["agents",t==null?void 0:t.id]})}}),l=hi({mutationFn:async f=>{const h=await fetch(`${e}/agents/${f}/archive`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!h.ok)throw new Error(h.statusText);return await h.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["agents",t==null?void 0:t.id]})}}),a=hi({mutationFn:async f=>{const h=await fetch(`${e}/agents/${f}/interrupt`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!h.ok)throw new Error(h.statusText);return await h.json()},onSuccess:(f,h)=>{n.invalidateQueries({queryKey:["agent",t==null?void 0:t.id,h]})}}),u=hi({mutationFn:async({agentId:f,name:h})=>{const m=await fetch(`${e}/agents/${f}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:h})});if(!m.ok)throw new Error(m.statusText);return await m.json()},onSuccess:(f,h)=>{n.invalidateQueries({queryKey:["agents",t==null?void 0:t.id]}),n.invalidateQueries({queryKey:["agent",t==null?void 0:t.id,h.agentId]})}}),c=hi({mutationFn:async({agentId:f,mode:h})=>{const m=await fetch(`${e}/agents/${f}/permission-mode`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:h})});if(!m.ok)throw new Error(m.statusText);return await m.json()},onSuccess:(f,h)=>{n.invalidateQueries({queryKey:["agent",t==null?void 0:t.id,h.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}},_H=e=>{const{apiRoot:t,activeProject:n}=$t();return Pf({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 Mk("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}=$t(),r=Fi(),s=Pf({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=hi({mutationFn:async({agentId:l,permissionId:a,behavior:u,message:c,updatedPermissions:d})=>{const f=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(!f.ok)throw new Error(f.statusText);return await f.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 zA=(...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 IH=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 DH=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 BE=e=>{const t=DH(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 LH={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 $H=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 zH=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},a)=>y.createElement("svg",{ref:a,...LH,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:zA("lucide",s),...!i&&!$H(l)&&{"aria-hidden":"true"},...l},[...o.map(([u,c])=>y.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 be=(e,t)=>{const n=y.forwardRef(({className:r,...s},i)=>y.createElement(zH,{ref:i,iconNode:t,className:zA(`lucide-${IH(BE(e))}`,`lucide-${e}`,r),...s}));return n.displayName=BE(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 FH=[["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"}]],im=be("archive",FH);/**
|
|
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 BH=[["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"}]],VH=be("arrow-down-a-z",BH);/**
|
|
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 HH=[["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"}]],rw=be("arrow-down-wide-narrow",HH);/**
|
|
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 UH=[["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"}]],qH=be("arrow-up-a-z",UH);/**
|
|
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 WH=[["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"}]],om=be("arrow-up-narrow-wide",WH);/**
|
|
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 KH=[["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"}]],QH=be("bell",KH);/**
|
|
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 GH=[["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"}]],JH=be("bold",GH);/**
|
|
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 ZH=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ac=be("check",ZH);/**
|
|
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 YH=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ji=be("chevron-down",YH);/**
|
|
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 XH=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Du=be("chevron-right",XH);/**
|
|
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 eU=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],FA=be("chevron-up",eU);/**
|
|
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 tU=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],nU=be("chevrons-up-down",tU);/**
|
|
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 rU=[["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"}]],sU=be("circle-alert",rU);/**
|
|
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 iU=[["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"}]],Ok=be("code-xml",iU);/**
|
|
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 oU=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],lU=be("code",oU);/**
|
|
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 aU=[["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"}]],uU=be("command",aU);/**
|
|
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 cU=[["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"}]],dU=be("copy",cU);/**
|
|
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 fU=[["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"}]],hU=be("database",fU);/**
|
|
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 pU=[["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"}]],BA=be("ellipsis-vertical",pU);/**
|
|
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 mU=[["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"}]],VA=be("external-link",mU);/**
|
|
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 gU=[["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"}]],yU=be("eye-off",gU);/**
|
|
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 xU=[["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"}]],vU=be("eye",xU);/**
|
|
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 wU=[["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"}]],ca=be("file-text",wU);/**
|
|
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 bU=[["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"}]],kU=be("file",bU);/**
|
|
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 SU=[["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"}]],Lu=be("folder-open",SU);/**
|
|
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 CU=[["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"}]],uc=be("folder",CU);/**
|
|
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 EU=[["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"}]],HA=be("funnel",EU);/**
|
|
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 NU=[["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"}]],TU=be("grip-vertical",NU);/**
|
|
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 RU=[["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"}]],UA=be("group",RU);/**
|
|
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 jU=[["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"}]],qA=be("hash",jU);/**
|
|
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 MU=[["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"}]],OU=be("heading-2",MU);/**
|
|
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 PU=[["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"}]],AU=be("heading-3",PU);/**
|
|
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 _U=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],WA=be("info",_U);/**
|
|
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 IU=[["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"}]],DU=be("italic",IU);/**
|
|
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 LU=[["path",{d:"M5 3v14",key:"9nsxs2"}],["path",{d:"M12 3v8",key:"1h2ygw"}],["path",{d:"M19 3v18",key:"1sk56x"}]],$U=be("kanban",LU);/**
|
|
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 zU=[["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"}]],FU=be("keyboard",zU);/**
|
|
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 BU=[["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"}]],VU=be("link-2",BU);/**
|
|
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 HU=[["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"}]],KA=be("link",HU);/**
|
|
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 UU=[["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"}]],qU=be("list-ordered",UU);/**
|
|
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 WU=[["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"}]],QA=be("list",WU);/**
|
|
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 KU=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],lm=be("loader-circle",KU);/**
|
|
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 QU=[["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"}]],GU=be("message-square",QU);/**
|
|
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 JU=[["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"}]],ZU=be("pen",JU);/**
|
|
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 YU=[["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"}]],GA=be("pencil",YU);/**
|
|
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 XU=[["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"}]],JA=be("pin",XU);/**
|
|
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 e6=[["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"}]],ZA=be("play",e6);/**
|
|
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 t6=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Qt=be("plus",t6);/**
|
|
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 n6=[["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"}]],r6=be("quote",n6);/**
|
|
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 s6=[["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"}]],i6=be("rotate-cw",s6);/**
|
|
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 o6=[["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"}]],l6=be("scroll-text",o6);/**
|
|
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 a6=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Pk=be("search",a6);/**
|
|
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 u6=[["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"}]],c6=be("send",u6);/**
|
|
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 d6=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],f6=be("settings-2",d6);/**
|
|
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 h6=[["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"}]],YA=be("settings",h6);/**
|
|
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 p6=[["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"}]],XA=be("smile",p6);/**
|
|
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 m6=[["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"}]],g6=be("square-check-big",m6);/**
|
|
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 y6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],e_=be("square",y6);/**
|
|
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 x6=[["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"}]],v6=be("strikethrough",x6);/**
|
|
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 w6=[["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"}]],da=be("trash-2",w6);/**
|
|
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 b6=[["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"}]],k6=be("unlink",b6);/**
|
|
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 S6=[["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"}]],C6=be("wifi-off",S6);/**
|
|
414
|
+
* @license lucide-react v0.563.0 - ISC
|
|
415
|
+
*
|
|
416
|
+
* This source code is licensed under the ISC license.
|
|
417
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
418
|
+
*/const E6=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Bn=be("x",E6),N6=e=>{var t;(t=e.openCreateDialog)==null||t.call(e,"markdown")},T6=e=>{var t;(t=e.openCreateDialog)==null||t.call(e,"json")},R6=e=>{var t;(t=e.openCreateDialog)==null||t.call(e,"prompt")},j6=e=>{var t;(t=e.openCreateDialog)==null||t.call(e,"app")},M6=e=>{var t;(t=e.openCreateDialog)==null||t.call(e,"tasks")},Ak=async e=>{var t;e.activeDoc&&await((t=e.toggleDocPinned)==null?void 0:t.call(e,e.activeDoc))},_k=async e=>{var t;e.activeDoc&&await((t=e.archiveDoc)==null?void 0:t.call(e,e.activeDoc))},Ik=async e=>{var t;e.activeDoc&&await((t=e.deleteDoc)==null?void 0:t.call(e,e.activeDoc))},O6=e=>{var t;(t=e.setAgentsSidebarOpen)==null||t.call(e,!0)},P6=e=>{var t;(t=e.setAgentsSidebarOpen)==null||t.call(e,!1)},A6=e=>{var t;(t=e.createAgent)==null||t.call(e)},_6=e=>{var t;(t=e.openInTerminal)==null||t.call(e)},I6=e=>{var t;(t=e.openZapper)==null||t.call(e)},D6=e=>{var t;(t=e.openCreateProject)==null||t.call(e)},L6=e=>{var t;(t=e.openManageProjects)==null||t.call(e)};function t_(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=t_(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function n_(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=t_(e))&&(r&&(r+=" "),r+=t);return r}const $6=(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},z6=(e,t)=>({classGroupId:e,validator:t}),r_=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),am="-",VE=[],F6="arbitrary..",B6=e=>{const t=H6(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return V6(o);const l=o.split(am),a=l[0]===""&&l.length>1?1:0;return s_(l,a,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const a=r[o],u=n[o];return a?u?$6(u,a):a:u||VE}return n[o]||VE}}},s_=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],i=n.nextPart.get(s);if(i){const u=s_(e,t+1,i);if(u)return u}const o=n.validators;if(o===null)return;const l=t===0?e.join(am):e.slice(t).join(am),a=o.length;for(let u=0;u<a;u++){const c=o[u];if(c.validator(l))return c.classGroupId}},V6=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?F6+r:void 0})(),H6=e=>{const{theme:t,classGroups:n}=e;return U6(n,t)},U6=(e,t)=>{const n=r_();for(const r in e){const s=e[r];Dk(s,n,r,t)}return n},Dk=(e,t,n,r)=>{const s=e.length;for(let i=0;i<s;i++){const o=e[i];q6(o,t,n,r)}},q6=(e,t,n,r)=>{if(typeof e=="string"){W6(e,t,n);return}if(typeof e=="function"){K6(e,t,n,r);return}Q6(e,t,n,r)},W6=(e,t,n)=>{const r=e===""?t:i_(t,e);r.classGroupId=n},K6=(e,t,n,r)=>{if(G6(e)){Dk(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(z6(n,e))},Q6=(e,t,n,r)=>{const s=Object.entries(e),i=s.length;for(let o=0;o<i;o++){const[l,a]=s[o];Dk(a,i_(t,l),n,r)}},i_=(e,t)=>{let n=e;const r=t.split(am),s=r.length;for(let i=0;i<s;i++){const o=r[i];let l=n.nextPart.get(o);l||(l=r_(),n.nextPart.set(o,l)),n=l}return n},G6=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,J6=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)}}},sw="!",HE=":",Z6=[],UE=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),Y6=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===HE){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 f=d,h=!1;d.endsWith(sw)?(f=d.slice(0,-1),h=!0):d.startsWith(sw)&&(f=d.slice(1),h=!0);const m=u&&u>a?u-a:void 0;return UE(i,h,f,m)};if(t){const s=t+HE,i=r;r=o=>o.startsWith(s)?i(o.slice(s.length)):UE(Z6,!1,o,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},X6=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}},e9=e=>({cache:J6(e.cacheSize),parseClassName:Y6(e),sortModifiers:X6(e),...B6(e)}),t9=/\s+/,n9=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=t,o=[],l=e.trim().split(t9);let a="";for(let u=l.length-1;u>=0;u-=1){const c=l[u],{isExternal:d,modifiers:f,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:g}=n(c);if(d){a=c+(a.length>0?" "+a:a);continue}let v=!!g,x=r(v?m.substring(0,g):m);if(!x){if(!v){a=c+(a.length>0?" "+a:a);continue}if(x=r(m),!x){a=c+(a.length>0?" "+a:a);continue}v=!1}const w=f.length===0?"":f.length===1?f[0]:i(f).join(":"),b=h?w+sw:w,C=b+x;if(o.indexOf(C)>-1)continue;o.push(C);const S=s(x,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},r9=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=o_(n))&&(s&&(s+=" "),s+=r);return s},o_=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=o_(e[r]))&&(n&&(n+=" "),n+=t);return n},s9=(e,...t)=>{let n,r,s,i;const o=a=>{const u=t.reduce((c,d)=>d(c),e());return n=e9(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=n9(a,n);return s(a,c),c};return i=o,(...a)=>i(r9(...a))},i9=[],qt=e=>{const t=n=>n[e]||i9;return t.isThemeGetter=!0,t},l_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,a_=/^\((?:(\w[\w-]*):)?(.+)\)$/i,o9=/^\d+\/\d+$/,l9=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,a9=/\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$/,u9=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,c9=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,d9=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ba=e=>o9.test(e),He=e=>!!e&&!Number.isNaN(Number(e)),Hi=e=>!!e&&Number.isInteger(Number(e)),mx=e=>e.endsWith("%")&&He(e.slice(0,-1)),si=e=>l9.test(e),f9=()=>!0,h9=e=>a9.test(e)&&!u9.test(e),u_=()=>!1,p9=e=>c9.test(e),m9=e=>d9.test(e),g9=e=>!ge(e)&&!ye(e),y9=e=>cc(e,f_,u_),ge=e=>l_.test(e),ul=e=>cc(e,h_,h9),gx=e=>cc(e,k9,He),qE=e=>cc(e,c_,u_),x9=e=>cc(e,d_,m9),vh=e=>cc(e,p_,p9),ye=e=>a_.test(e),Rc=e=>dc(e,h_),v9=e=>dc(e,S9),WE=e=>dc(e,c_),w9=e=>dc(e,f_),b9=e=>dc(e,d_),wh=e=>dc(e,p_,!0),cc=(e,t,n)=>{const r=l_.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},dc=(e,t,n=!1)=>{const r=a_.exec(e);return r?r[1]?t(r[1]):n:!1},c_=e=>e==="position"||e==="percentage",d_=e=>e==="image"||e==="url",f_=e=>e==="length"||e==="size"||e==="bg-size",h_=e=>e==="length",k9=e=>e==="number",S9=e=>e==="family-name",p_=e=>e==="shadow",C9=()=>{const e=qt("color"),t=qt("font"),n=qt("text"),r=qt("font-weight"),s=qt("tracking"),i=qt("leading"),o=qt("breakpoint"),l=qt("container"),a=qt("spacing"),u=qt("radius"),c=qt("shadow"),d=qt("inset-shadow"),f=qt("text-shadow"),h=qt("drop-shadow"),m=qt("blur"),g=qt("perspective"),v=qt("aspect"),x=qt("ease"),w=qt("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"],T=()=>[ye,ge,a],O=()=>[ba,"full","auto",...T()],N=()=>[Hi,"none","subgrid",ye,ge],j=()=>["auto",{span:["full",Hi,ye,ge]},Hi,ye,ge],P=()=>[Hi,"auto",ye,ge],z=()=>["auto","min","max","fr",ye,ge],I=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],L=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...T()],K=()=>[ba,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],_=()=>[e,ye,ge],Q=()=>[...C(),WE,qE,{position:[ye,ge]}],M=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ie=()=>["auto","cover","contain",w9,y9,{size:[ye,ge]}],V=()=>[mx,Rc,ul],R=()=>["","none","full",u,ye,ge],D=()=>["",He,Rc,ul],F=()=>["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,mx,WE,qE],ve=()=>["","none",m,ye,ge],me=()=>["none",He,ye,ge],Je=()=>["none",He,ye,ge],bt=()=>[He,ye,ge],It=()=>[ba,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[si],breakpoint:[si],color:[f9],container:[si],"drop-shadow":[si],ease:["in","out","in-out"],font:[g9],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[si],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[si],shadow:[si],spacing:["px",He],text:[si],"text-shadow":[si],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ba,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:[Hi,"auto",ye,ge]}],basis:[{basis:[ba,"full","auto",l,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[He,ba,"auto","initial","none",ge]}],grow:[{grow:["",He,ye,ge]}],shrink:[{shrink:["",He,ye,ge]}],order:[{order:[Hi,"first","last","none",ye,ge]}],"grid-cols":[{"grid-cols":N()}],"col-start-end":[{col:j()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":N()}],"row-start-end":[{row:j()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...I(),"normal"]}],"justify-items":[{"justify-items":[...L(),"normal"]}],"justify-self":[{"justify-self":["auto",...L()]}],"align-content":[{content:["normal",...I()]}],"align-items":[{items:[...L(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...L(),{baseline:["","last"]}]}],"place-content":[{"place-content":I()}],"place-items":[{"place-items":[...L(),"baseline"]}],"place-self":[{"place-self":["auto",...L()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],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":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"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,Rc,ul]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ye,gx]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",mx,ge]}],"font-family":[{font:[v9,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,gx]}],leading:[{leading:[i,...T()]}],"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:[...F(),"wavy"]}],"text-decoration-thickness":[{decoration:[He,"from-font","auto",ye,ul]}],"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:T()}],"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:ie()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Hi,ye,ge],radial:["",ye,ge],conic:[Hi,ye,ge]},b9,x9]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"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:D()}],"border-w-x":[{"border-x":D()}],"border-w-y":[{"border-y":D()}],"border-w-s":[{"border-s":D()}],"border-w-e":[{"border-e":D()}],"border-w-t":[{"border-t":D()}],"border-w-r":[{"border-r":D()}],"border-w-b":[{"border-b":D()}],"border-w-l":[{"border-l":D()}],"divide-x":[{"divide-x":D()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":D()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...F(),"hidden","none"]}],"divide-style":[{divide:[...F(),"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:[...F(),"none","hidden"]}],"outline-offset":[{"outline-offset":[He,ye,ge]}],"outline-w":[{outline:["",He,Rc,ul]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",c,wh,vh]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",d,wh,vh]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[He,ul]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":D()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",f,wh,vh]}],"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:ie()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ye,ge]}],filter:[{filter:["","none",ye,ge]}],blur:[{blur:ve()}],brightness:[{brightness:[He,ye,ge]}],contrast:[{contrast:[He,ye,ge]}],"drop-shadow":[{"drop-shadow":["","none",h,wh,vh]}],"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":ve()}],"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":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"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",x,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:me()}],"rotate-x":[{"rotate-x":me()}],"rotate-y":[{"rotate-y":me()}],"rotate-z":[{"rotate-z":me()}],scale:[{scale:Je()}],"scale-x":[{"scale-x":Je()}],"scale-y":[{"scale-y":Je()}],"scale-z":[{"scale-z":Je()}],"scale-3d":["scale-3d"],skew:[{skew:bt()}],"skew-x":[{"skew-x":bt()}],"skew-y":[{"skew-y":bt()}],transform:[{transform:[ye,ge,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:It()}],"translate-x":[{"translate-x":It()}],"translate-y":[{"translate-y":It()}],"translate-z":[{"translate-z":It()}],"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":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"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,Rc,ul,gx]}],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"]}},E9=s9(C9);function dt(...e){return E9(n_(e))}const Xa=typeof navigator<"u"&&navigator.platform.includes("Mac"),iw=e=>e.split("+").map(t=>t==="mod"?Xa?"⌘":"Ctrl":t==="shift"?Xa?"⇧":"Shift":t==="alt"?Xa?"⌥":"Alt":t.toUpperCase()).join(Xa?"":"+"),m_=()=>[{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:N6},{id:"doc.create.json",label:"Create data table document",scope:"global",keywords:["new","create","json","table","doc"],run:T6},{id:"doc.create.prompt",label:"Create prompt document",scope:"global",keywords:["new","create","prompt","text","doc"],run:R6},{id:"doc.create.app",label:"Create React app document",scope:"global",keywords:["new","create","app","react","bundle","doc"],run:j6},{id:"doc.create.tasks",label:"Create task board",scope:"global",keywords:["new","create","tasks","todo","kanban","board","doc"],run:M6},{id:"doc.pin",label:"Pin document",scope:"doc",keywords:["pin","document","info"],run:Ak},{id:"doc.archive",label:"Archive document",scope:"doc",keywords:["archive","document","info"],run:_k},{id:"doc.delete",label:"Delete document",scope:"doc",keywords:["delete","remove","document","info"],run:Ik},{id:"agent.create",label:"Create new agent",scope:"global",shortcut:"mod+shift+a",keywords:["new","create","agent","conversation"],run:A6},{id:"agents.sidebar.open",label:"Show agents sidebar",scope:"global",keywords:["agents","sidebar","open","show"],run:O6},{id:"agents.sidebar.close",label:"Hide agents sidebar",scope:"global",keywords:["agents","sidebar","close","hide"],run:P6},{id:"project.create",label:"Create new project",scope:"global",keywords:["new","create","project"],run:D6},{id:"project.manage",label:"Manage projects",scope:"global",keywords:["manage","projects","reorder","rename","delete"],run:L6},{id:"project.openInTerminal",label:"Open project in terminal",scope:"global",shortcut:"mod+shift+t",keywords:["terminal","project","open","shell"],run:_6},{id:"zapper.open",label:"Show Zapper",scope:"global",keywords:["zapper","services","processes","docker","tasks","zap"],run:I6}],g_=()=>{const{activeProject:e}=$t(),t=Ue.useUtils(),n=(e==null?void 0:e.id)??"",r=Ue.docs.list.useQuery({projectId:n},{enabled:!!e,refetchInterval:5e3,refetchOnWindowFocus:!1}),s=y.useMemo(()=>{var u;return((u=r.data)==null?void 0:u.docs)??[]},[r.data]),i=y.useMemo(()=>{var u;return((u=r.data)==null?void 0:u.folders)??[]},[r.data]),o=y.useCallback(u=>{t.docs.list.setData({projectId:n},c=>{if(c)return{...c,docs:u(c.docs)}})},[t,n]),l=y.useCallback(()=>{t.docs.list.invalidate({projectId:n}).catch(()=>{})},[t,n]),a=y.useMemo(()=>r.error?String(r.error):"",[r.error]);return{docs:s,folders:i,docsQuery:r,updateDocsCache:o,invalidateDocs:l,errorMessage:a}},y_="hyperdoc:recent-items",N9=3,ow=new Set,T9=e=>(ow.add(e),()=>ow.delete(e));let Oa=null;function lw(){if(Oa)return Oa;try{const e=localStorage.getItem(y_);Oa=e?JSON.parse(e):[]}catch{Oa=[]}return Oa}function KE(e){Oa=e,localStorage.setItem(y_,JSON.stringify(e)),ow.forEach(t=>t())}const R9=()=>lw();function j9(){const e=y.useSyncExternalStore(T9,R9),t=y.useCallback((r,s,i,o)=>{const l=lw().filter(u=>!(u.type===r&&u.id===s)),a={type:r,id:s,label:i,emoji:o,timestamp:Date.now()};KE([a,...l].slice(0,N9))},[]),n=y.useCallback((r,s)=>{KE(lw().filter(i=>!(i.type===r&&i.id===s)))},[]);return{recentItems:e,trackItem:t,removeItem:n}}const x_=y.createContext(null),M9=x_.Provider,v_=()=>{const e=y.useContext(x_);if(!e)throw new Error("useCommandPaletteContext must be used within CommandPaletteProvider.");return e};var QE=1,O9=.9,P9=.8,A9=.17,yx=.1,xx=.999,_9=.9999,I9=.99,D9=/[\\\/_+.#"@\[\(\{&]/,L9=/[\\\/_+.#"@\[\(\{&]/g,$9=/[\s-]/,w_=/[\s-]/g;function aw(e,t,n,r,s,i,o){if(i===t.length)return s===e.length?QE:I9;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,f,h,m;u>=0;)d=aw(e,t,n,r,u+1,i+1,o),d>c&&(u===s?d*=QE:D9.test(e.charAt(u-1))?(d*=P9,h=e.slice(s,u-1).match(L9),h&&s>0&&(d*=Math.pow(xx,h.length))):$9.test(e.charAt(u-1))?(d*=O9,m=e.slice(s,u-1).match(w_),m&&s>0&&(d*=Math.pow(xx,m.length))):(d*=A9,s>0&&(d*=Math.pow(xx,u-s))),e.charAt(u)!==t.charAt(i)&&(d*=_9)),(d<yx&&n.charAt(u-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(u-1)!==r.charAt(i))&&(f=aw(e,t,n,r,u+1,i+2,o),f*yx>d&&(d=f*yx)),d>c&&(c=d),u=n.indexOf(a,u+1);return o[l]=c,c}function GE(e){return e.toLowerCase().replace(w_," ")}function z9(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,aw(e,t,GE(e),GE(t),0,0,{})}function Kt(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 JE(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ho(...e){return t=>{let n=!1;const r=e.map(s=>{const i=JE(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():JE(e[s],null)}}}}function Er(...e){return y.useCallback(Ho(...e),e)}function F9(e,t){const n=y.createContext(t),r=i=>{const{children:o,...l}=i,a=y.useMemo(()=>l,Object.values(l));return p.jsx(n.Provider,{value:a,children:o})};r.displayName=e+"Provider";function s(i){const o=y.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 qg(e,t=[]){let n=[];function r(i,o){const l=y.createContext(o),a=n.length;n=[...n,o];const u=d=>{var x;const{scope:f,children:h,...m}=d,g=((x=f==null?void 0:f[e])==null?void 0:x[a])||l,v=y.useMemo(()=>m,Object.values(m));return p.jsx(g.Provider,{value:v,children:h})};u.displayName=i+"Provider";function c(d,f){var g;const h=((g=f==null?void 0:f[e])==null?void 0:g[a])||l,m=y.useContext(h);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=>y.createContext(o));return function(l){const a=(l==null?void 0:l[e])||i;return y.useMemo(()=>({[`__scope${e}`]:{...l,[e]:a}}),[l,a])}};return s.scopeName=e,[r,B9(s,...t)]}function B9(...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 y.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Uo=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},V9=Ef[" useId ".trim().toString()]||(()=>{}),H9=0;function ps(e){const[t,n]=y.useState(V9());return Uo(()=>{n(r=>r??String(H9++))},[e]),t?`radix-${t}`:""}var U9=Ef[" useInsertionEffect ".trim().toString()]||Uo;function Lk({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=q9({defaultProp:t,onChange:n}),l=e!==void 0,a=l?e:s;{const c=y.useRef(e!==void 0);y.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=y.useCallback(c=>{var d;if(l){const f=W9(c)?c(e):c;f!==e&&((d=o.current)==null||d.call(o,f))}else i(c)},[l,e,i,o]);return[a,u]}function q9({defaultProp:e,onChange:t}){const[n,r]=y.useState(e),s=y.useRef(n),i=y.useRef(t);return U9(()=>{i.current=t},[t]),y.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}function W9(e){return typeof e=="function"}function $k(e){const t=K9(e),n=y.forwardRef((r,s)=>{const{children:i,...o}=r,l=y.Children.toArray(i),a=l.find(G9);if(a){const u=a.props.children,c=l.map(d=>d===a?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:d);return p.jsx(t,{...o,ref:s,children:y.isValidElement(u)?y.cloneElement(u,void 0,c):null})}return p.jsx(t,{...o,ref:s,children:i})});return n.displayName=`${e}.Slot`,n}function K9(e){const t=y.forwardRef((n,r)=>{const{children:s,...i}=n;if(y.isValidElement(s)){const o=Z9(s),l=J9(i,s.props);return s.type!==y.Fragment&&(l.ref=r?Ho(r,o):o),y.cloneElement(s,l)}return y.Children.count(s)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var b_=Symbol("radix.slottable");function Q9(e){const t=({children:n})=>p.jsx(p.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=b_,t}function G9(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===b_}function J9(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 Z9(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 Y9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mn=Y9.reduce((e,t)=>{const n=$k(`Primitive.${t}`),r=y.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 X9(e,t){e&&el.flushSync(()=>e.dispatchEvent(t))}function $u(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function eq(e,t=globalThis==null?void 0:globalThis.document){const n=$u(e);y.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 tq="DismissableLayer",uw="dismissableLayer.update",nq="dismissableLayer.pointerDownOutside",rq="dismissableLayer.focusOutside",ZE,k_=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Wg=y.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...a}=e,u=y.useContext(k_),[c,d]=y.useState(null),f=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=y.useState({}),m=Er(t,E=>d(E)),g=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=g.indexOf(v),w=c?g.indexOf(c):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,C=w>=x,S=oq(E=>{const T=E.target,O=[...u.branches].some(N=>N.contains(T));!C||O||(s==null||s(E),o==null||o(E),E.defaultPrevented||l==null||l())},f),k=lq(E=>{const T=E.target;[...u.branches].some(N=>N.contains(T))||(i==null||i(E),o==null||o(E),E.defaultPrevented||l==null||l())},f);return eq(E=>{w===u.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&l&&(E.preventDefault(),l()))},f),y.useEffect(()=>{if(c)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ZE=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),YE(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=ZE)}},[c,f,n,u]),y.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),YE())},[c,u]),y.useEffect(()=>{const E=()=>h({});return document.addEventListener(uw,E),()=>document.removeEventListener(uw,E)},[]),p.jsx(Mn.div,{...a,ref:m,style:{pointerEvents:b?C?"auto":"none":void 0,...e.style},onFocusCapture:Kt(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Kt(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Kt(e.onPointerDownCapture,S.onPointerDownCapture)})});Wg.displayName=tq;var sq="DismissableLayerBranch",iq=y.forwardRef((e,t)=>{const n=y.useContext(k_),r=y.useRef(null),s=Er(t,r);return y.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),p.jsx(Mn.div,{...e,ref:s})});iq.displayName=sq;function oq(e,t=globalThis==null?void 0:globalThis.document){const n=$u(e),r=y.useRef(!1),s=y.useRef(()=>{});return y.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let a=function(){S_(nq,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 lq(e,t=globalThis==null?void 0:globalThis.document){const n=$u(e),r=y.useRef(!1);return y.useEffect(()=>{const s=i=>{i.target&&!r.current&&S_(rq,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 YE(){const e=new CustomEvent(uw);document.dispatchEvent(e)}function S_(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?X9(s,i):s.dispatchEvent(i)}var vx="focusScope.autoFocusOnMount",wx="focusScope.autoFocusOnUnmount",XE={bubbles:!1,cancelable:!0},aq="FocusScope",zk=y.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[l,a]=y.useState(null),u=$u(s),c=$u(i),d=y.useRef(null),f=Er(t,g=>a(g)),h=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let g=function(b){if(h.paused||!l)return;const C=b.target;l.contains(C)?d.current=C:Ki(d.current,{select:!0})},v=function(b){if(h.paused||!l)return;const C=b.relatedTarget;C!==null&&(l.contains(C)||Ki(d.current,{select:!0}))},x=function(b){if(document.activeElement===document.body)for(const S of b)S.removedNodes.length>0&&Ki(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",v);const w=new MutationObserver(x);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",v),w.disconnect()}}},[r,l,h.paused]),y.useEffect(()=>{if(l){tN.add(h);const g=document.activeElement;if(!l.contains(g)){const x=new CustomEvent(vx,XE);l.addEventListener(vx,u),l.dispatchEvent(x),x.defaultPrevented||(uq(pq(C_(l)),{select:!0}),document.activeElement===g&&Ki(l))}return()=>{l.removeEventListener(vx,u),setTimeout(()=>{const x=new CustomEvent(wx,XE);l.addEventListener(wx,c),l.dispatchEvent(x),x.defaultPrevented||Ki(g??document.body,{select:!0}),l.removeEventListener(wx,c),tN.remove(h)},0)}}},[l,u,c,h]);const m=y.useCallback(g=>{if(!n&&!r||h.paused)return;const v=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,x=document.activeElement;if(v&&x){const w=g.currentTarget,[b,C]=cq(w);b&&C?!g.shiftKey&&x===C?(g.preventDefault(),n&&Ki(b,{select:!0})):g.shiftKey&&x===b&&(g.preventDefault(),n&&Ki(C,{select:!0})):x===w&&g.preventDefault()}},[n,r,h.paused]);return p.jsx(Mn.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});zk.displayName=aq;function uq(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ki(r,{select:t}),document.activeElement!==n)return}function cq(e){const t=C_(e),n=eN(t,e),r=eN(t.reverse(),e);return[n,r]}function C_(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 eN(e,t){for(const n of e)if(!dq(n,{upTo:t}))return n}function dq(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 fq(e){return e instanceof HTMLInputElement&&"select"in e}function Ki(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&fq(e)&&t&&e.select()}}var tN=hq();function hq(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=nN(e,t),e.unshift(t)},remove(t){var n;e=nN(e,t),(n=e[0])==null||n.resume()}}}function nN(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function pq(e){return e.filter(t=>t.tagName!=="A")}var mq="Portal",Fk=y.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[s,i]=y.useState(!1);Uo(()=>i(!0),[]);const o=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?SP.createPortal(p.jsx(Mn.div,{...r,ref:t}),o):null});Fk.displayName=mq;function gq(e,t){return y.useReducer((n,r)=>t[n][r]??n,e)}var fa=e=>{const{present:t,children:n}=e,r=yq(t),s=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),i=Er(r.ref,xq(s));return typeof n=="function"||r.isPresent?y.cloneElement(s,{ref:i}):null};fa.displayName="Presence";function yq(e){const[t,n]=y.useState(),r=y.useRef(null),s=y.useRef(e),i=y.useRef("none"),o=e?"mounted":"unmounted",[l,a]=gq(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const u=bh(r.current);i.current=l==="mounted"?u:"none"},[l]),Uo(()=>{const u=r.current,c=s.current;if(c!==e){const f=i.current,h=bh(u);e?a("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?a("UNMOUNT"):a(c&&f!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,a]),Uo(()=>{if(t){let u;const c=t.ownerDocument.defaultView??window,d=h=>{const g=bh(r.current).includes(CSS.escape(h.animationName));if(h.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)})}},f=h=>{h.target===t&&(i.current=bh(r.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{c.clearTimeout(u),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else a("ANIMATION_END")},[t,a]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:y.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function bh(e){return(e==null?void 0:e.animationName)||"none"}function xq(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 bx=0;function E_(){y.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??rN()),document.body.insertAdjacentElement("beforeend",e[1]??rN()),bx++,()=>{bx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),bx--}},[])}function rN(){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 zs=function(){return zs=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},zs.apply(this,arguments)};function N_(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 vq(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 pp="right-scroll-bar-position",mp="width-before-scroll-bar",wq="with-scroll-bars-hidden",bq="--removed-body-scroll-bar-size";function kx(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function kq(e,t){var n=y.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 Sq=typeof window<"u"?y.useLayoutEffect:y.useEffect,sN=new WeakMap;function Cq(e,t){var n=kq(null,function(r){return e.forEach(function(s){return kx(s,r)})});return Sq(function(){var r=sN.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(l){i.has(l)||kx(l,null)}),i.forEach(function(l){s.has(l)||kx(l,o)})}sN.set(n,e)},[e]),n}function Eq(e){return e}function Nq(e,t){t===void 0&&(t=Eq);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 Tq(e){e===void 0&&(e={});var t=Nq(null);return t.options=zs({async:!0,ssr:!1},e),t}var T_=function(e){var t=e.sideCar,n=N_(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 y.createElement(r,zs({},n))};T_.isSideCarExport=!0;function Rq(e,t){return e.useMedium(t),T_}var R_=Tq(),Sx=function(){},Kg=y.forwardRef(function(e,t){var n=y.useRef(null),r=y.useState({onScrollCapture:Sx,onWheelCapture:Sx,onTouchMoveCapture:Sx}),s=r[0],i=r[1],o=e.forwardProps,l=e.children,a=e.className,u=e.removeScrollBar,c=e.enabled,d=e.shards,f=e.sideCar,h=e.noRelative,m=e.noIsolation,g=e.inert,v=e.allowPinchZoom,x=e.as,w=x===void 0?"div":x,b=e.gapMode,C=N_(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,k=Cq([n,t]),E=zs(zs({},C),s);return y.createElement(y.Fragment,null,c&&y.createElement(S,{sideCar:R_,removeScrollBar:u,shards:d,noRelative:h,noIsolation:m,inert:g,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:b}),o?y.cloneElement(y.Children.only(l),zs(zs({},E),{ref:k})):y.createElement(w,zs({},E,{className:a,ref:k}),l))});Kg.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Kg.classNames={fullWidth:mp,zeroRight:pp};var jq=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Mq(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=jq();return t&&e.setAttribute("nonce",t),e}function Oq(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Pq(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Aq=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Mq())&&(Oq(t,n),Pq(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},_q=function(){var e=Aq();return function(t,n){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},j_=function(){var e=_q(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Iq={left:0,top:0,right:0,gap:0},Cx=function(e){return parseInt(e||"",10)||0},Dq=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[Cx(n),Cx(r),Cx(s)]},Lq=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Iq;var t=Dq(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])}},$q=j_(),lu="data-scroll-locked",zq=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
419
|
+
.`.concat(wq,` {
|
|
420
|
+
overflow: hidden `).concat(r,`;
|
|
421
|
+
padding-right: `).concat(l,"px ").concat(r,`;
|
|
422
|
+
}
|
|
423
|
+
body[`).concat(lu,`] {
|
|
424
|
+
overflow: hidden `).concat(r,`;
|
|
425
|
+
overscroll-behavior: contain;
|
|
426
|
+
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
427
|
+
padding-left: `.concat(s,`px;
|
|
428
|
+
padding-top: `).concat(i,`px;
|
|
429
|
+
padding-right: `).concat(o,`px;
|
|
430
|
+
margin-left:0;
|
|
431
|
+
margin-top:0;
|
|
432
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
433
|
+
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.`).concat(pp,` {
|
|
437
|
+
right: `).concat(l,"px ").concat(r,`;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.`).concat(mp,` {
|
|
441
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.`).concat(pp," .").concat(pp,` {
|
|
445
|
+
right: 0 `).concat(r,`;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.`).concat(mp," .").concat(mp,` {
|
|
449
|
+
margin-right: 0 `).concat(r,`;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
body[`).concat(lu,`] {
|
|
453
|
+
`).concat(bq,": ").concat(l,`px;
|
|
454
|
+
}
|
|
455
|
+
`)},iN=function(){var e=parseInt(document.body.getAttribute(lu)||"0",10);return isFinite(e)?e:0},Fq=function(){y.useEffect(function(){return document.body.setAttribute(lu,(iN()+1).toString()),function(){var e=iN()-1;e<=0?document.body.removeAttribute(lu):document.body.setAttribute(lu,e.toString())}},[])},Bq=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;Fq();var i=y.useMemo(function(){return Lq(s)},[s]);return y.createElement($q,{styles:zq(i,!t,s,n?"":"!important")})},cw=!1;if(typeof window<"u")try{var kh=Object.defineProperty({},"passive",{get:function(){return cw=!0,!0}});window.addEventListener("test",kh,kh),window.removeEventListener("test",kh,kh)}catch{cw=!1}var ka=cw?{passive:!1}:!1,Vq=function(e){return e.tagName==="TEXTAREA"},M_=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Vq(e)&&n[t]==="visible")},Hq=function(e){return M_(e,"overflowY")},Uq=function(e){return M_(e,"overflowX")},oN=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=O_(e,r);if(s){var i=P_(e,r),o=i[1],l=i[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},qq=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Wq=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},O_=function(e,t){return e==="v"?Hq(t):Uq(t)},P_=function(e,t){return e==="v"?qq(t):Wq(t)},Kq=function(e,t){return e==="h"&&t==="rtl"?-1:1},Qq=function(e,t,n,r,s){var i=Kq(e,window.getComputedStyle(t).direction),o=i*r,l=n.target,a=t.contains(l),u=!1,c=o>0,d=0,f=0;do{if(!l)break;var h=P_(e,l),m=h[0],g=h[1],v=h[2],x=g-v-i*m;(m||x)&&O_(e,l)&&(d+=x,f+=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(f)<1)&&(u=!0),u},Sh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},lN=function(e){return[e.deltaX,e.deltaY]},aN=function(e){return e&&"current"in e?e.current:e},Gq=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Jq=function(e){return`
|
|
456
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
457
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
458
|
+
`)},Zq=0,Sa=[];function Yq(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),s=y.useState(Zq++)[0],i=y.useState(j_)[0],o=y.useRef(e);y.useEffect(function(){o.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=vq([e.lockRef.current],(e.shards||[]).map(aN),!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=y.useCallback(function(g,v){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var x=Sh(g),w=n.current,b="deltaX"in g?g.deltaX:w[0]-x[0],C="deltaY"in g?g.deltaY:w[1]-x[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 T=window.getSelection(),O=T&&T.anchorNode,N=O?O===k||O.contains(k):!1;if(N)return!1;var j=oN(E,k);if(!j)return!0;if(j?S=E:(S=E==="v"?"h":"v",j=oN(E,k)),!j)return!1;if(!r.current&&"changedTouches"in g&&(b||C)&&(r.current=S),!S)return!0;var P=r.current||S;return Qq(P,v,g,P==="h"?b:C)},[]),a=y.useCallback(function(g){var v=g;if(!(!Sa.length||Sa[Sa.length-1]!==i)){var x="deltaY"in v?lN(v):Sh(v),w=t.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&Gq(S.delta,x)})[0];if(w&&w.should){v.cancelable&&v.preventDefault();return}if(!w){var b=(o.current.shards||[]).map(aN).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=y.useCallback(function(g,v,x,w){var b={name:g,delta:v,target:x,should:w,shadowParent:Xq(x)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(C){return C!==b})},1)},[]),c=y.useCallback(function(g){n.current=Sh(g),r.current=void 0},[]),d=y.useCallback(function(g){u(g.type,lN(g),g.target,l(g,e.lockRef.current))},[]),f=y.useCallback(function(g){u(g.type,Sh(g),g.target,l(g,e.lockRef.current))},[]);y.useEffect(function(){return Sa.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",a,ka),document.addEventListener("touchmove",a,ka),document.addEventListener("touchstart",c,ka),function(){Sa=Sa.filter(function(g){return g!==i}),document.removeEventListener("wheel",a,ka),document.removeEventListener("touchmove",a,ka),document.removeEventListener("touchstart",c,ka)}},[]);var h=e.removeScrollBar,m=e.inert;return y.createElement(y.Fragment,null,m?y.createElement(i,{styles:Jq(s)}):null,h?y.createElement(Bq,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Xq(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const eW=Rq(R_,Yq);var Bk=y.forwardRef(function(e,t){return y.createElement(Kg,zs({},e,{ref:t,sideCar:eW}))});Bk.classNames=Kg.classNames;var tW=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ca=new WeakMap,Ch=new WeakMap,Eh={},Ex=0,A_=function(e){return e&&(e.host||A_(e.parentNode))},nW=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=A_(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})},rW=function(e,t,n,r){var s=nW(t,Array.isArray(e)?e:[e]);Eh[n]||(Eh[n]=new WeakMap);var i=Eh[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(f){if(l.has(f))c(f);else try{var h=f.getAttribute(r),m=h!==null&&h!=="false",g=(Ca.get(f)||0)+1,v=(i.get(f)||0)+1;Ca.set(f,g),i.set(f,v),o.push(f),g===1&&m&&Ch.set(f,!0),v===1&&f.setAttribute(n,"true"),m||f.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",f,x)}})};return c(t),l.clear(),Ex++,function(){o.forEach(function(d){var f=Ca.get(d)-1,h=i.get(d)-1;Ca.set(d,f),i.set(d,h),f||(Ch.has(d)||d.removeAttribute(r),Ch.delete(d)),h||d.removeAttribute(n)}),Ex--,Ex||(Ca=new WeakMap,Ca=new WeakMap,Ch=new WeakMap,Eh={})}},__=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=tW(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),rW(r,s,n,"aria-hidden")):function(){return null}},Qg="Dialog",[I_]=qg(Qg),[sW,Ss]=I_(Qg),D_=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,l=y.useRef(null),a=y.useRef(null),[u,c]=Lk({prop:r,defaultProp:s??!1,onChange:i,caller:Qg});return p.jsx(sW,{scope:t,triggerRef:l,contentRef:a,contentId:ps(),titleId:ps(),descriptionId:ps(),open:u,onOpenChange:c,onOpenToggle:y.useCallback(()=>c(d=>!d),[c]),modal:o,children:n})};D_.displayName=Qg;var L_="DialogTrigger",iW=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ss(L_,n),i=Er(t,s.triggerRef);return p.jsx(Mn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Uk(s.open),...r,ref:i,onClick:Kt(e.onClick,s.onOpenToggle)})});iW.displayName=L_;var Vk="DialogPortal",[oW,$_]=I_(Vk,{forceMount:void 0}),z_=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=Ss(Vk,t);return p.jsx(oW,{scope:t,forceMount:n,children:y.Children.map(r,o=>p.jsx(fa,{present:n||i.open,children:p.jsx(Fk,{asChild:!0,container:s,children:o})}))})};z_.displayName=Vk;var um="DialogOverlay",F_=y.forwardRef((e,t)=>{const n=$_(um,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=Ss(um,e.__scopeDialog);return i.modal?p.jsx(fa,{present:r||i.open,children:p.jsx(aW,{...s,ref:t})}):null});F_.displayName=um;var lW=$k("DialogOverlay.RemoveScroll"),aW=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ss(um,n);return p.jsx(Bk,{as:lW,allowPinchZoom:!0,shards:[s.contentRef],children:p.jsx(Mn.div,{"data-state":Uk(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Gl="DialogContent",B_=y.forwardRef((e,t)=>{const n=$_(Gl,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=Ss(Gl,e.__scopeDialog);return p.jsx(fa,{present:r||i.open,children:i.modal?p.jsx(uW,{...s,ref:t}):p.jsx(cW,{...s,ref:t})})});B_.displayName=Gl;var uW=y.forwardRef((e,t)=>{const n=Ss(Gl,e.__scopeDialog),r=y.useRef(null),s=Er(t,n.contentRef,r);return y.useEffect(()=>{const i=r.current;if(i)return __(i)},[]),p.jsx(V_,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Kt(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Kt(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:Kt(e.onFocusOutside,i=>i.preventDefault())})}),cW=y.forwardRef((e,t)=>{const n=Ss(Gl,e.__scopeDialog),r=y.useRef(!1),s=y.useRef(!1);return p.jsx(V_,{...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()}})}),V_=y.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,l=Ss(Gl,n),a=y.useRef(null),u=Er(t,a);return E_(),p.jsxs(p.Fragment,{children:[p.jsx(zk,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:p.jsx(Wg,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Uk(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(dW,{titleId:l.titleId}),p.jsx(hW,{contentRef:a,descriptionId:l.descriptionId})]})]})}),Hk="DialogTitle",H_=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ss(Hk,n);return p.jsx(Mn.h2,{id:s.titleId,...r,ref:t})});H_.displayName=Hk;var U_="DialogDescription",q_=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ss(U_,n);return p.jsx(Mn.p,{id:s.descriptionId,...r,ref:t})});q_.displayName=U_;var W_="DialogClose",K_=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ss(W_,n);return p.jsx(Mn.button,{type:"button",...r,ref:t,onClick:Kt(e.onClick,()=>s.onOpenChange(!1))})});K_.displayName=W_;function Uk(e){return e?"open":"closed"}var Q_="DialogTitleWarning",[tfe,G_]=F9(Q_,{contentName:Gl,titleName:Hk,docsSlug:"dialog"}),dW=({titleId:e})=>{const t=G_(Q_),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
459
|
+
|
|
460
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
461
|
+
|
|
462
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return y.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},fW="DialogDescriptionWarning",hW=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${G_(fW).contentName}}.`;return y.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},J_=D_,Z_=z_,qk=F_,Wk=B_,Y_=H_,X_=q_,pW=K_,mW=Symbol.for("react.lazy"),cm=Ef[" use ".trim().toString()];function gW(e){return typeof e=="object"&&e!==null&&"then"in e}function e2(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===mW&&"_payload"in e&&gW(e._payload)}function yW(e){const t=xW(e),n=y.forwardRef((r,s)=>{let{children:i,...o}=r;e2(i)&&typeof cm=="function"&&(i=cm(i._payload));const l=y.Children.toArray(i),a=l.find(wW);if(a){const u=a.props.children,c=l.map(d=>d===a?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:d);return p.jsx(t,{...o,ref:s,children:y.isValidElement(u)?y.cloneElement(u,void 0,c):null})}return p.jsx(t,{...o,ref:s,children:i})});return n.displayName=`${e}.Slot`,n}function xW(e){const t=y.forwardRef((n,r)=>{let{children:s,...i}=n;if(e2(s)&&typeof cm=="function"&&(s=cm(s._payload)),y.isValidElement(s)){const o=kW(s),l=bW(i,s.props);return s.type!==y.Fragment&&(l.ref=r?Ho(r,o):o),y.cloneElement(s,l)}return y.Children.count(s)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vW=Symbol("radix.slottable");function wW(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vW}function bW(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 kW(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 SW=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],nl=SW.reduce((e,t)=>{const n=yW(`Primitive.${t}`),r=y.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}},{}),jc='[cmdk-group=""]',Nx='[cmdk-group-items=""]',CW='[cmdk-group-heading=""]',t2='[cmdk-item=""]',uN=`${t2}:not([aria-disabled="true"])`,dw="cmdk-item-select",Pa="data-value",EW=(e,t,n)=>z9(e,t,n),n2=y.createContext(void 0),Df=()=>y.useContext(n2),r2=y.createContext(void 0),Kk=()=>y.useContext(r2),s2=y.createContext(void 0),i2=y.forwardRef((e,t)=>{let n=Aa(()=>{var V,R;return{search:"",value:(R=(V=e.value)!=null?V:e.defaultValue)!=null?R:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Aa(()=>new Set),s=Aa(()=>new Map),i=Aa(()=>new Map),o=Aa(()=>new Set),l=o2(e),{label:a,children:u,value:c,onValueChange:d,filter:f,shouldFilter:h,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...x}=e,w=ps(),b=ps(),C=ps(),S=y.useRef(null),k=DW();Jl(()=>{if(c!==void 0){let V=c.trim();n.current.value=V,E.emit()}},[c]),Jl(()=>{k(6,z)},[]);let E=y.useMemo(()=>({subscribe:V=>(o.current.add(V),()=>o.current.delete(V)),snapshot:()=>n.current,setState:(V,R,D)=>{var F,Y,G,ve;if(!Object.is(n.current[V],R)){if(n.current[V]=R,V==="search")P(),N(),k(1,j);else if(V==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let me=document.getElementById(C);me?me.focus():(F=document.getElementById(w))==null||F.focus()}if(k(7,()=>{var me;n.current.selectedItemId=(me=I())==null?void 0:me.id,E.emit()}),D||k(5,z),((Y=l.current)==null?void 0:Y.value)!==void 0){let me=R??"";(ve=(G=l.current).onValueChange)==null||ve.call(G,me);return}}E.emit()}},emit:()=>{o.current.forEach(V=>V())}}),[]),T=y.useMemo(()=>({value:(V,R,D)=>{var F;R!==((F=i.current.get(V))==null?void 0:F.value)&&(i.current.set(V,{value:R,keywords:D}),n.current.filtered.items.set(V,O(R,D)),k(2,()=>{N(),E.emit()}))},item:(V,R)=>(r.current.add(V),R&&(s.current.has(R)?s.current.get(R).add(V):s.current.set(R,new Set([V]))),k(3,()=>{P(),N(),n.current.value||j(),E.emit()}),()=>{i.current.delete(V),r.current.delete(V),n.current.filtered.items.delete(V);let D=I();k(4,()=>{P(),(D==null?void 0:D.getAttribute("id"))===V&&j(),E.emit()})}),group:V=>(s.current.has(V)||s.current.set(V,new Set),()=>{i.current.delete(V),s.current.delete(V)}),filter:()=>l.current.shouldFilter,label:a||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:w,inputId:C,labelId:b,listInnerRef:S}),[]);function O(V,R){var D,F;let Y=(F=(D=l.current)==null?void 0:D.filter)!=null?F:EW;return V?Y(V,n.current.search,R):0}function N(){if(!n.current.search||l.current.shouldFilter===!1)return;let V=n.current.filtered.items,R=[];n.current.filtered.groups.forEach(F=>{let Y=s.current.get(F),G=0;Y.forEach(ve=>{let me=V.get(ve);G=Math.max(me,G)}),R.push([F,G])});let D=S.current;L().sort((F,Y)=>{var G,ve;let me=F.getAttribute("id"),Je=Y.getAttribute("id");return((G=V.get(Je))!=null?G:0)-((ve=V.get(me))!=null?ve:0)}).forEach(F=>{let Y=F.closest(Nx);Y?Y.appendChild(F.parentElement===Y?F:F.closest(`${Nx} > *`)):D.appendChild(F.parentElement===D?F:F.closest(`${Nx} > *`))}),R.sort((F,Y)=>Y[1]-F[1]).forEach(F=>{var Y;let G=(Y=S.current)==null?void 0:Y.querySelector(`${jc}[${Pa}="${encodeURIComponent(F[0])}"]`);G==null||G.parentElement.appendChild(G)})}function j(){let V=L().find(D=>D.getAttribute("aria-disabled")!=="true"),R=V==null?void 0:V.getAttribute(Pa);E.setState("value",R||void 0)}function P(){var V,R,D,F;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 ve=(R=(V=i.current.get(G))==null?void 0:V.value)!=null?R:"",me=(F=(D=i.current.get(G))==null?void 0:D.keywords)!=null?F:[],Je=O(ve,me);n.current.filtered.items.set(G,Je),Je>0&&Y++}for(let[G,ve]of s.current)for(let me of ve)if(n.current.filtered.items.get(me)>0){n.current.filtered.groups.add(G);break}n.current.filtered.count=Y}function z(){var V,R,D;let F=I();F&&(((V=F.parentElement)==null?void 0:V.firstChild)===F&&((D=(R=F.closest(jc))==null?void 0:R.querySelector(CW))==null||D.scrollIntoView({block:"nearest"})),F.scrollIntoView({block:"nearest"}))}function I(){var V;return(V=S.current)==null?void 0:V.querySelector(`${t2}[aria-selected="true"]`)}function L(){var V;return Array.from(((V=S.current)==null?void 0:V.querySelectorAll(uN))||[])}function H(V){let R=L()[V];R&&E.setState("value",R.getAttribute(Pa))}function K(V){var R;let D=I(),F=L(),Y=F.findIndex(ve=>ve===D),G=F[Y+V];(R=l.current)!=null&&R.loop&&(G=Y+V<0?F[F.length-1]:Y+V===F.length?F[0]:F[Y+V]),G&&E.setState("value",G.getAttribute(Pa))}function _(V){let R=I(),D=R==null?void 0:R.closest(jc),F;for(;D&&!F;)D=V>0?_W(D,jc):IW(D,jc),F=D==null?void 0:D.querySelector(uN);F?E.setState("value",F.getAttribute(Pa)):K(V)}let Q=()=>H(L().length-1),M=V=>{V.preventDefault(),V.metaKey?Q():V.altKey?_(1):K(1)},ie=V=>{V.preventDefault(),V.metaKey?H(0):V.altKey?_(-1):K(-1)};return y.createElement(nl.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:V=>{var R;(R=x.onKeyDown)==null||R.call(x,V);let D=V.nativeEvent.isComposing||V.keyCode===229;if(!(V.defaultPrevented||D))switch(V.key){case"n":case"j":{v&&V.ctrlKey&&M(V);break}case"ArrowDown":{M(V);break}case"p":case"k":{v&&V.ctrlKey&&ie(V);break}case"ArrowUp":{ie(V);break}case"Home":{V.preventDefault(),H(0);break}case"End":{V.preventDefault(),Q();break}case"Enter":{V.preventDefault();let F=I();if(F){let Y=new Event(dw);F.dispatchEvent(Y)}}}}},y.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:$W},a),Gg(e,V=>y.createElement(r2.Provider,{value:E},y.createElement(n2.Provider,{value:T},V))))}),NW=y.forwardRef((e,t)=>{var n,r;let s=ps(),i=y.useRef(null),o=y.useContext(s2),l=Df(),a=o2(e),u=(r=(n=a.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;Jl(()=>{if(!u)return l.item(s,o==null?void 0:o.id)},[u]);let c=l2(s,i,[e.value,e.children,i],e.keywords),d=Kk(),f=qo(k=>k.value&&k.value===c.current),h=qo(k=>u||l.filter()===!1?!0:k.search?k.filtered.items.get(s)>0:!0);y.useEffect(()=>{let k=i.current;if(!(!k||e.disabled))return k.addEventListener(dw,m),()=>k.removeEventListener(dw,m)},[h,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(!h)return null;let{disabled:v,value:x,onSelect:w,forceMount:b,keywords:C,...S}=e;return y.createElement(nl.div,{ref:Ho(i,t),...S,id:s,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!f,"data-disabled":!!v,"data-selected":!!f,onPointerMove:v||l.getDisablePointerSelection()?void 0:g,onClick:v?void 0:m},e.children)}),TW=y.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...i}=e,o=ps(),l=y.useRef(null),a=y.useRef(null),u=ps(),c=Df(),d=qo(h=>s||c.filter()===!1?!0:h.search?h.filtered.groups.has(o):!0);Jl(()=>c.group(o),[]),l2(o,l,[e.value,e.heading,a]);let f=y.useMemo(()=>({id:o,forceMount:s}),[s]);return y.createElement(nl.div,{ref:Ho(l,t),...i,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},n&&y.createElement("div",{ref:a,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),Gg(e,h=>y.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},y.createElement(s2.Provider,{value:f},h))))}),RW=y.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=y.useRef(null),i=qo(o=>!o.search);return!n&&!i?null:y.createElement(nl.div,{ref:Ho(s,t),...r,"cmdk-separator":"",role:"separator"})}),jW=y.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,i=Kk(),o=qo(u=>u.search),l=qo(u=>u.selectedItemId),a=Df();return y.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),y.createElement(nl.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)}})}),MW=y.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,i=y.useRef(null),o=y.useRef(null),l=qo(u=>u.selectedItemId),a=Df();return y.useEffect(()=>{if(o.current&&i.current){let u=o.current,c=i.current,d,f=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{let h=u.offsetHeight;c.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return f.observe(u),()=>{cancelAnimationFrame(d),f.unobserve(u)}}},[]),y.createElement(nl.div,{ref:Ho(i,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:a.listId},Gg(e,u=>y.createElement("div",{ref:Ho(o,a.listInnerRef),"cmdk-list-sizer":""},u)))}),OW=y.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:o,...l}=e;return y.createElement(J_,{open:n,onOpenChange:r},y.createElement(Z_,{container:o},y.createElement(qk,{"cmdk-overlay":"",className:s}),y.createElement(Wk,{"aria-label":e.label,"cmdk-dialog":"",className:i},y.createElement(i2,{ref:t,...l}))))}),PW=y.forwardRef((e,t)=>qo(n=>n.filtered.count===0)?y.createElement(nl.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),AW=y.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...i}=e;return y.createElement(nl.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Gg(e,o=>y.createElement("div",{"aria-hidden":!0},o)))}),or=Object.assign(i2,{List:MW,Item:NW,Input:jW,Group:TW,Separator:RW,Dialog:OW,Empty:PW,Loading:AW});function _W(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function IW(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function o2(e){let t=y.useRef(e);return Jl(()=>{t.current=e}),t}var Jl=typeof window>"u"?y.useEffect:y.useLayoutEffect;function Aa(e){let t=y.useRef();return t.current===void 0&&(t.current=e()),t}function qo(e){let t=Kk(),n=()=>e(t.snapshot());return y.useSyncExternalStore(t.subscribe,n,n)}function l2(e,t,n,r=[]){let s=y.useRef(),i=Df();return Jl(()=>{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(Pa,l),s.current=l}),s}var DW=()=>{let[e,t]=y.useState(),n=Aa(()=>new Map);return Jl(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function LW(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Gg({asChild:e,children:t},n){return e&&y.isValidElement(t)?y.cloneElement(LW(t),{ref:t.ref},n(t.props.children)):n(t)}var $W={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Xs=J_,zW=Z_,a2=y.forwardRef(({className:e,...t},n)=>p.jsx(qk,{ref:n,className:dt("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}));a2.displayName=qk.displayName;const Cs=y.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(zW,{children:[p.jsx(a2,{}),p.jsxs(Wk,{ref:r,className:dt("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(pW,{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(Bn,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Cs.displayName=Wk.displayName;const ei=({className:e,...t})=>p.jsx("div",{className:dt("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});ei.displayName="DialogHeader";const ti=y.forwardRef(({className:e,...t},n)=>p.jsx(Y_,{ref:n,className:dt("text-lg font-semibold leading-none tracking-tight",e),...t}));ti.displayName=Y_.displayName;const Lf=y.forwardRef(({className:e,...t},n)=>p.jsx(X_,{ref:n,className:dt("text-sm text-muted-foreground",e),...t}));Lf.displayName=X_.displayName;const u2=y.forwardRef(({className:e,...t},n)=>p.jsx(or,{ref:n,className:dt("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));u2.displayName=or.displayName;const FW=({children:e,...t})=>p.jsx(Xs,{...t,children:p.jsx(Cs,{className:"overflow-hidden p-0 shadow-2xl",children:p.jsx(u2,{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})})}),c2=y.forwardRef(({className:e,...t},n)=>p.jsxs("div",{className:"flex items-center gap-2 px-3","cmdk-input-wrapper":"",children:[p.jsx(Pk,{className:"h-4 w-4 text-muted-foreground"}),p.jsx(or.Input,{ref:n,className:dt("flex h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",e),...t})]}));c2.displayName=or.Input.displayName;const d2=y.forwardRef(({className:e,...t},n)=>p.jsx(or.List,{ref:n,className:dt("max-h-[360px] overflow-y-auto overflow-x-hidden",e),...t}));d2.displayName=or.List.displayName;const f2=y.forwardRef((e,t)=>p.jsx(or.Empty,{ref:t,className:"py-6 text-center text-sm text-muted-foreground",...e}));f2.displayName=or.Empty.displayName;const _a=y.forwardRef(({className:e,...t},n)=>p.jsx(or.Group,{ref:n,className:dt("overflow-hidden p-1 text-foreground",e),...t}));_a.displayName=or.Group.displayName;const gp=y.forwardRef(({className:e,...t},n)=>p.jsx(or.Separator,{ref:n,className:dt("-mx-1 h-px bg-border",e),...t}));gp.displayName=or.Separator.displayName;const Ia=y.forwardRef(({className:e,...t},n)=>p.jsx(or.Item,{ref:n,className:dt("relative flex cursor-default select-none items-center",e),...t}));Ia.displayName=or.Item.displayName;const Tx=e=>e.displayName??e.name,BW=e=>e==="project"?p.jsx(Lu,{className:"h-4 w-4 text-muted-foreground"}):e==="document"?p.jsx(ca,{className:"h-4 w-4 text-muted-foreground"}):p.jsx(qA,{className:"h-4 w-4 text-muted-foreground"}),VW=()=>{const{docs:e}=g_(),{recentItems:t,trackItem:n,removeItem:r}=j9(),{open:s,onOpenChange:i,activeDoc:o,commands:l,onSelectDoc:a,onRunCommand:u}=v_(),{projects:c,activeProject:d,setActiveProjectId:f}=$t(),h=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),f(b)},v=b=>{n("document",b.name,Tx(b)),a(b)},x=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&&x(C)}};return p.jsxs(FW,{open:s,onOpenChange:i,children:[p.jsx(c2,{placeholder:"Search docs, projects, or commands..."}),p.jsxs(d2,{children:[p.jsx(f2,{children:"No matches found."}),t.length>0?p.jsxs(p.Fragment,{children:[p.jsx(_a,{heading:"Recent",children:t.map(b=>p.jsx(Ia,{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}):BW(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(Bn,{className:"h-3 w-3"})})]})},`recent-${b.type}-${b.id}`))}),p.jsx(gp,{})]}):null,c.length>0?p.jsx(_a,{heading:"Projects",children:c.map(b=>p.jsx(Ia,{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(Lu,{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(gp,{}):null,e.length>0?p.jsx(_a,{heading:"Documents",children:e.map(b=>p.jsx(Ia,{value:`${Tx(b)} ${b.name}`,onSelect:()=>v(b),children:p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(ca,{className:"h-4 w-4 text-muted-foreground"}),p.jsxs("span",{className:"flex flex-col",children:[p.jsx("span",{children:Tx(b)}),p.jsx("span",{className:"text-xs text-muted-foreground",children:b.name})]})]})},b.name))}):null,(e.length>0||c.length>0)&&(h.length>0||m.length>0)?p.jsx(gp,{}):null,h.length>0?p.jsx(_a,{heading:"Document commands",children:h.map(b=>p.jsxs(Ia,{value:`${b.label} ${(b.keywords??[]).join(" ")}`,onSelect:()=>x(b),disabled:!o,children:[p.jsxs("span",{className:"flex flex-1 items-center gap-2",children:[p.jsx(WA,{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:iw(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(_a,{heading:"Global commands",children:m.map(b=>p.jsxs(Ia,{value:`${b.label} ${(b.keywords??[]).join(" ")}`,onSelect:()=>x(b),children:[p.jsxs("span",{className:"flex flex-1 items-center gap-2",children:[p.jsx(qA,{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:iw(b.shortcut)}):null]},b.id))}):null]})]})},HW=({filePath:e})=>{var i;const{activeProject:t}=$t(),n=(t==null?void 0:t.id)??"",r=Ue.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(Ok,{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})})})]})},cN=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,dN=n_,UW=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return dN(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 f=cN(c)||cN(d);return s[u][f]}),l=n&&Object.entries(n).reduce((u,c)=>{let[d,f]=c;return f===void 0||(u[d]=f),u},{}),a=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,c)=>{let{class:d,className:f,...h}=c;return Object.entries(h).every(m=>{let[g,v]=m;return Array.isArray(v)?v.includes({...i,...l}[g]):{...i,...l}[g]===v})?[...u,d,f]:u},[]);return dN(e,o,a,n==null?void 0:n.class,n==null?void 0:n.className)},qW=UW("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"}}),te=y.forwardRef(({className:e,variant:t,size:n,...r},s)=>p.jsx("button",{className:dt(qW({variant:t,size:n,className:e})),ref:s,...r}));te.displayName="Button";const h2=y.createContext(null),WW=h2.Provider,Nr=()=>{const e=y.useContext(h2);if(!e)throw new Error("useAppStateContext must be used within AppStateProvider.");return e},p2=y.createContext(null),KW=p2.Provider,m2=()=>{const e=y.useContext(p2);if(!e)throw new Error("useCreateDocDialogContext must be used within CreateDocDialogProvider.");return e},g2=()=>{const{activeProject:e}=$t(),t=Ue.useUtils(),n=Ue.tags.list.useQuery({projectId:(e==null?void 0:e.id)??""},{enabled:!!e,refetchInterval:1e4,refetchOnWindowFocus:!1}),r=y.useMemo(()=>{var l;const o=((l=n.data)==null?void 0:l.tags)??[];return[...new Set(o)].sort()},[n.data]),s=y.useMemo(()=>n.error?String(n.error):"",[n.error]),i=y.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}},QW=()=>{const{dialogs:{createDoc:e}}=Nr(),{open:t,setOpen:n,docType:r,folder:s}=m2(),{tags:i}=g2(),[o,l]=y.useState(""),[a,u]=y.useState([]),[c,d]=y.useState(""),[f,h]=y.useState(""),[m,g]=y.useState("");y.useEffect(()=>{t&&(l(""),u([]),d(""),h(""),g(""))},[t]);const v=y.useMemo(()=>{const S=o.trim();if(!S)return"";const k=N=>N.toLowerCase().replace(/[\s_]+/g,"-").replace(/-{2,}/g,"-").replace(/^-|-$/g,""),E=S.toLowerCase();let T=S;const O=[".tasks.json",".app.json",".table.json",".prompt.yaml",".yaml",".json",".md"];for(const N of O)if(E.endsWith(N)){T=S.slice(0,S.length-N.length);break}return r==="app"?`${k(T)}.app.json`:r==="prompt"?`${k(T)}.prompt.yaml`:r==="json"?`${k(T)}.table.json`:`${k(T)}.md`},[r,o]),x=y.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){h("Tags must be lowercase letters only.");return}u(k=>k.includes(S)?k:[...k,S].sort()),d(""),h("")};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:[x.length>0?p.jsx("div",{className:"flex flex-wrap gap-2",children:x.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),f&&h("")},placeholder:"Add a tag"}),p.jsx(te,{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."}),f?p.jsx("div",{className:"text-xs text-destructive",children:f}):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(te,{type:"button",variant:"ghost",onClick:()=>n(!1),children:"Cancel"}),p.jsx(te,{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 GW=Object.defineProperty,JW=(e,t)=>{for(var n in t)GW(e,n,{get:t[n],enumerable:!0})},ml={};JW(ml,{ActiveEmoji:()=>$2,Empty:()=>L2,List:()=>_2,Loading:()=>D2,Root:()=>T2,Search:()=>R2,SkinTone:()=>z2,SkinToneSelector:()=>I2,Viewport:()=>j2});var y2="'Apple Color Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', 'Android Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', EmojiSymbols, sans-serif",Qk=["none","light","medium-light","medium","medium-dark","dark"];function Rx(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Zr=2,kn=null;function fN(e){try{kn??(kn=document.createElement("canvas").getContext("2d",{willReadFrequently:!0}))}catch{}if(!kn||(queueMicrotask(()=>{kn&&(kn=null)}),kn.canvas.width=Zr,kn.canvas.height=Zr,kn.font=`2px ${y2}`,kn.textBaseline="middle",kn.measureText(e).width>=Zr*2))return!1;kn.fillStyle="#00f",kn.fillText(e,0,0);let t=kn.getImageData(0,0,Zr,Zr).data;kn.clearRect(0,0,Zr,Zr),kn.fillStyle="#f00",kn.fillText(e,0,0);let n=kn.getImageData(0,0,Zr,Zr).data;for(let r=0;r<Zr*Zr*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 hN(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 x2(e,t,n){e.setItem(t,JSON.stringify(n))}function pN(e){return t=>t===void 0?void 0:e(t)}function mN(e){return t=>t===null?null:e(t)}function an(e){if(typeof e!="string")throw new Error;return e}function yp(e){if(typeof e!="number")throw new Error;return e}function v2(e){if(typeof e!="boolean")throw new Error;return e}function Qi(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 jx(e){return t=>{if(!Array.isArray(t))throw new Error;return t.length>0&&e(t[0]),t}}var w2=(e,t)=>`${e}/${t}/data.json`,b2=(e,t)=>`${e}/${t}/messages.json`,ZW=["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"],gN="en",k2=e=>`frimousse/data/${e}`,yN="frimousse/metadata";async function xN(e,t){try{return(await fetch(e,{method:"HEAD",signal:t})).headers.get("etag")}catch{return null}}async function YW(e,t,n){let[{emojis:r,emojisEtag:s},{messages:i,messagesEtag:o}]=await Promise.all([fetch(w2(e,t),{signal:n}).then(async l=>({emojis:await l.json(),emojisEtag:l.headers.get("etag")})),fetch(b2(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 XW(e,t,n){let[r,s]=await Promise.all([xN(w2(e,t),n),xN(b2(e,t),n)]);return{emojisEtag:r,messagesEtag:s}}function e8(e){return e.skins?e.skins.filter(t=>typeof t.tone=="number").reduce((t,n)=>{let r=Qk[n.tone];return t[r]=n.emoji,t},{}):void 0}async function vN(e,t,n){let{emojis:r,emojisEtag:s,messages:i,messagesEtag:o}=await YW(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:Rx(m.message)})),d=i.skinTones.reduce((m,g)=>(m[g.key]=Rx(g.message),m),{}),f=u.map(m=>({emoji:m.emoji,category:m.group,version:m.version,label:Rx(m.label),tags:m.tags??[],countryFlag:l&&m.subgroup===l.order||void 0,skins:e8(m)})),h={locale:t,emojis:f,categories:c,skinTones:d};return x2(localStorage,k2(t),{data:h,metadata:{emojisEtag:s,messagesEtag:o}}),h}function t8(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=fN("🇪🇺");if(typeof t=="number")return{emojiVersion:t,countryFlags:i};for(let o of r){let l=n.get(o);if(fN(l))return{emojiVersion:o,countryFlags:i}}return{emojiVersion:s,countryFlags:i}}var n8=Qi({emojiVersion:yp,countryFlags:v2}),r8=Qi({data:Qi({locale:an,emojis:jx(Qi({emoji:an,category:yp,label:an,version:yp,tags:jx(an),countryFlag:pN(v2),skins:pN(Qi({light:an,"medium-light":an,medium:an,"medium-dark":an,dark:an}))})),categories:jx(Qi({index:yp,label:an})),skinTones:Qi({light:an,"medium-light":an,medium:an,"medium-dark":an,dark:an})}),metadata:Qi({emojisEtag:mN(an),messagesEtag:mN(an)})});async function s8({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=hN(sessionStorage,yN,n8),o=hN(localStorage,k2(e),r8),l;if(!o)l=await vN(s,e,r);else if(i)l=o.data;else try{let{emojisEtag:u,messagesEtag:c}=await XW(s,e,r);l=!u||!c||u!==o.metadata.emojisEtag||c!==o.metadata.messagesEtag?await vN(s,e,r):o.data}catch{l=o.data}i??(i=t8(l.emojis,t)),x2(sessionStorage,yN,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 wN(e){return ZW.includes(e)?e:(console.warn(`Locale "${e}" is not supported, using "${gN}" instead.`),gN)}function bN(e){return Qk.includes(e)?e:(console.warn(`Skin tone "${e}" is not valid, using "none" instead.`),"none")}function i8(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 o8(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 l8(e,t,n,r){let s=o8(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 f=a[d.index];if(!f||f.length===0)continue;let h=i8(Array.from(f),t).map(m=>({categoryIndex:u,emojis:m}));i.push(...h),o.push({label:d.label,rowsCount:h.length,startRowIndex:c}),l.push(c),u++,c+=h.length}return{count:s.length,categories:o,categoriesStartRowIndices:l,rows:i,skinTones:e.skinTones}}function a8(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 u8(e){let[t]=y.useState(e);return t}function c8(e){let t=y.createContext(null);return{useStore:()=>{let n=y.useContext(t);if(!n)throw new Error(e);return n},Provider:({store:n,children:r})=>p.jsx(t.Provider,{value:n,children:r})}}function wr(e,t,n=Object.is){let[r,s]=y.useState(()=>t(e.get()));return y.useEffect(()=>e.subscribe(()=>{let i=t(e.get());s(o=>n(o,i)?o:i)}),[e,t,n]),y.useDebugValue(r),r}function Bs(e,t,n){let r=y.useCallback(s=>s[t],[t]);return wr(e,r,n)}var kN=2;function d8(e,t,n,r,s){let i=0;return a8((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 T;let u=l(),c=(a==null?void 0:a.data)??u.data,d=(a==null?void 0:a.categoryHeaderHeight)??u.categoryHeaderHeight,f=(a==null?void 0:a.rowHeight)??u.rowHeight,h=(a==null?void 0:a.viewportHeight)??u.viewportHeight;if(!c||c.rows.length===0||!d||!f||!h)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*f<i)m+=d;else break;let v=c.categories.length*d+c.rows.length*f,x=Math.floor(kN*f/2),w=Math.ceil(kN*f/2),b=Math.min(i-m-x,v-h),C=b+h+w,S=Math.max(0,Math.floor(b/f)),k=Math.min(c.rows.length-1,Math.ceil(C/f)),E=(T=c.rows[S])==null?void 0:T.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:f,sticky:h,rowHeight:m,viewportHeight:g,categoryHeaderHeight:v}=l(),x=d==null?void 0:d.current,w=f==null?void 0:f.current;if(!x||!w||!m||!v||!g)return;let b=c;b===0&&w.scrollTo({top:0,behavior:"instant"});let C=x.querySelector(`[aria-rowindex="${b}"]`);if(!(C instanceof HTMLElement))return;let S=C.offsetTop,k=getComputedStyle(C),E=Number.parseFloat(k.scrollMarginTop),T=Number.parseFloat(k.scrollMarginBottom),O=i+E;h&&S<i+g/2&&(O+=v);let N=O+g-T;(S<O||S+m>N)&&w.scrollTo({top:Math.max(S<O+v?S-Math.max(h?v:0,E):S-g+m+T,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:f8}=c8("EmojiPicker.Root is missing.");function h8(e){return e.search}function Gk(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 p8(e){var t;return e.data===void 0||typeof((t=e.data)==null?void 0:t.count)=="number"&&e.data.count===0}function m8(e){return e.data===null||e.viewportHeight===null||e.rowHeight===null||e.categoryHeaderHeight===null}function S2(e){var t;return(t=e.data)==null?void 0:t.rows.length}function g8(e){var t;return(t=e.data)==null?void 0:t.categories.length}function y8(e){var t;return(t=e.data)==null?void 0:t.categoriesStartRowIndices}function x8(e){var t;return(t=e.data)==null?void 0:t.skinTones}function C2(e,t){return(e==null?void 0:e.emoji)===(t==null?void 0:t.emoji)}function v8(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)=>C2(n,t==null?void 0:t.emojis[r])))}var Mc="",SN=new RegExp("\\p{Emoji_Modifier_Base}","u"),w8=/\uFE0F$/,b8=/\u{1F3FB}|\u{1F3FC}|\u{1F3FD}|\u{1F3FE}|\u{1F3FF}/gu,k8={light:"🏻","medium-light":"🏼",medium:"🏽","medium-dark":"🏾",dark:"🏿"};function S8(e,t){if(!e.split(Mc).some(r=>SN.test(r)))return e;let n=e.split(Mc).map(r=>r.replace(b8,"")).join(Mc);return t==="none"?n:n.split(Mc).map((r,s,i)=>{let o=i.length>1;return!SN.test(r)||o&&r==="🤝"?r:r.replace(w8,"")+k8[t]}).join(Mc)}function C8(e){return Qk.map(t=>({skinTone:t,emoji:S8(e,t)}))}function E2(){let e=lr(),t=wr(e,Gk,C2);return y.useDeferredValue(t)}function N2(e="✋"){let t=lr(),n=Bs(t,"skinTone"),r=y.useMemo(()=>C8(e),[e]),s=y.useCallback(i=>{t.set({skinTone:i})},[]);return[n,s,r]}function Jk(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 E8(...e){}function N8(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 is=typeof window<"u"?y.useLayoutEffect:y.useEffect;function T8(e){let t=y.useRef(e);return is(()=>{t.current=e}),y.useCallback((...n)=>t.current(...n),[])}function R8({emojiVersion:e,emojibaseUrl:t}){let[n,r]=y.useState(void 0),s=lr(),i=Bs(s,"locale"),o=Bs(s,"columns"),l=Bs(s,"skinTone"),a=Bs(s,"search");return y.useEffect(()=>{let u=new AbortController,c=u.signal;return s8({locale:i,emojiVersion:e,emojibaseUrl:t,signal:c}).then(d=>{r(d)}).catch(d=>{c.aborted||console.error(d)}),()=>{u.abort()}},[e,t,i]),y.useEffect(()=>{if(n)return N8(()=>{s.get().onDataChange(l8(n,o,l,a))},{timeout:100})},[n,o,l,a]),null}var T2=y.forwardRef(({locale:e="en",columns:t=9,skinTone:n="none",onEmojiSelect:r=E8,emojiVersion:s,emojibaseUrl:i,onFocusCapture:o,onBlurCapture:l,children:a,style:u,sticky:c=!0,...d},f)=>{let h=T8(r),m=u8(()=>d8(h,wN(e),t,c,bN(n))),[g,v]=y.useState(!1),x=y.useRef(null),w=y.useCallback(S=>{S&&(x.current=S,m.set({rootRef:x}))},[]);is(()=>{m.set({locale:wN(e)})},[e]),is(()=>{m.set({columns:t})},[t]),is(()=>{m.set({sticky:c})},[c]),is(()=>{m.set({skinTone:bN(n)})},[n]);let b=y.useCallback(S=>{o==null||o(S);let{searchRef:k,viewportRef:E}=m.get(),T=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(T||O),S.isDefaultPrevented()||(v(T||O),O?m.get().onActiveEmojiChange("keyboard",0,0):T&&m.get().search===""&&m.set({interaction:"none"})))},[o]),C=y.useCallback(S=>{l==null||l(S),!S.isDefaultPrevented()&&!S.currentTarget.contains(S.relatedTarget)&&v(!1)},[l]);return is(()=>{g||m.get().onActiveEmojiReset()},[g]),y.useImperativeHandle(f,()=>x.current),y.useEffect(()=>{if(!g)return;function S(k){if(k.defaultPrevented||!k.key.startsWith("Arrow")&&k.key!=="Enter")return;let{data:E,onEmojiSelect:T,onActiveEmojiChange:O,interaction:N,activeColumnIndex:j,activeRowIndex:P}=m.get();if(k.key==="Enter"){let z=Gk(m.get());z&&(k.preventDefault(),T(z))}if(k.key.startsWith("Arrow")){let z=j,I=P;if(k.preventDefault(),N!=="none"){if(E!=null&&E.rows&&E.rows.length>0)switch(k.key){case"ArrowLeft":{if(z===0){let L=I-1,H=E.rows[L];H&&(I=L,z=H.emojis.length-1)}else z-=1;break}case"ArrowRight":{if(z===E.rows[I].emojis.length-1){let L=I+1;E.rows[L]&&(I=L,z=0)}else z+=1;break}case"ArrowUp":{let L=E.rows[I-1];L&&(I-=1,L.emojis[z]||(z=L.emojis.length-1));break}case"ArrowDown":{let L=E.rows[I+1];L&&(I+=1,L.emojis[z]||(z=L.emojis.length-1));break}}O("keyboard",z,I)}else O("keyboard",0,0)}}return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[g]),is(()=>{let S=null,k=null,E=null,T=null,O=m.subscribe(I=>{x.current&&(S!==I.viewportWidth&&(S=I.viewportWidth,x.current.style.setProperty("--frimousse-viewport-width",`${I.viewportWidth}px`)),k!==I.viewportHeight&&(k=I.viewportHeight,x.current.style.setProperty("--frimousse-viewport-height",`${I.viewportHeight}px`)),E!==I.rowHeight&&(E=I.rowHeight,x.current.style.setProperty("--frimousse-row-height",`${I.rowHeight}px`)),T!==I.categoryHeaderHeight&&(T=I.categoryHeaderHeight,x.current.style.setProperty("--frimousse-category-header-height",`${I.categoryHeaderHeight}px`)))}),{viewportWidth:N,viewportHeight:j,rowHeight:P,categoryHeaderHeight:z}=m.get();return N&&x.current.style.setProperty("--frimousse-viewport-width",`${N}px`),j&&x.current.style.setProperty("--frimousse-viewport-height",`${j}px`),P&&x.current.style.setProperty("--frimousse-row-height",`${P}px`),z&&x.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":y2,...u},children:p.jsxs(f8,{store:m,children:[p.jsx(R8,{emojiVersion:s,emojibaseUrl:i}),a]})})}),R2=y.forwardRef(({value:e,defaultValue:t,onChange:n,...r},s)=>{let i=lr(),o=y.useRef(null),l=y.useCallback(d=>{d&&(o.current=d,i.set({searchRef:o}))},[]),a=typeof e=="string",u=y.useRef(a);y.useEffect(()=>{u.current=a},[a]),is(()=>{i.set({search:typeof e=="string"?e:typeof t=="string"?t:""})},[]),is(()=>{typeof e=="string"&&i.get().onSearchChange(e)},[e]);let c=y.useCallback(d=>{n==null||n(d),d.isDefaultPrevented()||i.get().onSearchChange(d.target.value)},[n]);return y.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})}),j8=y.memo(()=>{let e=E2();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}),j2=y.forwardRef(({children:e,onScroll:t,onKeyDown:n,style:r,...s},i)=>{let o=lr(),l=y.useRef(null),a=y.useCallback(f=>{f&&(l.current=f,o.set({viewportRef:l}))},[]),u=wr(o,S2),c=wr(o,g8),d=y.useCallback(f=>{t==null||t(f),o.get().onViewportScroll(f.currentTarget.scrollTop)},[t]);return is(()=>{if(!l.current)return;let f=new ResizeObserver(([h])=>{var b,C;let m=((b=h==null?void 0:h.borderBoxSize[0])==null?void 0:b.inlineSize)??0,g=((C=h==null?void 0:h.borderBoxSize[0])==null?void 0:C.blockSize)??0,{onViewportSizeChange:v,viewportHeight:x,viewportWidth:w}=o.get();(x!==g||w!==m)&&v(m,g)});return f.observe(l.current),o.get().onViewportSizeChange(l.current.offsetWidth,l.current.clientHeight),()=>{f.disconnect()}},[]),y.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(j8,{}),e]})});function M2(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 O2(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 P2(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 A2(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 CN(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 EN(e,t,n){return{"aria-colcount":e,"aria-rowcount":t,"frimousse-list":"",style:{"--frimousse-list-columns":e,...n},role:"grid"}}function M8(e){e.preventDefault()}var O8=y.memo(({Emoji:e,emoji:t,columnIndex:n,rowIndex:r})=>{let s=lr(),i=wr(s,u=>{var c;return((c=Gk(u))==null?void 0:c.emoji)===t.emoji}),o=y.useCallback(()=>{s.get().onEmojiSelect(t)},[t]),l=y.useCallback(()=>{s.get().onActiveEmojiChange("pointer",n,r)},[n,r]),a=y.useCallback(()=>{s.get().onActiveEmojiReset()},[]);return p.jsx(e,{...M2(t,n,i),onClick:o,onPointerDown:M8,onPointerEnter:l,onPointerLeave:a})}),P8=y.memo(({Row:e,Emoji:t,rowIndex:n})=>{let r=lr(),s=wr(r,i=>{var o;return(o=i.data)==null?void 0:o.rows[n]},v8);return s?p.jsx(e,{...O2(n),children:s.emojis.map((i,o)=>p.jsx(O8,{Emoji:t,columnIndex:o,emoji:i,rowIndex:n},i.label))}):null}),A8=y.memo(({CategoryHeader:e,categoryIndex:t})=>{let n=lr(),r=wr(n,i=>{var o;return(o=i.data)==null?void 0:o.categories[t]},Jk),s=Bs(n,"sticky");return r?p.jsx("div",{...P2(t,r),children:p.jsx(e,{...A2({label:r.label},!1,s)})}):null}),NN=y.memo(({CategoryHeader:e,Row:t,Emoji:n})=>{let r=y.useRef(null),s=lr(),i=Bs(s,"columns"),o=y.useMemo(()=>Array(i).fill({emoji:"🙂",label:""}),[i]),l=y.useMemo(()=>({label:"Category"}),[]),a=y.useRef(null),u=y.useRef(null);return is(()=>{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 x of v){let w=x.contentRect.height,{onRowHeightChange:b,onCategoryHeaderHeightChange:C,rowHeight:S,categoryHeaderHeight:k}=s.get();x.target===a.current&&S!==w&&b(w),x.target===u.current&&k!==w&&C(w)}});d.observe(c),d.observe(a.current),d.observe(u.current);let{onRowHeightChange:f,onCategoryHeaderHeightChange:h}=s.get();return f(a.current.clientHeight),h(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,{...O2(-1,!0),children:o.map((c,d)=>p.jsx(n,{...M2(c,d,!1)},d))})}),p.jsx("div",{...P2(-1),children:p.jsx("div",{"frimousse-category-header-sizer":"",ref:u,children:p.jsx(e,{...A2(l,!0)})})})]})});function _8({category:e,...t}){return p.jsx("div",{...t,children:e.label})}function I8({emoji:e,...t}){return p.jsx("button",{type:"button",...t,children:e.emoji})}function D8({...e}){return p.jsx("div",{...e})}var _2=y.forwardRef(({style:e,components:t,...n},r)=>{let s=lr(),i=y.useRef(null),o=y.useCallback(x=>{x&&(i.current=x,s.set({listRef:i}))},[]),l=(t==null?void 0:t.CategoryHeader)??_8,a=(t==null?void 0:t.Emoji)??I8,u=(t==null?void 0:t.Row)??D8,c=Bs(s,"columns"),d=Bs(s,"viewportStartRowIndex"),f=Bs(s,"viewportEndRowIndex"),h=wr(s,S2),m=wr(s,y8,Jk),g=y.useMemo(()=>(m==null?void 0:m.filter(x=>x<d).length)??0,[m,d]),v=(m==null?void 0:m.length)??0;return y.useImperativeHandle(r,()=>i.current),!h||!m||v===0?p.jsx("div",{...EN(c,0,e),...n,children:p.jsx("div",{...CN(0,0,0,0),children:p.jsx(NN,{CategoryHeader:l,Emoji:a,Row:u})})}):p.jsx("div",{...EN(c,h,e),...n,ref:o,children:p.jsxs("div",{...CN(h,v,d,g),children:[p.jsx(NN,{CategoryHeader:l,Emoji:a,Row:u}),Array.from({length:f-d+1},(x,w)=>{let b=d+w,C=m.indexOf(b);return p.jsxs(y.Fragment,{children:[C>=0&&p.jsx("div",{style:{height:"var(--frimousse-category-header-height)"}}),p.jsx(P8,{Emoji:a,Row:u,rowIndex:b})]},b)}),Array.from({length:v},(x,w)=>p.jsx(A8,{CategoryHeader:l,categoryIndex:w},w))]})})}),I2=y.forwardRef(({emoji:e,onClick:t,"aria-label":n="Change skin tone",...r},s)=>{let i=lr(),o=wr(i,x8,Jk),[l,a,u]=N2(e),c=y.useMemo(()=>Math.max(0,u.findIndex(v=>v.skinTone===l)),[l,u]),d=u[c],f=u[(c+1)%u.length].skinTone,h=l==="none"||o==null?void 0:o[l],m=f==="none"||o==null?void 0:o[f],g=y.useCallback(v=>{t==null||t(v),v.isDefaultPrevented()||a(f)},[t,a,f]);return p.jsx("button",{type:"button",...r,"aria-label":n+(m?` (${m})`:""),"aria-live":"polite","aria-valuetext":h,"frimousse-skin-tone-selector":"",onClick:g,ref:s,children:d.emoji})});function D2({children:e,...t}){let n=lr();return wr(n,m8)?p.jsx("span",{"frimousse-loading":"",...t,children:e}):null}function L8({children:e}){let t=lr(),n=wr(t,h8);return e({search:n})}function L2({children:e,...t}){let n=lr();return wr(n,p8)?p.jsx("span",{"frimousse-empty":"",...t,children:typeof e=="function"?p.jsx(L8,{children:e}):e}):null}function $2({children:e}){let t=E2();return e({emoji:t})}function z2({children:e,emoji:t}){let[n,r,s]=N2(t);return e({skinTone:n,setSkinTone:r,skinToneVariations:s})}T2.displayName="EmojiPicker.Root";R2.displayName="EmojiPicker.Search";j2.displayName="EmojiPicker.Viewport";_2.displayName="EmojiPicker.List";D2.displayName="EmojiPicker.Loading";L2.displayName="EmojiPicker.Empty";I2.displayName="EmojiPicker.SkinToneSelector";$2.displayName="EmojiPicker.ActiveEmoji";z2.displayName="EmojiPicker.SkinTone";const F2=["top","right","bottom","left"],TN=["start","end"],RN=F2.reduce((e,t)=>e.concat(t,t+"-"+TN[0],t+"-"+TN[1]),[]),xs=Math.min,Rn=Math.max,dm=Math.round,Nh=Math.floor,Us=e=>({x:e,y:e}),$8={left:"right",right:"left",bottom:"top",top:"bottom"},z8={start:"end",end:"start"};function fw(e,t,n){return Rn(e,xs(t,n))}function vs(e,t){return typeof e=="function"?e(t):e}function br(e){return e.split("-")[0]}function ms(e){return e.split("-")[1]}function Zk(e){return e==="x"?"y":"x"}function Yk(e){return e==="y"?"height":"width"}const F8=new Set(["top","bottom"]);function cs(e){return F8.has(br(e))?"y":"x"}function Xk(e){return Zk(cs(e))}function B2(e,t,n){n===void 0&&(n=!1);const r=ms(e),s=Xk(e),i=Yk(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=hm(o)),[o,hm(o)]}function B8(e){const t=hm(e);return[fm(e),t,fm(t)]}function fm(e){return e.replace(/start|end/g,t=>z8[t])}const jN=["left","right"],MN=["right","left"],V8=["top","bottom"],H8=["bottom","top"];function U8(e,t,n){switch(e){case"top":case"bottom":return n?t?MN:jN:t?jN:MN;case"left":case"right":return t?V8:H8;default:return[]}}function q8(e,t,n,r){const s=ms(e);let i=U8(br(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(fm)))),i}function hm(e){return e.replace(/left|right|bottom|top/g,t=>$8[t])}function W8(e){return{top:0,right:0,bottom:0,left:0,...e}}function e1(e){return typeof e!="number"?W8(e):{top:e,right:e,bottom:e,left:e}}function zu(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 ON(e,t,n){let{reference:r,floating:s}=e;const i=cs(t),o=Xk(t),l=Yk(o),a=br(t),u=i==="y",c=r.x+r.width/2-s.width/2,d=r.y+r.height/2-s.height/2,f=r[l]/2-s[l]/2;let h;switch(a){case"top":h={x:c,y:r.y-s.height};break;case"bottom":h={x:c,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-s.width,y:d};break;default:h={x:r.x,y:r.y}}switch(ms(t)){case"start":h[o]-=f*(n&&u?-1:1);break;case"end":h[o]+=f*(n&&u?-1:1);break}return h}async function K8(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:f=!1,padding:h=0}=vs(t,e),m=e1(h),v=l[f?d==="floating"?"reference":"floating":d],x=zu(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=zu(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:b,strategy:a}):w);return{top:(x.top-S.top+m.top)/C.y,bottom:(S.bottom-x.bottom+m.bottom)/C.y,left:(x.left-S.left+m.left)/C.x,right:(S.right-x.right+m.right)/C.x}}const Q8=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}=ON(u,r,a),f=r,h={},m=0;for(let v=0;v<l.length;v++){var g;const{name:x,fn:w}=l[v],{x:b,y:C,data:S,reset:k}=await w({x:c,y:d,initialPlacement:r,placement:f,strategy:s,middlewareData:h,rects:u,platform:{...o,detectOverflow:(g=o.detectOverflow)!=null?g:K8},elements:{reference:e,floating:t}});c=b??c,d=C??d,h={...h,[x]:{...h[x],...S}},k&&m<=50&&(m++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(u=k.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):k.rects),{x:c,y:d}=ON(u,f,a)),v=-1)}return{x:c,y:d,placement:f,strategy:s,middlewareData:h}},G8=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}=vs(e,t)||{};if(u==null)return{};const d=e1(c),f={x:n,y:r},h=Xk(s),m=Yk(h),g=await o.getDimensions(u),v=h==="y",x=v?"top":"left",w=v?"bottom":"right",b=v?"clientHeight":"clientWidth",C=i.reference[m]+i.reference[h]-f[h]-i.floating[m],S=f[h]-i.reference[h],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 T=C/2-S/2,O=E/2-g[m]/2-1,N=xs(d[x],O),j=xs(d[w],O),P=N,z=E-g[m]-j,I=E/2-g[m]/2+T,L=fw(P,I,z),H=!a.arrow&&ms(s)!=null&&I!==L&&i.reference[m]/2-(I<P?N:j)-g[m]/2<0,K=H?I<P?I-P:I-z:0;return{[h]:f[h]+K,data:{[h]:L,centerOffset:I-L-K,...H&&{alignmentOffset:K}},reset:H}}});function J8(e,t,n){return(e?[...n.filter(s=>ms(s)===e),...n.filter(s=>ms(s)!==e)]:n.filter(s=>br(s)===s)).filter(s=>e?ms(s)===e||(t?fm(s)!==s:!1):!0)}const Z8=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:f=RN,autoAlignment:h=!0,...m}=vs(e,t),g=d!==void 0||f===RN?J8(d||null,h,f):f,v=await a.detectOverflow(t,m),x=((n=o.autoPlacement)==null?void 0:n.index)||0,w=g[x];if(w==null)return{};const b=B2(w,i,await(a.isRTL==null?void 0:a.isRTL(u.floating)));if(l!==w)return{reset:{placement:g[0]}};const C=[v[br(w)],v[b[0]],v[b[1]]],S=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:w,overflows:C}],k=g[x+1];if(k)return{data:{index:x+1,overflows:S},reset:{placement:k}};const E=S.map(N=>{const j=ms(N.placement);return[N.placement,j&&c?N.overflows.slice(0,2).reduce((P,z)=>P+z,0):N.overflows[0],N.overflows]}).sort((N,j)=>N[1]-j[1]),O=((s=E.filter(N=>N[2].slice(0,ms(N[0])?2:3).every(j=>j<=0))[0])==null?void 0:s[0])||E[0][0];return O!==l?{data:{index:x+1,overflows:S},reset:{placement:O}}:{}}}},Y8=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:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...v}=vs(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=br(s),w=cs(l),b=br(l)===l,C=await(a.isRTL==null?void 0:a.isRTL(u.floating)),S=f||(b||!g?[hm(l)]:B8(l)),k=m!=="none";!f&&k&&S.push(...q8(l,g,m,C));const E=[l,...S],T=await a.detectOverflow(t,v),O=[];let N=((r=i.flip)==null?void 0:r.overflows)||[];if(c&&O.push(T[x]),d){const I=B2(s,o,C);O.push(T[I[0]],T[I[1]])}if(N=[...N,{placement:s,overflows:O}],!O.every(I=>I<=0)){var j,P;const I=(((j=i.flip)==null?void 0:j.index)||0)+1,L=E[I];if(L&&(!(d==="alignment"?w!==cs(L):!1)||N.every(_=>cs(_.placement)===w?_.overflows[0]>0:!0)))return{data:{index:I,overflows:N},reset:{placement:L}};let H=(P=N.filter(K=>K.overflows[0]<=0).sort((K,_)=>K.overflows[1]-_.overflows[1])[0])==null?void 0:P.placement;if(!H)switch(h){case"bestFit":{var z;const K=(z=N.filter(_=>{if(k){const Q=cs(_.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 PN(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function AN(e){return F2.some(t=>e[t]>=0)}const X8=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...i}=vs(e,t);switch(s){case"referenceHidden":{const o=await r.detectOverflow(t,{...i,elementContext:"reference"}),l=PN(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:AN(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),l=PN(o,n.floating);return{data:{escapedOffsets:l,escaped:AN(l)}}}default:return{}}}}};function V2(e){const t=xs(...e.map(i=>i.left)),n=xs(...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 e7(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=>zu(V2(s)))}const t7=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}=vs(e,t),c=Array.from(await(i.getClientRects==null?void 0:i.getClientRects(r.reference))||[]),d=e7(c),f=zu(V2(c)),h=e1(l);function m(){if(d.length===2&&d[0].left>d[1].right&&a!=null&&u!=null)return d.find(v=>a>v.left-h.left&&a<v.right+h.right&&u>v.top-h.top&&u<v.bottom+h.bottom)||f;if(d.length>=2){if(cs(n)==="y"){const N=d[0],j=d[d.length-1],P=br(n)==="top",z=N.top,I=j.bottom,L=P?N.left:j.left,H=P?N.right:j.right,K=H-L,_=I-z;return{top:z,bottom:I,left:L,right:H,width:K,height:_,x:L,y:z}}const v=br(n)==="left",x=Rn(...d.map(N=>N.right)),w=xs(...d.map(N=>N.left)),b=d.filter(N=>v?N.left===w:N.right===x),C=b[0].top,S=b[b.length-1].bottom,k=w,E=x,T=E-k,O=S-C;return{top:C,bottom:S,left:k,right:E,width:T,height:O,x:k,y:C}}return f}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}}:{}}}},H2=new Set(["left","top"]);async function n7(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=br(n),l=ms(n),a=cs(n)==="y",u=H2.has(o)?-1:1,c=i&&a?-1:1,d=vs(t,e);let{mainAxis:f,crossAxis:h,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"&&(h=l==="end"?m*-1:m),a?{x:h*c,y:f*u}:{x:f*u,y:h*c}}const r7=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 n7(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}}}}},s7=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:x=>{let{x:w,y:b}=x;return{x:w,y:b}}},...u}=vs(e,t),c={x:n,y:r},d=await i.detectOverflow(t,u),f=cs(br(s)),h=Zk(f);let m=c[h],g=c[f];if(o){const x=h==="y"?"top":"left",w=h==="y"?"bottom":"right",b=m+d[x],C=m-d[w];m=fw(b,m,C)}if(l){const x=f==="y"?"top":"left",w=f==="y"?"bottom":"right",b=g+d[x],C=g-d[w];g=fw(b,g,C)}const v=a.fn({...t,[h]:m,[f]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:o,[f]:l}}}}}},i7=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}=vs(e,t),c={x:n,y:r},d=cs(s),f=Zk(d);let h=c[f],m=c[d];const g=vs(l,t),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(a){const b=f==="y"?"height":"width",C=i.reference[f]-i.floating[b]+v.mainAxis,S=i.reference[f]+i.reference[b]-v.mainAxis;h<C?h=C:h>S&&(h=S)}if(u){var x,w;const b=f==="y"?"width":"height",C=H2.has(br(s)),S=i.reference[d]-i.floating[b]+(C&&((x=o.offset)==null?void 0:x[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{[f]:h,[d]:m}}}},o7=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}=vs(e,t),c=await o.detectOverflow(t,u),d=br(s),f=ms(s),h=cs(s)==="y",{width:m,height:g}=i.floating;let v,x;d==="top"||d==="bottom"?(v=d,x=f===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(x=d,v=f==="end"?"top":"bottom");const w=g-c.top-c.bottom,b=m-c.left-c.right,C=xs(g-c[v],w),S=xs(m-c[x],b),k=!t.middlewareData.shift;let E=C,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=w),k&&!f){const N=Rn(c.left,0),j=Rn(c.right,0),P=Rn(c.top,0),z=Rn(c.bottom,0);h?T=m-2*(N!==0||j!==0?N+j:Rn(c.left,c.right)):E=g-2*(P!==0||z!==0?P+z:Rn(c.top,c.bottom))}await a({...t,availableWidth:T,availableHeight:E});const O=await o.getDimensions(l.floating);return m!==O.width||g!==O.height?{reset:{rects:!0}}:{}}}};function Jg(){return typeof window<"u"}function fc(e){return U2(e)?(e.nodeName||"").toLowerCase():"#document"}function yr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ni(e){var t;return(t=(U2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function U2(e){return Jg()?e instanceof Node||e instanceof yr(e).Node:!1}function ws(e){return Jg()?e instanceof Element||e instanceof yr(e).Element:!1}function Ks(e){return Jg()?e instanceof HTMLElement||e instanceof yr(e).HTMLElement:!1}function _N(e){return!Jg()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof yr(e).ShadowRoot}const l7=new Set(["inline","contents"]);function $f(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=bs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!l7.has(s)}const a7=new Set(["table","td","th"]);function u7(e){return a7.has(fc(e))}const c7=[":popover-open",":modal"];function Zg(e){return c7.some(t=>{try{return e.matches(t)}catch{return!1}})}const d7=["transform","translate","scale","rotate","perspective"],f7=["transform","translate","scale","rotate","perspective","filter"],h7=["paint","layout","strict","content"];function t1(e){const t=n1(),n=ws(e)?bs(e):e;return d7.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)||f7.some(r=>(n.willChange||"").includes(r))||h7.some(r=>(n.contain||"").includes(r))}function p7(e){let t=Wo(e);for(;Ks(t)&&!Fu(t);){if(t1(t))return t;if(Zg(t))return null;t=Wo(t)}return null}function n1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const m7=new Set(["html","body","#document"]);function Fu(e){return m7.has(fc(e))}function bs(e){return yr(e).getComputedStyle(e)}function Yg(e){return ws(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Wo(e){if(fc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||_N(e)&&e.host||ni(e);return _N(t)?t.host:t}function q2(e){const t=Wo(e);return Fu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ks(t)&&$f(t)?t:q2(t)}function Yd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=q2(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=yr(s);if(i){const l=hw(o);return t.concat(o,o.visualViewport||[],$f(s)?s:[],l&&n?Yd(l):[])}return t.concat(s,Yd(s,[],n))}function hw(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function W2(e){const t=bs(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Ks(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,l=dm(n)!==i||dm(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function r1(e){return ws(e)?e:e.contextElement}function au(e){const t=r1(e);if(!Ks(t))return Us(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=W2(t);let o=(i?dm(n.width):n.width)/r,l=(i?dm(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const g7=Us(0);function K2(e){const t=yr(e);return!n1()||!t.visualViewport?g7:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function y7(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==yr(e)?!1:t}function Zl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=r1(e);let o=Us(1);t&&(r?ws(r)&&(o=au(r)):o=au(e));const l=y7(i,n,r)?K2(i):Us(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 f=yr(i),h=r&&ws(r)?yr(r):r;let m=f,g=hw(m);for(;g&&r&&h!==m;){const v=au(g),x=g.getBoundingClientRect(),w=bs(g),b=x.left+(g.clientLeft+parseFloat(w.paddingLeft))*v.x,C=x.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=yr(g),g=hw(m)}}return zu({width:c,height:d,x:a,y:u})}function Xg(e,t){const n=Yg(e).scrollLeft;return t?t.left+n:Zl(ni(e)).left+n}function Q2(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Xg(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function x7(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=ni(r),l=t?Zg(t.floating):!1;if(r===o||l&&i)return n;let a={scrollLeft:0,scrollTop:0},u=Us(1);const c=Us(0),d=Ks(r);if((d||!d&&!i)&&((fc(r)!=="body"||$f(o))&&(a=Yg(r)),Ks(r))){const h=Zl(r);u=au(r),c.x=h.x+r.clientLeft,c.y=h.y+r.clientTop}const f=o&&!d&&!i?Q2(o,a):Us(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+c.x+f.x,y:n.y*u.y-a.scrollTop*u.y+c.y+f.y}}function v7(e){return Array.from(e.getClientRects())}function w7(e){const t=ni(e),n=Yg(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+Xg(e);const l=-n.scrollTop;return bs(r).direction==="rtl"&&(o+=Rn(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:l}}const IN=25;function b7(e,t){const n=yr(e),r=ni(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=n1();(!c||c&&t==="fixed")&&(l=s.offsetLeft,a=s.offsetTop)}const u=Xg(r);if(u<=0){const c=r.ownerDocument,d=c.body,f=getComputedStyle(d),h=c.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(r.clientWidth-d.clientWidth-h);m<=IN&&(i-=m)}else u<=IN&&(i+=u);return{width:i,height:o,x:l,y:a}}const k7=new Set(["absolute","fixed"]);function S7(e,t){const n=Zl(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Ks(e)?au(e):Us(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 DN(e,t,n){let r;if(t==="viewport")r=b7(e,n);else if(t==="document")r=w7(ni(e));else if(ws(t))r=S7(t,n);else{const s=K2(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return zu(r)}function G2(e,t){const n=Wo(e);return n===t||!ws(n)||Fu(n)?!1:bs(n).position==="fixed"||G2(n,t)}function C7(e,t){const n=t.get(e);if(n)return n;let r=Yd(e,[],!1).filter(l=>ws(l)&&fc(l)!=="body"),s=null;const i=bs(e).position==="fixed";let o=i?Wo(e):e;for(;ws(o)&&!Fu(o);){const l=bs(o),a=t1(o);!a&&l.position==="fixed"&&(s=null),(i?!a&&!s:!a&&l.position==="static"&&!!s&&k7.has(s.position)||$f(o)&&!a&&G2(e,o))?r=r.filter(c=>c!==o):s=l,o=Wo(o)}return t.set(e,r),r}function E7(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?Zg(t)?[]:C7(t,this._c):[].concat(n),r],l=o[0],a=o.reduce((u,c)=>{const d=DN(t,c,s);return u.top=Rn(d.top,u.top),u.right=xs(d.right,u.right),u.bottom=xs(d.bottom,u.bottom),u.left=Rn(d.left,u.left),u},DN(t,l,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function N7(e){const{width:t,height:n}=W2(e);return{width:t,height:n}}function T7(e,t,n){const r=Ks(t),s=ni(t),i=n==="fixed",o=Zl(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const a=Us(0);function u(){a.x=Xg(s)}if(r||!r&&!i)if((fc(t)!=="body"||$f(s))&&(l=Yg(t)),r){const h=Zl(t,!0,i,t);a.x=h.x+t.clientLeft,a.y=h.y+t.clientTop}else s&&u();i&&!r&&s&&u();const c=s&&!r&&!i?Q2(s,l):Us(0),d=o.left+l.scrollLeft-a.x-c.x,f=o.top+l.scrollTop-a.y-c.y;return{x:d,y:f,width:o.width,height:o.height}}function Mx(e){return bs(e).position==="static"}function LN(e,t){if(!Ks(e)||bs(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ni(e)===n&&(n=n.ownerDocument.body),n}function J2(e,t){const n=yr(e);if(Zg(e))return n;if(!Ks(e)){let s=Wo(e);for(;s&&!Fu(s);){if(ws(s)&&!Mx(s))return s;s=Wo(s)}return n}let r=LN(e,t);for(;r&&u7(r)&&Mx(r);)r=LN(r,t);return r&&Fu(r)&&Mx(r)&&!t1(r)?n:r||p7(e)||n}const R7=async function(e){const t=this.getOffsetParent||J2,n=this.getDimensions,r=await n(e.floating);return{reference:T7(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function j7(e){return bs(e).direction==="rtl"}const M7={convertOffsetParentRelativeRectToViewportRelativeRect:x7,getDocumentElement:ni,getClippingRect:E7,getOffsetParent:J2,getElementRects:R7,getClientRects:v7,getDimensions:N7,getScale:au,isElement:ws,isRTL:j7};function Z2(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function O7(e,t){let n=null,r;const s=ni(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:f,height:h}=u;if(l||t(),!f||!h)return;const m=Nh(d),g=Nh(s.clientWidth-(c+f)),v=Nh(s.clientHeight-(d+h)),x=Nh(c),b={rootMargin:-m+"px "+-g+"px "+-v+"px "+-x+"px",threshold:Rn(0,xs(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&&!Z2(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 P7(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=r1(e),c=s||i?[...u?Yd(u):[],...Yd(t)]:[];c.forEach(x=>{s&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const d=u&&l?O7(u,n):null;let f=-1,h=null;o&&(h=new ResizeObserver(x=>{let[w]=x;w&&w.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(t)})),n()}),u&&!a&&h.observe(u),h.observe(t));let m,g=a?Zl(e):null;a&&v();function v(){const x=Zl(e);g&&!Z2(g,x)&&n(),g=x,m=requestAnimationFrame(v)}return n(),()=>{var x;c.forEach(w=>{s&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),d==null||d(),(x=h)==null||x.disconnect(),h=null,a&&cancelAnimationFrame(m)}}const s1=r7,Y2=Z8,i1=s7,o1=Y8,l1=o7,a1=X8,pm=G8,X2=t7,A7=i7,u1=(e,t,n)=>{const r=new Map,s={platform:M7,...n},i={...s.platform,_c:r};return Q8(e,t,{...s,platform:i})};var _7=typeof document<"u",I7=function(){},xp=_7?y.useLayoutEffect:I7;function mm(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(!mm(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)&&!mm(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function eI(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $N(e,t){const n=eI(e);return Math.round(t*n)/n}function Ox(e){const t=y.useRef(e);return xp(()=>{t.current=e}),t}function D7(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]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=y.useState(r);mm(f,r)||h(r);const[m,g]=y.useState(null),[v,x]=y.useState(null),w=y.useCallback(_=>{_!==k.current&&(k.current=_,g(_))},[]),b=y.useCallback(_=>{_!==E.current&&(E.current=_,x(_))},[]),C=i||m,S=o||v,k=y.useRef(null),E=y.useRef(null),T=y.useRef(c),O=a!=null,N=Ox(a),j=Ox(s),P=Ox(u),z=y.useCallback(()=>{if(!k.current||!E.current)return;const _={placement:t,strategy:n,middleware:f};j.current&&(_.platform=j.current),u1(k.current,E.current,_).then(Q=>{const M={...Q,isPositioned:P.current!==!1};I.current&&!mm(T.current,M)&&(T.current=M,el.flushSync(()=>{d(M)}))})},[f,t,n,j,P]);xp(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(_=>({..._,isPositioned:!1})))},[u]);const I=y.useRef(!1);xp(()=>(I.current=!0,()=>{I.current=!1}),[]),xp(()=>{if(C&&(k.current=C),S&&(E.current=S),C&&S){if(N.current)return N.current(C,S,z);z()}},[C,S,z,N,O]);const L=y.useMemo(()=>({reference:k,floating:E,setReference:w,setFloating:b}),[w,b]),H=y.useMemo(()=>({reference:C,floating:S}),[C,S]),K=y.useMemo(()=>{const _={position:n,left:0,top:0};if(!H.floating)return _;const Q=$N(H.floating,c.x),M=$N(H.floating,c.y);return l?{..._,transform:"translate("+Q+"px, "+M+"px)",...eI(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Q,top:M}},[n,l,H.floating,c.x,c.y]);return y.useMemo(()=>({...c,update:z,refs:L,elements:H,floatingStyles:K}),[c,z,L,H,K])}const L7=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?pm({element:r.current,padding:s}).fn(n):{}:r?pm({element:r,padding:s}).fn(n):{}}}},$7=(e,t)=>({...s1(e),options:[e,t]}),z7=(e,t)=>({...i1(e),options:[e,t]}),F7=(e,t)=>({...A7(e),options:[e,t]}),B7=(e,t)=>({...o1(e),options:[e,t]}),V7=(e,t)=>({...l1(e),options:[e,t]}),H7=(e,t)=>({...a1(e),options:[e,t]}),U7=(e,t)=>({...L7(e),options:[e,t]});var q7="Arrow",tI=y.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return p.jsx(Mn.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"})})});tI.displayName=q7;var W7=tI;function K7(e){const[t,n]=y.useState(void 0);return Uo(()=>{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 c1="Popper",[nI,ey]=qg(c1),[Q7,rI]=nI(c1),sI=e=>{const{__scopePopper:t,children:n}=e,[r,s]=y.useState(null);return p.jsx(Q7,{scope:t,anchor:r,onAnchorChange:s,children:n})};sI.displayName=c1;var iI="PopperAnchor",oI=y.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=rI(iI,n),o=y.useRef(null),l=Er(t,o),a=y.useRef(null);return y.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(Mn.div,{...s,ref:l})});oI.displayName=iI;var d1="PopperContent",[G7,J7]=nI(d1),lI=y.forwardRef((e,t)=>{var G,ve,me,Je,bt,It;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:f=!1,updatePositionStrategy:h="optimized",onPlaced:m,...g}=e,v=rI(d1,n),[x,w]=y.useState(null),b=Er(t,kt=>w(kt)),[C,S]=y.useState(null),k=K7(C),E=(k==null?void 0:k.width)??0,T=(k==null?void 0:k.height)??0,O=r+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},j=Array.isArray(u)?u:[u],P=j.length>0,z={padding:N,boundary:j.filter(Y7),altBoundary:P},{refs:I,floatingStyles:L,placement:H,isPositioned:K,middlewareData:_}=D7({strategy:"fixed",placement:O,whileElementsMounted:(...kt)=>P7(...kt,{animationFrame:h==="always"}),elements:{reference:v.anchor},middleware:[$7({mainAxis:s+T,alignmentAxis:o}),a&&z7({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?F7():void 0,...z}),a&&B7({...z}),V7({...z,apply:({elements:kt,rects:$e,availableWidth:Zt,availableHeight:ht})=>{const{width:Kn,height:Es}=$e.reference,Qn=kt.floating.style;Qn.setProperty("--radix-popper-available-width",`${Zt}px`),Qn.setProperty("--radix-popper-available-height",`${ht}px`),Qn.setProperty("--radix-popper-anchor-width",`${Kn}px`),Qn.setProperty("--radix-popper-anchor-height",`${Es}px`)}}),C&&U7({element:C,padding:l}),X7({arrowWidth:E,arrowHeight:T}),f&&H7({strategy:"referenceHidden",...z})]}),[Q,M]=cI(H),ie=$u(m);Uo(()=>{K&&(ie==null||ie())},[K,ie]);const V=(G=_.arrow)==null?void 0:G.x,R=(ve=_.arrow)==null?void 0:ve.y,D=((me=_.arrow)==null?void 0:me.centerOffset)!==0,[F,Y]=y.useState();return Uo(()=>{x&&Y(window.getComputedStyle(x).zIndex)},[x]),p.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:K?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:F,"--radix-popper-transform-origin":[(Je=_.transformOrigin)==null?void 0:Je.x,(bt=_.transformOrigin)==null?void 0:bt.y].join(" "),...((It=_.hide)==null?void 0:It.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(G7,{scope:n,placedSide:Q,onArrowChange:S,arrowX:V,arrowY:R,shouldHideArrow:D,children:p.jsx(Mn.div,{"data-side":Q,"data-align":M,...g,ref:b,style:{...g.style,animation:K?void 0:"none"}})})})});lI.displayName=d1;var aI="PopperArrow",Z7={top:"bottom",right:"left",bottom:"top",left:"right"},uI=y.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=J7(aI,r),o=Z7[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(W7,{...s,ref:n,style:{...s.style,display:"block"}})})});uI.displayName=aI;function Y7(e){return e!==null}var X7=e=>({name:"transformOrigin",options:e,fn(t){var v,x,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]=cI(n),d={start:"0%",center:"50%",end:"100%"}[c],f=(((x=s.arrow)==null?void 0:x.x)??0)+l/2,h=(((w=s.arrow)==null?void 0:w.y)??0)+a/2;let m="",g="";return u==="bottom"?(m=o?d:`${f}px`,g=`${-a}px`):u==="top"?(m=o?d:`${f}px`,g=`${r.floating.height+a}px`):u==="right"?(m=`${-a}px`,g=o?d:`${h}px`):u==="left"&&(m=`${r.floating.width+a}px`,g=o?d:`${h}px`),{data:{x:m,y:g}}}});function cI(e){const[t,n="center"]=e.split("-");return[t,n]}var dI=sI,f1=oI,fI=lI,hI=uI,ty="Popover",[pI]=qg(ty,[ey]),zf=ey(),[eK,rl]=pI(ty),mI=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=e,l=zf(t),a=y.useRef(null),[u,c]=y.useState(!1),[d,f]=Lk({prop:r,defaultProp:s??!1,onChange:i,caller:ty});return p.jsx(dI,{...l,children:p.jsx(eK,{scope:t,contentId:ps(),triggerRef:a,open:d,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(h=>!h),[f]),hasCustomAnchor:u,onCustomAnchorAdd:y.useCallback(()=>c(!0),[]),onCustomAnchorRemove:y.useCallback(()=>c(!1),[]),modal:o,children:n})})};mI.displayName=ty;var gI="PopoverAnchor",tK=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=rl(gI,n),i=zf(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=s;return y.useEffect(()=>(o(),()=>l()),[o,l]),p.jsx(f1,{...i,...r,ref:t})});tK.displayName=gI;var yI="PopoverTrigger",xI=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=rl(yI,n),i=zf(n),o=Er(t,s.triggerRef),l=p.jsx(Mn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":SI(s.open),...r,ref:o,onClick:Kt(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:p.jsx(f1,{asChild:!0,...i,children:l})});xI.displayName=yI;var h1="PopoverPortal",[nK,rK]=pI(h1,{forceMount:void 0}),vI=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,i=rl(h1,t);return p.jsx(nK,{scope:t,forceMount:n,children:p.jsx(fa,{present:n||i.open,children:p.jsx(Fk,{asChild:!0,container:s,children:r})})})};vI.displayName=h1;var Bu="PopoverContent",wI=y.forwardRef((e,t)=>{const n=rK(Bu,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,i=rl(Bu,e.__scopePopover);return p.jsx(fa,{present:r||i.open,children:i.modal?p.jsx(iK,{...s,ref:t}):p.jsx(oK,{...s,ref:t})})});wI.displayName=Bu;var sK=$k("PopoverContent.RemoveScroll"),iK=y.forwardRef((e,t)=>{const n=rl(Bu,e.__scopePopover),r=y.useRef(null),s=Er(t,r),i=y.useRef(!1);return y.useEffect(()=>{const o=r.current;if(o)return __(o)},[]),p.jsx(Bk,{as:sK,allowPinchZoom:!0,children:p.jsx(bI,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Kt(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Kt(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:Kt(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),oK=y.forwardRef((e,t)=>{const n=rl(Bu,e.__scopePopover),r=y.useRef(!1),s=y.useRef(!1);return p.jsx(bI,{...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()}})}),bI=y.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:u,onInteractOutside:c,...d}=e,f=rl(Bu,n),h=zf(n);return E_(),p.jsx(zk,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:p.jsx(Wg,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:c,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:p.jsx(fI,{"data-state":SI(f.open),role:"dialog",id:f.contentId,...h,...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)"}})})})}),kI="PopoverClose",lK=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=rl(kI,n);return p.jsx(Mn.button,{type:"button",...r,ref:t,onClick:Kt(e.onClick,()=>s.onOpenChange(!1))})});lK.displayName=kI;var aK="PopoverArrow",uK=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=zf(n);return p.jsx(hI,{...s,...r,ref:t})});uK.displayName=aK;function SI(e){return e?"open":"closed"}var cK=mI,dK=xI,fK=vI,hK=wI;function pK({...e}){return p.jsx(cK,{"data-slot":"popover",...e})}function mK({...e}){return p.jsx(dK,{"data-slot":"popover-trigger",...e})}function gK({className:e,align:t="center",sideOffset:n=4,...r}){return p.jsx(fK,{children:p.jsx(hK,{"data-slot":"popover-content",align:t,sideOffset:n,className:dt("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 yK=({onSelect:e})=>p.jsxs(ml.Root,{className:"isolate flex h-[340px] w-[284px] flex-col bg-background text-foreground",onEmojiSelect:t=>e(t.emoji),columns:8,children:[p.jsx(ml.Search,{className:"mx-2 mt-2 rounded-md border bg-background px-2.5 py-2 text-sm",placeholder:"Search emoji..."}),p.jsxs(ml.Viewport,{className:"flex-1 overflow-y-auto overflow-x-hidden px-1",children:[p.jsx(ml.Loading,{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"Loading…"}),p.jsx(ml.Empty,{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"No emoji found."}),p.jsx(ml.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})}})]})]}),CI=({value:e,onChange:t,fallback:n})=>{const[r,s]=y.useState(!1);return p.jsxs(pK,{open:r,onOpenChange:s,children:[p.jsx(mK,{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(gK,{className:"w-auto p-0",align:"start",children:p.jsx(yK,{onSelect:i=>{t(i),s(!1)}})})]})};var uM;const Ea=!!((uM=window.electronAPI)!=null&&uM.pickDirectory),Px="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",xK=({controller:e})=>{const{open:t,setOpen:n}=e,{setActiveProjectId:r}=$t(),[s,i]=y.useState(""),[o,l]=y.useState(null),[a,u]=y.useState([]),[c,d]=y.useState([]),[f,h]=y.useState(""),m=Ue.useUtils(),g=Ue.projects.create.useMutation({onSuccess:N=>{m.projects.list.invalidate(),n(!1),r(N.id)},onError:N=>h(N.message)});y.useEffect(()=>{t&&(i(""),l(null),u([]),d([]),h(""))},[t]);const v=y.useMemo(()=>{const N=s.trim().toLowerCase();return N?N.replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,100):""},[s]),x=()=>{!v||c.length===0||c.some(N=>!N.trim())||(h(""),g.mutate({id:v,name:s.trim(),docsDirs:c.map(N=>N.trim()),rootDirs:a.length>0?a.map(N=>N.trim()):void 0,emoji:o}))},w=y.useCallback(async(N,j)=>{const P=await window.electronAPI.pickDirectory();P&&N(z=>z.map((I,L)=>L===j?P:I))},[]),b=y.useCallback(async()=>{if(Ea){const N=await window.electronAPI.pickDirectory();if(!N)return;u(j=>[...j,N]),d(j=>j.length===0?[N+"/docs"]:j)}else u(N=>[...N,""])},[]),C=y.useCallback(async()=>{if(Ea){const N=await window.electronAPI.pickDirectory();if(!N)return;d(j=>[...j,N])}else d(N=>[...N,""])},[]),S=y.useCallback((N,j)=>{N(P=>P.filter((z,I)=>I!==j))},[]),k=y.useCallback((N,j,P)=>{N(z=>z.map((I,L)=>L===j?P:I))},[]),E=a.length>0,T=c.length>0,O=!!v&&c.length>0&&c.every(N=>N.trim())&&!g.isPending;return p.jsx(Xs,{open:t,onOpenChange:n,children:p.jsxs(Cs,{children:[p.jsxs(ei,{children:[p.jsx(ti,{children:"Create new project"}),p.jsx(Lf,{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(CI,{value:o,onChange:l,fallback:p.jsx(XA,{className:"h-5 w-5"})}),p.jsx("input",{className:Px,value:s,onChange:N=>i(N.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(te,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-2 text-xs text-muted-foreground",onClick:b,children:[p.jsx(Qt,{className:"h-3 w-3"})," Add"]})]}),a.map((N,j)=>p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{className:Px,value:N,onChange:P=>k(u,j,P.target.value),placeholder:"/path/to/project",readOnly:Ea}),Ea&&p.jsx(te,{type:"button",variant:"outline",size:"icon",className:"h-9 w-9 shrink-0",onClick:()=>w(u,j),children:p.jsx(Lu,{className:"h-4 w-4"})}),p.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-muted-foreground",onClick:()=>S(u,j),children:p.jsx(Bn,{className:"h-4 w-4"})})]},j)),!E&&p.jsxs(te,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1 self-start text-xs",onClick:b,children:[p.jsx(Qt,{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"}),T&&p.jsxs(te,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-2 text-xs text-muted-foreground",onClick:C,children:[p.jsx(Qt,{className:"h-3 w-3"})," Add"]})]}),c.map((N,j)=>p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{className:Px,value:N,onChange:P=>k(d,j,P.target.value),placeholder:"/path/to/project/docs",readOnly:Ea}),Ea&&p.jsx(te,{type:"button",variant:"outline",size:"icon",className:"h-9 w-9 shrink-0",onClick:()=>w(d,j),children:p.jsx(Lu,{className:"h-4 w-4"})}),c.length>1&&p.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-muted-foreground",onClick:()=>S(d,j),children:p.jsx(Bn,{className:"h-4 w-4"})})]},j)),!T&&p.jsxs(te,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1 self-start text-xs",onClick:C,children:[p.jsx(Qt,{className:"h-3 w-3"})," Add docs path"]}),p.jsx("span",{className:"text-xs text-muted-foreground",children:"Where your Hyperdoc documents live."})]}),f?p.jsx("div",{className:"text-sm text-destructive",children:f}):null]}),p.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[p.jsx(te,{type:"button",variant:"ghost",onClick:()=>n(!1),children:"Cancel"}),p.jsx(te,{type:"button",disabled:!O,onClick:x,children:g.isPending?"Creating…":"Create"})]})]})})};function vK({item:e,index:t,total:n,features:r,onMove:s,onRename:i,onEdit:o,onDelete:l,onToggle:a}){const[u,c]=y.useState(!1),[d,f]=y.useState(e.label),h=()=>{const g=d.trim();g&&g!==e.label&&i(g),c(!1)},m=()=>{f(e.label),c(!1)};return p.jsxs("div",{className:dt("flex items-center gap-2 border border-border px-3 py-2 text-xs",e.enabled===!1&&"opacity-50"),children:[r.toggle&&p.jsx("input",{type:"checkbox",checked:e.enabled!==!1,onChange:a}),u?p.jsx("input",{autoFocus:!0,className:"h-6 flex-1 rounded border border-input bg-background px-2 text-xs focus-visible:outline-none",value:d,onChange:g=>f(g.target.value),onKeyDown:g=>{g.key==="Enter"&&h(),g.key==="Escape"&&m()}}):p.jsx("span",{className:"flex-1 truncate",children:e.label}),p.jsx("div",{className:"flex items-center gap-1",children:u?p.jsxs(p.Fragment,{children:[p.jsx(te,{type:"button",size:"icon",variant:"ghost",onClick:h,children:p.jsx(ac,{className:"h-4 w-4"})}),p.jsx(te,{type:"button",size:"icon",variant:"ghost",onClick:m,children:p.jsx(Bn,{className:"h-4 w-4"})})]}):p.jsxs(p.Fragment,{children:[r.edit&&p.jsx(te,{type:"button",size:"icon",variant:"ghost",onClick:o,children:p.jsx(GA,{className:"h-3.5 w-3.5"})}),r.rename&&!r.edit&&p.jsx(te,{type:"button",size:"icon",variant:"ghost",onClick:()=>{f(e.label),c(!0)},children:p.jsx(f6,{className:"h-3.5 w-3.5"})}),r.reorder&&p.jsxs(p.Fragment,{children:[p.jsx(te,{type:"button",size:"icon",variant:"ghost",disabled:t===0,onClick:()=>s("up"),children:p.jsx(FA,{className:"h-4 w-4"})}),p.jsx(te,{type:"button",size:"icon",variant:"ghost",disabled:t===n-1,onClick:()=>s("down"),children:p.jsx(ji,{className:"h-4 w-4"})})]}),r.delete&&p.jsx(te,{type:"button",size:"icon",variant:"ghost",onClick:l,children:p.jsx(da,{className:"h-4 w-4 text-destructive"})})]})})]})}const wK={reorder:!0,rename:!0,edit:!1,delete:!0,toggle:!1},bK=({items:e,onChange:t,onEdit:n,features:r,emptyMessage:s="No items."})=>{const i={...wK,...r},o=(c,d)=>{const f=[...e],h=d==="up"?c-1:c+1;h<0||h>=f.length||([f[c],f[h]]=[f[h],f[c]],t(f))},l=(c,d)=>{const f=e.map((h,m)=>m===c?{...h,label:d}:h);t(f)},a=c=>{t(e.filter((d,f)=>f!==c))},u=c=>{const d=e.map((f,h)=>h===c?{...f,enabled:f.enabled===!1}:f);t(d)};return e.length===0?p.jsx("div",{className:"border border-border px-3 py-6 text-center text-sm text-muted-foreground",children:s}):p.jsx("div",{className:"flex flex-col gap-2",children:e.map((c,d)=>p.jsx(vK,{item:c,index:d,total:e.length,features:i,onMove:f=>o(d,f),onRename:f=>l(d,f),onEdit:()=>n==null?void 0:n(c.id),onDelete:()=>a(d),onToggle:()=>u(d)},c.id))})};var cM;const Na=!!((cM=window.electronAPI)!=null&&cM.pickDirectory),Ax="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",kK=({projectId:e,onOpenChange:t})=>{const n=e!==null,r=Ue.useUtils(),[s,i]=y.useState(""),[o,l]=y.useState(null),[a,u]=y.useState([]),[c,d]=y.useState([]),[f,h]=y.useState(""),[m,g]=y.useState(!1),v=Ue.projects.get.useQuery({id:e??""},{enabled:!!e});y.useEffect(()=>{v.data&&(i(v.data.name),l(v.data.emoji),u(v.data.rootDirs),d(v.data.docsDirs),h(""),g(!0))},[v.data]),y.useEffect(()=>{n||g(!1)},[n]);const x=Ue.projects.update.useMutation({onSuccess:()=>{r.projects.list.invalidate(),t(!1)},onError:j=>h(j.message)}),w=()=>{!e||!s.trim()||c.length===0||(h(""),x.mutate({id:e,name:s.trim(),emoji:o,docsDirs:c.map(j=>j.trim()),rootDirs:a.length>0?a.map(j=>j.trim()):void 0}))},b=y.useCallback(async(j,P)=>{const z=await window.electronAPI.pickDirectory();z&&j(I=>I.map((L,H)=>H===P?z:L))},[]),C=y.useCallback(async()=>{if(Na){const j=await window.electronAPI.pickDirectory();if(!j)return;u(P=>[...P,j])}else u(j=>[...j,""])},[]),S=y.useCallback(async()=>{if(Na){const j=await window.electronAPI.pickDirectory();if(!j)return;d(P=>[...P,j])}else d(j=>[...j,""])},[]),k=y.useCallback((j,P)=>{j(z=>z.filter((I,L)=>L!==P))},[]),E=y.useCallback((j,P,z)=>{j(I=>I.map((L,H)=>H===P?z:L))},[]),T=a.length>0,O=c.length>0,N=m&&!!s.trim()&&c.length>0&&c.every(j=>j.trim())&&!x.isPending;return p.jsx(Xs,{open:n,onOpenChange:t,children:p.jsxs(Cs,{children:[p.jsx(ei,{children:p.jsx(ti,{children:"Edit project"})}),m?p.jsxs(p.Fragment,{children:[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(CI,{value:o,onChange:l,fallback:p.jsx(XA,{className:"h-5 w-5"})}),p.jsx("input",{className:Ax,value:s,onChange:j=>i(j.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"}),T&&p.jsxs(te,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-2 text-xs text-muted-foreground",onClick:C,children:[p.jsx(Qt,{className:"h-3 w-3"})," Add"]})]}),a.map((j,P)=>p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{className:Ax,value:j,onChange:z=>E(u,P,z.target.value),placeholder:"/path/to/project",readOnly:Na}),Na&&p.jsx(te,{type:"button",variant:"outline",size:"icon",className:"h-9 w-9 shrink-0",onClick:()=>b(u,P),children:p.jsx(Lu,{className:"h-4 w-4"})}),p.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-muted-foreground",onClick:()=>k(u,P),children:p.jsx(Bn,{className:"h-4 w-4"})})]},P)),!T&&p.jsxs(te,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1 self-start text-xs",onClick:C,children:[p.jsx(Qt,{className:"h-3 w-3"})," Add root path"]})]}),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"}),O&&p.jsxs(te,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-2 text-xs text-muted-foreground",onClick:S,children:[p.jsx(Qt,{className:"h-3 w-3"})," Add"]})]}),c.map((j,P)=>p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{className:Ax,value:j,onChange:z=>E(d,P,z.target.value),placeholder:"/path/to/project/docs",readOnly:Na}),Na&&p.jsx(te,{type:"button",variant:"outline",size:"icon",className:"h-9 w-9 shrink-0",onClick:()=>b(d,P),children:p.jsx(Lu,{className:"h-4 w-4"})}),c.length>1&&p.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-muted-foreground",onClick:()=>k(d,P),children:p.jsx(Bn,{className:"h-4 w-4"})})]},P)),!O&&p.jsxs(te,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1 self-start text-xs",onClick:S,children:[p.jsx(Qt,{className:"h-3 w-3"})," Add docs path"]}),p.jsx("span",{className:"text-xs text-muted-foreground",children:"Where your Hyperdoc documents live."})]}),f?p.jsx("div",{className:"text-sm text-destructive",children:f}):null]}),p.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[p.jsx(te,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),p.jsx(te,{type:"button",disabled:!N,onClick:w,children:x.isPending?"Saving…":"Save"})]})]}):p.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Loading…"})]})})},SK=({open:e,onOpenChange:t})=>{const{projects:n,activeProject:r,setActiveProjectId:s}=$t(),i=Ue.useUtils(),[o,l]=y.useState([]),[a,u]=y.useState(""),[c,d]=y.useState(null);y.useEffect(()=>{e&&(l(n.map(g=>({id:g.id,label:g.name}))),u(""))},[e,n]);const f=Ue.projects.reorder.useMutation({onSuccess:()=>i.projects.list.invalidate(),onError:g=>u(g.message)}),h=Ue.projects.delete.useMutation({onSuccess:(g,v)=>{if(i.projects.list.invalidate(),(r==null?void 0:r.id)===v.id){const x=o.filter(w=>w.id!==v.id);x.length>0&&s(x[0].id)}},onError:g=>u(g.message)}),m=g=>{const v=o;l(g),u("");const x=v.find(b=>!g.some(C=>C.id===b.id));if(x){h.mutate({id:x.id});return}g.length===v.length&&g.some((b,C)=>{var S;return((S=v[C])==null?void 0:S.id)!==b.id})&&f.mutate({ids:g.map(b=>b.id)})};return p.jsxs(p.Fragment,{children:[p.jsx(Xs,{open:e&&!c,onOpenChange:t,children:p.jsxs(Cs,{children:[p.jsx(ei,{children:p.jsx(ti,{children:"Manage projects"})}),p.jsx("div",{className:"max-h-[60vh] overflow-auto py-2",children:p.jsx(bK,{items:o,onChange:m,onEdit:d,features:{edit:!0,rename:!1},emptyMessage:"No projects."})}),a?p.jsx("div",{className:"text-sm text-destructive",children:a}):null,p.jsx("div",{className:"flex justify-end pt-1",children:p.jsx(te,{type:"button",size:"sm",onClick:()=>t(!1),children:"Done"})})]})}),p.jsx(kK,{projectId:c,onOpenChange:()=>d(null)})]})};function CK({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(sU,{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(lm,{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(ac,{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 EI=()=>{const{docHeader:e}=Nr(),{active:t,save:n,saveStatus:r,status:s,conflict:i,openMetadataDialog:o,runCommandAction:l,pinDocCommand:a,archiveDocCommand:u,deleteDocCommand:c}=e,d=!!t,f=()=>{n().catch(()=>{})},h=y.useMemo(()=>{if(t)return()=>l(a)},[t,a,l]),m=y.useMemo(()=>{if(t)return()=>l(u)},[t,u,l]),g=y.useMemo(()=>{if(t)return()=>l(c)},[t,c,l]),v=y.useMemo(()=>{if(!t)return"";const x=t.name;return x.includes("/")?x.slice(x.lastIndexOf("/")+1):x},[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:f,onTogglePinned:h,onArchive:m,onDelete:g}},zN=({label:e,fileName:t})=>{const[n,r]=y.useState(!1),s=y.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(ac,{className:"h-3 w-3 text-neon-green-strong"}):p.jsx(dU,{className:"h-3 w-3"})})]})]})},EK=({nextFileName:e})=>{const{fileName:t,isPinned:n,onTogglePinned:r,onArchive:s,onDelete:i,showMetadataButton:o,onShowMetadata:l,saveStatus:a,onManualSave:u,errorStatus:c}=EI();return p.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[p.jsxs("div",{className:"flex",children:[r?p.jsx(te,{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(JA,{className:`h-4 w-4 ${n?"text-foreground":"text-muted-foreground"}`})}):null,s?p.jsx(te,{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(im,{className:"h-4 w-4 text-muted-foreground"})}):null,i?p.jsx(te,{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(da,{className:"h-4 w-4 text-muted-foreground"})}):null,o?p.jsx(te,{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(WA,{className:"h-4 w-4"})}):null]}),p.jsx("span",{className:"h-5 w-px bg-border/70","aria-hidden":"true"}),p.jsx(CK,{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(zN,{label:e?"Current":"File",fileName:t}):p.jsx("span",{children:"No file name yet"}),e?p.jsx(zN,{label:"New",fileName:e}):null]})]})},NK=()=>{const{docHeader:e}=Nr(),{availableHeaderTags:t,headerTags:n,applyHeaderTags:r}=e,s=y.useMemo(()=>n??[],[n]);return{availableTags:y.useMemo(()=>t??[],[t]),selectedTags:s,applyHeaderTags:r}},TK=()=>{const{selectedTags:e,availableTags:t,applyHeaderTags:n}=NK(),[r,s]=y.useState(!1),[i,o]=y.useState(""),[l,a]=y.useState(""),[u,c]=y.useState([]);y.useEffect(()=>{if(!r){o(""),a(""),c([]);return}c(e)},[r,e]);const d=y.useMemo(()=>t.filter(v=>!u.includes(v)),[t,u]),f=v=>{const x=v.trim().toLowerCase();return!x||!/^[a-z]+$/.test(x)?"":x},h=()=>{const v=f(i);if(!v){a("Tags must be lowercase letters only.");return}c(x=>x.includes(v)?x:[...x,v].sort()),o(""),a("")},m=v=>{c(x=>x.includes(v)?x.filter(w=>w!==v):[...x,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(te,{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(Xs,{open:r,onOpenChange:s,children:p.jsxs(Cs,{className:"max-w-xl",children:[p.jsxs(ei,{className:"text-left",children:[p.jsx(ti,{children:"Edit tags"}),p.jsx(Lf,{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(te,{type:"button",size:"sm",variant:"outline",onClick:h,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(Bn,{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(te,{type:"button",variant:"ghost",onClick:()=>s(!1),children:"Cancel"}),p.jsx(te,{type:"button",onClick:g,children:"Save"})]})]})]})})]})};function RK({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(te,{type:"button",size:"xs",onClick:n,children:"Confirm"}),p.jsx(te,{type:"button",size:"xs",variant:"ghost",onClick:r,children:"Cancel"})]}):null]})})}const jK=e=>{const{draftTitle:t,onDraftTitleChange:n,onConfirmRename:r,onCancelRename:s,showActions:i,inputRef:o,disabled:l}=e;return p.jsx(RK,{value:t,onChange:n,onConfirm:r,onCancel:s,showActions:i,inputRef:o,disabled:l})},MK=()=>{const{docHeader:e}=Nr(),{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=y.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 OK(){const{docType:e,title:t,titleInputRef:n,deriveFileName:r,onTitleChange:s,fileName:i}=MK(),{conflict:o}=EI(),l=!!e,[a,u]=y.useState(t),c=x=>{const w=x.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,f=y.useMemo(()=>r==null?void 0:r(a),[r,a]),m=!!(d&&f&&f!==i)?f:void 0;y.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(jK,{draftTitle:a,onDraftTitleChange:c,onConfirmRename:g,onCancelRename:v,showActions:d,inputRef:n,disabled:!e}),p.jsx(EK,{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(TK,{}):null]})})}function PK({bundleUrl:e,cssUrl:t,mountId:n,bundleType:r="classic",backgroundColor:s,projectId:i}){const[o,l]=y.useState("loading"),a=y.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 AK=({docName:e})=>{const{main:{appConfig:t,appConfigError:n}}=Nr(),{activeProject:r}=$t();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(PK,{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."})]})},_K=({open:e,onOpenChange:t})=>{const{main:{addTableColumn:n,parseColumnOptions:r}}=Nr(),[s,i]=y.useState(""),[o,l]=y.useState("text"),[a,u]=y.useState(""),[c,d]=y.useState(""),f=y.useMemo(()=>r(a),[a,r]),h=g=>{g||t(!1)},m=()=>{const g=s.trim();if(!g){d("Column name is required.");return}if(o==="select"&&f.length===0){d("Select columns need at least one option.");return}n({name:g,type:o,options:o==="select"?f:void 0}),t(!1)};return p.jsx(Xs,{open:e,onOpenChange:h,children:p.jsxs(Cs,{children:[p.jsx(ei,{children:p.jsx(ti,{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(te,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),p.jsx(te,{type:"button",onClick:m,children:"Add"})]})]})]})})};/**
|
|
463
|
+
* table-core
|
|
464
|
+
*
|
|
465
|
+
* Copyright (c) TanStack
|
|
466
|
+
*
|
|
467
|
+
* This source code is licensed under the MIT license found in the
|
|
468
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
469
|
+
*
|
|
470
|
+
* @license MIT
|
|
471
|
+
*/function wo(e,t){return typeof e=="function"?e(t):e}function kr(e,t){return n=>{t.setState(r=>({...r,[e]:wo(n,r[e])}))}}function ny(e){return e instanceof Function}function IK(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function NI(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,f=d/16,h=(m,g)=>{for(m=String(m);m.length<g;)m=" "+m;return m};console.info(`%c⏱ ${h(d,5)} /${h(c,5)} ms`,`
|
|
472
|
+
font-size: .6rem;
|
|
473
|
+
font-weight: bold;
|
|
474
|
+
color: hsl(${Math.max(0,Math.min(120-120*f,120))}deg 100% 31%);`,n==null?void 0:n.key)}return s}}function je(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 DK(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}),je(e.options,"debugCells"))};return e._features.forEach(o=>{o.createCell==null||o.createCell(i,n,t,e)},{}),i}function LK(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=f=>{let h=f;for(const g of a.split(".")){var m;h=(m=h)==null?void 0:m[g]}return h}:c=f=>f[l.accessorKey]),!u)throw new Error;let d={id:`${String(u)}`,accessorFn:c,parent:r,depth:n,columnDef:l,columns:[],getFlatColumns:Re(()=>[!0],()=>{var f;return[d,...(f=d.columns)==null?void 0:f.flatMap(h=>h.getFlatColumns())]},je(e.options,"debugColumns")),getLeafColumns:Re(()=>[e._getOrderColumnsFn()],f=>{var h;if((h=d.columns)!=null&&h.length){let m=d.columns.flatMap(g=>g.getLeafColumns());return f(m)}return[d]},je(e.options,"debugColumns"))};for(const f of e._features)f.createColumn==null||f.createColumn(d,e);return d}const Sn="debugHeaders";function FN(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 $K={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(f=>f.id===d)).filter(Boolean))!=null?i:[],a=(o=s==null?void 0:s.map(d=>n.find(f=>f.id===d)).filter(Boolean))!=null?o:[],u=n.filter(d=>!(r!=null&&r.includes(d.id))&&!(s!=null&&s.includes(d.id)));return Th(t,[...l,...u,...a],e)},je(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))),Th(t,n,e,"center")),je(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 Th(t,i,e,"left")},je(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 Th(t,i,e,"right")},je(e.options,Sn)),e.getFooterGroups=Re(()=>[e.getHeaderGroups()],t=>[...t].reverse(),je(e.options,Sn)),e.getLeftFooterGroups=Re(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),je(e.options,Sn)),e.getCenterFooterGroups=Re(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),je(e.options,Sn)),e.getRightFooterGroups=Re(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),je(e.options,Sn)),e.getFlatHeaders=Re(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),je(e.options,Sn)),e.getLeftFlatHeaders=Re(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),je(e.options,Sn)),e.getCenterFlatHeaders=Re(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),je(e.options,Sn)),e.getRightFlatHeaders=Re(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),je(e.options,Sn)),e.getCenterLeafHeaders=Re(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),je(e.options,Sn)),e.getLeftLeafHeaders=Re(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),je(e.options,Sn)),e.getRightLeafHeaders=Re(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),je(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()},je(e.options,Sn))}};function Th(e,t,n,r){var s,i;let o=0;const l=function(f,h){h===void 0&&(h=1),o=Math.max(o,h),f.filter(m=>m.getIsVisible()).forEach(m=>{var g;(g=m.columns)!=null&&g.length&&l(m.columns,h+1)},0)};l(e);let a=[];const u=(f,h)=>{const m={depth:h,id:[r,`${h}`].filter(Boolean).join("_"),headers:[]},g=[];f.forEach(v=>{const x=[...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),x&&(x==null?void 0:x.column)===b)x.subHeaders.push(v);else{const S=FN(n,b,{id:[r,h,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:h,index:g.length});S.subHeaders.push(v),g.push(S)}m.headers.push(v),v.headerGroup=m}),a.push(m),h>0&&u(g,h-1)},c=t.map((f,h)=>FN(n,f,{depth:o,index:h}));u(c,o-1),a.reverse();const d=f=>f.filter(m=>m.column.getIsVisible()).map(m=>{let g=0,v=0,x=[0];m.subHeaders&&m.subHeaders.length?(x=[],d(m.subHeaders).forEach(b=>{let{colSpan:C,rowSpan:S}=b;g+=C,x.push(S)})):g=1;const w=Math.min(...x);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 ry=(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:()=>NI(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=>DK(e,l,u,u.id)),je(e.options,"debugRows")),_getAllCellsByColumnId:Re(()=>[l.getAllCells()],a=>a.reduce((u,c)=>(u[c.column.id]=c,u),{}),je(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},zK={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()}}},TI=(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))};TI.autoRemove=e=>gs(e);const RI=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};RI.autoRemove=e=>gs(e);const jI=(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())};jI.autoRemove=e=>gs(e);const MI=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};MI.autoRemove=e=>gs(e);const OI=(e,t,n)=>!n.some(r=>{var s;return!((s=e.getValue(t))!=null&&s.includes(r))});OI.autoRemove=e=>gs(e)||!(e!=null&&e.length);const PI=(e,t,n)=>n.some(r=>{var s;return(s=e.getValue(t))==null?void 0:s.includes(r)});PI.autoRemove=e=>gs(e)||!(e!=null&&e.length);const AI=(e,t,n)=>e.getValue(t)===n;AI.autoRemove=e=>gs(e);const _I=(e,t,n)=>e.getValue(t)==n;_I.autoRemove=e=>gs(e);const p1=(e,t,n)=>{let[r,s]=n;const i=e.getValue(t);return i>=r&&i<=s};p1.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]};p1.autoRemove=e=>gs(e)||gs(e[0])&&gs(e[1]);const pi={includesString:TI,includesStringSensitive:RI,equalsString:jI,arrIncludes:MI,arrIncludesAll:OI,arrIncludesSome:PI,equals:AI,weakEquals:_I,inNumberRange:p1};function gs(e){return e==null||e===""}const FK={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:kr("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"?pi.includesString:typeof r=="number"?pi.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?pi.equals:Array.isArray(r)?pi.arrIncludes:pi.weakEquals},e.getFilterFn=()=>{var n,r;return ny(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:pi[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=wo(n,i?i.value:void 0);if(BN(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=wo(t,s))==null?void 0:i.filter(o=>{const l=n.find(a=>a.id===o.id);if(l){const a=l.getFilterFn();if(BN(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 BN(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const BK=(e,t,n)=>n.reduce((r,s)=>{const i=s.getValue(e);return r+(typeof i=="number"?i:0)},0),VK=(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},HK=(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},UK=(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]},qK=(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},WK=(e,t)=>{if(!t.length)return;const n=t.map(i=>i.getValue(e));if(!IK(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},KK=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),QK=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,GK=(e,t)=>t.length,_x={sum:BK,min:VK,max:HK,extent:UK,mean:qK,median:WK,unique:KK,uniqueCount:QK,count:GK},JK={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:kr("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 _x.sum;if(Object.prototype.toString.call(r)==="[object Date]")return _x.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return ny(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:_x[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 YK={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:kr("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Re(n=>[dd(t,n)],n=>n.findIndex(r=>r.id===e.id),je(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=dd(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const s=dd(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)},je(e.options,"debugTable"))}},Ix=()=>({left:[],right:[]}),XK={getInitialState:e=>({columnPinning:Ix(),...e}),getDefaultOptions:e=>({onColumnPinningChange:kr("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))},je(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"})),je(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"})),je(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?Ix():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:Ix())},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),je(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),je(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))},je(e.options,"debugColumns"))}};function eQ(e){return e||(typeof document<"u"?document:null)}const Rh={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Dx=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),tQ={getDefaultColumnDef:()=>Rh,getInitialState:e=>({columnSizing:{},columnSizingInfo:Dx(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:kr("columnSizing",e),onColumnSizingInfoChange:kr("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:Rh.minSize,(r=i??e.columnDef.size)!=null?r:Rh.size),(s=e.columnDef.maxSize)!=null?s:Rh.maxSize)},e.getStart=Re(n=>[n,dd(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((s,i)=>s+i.getSize(),0),je(t.options,"debugColumns")),e.getAfter=Re(n=>[n,dd(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((s,i)=>s+i.getSize(),0),je(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(),Lx(i)&&i.touches&&i.touches.length>1))return;const o=e.getSize(),l=e?e.getLeafHeaders().map(x=>[x.column.id,x.column.getSize()]):[[r.id,r.getSize()]],a=Lx(i)?Math.round(i.touches[0].clientX):i.clientX,u={},c=(x,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,T=Math.max(E/((S=b==null?void 0:b.startSize)!=null?S:0),-.999999);return b.columnSizingStart.forEach(O=>{let[N,j]=O;u[N]=Math.round(Math.max(j+j*T,0)*100)/100}),{...b,deltaOffset:E,deltaPercentage:T}}),(t.options.columnResizeMode==="onChange"||x==="end")&&t.setColumnSizing(b=>({...b,...u})))},d=x=>c("move",x),f=x=>{c("end",x),t.setColumnSizingInfo(w=>({...w,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},h=eQ(n),m={moveHandler:x=>d(x.clientX),upHandler:x=>{h==null||h.removeEventListener("mousemove",m.moveHandler),h==null||h.removeEventListener("mouseup",m.upHandler),f(x.clientX)}},g={moveHandler:x=>(x.cancelable&&(x.preventDefault(),x.stopPropagation()),d(x.touches[0].clientX),!1),upHandler:x=>{var w;h==null||h.removeEventListener("touchmove",g.moveHandler),h==null||h.removeEventListener("touchend",g.upHandler),x.cancelable&&(x.preventDefault(),x.stopPropagation()),f((w=x.touches[0])==null?void 0:w.clientX)}},v=nQ()?{passive:!1}:!1;Lx(i)?(h==null||h.addEventListener("touchmove",g.moveHandler,v),h==null||h.addEventListener("touchend",g.upHandler,v)):(h==null||h.addEventListener("mousemove",m.moveHandler,v),h==null||h.addEventListener("mouseup",m.upHandler,v)),t.setColumnSizingInfo(x=>({...x,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?Dx():(n=e.initialState.columnSizingInfo)!=null?n:Dx())},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 jh=null;function nQ(){if(typeof jh=="boolean")return jh;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 jh=e,jh}function Lx(e){return e.type==="touchstart"}const rQ={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:kr("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()),je(t.options,"debugRows")),e.getVisibleCells=Re(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,s)=>[...n,...r,...s],je(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()),je(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 dd(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const sQ={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()}}},iQ={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:kr("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=()=>pi.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return ny(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:pi[r]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},oQ={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:kr("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()}}}},pw=0,mw=10,$x=()=>({pageIndex:pw,pageSize:mw}),lQ={getInitialState:e=>({...e,pagination:{...$x(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:kr("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=>wo(r,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(s)},e.resetPagination=r=>{var s;e.setPagination(r?$x():(s=e.initialState.pagination)!=null?s:$x())},e.setPageIndex=r=>{e.setPagination(s=>{let i=wo(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?pw:(s=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?s:pw)},e.resetPageSize=r=>{var s,i;e.setPageSize(r?mw:(s=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?s:mw)},e.setPageSize=r=>{e.setPagination(s=>{const i=Math.max(1,wo(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=wo(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},je(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}}},zx=()=>({top:[],bottom:[]}),aQ={getInitialState:e=>({rowPinning:zx(),...e}),getDefaultOptions:e=>({onRowPinningChange:kr("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,f;return{top:((d=a==null?void 0:a.top)!=null?d:[]).filter(g=>!(l!=null&&l.has(g))),bottom:[...((f=a==null?void 0:a.bottom)!=null?f:[]).filter(g=>!(l!=null&&l.has(g))),...Array.from(l)]}}if(n==="top"){var h,m;return{top:[...((h=a==null?void 0:a.top)!=null?h:[]).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?zx():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:zx())},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"),je(e.options,"debugRows")),e.getBottomRows=Re(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),je(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))},je(e.options,"debugRows"))}},uQ={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:kr("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=>{gw(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?Fx(e,n):{rows:[],flatRows:[],rowsById:{}},je(e.options,"debugTable")),e.getFilteredSelectedRowModel=Re(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Fx(e,n):{rows:[],flatRows:[],rowsById:{}},je(e.options,"debugTable")),e.getGroupedSelectedRowModel=Re(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Fx(e,n):{rows:[],flatRows:[],rowsById:{}},je(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 gw(l,e.id,n,(o=r==null?void 0:r.selectChildren)!=null?o:!0,t),l})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return m1(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return yw(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return yw(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)}}}},gw=(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=>gw(e,l.id,n,r,s))};function Fx(e,t){const n=e.getState().rowSelection,r=[],s={},i=function(o,l){return o.map(a=>{var u;const c=m1(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 m1(e,t){var n;return(n=t[e.id])!=null?n:!1}function yw(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()&&(m1(o,t)?i=!0:s=!1),o.subRows&&o.subRows.length)){const l=yw(o,t);l==="all"?i=!0:(l==="some"&&(i=!0),s=!1)}}),s?"all":i?"some":!1}const xw=/([0-9]+)/gm,cQ=(e,t,n)=>II(Ko(e.getValue(n)).toLowerCase(),Ko(t.getValue(n)).toLowerCase()),dQ=(e,t,n)=>II(Ko(e.getValue(n)),Ko(t.getValue(n))),fQ=(e,t,n)=>g1(Ko(e.getValue(n)).toLowerCase(),Ko(t.getValue(n)).toLowerCase()),hQ=(e,t,n)=>g1(Ko(e.getValue(n)),Ko(t.getValue(n))),pQ=(e,t,n)=>{const r=e.getValue(n),s=t.getValue(n);return r>s?1:r<s?-1:0},mQ=(e,t,n)=>g1(e.getValue(n),t.getValue(n));function g1(e,t){return e===t?0:e>t?1:-1}function Ko(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function II(e,t){const n=e.split(xw).filter(Boolean),r=t.split(xw).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 Oc={alphanumeric:cQ,alphanumericCaseSensitive:dQ,text:fQ,textCaseSensitive:hQ,datetime:pQ,basic:mQ},gQ={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:kr("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 Oc.datetime;if(typeof i=="string"&&(r=!0,i.split(xw).length>1))return Oc.alphanumeric}return r?Oc.text:Oc.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 ny(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:Oc[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(h=>h.id===e.id),a=o==null?void 0:o.findIndex(h=>h.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 f;u=[...o,{id:e.id,desc:d}],u.splice(0,u.length-((f=t.options.maxMultiSortColCount)!=null?f:Number.MAX_SAFE_INTEGER))}else c==="toggle"?u=o.map(h=>h.id===e.id?{...h,desc:d}:h):c==="remove"?u=o.filter(h=>h.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())}},yQ=[$K,rQ,YK,XK,zK,FK,sQ,iQ,gQ,JK,oQ,lQ,aQ,uQ,tQ];function xQ(e){var t,n;const r=[...yQ,...(t=e._features)!=null?t:[]];let s={_features:r};const i=s._features.reduce((f,h)=>Object.assign(f,h.getDefaultOptions==null?void 0:h.getDefaultOptions(s)),{}),o=f=>s.options.mergeOptions?s.options.mergeOptions(i,f):{...i,...f};let a={...{},...(n=e.initialState)!=null?n:{}};s._features.forEach(f=>{var h;a=(h=f.getInitialState==null?void 0:f.getInitialState(a))!=null?h:a});const u=[];let c=!1;const d={_features:r,options:{...i,...e},initialState:a,_queue:f=>{u.push(f),c||(c=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();c=!1}).catch(h=>setTimeout(()=>{throw h})))},reset:()=>{s.setState(s.initialState)},setOptions:f=>{const h=wo(f,s.options);s.options=o(h)},getState:()=>s.options.state,setState:f=>{s.options.onStateChange==null||s.options.onStateChange(f)},_getRowId:(f,h,m)=>{var g;return(g=s.options.getRowId==null?void 0:s.options.getRowId(f,h,m))!=null?g:`${m?[m.id,h].join("."):h}`},getCoreRowModel:()=>(s._getCoreRowModel||(s._getCoreRowModel=s.options.getCoreRowModel(s)),s._getCoreRowModel()),getRowModel:()=>s.getPaginationRowModel(),getRow:(f,h)=>{let m=(h?s.getPrePaginationRowModel():s.getRowModel()).rowsById[f];if(!m&&(m=s.getCoreRowModel().rowsById[f],!m))throw new Error;return m},_getDefaultColumnDef:Re(()=>[s.options.defaultColumn],f=>{var h;return f=(h=f)!=null?h:{},{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()),{}),...f}},je(e,"debugColumns")),_getColumnDefs:()=>s.options.columns,getAllColumns:Re(()=>[s._getColumnDefs()],f=>{const h=function(m,g,v){return v===void 0&&(v=0),m.map(x=>{const w=LK(s,x,v,g),b=x;return w.columns=b.columns?h(b.columns,w,v+1):[],w})};return h(f)},je(e,"debugColumns")),getAllFlatColumns:Re(()=>[s.getAllColumns()],f=>f.flatMap(h=>h.getFlatColumns()),je(e,"debugColumns")),_getAllFlatColumnsById:Re(()=>[s.getAllFlatColumns()],f=>f.reduce((h,m)=>(h[m.id]=m,h),{}),je(e,"debugColumns")),getAllLeafColumns:Re(()=>[s.getAllColumns(),s._getOrderColumnsFn()],(f,h)=>{let m=f.flatMap(g=>g.getLeafColumns());return h(m)},je(e,"debugColumns")),getColumn:f=>s._getAllFlatColumnsById()[f]};Object.assign(s,d);for(let f=0;f<s._features.length;f++){const h=s._features[f];h==null||h.createTable==null||h.createTable(s)}return s}function vQ(){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=ry(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},je(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function wQ(){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:bQ(n),je(e.options,"debugTable"))}function bQ(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 kQ(e,t,n){return n.options.filterFromLeafRows?SQ(e,t,n):CQ(e,t,n)}function SQ(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 f=0;f<a.length;f++){var d;let h=a[f];const m=ry(n,h.id,h.original,h.index,h.depth,void 0,h.parentId);if(m.columnFilters=h.columnFilters,(d=h.subRows)!=null&&d.length&&u<o){if(m.subRows=l(h.subRows,u+1),h=m,t(h)&&!m.subRows.length){c.push(h),i[h.id]=h,s.push(h);continue}if(t(h)||m.subRows.length){c.push(h),i[h.id]=h,s.push(h);continue}}else h=m,t(h)&&(c.push(h),i[h.id]=h,s.push(h))}return c};return{rows:l(e),flatRows:s,rowsById:i}}function CQ(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 f=0;f<a.length;f++){let h=a[f];if(t(h)){var d;if((d=h.subRows)!=null&&d.length&&u<o){const g=ry(n,h.id,h.original,h.index,h.depth,void 0,h.parentId);g.subRows=l(h.subRows,u+1),h=g}c.push(h),s.push(h),i[h.id]=h}}return c};return{rows:l(e),flatRows:s,rowsById:i}}function EQ(){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 f=0;f<t.flatRows.length;f++)t.flatRows[f].columnFilters={},t.flatRows[f].columnFiltersMeta={};return t}const s=[],i=[];(n??[]).forEach(f=>{var h;const m=e.getColumn(f.id);if(!m)return;const g=m.getFilterFn();g&&s.push({id:f.id,filterFn:g,resolvedValue:(h=g.resolveFilterValue==null?void 0:g.resolveFilterValue(f.value))!=null?h:f.value})});const o=(n??[]).map(f=>f.id),l=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(f=>f.getCanGlobalFilter());r&&l&&a.length&&(o.push("__global__"),a.forEach(f=>{var h;i.push({id:f.id,filterFn:l,resolvedValue:(h=l.resolveFilterValue==null?void 0:l.resolveFilterValue(r))!=null?h:r})}));let u,c;for(let f=0;f<t.flatRows.length;f++){const h=t.flatRows[f];if(h.columnFilters={},s.length)for(let m=0;m<s.length;m++){u=s[m];const g=u.id;h.columnFilters[g]=u.filterFn(h,g,u.resolvedValue,v=>{h.columnFiltersMeta[g]=v})}if(i.length){for(let m=0;m<i.length;m++){c=i[m];const g=c.id;if(c.filterFn(h,g,c.resolvedValue,v=>{h.columnFiltersMeta[g]=v})){h.columnFilters.__global__=!0;break}}h.columnFilters.__global__!==!0&&(h.columnFilters.__global__=!1)}}const d=f=>{for(let h=0;h<o.length;h++)if(f.columnFilters[o[h]]===!1)return!1;return!0};return kQ(t.rows,d,e)},je(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function NQ(){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],f=TQ(a,d);return Array.from(f.entries()).map((m,g)=>{let[v,x]=m,w=`${d}:${v}`;w=c?`${c}>${w}`:w;const b=o(x,u+1,w);b.forEach(k=>{k.parentId=w});const C=u?NI(x,k=>k.subRows):x,S=ry(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(x[0]){var E;S._valuesCache[k]=(E=x[0].getValue(k))!=null?E:void 0}return S._valuesCache[k]}if(S._groupingValuesCache.hasOwnProperty(k))return S._groupingValuesCache[k];const T=e.getColumn(k),O=T==null?void 0:T.getAggregationFn();if(O)return S._groupingValuesCache[k]=O(k,C,x),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}},je(e.options,"debugTable","getGroupedRowModel",()=>{e._queue(()=>{e._autoResetExpanded(),e._autoResetPageIndex()})}))}function TQ(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 RQ(){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 h=0;h<i.length;h+=1){var f;const m=i[h],g=o[m.id],v=g.sortUndefined,x=(f=m==null?void 0:m.desc)!=null?f:!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 x&&(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}},je(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
|
|
475
|
+
* react-table
|
|
476
|
+
*
|
|
477
|
+
* Copyright (c) TanStack
|
|
478
|
+
*
|
|
479
|
+
* This source code is licensed under the MIT license found in the
|
|
480
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
481
|
+
*
|
|
482
|
+
* @license MIT
|
|
483
|
+
*/function Ta(e,t){return e?jQ(e)?y.createElement(e,t):e:null}function jQ(e){return MQ(e)||typeof e=="function"||OQ(e)}function MQ(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function OQ(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function PQ(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=y.useState(()=>({current:xQ(t)})),[r,s]=y.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 AQ({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:f=!1,disableGrouping:h=!1}){const m=n[0],g=(m==null?void 0:m.id)??"",v=(m==null?void 0:m.desc)??!1,x=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(HA,{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"})]}),f?null:p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[p.jsx(om,{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(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>{g&&s([{id:g,desc:!v}])},children:v?p.jsx(rw,{className:"h-4 w-4"}):p.jsx(om,{className:"h-4 w-4"})})]}),h?null:p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[p.jsx(UA,{className:"h-4 w-4"}),p.jsx("span",{children:"Group"})]}),p.jsxs("select",{value:x,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(te,{type:"button",variant:"ghost",size:"sm",onClick:a,children:"Clear"}),p.jsx(te,{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 tt;(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})(tt||(tt={}));var VN;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(VN||(VN={}));const xe=tt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yi=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}},se=tt.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 $i 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 $i))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,tt.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()}}$i.create=e=>new $i(e);const vw=(e,t)=>{let n;switch(e.code){case se.invalid_type:e.received===xe.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case se.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,tt.jsonStringifyReplacer)}`;break;case se.unrecognized_keys:n=`Unrecognized key(s) in object: ${tt.joinValues(e.keys,", ")}`;break;case se.invalid_union:n="Invalid input";break;case se.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${tt.joinValues(e.options)}`;break;case se.invalid_enum_value:n=`Invalid enum value. Expected ${tt.joinValues(e.options)}, received '${e.received}'`;break;case se.invalid_arguments:n="Invalid function arguments";break;case se.invalid_return_type:n="Invalid function return type";break;case se.invalid_date:n="Invalid date";break;case se.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}"`:tt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case se.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 se.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 se.custom:n="Invalid input";break;case se.invalid_intersection_types:n="Intersection results could not be merged";break;case se.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case se.not_finite:n="Number must be finite";break;default:n=t.defaultError,tt.assertNever(e)}return{message:n}};let _Q=vw;function IQ(){return _Q}const DQ=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=IQ(),r=DQ({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===vw?void 0:vw].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 Le;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 Le;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 Le=Object.freeze({status:"aborted"}),qc=e=>({status:"dirty",value:e}),Kr=e=>({status:"valid",value:e}),HN=e=>e.status==="aborted",UN=e=>e.status==="dirty",Vu=e=>e.status==="valid",gm=e=>typeof Promise<"u"&&e instanceof Promise;var Se;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Se||(Se={}));class Qs{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 qN=(e,t)=>{if(Vu(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 $i(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 Ge{get description(){return this._def.description}_getType(t){return Yi(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Yi(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:Yi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(gm(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:Yi(t)},s=this._parseSync({data:t,path:r.path,parent:r});return qN(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:Yi(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return Vu(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=>Vu(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:Yi(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(gm(s)?s:Promise.resolve(s));return qN(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:se.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 qu({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 Ao.create(this,this._def)}nullable(){return Wu.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qs.create(this)}promise(){return bm.create(this,this._def)}or(t){return xm.create([this,t],this._def)}and(t){return vm.create(this,t,this._def)}transform(t){return new qu({...Ve(this._def),schema:this,typeName:De.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Cw({...Ve(this._def),innerType:this,defaultValue:n,typeName:De.ZodDefault})}brand(){return new iG({typeName:De.ZodBranded,type:this,...Ve(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Ew({...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 y1.create(this,t)}readonly(){return Nw.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const LQ=/^c[^\s-]{8,}$/i,$Q=/^[0-9a-z]+$/,zQ=/^[0-9A-HJKMNP-TV-Z]{26}$/i,FQ=/^[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,BQ=/^[a-z0-9_-]{21}$/i,VQ=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,HQ=/^[-+]?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)?)??$/,UQ=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,qQ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Bx;const WQ=/^(?:(?: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])$/,KQ=/^(?:(?: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])$/,QQ=/^(([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]))$/,GQ=/^(([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])$/,JQ=/^([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}(=)?))?$/,DI="((\\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])))",YQ=new RegExp(`^${DI}$`);function LI(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 XQ(e){return new RegExp(`^${LI(e)}$`)}function eG(e){let t=`${DI}T${LI(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 tG(e,t){return!!((t==="v4"||!t)&&WQ.test(e)||(t==="v6"||!t)&&QQ.test(e))}function nG(e,t){if(!VQ.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 rG(e,t){return!!((t==="v4"||!t)&&KQ.test(e)||(t==="v6"||!t)&&GQ.test(e))}class Ci extends Ge{_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:se.invalid_type,expected:xe.string,received:i.parsedType}),Le}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:se.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:se.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:se.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):l&&de(s,{code:se.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")UQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"email",code:se.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Bx||(Bx=new RegExp(qQ,"u")),Bx.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"emoji",code:se.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")FQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"uuid",code:se.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")BQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"nanoid",code:se.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")LQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"cuid",code:se.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")$Q.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"cuid2",code:se.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")zQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"ulid",code:se.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:se.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:se.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:se.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:se.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:se.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?eG(i).test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{code:se.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?YQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{code:se.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?XQ(i).test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{code:se.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?HQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"duration",code:se.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?tG(t.data,i.version)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"ip",code:se.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?nG(t.data,i.alg)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"jwt",code:se.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?rG(t.data,i.version)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"cidr",code:se.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?JQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"base64",code:se.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?ZQ.test(t.data)||(s=this._getOrReturnCtx(t,s),de(s,{validation:"base64url",code:se.invalid_string,message:i.message}),r.dirty()):tt.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:se.invalid_string,...Se.errToObj(r)})}_addCheck(t){return new Ci({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Se.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Se.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Se.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Se.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Se.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Se.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Se.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Se.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Se.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Se.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Se.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Se.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Se.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,...Se.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,...Se.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Se.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Se.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Se.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Se.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Se.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Se.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Se.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Se.errToObj(n)})}nonempty(t){return this.min(1,Se.errToObj(t))}trim(){return new Ci({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ci({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ci({...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}}Ci.create=e=>new Ci({checks:[],typeName:De.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Ve(e)});function sG(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 Hu extends Ge{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:se.invalid_type,expected:xe.number,received:i.parsedType}),Le}let r;const s=new Vn;for(const i of this._def.checks)i.kind==="int"?tt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),de(r,{code:se.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:se.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:se.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?sG(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),de(r,{code:se.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:se.not_finite,message:i.message}),s.dirty()):tt.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Se.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Se.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Se.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Se.toString(n))}setLimit(t,n,r,s){return new Hu({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Se.toString(s)}]})}_addCheck(t){return new Hu({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Se.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Se.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Se.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Se.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Se.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Se.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Se.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Se.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Se.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"&&tt.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)}}Hu.create=e=>new Hu({checks:[],typeName:De.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ve(e)});class Xd extends Ge{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:se.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:se.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:se.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):tt.assertNever(i);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return de(n,{code:se.invalid_type,expected:xe.bigint,received:n.parsedType}),Le}gte(t,n){return this.setLimit("min",t,!0,Se.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Se.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Se.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Se.toString(n))}setLimit(t,n,r,s){return new Xd({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Se.toString(s)}]})}_addCheck(t){return new Xd({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Se.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Se.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Se.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Se.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Se.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}}Xd.create=e=>new Xd({checks:[],typeName:De.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Ve(e)});class ww extends Ge{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==xe.boolean){const r=this._getOrReturnCtx(t);return de(r,{code:se.invalid_type,expected:xe.boolean,received:r.parsedType}),Le}return Kr(t.data)}}ww.create=e=>new ww({typeName:De.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ve(e)});class ym extends Ge{_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:se.invalid_type,expected:xe.date,received:i.parsedType}),Le}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return de(i,{code:se.invalid_date}),Le}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:se.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:se.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):tt.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new ym({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Se.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Se.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}}ym.create=e=>new ym({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:De.ZodDate,...Ve(e)});class WN extends Ge{_parse(t){if(this._getType(t)!==xe.symbol){const r=this._getOrReturnCtx(t);return de(r,{code:se.invalid_type,expected:xe.symbol,received:r.parsedType}),Le}return Kr(t.data)}}WN.create=e=>new WN({typeName:De.ZodSymbol,...Ve(e)});class KN extends Ge{_parse(t){if(this._getType(t)!==xe.undefined){const r=this._getOrReturnCtx(t);return de(r,{code:se.invalid_type,expected:xe.undefined,received:r.parsedType}),Le}return Kr(t.data)}}KN.create=e=>new KN({typeName:De.ZodUndefined,...Ve(e)});class QN extends Ge{_parse(t){if(this._getType(t)!==xe.null){const r=this._getOrReturnCtx(t);return de(r,{code:se.invalid_type,expected:xe.null,received:r.parsedType}),Le}return Kr(t.data)}}QN.create=e=>new QN({typeName:De.ZodNull,...Ve(e)});class GN extends Ge{constructor(){super(...arguments),this._any=!0}_parse(t){return Kr(t.data)}}GN.create=e=>new GN({typeName:De.ZodAny,...Ve(e)});class bw extends Ge{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Kr(t.data)}}bw.create=e=>new bw({typeName:De.ZodUnknown,...Ve(e)});class Qo extends Ge{_parse(t){const n=this._getOrReturnCtx(t);return de(n,{code:se.invalid_type,expected:xe.never,received:n.parsedType}),Le}}Qo.create=e=>new Qo({typeName:De.ZodNever,...Ve(e)});class JN extends Ge{_parse(t){if(this._getType(t)!==xe.undefined){const r=this._getOrReturnCtx(t);return de(r,{code:se.invalid_type,expected:xe.void,received:r.parsedType}),Le}return Kr(t.data)}}JN.create=e=>new JN({typeName:De.ZodVoid,...Ve(e)});class qs extends Ge{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==xe.array)return de(n,{code:se.invalid_type,expected:xe.array,received:n.parsedType}),Le;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?se.too_big:se.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:se.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:se.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 Qs(n,o,n.path,l)))).then(o=>Vn.mergeArray(r,o));const i=[...n.data].map((o,l)=>s.type._parseSync(new Qs(n,o,n.path,l)));return Vn.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new qs({...this._def,minLength:{value:t,message:Se.toString(n)}})}max(t,n){return new qs({...this._def,maxLength:{value:t,message:Se.toString(n)}})}length(t,n){return new qs({...this._def,exactLength:{value:t,message:Se.toString(n)}})}nonempty(t){return this.min(1,t)}}qs.create=(e,t)=>new qs({type:e,minLength:null,maxLength:null,exactLength:null,typeName:De.ZodArray,...Ve(t)});function Da(e){if(e instanceof Ft){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ao.create(Da(r))}return new Ft({...e._def,shape:()=>t})}else return e instanceof qs?new qs({...e._def,type:Da(e.element)}):e instanceof Ao?Ao.create(Da(e.unwrap())):e instanceof Wu?Wu.create(Da(e.unwrap())):e instanceof Yl?Yl.create(e.items.map(t=>Da(t))):e}class Ft extends Ge{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=tt.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:se.invalid_type,expected:xe.object,received:u.parsedType}),Le}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 Qs(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:se.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 Qs(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,f=await c.value;u.push({key:d,value:f,alwaysSet:c.alwaysSet})}return u}).then(u=>Vn.mergeObjectSync(r,u)):Vn.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(t){return Se.errToObj,new Ft({...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:Se.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new Ft({...this._def,unknownKeys:"strip"})}passthrough(){return new Ft({...this._def,unknownKeys:"passthrough"})}extend(t){return new Ft({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Ft({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 Ft({...this._def,catchall:t})}pick(t){const n={};for(const r of tt.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Ft({...this._def,shape:()=>n})}omit(t){const n={};for(const r of tt.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new Ft({...this._def,shape:()=>n})}deepPartial(){return Da(this)}partial(t){const n={};for(const r of tt.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new Ft({...this._def,shape:()=>n})}required(t){const n={};for(const r of tt.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Ao;)i=i._def.innerType;n[r]=i}return new Ft({...this._def,shape:()=>n})}keyof(){return $I(tt.objectKeys(this.shape))}}Ft.create=(e,t)=>new Ft({shape:()=>e,unknownKeys:"strip",catchall:Qo.create(),typeName:De.ZodObject,...Ve(t)});Ft.strictCreate=(e,t)=>new Ft({shape:()=>e,unknownKeys:"strict",catchall:Qo.create(),typeName:De.ZodObject,...Ve(t)});Ft.lazycreate=(e,t)=>new Ft({shape:e,unknownKeys:"strip",catchall:Qo.create(),typeName:De.ZodObject,...Ve(t)});class xm extends Ge{_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 $i(l.ctx.common.issues));return de(n,{code:se.invalid_union,unionErrors:o}),Le}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 $i(a));return de(n,{code:se.invalid_union,unionErrors:l}),Le}}get options(){return this._def.options}}xm.create=(e,t)=>new xm({options:e,typeName:De.ZodUnion,...Ve(t)});function kw(e,t){const n=Yi(e),r=Yi(t);if(e===t)return{valid:!0,data:e};if(n===xe.object&&r===xe.object){const s=tt.objectKeys(t),i=tt.objectKeys(e).filter(l=>s.indexOf(l)!==-1),o={...e,...t};for(const l of i){const a=kw(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=kw(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 vm extends Ge{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(i,o)=>{if(HN(i)||HN(o))return Le;const l=kw(i.value,o.value);return l.valid?((UN(i)||UN(o))&&n.dirty(),{status:n.value,value:l.data}):(de(r,{code:se.invalid_intersection_types}),Le)};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}))}}vm.create=(e,t,n)=>new vm({left:e,right:t,typeName:De.ZodIntersection,...Ve(n)});class Yl extends Ge{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==xe.array)return de(r,{code:se.invalid_type,expected:xe.array,received:r.parsedType}),Le;if(r.data.length<this._def.items.length)return de(r,{code:se.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Le;!this._def.rest&&r.data.length>this._def.items.length&&(de(r,{code:se.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 Qs(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 Yl({...this._def,rest:t})}}Yl.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Yl({items:e,typeName:De.ZodTuple,rest:null,...Ve(t)})};class wm extends Ge{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:se.invalid_type,expected:xe.object,received:r.parsedType}),Le;const s=[],i=this._def.keyType,o=this._def.valueType;for(const l in r.data)s.push({key:i._parse(new Qs(r,l,r.path,l)),value:o._parse(new Qs(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 Ge?new wm({keyType:t,valueType:n,typeName:De.ZodRecord,...Ve(r)}):new wm({keyType:Ci.create(),valueType:t,typeName:De.ZodRecord,...Ve(n)})}}class ZN extends Ge{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:se.invalid_type,expected:xe.map,received:r.parsedType}),Le;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([l,a],u)=>({key:s._parse(new Qs(r,l,r.path,[u,"key"])),value:i._parse(new Qs(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 Le;(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 Le;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),l.set(u.value,c.value)}return{status:n.value,value:l}}}}ZN.create=(e,t,n)=>new ZN({valueType:t,keyType:e,typeName:De.ZodMap,...Ve(n)});class ef extends Ge{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==xe.set)return de(r,{code:se.invalid_type,expected:xe.set,received:r.parsedType}),Le;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(de(r,{code:se.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:se.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 Le;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 Qs(r,a,r.path,u)));return r.common.async?Promise.all(l).then(a=>o(a)):o(l)}min(t,n){return new ef({...this._def,minSize:{value:t,message:Se.toString(n)}})}max(t,n){return new ef({...this._def,maxSize:{value:t,message:Se.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}ef.create=(e,t)=>new ef({valueType:e,minSize:null,maxSize:null,typeName:De.ZodSet,...Ve(t)});class YN extends Ge{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})}}YN.create=(e,t)=>new YN({getter:e,typeName:De.ZodLazy,...Ve(t)});class Sw extends Ge{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return de(n,{received:n.data,code:se.invalid_literal,expected:this._def.value}),Le}return{status:"valid",value:t.data}}get value(){return this._def.value}}Sw.create=(e,t)=>new Sw({value:e,typeName:De.ZodLiteral,...Ve(t)});function $I(e,t){return new Uu({values:e,typeName:De.ZodEnum,...Ve(t)})}class Uu extends Ge{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return de(n,{expected:tt.joinValues(r),received:n.parsedType,code:se.invalid_type}),Le}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:se.invalid_enum_value,options:r}),Le}return Kr(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 Uu.create(t,{...this._def,...n})}exclude(t,n=this._def){return Uu.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Uu.create=$I;class XN extends Ge{_parse(t){const n=tt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==xe.string&&r.parsedType!==xe.number){const s=tt.objectValues(n);return de(r,{expected:tt.joinValues(s),received:r.parsedType,code:se.invalid_type}),Le}if(this._cache||(this._cache=new Set(tt.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=tt.objectValues(n);return de(r,{received:r.data,code:se.invalid_enum_value,options:s}),Le}return Kr(t.data)}get enum(){return this._def.values}}XN.create=(e,t)=>new XN({values:e,typeName:De.ZodNativeEnum,...Ve(t)});class bm extends Ge{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:se.invalid_type,expected:xe.promise,received:n.parsedType}),Le;const r=n.parsedType===xe.promise?n.data:Promise.resolve(n.data);return Kr(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}bm.create=(e,t)=>new bm({type:e,typeName:De.ZodPromise,...Ve(t)});class qu extends Ge{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 Le;const a=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return a.status==="aborted"?Le:a.status==="dirty"||n.value==="dirty"?qc(a.value):a});{if(n.value==="aborted")return Le;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?Le:l.status==="dirty"||n.value==="dirty"?qc(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"?Le:(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"?Le:(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(!Vu(o))return Le;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=>Vu(o)?Promise.resolve(s.transform(o.value,i)).then(l=>({status:n.value,value:l})):Le);tt.assertNever(s)}}qu.create=(e,t,n)=>new qu({schema:e,typeName:De.ZodEffects,effect:t,...Ve(n)});qu.createWithPreprocess=(e,t,n)=>new qu({schema:t,effect:{type:"preprocess",transform:e},typeName:De.ZodEffects,...Ve(n)});class Ao extends Ge{_parse(t){return this._getType(t)===xe.undefined?Kr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ao.create=(e,t)=>new Ao({innerType:e,typeName:De.ZodOptional,...Ve(t)});class Wu extends Ge{_parse(t){return this._getType(t)===xe.null?Kr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Wu.create=(e,t)=>new Wu({innerType:e,typeName:De.ZodNullable,...Ve(t)});class Cw extends Ge{_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}}Cw.create=(e,t)=>new Cw({innerType:e,typeName:De.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ve(t)});class Ew extends Ge{_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 gm(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new $i(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new $i(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Ew.create=(e,t)=>new Ew({innerType:e,typeName:De.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ve(t)});class eT extends Ge{_parse(t){if(this._getType(t)!==xe.nan){const r=this._getOrReturnCtx(t);return de(r,{code:se.invalid_type,expected:xe.nan,received:r.parsedType}),Le}return{status:"valid",value:t.data}}}eT.create=e=>new eT({typeName:De.ZodNaN,...Ve(e)});class iG extends Ge{_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 y1 extends Ge{_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"?Le:i.status==="dirty"?(n.dirty(),qc(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"?Le: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 y1({in:t,out:n,typeName:De.ZodPipeline})}}class Nw extends Ge{_parse(t){const n=this._def.innerType._parse(t),r=s=>(Vu(s)&&(s.value=Object.freeze(s.value)),s);return gm(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Nw.create=(e,t)=>new Nw({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 tn=Ci.create,oG=Hu.create,vp=ww.create,Tw=bw.create;Qo.create;const Ku=qs.create,$r=Ft.create,lG=xm.create;vm.create;Yl.create;const km=wm.create,tT=Sw.create,zI=Uu.create;bm.create;Ao.create;Wu.create;const nT=lG([$r({type:tT("pageLink"),details:$r({label:tn().optional(),pageName:tn()})}),$r({type:tT("command"),details:$r({id:tn(),args:km(Tw()).optional()})}),$r({type:tn(),details:km(Tw()).optional()})]),aG=zI(["text","select","object"]),uG=$r({id:tn().min(1),name:tn().min(1),type:aG.optional().default("text"),options:Ku(tn()).optional(),width:oG().int().positive().optional()}),FI=$r({columns:Ku(uG).default([])}),BI=$r({sortBy:$r({id:tn(),desc:vp().optional()}).nullable().optional(),groupBy:tn().nullable().optional(),columnOrder:Ku(tn()).nullable().optional(),columnVisibility:km(vp()).nullable().optional(),tags:Ku(tn()).nullable().optional(),pinned:vp().nullable().optional()}).partial().passthrough(),cG=$r({data:Ku(km(Tw())).optional(),metadata:BI.optional(),schema:FI.optional()}).passthrough(),rT=e=>e.type!=="pageLink"||!e.details||typeof e.details!="object"?!1:"pageName"in e.details,sT=e=>e.type!=="command"||!e.details||typeof e.details!="object"?!1:"id"in e.details;function dG({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:f=!0,renderTextValue:h,renderObjectValue:m,editingDisabled:g=!1,uncontrolledEditing:v=!1,disableSearch:x=!1,disableSorting:w=!1,disableGrouping:b=!1,belowToolbar:C}){const[S,k]=y.useState([]),[E,T]=y.useState(!0),[O,N]=y.useState(""),[j,P]=y.useState(!1),z=y.useCallback((q,W)=>q.length!==W.length?!1:q.every((Ee,Oe)=>Ee===W[Oe]),[]),I=y.useCallback((q,W)=>{const Ee=Object.keys(q).sort(),Oe=Object.keys(W).sort();return z(Ee,Oe)?Ee.every(Ne=>q[Ne]===W[Ne]):!1},[z]),L=y.useCallback((q,W)=>q.length!==W.length?!1:q.every((Ee,Oe)=>{const Ne=W[Oe];return Ee.id===Ne.id&&!!Ee.desc==!!Ne.desc}),[]),H=y.useCallback((q,W)=>q.length!==W.length?!1:q.every((Ee,Oe)=>Ee===W[Oe]),[]),K=y.useRef(e);y.useEffect(()=>{K.current=e},[e]);const _=y.useMemo(()=>t.columns.map(q=>q.id).filter(Boolean),[t.columns]),Q=y.useCallback((q,W)=>{const Ee=q.filter(Ne=>W.includes(Ne)),Oe=W.filter(Ne=>!Ee.includes(Ne));return[...Ee,...Oe]},[]),M=y.useRef([]),ie=y.useMemo(()=>{const q=Q(n.columnOrder??[],_);return z(q,M.current)?M.current:(M.current=q,q)},[z,_,Q,n.columnOrder]),V=y.useCallback(q=>h?h(q):q,[h]),R=y.useCallback(q=>m?m(q):rT(q)?q.details.label??q.details.pageName:sT(q)?`Command: ${q.details.id}`:q.type,[m]),D=y.useMemo(()=>new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),[]),F=y.useCallback((q,W)=>{if(W==null)return"";if(q.type==="object"){const Ee=nT.safeParse(W);if(Ee.success){const Oe=Ee.data;return rT(Oe)?Oe.details.label??Oe.details.pageName:sT(Oe)?`Command: ${Oe.details.id}`:Oe.type}return String(W)}return typeof W=="string"?W:String(W)},[]),Y=y.useCallback((q,W)=>{if(q.type==="object"){const Oe=nT.safeParse(W);return Oe.success?R(Oe.data):W==null?"":String(W)}if(W==null)return"";const Ee=typeof W=="string"?W:String(W);return V(Ee)},[R,V]),G=y.useRef(s);y.useEffect(()=>{G.current=s},[s]);const ve=y.useRef(Y);y.useEffect(()=>{ve.current=Y},[Y]);const me=y.useCallback((q,W,Ee)=>{const Ne=(K.current??[]).map((Xe,st)=>st===q?{...Xe,[W]:Ee}:Xe);G.current(Ne)},[]),Je=y.useMemo(()=>JSON.stringify(t.columns),[t.columns]),bt=y.useRef(null);(!bt.current||bt.current.signature!==Je)&&(bt.current={signature:Je,columns:t.columns.map(q=>({id:q.id,accessorKey:q.id,header:q.name,sortingFn:(W,Ee,Oe)=>{const Ne=F(q,W.getValue(Oe)),Xe=F(q,Ee.getValue(Oe));return!Ne&&!Xe?0:Ne?Xe?D.compare(Ne,Xe):-1:1},cell:({getValue:W,row:Ee,cell:Oe})=>{if(Oe.getIsGrouped())return ve.current(q,W());if(q.type==="object"){const Xe=W();return p.jsx("div",{className:"text-sm",children:Xe?ve.current(q,Xe):p.jsx("span",{className:"text-xs text-muted-foreground",children:"Add object"})})}if(q.type==="select"){const Xe=typeof W()=="string"?W():"";return v?p.jsxs("select",{defaultValue:Xe,className:"w-full bg-transparent text-sm focus-visible:outline-none",children:[p.jsx("option",{value:"",children:"—"}),(q.options??[]).map(st=>p.jsx("option",{value:st,children:st},st))]}):p.jsxs("select",{value:Xe,onChange:g?void 0:st=>me(Ee.index,q.id,st.target.value),disabled:g,className:"w-full bg-transparent text-sm focus-visible:outline-none",children:[p.jsx("option",{value:"",children:"—"}),(q.options??[]).map(st=>p.jsx("option",{value:st,children:st},st))]})}const Ne=typeof W()=="string"?W():W()===null||W()===void 0?"":String(W());return v?p.jsx("input",{defaultValue:Ne,className:"w-full bg-transparent text-sm text-foreground focus-visible:outline-none"}):p.jsx("input",{value:Ne,onChange:g?void 0:Xe=>me(Ee.index,q.id,Xe.target.value),readOnly:g,className:"w-full bg-transparent text-sm text-foreground focus-visible:outline-none"})},aggregatedCell:({getValue:W})=>ve.current(q,W())}))});const It=bt.current.columns,kt=y.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)&&I(W.columnVisibility,n.columnVisibility)||r(W)},[z,H,L,I,r,n]),$e=PQ({data:e,columns:It,state:{sorting:n.sorting,columnFilters:S,grouping:n.grouping,columnOrder:ie,columnVisibility:n.columnVisibility,expanded:E,globalFilter:O},onSortingChange:q=>{if(w)return;const W=typeof q=="function"?q(n.sorting):q;kt({sorting:W})},onColumnFiltersChange:k,onGroupingChange:q=>{if(b)return;const W=typeof q=="function"?q(n.grouping):q;kt({grouping:W})},onColumnOrderChange:q=>{const W=typeof q=="function"?q(ie):q;kt({columnOrder:W})},onColumnVisibilityChange:q=>{const W=typeof q=="function"?q(n.columnVisibility):q;kt({columnVisibility:W})},onExpandedChange:T,onGlobalFilterChange:N,getRowId:i,getCoreRowModel:vQ(),getFilteredRowModel:EQ(),getSortedRowModel:RQ(),getGroupedRowModel:NQ(),getExpandedRowModel:wQ(),enableGrouping:!b,enableSorting:!w,groupedColumnMode:"remove",autoResetExpanded:!1,initialState:{expanded:!0}}),Zt=$e.getAllColumns(),ht=Zt.filter(q=>q.getCanSort()),Kn=Zt.filter(q=>q.getCanGroup()),Es=$e.getVisibleLeafColumns(),Qn=e.length===0,ct=!!l,Qr=!!o,al=f&&Qr,Ns=Qn&&Es.length===1?"min-w-[240px] max-w-[320px] w-[260px]":"min-w-[200px]",Gr=n.sorting[0],An=(Gr==null?void 0:Gr.id)??"",U=n.grouping[0]??"",le=y.useMemo(()=>{if(!An||ht.some(Ee=>Ee.id===An))return ht;const W=Zt.find(Ee=>Ee.id===An);return W?[...ht,W]:ht},[An,Zt,ht]),Ae=y.useMemo(()=>{if(!U||Kn.some(Ee=>Ee.id===U))return Kn;const W=Zt.find(Ee=>Ee.id===U);return W?[...Kn,W]:Kn},[U,Zt,Kn]),Fe=()=>{kt({sorting:[],grouping:[]}),k([]),T(!0),x||N("")},Ze=(q,W)=>{const Ee=[...ie],Oe=Ee.indexOf(q);if(Oe===-1)return;const Ne=W==="up"?Oe-1:Oe+1;if(Ne<0||Ne>=Ee.length)return;const[Xe]=Ee.splice(Oe,1);Ee.splice(Ne,0,Xe),kt({columnOrder:Ee})},Yt=q=>{kt({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(AQ,{globalFilter:O,onGlobalFilterChange:N,sorting:n.sorting,grouping:n.grouping,onSortingChange:q=>kt({sorting:q}),onGroupingChange:q=>{kt({grouping:q}),T(!0)},sortableColumns:le,groupableColumns:Ae,onClear:Fe,onColumnsOpen:()=>P(!0),rowCount:$e.getFilteredRowModel().rows.length,disableSearch:x,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(te,{type:"button",size:"sm",variant:"ghost",onClick:()=>P(!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:ie.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."}):ie.map((q,W)=>{const Ee=Zt.find(st=>st.id===q);if(!Ee)return null;const Oe=Ee.getIsVisible(),Ne=W===0,Xe=W===ie.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:Oe,onChange:()=>Yt(q)}),p.jsx("span",{className:"flex-1 truncate",children:q}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(te,{type:"button",size:"icon",variant:"ghost",disabled:Ne,onClick:()=>Ze(q,"up"),children:p.jsx(FA,{className:"h-4 w-4"})}),p.jsx(te,{type:"button",size:"icon",variant:"ghost",disabled:Xe,onClick:()=>Ze(q,"down"),children:p.jsx(ji,{className:"h-4 w-4"})}),a?p.jsx(te,{type:"button",size:"icon",variant:"ghost",onClick:()=>a(q),children:p.jsx(da,{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(te,{type:"button",size:"sm",variant:"ghost",onClick:()=>{kt({columnOrder:_,columnVisibility:{}})},children:"Reset columns"}),l?p.jsxs(te,{type:"button",size:"sm",variant:"ghost",onClick:()=>l(),children:[p.jsx(Qt,{className:"mr-1 h-3 w-3"}),"Add column"]}):null]}),p.jsx(te,{type:"button",size:"sm",onClick:()=>P(!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:$e.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."}):$e.getGroupedRowModel().rows.map(q=>{const W=q.groupingValue===void 0||q.groupingValue===null?"(empty)":String(q.groupingValue),Ee=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(ji,{className:"h-4 w-4"}):p.jsx(Du,{className:"h-4 w-4"}),p.jsx("span",{children:W}),p.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",Ee.length,")"]})]}),q.getIsExpanded()&&p.jsxs("table",{className:"w-full border-collapse text-sm",children:[p.jsx("thead",{className:"sticky top-0 bg-muted",children:$e.getHeaderGroups().map(Oe=>p.jsxs("tr",{children:[Oe.headers.map(Ne=>p.jsx("th",{className:dt("border-b border-border px-3 py-2 text-left font-medium text-foreground",Ne.column.getCanSort()&&"cursor-pointer select-none",Ns),onClick:!w&&Ne.column.getCanSort()?Ne.column.getToggleSortingHandler():void 0,children:p.jsxs("div",{className:"flex items-center gap-1",children:[Ne.isPlaceholder?null:Ta(Ne.column.columnDef.header,Ne.getContext()),w?null:{asc:p.jsx(om,{className:"h-3 w-3"}),desc:p.jsx(rw,{className:"h-3 w-3"})}[Ne.column.getIsSorted()]??null]})},Ne.id)),ct?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(Qt,{className:"h-3 w-3"}),d]})}):null]},Oe.id))}),p.jsx("tbody",{children:Ee.length===0?p.jsx("tr",{children:p.jsx("td",{colSpan:$e.getVisibleLeafColumns().length,className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No rows to display."})}):Ee.map(Oe=>p.jsxs("tr",{className:"border-b border-border last:border-0",children:[Oe.getVisibleCells().map(Ne=>p.jsx("td",{className:dt("h-10 px-3 py-2 align-top",Ns),children:Ta(Ne.column.columnDef.cell,Ne.getContext())},Ne.id)),ct?p.jsx("td",{className:"h-10 px-3 py-2"}):null]},Oe.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:$e.getHeaderGroups().map(q=>p.jsxs("tr",{children:[q.headers.map(W=>p.jsx("th",{className:dt("border-b border-border px-3 py-2 text-left font-medium text-foreground",W.column.getCanSort()&&"cursor-pointer select-none",Ns),onClick:!w&&W.column.getCanSort()?W.column.getToggleSortingHandler():void 0,children:p.jsxs("div",{className:"flex items-center gap-1",children:[W.isPlaceholder?null:Ta(W.column.columnDef.header,W.getContext()),w?null:{asc:p.jsx(om,{className:"h-3 w-3"}),desc:p.jsx(rw,{className:"h-3 w-3"})}[W.column.getIsSorted()]??null]})},W.id)),ct?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(Qt,{className:"h-3 w-3"}),d]})}):null]},q.id))}),p.jsx("tbody",{children:Qn?Array.from({length:u},(q,W)=>{const Ee=W===0;return p.jsxs("tr",{className:"border-b border-border last:border-0",children:[Es.map((Oe,Ne)=>p.jsx("td",{className:dt("h-10 px-3 py-2 align-top text-xs text-muted-foreground",Ns),children:Ee&&Ne===0&&Qr?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(Qt,{className:"h-3 w-3"}),c]}):null},`${Oe.id}-${Ne}`)),ct?p.jsx("td",{className:"h-10 px-3 py-2"}):null]},`empty-${W}`)}):$e.getRowModel().rows.length===0?p.jsx("tr",{children:p.jsx("td",{colSpan:Es.length+(ct?1:0),className:"px-3 py-10 text-center text-sm text-muted-foreground",children:"No rows to display."})}):p.jsxs(p.Fragment,{children:[$e.getRowModel().rows.map(q=>p.jsxs("tr",{className:"border-b border-border last:border-0",children:[q.getVisibleCells().map(W=>p.jsx("td",{className:dt("h-10 px-3 py-2 align-top",Ns),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(ji,{className:"h-4 w-4"}):p.jsx(Du,{className:"h-4 w-4"}),Ta(W.column.columnDef.cell,W.getContext()),p.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",q.subRows.length,")"]})]}):W.getIsAggregated()?Ta(W.column.columnDef.aggregatedCell??W.column.columnDef.cell,W.getContext()):W.getIsPlaceholder()?null:Ta(W.column.columnDef.cell,W.getContext())},W.id)),ct?p.jsx("td",{className:"h-10 px-3 py-2"}):null]},q.id)),al?p.jsxs("tr",{className:"border-b border-border last:border-0",children:[Es.map((q,W)=>p.jsx("td",{className:dt("h-10 px-3 py-2 align-top text-xs text-muted-foreground",Ns),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(Qt,{className:"h-3 w-3"}),c]}):null},`${q.id}-new-${W}`)),ct?p.jsx("td",{className:"h-10 px-3 py-2"}):null]}):null]})})]})})})]})}const fG=e=>!e||!e.id?[]:[{id:e.id,desc:!!e.desc}],hG=e=>e?[e]:[],pG=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[],mG=e=>!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([,t])=>typeof t=="boolean")),Wc=(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},iT=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=cG.safeParse(r);return i.success?{error:null,payload:i.data,format:s}:{error:"JSON must be an object or array.",payload:null,format:s}},gG=({active:e,content:t,lastSaved:n,headerTags:r,setContent:s,setIsDirty:i,setLastEditAt:o,writeDoc:l})=>{const[a,u]=y.useState(null),[c,d]=y.useState(null),[f,h]=y.useState(null),[m,g]=y.useState(null),[v,x]=y.useState(""),[w,b]=y.useState(""),[C,S]=y.useState({columns:[{id:"name",name:"Name",type:"text"}]}),k=y.useRef(null),E=y.useRef(null),T=y.useRef(null),O=y.useRef(null),N=y.useRef(null),j=y.useRef("object"),P=y.useRef(!1),z=y.useRef(null);y.useEffect(()=>{var Zt;if(!e||e.type!=="json"||z.current===t)return;const{error:D,payload:F,format:Y}=iT(t);if(!F){x(D??"Invalid JSON"),u(null),d(null),h(null),g(null),N.current=null,j.current="object",P.current=!1;return}if(!Array.isArray(F.data)){x("JSON `data` must be an array of objects."),u(null),d(null),h(null),g(null),N.current=null,j.current="object",P.current=!1;return}if(!F.data.every(ht=>ht&&typeof ht=="object"&&!Array.isArray(ht))){x("JSON `data` must be an array of objects."),u(null),d(null),h(null),g(null),N.current=null,j.current="object",P.current=!1;return}x(""),u(F.data);const G=F.metadata?BI.safeParse(F.metadata):null,ve=F.schema?FI.safeParse(F.schema):null,me=G!=null&&G.success?G.data:void 0,Je=ve!=null&&ve.success?ve.data:void 0;d(Je??null),N.current={...F,metadata:me,schema:Je},j.current=Y,P.current=!!((Zt=Je==null?void 0:Je.columns)!=null&&Zt.length);const bt={sorting:fG(me==null?void 0:me.sortBy),grouping:hG(me==null?void 0:me.groupBy),columnOrder:pG(me==null?void 0:me.columnOrder),columnVisibility:mG(me==null?void 0:me.columnVisibility)},It=T.current,kt=O.current,$e=It&&kt&&!Wc(It,kt);h(ht=>ht&&Wc(ht,bt)?ht:bt),g(ht=>$e||ht&&Wc(ht,bt)?ht:bt)},[e,t]),y.useEffect(()=>{if(c&&c.columns.length>0)return;if(!a){w!==""&&(b(""),S({columns:[{id:"name",name:"Name",type:"text"}]}));return}const D=[];a.forEach((Y,G)=>{const ve=Object.keys(Y);if(G===0){D.push(...ve);return}ve.forEach(me=>{D.includes(me)||D.push(me)})});const F=D.join("|");F!==w&&(b(F),S(F.length>0?{columns:D.map(Y=>({id:Y,name:Y,type:"text"}))}:{columns:[{id:"name",name:"Name",type:"text"}]}))},[w,a,c]);const I=y.useMemo(()=>c&&c.columns.length>0?c:C,[C,c]),L=y.useCallback((D,F)=>D.length!==F.length?!1:D.every((Y,G)=>Y===F[G]),[]),H=y.useCallback((D,F)=>{const Y=D.filter(ve=>F.includes(ve)),G=F.filter(ve=>!Y.includes(ve));return[...Y,...G]},[]),K=y.useCallback((D,F)=>{if(D.columnOrder.length===0)return D;const Y=F.columns.map(ve=>ve.id),G=H(D.columnOrder,Y);return L(G,D.columnOrder)?D:{...D,columnOrder:G}},[L,H]);y.useEffect(()=>{if(!m)return;const D=K(m,I);D!==m&&g(D)},[I,K,m]),y.useEffect(()=>{k.current=a},[a]),y.useEffect(()=>{E.current=I},[I]),y.useEffect(()=>{T.current=f},[f]),y.useEffect(()=>{O.current=m},[m]);const _=y.useCallback((D,F)=>{if(!e||e.type!=="json")return;const Y=N.current??{},G=(F==null?void 0:F.nextSchema)??null,ve={...Y??{},data:D};G&&G.columns.length>0?ve.schema=G:delete ve.schema;const me=j.current==="array"&&!ve.metadata&&!ve.schema,Je=JSON.stringify(me?D:ve,null,2);z.current=Je,s(Je),x(""),o(Date.now()),i(Je!==n),u(D),G&&G.columns.length>0&&(d(G),P.current=!0,j.current="object"),N.current=ve},[e,n,s,i,o]),Q=y.useCallback(D=>{_(D)},[_]),M=y.useCallback(()=>{const D=E.current??I,F={};D.columns.forEach(G=>{F[G.id]=G.type==="object"?null:""});const Y=k.current??a??[];_([...Y,F])},[_,I,a]),ie=y.useCallback(async D=>{if(!e||e.type!=="json")return;const Y=iT(t).payload,G=N.current??Y??{},ve={...G??{},data:Array.isArray(G.data)?G.data:a??[],metadata:{...(G==null?void 0:G.metadata)??{},sortBy:D.sorting[0]?{id:D.sorting[0].id,desc:!!D.sorting[0].desc}:null,groupBy:D.grouping[0]??null,columnOrder:D.columnOrder.length>0?D.columnOrder:null,columnVisibility:Object.keys(D.columnVisibility).length>0?D.columnVisibility:null}},me=JSON.stringify(ve,null,2);s(me),i(me!==n),z.current=me,await l(me,{tags:r,pinned:void 0}),h(D),g(D),N.current=ve,j.current="object"},[e,t,r,a,n,s,i,l]),V=y.useCallback((D,F)=>{const G=D.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)+/g,"")||"column";let ve=G,me=1;for(;F.includes(ve);)ve=`${G}-${me}`,me+=1;return ve},[]),R=y.useCallback(D=>D.split(",").map(F=>F.trim()).filter(F=>F.length>0),[]);return{jsonError:v,jsonData:a,tableDefaults:f,tableView:m,setTableView:g,effectiveSchema:I,tableSchema:c,handleTableRowsChange:Q,handleAddRow:M,commitTableUpdate:_,persistTableView:ie,createColumnId:V,parseColumnOptions:R,viewEquals:Wc}},yG=()=>{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:f}}=Nr(),[h,m]=y.useState(!1),v=e&&t&&!Wc(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(te,{type:"button",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>r(t),children:"Save as default"}),p.jsx(te,{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(dG,{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…"})}),h?p.jsx(_K,{open:h,onOpenChange:m}):null,u?p.jsx("div",{className:"text-sm text-destructive",children:u}):null,null]})};var VI={exports:{}},HI={};/**
|
|
484
|
+
* @license React
|
|
485
|
+
* use-sync-external-store-shim.production.js
|
|
486
|
+
*
|
|
487
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
488
|
+
*
|
|
489
|
+
* This source code is licensed under the MIT license found in the
|
|
490
|
+
* LICENSE file in the root directory of this source tree.
|
|
491
|
+
*/var Qu=y;function xG(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var vG=typeof Object.is=="function"?Object.is:xG,wG=Qu.useState,bG=Qu.useEffect,kG=Qu.useLayoutEffect,SG=Qu.useDebugValue;function CG(e,t){var n=t(),r=wG({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return kG(function(){s.value=n,s.getSnapshot=t,Vx(s)&&i({inst:s})},[e,n,t]),bG(function(){return Vx(s)&&i({inst:s}),e(function(){Vx(s)&&i({inst:s})})},[e]),SG(n),n}function Vx(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!vG(e,n)}catch{return!0}}function EG(e,t){return t()}var NG=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?EG:CG;HI.useSyncExternalStore=Qu.useSyncExternalStore!==void 0?Qu.useSyncExternalStore:NG;VI.exports=HI;var x1=VI.exports;function cn(e){this.content=e}cn.prototype={constructor:cn,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 cn(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 cn(n)},addToStart:function(e,t){return new cn([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new cn(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 cn(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=cn.from(e),e.size?new cn(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=cn.from(e),e.size?new cn(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=cn.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}};cn.from=function(e){if(e instanceof cn)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new cn(t)};function UI(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=UI(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function qI(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=qI(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 UI(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return qI(this,t,n,r)}findIndex(t){if(t==0)return Mh(0,t);if(t==this.size)return Mh(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?Mh(n+1,i):Mh(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 Hx={index:0,offset:0};function Mh(e,t){return Hx.index=e,Hx.offset=t,Hx}function Sm(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(!Sm(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!Sm(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}let ft=class Rw{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&&Sm(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 Rw.none;if(t instanceof Rw)return[t];let n=t.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};ft.none=[];class Cm 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=KI(this.content,t+this.openStart,n);return r&&new ue(r,this.openStart,this.openEnd)}removeBetween(t,n){return new ue(WI(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 WI(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(WI(i.content,t-s-1,n-s-1)))}function KI(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=KI(o.content,t-i-1,n,o);return l&&e.replaceChild(s,o.copy(l))}function TG(e,t,n){if(n.openStart>e.depth)throw new Cm("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Cm("Inconsistent open depths");return QI(e,t,n,0)}function QI(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=QI(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 $l(o,l.cut(0,e.parentOffset).append(n.content).append(l.cut(t.parentOffset)))}else{let{start:o,end:l}=RG(n,e);return $l(i,JI(e,o,l,t,r))}else return $l(i,Em(e,t,r))}function GI(e,t){if(!t.type.compatibleContent(e.type))throw new Cm("Cannot join "+t.type.name+" onto "+e.type.name)}function jw(e,t,n){let r=e.node(n);return GI(r,t.node(n)),r}function Ll(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 fd(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&&(Ll(e.nodeAfter,r),i++));for(let l=i;l<o;l++)Ll(s.child(l),r);t&&t.depth==n&&t.textOffset&&Ll(t.nodeBefore,r)}function $l(e,t){return e.type.checkContent(t),e.copy(t)}function JI(e,t,n,r,s){let i=e.depth>s&&jw(e,t,s+1),o=r.depth>s&&jw(n,r,s+1),l=[];return fd(null,e,s,l),i&&o&&t.index(s)==n.index(s)?(GI(i,o),Ll($l(i,JI(e,t,n,r,s+1)),l)):(i&&Ll($l(i,Em(e,t,s+1)),l),fd(t,n,s,l),o&&Ll($l(o,Em(n,r,s+1)),l)),fd(r,null,s,l),new J(l)}function Em(e,t,n){let r=[];if(fd(null,e,n,r),e.depth>n){let s=jw(e,t,n+1);Ll($l(s,Em(e,t,n+1)),r)}return fd(t,null,n,r),new J(r)}function RG(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 tf{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 Nm(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 tf(n,r,i)}static resolveCached(t,n){let r=oT.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 oT.set(t,r=new jG);let s=r.elts[r.i]=tf.resolve(t,n);return r.i=(r.i+1)%MG,s}}class jG{constructor(){this.elts=[],this.i=0}}const MG=12,oT=new WeakMap;class Nm{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 OG=Object.create(null);let _o=class Mw{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&&Sm(this.attrs,n||t.defaultAttrs||OG)&&ft.sameSet(this.marks,r||ft.none)}copy(t=null){return t==this.content?this:new Mw(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Mw(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 TG(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 tf.resolveCached(this,t)}resolveNoCache(t){return tf.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()+")"),ZI(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}};_o.prototype.text=void 0;class Tm extends _o{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):ZI(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 Tm(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Tm(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 ZI(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class Xl{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new PG(t,n);if(r.next==null)return Xl.empty;let s=YI(r);r.next&&r.err("Unexpected trailing text");let i=zG($G(s));return FG(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 f=i(d,l.concat(c));if(f)return f}}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(`
|
|
492
|
+
`)}}Xl.empty=new Xl(!0);class PG{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 YI(e){let t=[];do t.push(AG(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function AG(e){let t=[];do t.push(_G(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function _G(e){let t=LG(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=IG(e,t);else break;return t}function lT(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function IG(e,t){let n=lT(e),r=n;return e.eat(",")&&(e.next!="}"?r=lT(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function DG(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 LG(e){if(e.eat("(")){let t=YI(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=DG(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 $G(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 XI(e,t){return t-e}function aT(e,t){let n=[];return r(t),n.sort(XI);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 zG(e){let t=Object.create(null);return n(aT(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]);aT(e,a).forEach(c=>{u||s.push([l,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let i=t[r.join(",")]=new Xl(r.indexOf(e.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(XI);i.next.push({type:s[o][0],next:t[l.join(",")]||n(l)})}return i}}function FG(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 eD(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 tD(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 nD(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 rD(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new VG(e,r,t[r]);return n}let uT=class sD{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=rD(t,r.attrs),this.defaultAttrs=eD(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==Xl.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:tD(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new _o(this,this.computeAttrs(t),J.from(n),ft.setFrom(r))}createChecked(t=null,n,r){return n=J.from(n),this.checkContent(n),new _o(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 _o(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){nD(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 sD(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 BG(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 VG{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?BG(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class sy{constructor(t,n,r,s){this.name=t,this.rank=n,this.schema=r,this.spec=s,this.attrs=rD(t,s.attrs),this.excluded=null;let i=eD(this.attrs);this.instance=i?new ft(this,i):null}create(t=null){return!t&&this.instance?this.instance:new ft(this,tD(this.attrs,t))}static compile(t,n){let r=Object.create(null),s=0;return t.forEach((i,o)=>r[i]=new sy(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){nD(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}let iD=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=cn.from(t.nodes),n.marks=cn.from(t.marks||{}),this.nodes=uT.compile(this.spec.nodes,this),this.marks=sy.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]=Xl.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?cT(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==""?[]:cT(this,o.split(" "))}this.nodeFromJSON=s=>_o.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 uT){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 Tm(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 cT(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 HG(e){return e.tag!=null}function UG(e){return e.style!=null}class Mi{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(HG(s))this.tags.push(s);else if(UG(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 fT(this,n,!1);return r.addAll(t,ft.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new fT(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(KG(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=hT(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=hT(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Mi(t,Mi.schemaRules(t)))}}const oD={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},qG={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},lD={ol:!0,ul:!0},nf=1,Ow=2,hd=4;function dT(e,t,n){return t!=null?(t?nf:0)|(t==="full"?Ow:0):e&&e.whitespace=="pre"?nf|Ow:n&~hd}class Oh{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&hd?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&nf)){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&&!oD.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class fT{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=dT(null,n.preserveWhitespace,0)|(r?hd:0);s?i=new Oh(s.type,s.attrs,ft.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new Oh(null,null,ft.none,!0,null,o):i=new Oh(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&Ow?"full":this.localPreserveWS||(s.options&nf)>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,`
|
|
493
|
+
`);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;lD.hasOwnProperty(o)&&this.parser.normalizeLists&&WG(t);let a=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(l=this.parser.matchTag(t,this,r));e:if(a?a.ignore:qG.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(oD.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(`
|
|
494
|
+
`),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):pT(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=dT(t,i,o.options);o.options&hd&&o.content.length==0&&(l|=hd);let a=ft.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):pT(u.type,t))?(a=u.addToSet(a),!1):!0),this.nodes.push(new Oh(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|=nf)}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 WG(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&lD.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function KG(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function hT(e){let t={};for(let n in e)t[n]=e[n];return t}function pT(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 ha{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=Ux(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}=wp(Ux(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&&wp(Ux(r),s(t,n),null,t.attrs)}static renderSpec(t,n,r=null,s){return wp(t,n,r,s)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new ha(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=mT(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return mT(t.marks)}}function mT(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Ux(e){return e.document||window.document}const gT=new WeakMap;function QG(e){let t=gT.get(e);return t===void 0&&gT.set(e,t=GG(e)),t}function GG(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 wp(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=QG(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 f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+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 f=t[d];if(f===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:h,contentDOM:m}=wp(e,f,n,r);if(a.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const aD=65535,uD=Math.pow(2,16);function JG(e,t){return e+t*uD}function yT(e){return e&aD}function ZG(e){return(e-(e&aD))/uD}const cD=1,dD=2,bp=4,fD=8;class Pw{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&fD)>0}get deletedBefore(){return(this.delInfo&(cD|bp))>0}get deletedAfter(){return(this.delInfo&(dD|bp))>0}get deletedAcross(){return(this.delInfo&bp)>0}}class hr{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&hr.empty)return hr.empty}recover(t){let n=0,r=yT(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 f=u?t==a?-1:t==d?1:n:n,h=a+s+(f<0?0:c);if(r)return h;let m=t==(n<0?a:d)?null:JG(l/3,t-a),g=t==a?dD:t==d?cD:bp;return(n<0?t!=a:t!=d)&&(g|=fD),new Pw(h,g,m)}s+=c-u}return r?t+s:new Pw(t+s,0,null)}touches(t,n){let r=0,s=yT(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 hr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?hr.empty:new hr(t<0?[0,-t,0]:[0,0,t])}}hr.empty=new hr([]);class rf{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 rf(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 rf;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 Pw(t,s,null)}}const qx=Object.create(null);class On{getMap(){return hr.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=qx[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 qx)throw new RangeError("Duplicate use of step JSON ID "+t);return qx[t]=n,n.prototype.jsonID=t,n}}class Vt{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Vt(t,null)}static fail(t){return new Vt(null,t)}static fromReplace(t,n,r,s){try{return Vt.ok(t.replace(n,r,s))}catch(i){if(i instanceof Cm)return Vt.fail(i.message);throw i}}}function v1(e,t,n){let r=[];for(let s=0;s<e.childCount;s++){let i=e.child(s);i.content.size&&(i=i.copy(v1(i.content,t,i))),i.isInline&&(i=t(i,n,s)),r.push(i)}return J.fromArray(r)}class bo extends On{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(v1(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 Vt.fromReplace(t,this.from,this.to,i)}invert(){return new ds(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 bo(n.pos,r.pos,this.mark)}merge(t){return t instanceof bo&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new bo(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 bo(n.from,n.to,t.markFromJSON(n.mark))}}On.jsonID("addMark",bo);class ds extends On{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(v1(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),t),n.openStart,n.openEnd);return Vt.fromReplace(t,this.from,this.to,r)}invert(){return new bo(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 ds(n.pos,r.pos,this.mark)}merge(t){return t instanceof ds&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ds(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 ds(n.from,n.to,t.markFromJSON(n.mark))}}On.jsonID("removeMark",ds);class ko extends On{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Vt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Vt.fromReplace(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 ko(this.pos,n.marks[s]);return new ko(this.pos,this.mark)}}return new ea(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new ko(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 ko(n.pos,t.markFromJSON(n.mark))}}On.jsonID("addNodeMark",ko);class ea extends On{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Vt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Vt.fromReplace(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 ko(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new ea(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 ea(n.pos,t.markFromJSON(n.mark))}}On.jsonID("removeNodeMark",ea);class nn extends On{constructor(t,n,r,s=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=s}apply(t){return this.structure&&Aw(t,this.from,this.to)?Vt.fail("Structure replace would overwrite content"):Vt.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new hr([this.from,this.to-this.from,this.slice.size])}invert(t){return new nn(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 nn(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(t){if(!(t instanceof nn)||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 nn(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 nn(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 nn(n.from,n.to,ue.fromJSON(t,n.slice),!!n.structure)}}On.jsonID("replace",nn);class on extends On{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&&(Aw(t,this.from,this.gapFrom)||Aw(t,this.gapTo,this.to)))return Vt.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Vt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Vt.fromReplace(t,this.from,this.to,r):Vt.fail("Content does not fit in gap")}getMap(){return new hr([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 on(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 on(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 on(n.from,n.to,n.gapFrom,n.gapTo,ue.fromJSON(t,n.slice),n.insert,!!n.structure)}}On.jsonID("replaceAround",on);function Aw(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 YG(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 f=Math.max(u,t),h=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==f&&o.mark.eq(d[g])?o.to=h:s.push(o=new ds(f,h,d[g])));l&&l.to==f?l.to=h:i.push(l=new bo(f,h,r))}}),s.forEach(a=>e.step(a)),i.forEach(a=>e.step(a))}function XG(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 sy){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],f;for(let h=0;h<s.length;h++){let m=s[h];m.step==i-1&&d.eq(s[h].style)&&(f=m)}f?(f.to=u,f.step=i):s.push({style:d,from:Math.max(l,t),to:u,step:i})}}}),s.forEach(o=>e.step(new ds(o.from,o.to,o.style)))}function w1(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 nn(l,c,ue.empty));else{r=d;for(let f=0;f<u.marks.length;f++)n.allowsMarkType(u.marks[f].type)||e.step(new ds(l,c,u.marks[f]));if(s&&u.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(u.text);)m||(m=new ue(J.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),o.push(new nn(l+f.index,l+f.index+f[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 eJ(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function hc(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||!eJ(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function tJ(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 f=J.empty,h=0;for(let m=i,g=!1;m>n;m--)g||s.after(m+1)<s.end(m)?(g=!0,f=J.from(s.node(m).copy(f)),h++):u++;e.step(new on(a,u,o,l,new ue(c.append(f),d,h),c.size-d,!0))}function b1(e,t,n=null,r=e){let s=nJ(e,t),i=s&&rJ(r,t);return i?s.map(xT).concat({type:t,attrs:n}).concat(i.map(xT)):null}function xT(e){return{type:e,attrs:null}}function nJ(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 rJ(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 sJ(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 on(s,i,s,i,new ue(r,0,0),n.length,!0))}function iJ(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)&&oJ(e.doc,e.mapping.slice(i).map(l),r)){let u=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&pD(e,o,l,i),w1(e,e.mapping.slice(i).map(l,1),r,void 0,u===null);let c=e.mapping.slice(i),d=c.map(l,1),f=c.map(l+o.nodeSize,1);return e.step(new on(d,f,d+1,f-1,new ue(J.from(r.create(a,null,o.marks)),0,0),1,!0)),u===!0&&hD(e,o,l,i),!1}})}function hD(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 pD(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(`
|
|
495
|
+
`))}})}function oJ(e,t,n){let r=e.resolve(t),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function lJ(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 on(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new ue(J.from(o),0,0),1,!0))}function Oi(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),f=s.index(u);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),m=r&&r[c+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[c]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(h))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 aJ(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 nn(t,t,new ue(i.append(o),n,n),!0))}function sl(e,t){let n=e.resolve(t),r=n.index();return mD(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function uJ(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 mD(e,t){return!!(e&&t&&!e.isLeaf&&uJ(e,t))}function iy(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&&mD(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 cJ(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);pD(e,c.node(),c.before(),l)}o.inlineContent&&w1(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 nn(u,a.map(t+n,-1),ue.empty,!0)),r===!0){let c=e.doc.resolve(u);hD(e,c.node(),c.before(),e.steps.length)}return e}function dJ(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 gD(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 oy(e,t,n=t,r=ue.empty){if(t==n&&!r.size)return null;let s=e.resolve(t),i=e.resolve(n);return yD(s,i,r)?new nn(t,n,r):new fJ(s,i,r).fit()}function yD(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class fJ{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 on(r.pos,t,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new nn(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=Wx(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=Wx(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=Wx(t,n);if(s.childCount<=1&&n>0){let i=t.size-n<=n+s.size;this.unplaced=new ue(Kc(t,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ue(Kc(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:f}=this.frontier[n];if(s){for(let g=0;g<s.childCount;g++)c.push(s.child(g));d=d.matchFragment(s)}let h=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(xD(g.mark(f.allowedMarks(g.marks)),u==1?a:0,u==l.childCount?h:-1)))}let m=u==l.childCount;m||(h=-1),this.placed=Qc(this.placed,n,J.from(c)),this.frontier[n].match=d,m&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,v=l;g<h;g++){let x=v.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),v=x.content}this.unplaced=m?t==0?ue.empty:new ue(Kc(o.content,t-1,1),t-1,h<0?o.openEnd:t-1):new ue(Kc(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||!Kx(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=Kx(t,n,s,r,i);if(o){for(let l=n-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],c=Kx(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 Kc(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Kc(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 Wx(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function xD(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,xD(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 Kx(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&&!hJ(n,i.content,o)?l:null}function hJ(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function pJ(e){return e.spec.defining||e.spec.definingForContent}function mJ(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let s=e.doc.resolve(t),i=e.doc.resolve(n);if(yD(s,i,r))return e.step(new nn(t,n,r));let o=wD(s,i);o[o.length-1]==0&&o.pop();let l=-(s.depth+1);o.unshift(l);for(let f=s.depth,h=s.pos-1;f>0;f--,h--){let m=s.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(f)>-1?l=f:s.before(f)==h&&o.splice(1,0,-f)}let a=o.indexOf(l),u=[],c=r.openStart;for(let f=r.content,h=0;;h++){let m=f.firstChild;if(u.push(m),h==r.openStart)break;f=m.content}for(let f=c-1;f>=0;f--){let h=u[f],m=pJ(h.type);if(m&&!h.sameMarkup(s.node(Math.abs(l)-1)))c=f;else if(m||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+c+1)%(r.openStart+1),m=u[h];if(m)for(let g=0;g<o.length;g++){let v=o[(g+a)%o.length],x=!0;v<0&&(x=!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),x?i.after(v):n,new ue(vD(r.content,0,r.openStart,h),h,r.openEnd))}}let d=e.steps.length;for(let f=o.length-1;f>=0&&(e.replace(t,n,r),!(e.steps.length>d));f--){let h=o[f];h<0||(t=s.before(h),n=i.after(h))}}function vD(e,t,n,r,s){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(vD(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 gJ(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let s=dJ(e.doc,t,r.type);s!=null&&(t=n=s)}e.replaceRange(t,n,new ue(J.from(r),0,0))}function yJ(e,t,n){let r=e.doc.resolve(t),s=e.doc.resolve(n),i=wD(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 wD(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 uu extends On{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 Vt.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 Vt.fromReplace(t,this.pos,this.pos+1,new ue(J.from(s),0,n.isLeaf?0:1))}getMap(){return hr.empty}invert(t){return new uu(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 uu(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 uu(n.pos,n.attr,n.value)}}On.jsonID("attr",uu);class sf extends On{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 Vt.ok(r)}getMap(){return hr.empty}invert(t){return new sf(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 sf(n.attr,n.value)}}On.jsonID("docAttr",sf);let Gu=class extends Error{};Gu=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};Gu.prototype=Object.create(Error.prototype);Gu.prototype.constructor=Gu;Gu.prototype.name="TransformError";class bD{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new rf}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new Gu(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=oy(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 mJ(this,t,n,r),this}replaceRangeWith(t,n,r){return gJ(this,t,n,r),this}deleteRange(t,n){return yJ(this,t,n),this}lift(t,n){return tJ(this,t,n),this}join(t,n=1){return cJ(this,t,n),this}wrap(t,n){return sJ(this,t,n),this}setBlockType(t,n=t,r,s=null){return iJ(this,t,n,r,s),this}setNodeMarkup(t,n,r=null,s){return lJ(this,t,n,r,s),this}setNodeAttribute(t,n,r){return this.step(new uu(t,n,r)),this}setDocAttribute(t,n){return this.step(new sf(t,n)),this}addNodeMark(t,n){return this.step(new ko(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 ea(t,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new ea(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 aJ(this,t,n,r),this}addMark(t,n,r){return YG(this,t,n,r),this}removeMark(t,n,r){return XG(this,t,n,r),this}clearIncompatible(t,n,r){return w1(this,t,n,r),this}}const Qx=Object.create(null);class Pe{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new kD(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&&bT(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),bT(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let s=t.parent.inlineContent?new _e(t):La(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?La(t.node(0),t.node(i),t.before(i+1),t.index(i),n,r):La(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 xr(t.node(0))}static atStart(t){return La(t,t,0,0,1)||new xr(t)}static atEnd(t){return La(t,t,t.content.size,t.childCount,-1)||new xr(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Qx[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 Qx)throw new RangeError("Duplicate use of selection JSON ID "+t);return Qx[t]=n,n.prototype.jsonID=t,n}getBookmark(){return _e.between(this.$anchor,this.$head).getBookmark()}}Pe.prototype.visible=!0;class kD{constructor(t,n){this.$from=t,this.$to=n}}let vT=!1;function wT(e){!vT&&!e.parent.inlineContent&&(vT=!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){wT(t),wT(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 ly(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 ly{constructor(t,n){this.anchor=t,this.head=n}map(t){return new ly(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 k1(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 k1{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new ly(r,r):new k1(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&Te.isSelectable(r)?new Te(n):Pe.near(n)}}class xr 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 xr(t)}map(t){return new xr(t)}eq(t){return t instanceof xr}getBookmark(){return xJ}}Pe.jsonID("all",xr);const xJ={map(){return this},resolve(e){return new xr(e)}};function La(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=La(e,l,n+s,s<0?l.childCount:0,s,i);if(a)return a}n+=l.nodeSize*s}return null}function bT(e,t,n){let r=e.steps.length-1;if(r<t)return;let s=e.steps[r];if(!(s instanceof nn||s instanceof on))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 kT=1,Ph=2,ST=4;class vJ extends bD{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|kT)&~Ph,this.storedMarks=null,this}get selectionSet(){return(this.updated&kT)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=Ph,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&Ph)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~Ph,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|=ST,this}get scrolledIntoView(){return(this.updated&ST)>0}}function CT(e,t){return!t||!e?e:e.bind(t)}class Gc{constructor(t,n,r){this.name=t,this.init=CT(n.init,r),this.apply=CT(n.apply,r)}}const wJ=[new Gc("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Gc("selection",{init(e,t){return e.selection||Pe.atStart(t.doc)},apply(e){return e.selection}}),new Gc("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Gc("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class Gx{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=wJ.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 Gc(r.key,r.spec.state,r))})}}class eu{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 eu(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 vJ(this)}static create(t){let n=new Gx(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new eu(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 Gx(this.schema,t.plugins),r=n.fields,s=new eu(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 Gx(t.schema,t.plugins),i=new eu(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=_o.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 SD(e,t,n){for(let r in e){let s=e[r];s instanceof Function?s=s.bind(t):r=="handleDOMEvents"&&(s=SD(s,t,{})),n[r]=s}return n}class wt{constructor(t){this.spec=t,this.props={},t.props&&SD(t.props,this,this.props),this.key=t.key?t.key.key:CD("plugin")}getState(t){return t[this.key]}}const Jx=Object.create(null);function CD(e){return e in Jx?e+"$"+ ++Jx[e]:(Jx[e]=0,e+"$")}class Ct{constructor(t="key"){this.key=CD(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const S1=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function ED(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const ND=(e,t,n)=>{let r=ED(e,n);if(!r)return!1;let s=C1(r);if(!s){let o=r.blockRange(),l=o&&hc(o);return l==null?!1:(t&&t(e.tr.lift(o,l).scrollIntoView()),!0)}let i=s.nodeBefore;if(ID(e,s,t,-1))return!0;if(r.parent.content.size==0&&(Ju(i,"end")||Te.isSelectable(i)))for(let o=r.depth;;o--){let l=oy(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(Ju(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},bJ=(e,t,n)=>{let r=ED(e,n);if(!r)return!1;let s=C1(r);return s?TD(e,s,t):!1},kJ=(e,t,n)=>{let r=jD(e,n);if(!r)return!1;let s=E1(r);return s?TD(e,s,t):!1};function TD(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=oy(e.doc,i,a,ue.empty);if(!u||u.from!=i||u instanceof nn&&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 Ju(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 RD=(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=C1(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 C1(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 jD(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const MD=(e,t,n)=>{let r=jD(e,n);if(!r)return!1;let s=E1(r);if(!s)return!1;let i=s.nodeAfter;if(ID(e,s,t,1))return!0;if(r.parent.content.size==0&&(Ju(i,"start")||Te.isSelectable(i))){let o=oy(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(Ju(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},OD=(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=E1(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 E1(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 SJ=(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=iy(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},CJ=(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=iy(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},EJ=(e,t)=>{let{$from:n,$to:r}=e.selection,s=n.blockRange(r),i=s&&hc(s);return i==null?!1:(t&&t(e.tr.lift(s,i).scrollIntoView()),!0)},PD=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
496
|
+
`).scrollIntoView()),!0)};function N1(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 NJ=(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=N1(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},AD=(e,t)=>{let n=e.selection,{$from:r,$to:s}=n;if(n instanceof xr||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=N1(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},_D=(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(Oi(e.doc,i))return t&&t(e.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&hc(r);return s==null?!1:(t&&t(e.tr.lift(r,s).scrollIntoView()),!0)};function TJ(e){return(t,n)=>{let{$from:r,$to:s}=t.selection;if(t.selection instanceof Te&&t.selection.node.isBlock)return!r.parentOffset||!Oi(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 h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),u=r.start(h)==r.pos-(r.depth-h),l=N1(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),i.unshift(a&&l?{type:l}:null),o=h;break}else{if(h==1)return!1;i.unshift(null)}let c=t.tr;(t.selection instanceof _e||t.selection instanceof xr)&&c.deleteSelection();let d=c.mapping.map(r.pos),f=Oi(c.doc,d,i.length,i);if(f||(i[0]=l?{type:l}:null,f=Oi(c.doc,d,i.length,i)),!f)return!1;if(c.split(d,i.length,i),!a&&u&&r.node(o).type!=l){let h=c.mapping.map(r.before(o)),m=c.doc.resolve(h);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 RJ=TJ(),jJ=(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 MJ(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 ID(e,t,n,r){let s=t.nodeBefore,i=t.nodeAfter,o,l,a=s.type.spec.isolating||i.type.spec.isolating;if(!a&&MJ(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 h=t.pos+i.nodeSize,m=J.empty;for(let x=o.length-1;x>=0;x--)m=J.from(o[x].create(null,m));m=J.from(s.copy(m));let g=e.tr.step(new on(t.pos-1,h,t.pos,h,new ue(m,1,0),o.length,!0)),v=g.doc.resolve(h+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),f=d&&hc(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(u&&Ju(i,"start",!0)&&Ju(s,"end")){let h=s,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=i,v=1;for(;!g.isTextblock;g=g.firstChild)v++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let x=J.empty;for(let b=m.length-1;b>=0;b--)x=J.from(m[b].copy(x));let w=e.tr.step(new on(t.pos-m.length,t.pos+i.nodeSize,t.pos+v,t.pos+i.nodeSize-v,new ue(x,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function DD(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 OJ=DD(-1),PJ=DD(1);function AJ(e,t=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),l=o&&b1(o,e,t);return l?(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0):!1}}function ET(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 T1(...e){return function(t,n,r){for(let s=0;s<e.length;s++)if(e[s](t,n,r))return!0;return!1}}T1(S1,ND,RD);T1(S1,MD,OD);T1(PD,AD,_D,RJ);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function _J(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 IJ(l,o,e,t)?(r&&r(l.scrollIntoView()),!0):!1}}function IJ(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 Nm(a,a,t.depth),t.endIndex<t.parent.childCount&&(t=new Nm(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),s=!0}let l=b1(i,n,r,t);return l?(e&&DJ(e,t,l,s,n),!0):!1}function DJ(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 on(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,f=!0;c<d;c++,f=!1)!f&&Oi(e.doc,a,l)&&(e.split(a,l),a+=2*l),a+=u.child(c).nodeSize;return e}function LJ(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?$J(t,n,e,i):zJ(t,n,i):!0:!1}}function $J(e,t,n,r){let s=e.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new on(i-1,o,i,o,new ue(J.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Nm(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const l=hc(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 zJ(e,t,n){let r=e.tr,s=n.parent;for(let h=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)h-=s.child(m).nodeSize,r.delete(h-1,h+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,f=d+o.nodeSize;return r.step(new on(d-(l?1:0),f+(a?1:0),d+1,f-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 FJ(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),f=i.start,h=i.end;n(t.tr.step(new on(f-(u?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const dn=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Zu=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let _w=null;const mi=function(e,t,n){let r=_w||(_w=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},BJ=function(){_w=null},ta=function(e,t,n,r){return n&&(NT(e,t,n,r,-1)||NT(e,t,n,r,1))},VJ=/^(img|br|input|textarea|hr)$/i;function NT(e,t,n,r,s){for(var i;;){if(e==n&&t==r)return!0;if(t==(s<0?0:zr(e))){let o=e.parentNode;if(!o||o.nodeType!=1||Ff(e)||VJ.test(e.nodeName)||e.contentEditable=="false")return!1;t=dn(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?zr(e):0}else return!1}}function zr(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function HJ(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=zr(e)}else if(e.parentNode&&!Ff(e))t=dn(e),e=e.parentNode;else return null}}function UJ(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&&!Ff(e))t=dn(e)+1,e=e.parentNode;else return null}}function qJ(e,t,n){for(let r=t==0,s=t==zr(e);r||s;){if(e==n)return!0;let i=dn(e);if(e=e.parentNode,!e)return!1;r=r&&i==0,s=s&&i==zr(e)}}function Ff(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 ay=function(e){return e.focusNode&&ta(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function gl(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function WJ(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function KJ(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(zr(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(zr(r.startContainer),r.startOffset)}}}const Gs=typeof navigator<"u"?navigator:null,TT=typeof document<"u"?document:null,il=Gs&&Gs.userAgent||"",Iw=/Edge\/(\d+)/.exec(il),LD=/MSIE \d/.exec(il),Dw=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(il),sr=!!(LD||Dw||Iw),Io=LD?document.documentMode:Dw?+Dw[1]:Iw?+Iw[1]:0,Vr=!sr&&/gecko\/(\d+)/i.test(il);Vr&&+(/Firefox\/(\d+)/.exec(il)||[0,0])[1];const Lw=!sr&&/Chrome\/(\d+)/.exec(il),rn=!!Lw,$D=Lw?+Lw[1]:0,mn=!sr&&!!Gs&&/Apple Computer/.test(Gs.vendor),Yu=mn&&(/Mobile\/\w+/.test(il)||!!Gs&&Gs.maxTouchPoints>2),_r=Yu||(Gs?/Mac/.test(Gs.platform):!1),zD=Gs?/Win/.test(Gs.platform):!1,Ei=/Android \d/.test(il),Bf=!!TT&&"webkitFontSmoothing"in TT.documentElement.style,QJ=Bf?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function GJ(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 ii(e,t){return typeof e=="number"?e:e[t]}function JJ(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 RT(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=Zu(o);continue}let l=o,a=l==i.body,u=a?GJ(i):JJ(l),c=0,d=0;if(t.top<u.top+ii(r,"top")?d=-(u.top-t.top+ii(s,"top")):t.bottom>u.bottom-ii(r,"bottom")&&(d=t.bottom-t.top>u.bottom-u.top?t.top+ii(s,"top")-u.top:t.bottom-u.bottom+ii(s,"bottom")),t.left<u.left+ii(r,"left")?c=-(u.left-t.left+ii(s,"left")):t.right>u.right-ii(r,"right")&&(c=t.right-u.right+ii(s,"right")),c||d)if(a)i.defaultView.scrollBy(c,d);else{let h=l.scrollLeft,m=l.scrollTop;d&&(l.scrollTop+=d),c&&(l.scrollLeft+=c);let g=l.scrollLeft-h,v=l.scrollTop-m;t={left:t.left-g,top:t.top-v,right:t.right-g,bottom:t.bottom-v}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:Zu(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:FD(e.dom)}}function FD(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Zu(r));return t}function YJ({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;BD(n,r==0?0:r-t)}function BD(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 Ra=null;function XJ(e){if(e.setActive)return e.setActive();if(Ra)return e.focus(Ra);let t=FD(e);e.focus(Ra==null?{get preventScroll(){return Ra={preventScroll:!0},!0}}:void 0),Ra||(Ra=!1,BD(t,0))}function VD(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 f;if(c.nodeType==1)f=c.getClientRects();else if(c.nodeType==3)f=mi(c).getClientRects();else continue;for(let h=0;h<f.length;h++){let m=f[h];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?eZ(n,s):!n||r&&n.nodeType==1?{node:e,offset:i}:VD(n,s)}function eZ(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=Gi(r,1);if(o.top!=o.bottom&&R1(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 R1(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function tZ(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function nZ(e,t,n){let{node:r,offset:s}=VD(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 rZ(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 HD(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(R1(t,u))return HD(o,t,u)}}if((i=(i+1)%r)==s)break}return e}function sZ(e,t){let n=e.dom.ownerDocument,r,s=0,i=KJ(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(!R1(t,u)||(o=HD(e.dom,t,u),!o))return null}if(mn)for(let u=o;r&&u;u=Zu(u))u.draggable&&(r=void 0);if(o=tZ(o,t),r){if(Vr&&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;Bf&&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=rZ(e,r,s,t))}l==null&&(l=nZ(e,o,t));let a=e.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function jT(e){return e.top<e.bottom||e.left<e.right}function Gi(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(jT(r))return r}return Array.prototype.find.call(n,jT)||e.getBoundingClientRect()}const iZ=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function UD(e,t,n){let{node:r,offset:s,atom:i}=e.docView.domFromPos(t,n<0?-1:1),o=Bf||Vr;if(r.nodeType==3)if(o&&(iZ.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let a=Gi(mi(r,s,s),n);if(Vr&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let u=Gi(mi(r,s-1,s-1),-1);if(u.top==a.top){let c=Gi(mi(r,s,s+1),-1);if(c.top!=a.top)return Pc(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++,Pc(Gi(mi(r,a,u),c),c<0)}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==zr(r))){let a=r.childNodes[s-1];if(a.nodeType==1)return Zx(a.getBoundingClientRect(),!1)}if(i==null&&s<zr(r)){let a=r.childNodes[s];if(a.nodeType==1)return Zx(a.getBoundingClientRect(),!0)}return Zx(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==zr(r))){let a=r.childNodes[s-1],u=a.nodeType==3?mi(a,zr(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return Pc(Gi(u,1),!1)}if(i==null&&s<zr(r)){let a=r.childNodes[s];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let u=a?a.nodeType==3?mi(a,0,o?0:1):a.nodeType==1?a:null:null;if(u)return Pc(Gi(u,-1),!0)}return Pc(Gi(r.nodeType==3?mi(r):r,-n),n>=0)}function Pc(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 Zx(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 qD(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 oZ(e,t,n){let r=t.selection,s=n=="up"?r.$from:r.$to;return qD(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=UD(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=mi(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 lZ=/[\u0590-\u08ac]/;function aZ(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?!lZ.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:o:qD(e,t,()=>{let{focusNode:a,focusOffset:u,anchorNode:c,anchorOffset:d}=e.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let h=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:m,focusOffset:g}=e.domSelectionRange(),v=m&&!h.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 f!=null&&(l.caretBidiLevel=f),v}):r.pos==r.start()||r.pos==r.end()}let MT=null,OT=null,PT=!1;function uZ(e,t,n){return MT==t&&OT==n?PT:(MT=t,OT=n,PT=n=="up"||n=="down"?oZ(e,t,n):aZ(e,t,n))}const Hr=0,AT=1,kl=2,Js=3;class Vf{constructor(t,n,r,s){this.parent=t,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Hr,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>dn(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 KD){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 WD&&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?dn(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?dn(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 f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){s=dn(f.dom)+1;break}t-=f.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=dn(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 h=0,m=0;h<this.children.length;h++){let g=this.children[h],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((Vr||mn)&&t==n){let{node:h,offset:m}=l;if(h.nodeType==3){if(d=!!(m&&h.nodeValue[m-1]==`
|
|
497
|
+
`),d&&m==h.nodeValue.length)for(let g=h,v;g;g=g.parentNode){if(v=g.nextSibling){v.nodeName=="BR"&&(l=a={node:v.parentNode,offset:dn(v)+1});break}let x=g.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let g=h.childNodes[m-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Vr&&c.focusNode&&c.focusNode!=a.node&&c.focusNode.nodeType==1){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(s=!0)}if(!(s||d&&mn)&&ta(l.node,l.offset,c.anchorNode,c.anchorOffset)&&ta(a.node,a.offset,c.focusNode,c.focusOffset))return;let f=!1;if((u.extend||t==n)&&!(d&&Vr)){u.collapse(l.node,l.offset);try{t!=n&&u.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(t>n){let m=l;l=a,a=m}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(h)}}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?kl:AT,t==l&&n==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Js:i.markDirty(t-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?kl:Js}r=o}this.dirty=kl}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?kl:AT;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class WD extends Vf{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==Hr&&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 cZ extends Vf{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 na extends Vf{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=ha.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new na(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Js||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=Js&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=Hr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Hr}}slice(t,n,r){let s=na.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=zw(i,n,o,r)),t>0&&(i=zw(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 Do extends Vf{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}=ha.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 f=c;return c=JD(c,r,n),u?a=new dZ(t,n,r,s,c,d||null,f,u,i,o+1):n.isText?new uy(t,n,r,s,c,f,i):new Do(t,n,r,s,c,d||null,f,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==Hr&&t.eq(this.node)&&Rm(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 hZ(this,o&&o.node,t);gZ(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,f)=>{a.syncToMarks(u.marks,r,t,f);let h;a.findNodeMatch(u,c,d,f)||l&&t.state.selection.from>s&&t.state.selection.to<s+u.nodeSize&&(h=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(u,c,d,h,t)||a.updateNextNode(u,c,d,t,f,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==kl)&&(o&&this.protectLocalComposition(t,o),QD(this.contentDOM,this.children,t),Yu&&yZ(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=xZ(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 cZ(this,i,n,s);t.input.compositionNodes.push(o),this.children=zw(this.children,r,r+s.length,t,o)}update(t,n,r,s){return this.dirty==Js||!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=Hr}updateOuterDeco(t){if(Rm(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=GD(this.dom,this.nodeDOM,$w(this.outerDeco,this.node,n),$w(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 _T(e,t,n,r,s){JD(r,t,e);let i=new Do(void 0,e,t,n,r,r,r,s,0);return i.contentDOM&&i.updateChildren(s,0),i}class uy extends Do{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==Js||this.dirty!=Hr&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Hr||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=Hr,!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 uy(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=Js)}get domAtom(){return!1}isText(t){return this.node.text==t}}class KD extends Vf{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==Hr&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class dZ extends Do{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==Js)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 QD(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=IT(r),s=!0;r=r.nextSibling}else s=!0,e.insertBefore(l,r);if(o instanceof na){let a=r?r.previousSibling:e.lastChild;QD(o.contentDOM,o.children,n),r=a?a.nextSibling:e.firstChild}}for(;r;)r=IT(r),s=!0;s&&n.trackWrites==e&&(n.trackWrites=null)}const pd=function(e){e&&(this.nodeName=e)};pd.prototype=Object.create(null);const Sl=[new pd];function $w(e,t,n){if(e.length==0)return Sl;let r=n?Sl[0]:new pd,s=[r];for(let i=0;i<e.length;i++){let o=e[i].type.attrs;if(o){o.nodeName&&s.push(r=new pd(o.nodeName));for(let l in o){let a=o[l];a!=null&&(n&&s.length==1&&s.push(r=new pd(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 GD(e,t,n,r){if(n==Sl&&r==Sl)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=Sl[0]),s=a}fZ(s,l||Sl[0],o)}return s}function fZ(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 JD(e,t,n){return GD(e,e,Sl,$w(t,n,e.nodeType!=1))}function Rm(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 IT(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class hZ{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=pZ(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=Hr,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=na.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==Js&&o.dom==o.contentDOM&&(o.dirty=kl),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 Do){let u=this.preMatch.matched.get(a);if(u!=null&&u!=i)return!1;let c=a.dom,d,f=this.isLocked(c)&&!(t.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==t.text&&a.dirty!=Js&&Rm(n,a.outerDeco));if(!f&&a.update(t,n,r,s))return this.destroyBetween(this.index,l),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!f&&(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=kl,d.updateChildren(s,o+1),d.dirty=Hr),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)||!Rm(r,t.outerDeco)||!s.eq(t.innerDeco))return null;let l=Do.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=Do.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 WD(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 na;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof uy)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((mn||rn)&&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 KD(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 pZ(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 na)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 mZ(e,t){return e.type.side-t.type.side}function gZ(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(mZ);for(let v=0;v<d.length;v++)n(d[v],u,!!a)}else n(c,u,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(u<e.childCount)h=u,f=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+f.nodeSize;if(f.isText){let v=m;o<s.length&&s[o].from<v&&(v=s[o].from);for(let x=0;x<l.length;x++)l[x].to<v&&(v=l[x].to);v<m&&(a=f.cut(v-i),f=f.cut(0,v-i),m=v,h=-1)}else for(;o<s.length&&s[o].to<m;)o++;let g=f.isInline&&!f.isLeaf?l.filter(v=>!v.inline):l.slice();r(f,g,t.forChild(i,f),h),i=m}}function yZ(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 xZ(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 zw(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 j1(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(ay(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&&qJ(n.focusNode,n.focusOffset,s.dom))){let f=s.posBefore;u=new Te(o==f?l:r.resolve(f))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,f=o;for(let h=0;h<n.rangeCount;h++){let m=n.getRangeAt(h);d=Math.min(d,e.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,e.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[a,o]=f==e.state.selection.anchor?[f,d]:[d,f],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=M1(e,c,l,d)}return u}function ZD(e){return e.editable?e.hasFocus():XD(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Pi(e,t=!1){let n=e.state.selection;if(YD(e,n),!!ZD(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&rn){let r=e.domSelectionRange(),s=e.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&ta(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)wZ(e);else{let{anchor:r,head:s}=n,i,o;DT&&!(n instanceof _e)&&(n.$from.parent.inlineContent||(i=LT(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=LT(e,n.to))),e.docView.setSelection(r,s,e,t),DT&&(i&&$T(i),o&&$T(o)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&vZ(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const DT=mn||rn&&$D<63;function LT(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(mn&&s&&s.contentEditable=="false")return Yx(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return Yx(s);if(i)return Yx(i)}}function Yx(e){return e.contentEditable="true",mn&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function $T(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function vZ(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(()=>{(!ZD(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function wZ(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName=="IMG";r?t.collapse(n.parentNode,dn(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&sr&&Io<=11&&(n.disabled=!0,n.disabled=!1)}function YD(e,t){if(t instanceof Te){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(zT(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else zT(e)}function zT(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function M1(e,t,n,r){return e.someProp("createSelectionBetween",s=>s(e,t,n))||_e.between(t,n,r)}function FT(e){return e.editable&&!e.hasFocus()?!1:XD(e)}function XD(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 bZ(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return ta(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Fw(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 Xi(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function BT(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 Xi(e,new _e(r.$anchor,o))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let s=Fw(e.state,t);return s&&s instanceof Te?Xi(e,s):!1}else if(!(_r&&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)?Xi(e,new Te(t<0?e.state.doc.resolve(s.pos-i.nodeSize):s)):Bf?Xi(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 Xi(e,new _e(t>0?r.$to:r.$from));{let s=Fw(e.state,t);return s?Xi(e,s):!1}}}function jm(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function md(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function ja(e,t){return t<0?kZ(e):SZ(e)}function kZ(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let s,i,o=!1;for(Vr&&n.nodeType==1&&r<jm(n)&&md(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(md(l,-1))s=n,i=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(eL(n))break;{let l=n.previousSibling;for(;l&&md(l,-1);)s=n.parentNode,i=dn(l),l=l.previousSibling;if(l)n=l,r=jm(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}o?Bw(e,n,r):s&&Bw(e,s,i)}function SZ(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let s=jm(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let l=n.childNodes[r];if(md(l,1))i=n,o=++r;else break}else{if(eL(n))break;{let l=n.nextSibling;for(;l&&md(l,1);)i=l.parentNode,o=dn(l)+1,l=l.nextSibling;if(l)n=l,r=0,s=jm(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}i&&Bw(e,i,o)}function eL(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function CZ(e,t){for(;e&&t==e.childNodes.length&&!Ff(e);)t=dn(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 EZ(e,t){for(;e&&!t&&!Ff(e);)t=dn(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 Bw(e,t,n){if(t.nodeType!=3){let i,o;(o=CZ(t,n))?(t=o,n=0):(i=EZ(t,n))&&(t=i,n=i.nodeValue.length)}let r=e.domSelection();if(!r)return;if(ay(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&&Pi(e)},50)}function VT(e,t){let n=e.state.doc.resolve(t);if(!(rn||zD)&&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 HT(e,t,n){let r=e.state.selection;if(r instanceof _e&&!r.empty||n.indexOf("s")>-1||_r&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let o=Fw(e.state,t);if(o&&o instanceof Te)return Xi(e,o)}if(!s.parent.inlineContent){let o=t<0?s:i,l=r instanceof xr?Pe.near(o,t):Pe.findFrom(o,t);return l?Xi(e,l):!1}return!1}function UT(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 qT(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function NZ(e){if(!mn||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;qT(e,r,"true"),setTimeout(()=>qT(e,r,"false"),20)}return!1}function TZ(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function RZ(e,t){let n=t.keyCode,r=TZ(t);if(n==8||_r&&n==72&&r=="c")return UT(e,-1)||ja(e,-1);if(n==46&&!t.shiftKey||_r&&n==68&&r=="c")return UT(e,1)||ja(e,1);if(n==13||n==27)return!0;if(n==37||_r&&n==66&&r=="c"){let s=n==37?VT(e,e.state.selection.from)=="ltr"?-1:1:-1;return BT(e,s,r)||ja(e,s)}else if(n==39||_r&&n==70&&r=="c"){let s=n==39?VT(e,e.state.selection.from)=="ltr"?1:-1:1;return BT(e,s,r)||ja(e,s)}else{if(n==38||_r&&n==80&&r=="c")return HT(e,-1,r)||ja(e,-1);if(n==40||_r&&n==78&&r=="c")return NZ(e)||HT(e,1,r)||ja(e,1);if(r==(_r?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function O1(e,t){e.someProp("transformCopied",h=>{t=h(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 h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=e.someProp("clipboardSerializer")||ha.fromSchema(e.state.schema),l=oL(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let u=a.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=iL[u.nodeName.toLowerCase()]);){for(let h=c.length-1;h>=0;h--){let m=l.createElement(c[h]);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 f=e.someProp("clipboardTextSerializer",h=>h(t,e))||t.content.textBetween(0,t.content.size,`
|
|
498
|
+
|
|
499
|
+
`);return{dom:a,text:f,slice:t}}function tL(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",f=>{t=f(t,i||r,e)}),i)return l=new ue(J.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
500
|
+
`))),0,0),e.someProp("transformPasted",f=>{l=f(l,e,!0)}),l;let d=e.someProp("clipboardTextParser",f=>f(t,s,r,e));if(d)l=d;else{let f=s.marks(),{schema:h}=e.state,m=ha.fromSchema(h);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(g=>{let v=o.appendChild(document.createElement("p"));g&&v.appendChild(m.serializeNode(h.text(g,f)))})}}else e.someProp("transformPastedHTML",d=>{n=d(n,e)}),o=PZ(n),Bf&&AZ(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 f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(e.someProp("clipboardParser")||e.someProp("domParser")||Mi.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||c),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!jZ.test(f.parentNode.nodeName)?{ignore:!0}:null}})),c)l=_Z(WT(l,+c[1],+c[2]),c[4]);else if(l=ue.maxOpen(MZ(l.content,s),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=WT(l,d,f)}return e.someProp("transformPasted",d=>{l=d(l,e,a)}),l}const jZ=/^(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 MZ(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&&rL(a,i,l,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=sL(o[o.length-1],i.length));let c=nL(l,a);o.push(c),s=s.matchType(c.type),i=a}}),o)return J.from(o)}return e}function nL(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,J.from(e));return e}function rL(e,t,n,r,s){if(s<e.length&&s<t.length&&e[s]==t[s]){let i=rL(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(nL(n,e,s+1))))}}function sL(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,sL(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(J.empty,!0);return e.copy(n.append(r))}function Vw(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=Vw(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 WT(e,t,n){return t<e.openStart&&(e=new ue(Vw(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new ue(Vw(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const iL={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 KT=null;function oL(){return KT||(KT=document.implementation.createHTMLDocument("title"))}let Xx=null;function OZ(e){let t=window.trustedTypes;return t?(Xx||(Xx=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Xx.createHTML(e)):e}function PZ(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=oL().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),s;if((s=r&&iL[r[1].toLowerCase()])&&(e=s.map(i=>"<"+i+">").join("")+e+s.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=OZ(e),s)for(let i=0;i<s.length;i++)n=n.querySelector(s[i])||n;return n}function AZ(e){let t=e.querySelectorAll(rn?"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 _Z(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={},IZ={touchstart:!0,touchmove:!0};class DZ{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 LZ(e){for(let t in Hn){let n=Hn[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{zZ(e,r)&&!P1(e,r)&&(e.editable||!(r.type in Un))&&n(e,r)},IZ[t]?{passive:!0}:void 0)}mn&&e.dom.addEventListener("input",()=>null),Hw(e)}function So(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function $Z(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 Hw(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>P1(e,r))})}function P1(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function zZ(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 FZ(e,t){!P1(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,!aL(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Ei&&rn&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),Yu&&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,gl(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||RZ(e,n)?n.preventDefault():So(e,"key")};Un.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};Un.keypress=(e,t)=>{let n=t;if(aL(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||_r&&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 cy(e){return{left:e.clientX,top:e.clientY}}function BZ(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function A1(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 cu(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 VZ(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&Te.isSelectable(r)?(cu(e,new Te(n)),!0):!1}function HZ(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?(cu(e,Te.create(e.state.doc,s)),!0):!1}function UZ(e,t,n,r,s){return A1(e,"handleClickOn",t,n,r)||e.someProp("handleClick",i=>i(e,t,r))||(s?HZ(e,n):VZ(e,n))}function qZ(e,t,n,r){return A1(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",s=>s(e,t,r))}function WZ(e,t,n,r){return A1(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",s=>s(e,t,r))||KZ(e,n,r)}function KZ(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(cu(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)cu(e,_e.create(r,l+1,l+1+o.content.size));else if(Te.isSelectable(o))cu(e,Te.create(r,l));else continue;return!0}}function _1(e){return Mm(e)}const lL=_r?"metaKey":"ctrlKey";Hn.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=_1(e),s=Date.now(),i="singleClick";s-e.input.lastClick.time<500&&BZ(n,e.input.lastClick)&&!n[lL]&&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(cy(n));o&&(i=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new QZ(e,o,n,!!r)):(i=="doubleClick"?qZ:WZ)(e,o.pos,o.inside,n)?n.preventDefault():So(e,"pointer"))};class QZ{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[lL],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&&Vr&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),So(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(()=>Pi(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(cy(t))),this.updateAllowDefault(t),this.allowDefault||!n?So(this.view,"pointer"):UZ(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||mn&&this.mightDrag&&!this.mightDrag.node.isAtom||rn&&!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)?(cu(this.view,Pe.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):So(this.view,"pointer")}move(t){this.updateAllowDefault(t),So(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(),_1(e),So(e,"pointer")};Hn.touchmove=e=>{e.input.lastTouch=Date.now(),So(e,"pointer")};Hn.contextmenu=e=>_1(e);function aL(e,t){return e.composing?!0:mn&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const GZ=Ei?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)||rn&&zD&&JZ(e)))e.markCursor=e.state.storedMarks||n.marks(),Mm(e,!0),e.markCursor=null;else if(Mm(e,!t.selection.empty),Vr&&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}uL(e,GZ)};function JZ(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++,uL(e,20))};function uL(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Mm(e),t))}function cL(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=YZ());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function ZZ(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=HJ(t.focusNode,t.focusOffset),r=UJ(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 YZ(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function Mm(e,t=!1){if(!(Ei&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),cL(e),t||e.docView&&e.docView.dirty){let n=j1(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 XZ(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 of=sr&&Io<15||Yu&&QJ<604;Hn.copy=Un.cut=(e,t)=>{let n=t,r=e.state.selection,s=n.type=="cut";if(r.empty)return;let i=of?null:n.clipboardData,o=r.content(),{dom:l,text:a}=O1(e,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):XZ(e,l),s&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function eY(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function tY(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?lf(e,r.value,null,s,t):lf(e,r.textContent,r.innerHTML,s,t)},50)}function lf(e,t,n,r,s){let i=tL(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=eY(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 dL(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&&!Ei)return;let r=of?null:n.clipboardData,s=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&lf(e,dL(r),r.getData("text/html"),s,n)?n.preventDefault():tY(e,n)};class fL{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const nY=_r?"altKey":"ctrlKey";function hL(e,t){let n=e.someProp("dragCopies",r=>!r(t));return n??!t[nY]}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(cy(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}=O1(e,l);(!n.dataTransfer.files.length||!rn||$D>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(of?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",of||n.dataTransfer.setData("text/plain",u),e.dragging=new fL(c,hL(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{rY(e,t,e.dragging)}finally{e.dragging=null}};function rY(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(cy(t));if(!r)return;let s=e.state.doc.resolve(r.pos),i=n&&n.slice;i?e.someProp("transformPasted",h=>{i=h(i,e,!1)}):i=tL(e,dL(t.dataTransfer),of?null:t.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&hL(e,t));if(e.someProp("handleDrop",h=>h(e,t,i||ue.empty,o))){t.preventDefault();return}if(!i)return;t.preventDefault();let l=i?gD(e.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let a=e.state.tr;if(o){let{node:h}=n;h?h.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 f=a.doc.resolve(u);if(c&&Te.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new Te(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((m,g,v,x)=>h=x),a.setSelection(M1(e,f,a.doc.resolve(h)))}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())&&Pi(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(rn&&Ei&&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,gl(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 af(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||zl,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 $n(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&&af(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Lo{constructor(t,n){this.attrs=t,this.spec=n||zl}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 $n(i,o,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof Lo&&af(this.attrs,t.attrs)&&af(this.spec,t.spec)}static is(t){return t.type instanceof Lo}destroy(){}}class I1{constructor(t,n){this.attrs=t,this.spec=n||zl}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 $n(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 I1&&af(this.attrs,t.attrs)&&af(this.spec,t.spec)}destroy(){}}class $n{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new $n(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 $n(t,t,new Om(n,r))}static inline(t,n,r,s){return new $n(t,n,new Lo(r,s))}static node(t,n,r,s){return new $n(t,n,new I1(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Lo}get widget(){return this.type instanceof Om}}const $a=[],zl={};class Tt{constructor(t,n){this.local=t.length?t:$a,this.children=n.length?n:$a}static create(t,n){return n.length?Pm(n,t,0,zl):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||zl)}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?sY(this.children,o||[],t,n,r,s,i):o?new Tt(o.sort(Fl),$a):En}add(t,n){return n.length?this==En?Tt.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=mL(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,Pm(c,l,u+1,zl)),i+=3}});let o=pL(i?gL(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(t,o[l])||o.splice(l--,1);return new Tt(o.length?this.local.concat(o).sort(Fl):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 Tt(s,r):En}forChild(t,n){if(this==En)return this;if(n.isLeaf)return Tt.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 Lo){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 Tt(s.sort(Fl),$a);return r?new so([l,r]):l}return r||En}eq(t){if(this==t)return!0;if(!(t instanceof Tt)||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 D1(this.localsInner(t))}localsInner(t){if(this==En)return $a;if(t.inlineContent||!this.local.some(Lo.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Lo||n.push(this.local[r]);return n}forEachSet(t){t(this)}}Tt.empty=new Tt([],[]);Tt.removeOverlap=D1;const En=Tt.empty;class so{constructor(t){this.members=t}map(t,n){const r=this.members.map(s=>s.map(t,n,zl));return so.from(r)}forChild(t,n){if(n.isLeaf)return Tt.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(t,n);i!=En&&(i instanceof so?r=r.concat(i.members):r.push(i))}return so.from(r)}eq(t){if(!(t instanceof so)||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?D1(r?n:n.sort(Fl)):$a}static from(t){switch(t.length){case 0:return En;case 1:return t[0];default:return new so(t.every(n=>n instanceof Tt)?t:t.reduce((n,r)=>n.concat(r instanceof Tt?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function sY(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((f,h,m,g)=>{let v=g-m-(h-f);for(let x=0;x<l.length;x+=3){let w=l[x+1];if(w<0||f>w+c-d)continue;let b=l[x]+c-d;h>=b?l[x+1]=f<=b?-2:-1:f>=c&&v&&(l[x]+=v,l[x+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 f=n.map(e[u+1]+i,-1),h=f-s,{index:m,offset:g}=r.content.findIndex(d),v=r.maybeChild(m);if(v&&g==d&&g+v.nodeSize==h){let x=l[u+2].mapInner(n,v,c+1,e[u]+i+1,o);x!=En?(l[u]=d,l[u+1]=h,l[u+2]=x):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=iY(l,e,t,n,s,i,o),c=Pm(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,f=0;d<c.children.length;d+=3){let h=c.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,c.children[d],c.children[d+1],c.children[d+2])}}return new Tt(t.sort(Fl),l)}function pL(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 $n(s.from+t,s.to+t,s.type))}return n}function iY(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 mL(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 gL(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function Pm(e,t,n,r){let s=[],i=!1;t.forEach((l,a)=>{let u=mL(e,l,a+n);if(u){i=!0;let c=Pm(u,l,n+a+1,r);c!=En&&s.push(a,a+l.nodeSize,c)}});let o=pL(i?gL(e):e,-n).sort(Fl);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 Tt(o,s):En}function Fl(e,t){return e.from-t.from||e.to-t.to}function D1(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&&Fl(n,e[t])>0;)t++;e.splice(t,0,n)}function ev(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=En&&t.push(r)}),e.cursorWrapper&&t.push(Tt.create(e.state.doc,[e.cursorWrapper.deco])),so.from(t)}const oY={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lY=sr&&Io<=11;class aY{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 uY{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new aY,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&&Io<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():mn&&t.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),lY&&(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,oY)),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(FT(this.view)){if(this.suppressingSelectionUpdates)return Pi(this.view);if(sr&&Io<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&ta(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=Zu(i))n.add(i);for(let i=t.anchorNode;i;i=Zu(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)&&FT(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(Vr&&a.length){let c=a.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,f]=c;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of c){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||fY(t,d)!=h)&&f.remove()}}}else if((rn||mn)&&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&&ay(r)&&(u=j1(t))&&u.eq(Pe.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Pi(t),this.currentSelection.set(r),t.scrollToSelection()):(i>-1||s)&&(i>-1&&(t.docView.markDirty(i,o),cY(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,hY(t,a)),this.handleDOMChange(i,o,l,a),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||Pi(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&&Io<=11&&t.addedNodes.length)for(let c=0;c<t.addedNodes.length;c++){let{previousSibling:d,nextSibling:f}=t.addedNodes[c];(!d||Array.prototype.indexOf.call(t.addedNodes,d)<0)&&(s=d),(!f||Array.prototype.indexOf.call(t.addedNodes,f)<0)&&(i=f)}let o=s&&s.parentNode==t.target?dn(s)+1:0,l=r.localPosFromDOM(t.target,o,-1),a=i&&i.parentNode==t.target?dn(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 GT=new WeakMap,JT=!1;function cY(e){if(!GT.has(e)&&(GT.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Vr,JT)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."),JT=!0}}function ZT(e,t){let n=t.startContainer,r=t.startOffset,s=t.endContainer,i=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return ta(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function dY(e,t){if(t.getComposedRanges){let s=t.getComposedRanges(e.root)[0];if(s)return ZT(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?ZT(e,n):null}function fY(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 hY(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 pY(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}],ay(a)||u.push({node:a.focusNode,offset:a.focusOffset})),rn&&e.input.lastKeyCode===8)for(let v=i;v>s;v--){let x=r.childNodes[v-1],w=x.pmViewDesc;if(x.nodeName=="BR"&&!w){i=v;break}if(!w||w.size)break}let d=e.state.doc,f=e.someProp("domParser")||Mi.fromSchema(e.state.schema),h=d.resolve(o),m=null,g=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:s,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:mY,context:h});if(u&&u[0].pos!=null){let v=u[0].pos,x=u[1]&&u[1].pos;x==null&&(x=v),m={anchor:v+o,head:x+o}}return{doc:g,sel:m,from:o,to:l}}function mY(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(mn&&/^(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||mn&&/^(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 gY=/^(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 yY(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,T=j1(e,E);if(T&&!e.state.selection.eq(T)){if(rn&&Ei&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",N=>N(e,gl(13,"Enter"))))return;let O=e.state.tr.setSelection(T);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=pY(e,t,n),c=e.state.doc,d=c.slice(u.from,u.to),f,h;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,h="end"):(f=e.state.selection.from,h="start"),e.input.lastKeyCode=null;let m=wY(d.content,u.doc.content,u.from,f,h);if(m&&e.input.domChangeCount++,(Yu&&e.input.lastIOSEnter>Date.now()-225||Ei)&&s.some(E=>E.nodeType==1&&!gY.test(E.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",E=>E(e,gl(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=YT(e,e.state.doc,u.sel);if(E&&!E.eq(e.state.selection)){let T=e.state.tr.setSelection(E);i&&T.setMeta("composition",i),e.dispatch(T)}}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&&Io<=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),x=c.resolve(m.start),w=g.sameParent(v)&&g.parent.inlineContent&&x.end()>=m.endA;if((Yu&&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,gl(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&vY(c,m.start,m.endA,g,v)&&e.someProp("handleKeyDown",E=>E(e,gl(8,"Backspace")))){Ei&&rn&&e.domObserver.suppressSelectionUpdates();return}rn&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),Ei&&!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,gl(13,"Enter"))})},20));let b=m.start,C=m.endA,S=E=>{let T=E||e.state.tr.replace(b,C,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let O=YT(e,T.doc,u.sel);O&&!(rn&&e.composing&&O.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(O.head==b||O.head==T.mapping.map(C)-1)||sr&&O.empty&&O.head==b)&&T.setSelection(O)}return i&&T.setMeta("composition",i),T.scrollIntoView()},k;if(w)if(g.pos==v.pos){sr&&Io<=11&&g.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Pi(e),20));let E=S(e.state.tr.delete(b,C)),T=c.resolve(m.start).marksAcross(c.resolve(m.endA));T&&E.ensureMarks(T),e.dispatch(E)}else if(m.endA==m.endB&&(k=xY(g.parent.content.cut(g.parentOffset,v.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.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),T=()=>S(e.state.tr.insertText(E,b,C));e.someProp("handleTextInput",O=>O(e,b,C,E,T))||e.dispatch(T())}else e.dispatch(S());else e.dispatch(S())}function YT(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:M1(e,t.resolve(n.anchor),t.resolve(n.head))}function xY(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 vY(e,t,n,r,s){if(n-t<=s.pos-r.pos||tv(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(tv(i,!0,!0));return!o.parent.isTextblock||o.pos>n||tv(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function tv(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 wY(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&&XT(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&&XT(e.textBetween(i-1,i+1))&&(i+=a?1:-1),o=i+(o-l),l=i}return{start:i,endA:o,endB:l}}function XT(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 yL{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 DZ,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(sR),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=nR(this),tR(this),this.nodeViews=rR(this),this.docView=_T(this.state.doc,eR(this),ev(this),this.dom,this),this.domObserver=new uY(this,(r,s,i,o)=>yY(this,r,s,i,o)),this.domObserver.start(),LZ(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&&Hw(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(sR),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&&(cL(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 h=rR(this);kY(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Hw(this),this.editable=nR(this),tR(this);let a=ev(this),u=eR(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 f=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&ZJ(this);if(o){this.domObserver.stop();let h=d&&(sr||rn)&&!this.composing&&!s.selection.empty&&!t.selection.empty&&bY(s.selection,t.selection);if(d){let m=rn?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=_T(t.doc,u,a,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&bZ(this))?Pi(this,h):(YD(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():f&&YJ(f)}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&&RT(this,n.getBoundingClientRect(),t)}else RT(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 fL(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&&XJ(this.dom),Pi(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 sZ(this,t)}coordsAtPos(t,n=1){return UD(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 uZ(this,n||this.state,t)}pasteHTML(t,n){return lf(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return lf(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return O1(this,t)}destroy(){this.docView&&($Z(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ev(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,BJ())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return FZ(this,t)}domSelectionRange(){let t=this.domSelection();return t?mn&&this.root.nodeType===11&&WJ(this.dom.ownerDocument)==this.dom&&dY(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}yL.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function eR(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"),[$n.node(0,e.state.doc.content.size,t)]}function tR(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:$n.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function nR(e){return!e.someProp("editable",t=>t(e.state)===!1)}function bY(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 rR(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 kY(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 sR(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 Go={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:"'"},Am={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},SY=typeof navigator<"u"&&/Mac/.test(navigator.platform),CY=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var fn=0;fn<10;fn++)Go[48+fn]=Go[96+fn]=String(fn);for(var fn=1;fn<=24;fn++)Go[fn+111]="F"+fn;for(var fn=65;fn<=90;fn++)Go[fn]=String.fromCharCode(fn+32),Am[fn]=String.fromCharCode(fn);for(var nv in Go)Am.hasOwnProperty(nv)||(Am[nv]=Go[nv]);function EY(e){var t=SY&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||CY&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Am:Go)[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 NY=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),TY=typeof navigator<"u"&&/Win/.test(navigator.platform);function RY(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))NY?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 jY(e){let t=Object.create(null);for(let n in e)t[RY(n)]=e[n];return t}function rv(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 MY(e){return new wt({props:{handleKeyDown:L1(e)}})}function L1(e){let t=jY(e);return function(n,r){let s=EY(r),i,o=t[rv(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=t[rv(s,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(TY&&r.ctrlKey&&r.altKey)&&(i=Go[r.keyCode])&&i!=s){let l=t[rv(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var OY=Object.defineProperty,$1=(e,t)=>{for(var n in t)OY(e,n,{get:t[n],enumerable:!0})};function dy(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 fy=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,f])=>[d,(...m)=>{const g=this.buildProps(a,t),v=f(...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:dy({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}},Xr={};$1(Xr,{blur:()=>PY,clearContent:()=>AY,clearNodes:()=>_Y,command:()=>IY,createParagraphNear:()=>DY,cut:()=>LY,deleteCurrentNode:()=>$Y,deleteNode:()=>zY,deleteRange:()=>FY,deleteSelection:()=>BY,enter:()=>VY,exitCode:()=>HY,extendMarkRange:()=>UY,first:()=>qY,focus:()=>KY,forEach:()=>QY,insertContent:()=>GY,insertContentAt:()=>YY,joinBackward:()=>tX,joinDown:()=>eX,joinForward:()=>nX,joinItemBackward:()=>rX,joinItemForward:()=>sX,joinTextblockBackward:()=>iX,joinTextblockForward:()=>oX,joinUp:()=>XY,keyboardShortcut:()=>aX,lift:()=>uX,liftEmptyBlock:()=>cX,liftListItem:()=>dX,newlineInCode:()=>fX,resetAttributes:()=>hX,scrollIntoView:()=>pX,selectAll:()=>mX,selectNodeBackward:()=>gX,selectNodeForward:()=>yX,selectParentNode:()=>xX,selectTextblockEnd:()=>vX,selectTextblockStart:()=>wX,setContent:()=>bX,setMark:()=>BX,setMeta:()=>VX,setNode:()=>HX,setNodeSelection:()=>UX,setTextDirection:()=>qX,setTextSelection:()=>WX,sinkListItem:()=>KX,splitBlock:()=>QX,splitListItem:()=>GX,toggleList:()=>JX,toggleMark:()=>ZX,toggleNode:()=>YX,toggleWrap:()=>XX,undoInputRule:()=>eee,unsetAllMarks:()=>tee,unsetMark:()=>nee,unsetTextDirection:()=>ree,updateAttributes:()=>see,wrapIn:()=>iee,wrapInList:()=>oee});var PY=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),AY=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),_Y=()=>({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)),f=u.resolve(c.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;const m=hc(h);if(l.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());t.setNodeMarkup(h.start,g)}(m||m===0)&&t.lift(h,m)})}),!0},IY=e=>t=>e(t),DY=()=>({state:e,dispatch:t})=>AD(e,t),LY=(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},$Y=()=>({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 Ht(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 zY=e=>({tr:t,state:n,dispatch:r})=>{const s=Ht(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},FY=e=>({tr:t,dispatch:n})=>{const{from:r,to:s}=e;return n&&t.delete(r,s),!0},BY=()=>({state:e,dispatch:t})=>S1(e,t),VY=()=>({commands:e})=>e.keyboardShortcut("Enter"),HY=()=>({state:e,dispatch:t})=>NJ(e,t);function z1(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function _m(e,t,n={strict:!0}){const r=Object.keys(t);return r.length?r.every(s=>n.strict?t[s]===e[s]:z1(t[s])?t[s].test(e[s]):t[s]===e[s]):!0}function xL(e,t,n={}){return e.find(r=>r.type===t&&_m(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function iR(e,t,n={}){return!!xL(e,t,n)}function F1(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),!xL([...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&&iR([...e.parent.child(o-1).marks],t,n);)o-=1,l-=e.parent.child(o).nodeSize;for(;a<e.parent.childCount&&iR([...e.parent.child(a).marks],t,n);)u+=e.parent.child(a).nodeSize,a+=1;return{from:l,to:u}}function Bi(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 UY=(e,t={})=>({tr:n,state:r,dispatch:s})=>{const i=Bi(e,r.schema),{doc:o,selection:l}=n,{$from:a,from:u,to:c}=l;if(s){const d=F1(a,i,t);if(d&&d.from<=u&&d.to>=c){const f=_e.create(o,d.from,d.to);n.setSelection(f)}}return!0},qY=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 B1(e){return e instanceof _e}function Ni(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function vL(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,Ni(0,s,i),Ni(e.content.size,s,i)):_e.create(e,Ni(t,s,i),Ni(t,s,i))}function oR(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Im(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function WY(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var KY=(e=null,t={})=>({editor:n,view:r,tr:s,dispatch:i})=>{t={scrollIntoView:!0,...t};const o=()=>{(Im()||oR())&&r.dom.focus(),WY()&&!Im()&&!oR()&&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&&!B1(n.state.selection))return o(),!0;const l=vL(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},QY=(e,t)=>n=>e.every((r,s)=>t(r,{...n,index:s})),GY=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),wL=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&&wL(r)}return e};function Jc(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 wL(n)}function uf(e,t,n){if(e instanceof _o||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),uf("",t,n)}if(s){if(n.errorOnInvalidContent){let o=!1,l="";const a=new iD({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?Mi.fromSchema(a).parseSlice(Jc(e),n.parseOptions):Mi.fromSchema(a).parse(Jc(e),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=Mi.fromSchema(t);return n.slice?i.parseSlice(Jc(e),n.parseOptions).content:i.parse(Jc(e),n.parseOptions)}return uf("",t,n)}function JY(e,t,n){const r=e.steps.length-1;if(r<t)return;const s=e.steps[r];if(!(s instanceof nn||s instanceof on))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),YY=(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{uf(t,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(v){a(v)}try{l=uf(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},f=!0,h=!0;if((ZY(l)?l:[l]).forEach(v=>{v.check(),f=f?v.isText&&v.marks.length===0:!1,h=h?v.isBlock:!1}),c===d&&h){const{parent:v}=r.doc.resolve(c);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(c-=1,d+=1)}let g;if(f){if(Array.isArray(t))g=t.map(v=>v.text||"").join("");else if(t instanceof J){let v="";t.forEach(x=>{x.text&&(v+=x.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),x=v.node(),w=v.parentOffset===0,b=x.isText||x.isTextblock,C=x.content.size>0;w&&b&&C&&(c=Math.max(0,c-1)),r.replaceWith(c,d,g)}n.updateSelection&&JY(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},XY=()=>({state:e,dispatch:t})=>SJ(e,t),eX=()=>({state:e,dispatch:t})=>CJ(e,t),tX=()=>({state:e,dispatch:t})=>ND(e,t),nX=()=>({state:e,dispatch:t})=>MD(e,t),rX=()=>({state:e,dispatch:t,tr:n})=>{try{const r=iy(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},sX=()=>({state:e,dispatch:t,tr:n})=>{try{const r=iy(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},iX=()=>({state:e,dispatch:t})=>bJ(e,t),oX=()=>({state:e,dispatch:t})=>kJ(e,t);function bL(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function lX(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))Im()||bL()?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 aX=e=>({editor:t,view:n,tr:r,dispatch:s})=>{const i=lX(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 Jo(e,t,n={}){const{from:r,to:s,empty:i}=e.selection,o=t?Ht(t,e.schema):null,l=[];e.doc.nodesBetween(r,s,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),m=Math.min(s,f+d.nodeSize);l.push({node:d,from:h,to:m})});const a=s-r,u=l.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>_m(d.node.attrs,n,{strict:!1}));return i?!!u.length:u.reduce((d,f)=>d+f.to-f.from,0)>=a}var uX=(e,t={})=>({state:n,dispatch:r})=>{const s=Ht(e,n.schema);return Jo(n,s,t)?EJ(n,r):!1},cX=()=>({state:e,dispatch:t})=>_D(e,t),dX=e=>({state:t,dispatch:n})=>{const r=Ht(e,t.schema);return LJ(r)(t,n)},fX=()=>({state:e,dispatch:t})=>PD(e,t);function hy(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function lR(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 hX=(e,t)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const l=hy(typeof e=="string"?e:e.name,r.schema);if(!l)return!1;l==="node"&&(i=Ht(e,r.schema)),l==="mark"&&(o=Bi(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,lR(c.attrs,t))),o&&c.marks.length&&c.marks.forEach(f=>{o===f.type&&(a=!0,s&&n.addMark(d,d+c.nodeSize,o.create(lR(f.attrs,t))))})})}),a},pX=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),mX=()=>({tr:e,dispatch:t})=>{if(t){const n=new xr(e.doc);e.setSelection(n)}return!0},gX=()=>({state:e,dispatch:t})=>RD(e,t),yX=()=>({state:e,dispatch:t})=>OD(e,t),xX=()=>({state:e,dispatch:t})=>jJ(e,t),vX=()=>({state:e,dispatch:t})=>PJ(e,t),wX=()=>({state:e,dispatch:t})=>OJ(e,t);function Uw(e,t,n={},r={}){return uf(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var bX=(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=Uw(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 kL(e,t){const n=Bi(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 SL(e,t){const n=new bD(e);return t.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function kX(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 SX(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function CX(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 py(e){return t=>CX(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 my(e){return e.map(t=>{const n={name:t.name,options:t.options,storage:t.storage},r=ke(t,"addExtensions",n);return r?[t,...my(r())]:t}).flat(10)}function V1(e,t){const n=ha.fromSchema(t).serializeFragment(e),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function CL(e){return typeof e=="function"}function lt(e,t=void 0,...n){return CL(e)?t?e.bind(t)(...n):e(...n):e}function EX(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Xu(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 EL(e){const t=[],{nodeExtensions:n,markExtensions:r}=Xu(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(([f,h])=>{t.push({type:d,name:f,attribute:{...i,...h}})})})})}),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 f={...i,...d};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,t.push({type:o.name,name:c,attribute:f})})}),t}function Ut(...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,f]=c.split(":").map(h=>h.trim());u.set(d,f)}),l.forEach(c=>{const[d,f]=c.split(":").map(h=>h.trim());u.set(d,f)}),r[s]=Array.from(u.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else r[s]=i}),r},{})}function cf(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)=>Ut(n,r),{})}function NX(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function aR(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):NX(n.getAttribute(o.name));return l==null?i:{...i,[o.name]:l}},{});return{...r,...s}}}}function uR(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&EX(n)?!1:n!=null))}function cR(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 NL(e,t){var n;const r=EL(e),{nodeExtensions:s,markExtensions:i}=Xu(e),o=(n=s.find(u=>ke(u,"topNode")))==null?void 0:n.name,l=Object.fromEntries(s.map(u=>{const c=r.filter(x=>x.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:t},f=e.reduce((x,w)=>{const b=ke(w,"extendNodeSchema",d);return{...x,...b?b(u):{}}},{}),h=uR({...f,content:lt(ke(u,"content",d)),marks:lt(ke(u,"marks",d)),group:lt(ke(u,"group",d)),inline:lt(ke(u,"inline",d)),atom:lt(ke(u,"atom",d)),selectable:lt(ke(u,"selectable",d)),draggable:lt(ke(u,"draggable",d)),code:lt(ke(u,"code",d)),whitespace:lt(ke(u,"whitespace",d)),linebreakReplacement:lt(ke(u,"linebreakReplacement",d)),defining:lt(ke(u,"defining",d)),isolating:lt(ke(u,"isolating",d)),attrs:Object.fromEntries(c.map(cR))}),m=lt(ke(u,"parseHTML",d));m&&(h.parseDOM=m.map(x=>aR(x,c)));const g=ke(u,"renderHTML",d);g&&(h.toDOM=x=>g({node:x,HTMLAttributes:cf(x,c)}));const v=ke(u,"renderText",d);return v&&(h.toText=v),[u.name,h]})),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},f=e.reduce((v,x)=>{const w=ke(x,"extendMarkSchema",d);return{...v,...w?w(u):{}}},{}),h=uR({...f,inclusive:lt(ke(u,"inclusive",d)),excludes:lt(ke(u,"excludes",d)),group:lt(ke(u,"group",d)),spanning:lt(ke(u,"spanning",d)),code:lt(ke(u,"code",d)),attrs:Object.fromEntries(c.map(cR))}),m=lt(ke(u,"parseHTML",d));m&&(h.parseDOM=m.map(v=>aR(v,c)));const g=ke(u,"renderHTML",d);return g&&(h.toDOM=v=>g({mark:v,HTMLAttributes:cf(v,c)})),[u.name,h]}));return new iD({topNode:o,nodes:l,marks:a})}function TX(e){const t=e.filter((n,r)=>e.indexOf(n)!==r);return Array.from(new Set(t))}function Dm(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 H1(e){const t=Dm(my(e)),n=TX(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 RX(e,t){const n=H1(e);return NL(n,t)}function jX(e,t){const n=RX(t),r=Jc(e);return Mi.fromSchema(n).parse(r).toJSON()}function TL(e,t,n){const{from:r,to:s}=t,{blockSeparator:i=`
|
|
501
|
+
|
|
502
|
+
`,textSerializers:o={}}=n||{};let l="";return e.nodesBetween(r,s,(a,u,c,d)=>{var f;a.isBlock&&u>r&&(l+=i);const h=o==null?void 0:o[a.type.name];if(h)return c&&(l+=h({node:a,pos:u,parent:c,index:d,range:t})),!1;a.isText&&(l+=(f=a==null?void 0:a.text)==null?void 0:f.slice(Math.max(r,u)-u,s-u))}),l}function RL(e,t){const n={from:0,to:e.content.size};return TL(e,n,t)}function U1(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}function MX(e,t){const n=Ht(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 jL(e,t){const n=hy(typeof t=="string"?t:t.name,e.schema);return n==="node"?MX(e,t):n==="mark"?kL(e,t):{}}function OX(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 PX(e){const t=OX(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 ML(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),f=t.invert().map(c);r.push({oldRange:{from:d,to:f},newRange:{from:u,to:c}})})}),PX(r)}function q1(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(s=>{const i=n.resolve(e),o=F1(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 AX=(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 Ah(e,t){return t.nodes[e]||t.marks[e]||null}function kp(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 _X=(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 qw(e,t,n={}){const{empty:r,ranges:s}=e.selection,i=t?Bi(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>_m(d.attrs,n,{strict:!1}));let o=0;const l=[];if(s.forEach(({$from:d,$to:f})=>{const h=d.pos,m=f.pos;e.doc.nodesBetween(h,m,(g,v)=>{if(!g.isText&&!g.marks.length)return;const x=Math.max(h,v),w=Math.min(m,v+g.nodeSize),b=w-x;o+=b,l.push(...g.marks.map(C=>({mark:C,from:x,to:w})))})}),o===0)return!1;const a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>_m(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),u=l.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+u:a)>=o}function IX(e,t,n={}){if(!t)return Jo(e,null,n)||qw(e,null,n);const r=hy(t,e.schema);return r==="node"?Jo(e,t,n):r==="mark"?qw(e,t,n):!1}var DX=(e,t)=>{const{$from:n,$to:r,$anchor:s}=e.selection;if(t){const i=py(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)},LX=e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function dR(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function fR(e,t){const{nodeExtensions:n}=Xu(t),r=n.find(o=>o.name===e);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=lt(ke(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function gy(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&&(gy(i,{ignoreWhitespace:n,checkChildren:t})||(s=!1))}),s}return!1}function OL(e){return e instanceof Te}var PL=class AL{constructor(t){this.position=t}static fromJSON(t){return new AL(t.position)}toJSON(){return{position:this.position}}};function $X(e,t){const n=t.mapping.mapResult(e.position);return{position:new PL(n.pos),mapResult:n}}function zX(e){return new PL(e)}function _L(e,t,n){const s=e.state.doc.content.size,i=Ni(t,0,s),o=Ni(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),f=Math.max(l.right,a.right),h=f-d,m=c-u,x={top:u,bottom:c,left:d,right:f,width:h,height:m,x:d,y:u};return{...x,toJSON:()=>x}}function FX(e,t,n){var r;const{selection:s}=t;let i=null;if(B1(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,f)=>{if(u)return!1;if(c.isInline){const h=!f||f.type.allowsMarkType(n),m=!!n.isInSet(c.marks)||!c.marks.some(g=>g.type.excludes(n));u=h&&m}return!u}),u})}var BX=(e,t={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:l}=i,a=Bi(e,r.schema);if(s)if(o){const u=kL(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,(f,h)=>{const m=Math.max(h,c),g=Math.min(h+f.nodeSize,d);f.marks.find(x=>x.type===a)?f.marks.forEach(x=>{a===x.type&&n.addMark(m,g,a.create({...x.attrs,...t}))}):n.addMark(m,g,a.create(t))})});return FX(r,n,a)},VX=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),HX=(e,t={})=>({state:n,dispatch:r,chain:s})=>{const i=Ht(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})=>ET(i,{...o,...t})(n)?!0:l.clearNodes()).command(({state:l})=>ET(i,{...o,...t})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},UX=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,s=Ni(e,0,r.content.size),i=Te.create(r,s);t.setSelection(i)}return!0},qX=(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},WX=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=Ni(s,o,l),u=Ni(i,o,l),c=_e.create(r,a,u);t.setSelection(c)}return!0},KX=e=>({state:t,dispatch:n})=>{const r=Ht(e,t.schema);return FJ(r)(t,n)};function hR(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 QX=({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=kp(u,l.node().type.name,l.node().attrs);if(i instanceof Te&&i.node.isBlock)return!l.parentOffset||!Oi(o,l.pos)?!1:(r&&(e&&hR(n,s.extensionManager.splittableMarks),t.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:kX(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:c}]:void 0,m=Oi(t.doc,t.mapping.map(l.pos),1,h);if(!h&&!m&&Oi(t.doc,t.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(m=!0,h=f?[{type:f,attrs:c}]:void 0),r){if(m&&(i instanceof _e&&t.deleteSelection(),t.split(t.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const g=t.mapping.map(l.before()),v=t.doc.resolve(g);l.node(-1).canReplaceWith(v.index(),v.index()+1,f)&&t.setNodeMarkup(t.mapping.map(l.before()),f)}e&&hR(n,s.extensionManager.splittableMarks),t.scrollIntoView()}return m},GX=(e,t={})=>({tr:n,state:r,dispatch:s,editor:i})=>{var o;const l=Ht(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 f=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 x=J.empty;const w=a.index(-1)?1:a.index(-2)?2:3;for(let T=a.depth-w;T>=a.depth-3;T-=1)x=J.from(a.node(T).copy(x));const b=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,C={...kp(f,a.node().type.name,a.node().attrs),...t},S=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(C))||void 0;x=x.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(x,4-w,0));let E=-1;n.doc.nodesBetween(k,n.doc.content.size,(T,O)=>{if(E>-1)return!1;T.isTextblock&&T.content.size===0&&(E=O+1)}),E>-1&&n.setSelection(_e.near(n.doc.resolve(E))),n.scrollIntoView()}return!0}const h=u.pos===a.end()?d.contentMatchAt(0).defaultType:null,m={...kp(f,d.type.name,d.attrs),...t},g={...kp(f,a.node().type.name,a.node().attrs),...t};n.delete(a.pos,u.pos);const v=h?[{type:l,attrs:m},{type:h,attrs:g}]:[{type:l,attrs:m}];if(!Oi(n.doc,a.pos,2))return!1;if(s){const{selection:x,storedMarks:w}=r,{splittableMarks:b}=i.extensionManager,C=w||x.$to.parentOffset&&x.$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},sv=(e,t)=>{const n=py(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},iv=(e,t)=>{const n=py(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},JX=(e,t,n,r={})=>({editor:s,tr:i,state:o,dispatch:l,chain:a,commands:u,can:c})=>{const{extensions:d,splittableMarks:f}=s.extensionManager,h=Ht(e,o.schema),m=Ht(t,o.schema),{selection:g,storedMarks:v}=o,{$from:x,$to:w}=g,b=x.blockRange(w),C=v||g.$to.parentOffset&&g.$from.marks();if(!b)return!1;const S=py(k=>fR(k.type.name,d))(g);if(b.depth>=1&&S&&b.depth-S.depth<=1){if(S.node.type===h)return u.liftListItem(m);if(fR(S.node.type.name,d)&&h.validContent(S.node.content)&&l)return a().command(()=>(i.setNodeMarkup(S.pos,h),!0)).command(()=>sv(i,h)).command(()=>iv(i,h)).run()}return!n||!C||!l?a().command(()=>c().wrapInList(h,r)?!0:u.clearNodes()).wrapInList(h,r).command(()=>sv(i,h)).command(()=>iv(i,h)).run():a().command(()=>{const k=c().wrapInList(h,r),E=C.filter(T=>f.includes(T.type.name));return i.ensureMarks(E),k?!0:u.clearNodes()}).wrapInList(h,r).command(()=>sv(i,h)).command(()=>iv(i,h)).run()},ZX=(e,t={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=Bi(e,r.schema);return qw(r,o,t)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,t)},YX=(e,t,n={})=>({state:r,commands:s})=>{const i=Ht(e,r.schema),o=Ht(t,r.schema),l=Jo(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})},XX=(e,t={})=>({state:n,commands:r})=>{const s=Ht(e,n.schema);return Jo(n,s,t)?r.lift(s):r.wrapIn(s,t)},eee=()=>({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},tee=()=>({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},nee=(e,t={})=>({tr:n,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=t,{selection:l}=n,a=Bi(e,r.schema),{$from:u,empty:c,ranges:d}=l;if(!s)return!0;if(c&&o){let{from:f,to:h}=l;const m=(i=u.marks().find(v=>v.type===a))==null?void 0:i.attrs,g=F1(u,a,m);g&&(f=g.from,h=g.to),n.removeMark(f,h,a)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,a)});return n.removeStoredMark(a),!0},ree=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},see=(e,t={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const l=hy(typeof e=="string"?e:e.name,r.schema);if(!l)return!1;l==="node"&&(i=Ht(e,r.schema)),l==="mark"&&(o=Bi(e,r.schema));let a=!1;return n.selection.ranges.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;let f,h,m,g;n.selection.empty?r.doc.nodesBetween(c,d,(v,x)=>{i&&i===v.type&&(a=!0,m=Math.max(x,c),g=Math.min(x+v.nodeSize,d),f=x,h=v)}):r.doc.nodesBetween(c,d,(v,x)=>{x<c&&i&&i===v.type&&(a=!0,m=Math.max(x,c),g=Math.min(x+v.nodeSize,d),f=x,h=v),x>=c&&x<=d&&(i&&i===v.type&&(a=!0,s&&n.setNodeMarkup(x,void 0,{...v.attrs,...t})),o&&v.marks.length&&v.marks.forEach(w=>{if(o===w.type&&(a=!0,s)){const b=Math.max(x,c),C=Math.min(x+v.nodeSize,d);n.addMark(b,C,o.create({...w.attrs,...t}))}}))}),h&&(f!==void 0&&s&&n.setNodeMarkup(f,void 0,{...h.attrs,...t}),o&&h.marks.length&&h.marks.forEach(v=>{o===v.type&&s&&n.addMark(m,g,o.create({...v.attrs,...t}))}))}),a},iee=(e,t={})=>({state:n,dispatch:r})=>{const s=Ht(e,n.schema);return AJ(s,t)(n,r)},oee=(e,t={})=>({state:n,dispatch:r})=>{const s=Ht(e,n.schema);return _J(s,t)(n,r)},lee=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={}}},yy=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=(t=e.undoable)!=null?t:!0}},aee=(e,t)=>{if(z1(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 _h(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(f=>f.type.spec.code))return!1;let c=!1;const d=_X(u)+i;return o.forEach(f=>{if(c)return;const h=aee(d,f.find);if(!h)return;const m=a.state.tr,g=dy({state:a.state,transaction:m}),v={from:r-(h[0].length-i.length),to:s},{commands:x,chain:w,can:b}=new fy({editor:n,state:g});f.handler({state:g,range:v,match:h,commands:x,chain:w,can:b})===null||!m.steps.length||(f.undoable&&m.setMeta(l,{transform:m,from:r,to:s,text:i}),a.dispatch(m),c=!0)}),c}function uee(e){const{editor:t,rules:n}=e,r=new wt({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=V1(J.from(c),o.schema);const{from:d}=a,f=d+c.length;_h({editor:t,from:d,to:f,text:c,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,l){return _h({editor:t,from:i,to:o,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&_h({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?_h({editor:t,from:o.pos,to:o.pos,text:`
|
|
503
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function cee(e){return Object.prototype.toString.call(e).slice(8,-1)}function Ih(e){return cee(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function IL(e,t){const n={...e};return Ih(e)&&Ih(t)&&Object.keys(t).forEach(r=>{Ih(t[r])&&Ih(e[r])?n[r]=IL(e[r],t[r]):n[r]=t[r]}),n}var W1=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{...lt(ke(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...lt(ke(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>IL(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}},pa=class DL extends W1{constructor(){super(...arguments),this.type="mark"}static create(t={}){const n=typeof t=="function"?t():t;return new DL(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 dee(e){return typeof e=="number"}var fee=class{constructor(e){this.find=e.find,this.handler=e.handler}},hee=(e,t,n)=>{if(z1(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 pee(e){const{editor:t,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:l}=e,{commands:a,chain:u,can:c}=new fy({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,s,(h,m)=>{var g,v,x,w,b;if((v=(g=h.type)==null?void 0:g.spec)!=null&&v.code||!(h.isText||h.isTextblock||h.isInline))return;const C=(b=(w=(x=h.content)==null?void 0:x.size)!=null?w:h.nodeSize)!=null?b:0,S=Math.max(r,m),k=Math.min(s,m+C);if(S>=k)return;const E=h.isText?h.text||"":h.textBetween(S-m,k-m,void 0,"");hee(E,i.find,o).forEach(O=>{if(O.index===void 0)return;const N=S+O.index+1,j=N+O[0].length,P={from:n.tr.mapping.map(N),to:n.tr.mapping.map(j)},z=i.handler({state:n,range:P,match:O,commands:a,chain:u,can:c,pasteEvent:o,dropEvent:l});d.push(z)})}),d.every(h=>h!==null)}var Dh=null,mee=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData("text/html",e),n};function gee(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:f,rule:h,pasteEvt:m})=>{const g=c.tr,v=dy({state:c,transaction:g});if(!(!pee({editor:t,state:v,from:Math.max(d-1,0),to:f.b-1,rule:h,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 wt({view(d){const f=m=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(m.target)?d.dom.parentElement:null,r&&(Dh=t)},h=()=>{Dh&&(Dh=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,l=f,!i){const h=Dh;h!=null&&h.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(d,f)=>{var h;const m=(h=f.clipboardData)==null?void 0:h.getData("text/html");return o=f,s=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(d,f,h)=>{const m=d[0],g=m.getMeta("uiEvent")==="paste"&&!s,v=m.getMeta("uiEvent")==="drop"&&!i,x=m.getMeta("applyPasteRules"),w=!!x;if(!g&&!v&&!w)return;if(w){let{text:S}=x;typeof S=="string"?S=S:S=V1(J.from(S),h.schema);const{from:k}=x,E=k+S.length,T=mee(S);return a({rule:c,state:h,from:k,to:{b:E},pasteEvt:T})}const b=f.doc.content.findDiffStart(h.doc.content),C=f.doc.content.findDiffEnd(h.doc.content);if(!(!dee(b)||!C||b===C.b))return a({rule:c,state:h,from:b,to:C,pasteEvt:o})}}))}var xy=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=H1(e),this.schema=NL(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:Ah(t.name,this.schema)},r=ke(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){const{editor:e}=this;return Dm([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Ah(r.name,this.schema)},i=[],o=ke(r,"addKeyboardShortcuts",s);let l={};if(r.type==="mark"&&ke(r,"exitable",s)&&(l.ArrowRight=()=>pa.handleExit({editor:e,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([h,m])=>[h,()=>m({editor:e})]));l={...l,...f}}const a=MY(l);i.push(a);const u=ke(r,"addInputRules",s);if(dR(r,e.options.enableInputRules)&&u){const f=u();if(f&&f.length){const h=uee({editor:e,rules:f}),m=Array.isArray(h)?h:[h];i.push(...m)}}const c=ke(r,"addPasteRules",s);if(dR(r,e.options.enablePasteRules)&&c){const f=c();if(f&&f.length){const h=gee({editor:e,rules:f});i.push(...h)}}const d=ke(r,"addProseMirrorPlugins",s);if(d){const f=d();i.push(...f)}return i})}get attributes(){return EL(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Xu(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:Ht(n.name,this.schema)},i=ke(n,"addNodeView",s);if(!i)return[];const o=i();if(!o)return[];const l=(a,u,c,d,f)=>{const h=cf(a,r);return o({node:a,view:u,getPos:c,decorations:d,innerDecorations:f,editor:e,extension:n,HTMLAttributes:h})};return[n.name,l]}))}dispatchTransaction(e){const{editor:t}=this;return Dm([...this.extensions].reverse()).reduceRight((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:t,type:Ah(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}=Xu(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:Bi(n.name,this.schema)},i=ke(n,"addMarkView",s);if(!i)return[];const o=(l,a,u)=>{const c=cf(l,r);return i()({mark:l,view:a,inline:u,editor:e,extension:n,HTMLAttributes:c,updateAttributes:d=>{Mee(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:Ah(t.name,this.schema)};t.type==="mark"&&((n=lt(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)})}};xy.resolve=H1;xy.sort=Dm;xy.flatten=my;var yee={};$1(yee,{ClipboardTextSerializer:()=>$L,Commands:()=>zL,Delete:()=>FL,Drop:()=>BL,Editable:()=>VL,FocusEvents:()=>UL,Keymap:()=>qL,Paste:()=>WL,Tabindex:()=>KL,TextDirection:()=>QL,focusEventsPluginKey:()=>HL});var Et=class LL extends W1{constructor(){super(...arguments),this.type="extension"}static create(t={}){const n=typeof t=="function"?t():t;return new LL(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}},$L=Et.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new wt({key:new Ct("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=U1(n);return TL(r,{from:o,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),zL=Et.create({name:"commands",addCommands(){return{...Xr}}}),FL=Et.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=SL(e.before,[e,...t]);ML(c).forEach(h=>{c.mapping.mapResult(h.oldRange.from).deletedAfter&&c.mapping.mapResult(h.oldRange.to).deletedBefore&&c.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,g)=>{const v=g+m.nodeSize-2,x=h.oldRange.from<=g&&v<=h.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:h.oldRange,newRange:h.newRange,partial:!x,editor:this.editor,transaction:e,combinedTransform:c})})});const f=c.mapping;c.steps.forEach((h,m)=>{var g,v;if(h instanceof ds){const x=f.slice(m).map(h.from,-1),w=f.slice(m).map(h.to),b=f.invert().map(x,-1),C=f.invert().map(w),S=(g=c.doc.nodeAt(x-1))==null?void 0:g.marks.some(E=>E.eq(h.mark)),k=(v=c.doc.nodeAt(w))==null?void 0:v.marks.some(E=>E.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:b,to:C},newRange:{from:x,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()}}),BL=Et.create({name:"drop",addProseMirrorPlugins(){return[new wt({key:new Ct("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),VL=Et.create({name:"editable",addProseMirrorPlugins(){return[new wt({key:new Ct("editable"),props:{editable:()=>this.editor.options.editable}})]}}),HL=new Ct("focusEvents"),UL=Et.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new wt({key:HL,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}}}})]}}),qL=Et.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:f,parent:h}=d,m=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,g=m.parent.type.spec.isolating,v=d.pos-d.parentOffset,x=g&&m.parent.childCount===1?v===d.pos:Pe.atStart(u).from===f;return!c||!h.type.isTextblock||h.textContent.length||!x||x&&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 Im()||bL()?i:s},addProseMirrorPlugins(){return[new wt({key:new Ct("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)||!gy(n.doc))return;const f=n.tr,h=dy({state:n,transaction:f}),{commands:m}=new fy({editor:this.editor,state:h});if(m.clearNodes(),!!f.steps.length)return f}})]}}),WL=Et.create({name:"paste",addProseMirrorPlugins(){return[new wt({key:new Ct("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),KL=Et.create({name:"tabindex",addProseMirrorPlugins(){return[new wt({key:new Ct("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),QL=Et.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=Xu(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 wt({key:new Ct("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),xee=class Zc{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 Zc(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 Zc(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 Zc(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 Zc(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)}},vee=`.ProseMirror {
|
|
504
|
+
position: relative;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.ProseMirror {
|
|
508
|
+
word-wrap: break-word;
|
|
509
|
+
white-space: pre-wrap;
|
|
510
|
+
white-space: break-spaces;
|
|
511
|
+
-webkit-font-variant-ligatures: none;
|
|
512
|
+
font-variant-ligatures: none;
|
|
513
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.ProseMirror [contenteditable="false"] {
|
|
517
|
+
white-space: normal;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
521
|
+
white-space: pre-wrap;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.ProseMirror pre {
|
|
525
|
+
white-space: pre-wrap;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
img.ProseMirror-separator {
|
|
529
|
+
display: inline !important;
|
|
530
|
+
border: none !important;
|
|
531
|
+
margin: 0 !important;
|
|
532
|
+
width: 0 !important;
|
|
533
|
+
height: 0 !important;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.ProseMirror-gapcursor {
|
|
537
|
+
display: none;
|
|
538
|
+
pointer-events: none;
|
|
539
|
+
position: absolute;
|
|
540
|
+
margin: 0;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.ProseMirror-gapcursor:after {
|
|
544
|
+
content: "";
|
|
545
|
+
display: block;
|
|
546
|
+
position: absolute;
|
|
547
|
+
top: -2px;
|
|
548
|
+
width: 20px;
|
|
549
|
+
border-top: 1px solid black;
|
|
550
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
@keyframes ProseMirror-cursor-blink {
|
|
554
|
+
to {
|
|
555
|
+
visibility: hidden;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
.ProseMirror-hideselection *::selection {
|
|
560
|
+
background: transparent;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
564
|
+
background: transparent;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
.ProseMirror-hideselection * {
|
|
568
|
+
caret-color: transparent;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
572
|
+
display: block;
|
|
573
|
+
}`;function wee(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 bee=class extends lee{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:$X,createMappablePosition:zX},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=vL(t,this.options.autofocus);this.editorState=eu.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=wee(vee,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=CL(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?[VL,$L.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),zL,UL,qL,KL,BL,WL,FL,QL.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 xy(r,this)}createCommandManager(){this.commandManager=new fy({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Uw(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=Uw(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 yL(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 jL(this.state,e)}isActive(e,t){const n=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return IX(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return V1(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
|
|
574
|
+
|
|
575
|
+
`,textSerializers:n={}}=e||{};return RL(this.state.doc,{blockSeparator:t,textSerializers:{...U1(this.schema),...n}})}get isEmpty(){return gy(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 xee(t,this)}get $doc(){return this.$pos(0)}};function ec(e){return new yy({find:e.find,handler:({state:t,range:n,match:r})=>{const s=lt(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(q1(n.from,n.to,t.doc).filter(h=>h.mark.type.excluded.find(g=>g===e.type&&g!==h.mark.type)).filter(h=>h.to>u).length)return null;c<n.to&&i.delete(c,n.to),u>n.from&&i.delete(n.from+a,u);const f=n.from+a+o.length;i.addMark(n.from+a,f,e.type.create(s||{})),i.removeStoredMark(e.type)}},undoable:e.undoable})}function kee(e){return new yy({find:e.find,handler:({state:t,range:n,match:r})=>{const s=lt(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 Ww(e){return new yy({find:e.find,handler:({state:t,range:n,match:r})=>{const s=t.doc.resolve(n.from),i=lt(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 tc(e){return new yy({find:e.find,handler:({state:t,range:n,match:r,chain:s})=>{const i=lt(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),a=o.doc.resolve(n.from).blockRange(),u=a&&b1(a,e.type,i);if(!u)return null;if(o.wrap(a,u),e.keepMarks&&e.editor){const{selection:d,storedMarks:f}=t,{splittableMarks:h}=e.editor.extensionManager,m=f||d.$to.parentOffset&&d.$from.marks();if(m){const g=m.filter(v=>h.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 See(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 Cee={};$1(Cee,{createAtomBlockMarkdownSpec:()=>Eee,createBlockMarkdownSpec:()=>Nee,createInlineMarkdownSpec:()=>jee,parseAttributes:()=>K1,parseIndentedBlocks:()=>Kw,renderNestedMarkdownContent:()=>G1,serializeAttributes:()=>Q1});function K1(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 f=parseInt(((d=c.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=n[f];h&&(t[u]=h.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 Q1(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 Eee(e){const{nodeName:t,name:n,parseAttributes:r=K1,serializeAttributes:s=Q1,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:l}=e,a=n||t,u=c=>{if(!l)return c;const d={};return l.forEach(f=>{f in c&&(d[f]=c[f])}),d};return{parseMarkdown:(c,d)=>{const f={...i,...c.attributes};return d.createNode(t,f,[])},markdownTokenizer:{name:t,level:"block",start(c){var d;const f=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(d=c.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(c,d,f){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=c.match(h);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||{}),f=s(d),h=f?` {${f}}`:"";return`:::${a}${h} :::`}}}function Nee(e){const{nodeName:t,name:n,getContent:r,parseAttributes:s=K1,serializeAttributes:i=Q1,defaultAttributes:o={},content:l="block",allowedAttributes:a}=e,u=n||t,c=d=>{if(!a)return d;const f={};return a.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const g=r(d);h=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const m={...o,...d.attributes};return f.createNode(t,m,h)},markdownTokenizer:{name:t,level:"block",start(d){var f;const h=new RegExp(`^:::${u}`,"m"),m=(f=d.match(h))==null?void 0:f.index;return m!==void 0?m:-1},tokenize(d,f,h){var m;const g=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=d.match(g);if(!v)return;const[x,w=""]=v,b=s(w);let C=1;const S=x.length;let k="";const E=/^:::([\w-]*)(\s.*)?/gm,T=d.slice(S);for(E.lastIndex=0;;){const O=E.exec(T);if(O===null)break;const N=O.index,j=O[1];if(!((m=O[2])!=null&&m.endsWith(":::"))){if(j)C+=1;else if(C-=1,C===0){const P=T.slice(0,N);k=P.trim();const z=d.slice(0,S+N+O[0].length);let I=[];if(k)if(l==="block")for(I=h.blockTokens(P),I.forEach(L=>{L.text&&(!L.tokens||L.tokens.length===0)&&(L.tokens=h.inlineTokens(L.text))});I.length>0;){const L=I[I.length-1];if(L.type==="paragraph"&&(!L.text||L.text.trim()===""))I.pop();else break}else I=h.inlineTokens(k);return{type:t,raw:z,attributes:b,content:k,tokens:I}}}}}},renderMarkdown:(d,f)=>{const h=c(d.attrs||{}),m=i(h),g=m?` {${m}}`:"",v=f.renderChildren(d.content||[],`
|
|
576
|
+
|
|
577
|
+
`);return`:::${u}${g}
|
|
578
|
+
|
|
579
|
+
${v}
|
|
580
|
+
|
|
581
|
+
:::`}}}function Tee(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 Ree(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t}="${n}"`).join(" ")}function jee(e){const{nodeName:t,name:n,getContent:r,parseAttributes:s=Tee,serializeAttributes:i=Ree,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:a}=e,u=n||t,c=f=>{if(!a)return f;const h={};return a.forEach(m=>{const g=typeof m=="string"?m:m.name,v=typeof m=="string"?void 0:m.skipIfDefault;if(g in f){const x=f[g];if(v!==void 0&&x===v)return;h[g]=x}}),h},d=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const m={...o,...f.attributes};if(l)return h.createNode(t,m);const g=r?r(f):f.content||"";return g?h.createNode(t,m,[h.createTextNode(g)]):h.createNode(t,m,[])},markdownTokenizer:{name:t,level:"inline",start(f){const h=l?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),m=f.match(h),g=m==null?void 0:m.index;return g!==void 0?g:-1},tokenize(f,h,m){const g=l?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),v=f.match(g);if(!v)return;let x="",w="";if(l){const[,C]=v;w=C}else{const[,C,S]=v;w=C,x=S||""}const b=s(w.trim());return{type:t,raw:v[0],content:x.trim(),attributes:b}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(x=>x.type==="text").map(x=>x.text).join(""));const m=c(f.attrs||{}),g=i(m),v=g?` ${g}`:"";return l?`[${u}${v}]`:`[${u}${v}]${h}[/${u}]`}}}function Kw(e,t,n){var r,s,i,o;const l=e.split(`
|
|
582
|
+
`),a=[];let u="",c=0;const d=t.baseIndentSize||2;for(;c<l.length;){const f=l[c],h=f.match(t.itemPattern);if(!h){if(a.length>0)break;if(f.trim()===""){c+=1,u=`${u}${f}
|
|
583
|
+
`;continue}else return}const m=t.extractItemData(h),{indentLevel:g,mainContent:v}=m;u=`${u}${f}
|
|
584
|
+
`;const x=[v];for(c+=1;c<l.length;){const S=l[c];if(S.trim()===""){const E=l.slice(c+1).findIndex(N=>N.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){x.push(S),u=`${u}${S}
|
|
585
|
+
`,c+=1;continue}else break}if((((o=(i=S.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>g)x.push(S),u=`${u}${S}
|
|
586
|
+
`,c+=1;else break}let w;const b=x.slice(1);if(b.length>0){const S=b.map(k=>k.slice(g+d)).join(`
|
|
587
|
+
`);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 G1(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(`
|
|
588
|
+
`).map(f=>f?t.indent(f):"").join(`
|
|
589
|
+
`);a.push(d)}}),a.join(`
|
|
590
|
+
`)}function Mee(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(h=>{if(h!==o)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=e.type.create({...e.attrs,...n});i.removeMark(u,c,e.type),i.addMark(u,c,h)}}),i.docChanged&&t.view.dispatch(i)}var Tr=class GL extends W1{constructor(){super(...arguments),this.type="node"}static create(t={}){const n=typeof t=="function"?t():t;return new GL(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}};function ra(e){return new fee({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:s})=>{const i=lt(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),f=d+l.length;if(q1(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;f<n.to&&o.delete(f,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:Oee,getOwnPropertySymbols:Pee}=Object,{hasOwnProperty:Aee}=Object.prototype;function ov(e,t){return function(r,s,i){return e(r,s,i)&&t(r,s,i)}}function Lh(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 _ee(e){return e!=null?e[Symbol.toStringTag]:void 0}function pR(e){return Oee(e).concat(Pee(e))}const Iee=Object.hasOwn||((e,t)=>Aee.call(e,t));function ma(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const Dee="__v",Lee="__o",$ee="_owner",{getOwnPropertyDescriptor:mR,keys:gR}=Object;function zee(e,t){return e.byteLength===t.byteLength&&Lm(new Uint8Array(e),new Uint8Array(t))}function Fee(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 Bee(e,t){return e.byteLength===t.byteLength&&Lm(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Vee(e,t){return ma(e.getTime(),t.getTime())}function Hee(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Uee(e,t){return e===t}function yR(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 f=o.value,h=l.value;if(n.equals(f[0],h[0],a,d,e,t,n)&&n.equals(f[1],h[1],f[0],h[0],e,t,n)){c=s[d]=!0;break}d++}if(!c)return!1;a++}return!0}const qee=ma;function Wee(e,t,n){const r=gR(e);let s=r.length;if(gR(t).length!==s)return!1;for(;s-- >0;)if(!JL(e,t,n,r[s]))return!1;return!0}function Ac(e,t,n){const r=pR(e);let s=r.length;if(pR(t).length!==s)return!1;let i,o,l;for(;s-- >0;)if(i=r[s],!JL(e,t,n,i)||(o=mR(e,i),l=mR(t,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function Kee(e,t){return ma(e.valueOf(),t.valueOf())}function Qee(e,t){return e.source===t.source&&e.flags===t.flags}function xR(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 Lm(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 Gee(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 JL(e,t,n,r){return(r===$ee||r===Lee||r===Dee)&&(e.$$typeof||t.$$typeof)?!0:Iee(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const Jee="[object ArrayBuffer]",Zee="[object Arguments]",Yee="[object Boolean]",Xee="[object DataView]",ete="[object Date]",tte="[object Error]",nte="[object Map]",rte="[object Number]",ste="[object Object]",ite="[object RegExp]",ote="[object Set]",lte="[object String]",ate={"[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},ute="[object URL]",cte=Object.prototype.toString;function dte({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:f,areUrlsEqual:h,unknownTagComparators:m}){return function(v,x,w){if(v===x)return!0;if(v==null||x==null)return!1;const b=typeof v;if(b!==typeof x)return!1;if(b!=="object")return b==="number"?l(v,x,w):b==="function"?i(v,x,w):!1;const C=v.constructor;if(C!==x.constructor)return!1;if(C===Object)return a(v,x,w);if(Array.isArray(v))return t(v,x,w);if(C===Date)return r(v,x,w);if(C===RegExp)return c(v,x,w);if(C===Map)return o(v,x,w);if(C===Set)return d(v,x,w);const S=cte.call(v);if(S===ete)return r(v,x,w);if(S===ite)return c(v,x,w);if(S===nte)return o(v,x,w);if(S===ote)return d(v,x,w);if(S===ste)return typeof v.then!="function"&&typeof x.then!="function"&&a(v,x,w);if(S===ute)return h(v,x,w);if(S===tte)return s(v,x,w);if(S===Zee)return a(v,x,w);if(ate[S])return f(v,x,w);if(S===Jee)return e(v,x,w);if(S===Xee)return n(v,x,w);if(S===Yee||S===rte||S===lte)return u(v,x,w);if(m){let k=m[S];if(!k){const E=_ee(v);E&&(k=m[E])}if(k)return k(v,x,w)}return!1}}function fte({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:zee,areArraysEqual:n?Ac:Fee,areDataViewsEqual:Bee,areDatesEqual:Vee,areErrorsEqual:Hee,areFunctionsEqual:Uee,areMapsEqual:n?ov(yR,Ac):yR,areNumbersEqual:qee,areObjectsEqual:n?Ac:Wee,arePrimitiveWrappersEqual:Kee,areRegExpsEqual:Qee,areSetsEqual:n?ov(xR,Ac):xR,areTypedArraysEqual:n?ov(Lm,Ac):Lm,areUrlsEqual:Gee,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const s=Lh(r.areArraysEqual),i=Lh(r.areMapsEqual),o=Lh(r.areObjectsEqual),l=Lh(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:l})}return r}function hte(e){return function(t,n,r,s,i,o,l){return e(t,n,l)}}function pte({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 mte=ol();ol({strict:!0});ol({circular:!0});ol({circular:!0,strict:!0});ol({createInternalComparator:()=>ma});ol({strict:!0,createInternalComparator:()=>ma});ol({circular:!0,createInternalComparator:()=>ma});ol({circular:!0,createInternalComparator:()=>ma,strict:!0});function ol(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:s=!1}=e,i=fte(e),o=dte(i),l=n?n(o):hte(o);return pte({circular:t,comparator:o,createState:r,equals:l,strict:s})}var ZL={exports:{}},YL={};/**
|
|
591
|
+
* @license React
|
|
592
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
593
|
+
*
|
|
594
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
595
|
+
*
|
|
596
|
+
* This source code is licensed under the MIT license found in the
|
|
597
|
+
* LICENSE file in the root directory of this source tree.
|
|
598
|
+
*/var vy=y,gte=x1;function yte(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var xte=typeof Object.is=="function"?Object.is:yte,vte=gte.useSyncExternalStore,wte=vy.useRef,bte=vy.useEffect,kte=vy.useMemo,Ste=vy.useDebugValue;YL.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=wte(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=kte(function(){function a(h){if(!u){if(u=!0,c=h,h=r(h),s!==void 0&&o.hasValue){var m=o.value;if(s(m,h))return d=m}return d=h}if(m=d,xte(c,h))return m;var g=r(h);return s!==void 0&&s(m,g)?(c=h,m):(c=h,d=g)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return a(t())},f===null?void 0:function(){return a(f())}]},[t,n,r,s]);var l=vte(e,i[0],i[1]);return bte(function(){o.hasValue=!0,o.value=l},[l]),Ste(l),l};ZL.exports=YL;var Cte=ZL.exports;let Qw,Gw;if(typeof WeakMap<"u"){let e=new WeakMap;Qw=t=>e.get(t),Gw=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;Qw=r=>{for(let s=0;s<e.length;s+=2)if(e[s]==r)return e[s+1]},Gw=(r,s)=>(n==10&&(n=0),e[n++]=r,e[n++]=s)}var yi=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 Qw(e)||Gw(e,Ete(e))}};function Ete(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=Nte(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:x,colwidth:w}=g.attrs;for(let b=0;b<x;b++){if(b+u>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:c,n:x-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,T=o[E];T==null||T!=k&&o[E+1]==1?(o[E]=k,o[E+1]=1):T==k&&o[E+1]++}}}s+=v,c+=g.nodeSize}const f=(u+1)*t;let h=0;for(;s<f;)r[s++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:u,n:h}),c++}(t===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new yi(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&&Tte(l,o,e),l}function Nte(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 Tte(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=Rte(a)))[u]=c)}l&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function Rte(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function J1(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 Ct("selectingCells");function jte(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 XL(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 Mte(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=jte(t.$head)||Ote(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function Ote(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 vR(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function e$(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function t$(e,t,n){const r=e.node(-1),s=yi.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 wR(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 Ws=class ui extends Pe{constructor(t,n=t){const r=t.node(-1),s=yi.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 f=i+c+1;return new kD(l.resolve(f),l.resolve(f+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(vR(r)&&vR(s)&&e$(r,s)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?ui.rowSelection(r,s):i&&this.isColSelection()?ui.colSelection(r,s):new ui(r,s)}return _e.between(r,s)}content(){const t=this.$anchorCell.node(-1),n=yi.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 f=n.map[c];if(i[f])continue;i[f]=!0;const h=n.findCell(f);let m=t.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const g=s.left-h.left,v=h.right-s.right;if(g>0||v>0){let x=m.attrs;if(g>0&&(x=wR(x,0,g)),v>0&&(x=wR(x,x.colspan-v,v)),h.left<s.left){if(m=m.type.createAndFill(x),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(x)}`)}else m=m.type.create(x,m.content)}if(h.top<s.top||h.bottom>s.bottom){const x={...m.attrs,rowspan:Math.min(h.bottom,s.bottom)-Math.max(h.top,s.top)};h.top<s.top?m=m.type.createAndFill(x):m=m.type.create(x,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=yi.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=yi.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 ui(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=yi.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 ui&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const r=t.node(-1),s=yi.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 ui(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new ui(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new ui(t.resolve(n),t.resolve(r))}getBookmark(){return new Pte(this.$anchorCell.pos,this.$headCell.pos)}};Ws.prototype.visible=!1;Pe.jsonID("cell",Ws);var Pte=class n${constructor(t,n){this.anchor=t,this.head=n}map(t){return new n$(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&&e$(n,r)?new Ws(n,r):Pe.near(r,1)}};new Ct("fix-tables");function r$(e){const t=e.selection,n=Mte(e),r=n.node(-1),s=n.start(-1),i=yi.get(r);return{...t instanceof Ws?i.rectBetween(t.$anchorCell.pos-s,t.$headCell.pos-s):i.findCell(n.pos-s),tableStart:s,map:i,table:r}}function Ate(e){return function(t,n){if(!XL(t))return!1;if(n){const r=J1(t.schema),s=r$(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 bR(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 Z1(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?Ate(e):function(n,r){if(!XL(n))return!1;if(r){const s=J1(n.schema),i=r$(n),o=n.tr,l=bR("row",i,s),a=bR("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(f=>{const h=f+i.tableStart,m=o.doc.nodeAt(h);m&&o.setNodeMarkup(h,d,m.attrs)}),r(o)}return!0}}Z1("row",{useDeprecatedLogic:!0});Z1("column",{useDeprecatedLogic:!0});Z1("cell",{useDeprecatedLogic:!0});function $h(e,t){const n=e.selection;if(!(n instanceof Ws))return!1;if(t){const r=e.tr,s=J1(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}L1({ArrowLeft:zh("horiz",-1),ArrowRight:zh("horiz",1),ArrowUp:zh("vert",-1),ArrowDown:zh("vert",1),"Shift-ArrowLeft":Fh("horiz",-1),"Shift-ArrowRight":Fh("horiz",1),"Shift-ArrowUp":Fh("vert",-1),"Shift-ArrowDown":Fh("vert",1),Backspace:$h,"Mod-Backspace":$h,Delete:$h,"Mod-Delete":$h});function Sp(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function zh(e,t){return(n,r,s)=>{if(!s)return!1;const i=n.selection;if(i instanceof Ws)return Sp(n,r,Pe.near(i.$headCell,t));if(e!="horiz"&&!i.empty)return!1;const o=s$(s,e,t);if(o==null)return!1;if(e=="horiz")return Sp(n,r,Pe.near(n.doc.resolve(i.head+t),t));{const l=n.doc.resolve(o),a=t$(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),Sp(n,r,u)}}}function Fh(e,t){return(n,r,s)=>{if(!s)return!1;const i=n.selection;let o;if(i instanceof Ws)o=i;else{const a=s$(s,e,t);if(a==null)return!1;o=new Ws(n.doc.resolve(a))}const l=t$(o.$headCell,e,t);return l?Sp(n,r,new Ws(o.$anchorCell,l)):!1}}function s$(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 Ct("tableColumnResizing");function _te(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 Ite=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:f,to:h})=>{const{doc:m,selection:g}=d,{empty:v}=g,x=!m.textBetween(f,h).length&&B1(d.selection),w=this.element.contains(document.activeElement);return!(!(c.hasFocus()||w)||v||x||!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 f=!(d!=null&&d.selection.eq(c.state.selection)),h=!(d!=null&&d.doc.eq(c.state.doc));!f&&!h||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(c,f,h,d)},this.updateDelay))},this.updateHandler=(c,d,f,h)=>{const{composing:m}=c;if(m||!d&&!f)return;if(!this.getShouldShow(h)){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(o1(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(i1(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(s1(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(pm(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(l1(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Y2(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(a1(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(X2(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=_L(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 Ws){const{$anchorCell:l,$headCell:a}=r,u=l?l.pos:a.pos,c=a?a.pos:l.pos,d=this.view.nodeDOM(u),f=this.view.nodeDOM(c);if(!d||!f)return;const h=d===f?d.getBoundingClientRect():_te(d.getBoundingClientRect(),f.getBoundingClientRect());o={getBoundingClientRect:()=>h,getClientRects:()=>[h]}}return o}updatePosition(){const e=this.virtualElement;e&&u1(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()}},Y1=e=>new wt({key:typeof e.pluginKey=="string"?new Ct(e.pluginKey):e.pluginKey,view:t=>new Ite({view:t,...e})});Et.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Y1({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 Dte=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:f,empty:h}=d,m=f.depth===1,g=f.parent.isTextblock&&!f.parent.type.spec.code&&!f.parent.textContent&&f.parent.childCount===0&&!this.getTextContent(f.parent);return!(!u.hasFocus()||!h||!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,f)=>{const{composing:h}=u;if(h||!c&&!d)return;if(!this.getShouldShow(f)){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 RL(e,{textSerializers:U1(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(o1(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(i1(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(s1(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(pm(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(l1(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Y2(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(a1(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(X2(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=_L(this.view,e.from,e.to);u1({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()}},X1=e=>new wt({key:typeof e.pluginKey=="string"?new Ct(e.pluginKey):e.pluginKey,view:t=>new Dte({view:t,...e})});Et.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?[X1({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 Lte=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},$te=({contentComponent:e})=>{const t=x1.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return p.jsx(p.Fragment,{children:Object.values(t)})};function zte(){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]:SP.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 Fte=class extends Ur.Component{constructor(e){var t;super(e),this.editorContentRef=Ur.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=zte(),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:Lte(t,this.editorContentRef),...n}),(e==null?void 0:e.contentComponent)&&p.jsx($te,{contentComponent:e.contentComponent})]})}},Bte=y.forwardRef((e,t)=>{const n=Ur.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return Ur.createElement(Fte,{key:n,innerRef:t,...e})}),i$=Ur.memo(Bte),Vte=typeof window<"u"?y.useLayoutEffect:y.useEffect,Hte=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 Ute(e){var t;const[n]=y.useState(()=>new Hte(e.editor)),r=Cte.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,(t=e.equalityFn)!=null?t:mte);return Vte(()=>n.watch(e.editor),[e.editor,n]),y.useDebugValue(r),r}var qte=!1,Jw=typeof window>"u",Wte=Jw||!!(typeof window<"u"&&window.next),Kte=class o${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?Jw||Wte?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 bee(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?o$.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 Qte(e={},t=[]){const n=y.useRef(e);n.current=e;const[r]=y.useState(()=>new Kte(n)),s=x1.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return y.useDebugValue(s),y.useEffect(r.onRender(t)),Ute({editor:s,selector:({transactionNumber:i})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&i===0?0:i+1}),s}var eS=y.createContext({editor:null});eS.Consumer;var wy=()=>y.useContext(eS),Gte=y.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Jte=()=>y.useContext(Gte);Ur.forwardRef((e,t)=>{const{onDragStart:n}=Jte(),r=e.as||"div";return p.jsx(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});Ur.createContext({markViewContentRef:()=>{}});var Zte=Ur.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=y.useRef(document.createElement("div"));typeof c=="function"?c(d.current):c&&(c.current=d.current);const{editor:f}=wy(),h=t||f,m={updateDelay:n,resizeDelay:r,appendTo:s,pluginKey:e,shouldShow:i,getReferencedVirtualElement:o,options:l},g=y.useRef(m);g.current=m;const[v,x]=y.useState(!1),w=y.useRef(!0);return y.useEffect(()=>{if(h!=null&&h.isDestroyed)return;if(!h){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=Y1({...g.current,editor:h,element:b});h.registerPlugin(C);const S=g.current.pluginKey;return w.current=!0,x(!0),()=>{x(!1),h.unregisterPlugin(S),window.requestAnimationFrame(()=>{b.parentNode&&b.parentNode.removeChild(b)})}},[h]),y.useEffect(()=>{if(!(!v||!h||h.isDestroyed)){if(w.current){w.current=!1;return}h.view.dispatch(h.state.tr.setMeta("bubbleMenu",{type:"updateOptions",options:g.current}))}},[v,h,n,r,i,l,s,o]),el.createPortal(p.jsx("div",{...u,children:a}),d.current)}),Yte=Ur.forwardRef(({pluginKey:e="floatingMenu",editor:t,updateDelay:n,resizeDelay:r,appendTo:s,shouldShow:i=null,options:o,children:l,...a},u)=>{const c=y.useRef(document.createElement("div"));typeof u=="function"?u(c.current):u&&(u.current=c.current);const{editor:d}=wy(),f=t||d,h={updateDelay:n,resizeDelay:r,appendTo:s,pluginKey:e,shouldShow:i,options:o},m=y.useRef(h);m.current=h;const[g,v]=y.useState(!1),x=y.useRef(!0);return y.useEffect(()=>{if(f!=null&&f.isDestroyed)return;if(!f){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=X1({...m.current,editor:f,element:w});f.registerPlugin(b);const C=m.current.pluginKey;return x.current=!0,v(!0),()=>{v(!1),f.unregisterPlugin(C),window.requestAnimationFrame(()=>{w.parentNode&&w.parentNode.removeChild(w)})}},[f]),y.useEffect(()=>{if(!(!g||!f||f.isDestroyed)){if(x.current){x.current=!1;return}f.view.dispatch(f.state.tr.setMeta("floatingMenu",{type:"updateOptions",options:m.current}))}},[g,f,n,r,i,o,s]),el.createPortal(p.jsx("div",{...a,children:l}),c.current)}),tS=y.createContext({editor:null,isReady:!1});tS.displayName="TiptapContext";var by=()=>y.useContext(tS);function l$({instance:e,children:t}){var n;const[r,s]=y.useState((n=e==null?void 0:e.isInitialized)!=null?n:!1);y.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=y.useMemo(()=>({editor:e,isReady:r}),[e,r]),o=y.useMemo(()=>({editor:e}),[e]);return p.jsx(eS.Provider,{value:o,children:p.jsx(tS.Provider,{value:i,children:t})})}l$.displayName="Tiptap";function a$({...e}){const{editor:t}=by();return p.jsx(i$,{editor:t,...e})}a$.displayName="Tiptap.Content";function u$({children:e}){const{isReady:t}=by();return t?null:e}u$.displayName="Tiptap.Loading";function c$({children:e,...t}){const{editor:n}=by();return n?p.jsx(Zte,{editor:n,...t,children:e}):null}c$.displayName="Tiptap.BubbleMenu";function d$({children:e,...t}){const{editor:n}=by();return n?p.jsx(Yte,{...t,editor:n,children:e}):null}d$.displayName="Tiptap.FloatingMenu";var Xte=Object.assign(l$,{Content:a$,Loading:u$,BubbleMenu:c$,FloatingMenu:d$}),ene=Ur.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=y.useRef(document.createElement("div"));typeof c=="function"?c(d.current):c&&(c.current=d.current);const{editor:f}=wy(),h=t||f,m={updateDelay:n,resizeDelay:r,appendTo:s,pluginKey:e,shouldShow:i,getReferencedVirtualElement:o,options:l},g=y.useRef(m);g.current=m;const[v,x]=y.useState(!1),w=y.useRef(!0);return y.useEffect(()=>{if(h!=null&&h.isDestroyed)return;if(!h){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=Y1({...g.current,editor:h,element:b});h.registerPlugin(C);const S=g.current.pluginKey;return w.current=!0,x(!0),()=>{x(!1),h.unregisterPlugin(S),window.requestAnimationFrame(()=>{b.parentNode&&b.parentNode.removeChild(b)})}},[h]),y.useEffect(()=>{if(!(!v||!h||h.isDestroyed)){if(w.current){w.current=!1;return}h.view.dispatch(h.state.tr.setMeta("bubbleMenu",{type:"updateOptions",options:g.current}))}},[v,h,n,r,i,l,s,o]),el.createPortal(p.jsx("div",{...u,children:a}),d.current)});Ur.forwardRef(({pluginKey:e="floatingMenu",editor:t,updateDelay:n,resizeDelay:r,appendTo:s,shouldShow:i=null,options:o,children:l,...a},u)=>{const c=y.useRef(document.createElement("div"));typeof u=="function"?u(c.current):u&&(u.current=c.current);const{editor:d}=wy(),f=t||d,h={updateDelay:n,resizeDelay:r,appendTo:s,pluginKey:e,shouldShow:i,options:o},m=y.useRef(h);m.current=h;const[g,v]=y.useState(!1),x=y.useRef(!0);return y.useEffect(()=>{if(f!=null&&f.isDestroyed)return;if(!f){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=X1({...m.current,editor:f,element:w});f.registerPlugin(b);const C=m.current.pluginKey;return x.current=!0,v(!0),()=>{v(!1),f.unregisterPlugin(C),window.requestAnimationFrame(()=>{w.parentNode&&w.parentNode.removeChild(w)})}},[f]),y.useEffect(()=>{if(!(!g||!f||f.isDestroyed)){if(x.current){x.current=!1;return}f.view.dispatch(f.state.tr.setMeta("floatingMenu",{type:"updateOptions",options:m.current}))}},[g,f,n,r,i,o,s]),el.createPortal(p.jsx("div",{...a,children:l}),c.current)});const Yr=e=>`tiptap-bubble-button${e?" is-active":""}`;function tne({editor:e}){const t=y.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(ene,{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:Yr(e.isActive("bold")),onClick:()=>e.chain().focus().toggleBold().run(),"aria-label":"Toggle bold",children:p.jsx(JH,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:Yr(e.isActive("italic")),onClick:()=>e.chain().focus().toggleItalic().run(),"aria-label":"Toggle italic",children:p.jsx(DU,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:Yr(e.isActive("strike")),onClick:()=>e.chain().focus().toggleStrike().run(),"aria-label":"Toggle strikethrough",children:p.jsx(v6,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:Yr(e.isActive("code")),onClick:()=>e.chain().focus().toggleCode().run(),"aria-label":"Toggle inline code",children:p.jsx(Ok,{className:"h-4 w-4"})}),p.jsx("span",{className:"tiptap-bubble-separator","aria-hidden":"true"}),p.jsx("button",{type:"button",className:Yr(e.isActive("heading",{level:2})),onClick:()=>e.chain().focus().toggleHeading({level:2}).run(),"aria-label":"Toggle heading level 2",children:p.jsx(OU,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:Yr(e.isActive("heading",{level:3})),onClick:()=>e.chain().focus().toggleHeading({level:3}).run(),"aria-label":"Toggle heading level 3",children:p.jsx(AU,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:Yr(e.isActive("bulletList")),onClick:()=>e.chain().focus().toggleBulletList().run(),"aria-label":"Toggle bullet list",children:p.jsx(QA,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:Yr(e.isActive("orderedList")),onClick:()=>e.chain().focus().toggleOrderedList().run(),"aria-label":"Toggle ordered list",children:p.jsx(qU,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:Yr(e.isActive("blockquote")),onClick:()=>e.chain().focus().toggleBlockquote().run(),"aria-label":"Toggle blockquote",children:p.jsx(r6,{className:"h-4 w-4"})}),p.jsx("span",{className:"tiptap-bubble-separator","aria-hidden":"true"}),p.jsx("button",{type:"button",className:Yr(e.isActive("link")),onClick:t,"aria-label":"Add or edit link",children:p.jsx(VU,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:Yr(),onClick:()=>e.chain().focus().extendMarkRange("link").unsetLink().run(),"aria-label":"Remove link",disabled:!e.isActive("link"),children:p.jsx(k6,{className:"h-4 w-4"})})]})}const nne=()=>{const{main:{editor:e}}=Nr();return p.jsx("div",{className:"min-h-0 flex-1",children:p.jsxs(Xte,{instance:e,children:[e?p.jsx(tne,{editor:e}):null,p.jsx(i$,{editor:e,className:"tiptap-editor tiptap-content h-full"})]})})},rne=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},sne=()=>{const{main:{content:e,setContent:t,setIsDirty:n,setLastEditAt:r,active:s}}=Nr(),{prompts:i,activeVersion:o}=y.useMemo(()=>{try{const h=JSON.parse(e);if(Array.isArray(h))return{prompts:h.length>0?h:[""],activeVersion:h.length};if(h&&typeof h=="object"){const m=h.prompts&&Array.isArray(h.prompts)&&h.prompts.length>0?h.prompts:[""],g=typeof h.activeVersion=="number"&&h.activeVersion>0?Math.min(h.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]=y.useState(l);y.useEffect(()=>{u(h=>i.length===0?0:h>=0&&h<i.length?h:l)},[l,i.length]);const c=i[a]??"",d=rne((s==null?void 0:s.name)??"prompt"),f=()=>{const h=i[i.length-1]??"",m=[...i,h],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((h,m)=>{const g=m===a,v=m===l,x=`${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:x}),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:f,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:h=>{const m=h.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"})})]})},pc={0:"None",1:"Urgent",2:"High",3:"Medium",4:"Low"},f$=[{type:"folder",label:"Folder",icon:uc},{type:"markdown",label:"Markdown",icon:ca},{type:"prompt",label:"Prompt",icon:GU},{type:"json",label:"Data Table",icon:hU},{type:"app",label:"React App",icon:lU},{type:"tasks",label:"Task Board",icon:g6}],h$=f$.filter(e=>e.type!=="folder"),p$=e=>f$.find(t=>t.type===e);function m$(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 ine(){const{activeProject:e}=$t(),t=Ue.useUtils(),n=(e==null?void 0:e.id)??"",r=Ue.docs.list.useQuery({projectId:n},{enabled:!!e,refetchInterval:5e3,refetchOnWindowFocus:!1}),s=y.useMemo(()=>{var a;return((a=r.data)==null?void 0:a.docs)??[]},[r.data]),i=y.useMemo(()=>{var a;return((a=r.data)==null?void 0:a.folders)??[]},[r.data]),o=y.useCallback(a=>{t.docs.list.setData({projectId:n},u=>{if(u)return{...u,docs:a(u.docs)}})},[t,n]),l=y.useCallback(()=>{t.docs.list.invalidate({projectId:n}).catch(()=>{})},[t,n]);return{docsQuery:r,docs:s,folders:i,updateDocsCache:o,invalidateDocs:l}}const g$=y.createContext(null);function y$(){const e=y.useContext(g$);if(!e)throw new Error("useDocPicker requires DocPickerProvider");return e.pickDoc}const one=({type:e})=>{const t=p$(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},lne=({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(one,{type:e.type}),p.jsx("span",{className:"truncate",children:e.displayName??r})]})},ane=({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(ji,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):p.jsx(Du,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),p.jsx(uc,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),p.jsx("span",{className:"truncate",children:e.name})]}),i&&p.jsx(x$,{items:e.children,depth:t+1,expanded:n,toggleExpanded:r,onSelect:s})]})},x$=({items:e,depth:t,expanded:n,toggleExpanded:r,onSelect:s})=>p.jsx(p.Fragment,{children:e.map(i=>i.type==="folder"?p.jsx(ane,{node:i,depth:t,expanded:n,toggleExpanded:r,onSelect:s},i.path):p.jsx(lne,{doc:i.doc,depth:t,onSelect:s},i.doc.name))}),une=({onSelect:e,onClose:t})=>{const{docs:n,folders:r}=ine(),[s,i]=y.useState(""),[o,l]=y.useState(()=>new Set),a=y.useRef(null),u=y.useCallback(f=>{l(h=>{const m=new Set(h);return m.has(f)?m.delete(f):m.add(f),m})},[]),c=y.useMemo(()=>{if(!s.trim())return n;const f=s.toLowerCase();return n.filter(h=>h.name.toLowerCase().includes(f)||(h.displayName??"").toLowerCase().includes(f))},[n,s]),d=y.useMemo(()=>m$(c,s.trim()?[]:r),[c,r,s]);return p.jsx(Xs,{open:!0,onOpenChange:f=>!f&&t(),children:p.jsxs(Cs,{className:"flex max-h-[70vh] max-w-sm flex-col gap-0 p-0",children:[p.jsxs(ei,{className:"border-b border-border px-4 py-3",children:[p.jsx(ti,{className:"text-sm",children:"Link document"}),p.jsx(Lf,{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(Pk,{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:f=>i(f.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(x$,{items:d,depth:0,expanded:o,toggleExpanded:u,onSelect:e})})]})})},cne=({children:e})=>{const t=y.useRef(null),[n,r]=y.useState(!1),s=y.useCallback(()=>new Promise(a=>{t.current=a,r(!0)}),[]),i=y.useCallback(a=>{var u;(u=t.current)==null||u.call(t,a),t.current=null,r(!1)},[]),o=y.useCallback(()=>{var a;(a=t.current)==null||a.call(t,null),t.current=null,r(!1)},[]),l=y.useMemo(()=>({pickDoc:s}),[s]);return p.jsxs(g$.Provider,{value:l,children:[e,n&&p.jsx(une,{onSelect:i,onClose:o})]})},dne=["docs","agents","code","settings","commands"];function fne(e){try{return decodeURIComponent(e)}catch{return e}}function hne(e){try{const t=atob(e),n=Uint8Array.from(t,r=>r.charCodeAt(0));return new TextDecoder().decode(n)}catch{return null}}function pne(e){const t=new TextEncoder().encode(e);let n="";return t.forEach(r=>{n+=String.fromCharCode(r)}),btoa(n)}function kR(e){return e.split("/").map(t=>encodeURIComponent(t)).join("/")}function nS(e){const t=e.replace(/^\/+/,"").split("/").filter(Boolean),n=t[0]||null,r=t[1]||null;let s="docs";r&&dne.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(fne).join("/"))):s==="agents"&&t.length>=3?l=t[2]:s==="code"&&t.length>=3&&(a=parseInt(t[2],10)||0,t.length>=4&&(u=hne(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 ky(){const e=Mf(),t=$g(),n=y.useMemo(()=>nS(e.pathname),[e.pathname]),r=y.useCallback((a,u,c=0)=>{t(`/${a}/docs/${c}/${kR(u)}`,{replace:!0})},[t]),s=y.useCallback((a,u)=>{t(`/${a}/agents/${u}`,{replace:!0})},[t]),i=y.useCallback((a,u,c=0)=>{t(`/${a}/code/${c}/${pne(u)}`,{replace:!0})},[t]),o=y.useCallback((a,u)=>{t(`/${a}/${u}`,{replace:!0})},[t]),l=y.useCallback((a,u,c=0)=>`${a}/docs/${c}/${kR(u)}`,[]);return{...n,navigateToDoc:r,navigateToAgent:s,navigateToCodeFile:i,navigateToTab:o,encodeDocPath:l}}const mne={1:"text-red-500",2:"text-orange-500",3:"text-yellow-500",4:"text-blue-400"},gne=({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(ca,{className:"h-2.5 w-2.5 shrink-0"}),p.jsx("span",{className:"truncate",children:n})]})},yne=({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 ${mne[l]??"text-muted-foreground"}`,children:pc[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(gne,{docName:e.linkedDoc,onClick:()=>s(e.linkedDoc)})]})]})},xne=({task:e,index:t,statuses:n,onUpdate:r,onRemove:s,onClose:i})=>{const[o,l]=y.useState(!1),[a,u]=y.useState(e.label),[c,d]=y.useState(""),f=y.useRef(null),h=y$(),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)})},x=async()=>{const w=await h();w&&r(t,{linkedDoc:w})};return p.jsx(Xs,{open:!0,onOpenChange:w=>!w&&i(),children:p.jsxs(Cs,{className:"max-w-sm",children:[p.jsxs(ei,{children:[p.jsx(ti,{className:"text-base",children:o?p.jsx("input",{ref:f,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=f.current)==null?void 0:w.focus()},0)},children:e.label})}),p.jsx(Lf,{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:pc[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(Bn,{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(ca,{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(Bn,{className:"h-2.5 w-2.5"})})]}):null,p.jsxs(te,{variant:"ghost",size:"sm",className:"h-6 gap-1 text-xs text-muted-foreground",onClick:x,children:[p.jsx(KA,{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(te,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-xs text-destructive hover:text-destructive",onClick:()=>{s(t),i()},children:[p.jsx(da,{className:"h-3.5 w-3.5"}),"Delete"]})})]})]})})},vne=({status:e,tasks:t,globalIndices:n,onDragStart:r,onDrop:s,onDragOver:i,onAdd:o,onCardClick:l,onNavigateDoc:a})=>{const[u,c]=y.useState(!1),[d,f]=y.useState(""),h=y.useRef(null),m=()=>{c(!0),f(""),setTimeout(()=>{var v;return(v=h.current)==null?void 0:v.focus()},0)},g=()=>{const v=d.trim();v&&o(v,e),c(!1),f("")};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,x)=>p.jsx(yne,{task:v,globalIndex:n[x],onDragStart:r,onClick:()=>l(n[x]),onNavigateDoc:a},`${n[x]}-${v.label}`))}),p.jsx("div",{className:"border-t border-border px-2 py-1.5",children:u?p.jsx("input",{ref:h,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",placeholder:"Task name...",value:d,onChange:v=>f(v.target.value),onBlur:g,onKeyDown:v=>{v.key==="Enter"&&g(),v.key==="Escape"&&c(!1)}}):p.jsxs(te,{variant:"ghost",size:"sm",className:"h-7 w-full justify-start gap-1 text-xs text-muted-foreground",onClick:m,children:[p.jsx(Qt,{className:"h-3.5 w-3.5"}),"Add"]})})]})},wne=({tasks:e,statuses:t,onUpdate:n,onRemove:r,onAdd:s,onAddStatus:i})=>{const o=y.useRef(null),[l,a]=y.useState(!1),[u,c]=y.useState(""),d=y.useRef(null),[f,h]=y.useState(null),{activeProject:m}=$t(),{navigateToDoc:g}=ky(),v=y.useCallback(T=>{m&&g(m.id,T)},[m,g]),x=y.useCallback((T,O)=>{o.current=O,T.dataTransfer.effectAllowed="move"},[]),w=y.useCallback(T=>{T.preventDefault()},[]),b=y.useCallback((T,O)=>{const N=o.current;if(N===null)return;o.current=null;const j=e[N];!j||(j.status??"todo")===O||n(N,{status:O})},[e,n]),C=()=>{a(!0),c(""),setTimeout(()=>{var T;return(T=d.current)==null?void 0:T.focus()},0)},S=()=>{const T=u.trim().toLowerCase();a(!1),!(!T||t.includes(T))&&i(T)},k=new Map;for(const T of t)k.set(T,[]);e.forEach((T,O)=>{const N=T.status??"todo";k.has(N)||k.set(N,[]),k.get(N).push({task:T,index:O})});const E=f!==null?e[f]:null;return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex flex-1 gap-3 overflow-x-auto pb-2",children:[t.map(T=>{const O=k.get(T)??[];return p.jsx(vne,{status:T,tasks:O.map(N=>N.task),globalIndices:O.map(N=>N.index),onDragStart:x,onDrop:b,onDragOver:w,onAdd:s,onCardClick:h,onNavigateDoc:v},T)}),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:T=>c(T.target.value),onBlur:S,onKeyDown:T=>{T.key==="Enter"&&S(),T.key==="Escape"&&a(!1)}})}):p.jsxs(te,{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(Qt,{className:"h-3.5 w-3.5"}),"Add column"]})})]}),E&&f!==null&&p.jsx(xne,{task:E,index:f,statuses:t,onUpdate:n,onRemove:r,onClose:()=>h(null)})]})},bne={1:"text-red-500",2:"text-orange-500",3:"text-yellow-500",4:"text-blue-400"},kne=({priority:e})=>{if(!e)return null;const t=bne[e]??"text-muted-foreground";return p.jsx("span",{className:`shrink-0 text-[10px] font-medium ${t}`,children:pc[e]})},Sne=({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}),Cne=({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(ca,{className:"h-2.5 w-2.5 shrink-0"}),p.jsx("span",{className:"truncate",children:n})]})},Ene=({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]=y.useState(!1),[f,h]=y.useState(e.label),[m,g]=y.useState(!1),v=y.useRef(null),[x,w]=y.useState(""),b=y.useRef(null),C=y$(),S=()=>{h(e.label),d(!0),setTimeout(()=>{var N;return(N=v.current)==null?void 0:N.focus()},0)},k=()=>{d(!1);const N=f.trim();N&&N!==e.label?s(t,{label:N}):h(e.label)},E=()=>{const N=x.trim().toLowerCase();if(!N)return;const j=e.tags??[];j.includes(N)||s(t,{tags:[...j,N]}),w("")},T=N=>{s(t,{tags:(e.tags??[]).filter(j=>j!==N)})},O=async()=>{const N=await C();N&&s(t,{linkedDoc:N})};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:N=>o.onDragStart(N,t),onDragOver:N=>o.onDragOver(N),onDragEnd:o.onDragEnd,children:[p.jsx(TU,{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:f,onChange:N=>h(N.target.value),onBlur:k,onKeyDown:N=>{N.key==="Enter"&&k(),N.key==="Escape"&&(h(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(N=>!N),children:e.label}),p.jsx(kne,{priority:e.priority??0}),(e.tags??[]).map(N=>p.jsx(Sne,{tag:N},N)),e.linkedDoc&&p.jsx(Cne,{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(te,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100",onClick:()=>i(t),children:p.jsx(da,{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:N=>s(t,{priority:Number(N.target.value)}),children:[0,1,2,3,4].map(N=>p.jsx("option",{value:N,children:pc[N]},N))}),p.jsx("select",{className:"h-6 rounded border border-border bg-background px-1.5 text-[11px]",value:e.status??"todo",onChange:N=>s(t,{status:N.target.value}),children:n.map(N=>p.jsx("option",{value:N,children:N},N))}),p.jsxs("div",{className:"flex items-center gap-1",children:[(e.tags??[]).map(N=>p.jsxs("span",{className:"flex items-center gap-0.5 rounded-full bg-accent px-1.5 py-0.5 text-[10px]",children:[N,p.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:()=>T(N),children:p.jsx(Bn,{className:"h-2.5 w-2.5"})})]},N)),p.jsx("input",{ref:b,className:"h-5 w-16 bg-transparent text-[11px] outline-none placeholder:text-muted-foreground",placeholder:"+ tag",value:x,onChange:N=>w(N.target.value),onKeyDown:N=>{N.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(ca,{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(Bn,{className:"h-2.5 w-2.5"})})]}):null,p.jsxs(te,{variant:"ghost",size:"sm",className:"h-5 gap-1 px-1 text-[11px] text-muted-foreground",onClick:O,children:[p.jsx(KA,{className:"h-3 w-3"}),e.linkedDoc?"Change":"Link doc"]})]})]})]})},Nne=({groups:e,statuses:t,onToggleDone:n,onUpdate:r,onRemove:s,onAdd:i})=>{var w;const[o,l]=y.useState(""),a=y.useRef(null),{activeProject:u}=$t(),{navigateToDoc:c}=ky(),d=y.useCallback(b=>{u&&c(u.id,b)},[u,c]),f=()=>{const b=o.trim();b&&(i(b),l(""))},h=y.useCallback((b,C)=>{a.current=C,b.dataTransfer.effectAllowed="move"},[]),m=y.useCallback(b=>{b.preventDefault()},[]),g=y.useCallback(()=>{a.current=null},[]),v={onDragStart:h,onDragOver:m,onDragEnd:g},x=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:[x&&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(Ene,{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(Qt,{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"&&f()}})]})]})},lv=["todo","in progress","done"];function cl(e){const t={tasks:[],statuses:lv,view:{},error:"",payload:{data:[],statuses:lv}};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):lv,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 Tne(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 v$(e,t){return!e||t==="board"&&e==="status"?"label":e}function SR(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 Rne(e,t,n,r){var c;const{groupBy:s,sortDesc:i}=t,o=v$(t.sortBy,r),l=e.map((d,f)=>({task:d,index:f}));if(!s)return[{key:"__all__",label:"",tasks:SR(l,o,i??!1,n)}];const a=new Map,u=[];for(const d of l){let f;s==="status"?f=[d.task.status??"todo"]:s==="priority"?f=[String(d.task.priority??0)]:f=(c=d.task.tags)!=null&&c.length?d.task.tags:["untagged"];for(const h of f)a.has(h)||(a.set(h,[]),u.push(h)),a.get(h).push(d)}return s==="status"?u.sort((d,f)=>{const h=n.indexOf(d),m=n.indexOf(f);return(h===-1?999:h)-(m===-1?999:m)}):s==="priority"?u.sort((d,f)=>Number(d)-Number(f)):u.sort((d,f)=>d.localeCompare(f)),u.map(d=>{const f=s==="priority"?pc[Number(d)]??d:d;return{key:d,label:f,tasks:SR(a.get(d)??[],o,i??!1,n)}})}function jne({content:e,setContent:t,setIsDirty:n,setLastEditAt:r,lastSaved:s}){const[i,o]=y.useState("list"),l=y.useMemo(()=>cl(e),[e]),{tasks:a,statuses:u,view:c,error:d}=l,f=y.useCallback(O=>{const N=JSON.stringify(O,null,2);t(N),n(N!==(s??"")),r(Date.now())},[s,t,n,r]),h=y.useCallback((O,N)=>{const j=cl(e).payload;f({...j,data:O,statuses:N??j.statuses})},[e,f]),m=y.useCallback(O=>{const N=cl(e).payload,j={...N.view??{},...O};f({...N,view:j})},[e,f]),g=y.useCallback((O,N="todo")=>{const j=cl(e).payload,P=j.statuses.includes(N)?j.statuses:[...j.statuses,N];h([...a,{label:O,status:N,priority:0,tags:[]}],P)},[h,e,a]),v=y.useCallback((O,N)=>{const j=a.map((P,z)=>z===O?{...P,...N}:P);if(N.status){const P=cl(e).payload,z=P.statuses.includes(N.status)?P.statuses:[...P.statuses,N.status];h(j,z)}else h(j)},[h,e,a]),x=y.useCallback(O=>{h(a.filter((N,j)=>j!==O))},[h,a]),w=y.useCallback(O=>{const N=a[O];if(!N)return;const j=N.status==="done"?"todo":"done";v(O,{status:j})},[a,v]),b=y.useCallback(O=>{if(u.includes(O))return;const N=cl(e).payload;f({...N,statuses:[...N.statuses,O]})},[e,f,u]),C=y.useCallback(O=>{const N=cl(e).payload,j=N.statuses.filter(z=>z!==O);if(j.length===0)return;const P=N.data.map(z=>(z.status??"todo")===O?{...z,status:j[0]}:z);f({...N,data:P,statuses:j})},[e,f]),S=y.useMemo(()=>Tne(a,c),[a,c]),k=y.useMemo(()=>Rne(S,c,u,i),[S,c,u,i]),E=y.useMemo(()=>{const O=new Set;for(const N of a)for(const j of N.tags??[])O.add(j);return[...O].sort()},[a]),T=v$(c.sortBy,i);return{tasks:a,filteredTasks:S,groups:k,error:d,statuses:u,view:c,resolvedSortBy:T,updateView:m,allTags:E,viewMode:i,setViewMode:o,addTask:g,updateTask:v,removeTask:x,toggleDone:w,addStatus:b,removeStatus:C}}const Zw=({trigger:e,children:t})=>{const[n,r]=y.useState(!1),s=y.useRef(null);return y.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})]})},gd=({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}),CR=[{value:null,label:"None"},{value:"status",label:"Status"},{value:"priority",label:"Priority"},{value:"tag",label:"Tag"}],ER=[{value:"label",label:"Name"},{value:"priority",label:"Priority"},{value:"status",label:"Status"}],Mne=({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=f=>{const h=r.includes(f)?r.filter(m=>m!==f):[...r,f];n({filters:{...e.filters,status:h.length?{exclude:h}:void 0}})},o=f=>{const h=s.includes(f)?s.filter(m=>m!==f):[...s,f];n({filters:{...e.filters,priority:h.length?{exclude:h}:void 0}})},l=r.length>0||s.length>0;return p.jsxs(Zw,{trigger:p.jsxs(te,{variant:"ghost",size:"sm",className:`h-7 gap-1 text-xs ${l?"text-foreground":""}`,children:[p.jsx(HA,{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(f=>p.jsx(gd,{label:f,active:!r.includes(f),onClick:()=>i(f)},f)),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(f=>p.jsx(gd,{label:pc[f],active:!s.includes(f),onClick:()=>o(f)},f))]})},One=()=>{var C,S;const{main:{content:e,setContent:t,setIsDirty:n,setLastEditAt:r}}=Nr(),{tasks:s,filteredTasks:i,groups:o,error:l,viewMode:a,setViewMode:u,addTask:c,updateTask:d,removeTask:f,toggleDone:h,statuses:m,addStatus:g,view:v,resolvedSortBy:x,updateView:w}=jne({content:e,setContent:t,setIsDirty:n,setLastEditAt:r});if(l)return p.jsx("div",{className:"text-sm text-destructive",children:l});const b=((C=ER.find(k=>k.value===x))==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(te,{variant:a==="list"?"secondary":"ghost",size:"sm",className:"h-7 gap-1 text-xs",onClick:()=>u("list"),children:[p.jsx(QA,{className:"h-3.5 w-3.5"}),"List"]}),p.jsxs(te,{variant:a==="board"?"secondary":"ghost",size:"sm",className:"h-7 gap-1 text-xs",onClick:()=>u("board"),children:[p.jsx($U,{className:"h-3.5 w-3.5"}),"Board"]}),p.jsx("div",{className:"mx-1 h-4 w-px bg-border"}),a==="list"&&p.jsx(Zw,{trigger:p.jsxs(te,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-xs",children:[p.jsx(UA,{className:"h-3.5 w-3.5"}),v.groupBy?(S=CR.find(k=>k.value===v.groupBy))==null?void 0:S.label:"Group"]}),children:CR.map(k=>p.jsx(gd,{label:k.label,active:v.groupBy===k.value,onClick:()=>w({groupBy:k.value})},k.label))}),p.jsxs(Zw,{trigger:p.jsxs(te,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-xs",children:[v.sortDesc?p.jsx(qH,{className:"h-3.5 w-3.5"}):p.jsx(VH,{className:"h-3.5 w-3.5"}),b]}),children:[ER.filter(k=>!(a==="board"&&k.value==="status")).map(k=>p.jsx(gd,{label:k.label,active:x===k.value,onClick:()=>w({sortBy:k.value})},k.label)),p.jsx("div",{className:"my-1 border-t border-border"}),p.jsx(gd,{label:v.sortDesc?"Ascending":"Descending",onClick:()=>w({sortDesc:!v.sortDesc})})]}),p.jsx(Mne,{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(Nne,{groups:o,statuses:m,onToggleDone:h,onUpdate:d,onRemove:f,onAdd:c}):p.jsx(wne,{tasks:i,statuses:m,onUpdate:d,onRemove:f,onAdd:c,onAddStatus:g})]})},Pne=()=>{const{main:{active:e}}=Nr();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(OK,{}),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(nne,{}):null,(e==null?void 0:e.type)==="prompt"?p.jsx(sne,{}):null,(e==null?void 0:e.type)==="json"?p.jsx(yG,{}):null,(e==null?void 0:e.type)==="app"?p.jsx(AK,{docName:e.name}):null,(e==null?void 0:e.type)==="tasks"?p.jsx(One,{}):null]})]})};function NR(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 Ane=({agentId:e,currentName:t,open:n,onOpenChange:r})=>{const[s,i]=y.useState(t??""),{updateAgent:o}=If(),l=a=>{a.preventDefault();const u=s.trim();u&&(o({agentId:e,name:u}),r(!1))};return p.jsx(Xs,{open:n,onOpenChange:r,children:p.jsxs(Cs,{className:"max-w-sm",children:[p.jsx(ei,{children:p.jsx(ti,{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(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>r(!1),children:"Cancel"}),p.jsx(te,{type:"submit",size:"sm",disabled:!s.trim(),children:"Save"})]})]})]})})},_ne=({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 ",NR(e.createdAt)]}),t&&p.jsxs("span",{children:["Updated ",NR(e.updatedAt)]})]})},TR=({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(_ne,{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(ZU,{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(im,{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(da,{className:"h-3 w-3 text-muted-foreground hover:text-destructive"})})]})]}),Ine=({selectedId:e,onSelect:t})=>{const{agents:n,isLoading:r,createAgent:s,archiveAgent:i,deleteAgent:o}=If(),[l,a]=y.useState(!1),[u,c]=y.useState(null),d=y.useMemo(()=>n.filter(x=>!x.archived),[n]),f=y.useMemo(()=>n.filter(x=>x.archived),[n]),h=()=>{s(void 0,{onSuccess:x=>t(x.id)})},m=(x,w)=>{w.stopPropagation(),i(x)},g=(x,w)=>{w.stopPropagation(),window.confirm("Are you sure you want to delete this conversation? This action cannot be undone.")&&o(x)},v=x=>{c(x)};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(te,{type:"button",variant:"ghost",size:"sm",onClick:h,className:"h-6 w-6 p-0",children:p.jsx(Qt,{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:h,className:"mt-1 text-xs text-primary hover:underline",children:"Create one"})]}):p.jsx("div",{className:"space-y-1",children:d.map(x=>p.jsx(TR,{agent:x,isActive:x.id===e,onSelect:()=>t(x.id),onArchive:w=>m(x.id,w),onRename:()=>v(x)},x.id))}),f.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(te,{type:"button",variant:"ghost",className:"h-auto px-0 py-0 text-xs font-medium text-muted-foreground hover:text-foreground",onClick:()=>a(x=>!x),children:l?"Hide":"Show"})]}),l&&p.jsx("div",{className:"space-y-1 opacity-60",children:f.map(x=>p.jsx(TR,{agent:x,isActive:x.id===e,onSelect:()=>t(x.id),onArchive:w=>m(x.id,w),onRename:()=>v(x),onDelete:w=>g(x.id,w)},x.id))})]})]})]}),u&&p.jsx(Ane,{agentId:u.id,currentName:u.name,open:!!u,onOpenChange:x=>{x||c(null)}})]})};function Dne(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 w$=({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(ji,{className:"h-3 w-3 text-muted-foreground"}):p.jsx(Du,{className:"h-3 w-3 text-muted-foreground"})}):p.jsx("span",{className:"h-3 w-3 shrink-0"}),p.jsx(uc,{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(w$,{node:u,depth:t+1,selected:n,onSelect:r,expanded:s,onToggle:i},u.path)):null]})},Lne=({doc:e,folders:t,onMove:n,onClose:r})=>{const s=e.name.includes("/")?e.name.slice(0,e.name.lastIndexOf("/")):"",[i,o]=y.useState(s),[l,a]=y.useState(()=>{const g=new Set;if(s){const v=s.split("/");for(let x=1;x<=v.length;x++)g.add(v.slice(0,x).join("/"))}return g}),[u,c]=y.useState(!1),d=Dne(t),f=g=>{a(v=>{const x=new Set(v);return x.has(g)?x.delete(g):x.add(g),x})},h=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(uc,{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(w$,{node:g,depth:1,selected:i,onSelect:o,expanded:l,onToggle:f},g.path))]}),p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx(te,{type:"button",variant:"ghost",onClick:r,children:"Cancel"}),p.jsx(te,{type:"button",onClick:h,disabled:u||i===s,children:u?"Moving…":"Move"})]})]})})},$ne=({open:e,onOpenChange:t,parentFolder:n,folders:r,onCreate:s})=>{const[i,o]=y.useState(""),[l,a]=y.useState(""),u=y.useRef(null);y.useEffect(()=>{e&&(o(""),a(""),setTimeout(()=>{var f;return(f=u.current)==null?void 0:f.focus()},0))},[e]);const c=async()=>{const f=i.trim();if(!f){t(!1);return}const h=n?`${n}/${f}`:f;if(r.includes(h)){a("Folder already exists");return}a("");try{await s(h),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:f=>{o(f.target.value),l&&a("")},onKeyDown:f=>{f.key==="Enter"&&c(),f.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(te,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),p.jsx(te,{type:"button",onClick:c,disabled:!i.trim(),children:"Create"})]})]})})},rS=({open:e,setOpen:t,ref:n})=>{y.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])},b$=(e,t=0)=>{let n=t;for(const r of e)if(r.type==="folder"){const s=b$(r.children,t+1);n=Math.max(n,s)}return n},k$=({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))}),zne=({doc:e,active:t,navigate:n,encodePath:r,runCommandAction:s,onMoveDoc:i,depth:o,indentWidth:l})=>{const[a,u]=y.useState(!1),c=y.useRef(null);rS({open:a,setOpen:u,ref:c});const d=(t==null?void 0:t.name)===e.name,f=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(k$,{depth:o,indentWidth:l}),p.jsxs("div",{className:"flex min-w-0 flex-1 items-center px-2 py-1.5",children:[p.jsx(te,{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(JA,{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??f}),p.jsx("span",{className:"truncate text-[10px] text-muted-foreground",children:f})]})]})}),p.jsxs("div",{className:"relative",ref:a?c:null,children:[p.jsx(te,{type:"button",size:"icon",variant:"ghost",className:"h-6 w-6 shrink-0 rounded-md bg-transparent hover:bg-transparent",onClick:()=>u(h=>!h),children:p.jsx(BA,{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(Ak,{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(_k,{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(Ik,{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]})]})]})},Fne=({node:e,depth:t,...n})=>{const r=n.expanded.has(e.path),[s,i]=y.useState(!1),o=y.useRef(null);return rS({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(k$,{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(ji,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):p.jsx(Du,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),p.jsx(uc,{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(te,{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(BA,{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:[h$.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(S$,{items:e.children,depth:t+1,...n})}):null]})},S$=({items:e,depth:t,...n})=>p.jsx(p.Fragment,{children:e.map(r=>r.type==="folder"?p.jsx(Fne,{node:r,depth:t,...n},r.path):p.jsx(zne,{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))}),Bne=({docs:e,folders:t,active:n,navigate:r,encodePath:s,runCommandAction:i,openFor:o,createFolder:l,deleteFolder:a,moveDoc:u})=>{const[c,d]=y.useState(()=>new Set),[f,h]=y.useState(!1);y.useEffect(()=>{if(n!=null&&n.name.includes("/")){const I=n.name.split("/"),L=new Set;for(let H=0;H<I.length-1;H++){const K=I.slice(0,H+1).join("/");L.add(K)}d(H=>new Set([...H,...L]))}},[n==null?void 0:n.name]);const[m,g]=y.useState(null),v=I=>{const L=p$(I),H=L==null?void 0:L.icon;return H?p.jsx(H,{className:"h-4 w-4"}):null},x=I=>{d(L=>{const H=new Set(L);return H.has(I)?H.delete(I):H.add(I),H})},w=m$(e,t),C=y.useMemo(()=>b$(w),[w])<4?16:8,S=()=>{d(new Set)},k=I=>{g(I),I&&d(L=>new Set([...L,I])),h(!0)},E=async I=>{await l(I),d(L=>new Set([...L,I]))},[T,O]=y.useState(null),N={active:n,navigate:r,encodePath:s,runCommandAction:i,openFor:o,expanded:c,toggleExpanded:x,onOpenCreateFolderDialog:k,onMoveDoc:O,deleteFolder:a,renderDocTypeIcon:v,indentWidth:C},[j,P]=y.useState(!1),z=y.useRef(null);return rS({open:j,setOpen:P,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(te,{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(nU,{className:"h-3 w-3"})}):null]}),p.jsxs("div",{className:"relative flex",ref:z,children:[p.jsx(te,{type:"button",size:"icon",variant:"ghost",onClick:()=>o("markdown"),title:"New document",children:p.jsx(Qt,{className:"h-4 w-4"})}),p.jsx(te,{type:"button",size:"icon",variant:"ghost",onClick:()=>P(I=>!I),"aria-expanded":j,"aria-haspopup":"menu",children:p.jsx(ji,{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:()=>{P(!1),k(null)},children:[v("folder"),"New Folder"]}),h$.map(I=>p.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1 text-left hover:bg-accent",onClick:()=>{P(!1),o(I.type)},children:[v(I.type),"New ",I.label]},I.type))]}):null]})]}),p.jsx("ul",{className:"space-y-0.5",children:p.jsx(S$,{items:w,depth:0,...N})}),T?p.jsx(Lne,{doc:T,folders:t,onMove:u,onClose:()=>O(null)}):null,f?p.jsx($ne,{open:f,onOpenChange:h,parentFolder:m,folders:t,onCreate:E}):null]})};function Vne(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 Hne=({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(kU,{className:"h-3.5 w-3.5 shrink-0"}),p.jsx("span",{className:"truncate",children:e})]}),Une=({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(ji,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):p.jsx(Du,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),p.jsx(uc,{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(C$,{items:e.children,depth:t+1,expanded:n,toggleExpanded:r,activeFile:s,onSelectFile:i})}):null]})},C$=({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(Une,{node:o,depth:t,expanded:n,toggleExpanded:r,activeFile:s,onSelectFile:i},o.path):p.jsx(Hne,{name:o.name,path:o.path,depth:t,isActive:s===o.path,onSelect:i},o.path))}),qne=({files:e,folders:t,activeFile:n,onSelectFile:r})=>{const[s,i]=y.useState(()=>new Set);y.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=Vne(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(Ok,{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(C$,{items:l,depth:0,expanded:s,toggleExpanded:o,activeFile:n,onSelectFile:r})})]})},Wne=()=>{var o;const{activeProject:e}=$t(),t=(e==null?void 0:e.id)??"",n=Ue.code.list.useQuery({projectId:t},{enabled:!!e,refetchInterval:1e4,refetchOnWindowFocus:!1}),r=y.useMemo(()=>{var l;return((l=n.data)==null?void 0:l.files)??[]},[n.data]),s=y.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}},Kne=({text:e})=>{const t=y.useRef(null),n=y.useRef(null);return y.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})})},av=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"}`,Qne=({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:av(e==="docs"),children:"Docs"}),p.jsx("button",{type:"button",onClick:()=>t("agents"),className:av(e==="agents"),children:"Agents"}),n?p.jsx("button",{type:"button",onClick:()=>t("code"),className:av(e==="code"),children:"Code"}):null]})}),Gne=({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:f,folders:h,createFolder:m,deleteFolder:g,moveDoc:v}}=Nr(),{activeProject:x}=$t(),{onOpenChange:w}=v_(),{openFor:b}=m2(),{files:C,folders:S,hasCodeDir:k}=Wne(),[E,T]=y.useState([]),[O,N]=y.useState(!0),j=()=>T([]),P=L=>{T(H=>H.includes(L)?H.filter(K=>K!==L):[...H,L].sort())},z=y.useMemo(()=>E.length===0?f:f.filter(L=>E.every(H=>{var K;return(K=L.tags)==null?void 0:K.includes(H)})),[f,E]),I=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:[x?p.jsx(Kne,{text:x.name}):null,p.jsx(Qne,{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(Pk,{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:Xa?"⌘ 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(te,{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(te,{type:"button",variant:"ghost",className:"h-auto px-0 py-0 text-xs font-medium text-muted-foreground hover:text-foreground",onClick:()=>N(L=>!L),children:O?"Show":"Hide"})]}),!O&&I?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:()=>P(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(Bne,{docs:z,folders:h,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(qne,{files:C,folders:S,activeFile:s,onSelectFile:i})})}):p.jsx(Ine,{selectedId:n,onSelect:r})]})})},E$=["shift","alt","meta","mod","ctrl","control"],Jne={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 $o(e){return(Jne[e.trim()]||e.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function N$(e){return E$.includes(e)}function uv(e,t=","){return e.toLowerCase().split(t)}function cv(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=>$o(c))):o=e.toLocaleLowerCase().split(t).map(c=>$o(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=>!E$.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&&T$([$o(e.code)])}),document.addEventListener("keyup",e=>{e.code!==void 0&&R$([$o(e.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{Ti.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{Ti.clear()},0)}));const Ti=new Set;function sS(e){return Array.isArray(e)}function Zne(e,t=","){return(sS(e)?e:e.split(t)).every(n=>Ti.has(n.trim().toLowerCase()))}function T$(e){const t=Array.isArray(e)?e:[e];Ti.has("meta")&&Ti.forEach(n=>{N$(n)||Ti.delete(n.toLowerCase())}),t.forEach(n=>{Ti.add(n.toLowerCase())})}function R$(e){const t=Array.isArray(e)?e:[e];e==="meta"?Ti.clear():t.forEach(n=>{Ti.delete(n.toLowerCase())})}function Yne(e,t,n){(typeof n=="function"&&n(e,t)||n===!0)&&e.preventDefault()}function Xne(e,t,n){return typeof n=="function"?n(e,t):n===!0||n===void 0}const ere=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"];function tre(e){return j$(e,ere)}function j$(e,t=!1){const{target:n,composed:r}=e;let s,i;return nre(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),sS(t)?!!(s&&t&&t.some(o=>o.toLowerCase()===s.toLowerCase()||o===i)):!!(s&&t&&t)}function nre(e){return!!e.tagName&&!e.tagName.startsWith("-")&&e.tagName.includes("-")}function rre(e,t){return e.length===0&&t?!1:t?e.some(n=>t.includes(n))||e.includes("*"):!0}const sre=(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:f,metaKey:h,shiftKey:m,altKey:g}=e,v=$o(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(!h&&!f)return!1}else if(s!==h&&v!=="meta"&&v!=="os"||l!==f&&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},ire=y.createContext(void 0),ore=()=>y.useContext(ire);function M$(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&&M$(e[r],t[r]),!0):e===t}const lre=y.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),are=()=>y.useContext(lre);function ure(e){const t=y.useRef(void 0);return M$(t.current,e)||(t.current=e),t.current}const RR=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},cre=typeof window<"u"?y.useLayoutEffect:y.useEffect;function dre(e,t,n,r){const s=y.useRef(null),i=y.useRef(!1),o=Array.isArray(n)?Array.isArray(r)?void 0:r:n,l=sS(e)?e.join(o==null?void 0:o.delimiter):e,a=Array.isArray(n)?n:Array.isArray(r)?r:void 0,u=y.useCallback(t,a??[]),c=y.useRef(u);a?c.current=u:c.current=t;const d=ure(o),{activeScopes:f}=are(),h=ore();return cre(()=>{if((d==null?void 0:d.enabled)===!1||!rre(f,d==null?void 0:d.scopes))return;let m=[],g;const v=(C,S=!1)=>{var k;if(!(tre(C)&&!j$(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)){RR(C);return}}(k=C.target)!=null&&k.isContentEditable&&!(d!=null&&d.enableOnContentEditable)||uv(l,d==null?void 0:d.delimiter).forEach(E=>{var O,N,j,P;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 T=cv(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(T.isSequence){g=setTimeout(()=>{m=[]},(d==null?void 0:d.sequenceTimeoutMs)??1e3);const z=T.useKey?C.key:$o(C.code);if(N$(z.toLowerCase()))return;m.push(z);const I=(O=T.keys)==null?void 0:O[m.length-1];if(z!==I){m=[],g&&clearTimeout(g);return}m.length===((N=T.keys)==null?void 0:N.length)&&(c.current(C,T),g&&clearTimeout(g),m=[])}else if(sre(C,T,d==null?void 0:d.ignoreModifiers)||(j=T.keys)!=null&&j.includes("*")){if((P=d==null?void 0:d.ignoreEventWhen)!=null&&P.call(d,C)||S&&i.current)return;if(Yne(C,T,d==null?void 0:d.preventDefault),!Xne(C,T,d==null?void 0:d.enabled)){RR(C);return}c.current(C,T),S||(i.current=!0)}})}},x=C=>{C.code!==void 0&&(T$($o(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&&(R$($o(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",x,o==null?void 0:o.eventListenerOptions),h&&uv(l,d==null?void 0:d.delimiter).forEach(C=>{h.addHotkey(cv(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",x,o==null?void 0:o.eventListenerOptions),h&&uv(l,d==null?void 0:d.delimiter).forEach(C=>{h.removeHotkey(cv(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,f]),s}var fre=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"}),hre="VisuallyHidden",O$=y.forwardRef((e,t)=>p.jsx(Mn.span,{...e,ref:t,style:{...fre,...e.style}}));O$.displayName=hre;var pre=O$,[Sy]=qg("Tooltip",[ey]),Cy=ey(),P$="TooltipProvider",mre=700,Yw="tooltip.open",[gre,iS]=Sy(P$),A$=e=>{const{__scopeTooltip:t,delayDuration:n=mre,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=e,o=y.useRef(!0),l=y.useRef(!1),a=y.useRef(0);return y.useEffect(()=>{const u=a.current;return()=>window.clearTimeout(u)},[]),p.jsx(gre,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:y.useCallback(()=>{window.clearTimeout(a.current),o.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:y.useCallback(u=>{l.current=u},[]),disableHoverableContent:s,children:i})};A$.displayName=P$;var df="Tooltip",[yre,Ey]=Sy(df),_$=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:l}=e,a=iS(df,e.__scopeTooltip),u=Cy(t),[c,d]=y.useState(null),f=ps(),h=y.useRef(0),m=o??a.disableHoverableContent,g=l??a.delayDuration,v=y.useRef(!1),[x,w]=Lk({prop:r,defaultProp:s??!1,onChange:E=>{E?(a.onOpen(),document.dispatchEvent(new CustomEvent(Yw))):a.onClose(),i==null||i(E)},caller:df}),b=y.useMemo(()=>x?v.current?"delayed-open":"instant-open":"closed",[x]),C=y.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,w(!0)},[w]),S=y.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w(!1)},[w]),k=y.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,w(!0),h.current=0},g)},[g,w]);return y.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),p.jsx(dI,{...u,children:p.jsx(yre,{scope:t,contentId:f,open:x,stateAttribute:b,trigger:c,onTriggerChange:d,onTriggerEnter:y.useCallback(()=>{a.isOpenDelayedRef.current?k():C()},[a.isOpenDelayedRef,k,C]),onTriggerLeave:y.useCallback(()=>{m?S():(window.clearTimeout(h.current),h.current=0)},[S,m]),onOpen:C,onClose:S,disableHoverableContent:m,children:n})})};_$.displayName=df;var Xw="TooltipTrigger",I$=y.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Ey(Xw,n),i=iS(Xw,n),o=Cy(n),l=y.useRef(null),a=Er(t,l,s.onTriggerChange),u=y.useRef(!1),c=y.useRef(!1),d=y.useCallback(()=>u.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),p.jsx(f1,{asChild:!0,...o,children:p.jsx(Mn.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:a,onPointerMove:Kt(e.onPointerMove,f=>{f.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),c.current=!0)}),onPointerLeave:Kt(e.onPointerLeave,()=>{s.onTriggerLeave(),c.current=!1}),onPointerDown:Kt(e.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Kt(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:Kt(e.onBlur,s.onClose),onClick:Kt(e.onClick,s.onClose)})})});I$.displayName=Xw;var xre="TooltipPortal",[rfe,vre]=Sy(xre,{forceMount:void 0}),nc="TooltipContent",D$=y.forwardRef((e,t)=>{const n=vre(nc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=e,o=Ey(nc,e.__scopeTooltip);return p.jsx(fa,{present:r||o.open,children:o.disableHoverableContent?p.jsx(L$,{side:s,...i,ref:t}):p.jsx(wre,{side:s,...i,ref:t})})}),wre=y.forwardRef((e,t)=>{const n=Ey(nc,e.__scopeTooltip),r=iS(nc,e.__scopeTooltip),s=y.useRef(null),i=Er(t,s),[o,l]=y.useState(null),{trigger:a,onClose:u}=n,c=s.current,{onPointerInTransitChange:d}=r,f=y.useCallback(()=>{l(null),d(!1)},[d]),h=y.useCallback((m,g)=>{const v=m.currentTarget,x={x:m.clientX,y:m.clientY},w=Ere(x,v.getBoundingClientRect()),b=Nre(x,w),C=Tre(g.getBoundingClientRect()),S=jre([...b,...C]);l(S),d(!0)},[d]);return y.useEffect(()=>()=>f(),[f]),y.useEffect(()=>{if(a&&c){const m=v=>h(v,c),g=v=>h(v,a);return a.addEventListener("pointerleave",m),c.addEventListener("pointerleave",g),()=>{a.removeEventListener("pointerleave",m),c.removeEventListener("pointerleave",g)}}},[a,c,h,f]),y.useEffect(()=>{if(o){const m=g=>{const v=g.target,x={x:g.clientX,y:g.clientY},w=(a==null?void 0:a.contains(v))||(c==null?void 0:c.contains(v)),b=!Rre(x,o);w?f():b&&(f(),u())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[a,c,o,u,f]),p.jsx(L$,{...e,ref:i})}),[bre,kre]=Sy(df,{isInside:!1}),Sre=Q9("TooltipContent"),L$=y.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=e,a=Ey(nc,n),u=Cy(n),{onClose:c}=a;return y.useEffect(()=>(document.addEventListener(Yw,c),()=>document.removeEventListener(Yw,c)),[c]),y.useEffect(()=>{if(a.trigger){const d=f=>{const h=f.target;h!=null&&h.contains(a.trigger)&&c()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[a.trigger,c]),p.jsx(Wg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:p.jsxs(fI,{"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(Sre,{children:r}),p.jsx(bre,{scope:n,isInside:!0,children:p.jsx(pre,{id:a.contentId,role:"tooltip",children:s||r})})]})})});D$.displayName=nc;var $$="TooltipArrow",Cre=y.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Cy(n);return kre($$,n).isInside?null:p.jsx(hI,{...s,...r,ref:t})});Cre.displayName=$$;function Ere(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 Nre(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 Tre(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 Rre(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,f=a.y;c>r!=f>r&&n<(d-u)*(r-c)/(f-c)+u&&(s=!s)}return s}function jre(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),Mre(t)}function Mre(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 Ore=A$,Pre=_$,Are=I$,z$=D$;const _re=Ore,Cp=Pre,Ep=Are,yd=y.forwardRef(({className:e,sideOffset:t=4,...n},r)=>p.jsx(z$,{ref:r,sideOffset:t,className:dt("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}));yd.displayName=z$.displayName;const Ire=Xa?"⌘":"Ctrl",Dre=({name:e,emoji:t,isActive:n,shortcut:r,onClick:s})=>p.jsxs(Cp,{children:[p.jsx(Ep,{asChild:!0,children:p.jsx("button",{type:"button",onClick:s,className:dt("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(yd,{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]})})]}),Lre=({panel:e,onPanelChange:t})=>{const{projects:n,activeProject:r,setActiveProjectId:s,openCreateProject:i}=$t();return dre(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(_re,{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(Dre,{name:o.name,emoji:o.emoji,isActive:o.id===(r==null?void 0:r.id)&&e==="docs",shortcut:l<9?`${Ire}${l+1}`:null,onClick:()=>s(o.id)},o.id)),p.jsxs(Cp,{children:[p.jsx(Ep,{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(Qt,{className:"h-5 w-5"})})}),p.jsx(yd,{side:"right",children:"Add project"})]}),p.jsxs(Cp,{children:[p.jsx(Ep,{asChild:!0,children:p.jsx("button",{type:"button",onClick:()=>t(e==="commands"?"docs":"commands"),className:dt("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(uU,{className:"h-5 w-5"})})}),p.jsx(yd,{side:"right",children:"Keyboard shortcuts"})]}),p.jsxs(Cp,{children:[p.jsx(Ep,{asChild:!0,children:p.jsx("button",{type:"button",onClick:()=>t(e==="settings"?"docs":"settings"),className:dt("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(YA,{className:"h-5 w-5"})})}),p.jsx(yd,{side:"right",children:"Settings"})]})]})]})})},$re=()=>{const[e,t]=y.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(te,{size:"sm",variant:"outline",onClick:n,children:[p.jsx(QH,{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})]})},zre=()=>{var h,m;const e=Ue.config.get.useQuery(),t=Ue.useUtils(),n=Ue.config.set.useMutation({onSuccess:()=>t.config.get.invalidate()}),[r,s]=y.useState(""),[i,o]=y.useState(!1),[l,a]=y.useState(!1),u=((h=e.data)==null?void 0:h.hasAnthropicApiKey)??!1,c=((m=e.data)==null?void 0:m.anthropicApiKey)??"",d=()=>{r.trim()&&(n.mutate({anthropicApiKey:r.trim()}),s(""),o(!1))},f=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:f,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(yU,{className:"h-3.5 w-3.5"}):p.jsx(vU,{className:"h-3.5 w-3.5"})})]}),p.jsx(te,{size:"sm",onClick:d,disabled:!r.trim(),children:"Save"}),p.jsx(te,{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(ac,{className:"h-3.5 w-3.5 text-green-500"})]}):p.jsx("span",{className:"text-sm text-muted-foreground",children:"Not set"}),p.jsx(te,{size:"sm",variant:"ghost",onClick:()=>o(!0),children:u?"Change":"Set"})]})},Fre=()=>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(YA,{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(zre,{})]}),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($re,{})]})]})}),Bre=({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:iw(e.shortcut)})]}),Vre=()=>{const e=y.useMemo(()=>m_().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(FU,{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(Bre,{command:t},t.id))})]})})};function Hre(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Ure=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qre=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Wre={};function jR(e,t){return(Wre.jsx?qre:Ure).test(e)}const Kre=/[ \t\n\f\r]/g;function Qre(e){return typeof e=="object"?e.type==="text"?MR(e.value):!1:MR(e)}function MR(e){return e.replace(Kre,"")===""}class Hf{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Hf.prototype.normal={};Hf.prototype.property={};Hf.prototype.space=void 0;function F$(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Hf(n,r,t)}function eb(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 Gre=0;const ze=ga(),zt=ga(),tb=ga(),re=ga(),pt=ga(),du=ga(),ur=ga();function ga(){return 2**++Gre}const nb=Object.freeze(Object.defineProperty({__proto__:null,boolean:ze,booleanish:zt,commaOrSpaceSeparated:ur,commaSeparated:du,number:re,overloadedBoolean:tb,spaceSeparated:pt},Symbol.toStringTag,{value:"Module"})),dv=Object.keys(nb);class oS extends ar{constructor(t,n,r,s){let i=-1;if(super(t,n),OR(this,"space",s),typeof r=="number")for(;++i<dv.length;){const o=dv[i];OR(this,dv[i],(r&nb[o])===nb[o])}}}oS.prototype.defined=!0;function OR(e,t,n){n&&(e[t]=n)}function mc(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new oS(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[eb(r)]=r,n[eb(i.attribute)]=r}return new Hf(t,n,e.space)}const B$=mc({properties:{ariaActiveDescendant:null,ariaAtomic:zt,ariaAutoComplete:null,ariaBusy:zt,ariaChecked:zt,ariaColCount:re,ariaColIndex:re,ariaColSpan:re,ariaControls:pt,ariaCurrent:null,ariaDescribedBy:pt,ariaDetails:null,ariaDisabled:zt,ariaDropEffect:pt,ariaErrorMessage:null,ariaExpanded:zt,ariaFlowTo:pt,ariaGrabbed:zt,ariaHasPopup:null,ariaHidden:zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:pt,ariaLevel:re,ariaLive:null,ariaModal:zt,ariaMultiLine:zt,ariaMultiSelectable:zt,ariaOrientation:null,ariaOwns:pt,ariaPlaceholder:null,ariaPosInSet:re,ariaPressed:zt,ariaReadOnly:zt,ariaRelevant:null,ariaRequired:zt,ariaRoleDescription:pt,ariaRowCount:re,ariaRowIndex:re,ariaRowSpan:re,ariaSelected:zt,ariaSetSize:re,ariaSort:null,ariaValueMax:re,ariaValueMin:re,ariaValueNow:re,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function V$(e,t){return t in e?e[t]:t}function H$(e,t){return V$(e,t.toLowerCase())}const Jre=mc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:du,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:re,colSpan:null,content:null,contentEditable:zt,controls:ze,controlsList:pt,coords:re|du,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ze,defer:ze,dir:null,dirName:null,disabled:ze,download:tb,draggable:zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ze,formTarget:null,headers:pt,height:re,hidden:tb,high:re,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:re,manifest:null,max:null,maxLength:re,media:null,method:null,min:null,minLength:re,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:re,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:re,rowSpan:re,sandbox:pt,scope:null,scoped:ze,seamless:ze,selected:ze,shadowRootClonable:ze,shadowRootDelegatesFocus:ze,shadowRootMode:null,shape:null,size:re,sizes:null,slot:null,span:re,spellCheck:zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:re,step:null,style:null,tabIndex:re,target:null,title:null,translate:null,type:null,typeMustMatch:ze,useMap:null,value:zt,width:re,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:pt,axis:null,background:null,bgColor:null,border:re,borderColor:null,bottomMargin:re,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:re,leftMargin:re,link:null,longDesc:null,lowSrc:null,marginHeight:re,marginWidth:re,noResize:ze,noHref:ze,noShade:ze,noWrap:ze,object:null,profile:null,prompt:null,rev:null,rightMargin:re,rules:null,scheme:null,scrolling:zt,standby:null,summary:null,text:null,topMargin:re,valueType:null,version:null,vAlign:null,vLink:null,vSpace:re,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ze,disableRemotePlayback:ze,prefix:null,property:null,results:re,security:null,unselectable:null},space:"html",transform:H$}),Zre=mc({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:ur,accentHeight:re,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:re,amplitude:re,arabicForm:null,ascent:re,attributeName:null,attributeType:null,azimuth:re,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:re,by:null,calcMode:null,capHeight:re,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:re,diffuseConstant:re,direction:null,display:null,dur:null,divisor:re,dominantBaseline:null,download:ze,dx:null,dy:null,edgeMode:null,editable:null,elevation:re,enableBackground:null,end:null,event:null,exponent:re,externalResourcesRequired:null,fill:null,fillOpacity:re,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:du,g2:du,glyphName:du,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:re,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:re,horizOriginX:re,horizOriginY:re,id:null,ideographic:re,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:re,k:re,k1:re,k2:re,k3:re,k4:re,kernelMatrix:ur,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:re,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:re,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:re,overlineThickness:re,paintOrder:null,panose1:null,path:null,pathLength:re,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:pt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:re,pointsAtY:re,pointsAtZ:re,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ur,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ur,rev:ur,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ur,requiredFeatures:ur,requiredFonts:ur,requiredFormats:ur,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:re,specularExponent:re,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:re,strikethroughThickness:re,string:null,stroke:null,strokeDashArray:ur,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:re,strokeOpacity:re,strokeWidth:null,style:null,surfaceScale:re,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ur,tabIndex:re,tableValues:null,target:null,targetX:re,targetY:re,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ur,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:re,underlineThickness:re,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:re,values:null,vAlphabetic:re,vMathematical:re,vectorEffect:null,vHanging:re,vIdeographic:re,version:null,vertAdvY:re,vertOriginX:re,vertOriginY:re,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:re,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:V$}),U$=mc({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()}}),q$=mc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:H$}),W$=mc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Yre={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"},Xre=/[A-Z]/g,PR=/-[a-z]/g,ese=/^data[-\w.:]+$/i;function tse(e,t){const n=eb(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"&&ese.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(PR,rse);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!PR.test(i)){let o=i.replace(Xre,nse);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=oS}return new s(r,t)}function nse(e){return"-"+e.toLowerCase()}function rse(e){return e.charAt(1).toUpperCase()}const sse=F$([B$,Jre,U$,q$,W$],"html"),lS=F$([B$,Zre,U$,q$,W$],"svg");function ise(e){return e.join(" ").trim()}var aS={},AR=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,ose=/\n/g,lse=/^\s*/,ase=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,use=/^:\s*/,cse=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,dse=/^[;\s]*/,fse=/^\s+|\s+$/g,hse=`
|
|
599
|
+
`,_R="/",IR="*",yl="",pse="comment",mse="declaration";function gse(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(ose);g&&(n+=g.length);var v=m.lastIndexOf(hse);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(lse)}function c(m){var g;for(m=m||[];g=d();)g!==!1&&m.push(g);return m}function d(){var m=i();if(!(_R!=e.charAt(0)||IR!=e.charAt(1))){for(var g=2;yl!=e.charAt(g)&&(IR!=e.charAt(g)||_R!=e.charAt(g+1));)++g;if(g+=2,yl===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:pse,comment:v})}}function f(){var m=i(),g=a(ase);if(g){if(d(),!a(use))return l("property missing ':'");var v=a(cse),x=m({type:mse,property:DR(g[0].replace(AR,yl)),value:v?DR(v[0].replace(AR,yl)):yl});return a(dse),x}}function h(){var m=[];c(m);for(var g;g=f();)g!==!1&&(m.push(g),c(m));return m}return u(),h()}function DR(e){return e?e.replace(fse,yl):yl}var yse=gse,xse=Mp&&Mp.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(aS,"__esModule",{value:!0});aS.default=wse;const vse=xse(yse);function wse(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,vse.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 Ny={};Object.defineProperty(Ny,"__esModule",{value:!0});Ny.camelCase=void 0;var bse=/^--[a-zA-Z0-9_-]+$/,kse=/-([a-z])/g,Sse=/^[^-]+$/,Cse=/^-(webkit|moz|ms|o|khtml)-/,Ese=/^-(ms)-/,Nse=function(e){return!e||Sse.test(e)||bse.test(e)},Tse=function(e,t){return t.toUpperCase()},LR=function(e,t){return"".concat(t,"-")},Rse=function(e,t){return t===void 0&&(t={}),Nse(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Ese,LR):e=e.replace(Cse,LR),e.replace(kse,Tse))};Ny.camelCase=Rse;var jse=Mp&&Mp.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Mse=jse(aS),Ose=Ny;function rb(e,t){var n={};return!e||typeof e!="string"||(0,Mse.default)(e,function(r,s){r&&s&&(n[(0,Ose.camelCase)(r,t)]=s)}),n}rb.default=rb;var Pse=rb;const Ase=xg(Pse),K$=Q$("end"),uS=Q$("start");function Q$(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 _se(e){const t=uS(e),n=K$(e);if(t&&n)return{start:t,end:n}}function xd(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?$R(e.position):"start"in e||"end"in e?$R(e):"line"in e||"column"in e?sb(e):""}function sb(e){return zR(e&&e.line)+":"+zR(e&&e.column)}function $R(e){return sb(e&&e.start)+"-"+sb(e&&e.end)}function zR(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=xd(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 cS={}.hasOwnProperty,Ise=new Map,Dse=/[A-Z]/g,Lse=new Set(["table","tbody","thead","tfoot","tr"]),$se=new Set(["td","th"]),G$="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function zse(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=Kse(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=Wse(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"?lS:sse,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=J$(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function J$(e,t,n){if(t.type==="element")return Fse(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Bse(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Hse(e,t,n);if(t.type==="mdxjsEsm")return Vse(e,t);if(t.type==="root")return Use(e,t,n);if(t.type==="text")return qse(e,t)}function Fse(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=lS,e.schema=s),e.ancestors.push(t);const i=Y$(e,t.tagName,!1),o=Qse(e,t);let l=fS(e,t);return Lse.has(t.tagName)&&(l=l.filter(function(a){return typeof a=="string"?!Qre(a):!0})),Z$(e,o,i,t),dS(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function Bse(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)}ff(e,t.position)}function Vse(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ff(e,t.position)}function Hse(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=lS,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:Y$(e,t.name,!0),o=Gse(e,t),l=fS(e,t);return Z$(e,o,i,t),dS(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function Use(e,t,n){const r={};return dS(r,fS(e,t)),e.create(t,e.Fragment,r,n)}function qse(e,t){return t.value}function Z$(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function dS(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Wse(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 Kse(e,t){return n;function n(r,s,i,o){const l=Array.isArray(i.children),a=uS(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 Qse(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&cS.call(t.properties,s)){const i=Jse(e,s,t.properties[s]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&$se.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 Gse(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 ff(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 ff(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function fS(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:Ise;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=J$(e,i,o);l!==void 0&&n.push(l)}return n}function Jse(e,t,n){const r=tse(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Hre(n):ise(n)),r.property==="style"){let s=typeof n=="object"?n:Zse(e,String(n));return e.stylePropertyNameCase==="css"&&(s=Yse(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?Yre[r.property]||r.property:r.attribute,n]}}function Zse(e,t){try{return Ase(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=G$+"#cannot-parse-style-attribute",s}}function Y$(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=jR(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=jR(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return cS.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);ff(e)}function ff(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=G$+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Yse(e){const t={};let n;for(n in e)cS.call(e,n)&&(t[Xse(n)]=e[n]);return t}function Xse(e){let t=e.replace(Dse,eie);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function eie(e){return"-"+e.toLowerCase()}const fv={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"]},tie={};function nie(e,t){const n=tie,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return X$(e,r,s)}function X$(e,t,n){if(rie(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 FR(e.children,t,n)}return Array.isArray(e)?FR(e,t,n):""}function FR(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=X$(e[s],t,n);return r.join("")}function rie(e){return!!(e&&typeof e=="object")}const BR=document.createElement("i");function hS(e){const t="&"+e+";";BR.innerHTML=t;const n=BR.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Zs(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 Lr(e,t){return e.length>0?(Zs(e,e.length,0,t),e):t}const VR={}.hasOwnProperty;function sie(e){const t={};let n=-1;for(;++n<e.length;)iie(t,e[n]);return t}function iie(e,t){let n;for(n in t){const s=(VR.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){VR.call(s,o)||(s[o]=[]);const l=i[o];oie(s[o],Array.isArray(l)?l:l?[l]:[])}}}function oie(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Zs(e,0,0,r)}function ez(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 fu(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Fs=ll(/[A-Za-z]/),mr=ll(/[\dA-Za-z]/),lie=ll(/[#-'*+\--9=?A-Z^-~]/);function ib(e){return e!==null&&(e<32||e===127)}const ob=ll(/\d/),aie=ll(/[\dA-Fa-f]/),uie=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 cie=ll(new RegExp("\\p{P}|\\p{S}","u")),die=ll(/\s/);function ll(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function gc(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&mr(e.charCodeAt(n+1))&&mr(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 gt(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 fie={tokenize:hie};function hie(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"),gt(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 pie={tokenize:mie},HR={tokenize:gie};function mie(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}x(r);let E=C;for(;E<t.events.length;)t.events[E][1].end={...k},E++;return Zs(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 f(b);if(s.currentConstruct&&s.currentConstruct.concrete)return m(b);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(HR,c,d)(b)}function c(b){return s&&w(),x(r),f(b)}function d(b){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(b)}function f(b){return t.containerState={},e.attempt(HR,h,m)(b)}function h(b){return r++,n.push([t.currentConstruct,t.containerState]),f(b)}function m(b){if(b===null){s&&w(),x(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),x(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 T=E,O,N;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(O){N=t.events[T][1].end;break}O=!0}for(x(r),k=E;k<t.events.length;)t.events[k][1].end={...N},k++;Zs(t.events,T+1,0,t.events.slice(E)),t.events.length=k}}function x(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 gie(e,t,n){return gt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function UR(e){if(e===null||ir(e)||die(e))return 1;if(cie(e))return 2}function pS(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 lb={name:"attention",resolveAll:yie,tokenize:xie};function yie(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},f={...e[n][1].start};qR(d,-a),qR(f,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:f},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=Lr(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Lr(u,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=Lr(u,pS(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Lr(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=Lr(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,Zs(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 xie(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=UR(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=UR(a),d=!c||c===2&&s||n.includes(a),f=!s||s===2&&c||n.includes(r);return u._open=!!(i===42?d:d&&(s||!f)),u._close=!!(i===42?f:f&&(c||!d)),t(a)}}function qR(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const vie={name:"autolink",tokenize:wie};function wie(e,t,n){let r=0;return s;function s(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return Fs(h)?(e.consume(h),o):h===64?n(h):u(h)}function o(h){return h===43||h===45||h===46||mr(h)?(r=1,l(h)):u(h)}function l(h){return h===58?(e.consume(h),r=0,a):(h===43||h===45||h===46||mr(h))&&r++<32?(e.consume(h),l):(r=0,u(h))}function a(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||ib(h)?n(h):(e.consume(h),a)}function u(h){return h===64?(e.consume(h),c):lie(h)?(e.consume(h),u):n(h)}function c(h){return mr(h)?d(h):n(h)}function d(h){return h===46?(e.consume(h),r=0,c):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):f(h)}function f(h){if((h===45||mr(h))&&r++<63){const m=h===45?f:d;return e.consume(h),m}return n(h)}}const Ty={partial:!0,tokenize:bie};function bie(e,t,n){return r;function r(i){return rt(i)?gt(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||Ie(i)?t(i):n(i)}}const tz={continuation:{tokenize:Sie},exit:Cie,name:"blockQuote",tokenize:kie};function kie(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 Sie(e,t,n){const r=this;return s;function s(o){return rt(o)?gt(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(tz,t,n)(o)}}function Cie(e){e.exit("blockQuote")}const nz={name:"characterEscape",tokenize:Eie};function Eie(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 uie(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const rz={name:"characterReference",tokenize:Nie};function Nie(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=mr,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=aie,c):(e.enter("characterReferenceValue"),i=7,o=ob,c(d))}function c(d){if(d===59&&s){const f=e.exit("characterReferenceValue");return o===mr&&!hS(r.sliceSerialize(f))?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 WR={partial:!0,tokenize:Rie},KR={concrete:!0,name:"codeFenced",tokenize:Tie};function Tie(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)?gt(e,d,"whitespace")(k):d(k))}function d(k){return k===null||Ie(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(WR,g,C)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(k))}function f(k){return k===null||Ie(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(k)):rt(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),gt(e,h,"whitespace")(k)):k===96&&k===l?n(k):(e.consume(k),f)}function h(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"),x}function x(k){return i>0&&rt(k)?gt(e,w,"linePrefix",i+1)(k):w(k)}function w(k){return k===null||Ie(k)?e.check(WR,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,T){let O=0;return N;function N(L){return k.enter("lineEnding"),k.consume(L),k.exit("lineEnding"),j}function j(L){return k.enter("codeFencedFence"),rt(L)?gt(k,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):P(L)}function P(L){return L===l?(k.enter("codeFencedFenceSequence"),z(L)):T(L)}function z(L){return L===l?(O++,k.consume(L),z):O>=o?(k.exit("codeFencedFenceSequence"),rt(L)?gt(k,I,"whitespace")(L):I(L)):T(L)}function I(L){return L===null||Ie(L)?(k.exit("codeFencedFence"),E(L)):T(L)}}}function Rie(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 hv={name:"codeIndented",tokenize:Mie},jie={partial:!0,tokenize:Oie};function Mie(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),gt(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(jie,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 Oie(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):gt(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 Pie={name:"codeText",previous:_ie,resolve:Aie,tokenize:Iie};function Aie(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 _ie(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Iie(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 Die{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&&_c(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),_c(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),_c(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);_c(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);_c(this.left,n.reverse())}}}function _c(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 sz(e){const t={};let n=-1,r,s,i,o,l,a,u;const c=new Die(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,Lie(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 Zs(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function Lie(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,f=-1,h=n,m=0,g=0;const v=[g];for(;h;){for(;e.get(++s)[1]!==h;);i.push(s),h._tokenizer||(c=r.sliceStream(h),h.next||c.push(null),d&&o.defineSkip(h.start),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(c),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=h,h=h.next}for(h=n;++f<l.length;)l[f][0]==="exit"&&l[f-1][0]==="enter"&&l[f][1].type===l[f-1][1].type&&l[f][1].start.line!==l[f][1].end.line&&(g=f+1,v.push(g),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(o.events=[],h?(h._tokenizer=void 0,h.previous=void 0):v.pop(),f=v.length;f--;){const x=l.slice(v[f],v[f+1]),w=i.pop();a.push([w,w+x.length-1]),e.splice(w,2,x)}for(a.reverse(),f=-1;++f<a.length;)u[m+a[f][0]]=m+a[f][1],m+=a[f][1]-a[f][0]-1;return u}const $ie={resolve:Fie,tokenize:Bie},zie={partial:!0,tokenize:Vie};function Fie(e){return sz(e),e}function Bie(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(zie,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 Vie(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),gt(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 iz(e,t,n,r,s,i,o,l,a){const u=a||Number.POSITIVE_INFINITY;let c=0;return d;function d(x){return x===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(x),e.exit(i),f):x===null||x===32||x===41||ib(x)?n(x):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),g(x))}function f(x){return x===62?(e.enter(i),e.consume(x),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(x))}function h(x){return x===62?(e.exit("chunkString"),e.exit(l),f(x)):x===null||x===60||Ie(x)?n(x):(e.consume(x),x===92?m:h)}function m(x){return x===60||x===62||x===92?(e.consume(x),h):h(x)}function g(x){return!c&&(x===null||x===41||ir(x))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(x)):c<u&&x===40?(e.consume(x),c++,g):x===41?(e.consume(x),c--,g):x===null||x===32||x===40||ib(x)?n(x):(e.consume(x),x===92?v:g)}function v(x){return x===40||x===41||x===92?(e.consume(x),g):g(x)}}function oz(e,t,n,r,s,i){const o=this;let l=0,a;return u;function u(h){return e.enter(r),e.enter(s),e.consume(h),e.exit(s),e.enter(i),c}function c(h){return l>999||h===null||h===91||h===93&&!a||h===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(h):h===93?(e.exit(i),e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):Ie(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===null||h===91||h===93||Ie(h)||l++>999?(e.exit("chunkString"),c(h)):(e.consume(h),a||(a=!rt(h)),h===92?f:d)}function f(h){return h===91||h===92||h===93?(e.consume(h),l++,d):d(h)}}function lz(e,t,n,r,s,i){let o;return l;function l(f){return f===34||f===39||f===40?(e.enter(r),e.enter(s),e.consume(f),e.exit(s),o=f===40?41:f,a):n(f)}function a(f){return f===o?(e.enter(s),e.consume(f),e.exit(s),e.exit(r),t):(e.enter(i),u(f))}function u(f){return f===o?(e.exit(i),a(o)):f===null?n(f):Ie(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),gt(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(f))}function c(f){return f===o||f===null||Ie(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?d:c)}function d(f){return f===o||f===92?(e.consume(f),c):c(f)}}function vd(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)?gt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const Hie={name:"definition",tokenize:qie},Uie={partial:!0,tokenize:Wie};function qie(e,t,n){const r=this;let s;return i;function i(h){return e.enter("definition"),o(h)}function o(h){return oz.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return s=fu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),a):n(h)}function a(h){return ir(h)?vd(e,u)(h):u(h)}function u(h){return iz(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function c(h){return e.attempt(Uie,d,d)(h)}function d(h){return rt(h)?gt(e,f,"whitespace")(h):f(h)}function f(h){return h===null||Ie(h)?(e.exit("definition"),r.parser.defined.push(s),t(h)):n(h)}}function Wie(e,t,n){return r;function r(l){return ir(l)?vd(e,s)(l):n(l)}function s(l){return lz(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return rt(l)?gt(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Ie(l)?t(l):n(l)}}const Kie={name:"hardBreakEscape",tokenize:Qie};function Qie(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 Gie={name:"headingAtx",resolve:Jie,tokenize:Zie};function Jie(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"},Zs(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)?gt(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 Yie=["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"],Xie={concrete:!0,name:"htmlFlow",resolveTo:noe,tokenize:roe},eoe={partial:!0,tokenize:ioe},toe={partial:!0,tokenize:soe};function noe(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 roe(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),f):R===47?(e.consume(R),i=!0,g):R===63?(e.consume(R),s=3,r.interrupt?t:M):Fs(R)?(e.consume(R),o=String.fromCharCode(R),v):n(R)}function f(R){return R===45?(e.consume(R),s=2,h):R===91?(e.consume(R),s=5,l=0,m):Fs(R)?(e.consume(R),s=4,r.interrupt?t:M):n(R)}function h(R){return R===45?(e.consume(R),r.interrupt?t:M):n(R)}function m(R){const D="CDATA[";return R===D.charCodeAt(l++)?(e.consume(R),l===D.length?r.interrupt?t:P:m):n(R)}function g(R){return Fs(R)?(e.consume(R),o=String.fromCharCode(R),v):n(R)}function v(R){if(R===null||R===47||R===62||ir(R)){const D=R===47,F=o.toLowerCase();return!D&&!i&&QR.includes(F)?(s=1,r.interrupt?t(R):P(R)):Yie.includes(o.toLowerCase())?(s=6,D?(e.consume(R),x):r.interrupt?t(R):P(R)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):i?w(R):b(R))}return R===45||mr(R)?(e.consume(R),o+=String.fromCharCode(R),v):n(R)}function x(R){return R===62?(e.consume(R),r.interrupt?t:P):n(R)}function w(R){return rt(R)?(e.consume(R),w):N(R)}function b(R){return R===47?(e.consume(R),N):R===58||R===95||Fs(R)?(e.consume(R),C):rt(R)?(e.consume(R),b):N(R)}function C(R){return R===45||R===46||R===58||R===95||mr(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):T(R)}function E(R){return R===a?(e.consume(R),a=null,O):R===null||Ie(R)?n(R):(e.consume(R),E)}function T(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),T)}function O(R){return R===47||R===62||rt(R)?b(R):n(R)}function N(R){return R===62?(e.consume(R),j):n(R)}function j(R){return R===null||Ie(R)?P(R):rt(R)?(e.consume(R),j):n(R)}function P(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),ie):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(eoe,V,z)(R)):R===null||Ie(R)?(e.exit("htmlFlowData"),z(R)):(e.consume(R),P)}function z(R){return e.check(toe,I,V)(R)}function I(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"),P(R))}function H(R){return R===45?(e.consume(R),M):P(R)}function K(R){return R===47?(e.consume(R),o="",_):P(R)}function _(R){if(R===62){const D=o.toLowerCase();return QR.includes(D)?(e.consume(R),ie):P(R)}return Fs(R)&&o.length<8?(e.consume(R),o+=String.fromCharCode(R),_):P(R)}function Q(R){return R===93?(e.consume(R),M):P(R)}function M(R){return R===62?(e.consume(R),ie):R===45&&s===2?(e.consume(R),M):P(R)}function ie(R){return R===null||Ie(R)?(e.exit("htmlFlowData"),V(R)):(e.consume(R),ie)}function V(R){return e.exit("htmlFlow"),t(R)}}function soe(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 ioe(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Ty,t,n)}}const ooe={name:"htmlText",tokenize:loe};function loe(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):Fs(M)?(e.consume(M),T):n(M)}function u(M){return M===45?(e.consume(M),c):M===91?(e.consume(M),i=0,m):Fs(M)?(e.consume(M),w):n(M)}function c(M){return M===45?(e.consume(M),h):n(M)}function d(M){return M===null?n(M):M===45?(e.consume(M),f):Ie(M)?(o=d,K(M)):(e.consume(M),d)}function f(M){return M===45?(e.consume(M),h):d(M)}function h(M){return M===62?H(M):M===45?f(M):d(M)}function m(M){const ie="CDATA[";return M===ie.charCodeAt(i++)?(e.consume(M),i===ie.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),x):g(M)}function x(M){return M===62?H(M):M===93?(e.consume(M),x):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 Fs(M)?(e.consume(M),k):n(M)}function k(M){return M===45||mr(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 T(M){return M===45||mr(M)?(e.consume(M),T):M===47||M===62||ir(M)?O(M):n(M)}function O(M){return M===47?(e.consume(M),H):M===58||M===95||Fs(M)?(e.consume(M),N):Ie(M)?(o=O,K(M)):rt(M)?(e.consume(M),O):H(M)}function N(M){return M===45||M===46||M===58||M===95||mr(M)?(e.consume(M),N):j(M)}function j(M){return M===61?(e.consume(M),P):Ie(M)?(o=j,K(M)):rt(M)?(e.consume(M),j):O(M)}function P(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=P,K(M)):rt(M)?(e.consume(M),P):(e.consume(M),I)}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 I(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),I)}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)?gt(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 mS={name:"labelEnd",resolveAll:doe,resolveTo:foe,tokenize:hoe},aoe={tokenize:poe},uoe={tokenize:moe},coe={tokenize:goe};function doe(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&&Zs(e,0,e.length,n),e}function foe(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=Lr(l,e.slice(i+1,i+r+3)),l=Lr(l,[["enter",c,t]]),l=Lr(l,pS(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),l=Lr(l,[["exit",c,t],e[o-2],e[o-1],["exit",u,t]]),l=Lr(l,e.slice(o+1)),l=Lr(l,[["exit",a,t]]),Zs(e,i,e.length,l),e}function hoe(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(f){return i?i._inactive?d(f):(o=r.parser.defined.includes(fu(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),a):n(f)}function a(f){return f===40?e.attempt(aoe,c,o?c:d)(f):f===91?e.attempt(uoe,c,o?u:d)(f):o?c(f):d(f)}function u(f){return e.attempt(coe,c,d)(f)}function c(f){return t(f)}function d(f){return i._balanced=!0,n(f)}}function poe(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)?vd(e,i)(d):i(d)}function i(d){return d===41?c(d):iz(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return ir(d)?vd(e,a)(d):c(d)}function l(d){return n(d)}function a(d){return d===34||d===39||d===40?lz(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function u(d){return ir(d)?vd(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 moe(e,t,n){const r=this;return s;function s(l){return oz.call(r,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(fu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function goe(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 yoe={name:"labelStartImage",resolveAll:mS.resolveAll,tokenize:xoe};function xoe(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 voe={name:"labelStartLink",resolveAll:mS.resolveAll,tokenize:woe};function woe(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 pv={name:"lineEnding",tokenize:boe};function boe(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),gt(e,t,"linePrefix")}}const Np={name:"thematicBreak",tokenize:koe};function koe(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)?gt(e,l,"whitespace")(u):l(u))}}const Gn={continuation:{tokenize:Noe},exit:Roe,name:"list",tokenize:Eoe},Soe={partial:!0,tokenize:joe},Coe={partial:!0,tokenize:Toe};function Eoe(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(h){const m=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:ob(h)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Np,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(h)}return n(h)}function a(h){return ob(h)&&++o<10?(e.consume(h),a):(!r.interrupt||o<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(Ty,r.interrupt?n:c,e.attempt(Soe,f,d))}function c(h){return r.containerState.initialBlankLine=!0,i++,f(h)}function d(h){return rt(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),f):n(h)}function f(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function Noe(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ty,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,gt(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(Coe,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,gt(e,e.attempt(Gn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Toe(e,t,n){const r=this;return gt(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 Roe(e){e.exit(this.containerState.type)}function joe(e,t,n){const r=this;return gt(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 GR={name:"setextUnderline",resolveTo:Moe,tokenize:Ooe};function Moe(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 Ooe(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)?gt(e,a,"lineSuffix")(u):a(u))}function a(u){return u===null||Ie(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Poe={tokenize:Aoe};function Aoe(e){const t=this,n=e.attempt(Ty,r,e.attempt(this.parser.constructs.flowInitial,s,gt(e,e.attempt(this.parser.constructs.flow,s,e.attempt($ie,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 _oe={resolveAll:uz()},Ioe=az("string"),Doe=az("text");function az(e){return{resolveAll:uz(e==="text"?Loe: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 f=-1;if(d)for(;++f<d.length;){const h=d[f];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function uz(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 Loe(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 $oe={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:tz},zoe={91:Hie},Foe={[-2]:hv,[-1]:hv,32:hv},Boe={35:Gie,42:Np,45:[GR,Np],60:Xie,61:GR,95:Np,96:KR,126:KR},Voe={38:rz,92:nz},Hoe={[-5]:pv,[-4]:pv,[-3]:pv,33:yoe,38:rz,42:lb,60:[vie,ooe],91:voe,92:[Kie,nz],93:mS,95:lb,96:Pie},Uoe={null:[lb,_oe]},qoe={null:[42,95]},Woe={null:[]},Koe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:qoe,contentInitial:zoe,disable:Woe,document:$oe,flow:Boe,flowInitial:Foe,insideSpan:Uoe,string:Voe,text:Hoe},Symbol.toStringTag,{value:"Module"}));function Qoe(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:f,sliceStream:h,write:d};let c=t.tokenize.call(u,a);return t.resolveAll&&i.push(t),u;function d(j){return o=Lr(o,j),v(),o[o.length-1]!==null?[]:(T(t,0),u.events=pS(i,u.events,u),u.events)}function f(j,P){return Joe(h(j),P)}function h(j){return Goe(o,j)}function m(){const{_bufferIndex:j,_index:P,line:z,column:I,offset:L}=r;return{_bufferIndex:j,_index:P,line:z,column:I,offset:L}}function g(j){s[j.line]=j.column,N()}function v(){let j;for(;r._index<o.length;){const P=o[r._index];if(typeof P=="string")for(j=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===j&&r._bufferIndex<P.length;)x(P.charCodeAt(r._bufferIndex));else x(P)}}function x(j){c=c(j)}function w(j){Ie(j)?(r.line++,r.column=1,r.offset+=j===-3?2:1,N()):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,P){const z=P||{};return z.type=j,z.start=m(),u.events.push(["enter",z,u]),l.push(z),z}function C(j){const P=l.pop();return P.end=m(),u.events.push(["exit",P,u]),P}function S(j,P){T(j,P.from)}function k(j,P){P.restore()}function E(j,P){return z;function z(I,L,H){let K,_,Q,M;return Array.isArray(I)?V(I):"tokenize"in I?V([I]):ie(I);function ie(Y){return G;function G(ve){const me=ve!==null&&Y[ve],Je=ve!==null&&Y.null,bt=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(Je)?Je:Je?[Je]:[]];return V(bt)(ve)}}function V(Y){return K=Y,_=0,Y.length===0?H:R(Y[_])}function R(Y){return G;function G(ve){return M=O(),Q=Y,Y.partial||(u.currentConstruct=Y),Y.name&&u.parser.constructs.disable.null.includes(Y.name)?F():Y.tokenize.call(P?Object.assign(Object.create(u),P):u,a,D,F)(ve)}}function D(Y){return j(Q,M),L}function F(Y){return M.restore(),++_<K.length?R(K[_]):H}}}function T(j,P){j.resolveAll&&!i.includes(j)&&i.push(j),j.resolve&&Zs(u.events,P,u.events.length-P,j.resolve(u.events.slice(P),u)),j.resolveTo&&(u.events=j.resolveTo(u.events,u))}function O(){const j=m(),P=u.previous,z=u.currentConstruct,I=u.events.length,L=Array.from(l);return{from:I,restore:H};function H(){r=j,u.previous=P,u.currentConstruct=z,u.events.length=I,l=L,N()}}function N(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function Goe(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 Joe(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=`
|
|
600
|
+
`;break}case-3:{o=`\r
|
|
601
|
+
`;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:sie([Koe,...(e||{}).extensions||[]]),content:s(fie),defined:[],document:s(pie),flow:s(Poe),lazy:{},string:s(Ioe),text:s(Doe)};return r;function s(i){return o;function o(l){return Qoe(r,i,l)}}}function Yoe(e){for(;!sz(e););return e}const JR=/[\0\t\n\r]/g;function Xoe(){let e=1,t="",n=!0,r;return s;function s(i,o,l){const a=[];let u,c,d,f,h;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(JR.lastIndex=d,u=JR.exec(i),f=u&&u.index!==void 0?u.index:i.length,h=i.charCodeAt(f),!u){t=i.slice(d);break}if(h===10&&d===f&&r)a.push(-3),r=void 0;else switch(r&&(a.push(-5),r=void 0),d<f&&(a.push(i.slice(d,f)),e+=f-d),h){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=f+1}return l&&(r&&a.push(-5),t&&a.push(t),a.push(null)),a}}const ele=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function tle(e){return e.replace(ele,nle)}function nle(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return ez(n.slice(i?2:1),i?16:10)}return hS(n)||e}const cz={}.hasOwnProperty;function rle(e,t,n){return typeof t!="string"&&(n=t,t=void 0),sle(n)(Yoe(Zoe(n).document().write(Xoe()(e,t,!0))))}function sle(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Qn),autolinkProtocol:O,autolinkEmail:O,atxHeading:i(Zt),blockQuote:i(Je),characterEscape:O,characterReference:O,codeFenced:i(bt),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(bt,o),codeText:i(It,o),codeTextData:O,data:O,codeFlowValue:O,definition:i(kt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i($e),hardBreakEscape:i(ht),hardBreakTrailing:i(ht),htmlFlow:i(Kn,o),htmlFlowData:O,htmlText:i(Kn,o),htmlTextData:O,image:i(Es),label:o,link:i(Qn),listItem:i(Qr),listItemValue:f,listOrdered:i(ct,d),listUnordered:i(ct),paragraph:i(al),reference:R,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(Zt),strong:i(Ns),thematicBreak:i(An)},exit:{atxHeading:a(),atxHeadingSequence:S,autolink:a(),autolinkEmail:me,autolinkProtocol:ve,blockQuote:a(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:F,characterReferenceMarkerNumeric:F,characterReferenceValue:Y,characterReference:G,codeFenced:a(v),codeFencedFence:g,codeFencedFenceInfo:h,codeFencedFenceMeta:m,codeFlowValue:N,codeIndented:a(x),codeText:a(L),codeTextData:N,data:N,definition:a(),definitionDestinationString:C,definitionLabelString:w,definitionTitleString:b,emphasis:a(),hardBreakEscape:a(P),hardBreakTrailing:a(P),htmlFlow:a(z),htmlFlowData:N,htmlText:a(I),htmlTextData:N,image:a(K),label:Q,labelText:_,lineEnding:j,link:a(H),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:D,resourceDestinationString:M,resourceTitleString:ie,resource:V,setextHeading:a(T),setextHeadingLineSequence:E,setextHeadingText:k,strong:a(),thematicBreak:a()}};dz(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(U){let le={type:"root",children:[]};const Ae={stack:[le],tokenStack:[],config:t,enter:l,exit:u,buffer:o,resume:c,data:n},Fe=[];let Ze=-1;for(;++Ze<U.length;)if(U[Ze][1].type==="listOrdered"||U[Ze][1].type==="listUnordered")if(U[Ze][0]==="enter")Fe.push(Ze);else{const Yt=Fe.pop();Ze=s(U,Yt,Ze)}for(Ze=-1;++Ze<U.length;){const Yt=t[U[Ze][0]];cz.call(Yt,U[Ze][1].type)&&Yt[U[Ze][1].type].call(Object.assign({sliceSerialize:U[Ze][2].sliceSerialize},Ae),U[Ze][1])}if(Ae.tokenStack.length>0){const Yt=Ae.tokenStack[Ae.tokenStack.length-1];(Yt[1]||ZR).call(Ae,void 0,Yt[0])}for(le.position={start:Ui(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:Ui(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},Ze=-1;++Ze<t.transforms.length;)le=t.transforms[Ze](le)||le;return le}function s(U,le,Ae){let Fe=le-1,Ze=-1,Yt=!1,q,W,Ee,Oe;for(;++Fe<=Ae;){const Ne=U[Fe];switch(Ne[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ne[0]==="enter"?Ze++:Ze--,Oe=void 0;break}case"lineEndingBlank":{Ne[0]==="enter"&&(q&&!Oe&&!Ze&&!Ee&&(Ee=Fe),Oe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Oe=void 0}if(!Ze&&Ne[0]==="enter"&&Ne[1].type==="listItemPrefix"||Ze===-1&&Ne[0]==="exit"&&(Ne[1].type==="listUnordered"||Ne[1].type==="listOrdered")){if(q){let Xe=Fe;for(W=void 0;Xe--;){const st=U[Xe];if(st[1].type==="lineEnding"||st[1].type==="lineEndingBlank"){if(st[0]==="exit")continue;W&&(U[W][1].type="lineEndingBlank",Yt=!0),st[1].type="lineEnding",W=Xe}else if(!(st[1].type==="linePrefix"||st[1].type==="blockQuotePrefix"||st[1].type==="blockQuotePrefixWhitespace"||st[1].type==="blockQuoteMarker"||st[1].type==="listItemIndent"))break}Ee&&(!W||Ee<W)&&(q._spread=!0),q.end=Object.assign({},W?U[W][1].start:Ne[1].end),U.splice(W||Fe,0,["exit",q,Ne[2]]),Fe++,Ae++}if(Ne[1].type==="listItemPrefix"){const Xe={type:"listItem",_spread:!1,start:Object.assign({},Ne[1].start),end:void 0};q=Xe,U.splice(Fe,0,["enter",Xe,Ne[2]]),Fe++,Ae++,Ee=void 0,Oe=!0}}}return U[le][1]._spread=Yt,Ae}function i(U,le){return Ae;function Ae(Fe){l.call(this,U(Fe),Fe),le&&le.call(this,Fe)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(U,le,Ae){this.stack[this.stack.length-1].children.push(U),this.stack.push(U),this.tokenStack.push([le,Ae||void 0]),U.position={start:Ui(le.start),end:void 0}}function a(U){return le;function le(Ae){U&&U.call(this,Ae),u.call(this,Ae)}}function u(U,le){const Ae=this.stack.pop(),Fe=this.tokenStack.pop();if(Fe)Fe[0].type!==U.type&&(le?le.call(this,U,Fe[0]):(Fe[1]||ZR).call(this,U,Fe[0]));else throw new Error("Cannot close `"+U.type+"` ("+xd({start:U.start,end:U.end})+"): it’s not open");Ae.position.end=Ui(U.end)}function c(){return nie(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(U){if(this.data.expectingFirstListItemValue){const le=this.stack[this.stack.length-2];le.start=Number.parseInt(this.sliceSerialize(U),10),this.data.expectingFirstListItemValue=void 0}}function h(){const U=this.resume(),le=this.stack[this.stack.length-1];le.lang=U}function m(){const U=this.resume(),le=this.stack[this.stack.length-1];le.meta=U}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const U=this.resume(),le=this.stack[this.stack.length-1];le.value=U.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const U=this.resume(),le=this.stack[this.stack.length-1];le.value=U.replace(/(\r?\n|\r)$/g,"")}function w(U){const le=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=le,Ae.identifier=fu(this.sliceSerialize(U)).toLowerCase()}function b(){const U=this.resume(),le=this.stack[this.stack.length-1];le.title=U}function C(){const U=this.resume(),le=this.stack[this.stack.length-1];le.url=U}function S(U){const le=this.stack[this.stack.length-1];if(!le.depth){const Ae=this.sliceSerialize(U).length;le.depth=Ae}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function E(U){const le=this.stack[this.stack.length-1];le.depth=this.sliceSerialize(U).codePointAt(0)===61?1:2}function T(){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=Gr(),Fe.position={start:Ui(U.start),end:void 0},Ae.push(Fe)),this.stack.push(Fe)}function N(U){const le=this.stack.pop();le.value+=this.sliceSerialize(U),le.position.end=Ui(U.end)}function j(U){const le=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ae=le.children[le.children.length-1];Ae.position.end=Ui(U.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(le.type)&&(O.call(this,U),N.call(this,U))}function P(){this.data.atHardBreak=!0}function z(){const U=this.resume(),le=this.stack[this.stack.length-1];le.value=U}function I(){const U=this.resume(),le=this.stack[this.stack.length-1];le.value=U}function L(){const U=this.resume(),le=this.stack[this.stack.length-1];le.value=U}function H(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const le=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=le,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 le=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=le,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function _(U){const le=this.sliceSerialize(U),Ae=this.stack[this.stack.length-2];Ae.label=tle(le),Ae.identifier=fu(le).toLowerCase()}function Q(){const U=this.stack[this.stack.length-1],le=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=le}function M(){const U=this.resume(),le=this.stack[this.stack.length-1];le.url=U}function ie(){const U=this.resume(),le=this.stack[this.stack.length-1];le.title=U}function V(){this.data.inReference=void 0}function R(){this.data.referenceType="collapsed"}function D(U){const le=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=le,Ae.identifier=fu(this.sliceSerialize(U)).toLowerCase(),this.data.referenceType="full"}function F(U){this.data.characterReferenceType=U.type}function Y(U){const le=this.sliceSerialize(U),Ae=this.data.characterReferenceType;let Fe;Ae?(Fe=ez(le,Ae==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Fe=hS(le);const Ze=this.stack[this.stack.length-1];Ze.value+=Fe}function G(U){const le=this.stack.pop();le.position.end=Ui(U.end)}function ve(U){N.call(this,U);const le=this.stack[this.stack.length-1];le.url=this.sliceSerialize(U)}function me(U){N.call(this,U);const le=this.stack[this.stack.length-1];le.url="mailto:"+this.sliceSerialize(U)}function Je(){return{type:"blockquote",children:[]}}function bt(){return{type:"code",lang:null,meta:null,value:""}}function It(){return{type:"inlineCode",value:""}}function kt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function $e(){return{type:"emphasis",children:[]}}function Zt(){return{type:"heading",depth:0,children:[]}}function ht(){return{type:"break"}}function Kn(){return{type:"html",value:""}}function Es(){return{type:"image",title:null,url:"",alt:null}}function Qn(){return{type:"link",title:null,url:"",children:[]}}function ct(U){return{type:"list",ordered:U.type==="listOrdered",start:null,spread:U._spread,children:[]}}function Qr(U){return{type:"listItem",spread:U._spread,checked:null,children:[]}}function al(){return{type:"paragraph",children:[]}}function Ns(){return{type:"strong",children:[]}}function Gr(){return{type:"text",value:""}}function An(){return{type:"thematicBreak"}}}function Ui(e){return{line:e.line,column:e.column,offset:e.offset}}function dz(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?dz(e,r):ile(e,r)}}function ile(e,t){let n;for(n in t)if(cz.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 ZR(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+xd({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+xd({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+xd({start:t.start,end:t.end})+") is still open")}function ole(e){const t=this;t.parser=n;function n(r){return rle(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function lle(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 ale(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
602
|
+
`}]}function ule(e,t){const n=t.value?t.value+`
|
|
603
|
+
`:"",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 cle(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dle(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fle(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=gc(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 hle(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 ple(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function fz(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 mle(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return fz(e,t);const s={src:gc(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 gle(e,t){const n={src:gc(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 yle(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 xle(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return fz(e,t);const s={href:gc(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 vle(e,t){const n={href:gc(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 wle(e,t,n){const r=e.all(t),s=n?ble(n):hz(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:`
|
|
604
|
+
`}),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:`
|
|
605
|
+
`});const u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)}function ble(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=hz(n[r])}return t}function hz(e){const t=e.spread;return t??e.children.length>1}function kle(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 Sle(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Cle(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Ele(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Nle(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=uS(t.children[1]),a=K$(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 Tle(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],f={},h=o?o[a]:void 0;h&&(f.align=h);let m={type:"element",tagName:i,properties:f,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 Rle(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const YR=9,XR=32;function jle(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(ej(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(ej(t.slice(s),s>0,!1)),i.join("")}function ej(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===YR||i===XR;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===YR||i===XR;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function Mle(e,t){const n={type:"text",value:jle(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Ole(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Ple={blockquote:lle,break:ale,code:ule,delete:cle,emphasis:dle,footnoteReference:fle,heading:hle,html:ple,imageReference:mle,image:gle,inlineCode:yle,linkReference:xle,link:vle,listItem:wle,list:kle,paragraph:Sle,root:Cle,strong:Ele,table:Nle,tableCell:Rle,tableRow:Tle,text:Mle,thematicBreak:Ole,toml:Bh,yaml:Bh,definition:Bh,footnoteDefinition:Bh};function Bh(){}const pz=-1,Ry=0,wd=1,$m=2,gS=3,yS=4,xS=5,vS=6,mz=7,gz=8,tj=typeof self=="object"?self:globalThis,Ale=(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 Ry:case pz:return n(o,s);case wd:{const l=n([],s);for(const a of o)l.push(r(a));return l}case $m:{const l=n({},s);for(const[a,u]of o)l[r(a)]=r(u);return l}case gS:return n(new Date(o),s);case yS:{const{source:l,flags:a}=o;return n(new RegExp(l,a),s)}case xS:{const l=n(new Map,s);for(const[a,u]of o)l.set(r(a),r(u));return l}case vS:{const l=n(new Set,s);for(const a of o)l.add(r(a));return l}case mz:{const{name:l,message:a}=o;return n(new tj[l](a),s)}case gz: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 tj[i](o),s)};return r},nj=e=>Ale(new Map,e)(0),Ma="",{toString:_le}={},{keys:Ile}=Object,Ic=e=>{const t=typeof e;if(t!=="object"||!e)return[Ry,t];const n=_le.call(e).slice(8,-1);switch(n){case"Array":return[wd,Ma];case"Object":return[$m,Ma];case"Date":return[gS,Ma];case"RegExp":return[yS,Ma];case"Map":return[xS,Ma];case"Set":return[vS,Ma];case"DataView":return[wd,n]}return n.includes("Array")?[wd,n]:n.includes("Error")?[mz,n]:[$m,n]},Vh=([e,t])=>e===Ry&&(t==="function"||t==="symbol"),Dle=(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]=Ic(o);switch(l){case Ry:{let c=o;switch(a){case"bigint":l=gz,c=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+a);c=null;break;case"undefined":return s([pz],o)}return s([l,c],o)}case wd:{if(a){let f=o;return a==="DataView"?f=new Uint8Array(o.buffer):a==="ArrayBuffer"&&(f=new Uint8Array(o)),s([a,[...f]],o)}const c=[],d=s([l,c],o);for(const f of o)c.push(i(f));return d}case $m:{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 f of Ile(o))(e||!Vh(Ic(o[f])))&&c.push([i(f),i(o[f])]);return d}case gS:return s([l,o.toISOString()],o);case yS:{const{source:c,flags:d}=o;return s([l,{source:c,flags:d}],o)}case xS:{const c=[],d=s([l,c],o);for(const[f,h]of o)(e||!(Vh(Ic(f))||Vh(Ic(h))))&&c.push([i(f),i(h)]);return d}case vS:{const c=[],d=s([l,c],o);for(const f of o)(e||!Vh(Ic(f)))&&c.push(i(f));return d}}const{message:u}=o;return s([l,{name:a,message:u}],o)};return i},rj=(e,{json:t,lossy:n}={})=>{const r=[];return Dle(!(t||n),!!t,new Map,r)(e),r},zm=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?nj(rj(e,t)):structuredClone(e):(e,t)=>nj(rj(e,t));function Lle(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 $le(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function zle(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Lle,r=e.options.footnoteBackLabel||$le,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(),f=gc(d.toLowerCase());let h=0;const m=[],g=e.footnoteCounts.get(d);for(;g!==void 0&&++h<=g;){m.length>0&&m.push({type:"text",value:" "});let w=typeof n=="string"?n:n(a,h);typeof w=="string"&&(w={type:"text",value:w}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(a,h),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 x={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(c,!0)};e.patch(u,x),l.push(x)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...zm(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
606
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
|
|
607
|
+
`}]}}const yz=function(e){if(e==null)return Hle;if(typeof e=="function")return jy(e);if(typeof e=="object")return Array.isArray(e)?Fle(e):Ble(e);if(typeof e=="string")return Vle(e);throw new Error("Expected function, string, or object as test")};function Fle(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=yz(e[n]);return jy(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function Ble(e){const t=e;return jy(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function Vle(e){return jy(t);function t(n){return n&&n.type===e}}function jy(e){return t;function t(n,r,s){return!!(Ule(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function Hle(){return!0}function Ule(e){return e!==null&&typeof e=="object"&&"type"in e}const xz=[],qle=!0,sj=!1,Wle="skip";function Kle(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=yz(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 h=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(a.type+(h?"<"+h+">":""))+")"})}return f;function f(){let h=xz,m,g,v;if((!t||i(a,u,c[c.length-1]||void 0))&&(h=Qle(n(a,c)),h[0]===sj))return h;if("children"in a&&a.children){const x=a;if(x.children&&h[0]!==Wle)for(g=(r?x.children.length:-1)+o,v=c.concat(x);g>-1&&g<x.children.length;){const w=x.children[g];if(m=l(w,g,v)(),m[0]===sj)return m;g=typeof m[1]=="number"?m[1]:g+o}}return h}}}function Qle(e){return Array.isArray(e)?e:typeof e=="number"?[qle,e]:e==null?xz:[e]}function vz(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),Kle(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 ab={}.hasOwnProperty,Gle={};function Jle(e,t){const n=t||Gle,r=new Map,s=new Map,i=new Map,o={...Ple,...n.handlers},l={all:u,applyData:Yle,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:a,options:n,patch:Zle,wrap:eae};return vz(e,function(c){if(c.type==="definition"||c.type==="footnoteDefinition"){const d=c.type==="definition"?r:s,f=String(c.identifier).toUpperCase();d.has(f)||d.set(f,c)}}),l;function a(c,d){const f=c.type,h=l.handlers[f];if(ab.call(l.handlers,f)&&h)return h(l,c,d);if(l.options.passThrough&&l.options.passThrough.includes(f)){if("children"in c){const{children:g,...v}=c,x=zm(v);return x.children=l.all(c),x}return zm(c)}return(l.options.unknownHandler||Xle)(l,c,d)}function u(c){const d=[];if("children"in c){const f=c.children;let h=-1;for(;++h<f.length;){const m=l.one(f[h],c);if(m){if(h&&f[h-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=ij(m.value)),!Array.isArray(m)&&m.type==="element")){const g=m.children[0];g&&g.type==="text"&&(g.value=ij(g.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function Zle(e,t){e.position&&(t.position=_se(e))}function Yle(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,zm(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function Xle(e,t){const n=t.data||{},r="value"in t&&!(ab.call(n,"hProperties")||ab.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 eae(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
608
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
609
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
610
|
+
`}),n}function ij(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function oj(e,t){const n=Jle(e,t),r=n.one(e,void 0),s=zle(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
|
|
611
|
+
`},s),i}function tae(e,t){return e&&"run"in e?async function(n,r){const s=oj(n,{file:r,...t});await e.run(s,r)}:function(n,r){return oj(n,{file:r,...e||t})}}function lj(e){if(e)throw e}var Tp=Object.prototype.hasOwnProperty,wz=Object.prototype.toString,aj=Object.defineProperty,uj=Object.getOwnPropertyDescriptor,cj=function(t){return typeof Array.isArray=="function"?Array.isArray(t):wz.call(t)==="[object Array]"},dj=function(t){if(!t||wz.call(t)!=="[object Object]")return!1;var n=Tp.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Tp.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Tp.call(t,s)},fj=function(t,n){aj&&n.name==="__proto__"?aj(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},hj=function(t,n){if(n==="__proto__")if(Tp.call(t,n)){if(uj)return uj(t,n).value}else return;return t[n]},nae=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=hj(l,n),s=hj(t,n),l!==s&&(c&&s&&(dj(s)||(i=cj(s)))?(i?(i=!1,o=r&&cj(r)?r:[]):o=r&&dj(r)?r:{},fj(l,{name:n,newValue:e(c,o,s)})):typeof s<"u"&&fj(l,{name:n,newValue:s}));return l};const mv=xg(nae);function ub(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 rae(){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?sae(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 sae(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 Ms={basename:iae,dirname:oae,extname:lae,join:aae,sep:"/"};function iae(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Uf(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 oae(e){if(Uf(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 lae(e){Uf(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 aae(...e){let t=-1,n;for(;++t<e.length;)Uf(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":uae(n)}function uae(e){Uf(e);const t=e.codePointAt(0)===47;let n=cae(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function cae(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 Uf(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const dae={cwd:fae};function fae(){return"/"}function cb(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function hae(e){if(typeof e=="string")e=new URL(e);else if(!cb(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 pae(e)}function pae(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 gv=["history","path","basename","stem","extname","dirname"];class bz{constructor(t){let n;t?cb(t)?n={path:t}:typeof t=="string"||mae(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":dae.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<gv.length;){const i=gv[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)gv.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Ms.basename(this.path):void 0}set basename(t){xv(t,"basename"),yv(t,"basename"),this.path=Ms.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ms.dirname(this.path):void 0}set dirname(t){pj(this.basename,"dirname"),this.path=Ms.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ms.extname(this.path):void 0}set extname(t){if(yv(t,"extname"),pj(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=Ms.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){cb(t)&&(t=hae(t)),xv(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ms.basename(this.path,this.extname):void 0}set stem(t){xv(t,"stem"),yv(t,"stem"),this.path=Ms.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 yv(e,t){if(e&&e.includes(Ms.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ms.sep+"`")}function xv(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function pj(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function mae(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const gae=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},yae={}.hasOwnProperty;class wS extends gae{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=rae()}copy(){const t=new wS;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(mv(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(bv("data",this.frozen),this.namespace[t]=n,this):yae.call(this.namespace,t)&&this.namespace[t]||void 0:t?(bv("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=Hh(t),r=this.parser||this.Parser;return vv("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),vv("process",this.parser||this.Parser),wv("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const l=Hh(t),a=r.parse(l);r.run(a,l,function(c,d,f){if(c||!d||!f)return u(c);const h=d,m=r.stringify(h,f);wae(m)?f.value=m:f.result=m,u(c,f)});function u(c,d){c||!d?o(c):i?i(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),vv("processSync",this.parser||this.Parser),wv("processSync",this.compiler||this.Compiler),this.process(t,s),gj("processSync","process",n),r;function s(i,o){n=!0,lj(i),r=o}}run(t,n,r){mj(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=Hh(n);s.run(t,a,u);function u(c,d,f){const h=d||t;c?l(c):o?o(h):r(void 0,h,f)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),gj("runSync","run",r),s;function i(o,l){lj(o),s=l,r=!0}}stringify(t,n){this.freeze();const r=Hh(n),s=this.compiler||this.Compiler;return wv("stringify",s),mj(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(bv("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=mv(!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,f=-1;for(;++d<r.length;)if(r[d][0]===u){f=d;break}if(f===-1)r.push([u,...c]);else if(c.length>0){let[h,...m]=c;const g=r[f][1];ub(g)&&ub(h)&&(h=mv(!0,g,h)),r[f]=[u,h,...m]}}}}const xae=new wS().freeze();function vv(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function wv(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function bv(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 mj(e){if(!ub(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function gj(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Hh(e){return vae(e)?e:new bz(e)}function vae(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function wae(e){return typeof e=="string"||bae(e)}function bae(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const kae="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",yj=[],xj={allowDangerousHtml:!0},Sae=/^(https?|ircs?|mailto|xmpp)$/i,Cae=[{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 Eae(e){const t=Nae(e),n=Tae(e);return Rae(t.runSync(t.parse(n),n),e)}function Nae(e){const t=e.rehypePlugins||yj,n=e.remarkPlugins||yj,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...xj}:xj;return xae().use(ole).use(n).use(tae,r).use(t)}function Tae(e){const t=e.children||"",n=new bz;return typeof t=="string"&&(n.value=t),n}function Rae(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,a=t.urlTransform||jae;for(const c of Cae)Object.hasOwn(t,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+kae+c.id,void 0);return vz(e,u),zse(e,{Fragment:p.Fragment,components:s,ignoreInvalidStyle:!0,jsx:p.jsx,jsxs:p.jsxs,passKeys:!0,passNode:!0});function u(c,d,f){if(c.type==="raw"&&f&&typeof d=="number")return o?f.children.splice(d,1):f.children[d]={type:"text",value:c.value},d;if(c.type==="element"){let h;for(h in fv)if(Object.hasOwn(fv,h)&&Object.hasOwn(c.properties,h)){const m=c.properties[h],g=fv[h];(g===null||g.includes(c.tagName))&&(c.properties[h]=a(String(m||""),h,c))}}if(c.type==="element"){let h=n?!n.includes(c.tagName):i?i.includes(c.tagName):!1;if(!h&&r&&typeof d=="number"&&(h=!r(c,d,f)),h&&f&&typeof d=="number")return l&&c.children?f.children.splice(d,1,...c.children):f.children.splice(d,1),d}}}function jae(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||Sae.test(e.slice(0,t))?e:""}const Mae="Connection to agent lost. Send a follow-up message to continue.",Oae="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 vj(e){try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&typeof t.message=="string")return t.message}catch{}return e}const Pae=({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:`
|
|
612
|
+
radial-gradient(circle at 30% 30%, rgba(255,255,255,0.3), rgba(255,255,255,0.05)),
|
|
613
|
+
conic-gradient(from 0deg at 50% 50%,
|
|
614
|
+
rgba(255,0,150,0.03),
|
|
615
|
+
rgba(0,255,255,0.03),
|
|
616
|
+
rgba(255,255,0,0.03),
|
|
617
|
+
rgba(255,0,150,0.03))
|
|
618
|
+
`,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)"}})]})}),kv=({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})}),Sv=({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:Oae,children:p.jsx(Eae,{children:e})})}),Aae=({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(f=>f.role==="user"&&vj(f.content).trim()===l.trim()),u=l&&!a&&t.type!=="idle",c=e.messages.map((f,h)=>{if(f.role!=="assistant")return{...f,isStep:!1};if(f.isThinking)return{...f,isStep:!0};const m=h<e.messages.length-1&&e.messages[h+1].role==="assistant";return{...f,isStep:m}}),d=t.type==="sending"||t.type==="streaming"||t.type==="interrupting";return p.jsxs("div",{className:"space-y-2",children:[c.map((f,h)=>f.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:vj(f.content)})},h):f.isStep?p.jsx(kv,{content:f.content},h):p.jsx(Sv,{content:f.content},h)),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((f,h)=>f.isThinking?p.jsx(kv,{content:f.content},`step-${h}`):p.jsx(Sv,{content:f.content},`step-${h}`)),i&&o&&(s?p.jsx(kv,{content:o}):p.jsx(Sv,{content:o})),d&&p.jsx(Pae,{stale:n}),t.type==="error"&&(t.error===Mae?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(C6,{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}))]})},_ae=({onSend:e,onInterrupt:t,flowState:n,disabled:r,pendingMessage:s,onEditPending:i,onCancelPending:o,onSendQueuedNow:l})=>{const[a,u]=y.useState(""),c=y.useRef(null),d=n.type==="sending"||n.type==="streaming"||n.type==="interrupting",f=()=>{!a.trim()||r||(e(a.trim()),u(""))},h=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),d&&t?a.trim()?f():s&&l?l():t():f())},m=()=>{var v;s&&(u(s),i==null||i(),(v=c.current)==null||v.focus())};y.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(GA,{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(Bn,{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:h,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(e_,{className:"h-3 w-3 fill-current"})}):p.jsx("button",{type:"button",onClick:f,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(lm,{className:"h-4 w-4 animate-spin"}):p.jsx(c6,{className:"h-3.5 w-3.5"})})]})]})},Iae={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 Dae(e){const t=e.split("/");return t.length<=3?e:"…/"+t.slice(-3).join("/")}function kz(e,t){const n=t.file_path,r=t.command,s=Iae[e]||e;return n?`${s}: ${Dae(n)}`:r?`${s}: ${r.length>50?r.slice(0,50)+"…":r}`:s}const Lae=({agentId:e,permission:t,onRespond:n})=>{const[r,s]=y.useState(!1),{respondToPermission:i}=$A(e),o=y.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]);y.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=kz(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(te,{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(Bn,{className:"mr-0.5 h-3 w-3"}),"Deny"]}),p.jsxs(te,{type:"button",size:"sm",onClick:()=>o("allow"),className:"h-6 px-2 text-xs",children:[p.jsx(ac,{className:"mr-0.5 h-3 w-3"}),"Allow"]})]})]}),p.jsx(Xs,{open:r,onOpenChange:s,children:p.jsxs(Cs,{className:"max-w-lg",children:[p.jsx(ei,{children:p.jsxs(ti,{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})]})})]})},$ae=({permission:e})=>{const t=e.status==="allowed",n=kz(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(ac,{className:"h-3 w-3"}):p.jsx(Bn,{className:"h-3 w-3"}),p.jsxs("span",{className:"truncate",children:[t?"Allowed":"Denied",": ",n]})]})},zae=({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($ae,{permission:i},i.permissionId)),s&&p.jsx(Lae,{agentId:e,permission:s,onRespond:n},s.permissionId)]})},Fae=({agentId:e,mode:t})=>{const{setPermissionMode:n}=If(),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"})},Bae=()=>({type:"idle"}),Vae=e=>({type:"sending",message:e}),wj=(e,t)=>({type:"streaming",message:e,accumulated:t}),bj=(e,t,n)=>({type:"waiting_permission",permissionId:e,accumulated:t,toolName:n}),Cv=e=>({type:"error",error:e}),kj=()=>({type:"idle"}),Sj=(e,t)=>({type:"interrupting",message:e,accumulated:t}),Hae=20,Uae=({agentId:e})=>{const{data:t,isLoading:n}=_H(e),{sendMessage:r,interruptAgent:s,deleteAgent:i,archiveAgent:o}=If(),{permissions:l}=$A(e),[a,u]=y.useState(Bae()),c=y.useRef(""),[d,f]=y.useState([]),[h,m]=y.useState([]),[g,v]=y.useState(!1),x=y.useRef(new Set),w=y.useRef(null),[b,C]=y.useState(null),S=y.useRef(null),k=y.useRef(()=>{}),E=y.useRef(0),[T,O]=y.useState(0),N=y.useCallback(()=>{const R=w.current;R&&(R.scrollTop=R.scrollHeight)},[]);y.useEffect(()=>{N()},[t==null?void 0:t.messages.length,a,N]),y.useEffect(()=>{for(const R of l)x.current.has(R.permissionId)||(x.current.add(R.permissionId),f(D=>[...D,{...R,status:"pending"}]),u(bj(R.permissionId,c.current,R.toolName)))},[l]);const j=y.useCallback(R=>{S.current=R,C(R)},[]),P=y.useCallback(()=>{const R=S.current;R&&(j(null),setTimeout(()=>k.current(R),100))},[j]),z=y.useCallback(R=>{c.current="",x.current.clear(),f([]),m([]),v(!1),E.current=Date.now(),O(0),u(Vae(R)),r({agentId:e,message:R,onStream:D=>{if(E.current=Date.now(),D.type!=="heartbeat")if(D.type==="permission_request"){if(x.current.has(D.permissionId))return;x.current.add(D.permissionId);const F={permissionId:D.permissionId,toolName:D.toolName,toolUseID:D.toolUseID,input:D.input,decisionReason:D.decisionReason,blockedPath:D.blockedPath,status:"pending"};f(Y=>[...Y,F]),u(bj(D.permissionId,c.current,D.toolName))}else if(D.type==="permission_auto_allowed"){const F=`auto-${D.toolUseID}`;x.current.has(F)||(x.current.add(F),f(Y=>[...Y,{permissionId:F,toolName:D.toolName,toolUseID:D.toolUseID,input:D.input,status:"allowed"}]))}else D.type==="step_complete"?m(F=>[...F,{content:D.content,isThinking:D.isThinking}]):D.type==="text_delta"?(c.current=D.accumulated||"",v(D.isThinking??!1),u(wj(R,D.accumulated||""))):D.type==="complete"?(c.current="",u(kj())):D.type==="disconnected"?u(Cv("Connection to agent lost. Send a follow-up message to continue.")):D.type==="error"&&u(Cv(D.error))}},{onSuccess:()=>{c.current="",m([]),v(!1),u(kj()),P()},onError:D=>{if(S.current){P();return}u(Cv(D instanceof Error?D.message:"Failed to send message"))}})},[e,r,P]);y.useEffect(()=>{k.current=z},[z]);const I=a.type==="sending"||a.type==="streaming"||a.type==="interrupting";y.useEffect(()=>{if(!I){O(0);return}const R=setInterval(()=>{const D=E.current;D!==0&&O(Math.floor((Date.now()-D)/1e3))},2e3);return()=>clearInterval(R)},[I]);const L=y.useCallback(R=>{if(!I){z(R);return}j(R),a.type==="streaming"&&(u(Sj(a.message,a.accumulated)),s(e))},[I,a,z,s,e,j]),H=y.useCallback(()=>{u(R=>R.type==="streaming"?Sj(R.message,R.accumulated):R),s(e)},[s,e]),K=y.useCallback(()=>{j(null)},[j]),_=y.useCallback(()=>{j(null)},[j]),Q=y.useCallback(()=>{const R=S.current;R&&(j(null),k.current(R))},[j]),M=y.useCallback(()=>{t&&window.confirm("Are you sure you want to delete this conversation? This action cannot be undone.")&&i(e)},[t,i,e]),ie=y.useCallback(()=>{t&&o(e)},[t,o,e]),V=y.useCallback((R,D)=>{const F=D==="allow"?"allowed":"denied";f(Y=>Y.map(G=>G.permissionId===R?{...G,status:F}:G)),u(wj("",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(im,{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(te,{variant:"ghost",size:"sm",onClick:ie,className:"h-8 px-3 text-xs",children:[p.jsx(im,{className:"h-3 w-3 mr-1"}),"Unarchive"]}),p.jsxs(te,{variant:"ghost",size:"sm",onClick:M,className:"h-8 px-3 text-xs text-destructive hover:text-destructive",children:[p.jsx(da,{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(Aae,{agent:t,flowState:a,stale:I&&T>=Hae,streamingSteps:h,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(zae,{agentId:e,permissions:d,onPermissionRespond:V}),p.jsx(_ae,{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(Fae,{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"})},qae=()=>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."}),Sz=y.createContext(null),Wae=Sz.Provider,Kae=()=>{const e=y.useContext(Sz);if(!e)throw new Error("useMetadataDialogContext must be used within MetadataDialogProvider.");return e},Cz=({open:e,onClose:t})=>{y.useEffect(()=>{if(!e)return;const n=r=>{r.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n)}},[t,e])},Qae=()=>{var s,i;const{dialogs:{infoInspector:e,active:t}}=Nr(),{open:n,setOpen:r}=Kae();return Cz({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 Gae(){var N,j;const{activeProject:e}=$t(),t=(e==null?void 0:e.id)??"",n=!!e,r=Ue.zapper.status.useQuery({projectId:t},{refetchInterval:2e3,refetchOnWindowFocus:!1,enabled:n}),s=Ue.zapper.tasks.useQuery({projectId:t},{refetchInterval:1e4,refetchOnWindowFocus:!1,enabled:n}),i=Ue.zapper.profiles.useQuery({projectId:t},{refetchInterval:5e3,refetchOnWindowFocus:!1,enabled:n}),o=Ue.useUtils(),l=()=>o.zapper.status.invalidate({projectId:t}),a=()=>o.zapper.profiles.invalidate({projectId:t}),u=Ue.zapper.startAll.useMutation({onSuccess:l}),c=Ue.zapper.stopAll.useMutation({onSuccess:l}),d=Ue.zapper.start.useMutation({onSuccess:l}),f=Ue.zapper.stop.useMutation({onSuccess:l}),h=Ue.zapper.restart.useMutation({onSuccess:l}),m=Ue.zapper.runTask.useMutation(),g=Ue.zapper.showLogs.useMutation(),v=Ue.zapper.launch.useMutation(),x=Ue.zapper.links.useQuery({projectId:t},{refetchOnWindowFocus:!1,enabled:n}),w=Ue.zapper.enableProfile.useMutation({onSuccess:()=>{l(),a()}}),b=Ue.zapper.disableProfile.useMutation({onSuccess:()=>{l(),a()}}),C=y.useMemo(()=>{var P;return((P=r.data)==null?void 0:P.services)??[]},[r.data]),S=y.useMemo(()=>s.data??[],[s.data]),k=y.useMemo(()=>{var P;return((P=x.data)==null?void 0:P.projectLinks)??[]},[x.data]),E=y.useMemo(()=>{var P;return((P=x.data)==null?void 0:P.serviceLinks)??{}},[x.data]),T=y.useMemo(()=>{var P;return((P=i.data)==null?void 0:P.profiles)??[]},[i.data]),O=((N=i.data)==null?void 0:N.activeProfile)??null;return{available:((j=r.data)==null?void 0:j.available)??!1,services:C,tasks:S,projectLinks:k,serviceLinks:E,profiles:T,activeProfile:O,isLoading:r.isLoading,startAll:()=>u.mutate({projectId:t}),stopAll:()=>c.mutate({projectId:t}),start:P=>d.mutate({projectId:t,service:P}),stop:P=>f.mutate({projectId:t,service:P}),restart:P=>h.mutate({projectId:t,service:P}),runTask:P=>m.mutate({projectId:t,task:P}),showLogs:P=>g.mutate({projectId:t,service:P}),launch:P=>v.mutate({url:P}),enableProfile:P=>w.mutate({projectId:t,profile:P}),disableProfile:()=>b.mutate({projectId:t}),isStartingAll:u.isPending,isStoppingAll:c.isPending,isPending:u.isPending||c.isPending||d.isPending||f.isPending||h.isPending||w.isPending||b.isPending}}const Jae=(e,t)=>dt("h-2 w-2 shrink-0 rounded-full",e==="up"?"bg-green-500":e==="pending"?"bg-yellow-500":t?"bg-red-500":"bg-muted-foreground/40"),Dc="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:Jae(t,n)}),p.jsx("span",{className:dt("flex-1 truncate",!n&&t!=="up"&&t!=="pending"&&"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:Dc,onClick:l,"aria-label":`Open ${e}`,children:p.jsx(VA,{className:"h-3 w-3"})}),p.jsx("button",{type:"button",className:Dc,onClick:o,"aria-label":`Logs ${e}`,children:p.jsx(l6,{className:"h-3 w-3"})}),t==="up"||t==="pending"?p.jsxs(p.Fragment,{children:[p.jsx("button",{type:"button",className:Dc,onClick:s,"aria-label":`Stop ${e}`,children:p.jsx(e_,{className:"h-3 w-3"})}),p.jsx("button",{type:"button",className:Dc,onClick:i,"aria-label":`Restart ${e}`,children:p.jsx(i6,{className:"h-3 w-3"})})]}):p.jsx("button",{type:"button",className:Dc,onClick:r,"aria-label":`Start ${e}`,children:p.jsx(ZA,{className:"h-3 w-3"})})]})]}),Cj=({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)})})]}),Yae=({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(ZA,{className:"h-3 w-3 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100"})]})}),Xae="rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors cursor-pointer select-none",eue=({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:dt(Xae,o?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground hover:border-foreground/30 hover:text-foreground"),children:i},i)})})]}),tue=()=>{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:f,runTask:h,showLogs:m,launch:g,enableProfile:v,disableProfile:x,isStartingAll:w,isStoppingAll:b,isPending:C}=Gae();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(T=>T.type==="native"),k=t.filter(T=>T.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(te,{variant:"muted",size:"xs",disabled:C,onClick:a,children:[w&&p.jsx(lm,{className:"h-3 w-3 animate-spin"}),"Start all"]}),p.jsxs(te,{variant:"muted",size:"xs",disabled:C,onClick:u,children:[b&&p.jsx(lm,{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(T=>p.jsxs("button",{type:"button",onClick:()=>g(T.url),className:"inline-flex items-center gap-1 text-xs text-primary underline-offset-2 hover:underline",children:[T.name,p.jsx(VA,{className:"h-3 w-3"})]},T.name))})]}),i.length>0&&p.jsx(eue,{profiles:i,active:o,onEnable:v,onDisable:x,disabled:C}),S.length>0&&p.jsx(Cj,{title:"Native",services:S,serviceLinks:s,onStart:c,onStop:d,onRestart:f,onShowLogs:m,onLaunch:g}),k.length>0&&p.jsx(Cj,{title:"Docker",services:k,serviceLinks:s,onStart:c,onStop:d,onRestart:f,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(T=>p.jsx(Yae,{name:T.name,onRun:()=>h(T.name)},T.name))})]})]})},nue=({open:e,onClose:t})=>(Cz({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(tue,{})})]})}):null),rue=()=>{const e=$g(),t=Mf(),n=Fi(),{activeProject:r}=$t(),s=r==null?void 0:r.id;return y.useEffect(()=>s?n.getQueryCache().subscribe(o=>{if((o==null?void 0:o.type)!=="updated")return;const l=o.query.state.error;if(!l||!AH(l))return;const{tab:a}=nS(t.pathname);e(`/${s}/${a}`,{replace:!0})}):void 0,[n,e,s,t.pathname]),null};var Fm=(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]},sue=/^\s*>\s$/,iue=Tr.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return Fm("blockquote",{...Ut(this.options.HTMLAttributes,e),children:Fm("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(`
|
|
619
|
+
`).map(a=>a.trim()===""?n:`${n} ${a}`);r.push(l.join(`
|
|
620
|
+
`))}),r.join(`
|
|
621
|
+
${n}
|
|
622
|
+
`)},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[tc({find:sue,type:this.type})]}}),oue=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,lue=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,aue=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,uue=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,cue=pa.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 Fm("strong",{...Ut(this.options.HTMLAttributes,e),children:Fm("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[ec({find:oue,type:this.type}),ec({find:aue,type:this.type})]},addPasteRules(){return[ra({find:lue,type:this.type}),ra({find:uue,type:this.type})]}}),due=/(^|[^`])`([^`]+)`(?!`)$/,fue=/(^|[^`])`([^`]+)`(?!`)/g,hue=pa.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",Ut(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[ec({find:due,type:this.type})]},addPasteRules(){return[ra({find:fue,type:this.type})]}}),Ev=4,pue=/^```([a-z]+)?[\s\n]$/,mue=/^~~~([a-z]+)?[\s\n]$/,gue=Tr.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Ev,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",Ut(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(`
|
|
623
|
+
`):r=`\`\`\`${s}
|
|
624
|
+
|
|
625
|
+
\`\`\``,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:Ev,{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,h=r.doc.textBetween(u,c,`
|
|
626
|
+
`,`
|
|
627
|
+
`).split(`
|
|
628
|
+
`).map(m=>l+m).join(`
|
|
629
|
+
`);return a.replaceWith(u,c,r.schema.text(h)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=(t=this.options.tabSize)!=null?t:Ev,{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(),h=r.doc.textBetween(c,d,`
|
|
630
|
+
`,`
|
|
631
|
+
`).split(`
|
|
632
|
+
`);let m=0,g=0;const v=u-c;for(let k=0;k<h.length;k+=1){if(g+h[k].length>=v){m=k;break}g+=h[k].length+1}const w=((a=h[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+=h[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,f=r.doc.textBetween(a,u,`
|
|
633
|
+
`,`
|
|
634
|
+
`).split(`
|
|
635
|
+
`).map(h=>{var m;const g=((m=h.match(/^ */))==null?void 0:m[0])||"",v=Math.min(g.length,n);return h.slice(v)}).join(`
|
|
636
|
+
`);return l.replaceWith(a,u,r.schema.text(f)),!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(`
|
|
637
|
+
|
|
638
|
+
`);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[Ww({find:pue,type:this.type,getAttributes:e=>({language:e[1]})}),Ww({find:mue,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new wt({key:new Ct("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,`
|
|
639
|
+
`));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}}})]}}),yue=Tr.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
640
|
+
|
|
641
|
+
`):""}),xue=Tr.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",Ut(this.options.HTMLAttributes,e)]},renderText(){return`
|
|
642
|
+
`},renderMarkdown:()=>`
|
|
643
|
+
`,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(f=>l.includes(f.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),vue=Tr.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]}`,Ut(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=>Ww({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),wue=Tr.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",Ut(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!See(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:r}=n,s=e();return OL(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[kee({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),bue=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,kue=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Sue=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Cue=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Eue=pa.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",Ut(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[ec({find:bue,type:this.type}),ec({find:Sue,type:this.type})]},addPasteRules(){return[ra({find:kue,type:this.type}),ra({find:Cue,type:this.type})]}});const Nue="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Tue="ελ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",db="numeric",fb="ascii",hb="alpha",bd="asciinumeric",Yc="alphanumeric",pb="domain",Ez="emoji",Rue="scheme",jue="slashscheme",Nv="whitespace";function Mue(e,t){return e in t||(t[e]=[]),t[e]}function Cl(e,t,n){t[db]&&(t[bd]=!0,t[Yc]=!0),t[fb]&&(t[bd]=!0,t[hb]=!0),t[bd]&&(t[Yc]=!0),t[hb]&&(t[Yc]=!0),t[Yc]&&(t[pb]=!0),t[Ez]&&(t[pb]=!0);for(const r in t){const s=Mue(r,n);s.indexOf(e)<0&&s.push(e)}}function Oue(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&&Cl(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(Oue(o.t,r),n);Cl(i,a,r)}else n&&Cl(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),Ej=(e,t,n,r,s)=>e.ts(t,n,r,s),ee=(e,t,n,r,s)=>e.tt(t,n,r,s),ci="WORD",mb="UWORD",Nz="ASCIINUMERICAL",Tz="ALPHANUMERICAL",hf="LOCALHOST",gb="TLD",yb="UTLD",Rp="SCHEME",za="SLASH_SCHEME",bS="NUM",xb="WS",kS="NL",kd="OPENBRACE",Sd="CLOSEBRACE",Bm="OPENBRACKET",Vm="CLOSEBRACKET",Hm="OPENPAREN",Um="CLOSEPAREN",qm="OPENANGLEBRACKET",Wm="CLOSEANGLEBRACKET",Km="FULLWIDTHLEFTPAREN",Qm="FULLWIDTHRIGHTPAREN",Gm="LEFTCORNERBRACKET",Jm="RIGHTCORNERBRACKET",Zm="LEFTWHITECORNERBRACKET",Ym="RIGHTWHITECORNERBRACKET",Xm="FULLWIDTHLESSTHAN",eg="FULLWIDTHGREATERTHAN",tg="AMPERSAND",ng="APOSTROPHE",rg="ASTERISK",eo="AT",sg="BACKSLASH",ig="BACKTICK",og="CARET",io="COLON",SS="COMMA",lg="DOLLAR",Os="DOT",ag="EQUALS",CS="EXCLAMATION",Mr="HYPHEN",Cd="PERCENT",ug="PIPE",cg="PLUS",dg="POUND",Ed="QUERY",ES="QUOTE",Rz="FULLWIDTHMIDDLEDOT",NS="SEMI",Ps="SLASH",Nd="TILDE",fg="UNDERSCORE",jz="EMOJI",hg="SYM";var Mz=Object.freeze({__proto__:null,ALPHANUMERICAL:Tz,AMPERSAND:tg,APOSTROPHE:ng,ASCIINUMERICAL:Nz,ASTERISK:rg,AT:eo,BACKSLASH:sg,BACKTICK:ig,CARET:og,CLOSEANGLEBRACKET:Wm,CLOSEBRACE:Sd,CLOSEBRACKET:Vm,CLOSEPAREN:Um,COLON:io,COMMA:SS,DOLLAR:lg,DOT:Os,EMOJI:jz,EQUALS:ag,EXCLAMATION:CS,FULLWIDTHGREATERTHAN:eg,FULLWIDTHLEFTPAREN:Km,FULLWIDTHLESSTHAN:Xm,FULLWIDTHMIDDLEDOT:Rz,FULLWIDTHRIGHTPAREN:Qm,HYPHEN:Mr,LEFTCORNERBRACKET:Gm,LEFTWHITECORNERBRACKET:Zm,LOCALHOST:hf,NL:kS,NUM:bS,OPENANGLEBRACKET:qm,OPENBRACE:kd,OPENBRACKET:Bm,OPENPAREN:Hm,PERCENT:Cd,PIPE:ug,PLUS:cg,POUND:dg,QUERY:Ed,QUOTE:ES,RIGHTCORNERBRACKET:Jm,RIGHTWHITECORNERBRACKET:Ym,SCHEME:Rp,SEMI:NS,SLASH:Ps,SLASH_SCHEME:za,SYM:hg,TILDE:Nd,TLD:gb,UNDERSCORE:fg,UTLD:yb,UWORD:mb,WORD:ci,WS:xb});const oi=/[a-z]/,Lc=new RegExp("\\p{L}","u"),Tv=new RegExp("\\p{Emoji}","u"),li=/\d/,Rv=/\s/,Nj="\r",jv=`
|
|
644
|
+
`,Pue="️",Aue="",Mv="";let Uh=null,qh=null;function _ue(e=[]){const t={};Xn.groups=t;const n=new Xn;Uh==null&&(Uh=Tj(Nue)),qh==null&&(qh=Tj(Tue)),ee(n,"'",ng),ee(n,"{",kd),ee(n,"}",Sd),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,"&",tg),ee(n,"*",rg),ee(n,"@",eo),ee(n,"`",ig),ee(n,"^",og),ee(n,":",io),ee(n,",",SS),ee(n,"$",lg),ee(n,".",Os),ee(n,"=",ag),ee(n,"!",CS),ee(n,"-",Mr),ee(n,"%",Cd),ee(n,"|",ug),ee(n,"+",cg),ee(n,"#",dg),ee(n,"?",Ed),ee(n,'"',ES),ee(n,"/",Ps),ee(n,";",NS),ee(n,"~",Nd),ee(n,"_",fg),ee(n,"\\",sg),ee(n,"・",Rz);const r=Mt(n,li,bS,{[db]:!0});Mt(r,li,r);const s=Mt(r,oi,Nz,{[bd]:!0}),i=Mt(r,Lc,Tz,{[Yc]:!0}),o=Mt(n,oi,ci,{[fb]:!0});Mt(o,li,s),Mt(o,oi,o),Mt(s,li,s),Mt(s,oi,s);const l=Mt(n,Lc,mb,{[hb]:!0});Mt(l,oi),Mt(l,li,i),Mt(l,Lc,l),Mt(i,li,i),Mt(i,oi),Mt(i,Lc,i);const a=ee(n,jv,kS,{[Nv]:!0}),u=ee(n,Nj,xb,{[Nv]:!0}),c=Mt(n,Rv,xb,{[Nv]:!0});ee(n,Mv,c),ee(u,jv,a),ee(u,Mv,c),Mt(u,Rv,c),ee(c,Nj),ee(c,jv),Mt(c,Rv,c),ee(c,Mv,c);const d=Mt(n,Tv,jz,{[Ez]:!0});ee(d,"#"),Mt(d,Tv,d),ee(d,Pue,d);const f=ee(d,Aue);ee(f,"#"),Mt(f,Tv,d);const h=[[oi,o],[li,s]],m=[[oi,null],[Lc,l],[li,i]];for(let g=0;g<Uh.length;g++)qi(n,Uh[g],gb,ci,h);for(let g=0;g<qh.length;g++)qi(n,qh[g],yb,mb,m);Cl(gb,{tld:!0,ascii:!0},t),Cl(yb,{utld:!0,alpha:!0},t),qi(n,"file",Rp,ci,h),qi(n,"mailto",Rp,ci,h),qi(n,"http",za,ci,h),qi(n,"https",za,ci,h),qi(n,"ftp",za,ci,h),qi(n,"ftps",za,ci,h),Cl(Rp,{scheme:!0,ascii:!0},t),Cl(za,{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]?{[Rue]:!0}:{[jue]:!0};v.indexOf("-")>=0?w[pb]=!0:oi.test(v)?li.test(v)?w[bd]=!0:w[fb]=!0:w[db]=!0,Ej(n,v,v,w)}return Ej(n,"localhost",hf,{ascii:!0}),n.jd=new Xn(hg),{start:n,tokens:Object.assign({groups:t},Mz)}}function Oz(e,t){const n=Iue(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,f=-1;for(;o<r&&(a=l.go(n[o]));)l=a,l.accepts()?(d=0,f=0,c=l):d>=0&&(d+=n[o].length,f++),u+=n[o].length,i+=n[o].length,o++;i-=d,o-=f,u-=d,s.push({t:c.t,v:t.slice(i-u,i),s:i-u,e:i})}return s}function Iue(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 qi(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 Tj(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 pf={defaultProtocol:"http",events:null,format:Rj,formatHref:Rj,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function TS(e,t=null){let n=Object.assign({},pf);e&&(n=Object.assign(n,e instanceof TS?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}TS.prototype={o:pf,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]:pf[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 Rj(e){return e}function Pz(e,t){this.t="token",this.v=e,this.tk=t}Pz.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=pf.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 Pz{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 jj=My("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Mj=My("text"),Due=My("nl"),Wh=My("url",{isLink:!0,toHref(e=pf.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==hf&&e[1].t===io}}),jr=e=>new Xn(e);function Lue({groups:e}){const t=e.domain.concat([tg,rg,eo,sg,ig,og,lg,ag,Mr,bS,Cd,ug,cg,dg,Ps,hg,Nd,fg]),n=[ng,io,SS,Os,CS,Cd,Ed,ES,NS,qm,Wm,kd,Sd,Vm,Bm,Hm,Um,Km,Qm,Gm,Jm,Zm,Ym,Xm,eg],r=[tg,ng,rg,sg,ig,og,lg,ag,Mr,kd,Sd,Cd,ug,cg,dg,Ed,Ps,hg,Nd,fg],s=jr(),i=ee(s,Nd);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,eo);ee(i,eo,u),ee(l,eo,u),ee(a,eo,u);const c=ee(i,Os);Be(c,r,i),Be(c,e.domain,i);const d=jr();Be(u,e.domain,d),Be(d,e.domain,d);const f=ee(d,Os);Be(f,e.domain,d);const h=jr(jj);Be(f,e.tld,h),Be(f,e.utld,h),ee(u,hf,h);const m=ee(d,Mr);ee(m,Mr,m),Be(m,e.domain,d),Be(h,e.domain,d),ee(h,Os,f),ee(h,Mr,m);const g=ee(h,io);Be(g,e.numeric,jj);const v=ee(o,Mr),x=ee(o,Os);ee(v,Mr,v),Be(v,e.domain,o),Be(x,r,i),Be(x,e.domain,o);const w=jr(Wh);Be(x,e.tld,w),Be(x,e.utld,w),Be(w,e.domain,o),Be(w,r,i),ee(w,Os,x),ee(w,Mr,v),ee(w,eo,u);const b=ee(w,io),C=jr(Wh);Be(b,e.numeric,C);const S=jr(Wh),k=jr();Be(S,t,S),Be(S,n,k),Be(k,t,S),Be(k,n,k),ee(w,Ps,S),ee(C,Ps,S);const E=ee(l,io),T=ee(a,io),O=ee(T,Ps),N=ee(O,Ps);Be(l,e.domain,o),ee(l,Os,x),ee(l,Mr,v),Be(a,e.domain,o),ee(a,Os,x),ee(a,Mr,v),Be(E,e.domain,S),ee(E,Ps,S),ee(E,Ed,S),Be(N,e.domain,S),Be(N,t,S),ee(N,Ps,S);const j=[[kd,Sd],[Bm,Vm],[Hm,Um],[qm,Wm],[Km,Qm],[Gm,Jm],[Zm,Ym],[Xm,eg]];for(let P=0;P<j.length;P++){const[z,I]=j[P],L=ee(S,z);ee(k,z,L),ee(L,I,S);const H=jr(Wh);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,I,S),ee(K,I,S)}return ee(s,hf,w),ee(s,kS,Due),{start:s,tokens:Mz}}function $ue(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,f=-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()?(f=0,d=l):f>=0&&f++,s++,c++;if(f<0)s-=c,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push(Ov(Mj,t,o)),o=[]),s-=f,c-=f;const h=d.t,m=n.slice(s-c,s);i.push(Ov(h,t,m))}}return o.length>0&&i.push(Ov(Mj,t,o)),i}function Ov(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 zue=typeof console<"u"&&console&&console.warn||(()=>{}),Fue="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",xt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Bue(){return Xn.groups={},xt.scanner=null,xt.parser=null,xt.tokenQueue=[],xt.pluginQueue=[],xt.customSchemes=[],xt.initialized=!1,xt}function Oj(e,t=!1){if(xt.initialized&&zue(`linkifyjs: already initialized - will not register custom scheme "${e}" ${Fue}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format.
|
|
645
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
646
|
+
2. Cannot start or end with "-"
|
|
647
|
+
3. "-" cannot repeat`);xt.customSchemes.push([e,t])}function Vue(){xt.scanner=_ue(xt.customSchemes);for(let e=0;e<xt.tokenQueue.length;e++)xt.tokenQueue[e][1]({scanner:xt.scanner});xt.parser=Lue(xt.scanner.tokens);for(let e=0;e<xt.pluginQueue.length;e++)xt.pluginQueue[e][1]({scanner:xt.scanner,parser:xt.parser});return xt.initialized=!0,xt}function RS(e){return xt.initialized||Vue(),$ue(xt.parser.start,e,Oz(xt.scanner.start,e))}RS.scan=Oz;function Az(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 TS(n),s=RS(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 jS="[\0- -\u2029 ]",Hue=new RegExp(jS),Uue=new RegExp(`${jS}$`),que=new RegExp(jS,"g");function Wue(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function Kue(e){return new wt({key:new Ct("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=SL(n.doc,[...t]);if(ML(l).forEach(({newRange:u})=>{const c=SX(r.doc,u,h=>h.isTextblock);let d,f;if(c.length>1)d=c[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(c.length){const h=r.doc.textBetween(u.from,u.to," "," ");if(!Uue.test(h))return;d=c[0],f=r.doc.textBetween(d.pos,u.to,void 0," ")}if(d&&f){const h=f.split(Hue).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],g=d.pos+f.lastIndexOf(m);if(!m)return!1;const v=RS(m).map(x=>x.toObject(e.defaultProtocol));if(!Wue(v))return!1;v.filter(x=>x.isLink).map(x=>({...x,from:g+x.start+1,to:g+x.end+1})).filter(x=>r.schema.marks.code?!r.doc.rangeHasMark(x.from,x.to,r.schema.marks.code):!0).filter(x=>e.validate(x.value)).filter(x=>e.shouldAutoLink(x.value)).forEach(x=>{q1(x.from,x.to,r.doc).some(w=>w.mark.type===e.type)||o.addMark(x.from,x.to,e.type.create({href:x.href}))})}}),!!o.steps.length)return o}})}function Que(e){return new wt({key:new Ct("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=jL(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 Gue(e){return new wt({key:new Ct("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=Az(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 dl(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(que,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Jue=pa.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"){Oj(e);return}Oj(e.scheme,e.optionalSlashes)})},onDestroy(){Bue()},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)=>!!dl(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=>!!dl(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=>!!dl(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ut(this.options.HTMLAttributes,e),0]:["a",Ut(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=>!!dl(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=>!!dl(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[ra({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,s=Az(e).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!dl(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(Kue({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!dl(s,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(Que({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(Gue({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),Zue=Object.defineProperty,Yue=(e,t)=>{for(var n in t)Zue(e,n,{get:t[n],enumerable:!0})},Xue="listItem",Pj="textStyle",Aj=/^\s*([-+*])\s$/,_z=Tr.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",Ut(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,`
|
|
648
|
+
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Xue,this.editor.getAttributes(Pj)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=tc({find:Aj,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=tc({find:Aj,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Pj),editor:this.editor})),[e]}}),Iz=Tr.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",Ut(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)=>G1(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)}}}),ece={};Yue(ece,{findListItemPos:()=>qf,getNextListDepth:()=>MS,handleBackspace:()=>vb,handleDelete:()=>wb,hasListBefore:()=>Dz,hasListItemAfter:()=>tce,hasListItemBefore:()=>Lz,listItemHasSubList:()=>$z,nextListIsDeeper:()=>zz,nextListIsHigher:()=>Fz});var qf=(e,t)=>{const{$from:n}=t.selection,r=Ht(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}},MS=(e,t)=>{const n=qf(e,t);if(!n)return!1;const[,r]=AX(t,e,n.$pos.pos+4);return r},Dz=(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))},Lz=(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)},$z=(e,t,n)=>{if(!n)return!1;const r=Ht(e,t.schema);let s=!1;return n.descendants(i=>{i.type===r&&(s=!0)}),s},vb=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!Jo(e.state,t)&&Dz(e.state,t,n)){const{$anchor:l}=e.state.selection,a=e.state.doc.resolve(l.before()-1),u=[];a.node().descendants((f,h)=>{f.type.name===t&&u.push({node:f,pos:h})});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(!Jo(e.state,t)||!LX(e.state))return!1;const r=qf(t,e.state);if(!r)return!1;const i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=$z(t,e.state,i);return Lz(t,e.state)&&!o?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},zz=(e,t)=>{const n=MS(e,t),r=qf(e,t);return!r||!n?!1:n>r.depth},Fz=(e,t)=>{const n=MS(e,t),r=qf(e,t);return!r||!n?!1:n<r.depth},wb=(e,t)=>{if(!Jo(e.state,t)||!DX(e.state,t))return!1;const{selection:n}=e.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:zz(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():Fz(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},tce=(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)},Bz=Et.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&&wb(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&&wb(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&&vb(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&&vb(e,n,r)&&(t=!0)}),t}}}}),_j=/^(\s*)(\d+)\.\s+(.*)$/,nce=/^\s/;function rce(e){const t=[];let n=0,r=0;for(;n<e.length;){const s=e[n],i=s.match(_j);if(!i)break;const[,o,l,a]=i,u=o.length;let c=a,d=n+1;const f=[s];for(;d<e.length;){const h=e[d];if(h.match(_j))break;if(h.trim()==="")f.push(h),c+=`
|
|
649
|
+
`,d+=1;else if(h.match(nce))f.push(h),c+=`
|
|
650
|
+
${h.slice(u+2)}`,d+=1;else break}t.push({indent:u,number:parseInt(l,10),content:c.trim(),raw:f.join(`
|
|
651
|
+
`)}),r=d,n=d}return[t,r]}function Vz(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(`
|
|
652
|
+
`),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(`
|
|
653
|
+
`).trim();if(c){const h=n.blockTokens(c);u.push(...h)}let d=i+1;const f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){const h=Math.min(...f.map(g=>g.indent)),m=Vz(f,h,n);u.push({type:"list",ordered:!0,start:f[0].number,items:m,raw:f.map(g=>g.raw).join(`
|
|
654
|
+
`)})}s.push({type:"list_item",raw:o.raw,tokens:u}),i=d}else i+=1}return s}function sce(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 ice="listItem",Ij="textStyle",Dj=/^(\d+)\.\s$/,Hz=Tr.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",Ut(this.options.HTMLAttributes,n),0]:["ol",Ut(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?sce(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,`
|
|
655
|
+
`):"",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(`
|
|
656
|
+
`),[i,o]=rce(s);if(i.length===0)return;const l=Vz(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(`
|
|
657
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ice,this.editor.getAttributes(Ij)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=tc({find:Dj,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=tc({find:Dj,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(Ij)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),oce=/^\s*(\[([( |x])?\])\s$/,lce=Tr.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",Ut(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 G1(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 f,h;l.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,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:f}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const m=n();if(typeof m!="number")return!1;const g=h.doc.nodeAt(m);return h.setNodeMarkup(m,void 0,{...g==null?void 0:g.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{s.setAttribute(d,f)}),s.dataset.checked=e.attrs.checked,l.checked=e.attrs.checked,i.append(l,o),s.append(i,a),Object.entries(t).forEach(([d,f])=>{s.setAttribute(d,f)});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 f=r.extensionManager.attributes,h=cf(d,f),m=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return c.forEach(v=>{m.has(v)||(v in g?s.setAttribute(v,g[v]):s.removeAttribute(v))}),Object.entries(h).forEach(([v,x])=>{x==null?v in g?s.setAttribute(v,g[v]):s.removeAttribute(v):s.setAttribute(v,x)}),c=m,!0}}}},addInputRules(){return[tc({find:oce,type:this.type,getAttributes:e=>({checked:e[e.length-1]==="x"})})]}}),ace=Tr.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",Ut(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,`
|
|
658
|
+
`):"",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=Kw(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=Kw(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()}}});Et.create({name:"listKit",addExtensions(){const e=[];return this.options.bulletList!==!1&&e.push(_z.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(Iz.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(Bz.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Hz.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(lce.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(ace.configure(this.options.taskList)),e}});var Lj=" ",uce=" ",cce=Tr.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",Ut(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===Lj||r[0].text===uce)?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?Lj:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),dce=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,fce=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,hce=pa.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",Ut(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[ec({find:dce,type:this.type})]},addPasteRules(){return[ra({find:fce,type:this.type})]}}),pce=Tr.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),mce=pa.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",Ut(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 gce(e={}){return new wt({view(t){return new yce(t,e)}})}class yce{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,f=t.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let m=h.getBoundingClientRect(),g=d?m.bottom:m.top;d&&f&&(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),f=this.width/2*o;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,c;if(!a||a==document.body&&getComputedStyle(a).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;u=d.left-a.scrollLeft*f,c=d.top-a.scrollTop*h}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=gD(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 At extends Pe{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return At.valid(r)?new At(r):Pe.near(r)}content(){return ue.empty}eq(t){return t instanceof At&&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 At(t.resolve(n.pos))}getBookmark(){return new OS(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!xce(t)||!vce(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&&At.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(At.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(At.valid(l))return l}return null}}}At.prototype.visible=!1;At.findFrom=At.findGapCursorFrom;Pe.jsonID("gapcursor",At);class OS{constructor(t){this.pos=t}map(t){return new OS(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return At.valid(n)?new At(n):Pe.near(n)}}function Uz(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function xce(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||Uz(s.type))return!0;if(s.inlineContent)return!1}}return!0}function vce(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||Uz(s.type))return!0;if(s.inlineContent)return!1}}return!0}function wce(){return new wt({props:{decorations:Cce,createSelectionBetween(e,t,n){return t.pos==n.pos&&At.valid(n)?new At(n):null},handleClick:kce,handleKeyDown:bce,handleDOMEvents:{beforeinput:Sce}}})}const bce=L1({ArrowLeft:Kh("horiz",-1),ArrowRight:Kh("horiz",1),ArrowUp:Kh("vert",-1),ArrowDown:Kh("vert",1)});function Kh(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=At.findGapCursorFrom(l,t,a);return u?(s&&s(r.tr.setSelection(new At(u))),!0):!1}}function kce(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!At.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 At(r))),!0)}function Sce(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof At))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 Cce(e){if(!(e.selection instanceof At))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Tt.create(e.doc,[$n.widget(e.selection.head,t,{key:"gapcursor"})])}var pg=200,ln=function(){};ln.prototype.append=function(t){return t.length?(t=ln.from(t),!this.length&&t||t.length<pg&&this.leafAppend(t)||this.length<pg&&t.leafPrepend(this)||this.appendInner(t)):this};ln.prototype.prepend=function(t){return t.length?ln.from(t).append(this):this};ln.prototype.appendInner=function(t){return new Ece(this,t)};ln.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?ln.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};ln.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};ln.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)};ln.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};ln.from=function(t){return t instanceof ln?t:t&&t.length?new qz(t):ln.empty};var qz=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<=pg)return new t(this.values.concat(s.flatten()))},t.prototype.leafPrepend=function(s){if(this.length+s.length<=pg)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}(ln);ln.empty=new qz([]);var Ece=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}(ln);const Nce=500;class us{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,f)=>{if(!d.step){s||(s=this.remapping(r,f+1),i=s.maps.length),i--,c.push(d);return}if(s){c.push(new As(d.map));let h=d.step.map(s.slice(i)),m;h&&o.maybeStep(h).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],u.push(new As(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 us(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]),f=new As(t.mapping.maps[c],d,n),h;(h=a&&a.merge(f))&&(f=h,c?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(o++,n=void 0),s||(a=f)}let u=o-r.depth;return u>Rce&&(l=Tce(l,u),o-=u),new us(l.append(i),o)}remapping(t,n){let r=new rf;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 us(this.items.append(t.map(n=>new As(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(f=>{f.selection&&l--},s);let a=n;this.items.forEach(f=>{let h=i.getMirror(--a);if(h==null)return;o=Math.min(o,h);let m=i.maps[h];if(f.step){let g=t.steps[h].invert(t.docs[h]),v=f.selection&&f.selection.map(i.slice(a+1,h));v&&l++,r.push(new As(m,g,v))}else r.push(new As(m))},s);let u=[];for(let f=n;f<o;f++)u.push(new As(i.maps[f]));let c=this.items.slice(0,s).append(u).append(r),d=new us(c,l);return d.emptyItemCount()>Nce&&(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 As(u.invert(),a,c),f,h=s.length-1;(f=s.length&&s[h].merge(d))?s[h]=f:s.push(d)}}else o.map&&r--},this.items.length,0),new us(ln.from(s.reverse()),i)}}us.empty=new us(ln.empty,0);function Tce(e,t){let n;return e.forEach((r,s)=>{if(r.selection&&t--==0)return n=s,!1}),e.slice(n)}class As{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 As(n.getMap().invert(),n,this.selection)}}}class to{constructor(t,n,r,s,i){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const Rce=20;function jce(e,t,n,r){let s=n.getMeta(Bl),i;if(s)return s.historyState;n.getMeta(Pce)&&(e=new to(e.done,e.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(o&&o.getMeta(Bl))return o.getMeta(Bl).redo?new to(e.done.addTransform(n,void 0,r,jp(t)),e.undone,$j(n.mapping.maps),e.prevTime,e.prevComposition):new to(e.done,e.undone.addTransform(n,void 0,r,jp(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||!Mce(n,e.prevRanges)),u=o?Pv(e.prevRanges,n.mapping):$j(n.mapping.maps);return new to(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,jp(t)),us.empty,u,n.time,l??e.prevComposition)}else return(i=n.getMeta("rebased"))?new to(e.done.rebased(n,i),e.undone.rebased(n,i),Pv(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new to(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Pv(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function Mce(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 $j(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 Pv(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 Oce(e,t,n){let r=jp(t),s=Bl.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 to(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(Bl,{redo:n,historyState:a})}let Av=!1,zj=null;function jp(e){let t=e.plugins;if(zj!=t){Av=!1,zj=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){Av=!0;break}}return Av}const Bl=new Ct("history"),Pce=new Ct("closeHistory");function Ace(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new wt({key:Bl,state:{init(){return new to(us.empty,us.empty,null,0,-1)},apply(t,n,r){return jce(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,s=r=="historyUndo"?Kz:r=="historyRedo"?Qz:null;return!s||!t.editable?!1:(n.preventDefault(),s(t.state,t.dispatch))}}}})}function Wz(e,t){return(n,r)=>{let s=Bl.getState(n);if(!s||(e?s.undone:s.done).eventCount==0)return!1;if(r){let i=Oce(s,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const Kz=Wz(!1,!0),Qz=Wz(!0,!0);Et.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 wt({key:new Ct("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 _ce=Et.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[gce(this.options)]}});Et.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new wt({key:new Ct("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=t,i=[];if(!n||!r)return Tt.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($n.node(u,u+a.nodeSize,{class:this.options.className}))}),Tt.create(e,i)}}})]}});var Ice=Et.create({name:"gapCursor",addProseMirrorPlugins(){return[wce()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=lt(ke(e,"allowGapCursor",n)))!=null?t:null}}}),Fj="placeholder";function Dce(e){return e.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}Et.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Fj,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const e=this.options.dataAttribute?`data-${Dce(this.options.dataAttribute)}`:`data-${Fj}`;return[new wt({key:new Ct("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&&gy(l);if((u||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];o&&d.push(this.options.emptyEditorClass);const f=$n.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(f)}return this.options.includeChildren}),Tt.create(t,i)}}})]}});Et.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new wt({key:new Ct("selection"),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||OL(n.selection)||e.view.dragging?null:Tt.create(n.doc,[$n.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function Bj({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(t==null?void 0:t.type)===e}var Lce=Et.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var e;const t=new Ct(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 wt({key:t,appendTransaction:(s,i,o)=>{const{doc:l,tr:a,schema:u}=o,c=t.getState(o),d=l.content.size,f=u.nodes[n];if(c)return a.insert(d,f.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!Bj({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!Bj({node:o,types:r})}}})]}}),$ce=Et.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>Kz(e,t),redo:()=>({state:e,dispatch:t})=>Qz(e,t)}},addProseMirrorPlugins(){return[Ace(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()}}}),zce=Et.create({name:"starterKit",addExtensions(){var e,t,n,r;const s=[];return this.options.bold!==!1&&s.push(cue.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(iue.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(_z.configure(this.options.bulletList)),this.options.code!==!1&&s.push(hue.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(gue.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(yue.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(_ce.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(Ice.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(xue.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(vue.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push($ce.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(wue.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(Eue.configure(this.options.italic)),this.options.listItem!==!1&&s.push(Iz.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(Bz.configure((e=this.options)==null?void 0:e.listKeymap)),this.options.link!==!1&&s.push(Jue.configure((t=this.options)==null?void 0:t.link)),this.options.orderedList!==!1&&s.push(Hz.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(cce.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(hce.configure(this.options.strike)),this.options.text!==!1&&s.push(pce.configure(this.options.text)),this.options.underline!==!1&&s.push(mce.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(Lce.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),Fce=zce;function PS(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ya=PS();function Gz(e){ya=e}var Td={exec:()=>null};function nt(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(zn.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,t)};return r}var Bce=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),zn={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")},Vce=/^(?:[ \t]*(?:\n|$))+/,Hce=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Uce=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Wf=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,qce=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,AS=/(?:[*+-]|\d{1,9}[.)])/,Jz=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Zz=nt(Jz).replace(/bull/g,AS).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(),Wce=nt(Jz).replace(/bull/g,AS).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(),_S=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Kce=/^[^\n]+/,IS=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Qce=nt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",IS).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Gce=nt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,AS).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",DS=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Jce=nt("^ {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",DS).replace("tag",Oy).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Yz=nt(_S).replace("hr",Wf).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=nt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Yz).getRegex(),LS={blockquote:Zce,code:Hce,def:Qce,fences:Uce,heading:qce,hr:Wf,html:Jce,lheading:Zz,list:Gce,newline:Vce,paragraph:Yz,table:Td,text:Kce},Vj=nt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Wf).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(),Yce={...LS,lheading:Wce,table:Vj,paragraph:nt(_S).replace("hr",Wf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Vj).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()},Xce={...LS,html:nt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",DS).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:Td,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:nt(_S).replace("hr",Wf).replace("heading",` *#{1,6} *[^
|
|
659
|
+
]`).replace("lheading",Zz).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ede=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,tde=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Xz=/^( {2,}|\\)\n(?!\s*$)/,nde=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Py=/[\p{P}\p{S}]/u,$S=/[\s\p{P}\p{S}]/u,e3=/[^\s\p{P}\p{S}]/u,rde=nt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,$S).getRegex(),t3=/(?!~)[\p{P}\p{S}]/u,sde=/(?!~)[\s\p{P}\p{S}]/u,ide=/(?:[^\s\p{P}\p{S}]|~)/u,ode=nt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Bce?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),n3=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,lde=nt(n3,"u").replace(/punct/g,Py).getRegex(),ade=nt(n3,"u").replace(/punct/g,t3).getRegex(),r3="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ude=nt(r3,"gu").replace(/notPunctSpace/g,e3).replace(/punctSpace/g,$S).replace(/punct/g,Py).getRegex(),cde=nt(r3,"gu").replace(/notPunctSpace/g,ide).replace(/punctSpace/g,sde).replace(/punct/g,t3).getRegex(),dde=nt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,e3).replace(/punctSpace/g,$S).replace(/punct/g,Py).getRegex(),fde=nt(/\\(punct)/,"gu").replace(/punct/g,Py).getRegex(),hde=nt(/^<(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(),pde=nt(DS).replace("(?:-->|$)","-->").getRegex(),mde=nt("^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",pde).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),mg=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,gde=nt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",mg).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),s3=nt(/^!?\[(label)\]\[(ref)\]/).replace("label",mg).replace("ref",IS).getRegex(),i3=nt(/^!?\[(ref)\](?:\[\])?/).replace("ref",IS).getRegex(),yde=nt("reflink|nolink(?!\\()","g").replace("reflink",s3).replace("nolink",i3).getRegex(),Hj=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,zS={_backpedal:Td,anyPunctuation:fde,autolink:hde,blockSkip:ode,br:Xz,code:tde,del:Td,emStrongLDelim:lde,emStrongRDelimAst:ude,emStrongRDelimUnd:dde,escape:ede,link:gde,nolink:i3,punctuation:rde,reflink:s3,reflinkSearch:yde,tag:mde,text:nde,url:Td},xde={...zS,link:nt(/^!?\[(label)\]\((.*?)\)/).replace("label",mg).getRegex(),reflink:nt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",mg).getRegex()},bb={...zS,emStrongRDelimAst:cde,emStrongLDelim:ade,url:nt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Hj).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:nt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Hj).getRegex()},vde={...bb,br:nt(Xz).replace("{2,}","*").getRegex(),text:nt(bb.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Qh={normal:LS,gfm:Yce,pedantic:Xce},$c={normal:zS,gfm:bb,breaks:vde,pedantic:xde},wde={"&":"&","<":"<",">":">",'"':""","'":"'"},Uj=e=>wde[e];function di(e,t){if(t){if(zn.escapeTest.test(e))return e.replace(zn.escapeReplace,Uj)}else if(zn.escapeTestNoEncode.test(e))return e.replace(zn.escapeReplaceNoEncode,Uj);return e}function qj(e){try{e=encodeURI(e).replace(zn.percentDecode,"%")}catch{return null}return e}function Wj(e,t){var i;let n=e.replace(zn.findPipe,(o,l,a)=>{let u=!1,c=l;for(;--c>=0&&a[c]==="\\";)u=!u;return u?"|":" |"}),r=n.split(zn.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(zn.slashPipe,"|");return r}function zc(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 bde(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 Kj(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 kde(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let s=r[1];return t.split(`
|
|
660
|
+
`).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(`
|
|
661
|
+
`)}var gg=class{constructor(e){ot(this,"options");ot(this,"rules");ot(this,"lexer");this.options=e||ya}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:zc(n,`
|
|
662
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=kde(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=zc(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:zc(t[0],`
|
|
663
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=zc(t[0],`
|
|
664
|
+
`).split(`
|
|
665
|
+
`),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(`
|
|
666
|
+
`),c=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
667
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
668
|
+
${u}`:u,s=s?`${s}
|
|
669
|
+
${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 f=i.at(-1);if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){let h=f,m=h.raw+`
|
|
670
|
+
`+n.join(`
|
|
671
|
+
`),g=this.blockquote(m);i[i.length-1]=g,r=r.substring(0,r.length-h.raw.length)+g.raw,s=s.substring(0,s.length-h.text.length)+g.text;break}else if((f==null?void 0:f.type)==="list"){let h=f,m=h.raw+`
|
|
672
|
+
`+n.join(`
|
|
673
|
+
`),g=this.list(m);i[i.length-1]=g,r=r.substring(0,r.length-f.raw.length)+g.raw,s=s.substring(0,s.length-h.raw.length)+g.raw,n=m.substring(i.at(-1).raw.length).split(`
|
|
674
|
+
`);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="",f="";if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let h=t[2].split(`
|
|
675
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,x=>" ".repeat(3*x.length)),m=e.split(`
|
|
676
|
+
`,1)[0],g=!h.trim(),v=0;if(this.options.pedantic?(v=2,f=h.trimStart()):g?v=t[1].length+1:(v=t[2].search(this.rules.other.nonSpaceChar),v=v>4?1:v,f=h.slice(v),v+=t[1].length),g&&this.rules.other.blankLine.test(m)&&(d+=m+`
|
|
677
|
+
`,e=e.substring(m.length+1),c=!0),!c){let x=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(`
|
|
678
|
+
`,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)||x.test(m)||w.test(m))break;if(E.search(this.rules.other.nonSpaceChar)>=v||!m.trim())f+=`
|
|
679
|
+
`+E.slice(v);else{if(g||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||b.test(h)||C.test(h)||w.test(h))break;f+=`
|
|
680
|
+
`+m}!g&&!m.trim()&&(g=!0),d+=k+`
|
|
681
|
+
`,e=e.substring(k.length+1),h=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(f),loose:!1,text:f,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 f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}}let d=this.rules.other.listTaskCheckbox.exec(c.raw);if(d){let f={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};c.checked=f.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=f.raw+c.tokens[0].raw,c.tokens[0].text=f.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(f)):c.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):c.tokens.unshift(f)}}if(!o.loose){let d=c.tokens.filter(h=>h.type==="space"),f=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));o.loose=f}}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=Wj(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(`
|
|
682
|
+
`):[],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(Wj(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)===`
|
|
683
|
+
`?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=zc(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=bde(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)),Kj(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 Kj(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 h=d.slice(1,-1);return{type:"em",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}let f=d.slice(2,-2);return{type:"strong",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}}}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}}}},ls=class kb{constructor(t){ot(this,"tokens");ot(this,"options");ot(this,"state");ot(this,"inlineQueue");ot(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||ya,this.options.tokenizer=this.options.tokenizer||new gg,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:zn,block:Qh.normal,inline:$c.normal};this.options.pedantic?(n.block=Qh.pedantic,n.inline=$c.pedantic):this.options.gfm&&(n.block=Qh.gfm,this.options.breaks?n.inline=$c.breaks:n.inline=$c.gfm),this.tokenizer.rules=n}static get rules(){return{block:Qh,inline:$c}}static lex(t,n){return new kb(n).lex(t)}static lexInline(t,n){return new kb(n).inlineTokens(t)}lex(t){t=t.replace(zn.carriageReturn,`
|
|
684
|
+
`),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(zn.tabCharGlobal," ").replace(zn.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+=`
|
|
685
|
+
`: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(`
|
|
686
|
+
`)?"":`
|
|
687
|
+
`)+l.raw,u.text+=`
|
|
688
|
+
`+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(`
|
|
689
|
+
`)?"":`
|
|
690
|
+
`)+l.raw,u.text+=`
|
|
691
|
+
`+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(f=>{d=f.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(`
|
|
692
|
+
`)?"":`
|
|
693
|
+
`)+l.raw,u.text+=`
|
|
694
|
+
`+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(`
|
|
695
|
+
`)?"":`
|
|
696
|
+
`)+l.raw,u.text+=`
|
|
697
|
+
`+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,f;let r=t,s=null;if(this.tokens.links){let h=Object.keys(this.tokens.links);if(h.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)h.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 h;if((d=(c=this.options.extensions)==null?void 0:c.inline)!=null&&d.some(g=>(h=g.call({lexer:this},t,n))?(t=t.substring(h.raw.length),n.push(h),!0):!1))continue;if(h=this.tokenizer.escape(t)){t=t.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.tag(t)){t=t.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.link(t)){t=t.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(h.raw.length);let g=n.at(-1);h.type==="text"&&(g==null?void 0:g.type)==="text"?(g.raw+=h.raw,g.text+=h.text):n.push(h);continue}if(h=this.tokenizer.emStrong(t,r,l)){t=t.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.codespan(t)){t=t.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.br(t)){t=t.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.del(t)){t=t.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.autolink(t)){t=t.substring(h.raw.length),n.push(h);continue}if(!this.state.inLink&&(h=this.tokenizer.url(t))){t=t.substring(h.raw.length),n.push(h);continue}let m=t;if((f=this.options.extensions)!=null&&f.startInline){let g=1/0,v=t.slice(1),x;this.options.extensions.startInline.forEach(w=>{x=w.call({lexer:this},v),typeof x=="number"&&x>=0&&(g=Math.min(g,x))}),g<1/0&&g>=0&&(m=t.substring(0,g+1))}if(h=this.tokenizer.inlineText(m)){t=t.substring(h.raw.length),h.raw.slice(-1)!=="_"&&(l=h.raw.slice(-1)),o=!0;let g=n.at(-1);(g==null?void 0:g.type)==="text"?(g.raw+=h.raw,g.text+=h.text):n.push(h);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}},yg=class{constructor(e){ot(this,"options");ot(this,"parser");this.options=e||ya}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let r=(i=(t||"").match(zn.notSpaceStart))==null?void 0:i[0],s=e.replace(zn.endingNewline,"")+`
|
|
698
|
+
`;return r?'<pre><code class="language-'+di(r)+'">'+(n?s:di(s,!0))+`</code></pre>
|
|
699
|
+
`:"<pre><code>"+(n?s:di(s,!0))+`</code></pre>
|
|
700
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
701
|
+
${this.parser.parse(e)}</blockquote>
|
|
702
|
+
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
703
|
+
`}hr(e){return`<hr>
|
|
704
|
+
`}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+`>
|
|
705
|
+
`+r+"</"+s+`>
|
|
706
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
707
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
708
|
+
`}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>
|
|
709
|
+
<thead>
|
|
710
|
+
`+t+`</thead>
|
|
711
|
+
`+r+`</table>
|
|
712
|
+
`}tablerow({text:e}){return`<tr>
|
|
713
|
+
${e}</tr>
|
|
714
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
715
|
+
`}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>${di(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=qj(e);if(s===null)return r;e=s;let i='<a href="'+e+'"';return t&&(i+=' title="'+di(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=qj(e);if(s===null)return di(n);e=s;let i=`<img src="${e}" alt="${n}"`;return t&&(i+=` title="${di(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:di(e.text)}},FS=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}},as=class Sb{constructor(t){ot(this,"options");ot(this,"renderer");ot(this,"textRenderer");this.options=t||ya,this.options.renderer=this.options.renderer||new yg,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new FS}static parse(t,n){return new Sb(n).parse(t)}static parseInline(t,n){return new Sb(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}},Zh,Xc=(Zh=class{constructor(e){ot(this,"options");ot(this,"block");this.options=e||ya}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?ls.lex:ls.lexInline}provideParser(){return this.block?as.parse:as.parseInline}},ot(Zh,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ot(Zh,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Zh),Sde=class{constructor(...e){ot(this,"defaults",PS());ot(this,"options",this.setOptions);ot(this,"parse",this.parseMarkdown(!0));ot(this,"parseInline",this.parseMarkdown(!1));ot(this,"Parser",as);ot(this,"Renderer",yg);ot(this,"TextRenderer",FS);ot(this,"Lexer",ls);ot(this,"Tokenizer",gg);ot(this,"Hooks",Xc);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 yg(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 gg(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 Xc;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];Xc.passThroughHooks.has(i)?s[o]=u=>{if(this.defaults.async&&Xc.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 ls.lex(e,t??this.defaults)}parser(e,t){return as.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?ls.lex:ls.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?as.parse:as.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?ls.lex:ls.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?as.parse:as.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+=`
|
|
716
|
+
Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+di(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},sa=new Sde;function at(e,t){return sa.parse(e,t)}at.options=at.setOptions=function(e){return sa.setOptions(e),at.defaults=sa.defaults,Gz(at.defaults),at};at.getDefaults=PS;at.defaults=ya;at.use=function(...e){return sa.use(...e),at.defaults=sa.defaults,Gz(at.defaults),at};at.walkTokens=function(e,t){return sa.walkTokens(e,t)};at.parseInline=sa.parseInline;at.Parser=as;at.parser=as.parse;at.Renderer=yg;at.TextRenderer=FS;at.Lexer=ls;at.lexer=ls.lex;at.Tokenizer=gg;at.Hooks=Xc;at.parse=at;at.options;at.setOptions;at.use;at.walkTokens;at.parseInline;as.parse;ls.lex;function Cde(e,t){const r=t.split(`
|
|
717
|
+
`).flatMap(s=>[s,""]).map(s=>`${e}${s}`).join(`
|
|
718
|
+
`);return r.slice(0,r.length-1)}function Ede(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 Nde(e,t){const n=[];return Array.from(t.entries()).forEach(([r,s])=>{e.has(r)||n.push({type:r,mark:s})}),n}function Tde(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 Rde(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 jde(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 _v(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 Gh(e,t){return typeof e!="string"?"json":t}var Mde=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:at,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,my(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 f=this.registry.get(i)||[];f.push(d),this.registry.set(i,f)}if(l){const f=this.nodeTypeRegistry.get(s)||[];f.push(d),this.nodeTypeRegistry.set(s,f)}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 f=s(c,d,l);if(f&&f.type)return{...f,type:f.type||t,raw:f.raw||"",tokens:f.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=>_v(l).isTask),n=e.items.some(l=>!_v(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}=_v(a);let f=a;if(u){const g=(a.raw||a.text||"").split(`
|
|
719
|
+
`),v=g[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),x=v?v[2]:"";let w=[];if(g.length>1&&g.slice(1).join(`
|
|
720
|
+
`).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)),T=C.map(O=>O.trim()?O.slice(k):"").join(`
|
|
721
|
+
`).trim();T&&(w=this.markedInstance.lexer(`${T}
|
|
722
|
+
`))}}f={type:"taskItem",raw:"",mainContent:x,indentLevel:d,checked:c??!1,text:x,tokens:this.lexer.inlineTokens(x),nestedTokens:w}}const h=u?"taskList":"list";i!==h?(s.length>0&&r.push({type:i,items:s}),s=[f],i=h):s.push(f)}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 f=c[1],h=this.escapeRegex(f),m=new RegExp(`^<\\/\\s*${h}\\b`,"i");let g=-1;const v=[a];for(let x=o+1;x<e.length;x+=1){const w=e[x],b=((s=(r=w.raw)!=null?r:w.text)!=null?s:"").toString();if(v.push(b),w.type==="html"&&m.test(b)){g=x;break}}if(g!==-1){const x=v.join(""),w={type:"html",raw:x,text:x,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 f=this.normalizeParseResult(d);Array.isArray(f)?i.push(...f):f&&i.push(f)}}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=jX(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:Cde},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(x=>[x.type,x])),d=Nde(i,c),f=Ede(c,a);let h="";if(f.length>0){const x=u.match(/(\s+)$/);x&&(h=x[1],u=u.slice(0,-h.length))}f.forEach(x=>{const w=c.get(x),b=this.getMarkClosing(x,w);b&&(u+=b),i.has(x)&&i.delete(x)});let m="";if(d.length>0){const x=u.match(/^(\s+)/);x&&(m=x[1],u=u.slice(m.length))}d.forEach(({type:x,mark:w})=>{const b=this.getMarkOpening(x,w);b&&(u=b+u),f.includes(x)||i.set(x,w)}),u=m+u;const g=Tde(i,c,a,this.markSetsEqual.bind(this));let v="";if(g.length>0){const x=u.match(/(\s+)$/);x&&(v=x[1],u=u.slice(0,-v.length))}g.forEach(x=>{const w=i.get(x),b=this.getMarkClosing(x,w);b&&(u+=b),i.delete(x)}),u+=v,u+=h,s.push(u)}else{const u=new Map(i),c=Rde(i,this.getMarkClosing.bind(this)),d=this.renderNodeToMarkdown(o,t,l,r),f=o.type==="hardBreak"?"":jde(u,i,this.getMarkOpening.bind(this));s.push(c+d+f)}}),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))}},Qj=Mde,Ode=Et.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(e,t)=>{if(!(t!=null&&t.contentType)||Gh(e,t==null?void 0:t.contentType)!=="markdown"||!this.editor.markdown)return Xr.setContent(e,t);const r=this.editor.markdown.parse(e);return Xr.setContent(r,t)},insertContent:(e,t)=>{if(!(t!=null&&t.contentType)||Gh(e,t==null?void 0:t.contentType)!=="markdown"||!this.editor.markdown)return Xr.insertContent(e,t);const r=this.editor.markdown.parse(e);return Xr.insertContent(r,t)},insertContentAt:(e,t,n)=>{if(!(n!=null&&n.contentType)||Gh(t,n==null?void 0:n.contentType)!=="markdown"||!this.editor.markdown)return Xr.insertContentAt(e,t,n);const s=this.editor.markdown.parse(t);return Xr.insertContentAt(e,s,n)}}},addStorage(){return{manager:new Qj({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 Qj({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||Gh(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 Pde=()=>{const[e,t]=y.useState(!1);return{open:e,setOpen:t}},Ade=({active:e,isDirty:t,conflict:n,lastEditAt:r,autosave:s,autosaveTimeoutRef:i,saveStatusStartRef:o,setSaveStatus:l})=>{y.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])},_de=({docs:e,active:t,setActive:n,status:r,setStatus:s})=>{const{activeProject:i}=$t(),{tab:o,docName:l,navigateToDoc:a}=ky(),u=(i==null?void 0:i.id)??"";return y.useEffect(()=>{if(o!=="docs"||!l||(t==null?void 0:t.name)===l)return;const d=e.find(f=>f.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]),y.useEffect(()=>{if(o!=="docs"||l||!u||e.length===0)return;const d=e[0];a(u,d.name)},[l,e,a,u,o]),{encodePath:y.useCallback(d=>`${u}/docs/0/${d.split("/").map(encodeURIComponent).join("/")}`,[u]),currentPathDoc:o==="docs"?l:null}},Ide=({editor:e,active:t,content:n,setIsDirty:r,setLastEditAt:s,setMarkdownInEditor:i,pendingNormalizeRef:o,lastEditorContentRef:l})=>{y.useEffect(()=>{e&&(!t||t.type!=="markdown"||n&&l.current!==n&&(i(n),l.current=n,o.current=!0))},[t,n,e,l,o,i]),y.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])},Dde=/^\uFEFF?\s*<!--\s*hyperdoc:([A-Za-z0-9+/=]+)\s*-->\s*(?:\r?\n|$)/i,Lde=/^\uFEFF?\s*<!--\s*hyperdoc:[A-Za-z0-9+/=]+\s*-->\s*(?:\r?\n|$)/i,$de=/^\s*<!--\s*title:\s*.+?\s*-->\s*(?:\r?\n|$)/i,zde=e=>e.replace(/^\uFEFF/,""),Fde=e=>{if(!e)return e;const t=e.match(/^\s*(?:\r?\n)/);return t?e.slice(t[0].length):e},Jh=(e,t)=>{if(e.length!==t.length)return!1;const n=[...e].sort(),r=[...t].sort();return n.every((s,i)=>s===r[i])},Bde=$r({bundleUrl:tn().trim().min(1).optional(),bundlePath:tn().trim().min(1).optional(),cssUrl:tn().trim().min(1).optional(),cssPath:tn().trim().min(1).optional(),mountId:tn().trim().min(1),bundleType:zI(["module","classic"]).optional(),backgroundColor:tn().trim().optional(),metadata:$r({tags:Ku(tn()).optional(),pinned:vp().optional()}).optional()}).passthrough().superRefine((e,t)=>{!e.bundleUrl&&!e.bundlePath&&t.addIssue({code:se.custom,message:"Provide bundleUrl or bundlePath."})}),Vde=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`client_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`,Hde=()=>typeof crypto<"u"&&"randomUUID"in crypto?`hyperdoc-${crypto.randomUUID()}`:`hyperdoc-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`,Ude=({openCreateDialog:e,openMetadataDialog:t,setAgentsSidebarOpen:n,createAgent:r,openZapper:s})=>{const{apiRoot:i,activeProject:o,openCreateProject:l,openManageProjects:a}=$t(),[u,c]=y.useState(null),[d,f]=y.useState(""),[h,m]=y.useState(""),[g,v]=y.useState(""),x=y.useRef(!1),w=y.useRef(""),b=y.useRef(""),[C,S]=y.useState("idle"),k=y.useRef(null),E=y.useRef(null),T=y.useRef(null),[O,N]=y.useState(null),[j,P]=y.useState(null),[z,I]=y.useState(""),[L,H]=y.useState(!1),[K,_]=y.useState(!1),[Q,M]=y.useState(null),[ie,V]=y.useState([]),[R,D]=y.useState([]),F=$g(),Y=y.useRef(null),G=y.useRef(!1),ve=y.useRef(Vde()),[me,Je]=y.useState(null),{open:bt,setOpen:It}=Pde(),kt=y.useMemo(()=>m_(),[]),$e=Qte({extensions:[Fce.configure({codeBlock:{languageClassPrefix:"language-"}}),Ode.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"}}}),Zt=Fi(),ht=y.useCallback(async $=>{const B=await fetch(`${i}/doc/${encodeURIComponent($)}`,{cache:"no-store"});if(B.status===404)throw new Mk("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:Kn,folders:Es,docsQuery:Qn,updateDocsCache:ct,invalidateDocs:Qr}=g_(),{tags:al,errorMessage:Ns,invalidateTags:Gr}=g2(),{encodePath:An}=_de({docs:Kn,active:u,setActive:c,status:h,setStatus:m});y.useEffect(()=>{Qn.error&&m(String(Qn.error))},[Qn.error]);const U=y.useCallback(()=>{if(!$e)return"";const $=$e;return $.getMarkdown?$.getMarkdown():""},[$e]),le=y.useCallback($=>{var we;if(!$e)return;const B=$e;if((((we=B.getMarkdown)==null?void 0:we.call(B))??"")===$)return;const{from:Z,to:fe}=$e.state.selection;if(B.markdown){const ae=B.markdown.parse($);$e.commands.setContent(ae,{emitUpdate:!1})}else $e.commands.setContent($,{emitUpdate:!1});try{const ae=$e.state.doc.content.size,Ce=Math.min(Z,ae),We=Math.min(fe,ae);Ce>=0&&We>=0&&$e.commands.setTextSelection({from:Ce,to:We})}catch{}},[$e]),Ae=y.useCallback($=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem($)==="1"}catch{return!1}},[]),Fe=y.useCallback(($,B)=>{const X=$.trim();if(!X)return"";const Z=Ce=>Ce.toLowerCase().replace(/[\s_]+/g,"-").replace(/-{2,}/g,"-").replace(/^-|-$/g,""),fe=X.toLowerCase();let we=X;const ae=[".app.json",".table.json",".prompt.yaml",".yaml",".json",".md"];for(const Ce of ae)if(fe.endsWith(Ce)){we=X.slice(0,X.length-Ce.length);break}return B==="app"?`${Z(we)}.app.json`:B==="prompt"?`${Z(we)}.prompt.yaml`:B==="json"?`${Z(we)}.table.json`:`${Z(we)}.md`},[]),Ze=y.useCallback($=>$.endsWith(".app.json")?$.slice(0,-9):$.endsWith(".table.json")?$.slice(0,-11):$.endsWith(".prompt.yaml")?$.slice(0,-12):$.replace(/\.(md|json|yaml)$/i,""),[]),Yt=y.useCallback(($,B)=>Fe($,B),[Fe]),q=y.useCallback($=>{try{const B=atob($),X=Uint8Array.from(B,Z=>Z.charCodeAt(0));return new TextDecoder().decode(X)}catch{return null}},[]),W=y.useCallback($=>{const B=new TextEncoder().encode($);let X="";return B.forEach(Z=>{X+=String.fromCharCode(Z)}),btoa(X)},[]),Ee=y.useCallback($=>{const B=$.match(Dde);if(!B)return null;const X=q(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,we=Array.isArray(Z.tags)?Z.tags.filter(Ce=>typeof Ce=="string"):[],ae=Z.pinned===!0;return{title:fe,tags:we,pinned:ae}}catch{return null}},[q]),Oe=y.useCallback($=>{let B="",X=!1,Z=!1,fe=!1,we=!1;for(let ae=0;ae<$.length;ae+=1){const Ce=$[ae],We=$[ae+1];if(fe){Ce===`
|
|
723
|
+
`&&(fe=!1,B+=Ce);continue}if(we){Ce==="*"&&We==="/"&&(we=!1,ae+=1);continue}if(X){if(B+=Ce,Z){Z=!1;continue}if(Ce==="\\"){Z=!0;continue}Ce==='"'&&(X=!1);continue}if(Ce==='"'){X=!0,B+=Ce;continue}if(Ce==="/"&&We==="/"){fe=!0,ae+=1;continue}if(Ce==="/"&&We==="*"){we=!0,ae+=1;continue}B+=Ce}return B},[]),Ne=y.useCallback($=>{let B="",X=!1,Z=!1;for(let fe=0;fe<$.length;fe+=1){const we=$[fe];if(X){if(B+=we,Z){Z=!1;continue}if(we==="\\"){Z=!0;continue}we==='"'&&(X=!1);continue}if(we==='"'){X=!0,B+=we;continue}if(we===","){let ae=fe+1;for(;ae<$.length&&/\s/.test($[ae]);)ae+=1;if($[ae]==="}"||$[ae]==="]")continue}B+=we}return B},[]),Xe=y.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=Ne(Oe(B)),Z=JSON.parse(X);return!Z||typeof Z!="object"||Array.isArray(Z)?null:Z}catch{return null}}},[Oe,Ne]),st=y.useCallback($=>{const B=Xe($);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(ae=>typeof ae=="string"):[],we=Z.pinned===!0;return{tags:fe,pinned:we}},[Xe]),BS=y.useCallback(($,B)=>{const X=Xe($);if(!X)return{config:null,error:"Invalid JSON."};const Z=Bde.safeParse(X);if(!Z.success)return{config:null,error:Z.error.issues.map(Ce=>Ce.message).join(" ")||"Invalid app config."};let fe;if(Z.data.bundleUrl)fe=Z.data.bundleUrl;else if(Z.data.bundlePath){const ae=Z.data.bundlePath.replace(/^\/+/,"");fe=B?`${B}/${ae}`:Z.data.bundlePath}else fe="";let we;if(Z.data.cssUrl)we=Z.data.cssUrl;else if(Z.data.cssPath){const ae=Z.data.cssPath.replace(/^\/+/,"");we=B?`${B}/${ae}`:Z.data.cssPath}return{config:{bundleUrl:fe,cssUrl:we,mountId:Z.data.mountId,bundleType:Z.data.bundleType,backgroundColor:Z.data.backgroundColor,metadata:Z.data.metadata},error:null}},[Xe]),VS=y.useCallback(($,B)=>{var X,Z;return B==="markdown"||B==="prompt"?((X=Ee($))==null?void 0:X.tags)??[]:B==="json"||B==="app"?((Z=st($))==null?void 0:Z.tags)??[]:[]},[st,Ee]),Ay=y.useCallback($=>{const B=JSON.stringify({v:1,title:$.title,tags:$.tags,...$.pinned?{pinned:!0}:{}});return`<!-- hyperdoc:${W(B)} -->
|
|
724
|
+
|
|
725
|
+
`},[W]),Kf=y.useCallback($=>{let B=$.replace(/^\uFEFF/,""),X="";for(;B!==X;)X=B,B=B.replace(Lde,"").replace($de,"");return Fde(B)},[]),_y=y.useCallback(($,B,X)=>{if(B==="markdown"||B==="prompt"){const Z=zde(Kf($));return`${Ay({title:null,tags:X.tags,pinned:X.pinned})}${Z}`}if(B==="json"||B==="app"){const Z=Xe($);if(!Z)return null;const fe=Z.metadata,we=fe&&typeof fe=="object"&&!Array.isArray(fe)?{...fe}:{};X.tags.length>0?we.tags=X.tags:delete we.tags,X.pinned?we.pinned=!0:delete we.pinned;const ae={...Z};return Object.keys(we).length>0?ae.metadata=we:delete ae.metadata,JSON.stringify(ae,null,2)}return $},[Ay,Xe,Kf]),HS=y.useCallback($=>{const B=$.trim().toLowerCase();return!B||!/^[a-z]+$/.test(B)?"":B},[]),US=y.useCallback($=>{const B=$.map(X=>HS(X)).filter(X=>X.length>0);return Array.from(new Set(B)).sort()},[HS]),xa=Pf({queryKey:["doc",o==null?void 0:o.id,u==null?void 0:u.name],queryFn:()=>ht((u==null?void 0:u.name)??""),enabled:!!(u!=null&&u.name),refetchInterval:!1,refetchOnWindowFocus:!1});y.useEffect(()=>{xa.error&&m(String(xa.error))},[xa.error]),y.useEffect(()=>{var Ce;if(!u||!xa.data||L)return;const $=xa.data,B=$.content??"",X=$.metadata??null,Z=B===d,fe=u.type==="markdown"||u.type==="prompt"?(X==null?void 0:X.tags)??[]:VS(B,u.type);Jh(fe,ie)||V(fe),typeof $.mtimeMs=="number"&&M($.mtimeMs);const we=w.current!==u.name;if(!we&&Z)return;f(B),v(B),H(!1),_(!1),we&&(P(null),I("")),u.type==="markdown"&&$e&&(le(B),b.current=B,x.current=!0);const ae=u.type==="markdown"||u.type==="prompt"?X==null?void 0:X.pinned:(Ce=st(B))==null?void 0:Ce.pinned;ae!==void 0&&(ct(We=>We.map(yn=>yn.name===u.name?{...yn,pinned:ae}:yn)),c(We=>We&&We.name===u.name?{...We,pinned:ae}:We)),w.current=u.name},[u,ie,d,xa.data,$e,VS,L,st,le,ct]),Ide({editor:$e,active:u,content:d,setIsDirty:H,setLastEditAt:N,setMarkdownInEditor:le,pendingNormalizeRef:x,lastEditorContentRef:b}),y.useEffect(()=>{u||M(null)},[u]);const qS=y.useMemo(()=>u?(u.displayName??Ze(u.name)).trim():"",[u,Ze]);y.useEffect(()=>{if(!u){R.length>0&&D([]);return}Jh(ie,R)||D(ie)},[u,ie,qS,R]),y.useEffect(()=>{me&&(!u||u.name!==me.name||(requestAnimationFrame(()=>{var $;return($=Y.current)==null?void 0:$.focus()}),Je(null)))},[u,me]);const WS=y.useCallback(($,B)=>Jh($,B),[]),ri=y.useCallback(async($,B)=>{if(!u)return null;const X=(B==null?void 0:B.name)??u.name,Z=(B==null?void 0:B.type)??u.type,fe=u.name===X,we=(B==null?void 0:B.tags)??(fe?R:[]),ae=(B==null?void 0:B.pinned)??(fe?u.pinned??!1:!1);let Ce=$;if(Z==="markdown"||Z==="prompt"){const vn=_y(Ce,Z,{tags:we,pinned:ae});if(vn===null)return m("Cannot update metadata. JSON must be an object."),null;Ce=vn}else if((Z==="json"||Z==="app")&&((B==null?void 0:B.tags)!==void 0||(B==null?void 0:B.pinned)!==void 0)){const Jf=_y($,Z,{tags:we,pinned:ae});if(Jf===null)return m("Cannot update metadata. JSON must be an object."),null;Ce=Jf}const We=Z==="markdown"||Z==="prompt"?Kf(Ce):Ce,yn=250;fe&&(k.current&&(clearTimeout(k.current),k.current=null),E.current=Date.now(),S("saving")),G.current=!0;const _n=(B==null?void 0:B.baseVersion)??(fe?Q: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":ve.current},body:Ce});setTimeout(()=>{G.current=!1},500);const Rr=vn=>{if(!fe)return;const Jf=E.current??Date.now(),T3=Date.now()-Jf,R3=Math.max(0,yn-T3);k.current=setTimeout(()=>{S(vn),k.current=null},R3)};if(xn.status===409){try{const vn=await xn.json();fe&&typeof vn.mtimeMs=="number"&&M(vn.mtimeMs)}catch{}return fe&&_(!0),m("Conflict: file changed on disk."),Rr("idle"),null}if(!xn.ok)return m(`Save failed: ${xn.status}`),Rr("idle"),null;const Iy=await xn.json();return fe&&(M(Iy.mtimeMs??null),v(We),f(We),b.current=We,H(!1),_(!1)),Zt.setQueryData(["doc",o==null?void 0:o.id,X],vn=>({...vn??{content:We},content:We,mtimeMs:Iy.mtimeMs??(vn==null?void 0:vn.mtimeMs),metadata:Z==="markdown"||Z==="prompt"?{tags:we,pinned:ae}:(vn==null?void 0:vn.metadata)??null})),Rr("saved"),Ce},[u,o==null?void 0:o.id,i,_y,Q,R,Zt,Kf]),{jsonError:o3,jsonData:yc,tableDefaults:l3,tableView:a3,setTableView:u3,effectiveSchema:xc,handleTableRowsChange:c3,handleAddRow:d3,commitTableUpdate:Qf,persistTableView:f3,createColumnId:KS,parseColumnOptions:h3}=gG({active:u,content:d,lastSaved:g,headerTags:R,setContent:f,setIsDirty:H,setLastEditAt:N,writeDoc:ri}),p3=y.useCallback(async $=>{if(!u)return;const B=Yt($,u.type);if(B===u.name)return;const X=await fetch(`${i}/doc/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:u.name,to:B})});if(!X.ok){m(`Rename failed: ${X.status}`);return}const Z=await X.json();c(fe=>fe&&{...fe,...Z}),ct(fe=>{const we=fe.map(ae=>ae.name===u.name?{...ae,...Z}:ae);return we.sort((ae,Ce)=>(ae.displayName??ae.name).localeCompare(Ce.displayName??Ce.name)),we}),F(`/${An(Z.name)}`,{replace:!0})},[u,i,Yt,An,F,ct]),m3=y.useCallback(async()=>{if(!u)return;const $=u.type==="markdown"&&$e?U():d,B=!WS(R,ie);if(L||B){const Z=u.type==="markdown"||u.type==="prompt"||B?R:void 0;if(!await ri($,{tags:Z,pinned:u.type==="markdown"||u.type==="prompt"?u.pinned??!1:void 0}))return}B&&(V(R),Gr())},[u,ie,d,$e,U,R,Gr,L,WS,ri]),g3=y.useCallback(async()=>{if(!u||!L||K||Ae("hyperdoc.disableAutosave"))return;const $=u.type==="markdown"&&$e?U():d;await ri($,{pinned:u.type==="markdown"||u.type==="prompt"?u.pinned??!1:void 0})},[u,K,d,$e,U,L,Ae,ri]),QS=y.useCallback(async $=>{var B,X;try{const Z=(u==null?void 0:u.name)===$.name;let fe="",we=null,ae=[],Ce=$.pinned??!1;if(Z&&u)u.type==="markdown"?L?$e?fe=U():fe=d:fe=g:fe=d,ae=R,Ce=u.pinned??Ce,we=Q;else{const _n=await fetch(`${i}/doc/${encodeURIComponent($.name)}`,{cache:"no-store"});if(!_n.ok){m(`Failed to fetch document: ${_n.statusText}`);return}const xn=await _n.json();if(fe=xn.content??"",we=xn.mtimeMs??null,$.type==="markdown"||$.type==="prompt")ae=((B=xn.metadata)==null?void 0:B.tags)??$.tags??[],Ce=((X=xn.metadata)==null?void 0:X.pinned)??Ce;else{const Rr=st(fe);ae=(Rr==null?void 0:Rr.tags)??$.tags??[],Ce=(Rr==null?void 0:Rr.pinned)??Ce}}const We=!Ce,yn=await ri(fe,{name:$.name,type:$.type,tags:ae,pinned:We,baseVersion:we});if(!yn)return;ct(_n=>_n.map(xn=>xn.name===$.name?{...xn,pinned:We}:xn)),Z&&u&&(c(_n=>_n&&{..._n,pinned:We}),(u.type==="json"||u.type==="app"||u.type==="prompt")&&f(yn))}catch(Z){m(`Failed to toggle pinned: ${String(Z)}`)}},[u,i,d,Q,$e,U,R,L,g,st,ct,ri]),GS=y.useCallback(async $=>{try{const B=await fetch(`${i}/doc/${encodeURIComponent($.name)}/archive`,{method:"POST"});if(!B.ok){m(`Archive failed: ${B.statusText}`);return}ct(X=>X.filter(Z=>Z.name!==$.name)),(u==null?void 0:u.name)===$.name&&(c(null),F(`/${o==null?void 0:o.id}/docs`,{replace:!0}))}catch(B){m(`Archive failed: ${String(B)}`)}},[u,o==null?void 0:o.id,i,F,ct]),JS=y.useCallback(async $=>{try{const B=await fetch(`${i}/doc/${encodeURIComponent($.name)}`,{method:"DELETE"});if(!B.ok){m(`Delete failed: ${B.statusText}`);return}ct(X=>X.filter(Z=>Z.name!==$.name)),(u==null?void 0:u.name)===$.name&&(c(null),F(`/${o==null?void 0:o.id}/docs`,{replace:!0}))}catch(B){m(`Delete failed: ${String(B)}`)}},[u,o==null?void 0:o.id,i,F,ct]);Ade({active:u,isDirty:L,conflict:K,lastEditAt:O,autosave:g3,autosaveTimeoutRef:T,saveStatusStartRef:E,setSaveStatus:S}),y.useEffect(()=>{!u||u.type!=="json"&&u.type!=="app"&&u.type!=="prompt"&&u.type!=="tasks"||H(d!==g)},[d,u,g]),y.useEffect(()=>{if(!u||u.type!=="app")return;const $=BS(d,`${i}/bundles`);P($.config),I($.error??"")},[u,i,d,BS]);const ZS=y.useCallback(async()=>{if(!(o!=null&&o.id)){m("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"}));m(`Failed to open terminal: ${X.error||$.statusText}`);return}const B=await $.json();m(B.message||"Terminal opened successfully")}catch($){m(`Error opening terminal: ${$ instanceof Error?$.message:String($)}`),console.error("Error opening terminal:",$)}},[o==null?void 0:o.id,i,m]),YS=y.useMemo(()=>({activeDoc:u,announce:m,openCreateDialog:e,toggleDocPinned:QS,archiveDoc:GS,deleteDoc:JS,setAgentsSidebarOpen:n,createAgent:r,openInTerminal:ZS,openZapper:s,openCreateProject:l,openManageProjects:a}),[u,GS,r,JS,e,l,ZS,a,s,n,QS]),Gf=y.useCallback(async($,B)=>{if(!$)return;const X={...YS,...B};await $(X)},[YS]),XS=y.useCallback($=>{It(!1),F(`/${An($.name)}`,{replace:!0})},[An,F,It]),eC=y.useCallback($=>{It(!1),Gf($.run)},[Gf,It]),y3=y.useMemo(()=>{const $=new Set([...al,...R]);return Array.from($).sort()},[R,al]),x3=y.useCallback(async $=>{if(!u)return!1;const B=US($);if(Jh(B,ie))return!0;const X=ie;V(B),D(B),ct(we=>we.map(ae=>ae.name===u.name?{...ae,tags:B}:ae));const Z=u.type==="markdown"&&$e?U():d;return await ri(Z,{tags:B,pinned:u.type==="markdown"?u.pinned??!1:void 0})?(Gr(),!0):(V(X),D(X),ct(we=>we.map(ae=>ae.name===u.name?{...ae,tags:X}:ae)),!1)},[u,ie,d,$e,U,Gr,US,ct,ri]),v3=async $=>{const B=Yt($.title,$.type),X=$.folder?`${$.folder}/${B}`:B,fe=await(async ae=>{const Ce=$.title.trim(),We=$.type==="markdown"?`${Ay({title:Ce||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:Hde()},null,2):void 0,xn=$.type==="prompt"?"":void 0,Rr=$.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:Ce,name:ae,type:$.type,content:$.type==="markdown"?We:$.type==="json"?yn:$.type==="app"?_n:$.type==="tasks"?Rr:xn})})})(X);if(!fe.ok)throw new Error(`Create failed: ${fe.status}`);const we=await fe.json();ct(ae=>{const Ce=[...ae,we];return Ce.sort((We,yn)=>(We.displayName??We.name).localeCompare(yn.displayName??yn.name)),Ce}),$.tags.length>0&&Gr(),Qr(),F(`/${An(we.name)}`,{replace:!0})},w3=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}`);Qr()},b3=y.useCallback(async $=>{const B=await fetch(`${i}/folders/${encodeURIComponent($)}`,{method:"DELETE"});if(B.status===409){m("Cannot delete folder: it still contains documents. Move or delete them first.");return}if(!B.ok){m(`Delete folder failed: ${B.status}`);return}Qr()},[i,Qr]),k3=y.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){m(`Move failed: ${fe.status}`);return}const we=await fe.json();ct(ae=>{const Ce=ae.map(We=>We.name===$.name?{...We,...we}:We);return Ce.sort((We,yn)=>(We.displayName??We.name).localeCompare(yn.displayName??yn.name)),Ce}),(u==null?void 0:u.name)===$.name&&(c(ae=>ae&&{...ae,...we}),F(`/${An(we.name)}`,{replace:!0})),Qr()},[u,i,An,Qr,F,ct]),S3=y.useCallback($=>{const B=xc,X=B.columns.map(Ce=>Ce.id),Z=KS($.name,X),fe={id:Z,name:$.name,type:$.type,...$.type==="select"?{options:$.options??[]}:{}},we={columns:[...B.columns,fe]},ae=(yc??[]).map(Ce=>({...Ce,[Z]:$.type==="object"?null:""}));Qf(ae,{nextSchema:we})},[Qf,KS,xc,yc]),C3=y.useCallback($=>{const X={columns:xc.columns.filter(fe=>fe.id!==$)},Z=(yc??[]).map(fe=>{const{[$]:we,...ae}=fe;return ae});Qf(Z,{nextSchema:X})},[Qf,xc,yc]),E3=y.useMemo(()=>{if(!u)return null;if(u.type==="markdown"||u.type==="prompt")return{type:"markdown",metadata:{base64:null,decoded:null,json:{tags:ie,pinned:u.pinned??!1},error:null},rawMarkdown:d};if(u.type==="json")try{const $=JSON.parse(d);return{type:"json",prettyJson:JSON.stringify($,null,2),error:null,rawJson:d}}catch{return{type:"json",prettyJson:null,error:"Invalid JSON",rawJson:d}}if(u.type==="app"||u.type==="tasks")try{const $=JSON.parse(d);return{type:u.type,prettyJson:JSON.stringify($,null,2),error:null,rawJson:d}}catch{return{type:u.type,prettyJson:null,error:"Invalid JSON",rawJson:d}}return null},[u,ie,d]),N3=y.useMemo(()=>({open:bt,onOpenChange:It,activeDoc:u,commands:kt,onSelectDoc:XS,onRunCommand:eC}),[u,kt,bt,XS,eC,It]);return{sidebar:{tags:al,systemTagStatus:Ns,runCommandAction:Gf,active:u,navigate:F,encodePath:An,docs:Kn,folders:Es,createFolder:w3,deleteFolder:b3,moveDoc:k3},main:{active:u,editor:$e,tableDefaults:l3,tableView:a3,setTableView:u3,persistTableView:f3,jsonData:yc,effectiveSchema:xc,handleTableRowsChange:c3,handleAddRow:d3,addTableColumn:S3,deleteTableColumn:C3,parseColumnOptions:h3,jsonError:o3,content:d,setContent:f,setIsDirty:H,setLastEditAt:N,appConfig:j,appConfigError:z},dialogs:{infoInspector:E3,active:u,createDoc:v3},docHeader:{active:u,activeTitleLabel:qS,titleInputRef:Y,deriveFileName:Yt,renameDoc:p3,save:m3,saveStatus:C,status:h,conflict:K,openMetadataDialog:t,runCommandAction:Gf,pinDocCommand:Ak,archiveDocCommand:_k,deleteDocCommand:Ik,availableHeaderTags:y3,headerTags:R,applyHeaderTags:x3},commandPalette:{commandPaletteValue:N3}}},qde=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]}},Wde=(e,t,n)=>{y.useEffect(()=>{const r=e.filter(i=>i.shortcut),s=i=>{for(const o of r){const l=qde(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])},Kde=()=>{const[e,t]=y.useState(!1),[n,r]=y.useState("markdown"),[s,i]=y.useState(void 0),o=y.useCallback((l,a)=>{r(l),i(a),t(!0)},[]);return{open:e,setOpen:t,docType:n,setDocType:r,folder:s,openFor:o}},Qde=()=>{const[e,t]=y.useState(!1),n=y.useCallback(()=>t(!0),[]);return{open:e,setOpen:t,openDialog:n}},Gde=()=>{const[e,t]=y.useState(!1),n=y.useCallback(()=>t(!0),[]);return{open:e,setOpen:t,openDialog:n}};function Jde(){const e=$g(),t=Mf(),n=Ue.projects.list.useQuery(void 0,{refetchInterval:1e3}),r=y.useMemo(()=>n.data??[],[n.data]),s=y.useMemo(()=>nS(t.pathname),[t.pathname]),i=s.projectId,o=y.useMemo(()=>{var d,f;return i?r.find(h=>h.id===i)?i:((f=r[0])==null?void 0:f.id)??null:((d=r[0])==null?void 0:d.id)??null},[r,i]),l=s.sidebarTab;y.useEffect(()=>{if(r.length===0||i&&r.find(f=>f.id===i))return;const d=r[0];e(`/${d.id}/${l}`,{replace:!0})},[r,i,e,l]);const a=y.useCallback(d=>{e(`/${d}/${l}`,{replace:!0})},[e,l]),u=y.useMemo(()=>r.find(d=>d.id===o)??null,[r,o]),c=y.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=Kde(),t=Gde(),{activeProject:n}=$t(),r=(n==null?void 0:n.id)??"",{sidebarTab:s,panel:i,agentId:o,codeFilePath:l,navigateToTab:a,navigateToAgent:u,navigateToCodeFile:c}=ky(),[d,f]=y.useState(!1),{createAgent:h}=If(),m=y.useCallback(()=>{h(void 0,{onSuccess:S=>{u(r,S.id)}})},[h,u,r]),g=y.useCallback(S=>a(r,S),[a,r]),v=y.useCallback(S=>{S==="docs"?a(r,s):a(r,S)},[a,r,s]),x=y.useCallback(S=>u(r,S),[u,r]),w=y.useCallback(S=>c(r,S),[c,r]),b=Ude({openCreateDialog:e.openFor,openMetadataDialog:t.openDialog,setAgentsSidebarOpen:()=>{},createAgent:m,openZapper:()=>f(!0)}),C=y.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 Wde(b.commandPalette.commandPaletteValue.commands,C,b.commandPalette.commandPaletteValue.onRunCommand),p.jsx(KW,{value:e,children:p.jsx(Wae,{value:t,children:p.jsx(cne,{children:p.jsx(WW,{value:b,children:p.jsxs(M9,{value:b.commandPalette.commandPaletteValue,children:[p.jsx(rue,{}),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(Lre,{panel:i,onPanelChange:v}),i==="docs"&&p.jsx(Gne,{activeTab:s,onTabChange:g,selectedAgentId:o,onSelectAgent:x,activeCodeFile:l,onSelectCodeFile:w})]}),i==="settings"?p.jsx(Fre,{}):i==="commands"?p.jsx(Vre,{}):s==="code"&&l?p.jsx(HW,{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(Pne,{}):o?p.jsx(Uae,{agentId:o},o):p.jsx(qae,{})]}),p.jsx(VW,{}),p.jsx(Qae,{}),p.jsx(nue,{open:d,onClose:()=>f(!1)}),p.jsx(QW,{})]})]})})})})})}function Yde(){const e=Jde(),t=Qde(),[n,r]=y.useState(!1),s=y.useMemo(()=>({...e,openCreateProject:t.openDialog,openManageProjects:()=>r(!0)}),[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(PH,{value:s,children:[p.jsx(Zde,{},e.activeProject.id),p.jsx(xK,{controller:t}),p.jsx(SK,{open:n,onOpenChange:r})]}):null}const Gj=document.getElementById("root"),Jj=new CB;Gj&&CP(Gj).render(p.jsx(Ue.Provider,{client:OH,queryClient:Jj,children:p.jsx(EB,{client:Jj,children:p.jsx(Y5,{children:p.jsx(G5,{children:p.jsx(IP,{path:"/*",element:p.jsx(Yde,{})})})})})}));
|